/* Minification failed. Returning unminified contents.
(11317,11-12): run-time error JS1010: Expected identifier: .
(11317,11-12): run-time error JS1195: Expected expression: .
 */
/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(l.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:k&&!k.call("\ufeff\xa0")?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||n.guid++,e):void 0},now:function(){return+new Date},support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="<select t=''><option selected=''></option></select>",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=jb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=kb(b);function nb(){}nb.prototype=d.filters=d.pseudos,d.setFilters=new nb;function ob(a,b){var c,e,f,g,h,i,j,k=x[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=Q.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?db.error(a):x(a,i).slice(0)}function pb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=a.document,A=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,B=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:A.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:z,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=z.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return y.find(a);this.length=1,this[0]=d}return this.context=z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};B.prototype=n.fn,y=n(z);var C=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!n(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function E(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return E(a,"nextSibling")},prev:function(a){return E(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(D[a]||(e=n.unique(e)),C.test(a)&&(e=e.reverse())),this.pushStack(e)}});var F=/\S+/g,G={};function H(a){var b=G[a]={};return n.each(a.match(F)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?G[a]||H(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&n.each(arguments,function(a,c){var d;while((d=n.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){if(a===!0?!--n.readyWait:!n.isReady){if(!z.body)return setTimeout(n.ready);n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(z,[n]),n.fn.trigger&&n(z).trigger("ready").off("ready"))}}});function J(){z.addEventListener?(z.removeEventListener("DOMContentLoaded",K,!1),a.removeEventListener("load",K,!1)):(z.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(z.addEventListener||"load"===event.type||"complete"===z.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===z.readyState)setTimeout(n.ready);else if(z.addEventListener)z.addEventListener("DOMContentLoaded",K,!1),a.addEventListener("load",K,!1);else{z.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&z.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!n.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}J(),n.ready()}}()}return I.promise(b)};var L="undefined",M;for(M in n(l))break;l.ownLast="0"!==M,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c=z.getElementsByTagName("body")[0];c&&(a=z.createElement("div"),a.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",b=z.createElement("div"),c.appendChild(a).appendChild(b),typeof b.style.zoom!==L&&(b.style.cssText="border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1",(l.inlineBlockNeedsLayout=3===b.offsetWidth)&&(c.style.zoom=1)),c.removeChild(a),a=b=null)}),function(){var a=z.createElement("div");if(null==l.deleteExpando){l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}}a=null}(),n.acceptData=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(n.acceptData(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f
}}function S(a,b,c){if(n.acceptData(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},W=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},X=/^(?:checkbox|radio)$/i;!function(){var a=z.createDocumentFragment(),b=z.createElement("div"),c=z.createElement("input");if(b.setAttribute("className","t"),b.innerHTML="  <link/><table></table><a href='/a'>a</a>",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),l[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Y=/^(?:input|select|textarea)$/i,Z=/^key/,$=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;function bb(){return!0}function cb(){return!1}function db(){try{return z.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof n===L||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=ab.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(F)||[""],j=b.length;while(j--)if(h=ab.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,m,o=[d||z],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||z,3!==d.nodeType&&8!==d.nodeType&&!_.test(p+n.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[n.expando]?b:new n.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),k=n.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!n.isWindow(d)){for(i=k.delegateType||p,_.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||z)&&o.push(l.defaultView||l.parentWindow||a)}m=0;while((h=o[m++])&&!b.isPropagationStopped())b.type=m>1?i:k.bindType||p,f=(n._data(h,"events")||{})[b.type]&&n._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&n.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&n.acceptData(d)&&g&&d[p]&&!n.isWindow(d)){l=d[g],l&&(d[g]=null),n.event.triggered=p;try{d[p]()}catch(r){}n.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((n.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?n(c,this).index(i)>=0:n.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=$.test(e)?this.mouseHooks:Z.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||z),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||z,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==db()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===db()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return n.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=z.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===L&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&(a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault())?bb:cb):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:cb,isPropagationStopped:cb,isImmediatePropagationStopped:cb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=bb,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=bb,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submitBubbles||(n.event.special.submit={setup:function(){return n.nodeName(this,"form")?!1:void n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?b.form:void 0;c&&!n._data(c,"submitBubbles")&&(n.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),n._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return n.nodeName(this,"form")?!1:void n.event.remove(this,"._submit")}}),l.changeBubbles||(n.event.special.change={setup:function(){return Y.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),n.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),n.event.simulate("change",this,a,!0)})),!1):void n.event.add(this,"beforeactivate._change",function(a){var b=a.target;Y.test(b.nodeName)&&!n._data(b,"changeBubbles")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a,!0)}),n._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return n.event.remove(this,"._change"),!Y.test(this.nodeName)}}),l.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=cb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return n().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=cb),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});function eb(a){var b=fb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var fb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gb=/ jQuery\d+="(?:null|\d+)"/g,hb=new RegExp("<(?:"+fb+")[\\s/>]","i"),ib=/^\s+/,jb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,kb=/<([\w:]+)/,lb=/<tbody/i,mb=/<|&#?\w+;/,nb=/<(?:script|style|link)/i,ob=/checked\s*(?:[^=]|=\s*.checked.)/i,pb=/^$|\/(?:java|ecma)script/i,qb=/^true\/(.*)/,rb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,sb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},tb=eb(z),ub=tb.appendChild(z.createElement("div"));sb.optgroup=sb.option,sb.tbody=sb.tfoot=sb.colgroup=sb.caption=sb.thead,sb.th=sb.td;function vb(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==L?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==L?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,vb(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function wb(a){X.test(a.type)&&(a.defaultChecked=a.checked)}function xb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function yb(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function zb(a){var b=qb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ab(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}function Bb(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Cb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(yb(b).text=a.text,zb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&X.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}n.extend({clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!hb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ub.innerHTML=a.outerHTML,ub.removeChild(f=ub.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=vb(f),h=vb(a),g=0;null!=(e=h[g]);++g)d[g]&&Cb(e,d[g]);if(b)if(c)for(h=h||vb(a),d=d||vb(f),g=0;null!=(e=h[g]);g++)Bb(e,d[g]);else Bb(a,f);return d=vb(f,"script"),d.length>0&&Ab(d,!i&&vb(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,m=a.length,o=eb(b),p=[],q=0;m>q;q++)if(f=a[q],f||0===f)if("object"===n.type(f))n.merge(p,f.nodeType?[f]:f);else if(mb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(kb.exec(f)||["",""])[1].toLowerCase(),k=sb[i]||sb._default,h.innerHTML=k[1]+f.replace(jb,"<$1></$2>")+k[2],e=k[0];while(e--)h=h.lastChild;if(!l.leadingWhitespace&&ib.test(f)&&p.push(b.createTextNode(ib.exec(f)[0])),!l.tbody){f="table"!==i||lb.test(f)?"<table>"!==k[1]||lb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)n.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}n.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),l.appendChecked||n.grep(vb(p,"input"),wb),q=0;while(f=p[q++])if((!d||-1===n.inArray(f,d))&&(g=n.contains(f.ownerDocument,f),h=vb(o.appendChild(f),"script"),g&&Ab(h),c)){e=0;while(f=h[e++])pb.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.deleteExpando,m=n.event.special;null!=(d=a[h]);h++)if((b||n.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k?delete d[i]:typeof d.removeAttribute!==L?d.removeAttribute(i):d[i]=null,c.push(f))}}}),n.fn.extend({text:function(a){return W(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||z).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(vb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&Ab(vb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(vb(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return W(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(gb,""):void 0;if(!("string"!=typeof a||nb.test(a)||!l.htmlSerialize&&hb.test(a)||!l.leadingWhitespace&&ib.test(a)||sb[(kb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(jb,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(vb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(vb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&ob.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(i=n.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=n.map(vb(i,"script"),yb),f=g.length;k>j;j++)d=i,j!==o&&(d=n.clone(d,!0,!0),f&&n.merge(g,vb(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,n.map(g,zb),j=0;f>j;j++)d=g[j],pb.test(d.type||"")&&!n._data(d,"globalEval")&&n.contains(h,d)&&(d.src?n._evalUrl&&n._evalUrl(d.src):n.globalEval((d.text||d.textContent||d.innerHTML||"").replace(rb,"")));i=c=null}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],g=n(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Db,Eb={};function Fb(b,c){var d=n(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:n.css(d[0],"display");return d.detach(),e}function Gb(a){var b=z,c=Eb[a];return c||(c=Fb(a,b),"none"!==c&&c||(Db=(Db||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Db[0].contentWindow||Db[0].contentDocument).document,b.write(),b.close(),c=Fb(a,b),Db.detach()),Eb[a]=c),c}!function(){var a,b,c=z.createElement("div"),d="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";c.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],a.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(a.style.opacity),l.cssFloat=!!a.style.cssFloat,c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===c.style.backgroundClip,a=c=null,l.shrinkWrapBlocks=function(){var a,c,e,f;if(null==b){if(a=z.getElementsByTagName("body")[0],!a)return;f="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",c=z.createElement("div"),e=z.createElement("div"),a.appendChild(c).appendChild(e),b=!1,typeof e.style.zoom!==L&&(e.style.cssText=d+";width:1px;padding:1px;zoom:1",e.innerHTML="<div></div>",e.firstChild.style.width="5px",b=3!==e.offsetWidth),a.removeChild(c),a=c=e=null}return b}}();var Hb=/^margin/,Ib=new RegExp("^("+T+")(?!px)[a-z%]+$","i"),Jb,Kb,Lb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Jb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),Ib.test(g)&&Hb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):z.documentElement.currentStyle&&(Jb=function(a){return a.currentStyle},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ib.test(g)&&!Lb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Mb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h=z.createElement("div"),i="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",j="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";h.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",b=h.getElementsByTagName("a")[0],b.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(b.style.opacity),l.cssFloat=!!b.style.cssFloat,h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,b=h=null,n.extend(l,{reliableHiddenOffsets:function(){if(null!=c)return c;var a,b,d,e=z.createElement("div"),f=z.getElementsByTagName("body")[0];if(f)return e.setAttribute("className","t"),e.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=z.createElement("div"),a.style.cssText=i,f.appendChild(a).appendChild(e),e.innerHTML="<table><tr><td></td><td>t</td></tr></table>",b=e.getElementsByTagName("td"),b[0].style.cssText="padding:0;margin:0;border:0;display:none",d=0===b[0].offsetHeight,b[0].style.display="",b[1].style.display="none",c=d&&0===b[0].offsetHeight,f.removeChild(a),e=f=null,c},boxSizing:function(){return null==d&&k(),d},boxSizingReliable:function(){return null==e&&k(),e},pixelPosition:function(){return null==f&&k(),f},reliableMarginRight:function(){var b,c,d,e;if(null==g&&a.getComputedStyle){if(b=z.getElementsByTagName("body")[0],!b)return;c=z.createElement("div"),d=z.createElement("div"),c.style.cssText=i,b.appendChild(c).appendChild(d),e=d.appendChild(z.createElement("div")),e.style.cssText=d.style.cssText=j,e.style.marginRight=e.style.width="0",d.style.width="1px",g=!parseFloat((a.getComputedStyle(e,null)||{}).marginRight),b.removeChild(c)}return g}});function k(){var b,c,h=z.getElementsByTagName("body")[0];h&&(b=z.createElement("div"),c=z.createElement("div"),b.style.cssText=i,h.appendChild(b).appendChild(c),c.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;display:block;padding:1px;border:1px;width:4px;margin-top:1%;top:1%",n.swap(h,null!=h.style.zoom?{zoom:1}:{},function(){d=4===c.offsetWidth}),e=!0,f=!1,g=!0,a.getComputedStyle&&(f="1%"!==(a.getComputedStyle(c,null)||{}).top,e="4px"===(a.getComputedStyle(c,null)||{width:"4px"}).width),h.removeChild(b),c=h=null)}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Nb=/alpha\([^)]*\)/i,Ob=/opacity\s*=\s*([^)]*)/,Pb=/^(none|table(?!-c[ea]).+)/,Qb=new RegExp("^("+T+")(.*)$","i"),Rb=new RegExp("^([+-])=("+T+")","i"),Sb={position:"absolute",visibility:"hidden",display:"block"},Tb={letterSpacing:0,fontWeight:400},Ub=["Webkit","O","Moz","ms"];function Vb(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ub.length;while(e--)if(b=Ub[e]+c,b in a)return b;return d}function Wb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=n._data(d,"olddisplay",Gb(d.nodeName)))):f[g]||(e=V(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Xb(a,b,c){var d=Qb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Yb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Zb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Jb(a),g=l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Kb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ib.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Yb(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Kb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=Vb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Rb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]="",i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Vb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Kb(a,b,d)),"normal"===f&&b in Tb&&(f=Tb[b]),""===c||c?(e=parseFloat(f),c===!0||n.isNumeric(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&Pb.test(n.css(a,"display"))?n.swap(a,Sb,function(){return Zb(a,b,d)}):Zb(a,b,d):void 0},set:function(a,c,d){var e=d&&Jb(a);return Xb(a,c,d?Yb(a,b,d,l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Ob.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Nb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Nb.test(f)?f.replace(Nb,e):f+" "+e)}}),n.cssHooks.marginRight=Mb(l.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},Kb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Hb.test(a)||(n.cssHooks[a+b].set=Xb)}),n.fn.extend({css:function(a,b){return W(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Jb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)
},a,b,arguments.length>1)},show:function(){return Wb(this,!0)},hide:function(){return Wb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function $b(a,b,c,d,e){return new $b.prototype.init(a,b,c,d,e)}n.Tween=$b,$b.prototype={constructor:$b,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=$b.propHooks[this.prop];return a&&a.get?a.get(this):$b.propHooks._default.get(this)},run:function(a){var b,c=$b.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):$b.propHooks._default.set(this),this}},$b.prototype.init.prototype=$b.prototype,$b.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},$b.propHooks.scrollTop=$b.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=$b.prototype.init,n.fx.step={};var _b,ac,bc=/^(?:toggle|show|hide)$/,cc=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),dc=/queueHooks$/,ec=[jc],fc={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=cc.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&cc.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function gc(){return setTimeout(function(){_b=void 0}),_b=n.now()}function hc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=U[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function ic(a,b,c){for(var d,e=(fc[b]||[]).concat(fc["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function jc(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&V(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k=Gb(a.nodeName),"none"===j&&(j=k),"inline"===j&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==k?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],bc.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}if(!n.isEmptyObject(o)){r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=ic(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function kc(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function lc(a,b,c){var d,e,f=0,g=ec.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=_b||gc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:_b||gc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(kc(k,j.opts.specialEasing);g>f;f++)if(d=ec[f].call(j,a,k,j.opts))return d;return n.map(k,ic,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(lc,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],fc[c]=fc[c]||[],fc[c].unshift(b)},prefilter:function(a,b){b?ec.unshift(a):ec.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=lc(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&dc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(hc(b,!0),a,d,e)}}),n.each({slideDown:hc("show"),slideUp:hc("hide"),slideToggle:hc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(_b=n.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||n.fx.stop(),_b=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){ac||(ac=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(ac),ac=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e=z.createElement("div");e.setAttribute("className","t"),e.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=e.getElementsByTagName("a")[0],c=z.createElement("select"),d=c.appendChild(z.createElement("option")),b=e.getElementsByTagName("input")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==e.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=d.selected,l.enctype=!!z.createElement("form").enctype,c.disabled=!0,l.optDisabled=!d.disabled,b=z.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value,a=b=c=d=e=null}();var mc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(mc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.text(a)}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(l.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var nc,oc,pc=n.expr.attrHandle,qc=/^(?:checked|selected)$/i,rc=l.getSetAttribute,sc=l.input;n.fn.extend({attr:function(a,b){return W(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===L?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?oc:nc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(F);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)?sc&&rc||!qc.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(rc?c:d)},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),oc={set:function(a,b,c){return b===!1?n.removeAttr(a,c):sc&&rc||!qc.test(c)?a.setAttribute(!rc&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=pc[b]||n.find.attr;pc[b]=sc&&rc||!qc.test(b)?function(a,b,d){var e,f;return d||(f=pc[b],pc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,pc[b]=f),e}:function(a,b,c){return c?void 0:a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),sc&&rc||(n.attrHooks.value={set:function(a,b,c){return n.nodeName(a,"input")?void(a.defaultValue=b):nc&&nc.set(a,b,c)}}),rc||(nc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},pc.id=pc.name=pc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:nc.set},n.attrHooks.contenteditable={set:function(a,b,c){nc.set(a,""===b?!1:b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var tc=/^(?:input|select|textarea|button|object)$/i,uc=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return W(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):tc.test(a.nodeName)||uc.test(a.nodeName)&&a.href?0:-1}}}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var vc=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(F)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===L||"boolean"===c)&&(this.className&&n._data(this,"__className__",this.className),this.className=this.className||a===!1?"":n._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(vc," ").indexOf(b)>=0)return!0;return!1}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var wc=n.now(),xc=/\?/,yc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(yc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var zc,Ac,Bc=/#.*$/,Cc=/([?&])_=[^&]*/,Dc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ec=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Fc=/^(?:GET|HEAD)$/,Gc=/^\/\//,Hc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ic={},Jc={},Kc="*/".concat("*");try{Ac=location.href}catch(Lc){Ac=z.createElement("a"),Ac.href="",Ac=Ac.href}zc=Hc.exec(Ac.toLowerCase())||[];function Mc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(F)||[];if(n.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nc(a,b,c,d){var e={},f=a===Jc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Oc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&n.extend(!0,a,c),a}function Pc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Qc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ac,type:"GET",isLocal:Ec.test(zc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Oc(Oc(a,n.ajaxSettings),b):Oc(n.ajaxSettings,a)},ajaxPrefilter:Mc(Ic),ajaxTransport:Mc(Jc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Dc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||Ac)+"").replace(Bc,"").replace(Gc,zc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(F)||[""],null==k.crossDomain&&(c=Hc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===zc[1]&&c[2]===zc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(zc[3]||("http:"===zc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),Nc(Ic,k,b,v),2===t)return v;h=k.global,h&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Fc.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(xc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Cc.test(e)?e.replace(Cc,"$1_="+wc++):e+(xc.test(e)?"&":"?")+"_="+wc++)),k.ifModified&&(n.lastModified[e]&&v.setRequestHeader("If-Modified-Since",n.lastModified[e]),n.etag[e]&&v.setRequestHeader("If-None-Match",n.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Kc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Nc(Jc,k,b,v)){v.readyState=1,h&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Pc(k,v,c)),u=Qc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(n.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a))return this.each(function(b){n(this).wrapAll(a.call(this,b))});if(this[0]){var b=n(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!l.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||n.css(a,"display"))},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var Rc=/%20/g,Sc=/\[\]$/,Tc=/\r?\n/g,Uc=/^(?:submit|button|image|reset|file)$/i,Vc=/^(?:input|select|textarea|keygen)/i;function Wc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Sc.test(a)?d(a,e):Wc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Wc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Wc(c,a[c],b,e);return d.join("&").replace(Rc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Vc.test(this.nodeName)&&!Uc.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Tc,"\r\n")}}):{name:b.name,value:c.replace(Tc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&$c()||_c()}:$c;var Xc=0,Yc={},Zc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Yc)Yc[a](void 0,!0)}),l.cors=!!Zc&&"withCredentials"in Zc,Zc=l.ajax=!!Zc,Zc&&n.ajaxTransport(function(a){if(!a.crossDomain||l.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Xc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Yc[g],b=void 0,f.onreadystatechange=n.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Yc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function $c(){try{return new a.XMLHttpRequest}catch(b){}}function _c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=z.head||n("head")[0]||z.documentElement;return{send:function(d,e){b=z.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var ad=[],bd=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=ad.pop()||n.expando+"_"+wc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(bd.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&bd.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(bd,"$1"+e):b.jsonp!==!1&&(b.url+=(xc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,ad.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||z;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var cd=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&cd)return cd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=a.slice(h,a.length),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&n.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var dd=a.document.documentElement;function ed(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?(typeof e.getBoundingClientRect!==L&&(d=e.getBoundingClientRect()),c=ed(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||dd;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||dd})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return W(this,function(a,d,e){var f=ed(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Mb(l.pixelPosition,function(a,c){return c?(c=Kb(a,b),Ib.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return W(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var fd=a.jQuery,gd=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=gd),b&&a.jQuery===n&&(a.jQuery=fd),n},typeof b===L&&(a.jQuery=a.$=n),n});
;
/*! jQuery UI - v1.11.4 - 2015-03-11
* http://jqueryui.com
* Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/^(input|select|textarea|button|object)$/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function n(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent()[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.4",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}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return a?this.each(function(){var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):(o.length&&(n=e.widget.extend.apply(null,[n].concat(o))),this.each(function(){var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init()):e.data(this,s,new i(n,this))})),r}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var d=!1;e(document).mouseup(function(){d=!1}),e.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:a?e.position.scrollbarWidth():0,height:n?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s||n?i.width():i.outerWidth(),height:s||n?i.height():i.outerHeight()}}},e.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=e.extend({},n);var p,m,g,v,y,b,_=e(n.of),x=e.position.getWithinInfo(n.within),w=e.position.getScrollInfo(x),k=(n.collision||"flip").split(" "),T={};return b=s(_),_[0].preventDefault&&(n.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,t,i=(n[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),T[this]=[e?e[0]:0,t?t[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===n.at[0]?y.left+=m:"center"===n.at[0]&&(y.left+=m/2),"bottom"===n.at[1]?y.top+=g:"center"===n.at[1]&&(y.top+=g/2),p=t(T.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function(){var s,l,u=e(this),d=u.outerWidth(),c=u.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),D=d+f+i(this,"marginRight")+w.width,S=c+b+i(this,"marginBottom")+w.height,M=e.extend({},y),C=t(T.my,u.outerWidth(),u.outerHeight());"right"===n.my[0]?M.left-=d:"center"===n.my[0]&&(M.left-=d/2),"bottom"===n.my[1]?M.top-=c:"center"===n.my[1]&&(M.top-=c/2),M.left+=C[0],M.top+=C[1],a||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[k[t]]&&e.ui.position[k[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:D,collisionHeight:S,offset:[p[0]+C[0],p[1]+C[1]],my:n.my,at:n.at,within:x,elem:u})}),n.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,a=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.accordion",{version:"1.11.4",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,n=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),s=t.next(),n=s.uniqueId().attr("id");t.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(t=n.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?e():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:o?e():n,newPanel:r};t.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?e():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(e(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,t,i){var s,n,a,o=this,r=0,h=e.css("box-sizing"),l=e.length&&(!t.length||e.index()<t.index()),u=this.options.animate||{},d=l&&u.down||u,c=function(){o._toggleComplete(i)};return"number"==typeof d&&(a=d),"string"==typeof d&&(n=d),n=n||d.easing||u.easing,a=a||d.duration||u.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(this.hideProps,{duration:a,easing:n,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:a,easing:n,complete:c,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==o.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-r),r=0)}}),void 0):t.animate(this.hideProps,a,n,c):e.animate(this.showProps,a,n,c)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).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(t){if(!this.previousFilter){var i=e(t.currentTarget);
i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var i,s,n,a,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,s=this.previousFilter||"",n=String.fromCharCode(t.keyCode),a=!1,clearTimeout(this.filterTimer),n===s?a=!0:n=s+n,i=this._filterMenuItems(n),i=a&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(t.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(t,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,n=this.options.icons.submenu,a=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),a.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),s=e("<span>").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=a.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset().top-this.activeMenu.offset().top-i-s,a=this.activeMenu.scrollTop(),o=this.activeMenu.height(),r=t.outerHeight(),0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},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(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]()),this.focus(i,s)},nextPage:function(t){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=e(this),0>i.offset().top-s-n}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){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=e(this),i.offset().top-s+n>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)},_filterMenuItems:function(t){var i=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(e.trim(e(this).text()))})}}),e.widget("ui.autocomplete",{version:"1.11.4",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 t,i,s,n=this.element[0].nodeName.toLowerCase(),a="textarea"===n,o="input"===n;this.isMultiLine=a?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[a||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var a=e.ui.keyCode;switch(n.keyCode){case a.PAGE_UP:t=!0,this._move("previousPage",n);break;case a.PAGE_DOWN:t=!0,this._move("nextPage",n);break;case a.UP:t=!0,this._keyEvent("previous",n);break;case a.DOWN:t=!0,this._keyEvent("next",n);break;case a.ENTER:this.menu.active&&(t=!0,n.preventDefault(),this.menu.select(n));break;case a.TAB:this.menu.active&&this.menu.select(n);break;case a.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(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=e.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(e){return s?(s=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(s){s.target===t.element[0]||s.target===i||e.contains(i,s.target)||t.close()})})},menufocus:function(t,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:n})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&e.trim(s).length&&(this.liveRegion.children().hide(),e("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,s=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,s){s(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,n){s.xhr&&s.xhr.abort(),s.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){n(e)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),i=this.menu.element.is(":visible"),s=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!s)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var s=this;e.each(i,function(e,i){s._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var s=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return s.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var c,p="ui-button ui-widget ui-state-default ui-corner-all",f="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",m=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},g=function(t){var i=t.name,s=t.form,n=e([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?e(s).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),n};e.widget("ui.button",{version:"1.11.4",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,m),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,i=this.options,s="checkbox"===this.type||"radio"===this.type,n=s?"":"ui-state-active";null===i.label&&(i.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(p).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){i.disabled||this===c&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){i.disabled||e(this).removeClass(n)}).bind("click"+this.eventNamespace,function(e){i.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),s&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return i.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(i.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var s=t.element[0];g(s).not(s).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return i.disabled?!1:(e(this).addClass("ui-state-active"),c=this,t.document.one("mouseup",function(){c=null}),void 0)}).bind("mouseup"+this.eventNamespace,function(){return i.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return i.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",i.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(p+" ui-state-active "+f).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton(),void 0)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?g(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(f),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),s=this.options.icons,n=s.primary&&s.secondary,a=[];s.primary||s.secondary?(this.options.text&&a.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(a.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):a.push("ui-button-text-only"),t.addClass(a.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),i=this.element.find(this.options.items),s=i.filter(":ui-button");i.not(":ui-button").button(),s.button("refresh"),this.buttons=i.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.4"}});var v;e.extend(n.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return r(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var s,n,a;s=t.nodeName.toLowerCase(),n="div"===s||"span"===s,t.id||(this.uuid+=1,t.id="dp"+this.uuid),a=this._newInst(e(t),n),a.settings=e.extend({},i||{}),"input"===s?this._connectDatepicker(t,a):n&&this._inlineDatepicker(t,a)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?a(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var s=e(t);i.append=e([]),i.trigger=e([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,"datepicker",i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var s,n,a,o=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),o&&(i.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[r?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&t.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),a=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:a,alt:n,title:n}):e("<button type='button'></button>").addClass(this._triggerClass).html(a?e("<img/>").attr({src:a,alt:n,title:n}):n)),t[r?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,s,n,a=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(i=0,s=0,n=0;e.length>n;n++)e[n].length>i&&(i=e[n].length,s=n);return s},a.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),a.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())),e.input.attr("size",this._formatDate(e,a).length)}},_inlineDatepicker:function(t,i){var s=e(t);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,s,n,a){var o,h,l,u,d,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),r(c.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(c,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,l/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var i,s=e(t),n=e.data(t,"datepicker");s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),v===n&&(v=null))},_enableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,a.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,a.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,s){var n,a,o,h,l=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),a=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),r(l.settings,n),null!==o&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,o)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),l),this._autoSize(l),this._setDate(l,a),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,s,n,a=e.datepicker._getInst(t.target),o=!0,r=a.dpDiv.is(".ui-datepicker-rtl");if(a._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),o=!1;break;case 13:return n=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",a.dpDiv),n[0]&&e.datepicker._selectDay(t.target,a.selectedMonth,a.selectedYear,n[0]),i=e.datepicker._get(a,"onSelect"),i?(s=e.datepicker._formatDate(a),i.apply(a.input?a.input[0]:null,[s,a])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,s,n=e.datepicker._getInst(t.target);
return e.datepicker._get(n,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(t){var i,s=e.datepicker._getInst(t.target);if(s.input.val()!==s.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,e.datepicker._getFormatConfig(s)),i&&(e.datepicker._setDateFromField(s),e.datepicker._updateAlternate(s),e.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,n,a,o,h,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),n=e.datepicker._get(i,"beforeShow"),a=n?n.apply(t,[t,i]):{},a!==!1&&(r(i.settings,a),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),h={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),h=e.datepicker._checkOffset(i,h,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,v=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var i,s=this._getNumberOfMonths(t),n=s[1],a=17,r=t.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&t.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),t.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,s){var n=t.dpDiv.outerWidth(),a=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,r=t.input?t.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:e(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?n-o:0,i.left-=s&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=s&&i.top===t.input.offset().top+r?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+a>l&&l>a?Math.abs(a+r):0),i},_findPos:function(t){for(var i,s=this._getInst(t),n=this._get(s,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[n?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,s,n,a,o=this._curInst;!o||t&&o!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(o,"showAnim"),s=this._get(o,"duration"),n=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[i]||e.effects[i])?o.dpDiv.hide(i,e.datepicker._get(o,"showOptions"),s,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,a=this._get(o,"onClose"),a&&a.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),s=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==s)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,s){var n=e(t),a=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(a,i+("M"===s?this._get(a,"showCurrentAtPos"):0),s),this._updateDatepicker(a))},_gotoToday:function(t){var i,s=e(t),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(t,i,s){var n=e(t),a=this._getInst(n[0]);a["selected"+("M"===s?"Month":"Year")]=a["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(a),this._adjustDate(n)},_selectDay:function(t,i,s,n){var a,o=e(t);e(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(a=this._getInst(o[0]),a.selectedDay=a.currentDay=e("a",n).html(),a.selectedMonth=a.currentMonth=i,a.selectedYear=a.currentYear=s,this._selectDate(t,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var s,n=e(t),a=this._getInst(n[0]);i=null!=i?i:this._formatDate(a),a.input&&a.input.val(i),this._updateAlternate(a),s=this._get(a,"onSelect"),s?s.apply(a.input?a.input[0]:null,[i,a]):a.input&&a.input.trigger("change"),a.inline?this._updateDatepicker(a):(this._hideDatepicker(),this._lastInput=a.input[0],"object"!=typeof a.input[0]&&a.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,s,n,a=this._get(t,"altField");a&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),s=this._getDate(t),n=this.formatDate(i,s,this._getFormatConfig(t)),e(a).each(function(){e(this).val(n)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,s){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,a,o,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,c=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,v=-1,y=-1,b=!1,_=function(e){var i=t.length>n+1&&t.charAt(n+1)===e;return i&&n++,i},x=function(e){var t=_(e),s="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,n="y"===e?s:1,a=RegExp("^\\d{"+n+","+s+"}"),o=i.substring(h).match(a);if(!o)throw"Missing number at position "+h;return h+=o[0].length,parseInt(o[0],10)},w=function(t,s,n){var a=-1,o=e.map(_(t)?n:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,t){var s=t[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(a=t[0],h+=s.length,!1):void 0}),-1!==a)return a+1;throw"Unknown name at position "+h},k=function(){if(i.charAt(h)!==t.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;t.length>n;n++)if(b)"'"!==t.charAt(n)||_("'")?k():b=!1;else switch(t.charAt(n)){case"d":v=x("d");break;case"D":w("D",d,c);break;case"o":y=x("o");break;case"m":g=x("m");break;case"M":g=w("M",p,f);break;case"y":m=x("y");break;case"@":r=new Date(x("@")),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"!":r=new Date((x("!")-this._ticksTo1970)/1e4),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"'":_("'")?k():b=!0;break;default:k()}if(i.length>h&&(o=i.substr(h),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),y>-1)for(g=1,v=y;;){if(a=this._getDaysInMonth(m,g-1),a>=v)break;g++,v-=a}if(r=this._daylightSavingAdjust(new Date(m,g-1,v)),r.getFullYear()!==m||r.getMonth()+1!==g||r.getDate()!==v)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>s+1&&e.charAt(s+1)===t;return i&&s++,i},l=function(e,t,i){var s=""+t;if(h(e))for(;i>s.length;)s="0"+s;return s},u=function(e,t,i,s){return h(e)?s[t]:i[t]},d="",c=!1;if(t)for(s=0;e.length>s;s++)if(c)"'"!==e.charAt(s)||h("'")?d+=e.charAt(s):c=!1;else switch(e.charAt(s)){case"d":d+=l("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),n,a);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=l("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),o,r);break;case"y":d+=h("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(s)}return d},_possibleChars:function(e){var t,i="",s=!1,n=function(i){var s=e.length>t+1&&e.charAt(t+1)===i;return s&&t++,s};for(t=0;e.length>t;t++)if(s)"'"!==e.charAt(t)||n("'")?i+=e.charAt(t):s=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),s=e.lastVal=e.input?e.input.val():null,n=this._getDefaultDate(e),a=n,o=this._getFormatConfig(e);try{a=this.parseDate(i,s,o)||n}catch(r){s=t?"":s}e.selectedDay=a.getDate(),e.drawMonth=e.selectedMonth=a.getMonth(),e.drawYear=e.selectedYear=a.getFullYear(),e.currentDay=s?a.getDate():0,e.currentMonth=s?a.getMonth():0,e.currentYear=s?a.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,s){var n=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},a=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,a=n.getFullYear(),o=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":o+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o));break;case"y":case"Y":a+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o))}l=h.exec(i)}return new Date(a,o,r)},o=null==i||""===i?s:"string"==typeof i?a(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return o=o&&"Invalid Date"==""+o?s:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var s=!t,n=e.selectedMonth,a=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),n===e.selectedMonth&&a===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(s?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),s="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(s,-i,"M")},next:function(){e.datepicker._adjustDate(s,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(s)},selectDay:function(){return e.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(s,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,s,n,a,o,r,h,l,u,d,c,p,f,m,g,v,y,b,_,x,w,k,T,D,S,M,C,N,A,P,I,H,z,F,E,O,j,W,L=new Date,R=this._daylightSavingAdjust(new Date(L.getFullYear(),L.getMonth(),L.getDate())),Y=this._get(e,"isRTL"),B=this._get(e,"showButtonPanel"),J=this._get(e,"hideIfNoPrevNext"),q=this._get(e,"navigationAsDateFormat"),K=this._getNumberOfMonths(e),V=this._get(e,"showCurrentAtPos"),U=this._get(e,"stepMonths"),Q=1!==K[0]||1!==K[1],G=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),X=this._getMinMaxDate(e,"min"),$=this._getMinMaxDate(e,"max"),Z=e.drawMonth-V,et=e.drawYear;if(0>Z&&(Z+=12,et--),$)for(t=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-K[0]*K[1]+1,$.getDate())),t=X&&X>t?X:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=q?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-U,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":J?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(e,"nextText"),n=q?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z+U,1)),this._getFormatConfig(e)):n,a=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":J?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",o=this._get(e,"currentText"),r=this._get(e,"gotoCurrent")&&e.currentDay?G:R,o=q?this.formatDate(o,r,this._getFormatConfig(e)):o,h=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(e,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(Y?"":h)+"</div>":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",w=0;K[0]>w;w++){for(k="",this.maxRows=4,T=0;K[1]>T;T++){if(D=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),S=" ui-corner-all",M="",Q){if(M+="<div class='ui-datepicker-group",K[1]>1)switch(T){case 0:M+=" ui-datepicker-group-first",S=" ui-corner-"+(Y?"right":"left");break;case K[1]-1:M+=" ui-datepicker-group-last",S=" ui-corner-"+(Y?"left":"right");break;default:M+=" ui-datepicker-group-middle",S=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+S+"'>"+(/all|left/.test(S)&&0===w?Y?a:s:"")+(/all|right/.test(S)&&0===w?Y?s:a:"")+this._generateMonthYearHeader(e,Z,et,X,$,w>0||T>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",C=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",x=0;7>x;x++)N=(x+u)%7,C+="<th scope='col'"+((x+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+c[N]+"'>"+p[N]+"</span></th>";for(M+=C+"</tr></thead><tbody>",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),P=(this._getFirstDayOfMonth(et,Z)-u+7)%7,I=Math.ceil((P+A)/7),H=Q?this.maxRows>I?this.maxRows:I:I,this.maxRows=H,z=this._daylightSavingAdjust(new Date(et,Z,1-P)),F=0;H>F;F++){for(M+="<tr>",E=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(z)+"</td>":"",x=0;7>x;x++)O=g?g.apply(e.input?e.input[0]:null,[z]):[!0,""],j=z.getMonth()!==Z,W=j&&!y||!O[0]||X&&X>z||$&&z>$,E+="<td class='"+((x+u+6)%7>=5?" ui-datepicker-week-end":"")+(j?" ui-datepicker-other-month":"")+(z.getTime()===D.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===z.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(W?" "+this._unselectableClass+" ui-state-disabled":"")+(j&&!v?"":" "+O[1]+(z.getTime()===G.getTime()?" "+this._currentClass:"")+(z.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(j&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"&#39;")+"'")+(W?"":" data-handler='selectDay' data-event='click' data-month='"+z.getMonth()+"' data-year='"+z.getFullYear()+"'")+">"+(j&&!v?"&#xa0;":W?"<span class='ui-state-default'>"+z.getDate()+"</span>":"<a class='ui-state-default"+(z.getTime()===R.getTime()?" ui-state-highlight":"")+(z.getTime()===G.getTime()?" ui-state-active":"")+(j?" ui-priority-secondary":"")+"' href='#'>"+z.getDate()+"</a>")+"</td>",z.setDate(z.getDate()+1),z=this._daylightSavingAdjust(z);M+=E+"</tr>"}Z++,Z>11&&(Z=0,et++),M+="</tbody></table>"+(Q?"</div>"+(K[0]>0&&T===K[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),k+=M}_+=k}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,s,n,a,o,r){var h,l,u,d,c,p,f,m,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",_="";if(a||!g)_+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,_+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!h||u>=s.getMonth())&&(!l||n.getMonth()>=u)&&(_+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+r[u]+"</option>");_+="</select>"}if(y||(b+=_+(!a&&g&&v?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",a||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);return isNaN(t)?c:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=n?Math.min(m,n.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!a&&g&&v?"":"&#xa0;")+_),b+="</div>"},_adjustInstDate:function(e,t,i){var s=e.drawYear+("Y"===i?t:0),n=e.drawMonth+("M"===i?t:0),a=Math.min(e.selectedDay,this._getDaysInMonth(s,n))+("D"===i?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(s,n,a)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),n=i&&i>t?i:t;return s&&n>s?s:n},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,s){var n=this._getNumberOfMonths(e),a=this._daylightSavingAdjust(new Date(i,s+(0>t?t:n[0]*n[1]),1));return 0>t&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(e,a)},_isInRange:function(e,t){var i,s,n=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),o=null,r=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),o=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||t.getTime()>=n.getTime())&&(!a||t.getTime()<=a.getTime())&&(!o||t.getFullYear()>=o)&&(!r||r>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,s){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var n=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(s,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),n,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new n,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.4",e.datepicker,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(s){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper),n=s?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width()-this.helperProportions.width-this.margins.left,(e(a).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)
},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=e.extend({},i,{item:s.element});s.sortables=[],e(s.options.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,e.each(s.sortables,function(){var e=this;e.isOver?(e.isOver=0,s.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,n))})},drag:function(t,i,s){e.each(s.sortables,function(){var n=!1,a=this;a.positionAbs=s.positionAbs,a.helperProportions=s.helperProportions,a.offset.click=s.offset.click,a._intersectsWith(a.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==a&&this._intersectsWith(this.containerCache)&&e.contains(a.element[0],this.element[0])&&(n=!1),n})),n?(a.isOver||(a.isOver=1,s._parent=i.helper.parent(),a.currentItem=i.helper.appendTo(a.element).data("ui-sortable-item",!0),a.options._helper=a.options.helper,a.options.helper=function(){return i.helper[0]},t.target=a.currentItem[0],a._mouseCapture(t,!0),a._mouseStart(t,!0,!0),a.offset.click.top=s.offset.click.top,a.offset.click.left=s.offset.click.left,a.offset.parent.left-=s.offset.parent.left-a.offset.parent.left,a.offset.parent.top-=s.offset.parent.top-a.offset.parent.top,s._trigger("toSortable",t),s.dropped=a.element,e.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,a.fromOutside=s),a.currentItem&&(a._mouseDrag(t),i.position=a.position)):a.isOver&&(a.isOver=0,a.cancelHelperRemoval=!0,a.options._revert=a.options.revert,a.options.revert=!1,a._trigger("out",t,a._uiHash(a)),a._mouseStop(t,!0),a.options.revert=a.options._revert,a.options.helper=a.options._helper,a.placeholder&&a.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(t),i.position=s._generatePosition(t,!0),s._trigger("fromSortable",t),s.dropped=!1,e.each(s.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY<n.scrollSensitivity?o.scrollTop=a=o.scrollTop+n.scrollSpeed:t.pageY-s.overflowOffset.top<n.scrollSensitivity&&(o.scrollTop=a=o.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+o.offsetWidth-t.pageX<n.scrollSensitivity?o.scrollLeft=a=o.scrollLeft+n.scrollSpeed:t.pageX-s.overflowOffset.left<n.scrollSensitivity&&(o.scrollLeft=a=o.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(r).scrollTop()<n.scrollSensitivity?a=e(r).scrollTop(e(r).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(r).scrollTop())<n.scrollSensitivity&&(a=e(r).scrollTop(e(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(r).scrollLeft()<n.scrollSensitivity?a=e(r).scrollLeft(e(r).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(r).scrollLeft())<n.scrollSensitivity&&(a=e(r).scrollLeft(e(r).scrollLeft()+n.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var n=s.options;s.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var t=e(this),i=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i,s){var n,a,o,r,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left-s.margins.left,l=h+s.snapElements[c].width,u=s.snapElements[c].top-s.margins.top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return t[s]>0?!0:(t[s]=1,n=t[s]>0,t[s]=0,n)},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=e(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=e(this.handles[i]),this._on(this.handles[i],{mousedown:o._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var i,s,n,a=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=e(a.containment).scrollLeft()||0,s+=e(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s,n=this.originalMousePosition,a=this.axis,o=t.pageX-n.left||0,r=t.pageY-n.top||0,h=this._change[a];return this._updatePrevProperties(),h?(i=h.apply(this,[t,o,r]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,s,n,a,o=this.options;a={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,n=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),a.maxWidth>i&&(a.maxWidth=i),a.maxHeight>n&&(a.maxHeight=n)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,n=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,a=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),o&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),a&&l&&(e.left=r-t.minWidth),s&&l&&(e.left=r-t.maxWidth),o&&u&&(e.top=h-t.minHeight),n&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],s=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],n=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(s[t],10)||0,i[t]+=parseInt(n[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,n,a,o,r,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,a=h.containerSize.width,o=h._hasScroll(c,"left")?c.scrollWidth:a,r=h._hasScroll(c)?c.scrollHeight:n,h.parentData={element:c,left:s.left,top:s.top,width:o,height:r}))},resize:function(t){var i,s,n,a,o=e(this).resizable("instance"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,d={top:0,left:0},c=o.containerElement,p=!0;c[0]!==document&&/static/.test(c.css("position"))&&(d=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-d.left),u&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?h.top:0),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),i=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-d.left:o.offset.left-h.left)),s=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-d.top:o.offset.top-h.top)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options;e(i.alsoResize).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})},resize:function(t,i){var s=e(this).resizable("instance"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0};e(n.alsoResize).each(function(){var t=e(this),s=e(this).data("ui-resizable-alsoresize"),n={},a=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(a,function(e,t){var i=(s[t]||0)+(r[t]||0);i&&i>=0&&(n[t]=i||null)}),t.css(n)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,i=e(this).resizable("instance"),s=i.options,n=i.size,a=i.originalSize,o=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,u=h[1]||1,d=Math.round((n.width-a.width)/l)*l,c=Math.round((n.height-a.height)/u)*u,p=a.width+d,f=a.height+c,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,v=s.minWidth&&s.minWidth>p,y=s.minHeight&&s.minHeight>f;s.grid=h,v&&(p+=l),y&&(f+=u),m&&(p-=l),g&&(f-=u),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=o.top-c):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=o.left-d):((0>=f-u||0>=p-l)&&(t=i._getPaddingPlusBorderDimensions(this)),f-u>0?(i.size.height=f,i.position.top=o.top-c):(f=u-t.height,i.size.height=f,i.position.top=o.top+a.height-f),p-l>0?(i.size.width=p,i.position.left=o.left-d):(p=l-t.width,i.size.width=p,i.position.left=o.left+a.width-p))}}),e.ui.resizable,e.widget("ui.dialog",{version:"1.11.4",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(n){}this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),a=Math.max.apply(null,n);return a>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",a+1),s=!0),s&&!i&&this._trigger("focus",t),s},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0;
if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");t.target!==n[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==s[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){n.focus()}),t.preventDefault()):(this._delay(function(){s.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(i,function(i,s){var n,a;s=e.isFunction(s)?{click:s,text:i}:s,s=e.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(t.element[0],arguments)},a={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,e("<button></button>",s).button(a).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,t(n))},drag:function(e,s){i._trigger("drag",e,t(s))},stop:function(n,a){var o=a.offset.left-i.document.scrollLeft(),r=a.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(r>=0?"+":"")+r,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,t(a))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,s=this.options,n=s.resizable,a=this.uiDialog.css("position"),o="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:o,start:function(s,n){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,t(n))},resize:function(e,s){i._trigger("resize",e,t(s))},stop:function(n,a){var o=i.uiDialog.offset(),r=o.left-i.document.scrollLeft(),h=o.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,t(a))}}).css("position",a)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(s=!0),e in i.resizableRelatedOptions&&(n[e]=t)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,t){var i,s,n=this.uiDialog;"dialogClass"===e&&n.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=n.is(":data(ui-draggable)"),i&&!t&&n.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(s=n.is(":data(ui-resizable)"),s&&!t&&n.resizable("destroy"),s&&"string"==typeof t&&n.resizable("option","handles",t),s||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),e=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),t=Math.max(0,s.minHeight-e),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-e):"none","auto"===s.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.droppable",{version:"1.11.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s,n){if(!i.offset)return!1;var a=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,r=a+t.helperProportions.width,h=o+t.helperProportions.height,l=i.offset.left,u=i.offset.top,d=l+i.proportions().width,c=u+i.proportions().height;switch(s){case"fit":return a>=l&&d>=r&&o>=u&&c>=h;case"intersect":return a+t.helperProportions.width/2>l&&d>r-t.helperProportions.width/2&&o+t.helperProportions.height/2>u&&c>h-t.helperProportions.height/2;case"pointer":return e(n.pageY,u,i.proportions().height)&&e(n.pageX,l,i.proportions().width);case"touch":return(o>=u&&c>=o||h>=u&&c>=h||u>o&&h>c)&&(a>=l&&d>=a||r>=l&&d>=r||l>a&&r>d);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions().height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance,i),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===n}),a.length&&(s=e(a[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable;var y="ui-effects-",b=e;e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[u[l].cache]=o[u[l].cache],n=s._rgba=o._rgba,!1):t}),n.length?("0,0,0,0"===n.join()&&e.extend(n,a.transparent),s):a[i]}function n(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,n){return new e.Color.fn.parse(t,i,s,n)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(n,o,r,h){if(n===t)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=e(n).css(o),o=t);var d=this,c=e.type(n),p=this._rgba=[];return o!==t&&(n=[n,o,r,h],c="array"),"string"===c?this.parse(s(n)||a._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(n[t.idx],t)}),this):"object"===c?(n instanceof l?f(u,function(e,t){n[t.cache]&&(d[t.cache]=n[t.cache].slice())}):f(u,function(t,s){var a=s.cache;f(s.props,function(e,t){if(!d[a]&&s.to){if("alpha"===e||null==n[e])return;d[a]=s.to(d._rgba)}d[a][t.idx]=i(n[e],t,!0)}),d[a]&&0>e.inArray(null,d[a].slice(0,3))&&(d[a][3]=1,s.from&&(d._rgba=s.from(d[a])))}),this):t},is:function(e){var i=l(e),s=!0,n=this;return f(u,function(e,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(e,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),n=s._space(),a=u[n],o=0===this.alpha()?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice();return s=s[a.cache],f(a.props,function(e,n){var a=n.idx,o=r[a],l=s[a],u=d[n.type]||{};null!==l&&(null===o?h[a]=l:(u.mod&&(l-o>u.mod/2?o+=u.mod:o-l>u.mod/2&&(o-=u.mod)),h[a]=i((l-o)*t+o,n)))}),this[n](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*n[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,n=e[1]/255,a=e[2]/255,o=e[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,u=r+h,d=.5*u;return t=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==o?1:o]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],a=e[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,t+1/3)),Math.round(255*n(r,o,t)),Math.round(255*n(r,o,t-1/3)),a]},f(u,function(s,n){var a=n.props,o=n.cache,h=n.to,u=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===t)return this[o].slice();var n,r=e.type(s),d="array"===r||"object"===r?s:arguments,c=this[o].slice();return f(a,function(e,t){var s=d["object"===r?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(n=l(u(c)),n[o]=c,n):l(c)},f(a,function(t,i){l.fn[t]||(l.fn[t]=function(n){var a,o=e.type(n),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===o?u:("function"===o&&(n=n.call(this,u),o=e.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=u+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,n){var a,o,r="";if("transparent"!==n&&("string"!==e.type(n)||(a=s(n)))){if(n=l(a||n),!c.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?t.parentNode:t;(""===r||"transparent"===r)&&o&&o.style;)try{r=e.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{t.style[i]=n}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},a=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(b),function(){function t(t){var i,s,n=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[e.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function i(t,i){var s,a,o={};for(s in i)a=i[s],t[s]!==a&&(n[s]||(e.fx.step[s]||!isNaN(parseFloat(a)))&&(o[s]=a));return o}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(b.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(n,a,o,r){var h=e.speed(a,o,r);return this.queue(function(){var a,o=e(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack():o;l=l.map(function(){var i=e(this);return{el:i,start:t(this)}}),a=function(){e.each(s,function(e,t){n[t]&&o[t+"Class"](n[t])})},a(),l=l.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),o.attr("class",r),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(i,s,n,a){return s?e.effects.animateClass.call(this,{add:i},s,n,a):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,n,a){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,n,a):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,n,a,o){return"boolean"==typeof s||void 0===s?n?e.effects.animateClass.call(this,s?{add:i}:{remove:i},n,a,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,n,a)}}(e.fn.toggleClass),switchClass:function(t,i,s,n,a){return e.effects.animateClass.call(this,{add:i,remove:t},s,n,a)}})}(),function(){function t(t,i,s,n){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(n=s,s=i,i={}),e.isFunction(s)&&(n=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=n||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.4",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(y+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(y+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:t.width(),height:t.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return t.wrap(s),(t[0]===a||e.contains(t[0],a))&&e(a).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(n),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,n){return n=n||{},e.each(i,function(e,i){var a=t.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(a)&&a.call(n[0]),e.isFunction(t)&&t()}var n=e(this),a=s.complete,r=s.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),i()):o.call(n[0],s,i)}var s=t.apply(this,arguments),n=s.mode,a=s.queue,o=e.effects.effect[s.effect];return e.fx.off||!o?n?this[n](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):a===!1?this.each(i):this.queue(a||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var s,n,a,o=e(this),r=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(o,t.mode||"hide"),d=t.direction||"up",c=r.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u;o.parent().is(".ui-effects-wrapper")?e.effects.save(o.parent(),l):e.effects.save(o,l),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n=s[p](),a=parseFloat(s.css(f))||0,g[p]=v?n:0,m||(o.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?a:n+a),v&&(s.css(p,0),m||s.css(f,a+n)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&o.hide(),e.effects.restore(o,l),e.effects.removeWrapper(o),i()}})},e.effects.effect.bounce=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=o.queue(),_=b.length;for((u||l)&&r.push("opacity"),e.effects.save(o,r),o.show(),e.effects.createWrapper(o),c||(c=o["top"===v?"outerHeight":"outerWidth"]()/3),u&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,y?2*-c:2*c).animate(a,m,g)),l&&(c/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g).animate(a,m,g),c=l?2*c:c/2;l&&(n={opacity:0},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g)),o.queue(function(){l&&o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),o.dequeue()},e.effects.effect.clip=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(o,r),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[c](),l&&(n.css(c,0),n.css(p,a/2)),f[c]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}})},e.effects.effect.drop=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(n,t.mode||"hide"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:r?1:0};e.effects.save(n,a),n.show(),e.effects.createWrapper(n),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&n()}function n(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var a,o,r,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(a=0;d>a;a++)for(h=g.top+a*y,u=a-(d-1)/2,o=0;c>o;o++)r=g.left+o*v,l=o-(c-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:r+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,n,a=e(this),o=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"hide"),h="show"===r,l="hide"===r,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(a,o),a.show(),s=e.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*n[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?n[0]:u,v[f[1]]=h?n[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){l&&a.hide(),e.effects.restore(a,o),e.effects.removeWrapper(a),i()})},e.effects.effect.highlight=function(t,i){var s=e(this),n=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(s,t.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),e.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&s.hide(),e.effects.restore(s,n),i()}})},e.effects.effect.size=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=o.css("position"),y=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||s):(o.from=t.from||("show"===p?b:s),o.to=t.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(y=y.concat(d),o.from=e.effects.setTransition(o,d,a.from.y,o.from),o.to=e.effects.setTransition(o,d,a.to.y,o.to)),a.from.x!==a.to.x&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,a.from.x,o.from),o.to=e.effects.setTransition(o,c,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(y=y.concat(u).concat(l),o.from=e.effects.setTransition(o,u,a.from.y,o.from),o.to=e.effects.setTransition(o,u,a.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=e.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=r.concat(d).concat(c),o.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};
f&&e.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=e.effects.setTransition(i,d,a.from.y,i.from),i.to=e.effects.setTransition(i,d,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=e.effects.setTransition(i,c,a.from.x,i.from),i.to=e.effects.setTransition(i,c,a.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),e.effects.restore(o,y),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,i){var s=parseInt(i,10),n=e?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),e.effects.removeWrapper(o),i()}})},e.effects.effect.scale=function(t,i){var s=e(this),n=e.extend(!0,{},t),a=e.effects.setMode(s,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),r=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},e.effects.effect.puff=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"hide"),a="hide"===n,o=parseInt(t.percent,10)||150,r=o/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,n=e(this),a=e.effects.setMode(n,t.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=n.queue(),p=c.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),d=1),s=1;l>s;s++)n.animate({opacity:d},u,t.easing),d=1-d;n.animate({opacity:d},u,t.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),n.dequeue()},e.effects.effect.shake=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"effect"),r=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue(),y=v.length;for(e.effects.save(n,a),n.show(),e.effects.createWrapper(n),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,n.animate(f,d,t.easing),s=1;l>s;s++)n.animate(m,d,t.easing).animate(g,d,t.easing);n.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),n.dequeue()},e.effects.effect.slide=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(n,t.mode||"show"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(n,a),n.show(),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(r?u?"+=":"-=":u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.transfer=function(t,i){var s=e(this),n=e(t.to),a="fixed"===n.css("position"),o=e("body"),r=a?o.scrollTop():0,h=a?o.scrollLeft():0,l=n.offset(),u={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},d=s.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:d.top-r,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})},e.widget("ui.progressbar",{version:"1.11.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectable",e.ui.mouse,{version:"1.11.4",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.selectmenu",{version:"1.11.4",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this;this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,i){e.preventDefault(),t._setSelection(),t._select(i.item.data("ui-selectmenu-item"),e)},focus:function(e,i){var s=i.item.data("ui-selectmenu-item");null!=t.focusIndex&&s.index!==t.focusIndex&&(t._trigger("focus",e,{item:s}),t.isOpen||t._select(s,e)),t.focusIndex=s.index,t.button.attr("aria-activedescendant",t.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,i){var s=this,n="";e.each(i,function(i,a){a.optgroup!==n&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(a.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:a.optgroup}).appendTo(t),n=a.optgroup),s._renderItemData(t,a)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,i){var s=e("<li>");return i.disabled&&s.addClass("ui-state-disabled"),this._setText(s,i.label),s.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex):(i=this.menuItems.eq(this.element[0].selectedIndex),n+=":not(.ui-state-disabled)"),s="first"===e||"last"===e?i["first"===e?"prevAll":"nextAll"](n).eq(-1):i[e+"All"](n).eq(0),s.length&&this.menuInstance.focus(t,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;this.range&&(window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var i=[];t.each(function(t,s){var n=e(s),a=n.parent("optgroup");i.push({element:n,index:t,value:n.val(),label:n.text(),optgroup:a.attr("label")||"",disabled:a.prop("disabled")||n.prop("disabled")})}),this.items=i},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),t=n.length;i>t;t++)o.push(a);this.handles=n.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,a,o,r,h,l,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));(n>i||n===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(n=i,a=e(this),o=t)}),r=this._start(t,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),h=a.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-a.width()/2,top:t.pageY-h.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,n,a;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(n=this.values(),n[t]=i,a=this._trigger("slide",e,{handle:this.handles[t],value:i,values:n}),s=this.values(t?0:1),a!==!1&&this.values(t,i))):i!==this.value()&&(a=this._trigger("slide",e,{handle:this.handles[t],value:i}),a!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(t,i){var s,n,a;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),void 0;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(t,i){var s,n=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(n=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!i),this._super(t,i),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),i=this.options.step,s=Math.floor(+(e-t).toFixed(this._precision())/i)*i;e=s+t,this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,i,s,n,a,o=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:r.animate}))),t=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(t){var i,s,n,a,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),i=this._start(t,o),i===!1))return}switch(a=this.options.step,s=n=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:n=this._valueMin();break;case e.ui.keyCode.END:n=this._valueMax();break;case e.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+a);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-a)}this._slide(t,o,n)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.4",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(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,a.widgetName+"-item")===a?(s=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),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},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.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(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this));
return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(t),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-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-this.document.scrollTop()<o.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<o.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),t.pageX-this.document.scrollLeft()<o.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),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],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!e.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.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,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].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(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=e.left,o=a+e.width,r=e.top,h=r+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>r&&h>s+l,c="y"===this.options.axis||t+u>a&&o>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return s?this.floating?a&&"right"===a||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){r.push(this)}var s,n,a,o,r=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(a=e(l[s],this.document[0]),n=a.length-1;n>=0;n--)o=e.data(a[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&h.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(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 e(r)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(n=e(c[i],this.document[0]),s=n.length-1;s>=0;s--)a=e.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(d.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(i=d.length-1;i>=0;i--)for(o=d[i][1],r=d[i][0],s=0,l=r.length;l>s;s++)h=e(r[s]),h.data(this.widgetName+"-item",o),u.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){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,a;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?e(this.options.toleranceElement,s.item):s.item,t||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.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--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.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(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),n=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===s?t._createTrPlaceholder(t.currentItem.find("tr").eq(0),e("<tr>",t.document[0]).appendTo(n)):"tr"===s?t._createTrPlaceholder(t.currentItem,n):"img"===s&&n.attr("src",t.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(e,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_createTrPlaceholder:function(t,i){var s=this;t.children().each(function(){e("<td>&#160;</td>",s.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(t){var i,s,n,a,o,r,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,a=null,u=c.floating||this._isFloating(this.currentItem),o=u?"left":"top",r=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.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()[o],l=!1,t[d]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(t[d]-h)&&(n=Math.abs(t[d]-h),a=this.items[s],this.direction=l?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("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(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.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 t,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.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(t=e(n.containment)[0],i=e(n.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(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():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(t){var i,s,n=this.options,a=t.pageX,o=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.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&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=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((a-this.originalPageX)/n.grid[0])*n.grid[0],a=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:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.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(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}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).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||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,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.spinner",{version:"1.11.4",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,s){var n=i.attr(s);void 0!==n&&n.length&&(t[s]=n)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:h(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:h(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:h(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:h(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:h(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(h(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.4",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var i,s;t=t.cloneNode(!1),i=t.href.replace(e,""),s=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return t.hash.length>1&&i===s}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===t&&(s&&this.tabs.each(function(i,n){return e(n).attr("aria-controls")===s?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:n=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),t.ctrlKey||t.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function s(){return t>n&&(t=0),0>t&&(t=n),t}for(var n=this.tabs.length-1;-1!==e.inArray(s(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,i=this.tabs,s=this.anchors,n=this.panels;
this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var n,a,o,r=e(s).uniqueId().attr("id"),h=e(s).closest("li"),l=h.attr("aria-controls");t._isLocal(s)?(n=s.hash,o=n.substring(1),a=t.element.find(t._sanitizeSelector(n))):(o=h.attr("aria-controls")||e({}).uniqueId()[0].id,n="#"+o,a=t.element.find(n),a.length||(a=t._createPanel(o),a.insertAfter(t.panels[i-1]||t.tablist)),a.attr("aria-live","polite")),a.length&&(t.panels=t.panels.add(a)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":o,"aria-labelledby":r}),a.attr("aria-labelledby",r)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,s=this.element.parent();"fill"===t?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n.closest("li"),o=a[0]===s[0],r=o&&i.collapsible,h=r?e():this._getPanelForTab(a),l=s.length?this._getPanelForTab(s):e(),u={oldTab:s,oldPanel:l,newTab:r?e():a,newPanel:h};t.preventDefault(),a.hasClass("ui-state-disabled")||a.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=r?!1:this.tabs.index(a),this.active=o?e():a,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(a),t),this._toggle(t,u))},_toggle:function(t,i){function s(){a.running=!1,a._trigger("activate",t,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&a.options.show?a._show(o,a.options.show,s):(o.show(),s())}var a=this,o=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&r.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var s=this,n=this.tabs.eq(t),a=n.find(".ui-tabs-anchor"),o=this._getPanelForTab(n),r={tab:n,panel:o},h=function(e,t){"abort"===t&&s.panels.stop(!1,!0),n.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr};this._isLocal(a[0])||(this.xhr=e.ajax(this._ajaxSettings(a,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(n.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.done(function(e,t,n){setTimeout(function(){o.html(e),s._trigger("load",i,r),h(n,t)},1)}).fail(function(e,t){setTimeout(function(){h(e,t)},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href"),beforeSend:function(t,a){return n._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:a},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.4",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),n=e.inArray(i,s);-1!==n&&s.splice(n,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t.element)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur");n.target=n.currentTarget=s.element[0],t.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&s.parents().each(function(){var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(t,s),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,n=this,a=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){n._delay(function(){e.data("ui-tooltip-open")&&(t&&(t.type=a),this._open(t,e,i))})}),i&&this._open(t,e,i),void 0)},_open:function(t,i,s){function n(e){l.of=e,o.is(":hidden")||o.position(l)}var a,o,r,h,l=e.extend({},this.options.position);if(s){if(a=this._find(i))return a.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),a=this._tooltip(i),o=a.tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),s.clone?(h=s.clone(),h.removeAttr("id").find("[id]").removeAttr("id")):h=s,e("<div>").html(h).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:n}),n(t)):o.position(e.extend({of:i},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){o.is(":visible")&&(n(l.of),clearInterval(r))},e.fx.interval)),this._trigger("open",t,{tooltip:o})}},_registerCloseHandlers:function(t,i){var s={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var s=e.Event(t);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),t&&"mouseover"!==t.type||(s.mouseleave="close"),t&&"focusin"!==t.type||(s.focusout="close"),this._on(!0,i,s)},close:function(t){var i,s=this,n=e(t?t.currentTarget:this.element),a=this._find(n);return a?(i=a.tooltip,a.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),a.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(e(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete s.parents[t]}),a.closing=!0,this._trigger("close",t,{tooltip:i}),a.hiding||(a.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(t){var i=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),s=i.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[s]={element:t,tooltip:i}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur"),a=s.element;n.target=n.currentTarget=a[0],t.close(n,!0),e("#"+i).remove(),a.data("ui-tooltip-title")&&(a.attr("title")||a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}})});;
/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * _example $.cookie('the_cookie', 'the_value');
 * _desc Set the value of a cookie.
 * _example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * _desc Create a cookie with all available options.
 * _example $.cookie('the_cookie', 'the_value');
 * _desc Create a session cookie.
 * _example $.cookie('the_cookie', null);
 * _desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * _param String name The name of the cookie.
 * _param String value The value of the cookie.
 * _param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * _option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * _option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * _option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * _option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * _type undefined
 *
 * _name $.cookie
 * _cat Plugins/Cookie
 * _author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * example $.cookie('the_cookie');
 * desc Get the value of a cookie.
 *
 * param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};


;
/*!
 AnythingSlider v1.9.4 minified using Google Closure Compiler
 Original by Chris Coyier: http://css-tricks.com
 Get the latest version: https://github.com/CSS-Tricks/AnythingSlider
*/
;(function(d,l,n){d.anythingSlider=function(m,p){var a=this,b,k;a.el=m;a.$el=d(m).addClass("anythingBase").wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');a.$el.data("AnythingSlider",a);a.init=function(){a.options=b=d.extend({},d.anythingSlider.defaults,p);a.initialized=!1;d.isFunction(b.onBeforeInitialize)&&a.$el.bind("before_initialize",b.onBeforeInitialize);a.$el.trigger("before_initialize",a);d('\x3c!--[if lte IE 8]><script>jQuery("body").addClass("as-oldie");\x3c/script><![endif]--\x3e').appendTo("body").remove(); a.$wrapper=a.$el.parent().closest("div.anythingSlider").addClass("anythingSlider-"+b.theme);a.$outer=a.$wrapper.parent();a.$window=a.$el.closest("div.anythingWindow");a.$win=d(l);a.$controls=d('<div class="anythingControls"></div>');a.$nav=d('<ul class="thumbNav"><li><a><span></span></a></li></ul>');a.$startStop=d('<a href="#" class="start-stop"></a>');(b.buildStartStop||b.buildNavigation)&&a.$controls.appendTo(b.appendControlsTo&&d(b.appendControlsTo).length?d(b.appendControlsTo):a.$wrapper);b.buildNavigation&& a.$nav.appendTo(b.appendNavigationTo&&d(b.appendNavigationTo).length?d(b.appendNavigationTo):a.$controls);b.buildStartStop&&a.$startStop.appendTo(b.appendStartStopTo&&d(b.appendStartStopTo).length?d(b.appendStartStopTo):a.$controls);a.runTimes=d(".anythingBase").length;a.regex=b.hashTags?RegExp("panel"+a.runTimes+"-(\\d+)","i"):null;1===a.runTimes&&a.makeActive();a.flag=!1;b.autoPlayLocked&&(b.autoPlay=!0);a.playing=b.autoPlay;a.slideshow=!1;a.hovered=!1;a.panelSize=[];a.currentPage=a.targetPage= b.startPanel=parseInt(b.startPanel,10)||1;b.changeBy=parseInt(b.changeBy,10)||1;k=(b.mode||"h").toLowerCase().match(/(h|v|f)/);k=b.vertical?"v":(k||["h"])[0];b.mode="v"===k?"vertical":"f"===k?"fade":"horizontal";"f"===k&&(b.showMultiple=1,b.infiniteSlides=!1);a.adj=b.infiniteSlides?0:1;a.adjustMultiple=0;b.playRtl&&a.$wrapper.addClass("rtl");b.buildStartStop&&a.buildAutoPlay();b.buildArrows&&a.buildNextBackButtons();a.$lastPage=a.$targetPage=a.$currentPage;if(b.expand){if(!0===b.aspectRatio)b.aspectRatio= a.$el.width()/a.$el.height();else if("string"===typeof b.aspectRatio&&-1!==b.aspectRatio.indexOf(":")){var c=b.aspectRatio.split(":");b.aspectRatio=c[0]/c[1]}0<b.aspectRatio&&1<b.showMultiple&&(b.aspectRatio*=b.showMultiple)}a.updateSlider();b.expand&&(a.$window.css({width:"100%",height:"100%"}),a.checkResize());d.isFunction(d.easing[b.easing])||(b.easing="swing");b.pauseOnHover&&a.$wrapper.hover(function(){a.playing&&(a.$el.trigger("slideshow_paused",a),a.clearTimer(!0))},function(){a.playing&&(a.$el.trigger("slideshow_unpaused", a),a.startStop(a.playing,!0))});a.slideControls(!1);a.$wrapper.bind("mouseenter mouseleave",function(b){d(this)["mouseenter"===b.type?"addClass":"removeClass"]("anythingSlider-hovered");a.hovered="mouseenter"===b.type?!0:!1;a.slideControls(a.hovered)});d(n).keyup(function(c){if(b.enableKeyboard&&a.$wrapper.hasClass("activeSlider")&&!c.target.tagName.match("TEXTAREA|INPUT|SELECT")&&("vertical"===b.mode||38!==c.which&&40!==c.which))switch(c.which){case 39:case 40:a.goForward();break;case 37:case 38:a.goBack()}}); a.currentPage=(b.hashTags?a.gotoHash():"")||b.startPanel||1;a.gotoPage(a.currentPage,!1,null,-1);var f="slideshow_resized slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");d.each("onSliderResize onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "),function(c,h){d.isFunction(b[h])&&a.$el.bind(f[c],b[h])});d.isFunction(b.onSlideComplete)&&a.$el.bind("slide_complete", function(){setTimeout(function(){b.onSlideComplete(a)},0);return!1});a.initialized=!0;a.$el.trigger("initialized",a);a.startStop(b.autoPlay)};a.updateSlider=function(){a.$el.children(".cloned").remove();a.navTextVisible="hidden"!==a.$nav.find("span:first").css("visibility");a.$nav.empty();a.currentPage=a.currentPage||1;a.$items=a.$el.children();a.pages=a.$items.length;a.dir="vertical"===b.mode?"top":"left";b.showMultiple=parseInt(b.showMultiple,10)||1;b.navigationSize=!1===b.navigationSize?0:parseInt(b.navigationSize, 10)||0;a.$items.find("a").unbind("focus.AnythingSlider").bind("focus.AnythingSlider",function(c){var f=d(this).closest(".panel"),f=a.$items.index(f)+a.adj;a.$items.find(".focusedLink").removeClass("focusedLink");d(this).addClass("focusedLink");a.$window.scrollLeft(0).scrollTop(0);-1!==f&&(f>=a.currentPage+b.showMultiple||f<a.currentPage)&&(a.gotoPage(f),c.preventDefault())});1<b.showMultiple&&(b.showMultiple>a.pages&&(b.showMultiple=a.pages),a.adjustMultiple=b.infiniteSlides&&1<a.pages?0:b.showMultiple- 1);a.$controls.add(a.$nav).add(a.$startStop).add(a.$forward).add(a.$back)[1>=a.pages?"hide":"show"]();1<a.pages&&a.buildNavigation();"fade"!==b.mode&&b.infiniteSlides&&1<a.pages&&(a.$el.prepend(a.$items.filter(":last").clone().addClass("cloned")),1<b.showMultiple?a.$el.append(a.$items.filter(":lt("+b.showMultiple+")").clone().addClass("cloned multiple")):a.$el.append(a.$items.filter(":first").clone().addClass("cloned")),a.$el.find(".cloned").each(function(){d(this).find("a,input,textarea,select,button,area,form").attr({disabled:"disabled", name:""});d(this).find("[id]")[d.fn.addBack?"addBack":"andSelf"]().removeAttr("id")}));a.$items=a.$el.addClass(b.mode).children().addClass("panel");a.setDimensions();b.resizeContents?(a.$items.css("width",a.width),a.$wrapper.css("width",a.getDim(a.currentPage)[0]).add(a.$items).css("height",a.height)):a.$win.load(function(){a.setDimensions();k=a.getDim(a.currentPage);a.$wrapper.css({width:k[0],height:k[1]});a.setCurrentPage(a.currentPage,!1)});a.currentPage>a.pages&&(a.currentPage=a.pages);a.setCurrentPage(a.currentPage, !1);a.$nav.find("a").eq(a.currentPage-1).addClass("cur");"fade"===b.mode&&(k=a.$items.eq(a.currentPage-1),b.resumeOnVisible?k.css({opacity:1,visibility:"visible"}).siblings().css({opacity:0,visibility:"hidden"}):(a.$items.css("opacity",1),k.fadeIn(0).siblings().fadeOut(0)))};a.buildNavigation=function(){if(b.buildNavigation&&1<a.pages){var c,f,e,h,g;a.$items.filter(":not(.cloned)").each(function(q){g=d("<li/>");e=q+1;f=(1===e?" first":"")+(e===a.pages?" last":"");c='<a class="panel'+e+(a.navTextVisible? '"':" "+b.tooltipClass+'" title="@"')+' href="#"><span>@</span></a>';d.isFunction(b.navigationFormatter)?(h=b.navigationFormatter(e,d(this)),"string"===typeof h?g.html(c.replace(/@/g,h)):g=d("<li/>",h)):g.html(c.replace(/@/g,e));g.appendTo(a.$nav).addClass(f).data("index",e)});a.$nav.children("li").bind(b.clickControls,function(c){!a.flag&&b.enableNavigation&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.gotoPage(d(this).data("index")));c.preventDefault()});b.navigationSize&&b.navigationSize< a.pages&&(a.$controls.find(".anythingNavWindow").length||a.$nav.before('<ul><li class="prev"><a href="#"><span>'+b.backText+"</span></a></li></ul>").after('<ul><li class="next"><a href="#"><span>'+b.forwardText+"</span></a></li></ul>").wrap('<div class="anythingNavWindow"></div>'),a.navWidths=a.$nav.find("li").map(function(){return d(this).outerWidth(!0)+Math.ceil(parseInt(d(this).find("span").css("left"),10)/2||0)}).get(),a.navLeft=a.currentPage,a.$nav.width(a.navWidth(1,a.pages+1)+25),a.$controls.find(".anythingNavWindow").width(a.navWidth(1, b.navigationSize+1)).end().find(".prev,.next").bind(b.clickControls,function(c){a.flag||(a.flag=!0,setTimeout(function(){a.flag=!1},200),a.navWindow(a.navLeft+b.navigationSize*(d(this).is(".prev")?-1:1)));c.preventDefault()}))}};a.navWidth=function(b,f){var e;e=Math.min(b,f);for(var d=Math.max(b,f),g=0;e<d;e++)g+=a.navWidths[e-1]||0;return g};a.navWindow=function(c){if(b.navigationSize&&b.navigationSize<a.pages&&a.navWidths){var f=a.pages-b.navigationSize+1;c=1>=c?1:1<c&&c<f?c:f;c!==a.navLeft&&(a.$controls.find(".anythingNavWindow").animate({scrollLeft:a.navWidth(1, c),width:a.navWidth(c,c+b.navigationSize)},{queue:!1,duration:b.animationTime}),a.navLeft=c)}};a.buildNextBackButtons=function(){a.$forward=d('<span class="arrow forward"><a href="#"><span>'+b.forwardText+"</span></a></span>");a.$back=d('<span class="arrow back"><a href="#"><span>'+b.backText+"</span></a></span>");a.$back.bind(b.clickBackArrow,function(c){b.enableArrows&&!a.flag&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goBack());c.preventDefault()});a.$forward.bind(b.clickForwardArrow, function(c){b.enableArrows&&!a.flag&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goForward());c.preventDefault()});a.$back.add(a.$forward).find("a").bind("focusin focusout",function(){d(this).toggleClass("hover")});a.$back.appendTo(b.appendBackTo&&d(b.appendBackTo).length?d(b.appendBackTo):a.$wrapper);a.$forward.appendTo(b.appendForwardTo&&d(b.appendForwardTo).length?d(b.appendForwardTo):a.$wrapper);a.arrowWidth=a.$forward.width();a.arrowRight=parseInt(a.$forward.css("right"),10);a.arrowLeft= parseInt(a.$back.css("left"),10)};a.buildAutoPlay=function(){a.$startStop.html("<span>"+(a.playing?b.stopText:b.startText)+"</span>").bind(b.clickSlideshow,function(c){b.enableStartStop&&(a.startStop(!a.playing),a.makeActive(),a.playing&&!b.autoPlayDelayed&&a.goForward(!0,b.playRtl));c.preventDefault()}).bind("focusin focusout",function(){d(this).toggleClass("hover")})};a.checkResize=function(b){var f=!!(n.hidden||n.webkitHidden||n.mozHidden||n.msHidden);clearTimeout(a.resizeTimer);a.resizeTimer= setTimeout(function(){var e=a.$outer.width(),d="BODY"===a.$outer[0].tagName?a.$win.height():a.$outer.height();f||a.lastDim[0]===e&&a.lastDim[1]===d||(a.setDimensions(),a.$el.trigger("slideshow_resized",a),a.gotoPage(a.currentPage,a.playing,null,-1));"undefined"===typeof b&&a.checkResize()},f?2E3:500)};a.setDimensions=function(){a.$wrapper.find(".anythingWindow, .anythingBase, .panel")[d.fn.addBack?"addBack":"andSelf"]().css({width:"",height:""});a.width=a.$el.width();a.height=a.$el.height();a.outerPad= [a.$wrapper.innerWidth()-a.$wrapper.width(),a.$wrapper.innerHeight()-a.$wrapper.height()];var c,f,e,h,g=0,m={width:"100%",height:"100%"},k=1<b.showMultiple&&"horizontal"===b.mode?a.width||a.$window.width()/b.showMultiple:a.$window.width(),n=1<b.showMultiple&&"vertical"===b.mode?a.height/b.showMultiple||a.$window.height()/b.showMultiple:a.$window.height();if(b.expand){a.lastDim=[a.$outer.width(),a.$outer.height()];c=a.lastDim[0]-a.outerPad[0];f=a.lastDim[1]-a.outerPad[1];if(b.aspectRatio&&b.aspectRatio< a.width){var l=f*b.aspectRatio;l<c?c=l:(l=c/b.aspectRatio,l<f&&(f=l))}a.$wrapper.add(a.$window).css({width:c,height:f});a.height=f=1<b.showMultiple&&"vertical"===b.mode?n:f;a.width=k=1<b.showMultiple&&"horizontal"===b.mode?c/b.showMultiple:c;a.$items.css({width:k,height:n})}a.$items.each(function(l){h=d(this);e=h.children();b.resizeContents?(c=a.width,f=a.height,h.css({width:c,height:f}),e.length&&("EMBED"===e[0].tagName&&e.attr(m),"OBJECT"===e[0].tagName&&e.find("embed").attr(m),1===e.length&&e.css(m))): ("vertical"===b.mode?(c=h.css("display","inline-block").width(),h.css("display","")):c=h.width()||a.width,1===e.length&&c>=k&&(c=e.width()>=k?k:e.width(),e.css("max-width",c)),h.css({width:c,height:""}),f=1===e.length?e.outerHeight(!0):h.height(),f<=a.outerPad[1]&&(f=a.height),h.css("height",f));a.panelSize[l]=[c,f,g];g+="vertical"===b.mode?f:c});a.$el.css("vertical"===b.mode?"height":"width","fade"===b.mode?a.width:g)};a.getDim=function(c){var f,e,d=a.width,g=a.height;if(1>a.pages||isNaN(c))return[d, g];c=b.infiniteSlides&&1<a.pages?c:c-1;if(e=a.panelSize[c])d=e[0]||d,g=e[1]||g;if(1<b.showMultiple)for(e=1;e<b.showMultiple;e++)f=c+e,"vertical"===b.mode?(d=Math.max(d,a.panelSize[f][0]),g+=a.panelSize[f][1]):(d+=a.panelSize[f][0],g=Math.max(g,a.panelSize[f][1]));return[d,g]};a.goForward=function(c,d){a.gotoPage(a[b.allowRapidChange?"targetPage":"currentPage"]+b.changeBy*(d?-1:1),c)};a.goBack=function(c){a.gotoPage(a[b.allowRapidChange?"targetPage":"currentPage"]-b.changeBy,c)};a.gotoPage=function(c, f,e,h){!0!==f&&(f=!1,a.startStop(!1),a.makeActive());/^[#|.]/.test(c)&&d(c).length&&(c=d(c).closest(".panel").index()+a.adj);if(1!==b.changeBy){var g=a.pages-a.adjustMultiple;1>c&&(c=b.stopAtEnd?1:b.infiniteSlides?a.pages+c:b.showMultiple>1-c?1:g);c>a.pages?c=b.stopAtEnd?a.pages:b.showMultiple>1-c?1:c-=g:c>=g&&(c=g)}1>=a.pages||(a.$lastPage=a.$currentPage,"number"!==typeof c&&(c=parseInt(c,10)||b.startPanel,a.setCurrentPage(c)),f&&b.isVideoPlaying(a)||(b.stopAtEnd&&!b.infiniteSlides&&c>a.pages-b.showMultiple&& (c=a.pages-b.showMultiple+1),a.exactPage=c,c>a.pages+1-a.adj&&(c=b.infiniteSlides||b.stopAtEnd?a.pages:1),c<a.adj&&(c=b.infiniteSlides||b.stopAtEnd?1:a.pages),b.infiniteSlides||(a.exactPage=c),a.currentPage=c>a.pages?a.pages:1>c?1:a.currentPage,a.$currentPage=a.$items.eq(a.currentPage-a.adj),a.targetPage=0===c?a.pages:c>a.pages?1:c,a.$targetPage=a.$items.eq(a.targetPage-a.adj),h="undefined"!==typeof h?h:b.animationTime,0<=h&&a.$el.trigger("slide_init",a),0<h&&!0===b.toggleControls&&a.slideControls(!0), b.buildNavigation&&a.setNavigation(a.targetPage),!0!==f&&(f=!1),(!f||b.stopAtEnd&&c===a.pages)&&a.startStop(!1),0<=h&&a.$el.trigger("slide_begin",a),setTimeout(function(d){var f,g=!0;b.allowRapidChange&&a.$wrapper.add(a.$el).add(a.$items).stop(!0,!0);b.resizeContents||(f=a.getDim(c),d={},a.$wrapper.width()!==f[0]&&(d.width=f[0]||a.width,g=!1),a.$wrapper.height()!==f[1]&&(d.height=f[1]||a.height,g=!1),g||a.$wrapper.filter(":not(:animated)").animate(d,{queue:!1,duration:0>h?0:h,easing:b.easing}));"fade"=== b.mode?a.$lastPage[0]!==a.$targetPage[0]?(a.fadeIt(a.$lastPage,0,h),a.fadeIt(a.$targetPage,1,h,function(){a.endAnimation(c,e,h)})):a.endAnimation(c,e,h):(d={},d[a.dir]=-a.panelSize[b.infiniteSlides&&1<a.pages?c:c-1][2],"vertical"!==b.mode||b.resizeContents||(d.width=f[0]),a.$el.filter(":not(:animated)").animate(d,{queue:!1,duration:0>h?0:h,easing:b.easing,complete:function(){a.endAnimation(c,e,h)}}))},parseInt(b.delayBeforeAnimate,10)||0)))};a.endAnimation=function(c,d,e){0===c?(a.$el.css(a.dir,"fade"=== b.mode?0:-a.panelSize[a.pages][2]),c=a.pages):c>a.pages&&(a.$el.css(a.dir,"fade"===b.mode?0:-a.panelSize[1][2]),c=1);a.exactPage=c;a.setCurrentPage(c,!1);"fade"===b.mode&&a.fadeIt(a.$items.not(":eq("+(c-a.adj)+")"),0,0);a.hovered||a.slideControls(!1);b.hashTags&&a.setHash(c);0<=e&&a.$el.trigger("slide_complete",a);"function"===typeof d&&d(a);b.autoPlayLocked&&!a.playing&&setTimeout(function(){a.startStop(!0)},b.resumeDelay-(b.autoPlayDelayed?b.delay:0))};a.fadeIt=function(a,f,e,h){var g=a.filter(":not(:animated)"); a=0>e?0:e;if(b.resumeOnVisible)1===f&&g.css("visibility","visible"),g.fadeTo(a,f,function(){0===f&&g.css("visibility","hidden");d.isFunction(h)&&h()});else g[0===f?"fadeOut":"fadeIn"](a,h)};a.setCurrentPage=function(c,d){c=parseInt(c,10);if(!(1>a.pages||0===c||isNaN(c))){c>a.pages+1-a.adj&&(c=a.pages-a.adj);c<a.adj&&(c=1);b.buildArrows&&!b.infiniteSlides&&b.stopAtEnd&&(a.$forward[c===a.pages-a.adjustMultiple?"addClass":"removeClass"]("disabled"),a.$back[1===c?"addClass":"removeClass"]("disabled"), c===a.pages&&a.playing&&a.startStop());if(!d){var e=a.getDim(c);a.$wrapper.css({width:e[0],height:e[1]}).add(a.$window).scrollLeft(0).scrollTop(0);a.$el.css(a.dir,"fade"===b.mode?0:-a.panelSize[b.infiniteSlides&&1<a.pages?c:c-1][2])}a.currentPage=c;a.$currentPage=a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage");b.buildNavigation&&a.setNavigation(c)}};a.setNavigation=function(b){a.$nav.find(".cur").removeClass("cur").end().find("a").eq(b-1).addClass("cur")};a.makeActive=function(){a.$wrapper.hasClass("activeSlider")|| (d(".activeSlider").removeClass("activeSlider"),a.$wrapper.addClass("activeSlider"))};a.gotoHash=function(){var c=l.location.hash,f=c.indexOf("&"),e=c.match(a.regex);null!==e||/^#&/.test(c)||/#!?\//.test(c)||/\=/.test(c)?null!==e&&(e=b.hashTags?parseInt(e[1],10):null):(c=c.substring(0,0<=f?f:c.length),e=d(c).length&&d(c).closest(".anythingBase")[0]===a.el?a.$items.index(d(c).closest(".panel"))+a.adj:null);return e};a.setHash=function(b){var d="panel"+a.runTimes+"-",e=l.location.hash;"undefined"!== typeof e&&(l.location.hash=0<e.indexOf(d)?e.replace(a.regex,d+b):e+"&"+d+b)};a.slideControls=function(c){var d=c?"slideDown":"slideUp",e=c?0:b.animationTime,h=c?b.animationTime:0,g=c?1:0;c=c?0:1;b.toggleControls&&a.$controls.stop(!0,!0).delay(e)[d](b.animationTime/2).delay(h);b.buildArrows&&b.toggleArrows&&(!a.hovered&&a.playing&&(c=1,g=0),a.$forward.stop(!0,!0).delay(e).animate({right:a.arrowRight+c*a.arrowWidth,opacity:g},b.animationTime/2),a.$back.stop(!0,!0).delay(e).animate({left:a.arrowLeft+ c*a.arrowWidth,opacity:g},b.animationTime/2))};a.clearTimer=function(b){a.timer&&(l.clearInterval(a.timer),!b&&a.slideshow&&(a.$el.trigger("slideshow_stop",a),a.slideshow=!1))};a.startStop=function(c,d){!0!==c&&(c=!1);(a.playing=c)&&!d&&(a.$el.trigger("slideshow_start",a),a.slideshow=!0);b.buildStartStop&&(a.$startStop.toggleClass("playing",c).find("span").html(c?b.stopText:b.startText),"hidden"===a.$startStop.find("span").css("visibility")&&a.$startStop.addClass(b.tooltipClass).attr("title",c?b.stopText: b.startText));c?(a.clearTimer(!0),a.timer=l.setInterval(function(){n.hidden||n.webkitHidden||n.mozHidden||n.msHidden?b.autoPlayLocked||a.startStop():b.isVideoPlaying(a)?b.resumeOnVideoEnd||a.startStop():a.goForward(!0,b.playRtl)},b.delay)):a.clearTimer()};a.init()};d.anythingSlider.defaults={theme:"default",mode:"horiz",expand:!1,resizeContents:!0,showMultiple:!1,easing:"swing",buildArrows:!0,buildNavigation:!0,buildStartStop:!0,toggleArrows:!1,toggleControls:!1,startText:"Start",stopText:"Stop", forwardText:"&raquo;",backText:"&laquo;",tooltipClass:"tooltip",enableArrows:!0,enableNavigation:!0,enableStartStop:!0,enableKeyboard:!0,startPanel:1,changeBy:1,hashTags:!0,infiniteSlides:!0,navigationFormatter:null,navigationSize:!1,autoPlay:!1,autoPlayLocked:!1,autoPlayDelayed:!1,pauseOnHover:!0,stopAtEnd:!1,playRtl:!1,delay:3E3,resumeDelay:15E3,animationTime:600,delayBeforeAnimate:0,clickForwardArrow:"click",clickBackArrow:"click",clickControls:"click focusin",clickSlideshow:"click",allowRapidChange:!1, resumeOnVideoEnd:!0,resumeOnVisible:!0,isVideoPlaying:function(d){return!1}};d.fn.anythingSlider=function(m,l){return this.each(function(){var a,b=d(this).data("AnythingSlider");(typeof m).match("object|undefined")?b?b.updateSlider():new d.anythingSlider(this,m):/\d/.test(m)&&!isNaN(m)&&b?(a="number"===typeof m?m:parseInt(d.trim(m),10),1<=a&&a<=b.pages&&b.gotoPage(a,!1,l)):/^[#|.]/.test(m)&&d(m).length&&b.gotoPage(m,!1,l)})}})(jQuery,window,document);

/*!
	Colorbox 1.6.4
	license: MIT
	http://www.jacklmoore.com/colorbox
*/
(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!U){U=$=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),S=t('<button type="button"/>').attr({id:Z+"Slideshow"}),L),B=t('<button type="button"/>').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(R).add(S)),e.body&&!x.parent().length&&t(e.body).append(v,x.append(y,M))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;U&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),U&&_.get("arrowKey")&&W[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if($=!0,q=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-N-j:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-z-D:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-z-D,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-N-j,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){L.show()},100),_.get("inline")){var c=t(e).eq(0);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),q=_.get("createImg"),t(q).addClass(Z+"Photo").bind("error."+Z,function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;_.get("retinaImage")&&i.devicePixelRatio>1&&(q.height=q.height/i.devicePixelRatio,q.width=q.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){q.height-=q.height*e,q.width-=q.width*e},_.mw&&q.width>_.mw&&(e=(q.width-_.mw)/q.width,o()),_.mh&&q.height>_.mh&&(e=(q.height-_.mh)/q.height,o())),_.h&&(q.style.marginTop=Math.max(_.mh-q.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+1])&&(q.style.cursor="pointer",t(q).bind("click."+Z,function(){J.next()})),q.style.width=q.width+"px",q.style.height=q.height+"px",h(q)},1)}),q.src=e):e&&M.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,x,y,b,T,C,H,k,W,E,I,M,L,F,R,S,K,P,B,O,_,j,D,N,z,A,q,U,$,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),n=t(this).data("cbox-iframe-attrs");return"object"==typeof n&&t.each(n,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("<a/>"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[A+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){S.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),x.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),S.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),x.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,S.hide(),t(),ae.unbind(ne,e).unbind(ie,t),x.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),S.show())}}();t[Y]||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;return e=e||{},t.isFunction(o)&&(o=t("<a/>"),e.open=!0),o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(x[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(x[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=x.offset();if(E.unbind("resize."+Z),x.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,x.css({position:"fixed"})):(l=h,d=s,x.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-z-D-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-z-D,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-N-j-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-N-j,0)/2),x.css({top:c.top,left:c.left,visibility:"visible"}),y[0].style.width=y[0].style.height="9999px",r={width:_.w+z+D,height:_.h+N+j,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||x.css(r),x.dequeue().animate(r,{duration:e||0,complete:function(){n(),$=!1,y[0].style.width=_.w+z+D+"px",y[0].style.height=_.h+N+j+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;U&&(t=t||{},t.width&&(_.w=a(t.width,"x")-z-D),t.innerWidth&&(_.w=a(t.innerWidth,"x")),I.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-N-j),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),_.h=I.height()),I.css({height:_.h}),e&&I.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||I.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||I.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if(U){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(M.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),M.hide(),t(q).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var n,o,a=W.length;U&&(o=function(){clearTimeout(Q),L.hide(),u(ne),_.get("onComplete")},F.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&R.html(_.get("current").replace("{current}",A+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>A?"show":"hide"]().html(_.get("next")),P[_.get("loop")||A?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):O.hide(),_.get("iframe")?(n=_.get("createIframe"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?x.fadeTo(g,1,i):i())},"fade"===_.get("transition")?x.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!$&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!$&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){U&&!G&&(G=!0,U=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),x.stop().fadeTo(_.get("fadeOut")||0,0,function(){x.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){x&&(x.stop(),t[Y].close(),x.stop(!1,!0).remove(),v.remove(),G=!1,x=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);

//! moment.js
//! version : 2.6.0
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
(function(a){function b(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function c(a,b){function c(){ib.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+a)}var d=!0;return i(function(){return d&&(c(),d=!1),b.apply(this,arguments)},b)}function d(a,b){return function(c){return l(a.call(this,c),b)}}function e(a,b){return function(c){return this.lang().ordinal(a.call(this,c),b)}}function f(){}function g(a){y(a),i(this,a)}function h(a){var b=r(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._bubble()}function i(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return b.hasOwnProperty("toString")&&(a.toString=b.toString),b.hasOwnProperty("valueOf")&&(a.valueOf=b.valueOf),a}function j(a){var b,c={};for(b in a)a.hasOwnProperty(b)&&wb.hasOwnProperty(b)&&(c[b]=a[b]);return c}function k(a){return 0>a?Math.ceil(a):Math.floor(a)}function l(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}function m(a,b,c,d){var e=b._milliseconds,f=b._days,g=b._months;d=null==d?!0:d,e&&a._d.setTime(+a._d+e*c),f&&db(a,"Date",cb(a,"Date")+f*c),g&&bb(a,cb(a,"Month")+g*c),d&&ib.updateOffset(a,f||g)}function n(a){return"[object Array]"===Object.prototype.toString.call(a)}function o(a){return"[object Date]"===Object.prototype.toString.call(a)||a instanceof Date}function p(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&t(a[d])!==t(b[d]))&&g++;return g+f}function q(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=Zb[a]||$b[b]||b}return a}function r(a){var b,c,d={};for(c in a)a.hasOwnProperty(c)&&(b=q(c),b&&(d[b]=a[c]));return d}function s(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}ib[b]=function(e,f){var g,h,i=ib.fn._lang[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=ib().utc().set(d,a);return i.call(ib.fn._lang,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function t(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function u(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function v(a,b,c){return $(ib([a,11,31+b-c]),b,c).week}function w(a){return x(a)?366:365}function x(a){return a%4===0&&a%100!==0||a%400===0}function y(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[pb]<0||a._a[pb]>11?pb:a._a[qb]<1||a._a[qb]>u(a._a[ob],a._a[pb])?qb:a._a[rb]<0||a._a[rb]>23?rb:a._a[sb]<0||a._a[sb]>59?sb:a._a[tb]<0||a._a[tb]>59?tb:a._a[ub]<0||a._a[ub]>999?ub:-1,a._pf._overflowDayOfYear&&(ob>b||b>qb)&&(b=qb),a._pf.overflow=b)}function z(a){return null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&a._pf.overflow<0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length)),a._isValid}function A(a){return a?a.toLowerCase().replace("_","-"):a}function B(a,b){return b._isUTC?ib(a).zone(b._offset||0):ib(a).local()}function C(a,b){return b.abbr=a,vb[a]||(vb[a]=new f),vb[a].set(b),vb[a]}function D(a){delete vb[a]}function E(a){var b,c,d,e,f=0,g=function(a){if(!vb[a]&&xb)try{require("./lang/"+a)}catch(b){}return vb[a]};if(!a)return ib.fn._lang;if(!n(a)){if(c=g(a))return c;a=[a]}for(;f<a.length;){for(e=A(a[f]).split("-"),b=e.length,d=A(a[f+1]),d=d?d.split("-"):null;b>0;){if(c=g(e.slice(0,b).join("-")))return c;if(d&&d.length>=b&&p(e,d,!0)>=b-1)break;b--}f++}return ib.fn._lang}function F(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function G(a){var b,c,d=a.match(Bb);for(b=0,c=d.length;c>b;b++)d[b]=cc[d[b]]?cc[d[b]]:F(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function H(a,b){return a.isValid()?(b=I(b,a.lang()),_b[b]||(_b[b]=G(b)),_b[b](a)):a.lang().invalidDate()}function I(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Cb.lastIndex=0;d>=0&&Cb.test(a);)a=a.replace(Cb,c),Cb.lastIndex=0,d-=1;return a}function J(a,b){var c,d=b._strict;switch(a){case"Q":return Nb;case"DDDD":return Pb;case"YYYY":case"GGGG":case"gggg":return d?Qb:Fb;case"Y":case"G":case"g":return Sb;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?Rb:Gb;case"S":if(d)return Nb;case"SS":if(d)return Ob;case"SSS":if(d)return Pb;case"DDD":return Eb;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Ib;case"a":case"A":return E(b._l)._meridiemParse;case"X":return Lb;case"Z":case"ZZ":return Jb;case"T":return Kb;case"SSSS":return Hb;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?Ob:Db;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Db;case"Do":return Mb;default:return c=new RegExp(R(Q(a.replace("\\","")),"i"))}}function K(a){a=a||"";var b=a.match(Jb)||[],c=b[b.length-1]||[],d=(c+"").match(Xb)||["-",0,0],e=+(60*d[1])+t(d[2]);return"+"===d[0]?-e:e}function L(a,b,c){var d,e=c._a;switch(a){case"Q":null!=b&&(e[pb]=3*(t(b)-1));break;case"M":case"MM":null!=b&&(e[pb]=t(b)-1);break;case"MMM":case"MMMM":d=E(c._l).monthsParse(b),null!=d?e[pb]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[qb]=t(b));break;case"Do":null!=b&&(e[qb]=t(parseInt(b,10)));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=t(b));break;case"YY":e[ob]=ib.parseTwoDigitYear(b);break;case"YYYY":case"YYYYY":case"YYYYYY":e[ob]=t(b);break;case"a":case"A":c._isPm=E(c._l).isPM(b);break;case"H":case"HH":case"h":case"hh":e[rb]=t(b);break;case"m":case"mm":e[sb]=t(b);break;case"s":case"ss":e[tb]=t(b);break;case"S":case"SS":case"SSS":case"SSSS":e[ub]=t(1e3*("0."+b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=K(b);break;case"w":case"ww":case"W":case"WW":case"d":case"dd":case"ddd":case"dddd":case"e":case"E":a=a.substr(0,1);case"gg":case"gggg":case"GG":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=b)}}function M(a){var b,c,d,e,f,g,h,i,j,k,l=[];if(!a._d){for(d=O(a),a._w&&null==a._a[qb]&&null==a._a[pb]&&(f=function(b){var c=parseInt(b,10);return b?b.length<3?c>68?1900+c:2e3+c:c:null==a._a[ob]?ib().weekYear():a._a[ob]},g=a._w,null!=g.GG||null!=g.W||null!=g.E?h=_(f(g.GG),g.W||1,g.E,4,1):(i=E(a._l),j=null!=g.d?X(g.d,i):null!=g.e?parseInt(g.e,10)+i._week.dow:0,k=parseInt(g.w,10)||1,null!=g.d&&j<i._week.dow&&k++,h=_(f(g.gg),k,j,i._week.doy,i._week.dow)),a._a[ob]=h.year,a._dayOfYear=h.dayOfYear),a._dayOfYear&&(e=null==a._a[ob]?d[ob]:a._a[ob],a._dayOfYear>w(e)&&(a._pf._overflowDayOfYear=!0),c=W(e,0,a._dayOfYear),a._a[pb]=c.getUTCMonth(),a._a[qb]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=l[b]=d[b];for(;7>b;b++)a._a[b]=l[b]=null==a._a[b]?2===b?1:0:a._a[b];l[rb]+=t((a._tzm||0)/60),l[sb]+=t((a._tzm||0)%60),a._d=(a._useUTC?W:V).apply(null,l)}}function N(a){var b;a._d||(b=r(a._i),a._a=[b.year,b.month,b.day,b.hour,b.minute,b.second,b.millisecond],M(a))}function O(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function P(a){a._a=[],a._pf.empty=!0;var b,c,d,e,f,g=E(a._l),h=""+a._i,i=h.length,j=0;for(d=I(a._f,g).match(Bb)||[],b=0;b<d.length;b++)e=d[b],c=(h.match(J(e,a))||[])[0],c&&(f=h.substr(0,h.indexOf(c)),f.length>0&&a._pf.unusedInput.push(f),h=h.slice(h.indexOf(c)+c.length),j+=c.length),cc[e]?(c?a._pf.empty=!1:a._pf.unusedTokens.push(e),L(e,c,a)):a._strict&&!c&&a._pf.unusedTokens.push(e);a._pf.charsLeftOver=i-j,h.length>0&&a._pf.unusedInput.push(h),a._isPm&&a._a[rb]<12&&(a._a[rb]+=12),a._isPm===!1&&12===a._a[rb]&&(a._a[rb]=0),M(a),y(a)}function Q(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function R(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function S(a){var c,d,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;f<a._f.length;f++)g=0,c=i({},a),c._pf=b(),c._f=a._f[f],P(c),z(c)&&(g+=c._pf.charsLeftOver,g+=10*c._pf.unusedTokens.length,c._pf.score=g,(null==e||e>g)&&(e=g,d=c));i(a,d||c)}function T(a){var b,c,d=a._i,e=Tb.exec(d);if(e){for(a._pf.iso=!0,b=0,c=Vb.length;c>b;b++)if(Vb[b][1].exec(d)){a._f=Vb[b][0]+(e[6]||" ");break}for(b=0,c=Wb.length;c>b;b++)if(Wb[b][1].exec(d)){a._f+=Wb[b][0];break}d.match(Jb)&&(a._f+="Z"),P(a)}else ib.createFromInputFallback(a)}function U(b){var c=b._i,d=yb.exec(c);c===a?b._d=new Date:d?b._d=new Date(+d[1]):"string"==typeof c?T(b):n(c)?(b._a=c.slice(0),M(b)):o(c)?b._d=new Date(+c):"object"==typeof c?N(b):"number"==typeof c?b._d=new Date(c):ib.createFromInputFallback(b)}function V(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function W(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function X(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function Y(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function Z(a,b,c){var d=nb(Math.abs(a)/1e3),e=nb(d/60),f=nb(e/60),g=nb(f/24),h=nb(g/365),i=45>d&&["s",d]||1===e&&["m"]||45>e&&["mm",e]||1===f&&["h"]||22>f&&["hh",f]||1===g&&["d"]||25>=g&&["dd",g]||45>=g&&["M"]||345>g&&["MM",nb(g/30)]||1===h&&["y"]||["yy",h];return i[2]=b,i[3]=a>0,i[4]=c,Y.apply({},i)}function $(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=ib(a).add("d",f),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function _(a,b,c,d,e){var f,g,h=W(a,0,1).getUTCDay();return c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:w(a-1)+g}}function ab(b){var c=b._i,d=b._f;return null===c||d===a&&""===c?ib.invalid({nullInput:!0}):("string"==typeof c&&(b._i=c=E().preparse(c)),ib.isMoment(c)?(b=j(c),b._d=new Date(+c._d)):d?n(d)?S(b):P(b):U(b),new g(b))}function bb(a,b){var c;return"string"==typeof b&&(b=a.lang().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),u(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function cb(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function db(a,b,c){return"Month"===b?bb(a,c):a._d["set"+(a._isUTC?"UTC":"")+b](c)}function eb(a,b){return function(c){return null!=c?(db(this,a,c),ib.updateOffset(this,b),this):cb(this,a)}}function fb(a){ib.duration.fn[a]=function(){return this._data[a]}}function gb(a,b){ib.duration.fn["as"+a]=function(){return+this/b}}function hb(a){"undefined"==typeof ender&&(jb=mb.moment,mb.moment=a?c("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.",ib):ib)}for(var ib,jb,kb,lb="2.6.0",mb="undefined"!=typeof global?global:this,nb=Math.round,ob=0,pb=1,qb=2,rb=3,sb=4,tb=5,ub=6,vb={},wb={_isAMomentObject:null,_i:null,_f:null,_l:null,_strict:null,_isUTC:null,_offset:null,_pf:null,_lang:null},xb="undefined"!=typeof module&&module.exports,yb=/^\/?Date\((\-?\d+)/i,zb=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Ab=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Bb=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,Cb=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,Db=/\d\d?/,Eb=/\d{1,3}/,Fb=/\d{1,4}/,Gb=/[+\-]?\d{1,6}/,Hb=/\d+/,Ib=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Jb=/Z|[\+\-]\d\d:?\d\d/gi,Kb=/T/i,Lb=/[\+\-]?\d+(\.\d{1,3})?/,Mb=/\d{1,2}/,Nb=/\d/,Ob=/\d\d/,Pb=/\d{3}/,Qb=/\d{4}/,Rb=/[+-]?\d{6}/,Sb=/[+-]?\d+/,Tb=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ub="YYYY-MM-DDTHH:mm:ssZ",Vb=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],Wb=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],Xb=/([\+\-]|\d\d)/gi,Yb=("Date|Hours|Minutes|Seconds|Milliseconds".split("|"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),Zb={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},$b={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},_b={},ac="DDD w W M D d".split(" "),bc="M D H h m s w W".split(" "),cc={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return l(this.year()%100,2)},YYYY:function(){return l(this.year(),4)},YYYYY:function(){return l(this.year(),5)},YYYYYY:function(){var a=this.year(),b=a>=0?"+":"-";return b+l(Math.abs(a),6)},gg:function(){return l(this.weekYear()%100,2)},gggg:function(){return l(this.weekYear(),4)},ggggg:function(){return l(this.weekYear(),5)},GG:function(){return l(this.isoWeekYear()%100,2)},GGGG:function(){return l(this.isoWeekYear(),4)},GGGGG:function(){return l(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return t(this.milliseconds()/100)},SS:function(){return l(t(this.milliseconds()/10),2)},SSS:function(){return l(this.milliseconds(),3)},SSSS:function(){return l(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+l(t(a/60),2)+":"+l(t(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+l(t(a/60),2)+l(t(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},dc=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];ac.length;)kb=ac.pop(),cc[kb+"o"]=e(cc[kb],kb);for(;bc.length;)kb=bc.pop(),cc[kb+kb]=d(cc[kb],2);for(cc.DDDD=d(cc.DDD,3),i(f.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c,d;for(this._monthsParse||(this._monthsParse=[]),b=0;12>b;b++)if(this._monthsParse[b]||(c=ib.utc([2e3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=new RegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=ib([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"==typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return $(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),ib=function(c,d,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=c,g._f=d,g._l=e,g._strict=f,g._isUTC=!1,g._pf=b(),ab(g)},ib.suppressDeprecationWarnings=!1,ib.createFromInputFallback=c("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i)}),ib.utc=function(c,d,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=c,g._f=d,g._strict=f,g._pf=b(),ab(g).utc()},ib.unix=function(a){return ib(1e3*a)},ib.duration=function(a,b){var c,d,e,f=a,g=null;return ib.isDuration(a)?f={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(f={},b?f[b]=a:f.milliseconds=a):(g=zb.exec(a))?(c="-"===g[1]?-1:1,f={y:0,d:t(g[qb])*c,h:t(g[rb])*c,m:t(g[sb])*c,s:t(g[tb])*c,ms:t(g[ub])*c}):(g=Ab.exec(a))&&(c="-"===g[1]?-1:1,e=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*c},f={y:e(g[2]),M:e(g[3]),d:e(g[4]),h:e(g[5]),m:e(g[6]),s:e(g[7]),w:e(g[8])}),d=new h(f),ib.isDuration(a)&&a.hasOwnProperty("_lang")&&(d._lang=a._lang),d},ib.version=lb,ib.defaultFormat=Ub,ib.momentProperties=wb,ib.updateOffset=function(){},ib.lang=function(a,b){var c;return a?(b?C(A(a),b):null===b?(D(a),a="en"):vb[a]||E(a),c=ib.duration.fn._lang=ib.fn._lang=E(a),c._abbr):ib.fn._lang._abbr},ib.langData=function(a){return a&&a._lang&&a._lang._abbr&&(a=a._lang._abbr),E(a)},ib.isMoment=function(a){return a instanceof g||null!=a&&a.hasOwnProperty("_isAMomentObject")},ib.isDuration=function(a){return a instanceof h},kb=dc.length-1;kb>=0;--kb)s(dc[kb]);ib.normalizeUnits=function(a){return q(a)},ib.invalid=function(a){var b=ib.utc(0/0);return null!=a?i(b._pf,a):b._pf.userInvalidated=!0,b},ib.parseZone=function(){return ib.apply(null,arguments).parseZone()},ib.parseTwoDigitYear=function(a){return t(a)+(t(a)>68?1900:2e3)},i(ib.fn=g.prototype,{clone:function(){return ib(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=ib(this).utc();return 0<a.year()&&a.year()<=9999?H(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):H(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return z(this)},isDSTShifted:function(){return this._a?this.isValid()&&p(this._a,(this._isUTC?ib.utc(this._a):ib(this._a)).toArray())>0:!1},parsingFlags:function(){return i({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(a){var b=H(this,a||ib.defaultFormat);return this.lang().postformat(b)},add:function(a,b){var c;return c="string"==typeof a?ib.duration(+b,a):ib.duration(a,b),m(this,c,1),this},subtract:function(a,b){var c;return c="string"==typeof a?ib.duration(+b,a):ib.duration(a,b),m(this,c,-1),this},diff:function(a,b,c){var d,e,f=B(a,this),g=6e4*(this.zone()-f.zone());return b=q(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+f.daysInMonth()),e=12*(this.year()-f.year())+(this.month()-f.month()),e+=(this-ib(this).startOf("month")-(f-ib(f).startOf("month")))/d,e-=6e4*(this.zone()-ib(this).startOf("month").zone()-(f.zone()-ib(f).startOf("month").zone()))/d,"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:k(e)},from:function(a,b){return ib.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){return this.from(ib(),a)},calendar:function(){var a=B(ib(),this).startOf("day"),b=this.diff(a,"days",!0),c=-6>b?"sameElse":-1>b?"lastWeek":0>b?"lastDay":1>b?"sameDay":2>b?"nextDay":7>b?"nextWeek":"sameElse";return this.format(this.lang().calendar(c,this))},isLeapYear:function(){return x(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=X(a,this.lang()),this.add({d:a-b})):b},month:eb("Month",!0),startOf:function(a){switch(a=q(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this},endOf:function(a){return a=q(a),this.startOf(a).add("isoWeek"===a?"week":a,1).subtract("ms",1)},isAfter:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)>+ib(a).startOf(b)},isBefore:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)<+ib(a).startOf(b)},isSame:function(a,b){return b=b||"ms",+this.clone().startOf(b)===+B(a,this).startOf(b)},min:function(a){return a=ib.apply(null,arguments),this>a?this:a},max:function(a){return a=ib.apply(null,arguments),a>this?this:a},zone:function(a,b){var c=this._offset||0;return null==a?this._isUTC?c:this._d.getTimezoneOffset():("string"==typeof a&&(a=K(a)),Math.abs(a)<16&&(a=60*a),this._offset=a,this._isUTC=!0,c!==a&&(!b||this._changeInProgress?m(this,ib.duration(c-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,ib.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?ib(a).zone():0,(this.zone()-a)%60===0},daysInMonth:function(){return u(this.year(),this.month())},dayOfYear:function(a){var b=nb((ib(this).startOf("day")-ib(this).startOf("year"))/864e5)+1;return null==a?b:this.add("d",a-b)},quarter:function(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)},weekYear:function(a){var b=$(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==a?b:this.add("y",a-b)},isoWeekYear:function(a){var b=$(this,1,4).year;return null==a?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return null==a?b:this.add("d",7*(a-b))},isoWeek:function(a){var b=$(this,1,4).week;return null==a?b:this.add("d",7*(a-b))},weekday:function(a){var b=(this.day()+7-this.lang()._week.dow)%7;return null==a?b:this.add("d",a-b)},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return v(this.year(),1,4)},weeksInYear:function(){var a=this._lang._week;return v(this.year(),a.dow,a.doy)},get:function(a){return a=q(a),this[a]()},set:function(a,b){return a=q(a),"function"==typeof this[a]&&this[a](b),this},lang:function(b){return b===a?this._lang:(this._lang=E(b),this)}}),ib.fn.millisecond=ib.fn.milliseconds=eb("Milliseconds",!1),ib.fn.second=ib.fn.seconds=eb("Seconds",!1),ib.fn.minute=ib.fn.minutes=eb("Minutes",!1),ib.fn.hour=ib.fn.hours=eb("Hours",!0),ib.fn.date=eb("Date",!0),ib.fn.dates=c("dates accessor is deprecated. Use date instead.",eb("Date",!0)),ib.fn.year=eb("FullYear",!0),ib.fn.years=c("years accessor is deprecated. Use year instead.",eb("FullYear",!0)),ib.fn.days=ib.fn.day,ib.fn.months=ib.fn.month,ib.fn.weeks=ib.fn.week,ib.fn.isoWeeks=ib.fn.isoWeek,ib.fn.quarters=ib.fn.quarter,ib.fn.toJSON=ib.fn.toISOString,i(ib.duration.fn=h.prototype,{_bubble:function(){var a,b,c,d,e=this._milliseconds,f=this._days,g=this._months,h=this._data;h.milliseconds=e%1e3,a=k(e/1e3),h.seconds=a%60,b=k(a/60),h.minutes=b%60,c=k(b/60),h.hours=c%24,f+=k(c/24),h.days=f%30,g+=k(f/30),h.months=g%12,d=k(g/12),h.years=d},weeks:function(){return k(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*t(this._months/12)},humanize:function(a){var b=+this,c=Z(b,!a,this.lang());return a&&(c=this.lang().pastFuture(b,c)),this.lang().postformat(c)},add:function(a,b){var c=ib.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=ib.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=q(a),this[a.toLowerCase()+"s"]()},as:function(a){return a=q(a),this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:ib.fn.lang,toIsoString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}});for(kb in Yb)Yb.hasOwnProperty(kb)&&(gb(kb,Yb[kb]),fb(kb.toLowerCase()));gb("Weeks",6048e5),ib.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},ib.lang("en",{ordinal:function(a){var b=a%10,c=1===t(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),function(a){a(ib)}(function(a){return a.lang("ar-ma",{months:"ÙŠÙ†Ø§ÙŠØ±_ÙØ¨Ø±Ø§ÙŠØ±_Ù…Ø§Ø±Ø³_Ø£Ø¨Ø±ÙŠÙ„_Ù…Ø§ÙŠ_ÙŠÙˆÙ†ÙŠÙˆ_ÙŠÙˆÙ„ÙŠÙˆØ²_ØºØ´Øª_Ø´ØªÙ†Ø¨Ø±_Ø£ÙƒØªÙˆØ¨Ø±_Ù†ÙˆÙ†Ø¨Ø±_Ø¯Ø¬Ù†Ø¨Ø±".split("_"),monthsShort:"ÙŠÙ†Ø§ÙŠØ±_ÙØ¨Ø±Ø§ÙŠØ±_Ù…Ø§Ø±Ø³_Ø£Ø¨Ø±ÙŠÙ„_Ù…Ø§ÙŠ_ÙŠÙˆÙ†ÙŠÙˆ_ÙŠÙˆÙ„ÙŠÙˆØ²_ØºØ´Øª_Ø´ØªÙ†Ø¨Ø±_Ø£ÙƒØªÙˆØ¨Ø±_Ù†ÙˆÙ†Ø¨Ø±_Ø¯Ø¬Ù†Ø¨Ø±".split("_"),weekdays:"Ø§Ù„Ø£Ø­Ø¯_Ø§Ù„Ø¥ØªÙ†ÙŠÙ†_Ø§Ù„Ø«Ù„Ø§Ø«Ø§Ø¡_Ø§Ù„Ø£Ø±Ø¨Ø¹Ø§Ø¡_Ø§Ù„Ø®Ù…ÙŠØ³_Ø§Ù„Ø¬Ù…Ø¹Ø©_Ø§Ù„Ø³Ø¨Øª".split("_"),weekdaysShort:"Ø§Ø­Ø¯_Ø§ØªÙ†ÙŠÙ†_Ø«Ù„Ø§Ø«Ø§Ø¡_Ø§Ø±Ø¨Ø¹Ø§Ø¡_Ø®Ù…ÙŠØ³_Ø¬Ù…Ø¹Ø©_Ø³Ø¨Øª".split("_"),weekdaysMin:"Ø­_Ù†_Ø«_Ø±_Ø®_Ø¬_Ø³".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Ø§Ù„ÙŠÙˆÙ… Ø¹Ù„Ù‰ Ø§Ù„Ø³Ø§Ø¹Ø©] LT",nextDay:"[ØºØ¯Ø§ Ø¹Ù„Ù‰ Ø§Ù„Ø³Ø§Ø¹Ø©] LT",nextWeek:"dddd [Ø¹Ù„Ù‰ Ø§Ù„Ø³Ø§Ø¹Ø©] LT",lastDay:"[Ø£Ù…Ø³ Ø¹Ù„Ù‰ Ø§Ù„Ø³Ø§Ø¹Ø©] LT",lastWeek:"dddd [Ø¹Ù„Ù‰ Ø§Ù„Ø³Ø§Ø¹Ø©] LT",sameElse:"L"},relativeTime:{future:"ÙÙŠ %s",past:"Ù…Ù†Ø° %s",s:"Ø«ÙˆØ§Ù†",m:"Ø¯Ù‚ÙŠÙ‚Ø©",mm:"%d Ø¯Ù‚Ø§Ø¦Ù‚",h:"Ø³Ø§Ø¹Ø©",hh:"%d Ø³Ø§Ø¹Ø§Øª",d:"ÙŠÙˆÙ…",dd:"%d Ø£ÙŠØ§Ù…",M:"Ø´Ù‡Ø±",MM:"%d Ø£Ø´Ù‡Ø±",y:"Ø³Ù†Ø©",yy:"%d Ø³Ù†ÙˆØ§Øª"},week:{dow:6,doy:12}})}),function(a){a(ib)}(function(a){return a.lang("ar",{months:"ÙŠÙ†Ø§ÙŠØ±/ ÙƒØ§Ù†ÙˆÙ† Ø§Ù„Ø«Ø§Ù†ÙŠ_ÙØ¨Ø±Ø§ÙŠØ±/ Ø´Ø¨Ø§Ø·_Ù…Ø§Ø±Ø³/ Ø¢Ø°Ø§Ø±_Ø£Ø¨Ø±ÙŠÙ„/ Ù†ÙŠØ³Ø§Ù†_Ù…Ø§ÙŠÙˆ/ Ø£ÙŠØ§Ø±_ÙŠÙˆÙ†ÙŠÙˆ/ Ø­Ø²ÙŠØ±Ø§Ù†_ÙŠÙˆÙ„ÙŠÙˆ/ ØªÙ…ÙˆØ²_Ø£ØºØ³Ø·Ø³/ Ø¢Ø¨_Ø³Ø¨ØªÙ…Ø¨Ø±/ Ø£ÙŠÙ„ÙˆÙ„_Ø£ÙƒØªÙˆØ¨Ø±/ ØªØ´Ø±ÙŠÙ† Ø§Ù„Ø£ÙˆÙ„_Ù†ÙˆÙÙ…Ø¨Ø±/ ØªØ´Ø±ÙŠÙ† Ø§Ù„Ø«Ø§Ù†ÙŠ_Ø¯ÙŠØ³Ù…Ø¨Ø±/ ÙƒØ§Ù†ÙˆÙ† Ø§Ù„Ø£ÙˆÙ„".split("_"),monthsShort:"ÙŠÙ†Ø§ÙŠØ±/ ÙƒØ§Ù†ÙˆÙ† Ø§Ù„Ø«Ø§Ù†ÙŠ_ÙØ¨Ø±Ø§ÙŠØ±/ Ø´Ø¨Ø§Ø·_Ù…Ø§Ø±Ø³/ Ø¢Ø°Ø§Ø±_Ø£Ø¨Ø±ÙŠÙ„/ Ù†ÙŠØ³Ø§Ù†_Ù…Ø§ÙŠÙˆ/ Ø£ÙŠØ§Ø±_ÙŠÙˆÙ†ÙŠÙˆ/ Ø­Ø²ÙŠØ±Ø§Ù†_ÙŠÙˆÙ„ÙŠÙˆ/ ØªÙ…ÙˆØ²_Ø£ØºØ³Ø·Ø³/ Ø¢Ø¨_Ø³Ø¨ØªÙ…Ø¨Ø±/ Ø£ÙŠÙ„ÙˆÙ„_Ø£ÙƒØªÙˆØ¨Ø±/ ØªØ´Ø±ÙŠÙ† Ø§Ù„Ø£ÙˆÙ„_Ù†ÙˆÙÙ…Ø¨Ø±/ ØªØ´Ø±ÙŠÙ† Ø§Ù„Ø«Ø§Ù†ÙŠ_Ø¯ÙŠØ³Ù…Ø¨Ø±/ ÙƒØ§Ù†ÙˆÙ† Ø§Ù„Ø£ÙˆÙ„".split("_"),weekdays:"Ø§Ù„Ø£Ø­Ø¯_Ø§Ù„Ø¥Ø«Ù†ÙŠÙ†_Ø§Ù„Ø«Ù„Ø§Ø«Ø§Ø¡_Ø§Ù„Ø£Ø±Ø¨Ø¹Ø§Ø¡_Ø§Ù„Ø®Ù…ÙŠØ³_Ø§Ù„Ø¬Ù…Ø¹Ø©_Ø§Ù„Ø³Ø¨Øª".split("_"),weekdaysShort:"Ø§Ù„Ø£Ø­Ø¯_Ø§Ù„Ø¥Ø«Ù†ÙŠÙ†_Ø§Ù„Ø«Ù„Ø§Ø«Ø§Ø¡_Ø§Ù„Ø£Ø±Ø¨Ø¹Ø§Ø¡_Ø§Ù„Ø®Ù…ÙŠØ³_Ø§Ù„Ø¬Ù…Ø¹Ø©_Ø§Ù„Ø³Ø¨Øª".split("_"),weekdaysMin:"Ø­_Ù†_Ø«_Ø±_Ø®_Ø¬_Ø³".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Ø§Ù„ÙŠÙˆÙ… Ø¹Ù„Ù‰ Ø§Ù„Ø³Ø§Ø¹Ø©] LT",nextDay:"[ØºØ¯Ø§ Ø¹Ù„Ù‰ Ø§Ù„Ø³Ø§Ø¹Ø©] LT",nextWeek:"dddd [Ø¹Ù„Ù‰ Ø§Ù„Ø³Ø§Ø¹Ø©] LT",lastDay:"[Ø£Ù…Ø³ Ø¹Ù„Ù‰ Ø§Ù„Ø³Ø§Ø¹Ø©] LT",lastWeek:"dddd [Ø¹Ù„Ù‰ Ø§Ù„Ø³Ø§Ø¹Ø©] LT",sameElse:"L"},relativeTime:{future:"ÙÙŠ %s",past:"Ù…Ù†Ø° %s",s:"Ø«ÙˆØ§Ù†",m:"Ø¯Ù‚ÙŠÙ‚Ø©",mm:"%d Ø¯Ù‚Ø§Ø¦Ù‚",h:"Ø³Ø§Ø¹Ø©",hh:"%d Ø³Ø§Ø¹Ø§Øª",d:"ÙŠÙˆÙ…",dd:"%d Ø£ÙŠØ§Ù…",M:"Ø´Ù‡Ø±",MM:"%d Ø£Ø´Ù‡Ø±",y:"Ø³Ù†Ø©",yy:"%d Ø³Ù†ÙˆØ§Øª"},week:{dow:6,doy:12}})}),function(a){a(ib)}(function(a){return a.lang("bg",{months:"ÑÐ½ÑƒÐ°Ñ€Ð¸_Ñ„ÐµÐ²Ñ€ÑƒÐ°Ñ€Ð¸_Ð¼Ð°Ñ€Ñ‚_Ð°Ð¿Ñ€Ð¸Ð»_Ð¼Ð°Ð¹_ÑŽÐ½Ð¸_ÑŽÐ»Ð¸_Ð°Ð²Ð³ÑƒÑÑ‚_ÑÐµÐ¿Ñ‚ÐµÐ¼Ð²Ñ€Ð¸_Ð¾ÐºÑ‚Ð¾Ð¼Ð²Ñ€Ð¸_Ð½Ð¾ÐµÐ¼Ð²Ñ€Ð¸_Ð´ÐµÐºÐµÐ¼Ð²Ñ€Ð¸".split("_"),monthsShort:"ÑÐ½Ñ€_Ñ„ÐµÐ²_Ð¼Ð°Ñ€_Ð°Ð¿Ñ€_Ð¼Ð°Ð¹_ÑŽÐ½Ð¸_ÑŽÐ»Ð¸_Ð°Ð²Ð³_ÑÐµÐ¿_Ð¾ÐºÑ‚_Ð½Ð¾Ðµ_Ð´ÐµÐº".split("_"),weekdays:"Ð½ÐµÐ´ÐµÐ»Ñ_Ð¿Ð¾Ð½ÐµÐ´ÐµÐ»Ð½Ð¸Ðº_Ð²Ñ‚Ð¾Ñ€Ð½Ð¸Ðº_ÑÑ€ÑÐ´Ð°_Ñ‡ÐµÑ‚Ð²ÑŠÑ€Ñ‚ÑŠÐº_Ð¿ÐµÑ‚ÑŠÐº_ÑÑŠÐ±Ð¾Ñ‚Ð°".split("_"),weekdaysShort:"Ð½ÐµÐ´_Ð¿Ð¾Ð½_Ð²Ñ‚Ð¾_ÑÑ€Ñ_Ñ‡ÐµÑ‚_Ð¿ÐµÑ‚_ÑÑŠÐ±".split("_"),weekdaysMin:"Ð½Ð´_Ð¿Ð½_Ð²Ñ‚_ÑÑ€_Ñ‡Ñ‚_Ð¿Ñ‚_ÑÐ±".split("_"),longDateFormat:{LT:"H:mm",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Ð”Ð½ÐµÑ Ð²] LT",nextDay:"[Ð£Ñ‚Ñ€Ðµ Ð²] LT",nextWeek:"dddd [Ð²] LT",lastDay:"[Ð’Ñ‡ÐµÑ€Ð° Ð²] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Ð’ Ð¸Ð·Ð¼Ð¸Ð½Ð°Ð»Ð°Ñ‚Ð°] dddd [Ð²] LT";case 1:case 2:case 4:case 5:return"[Ð’ Ð¸Ð·Ð¼Ð¸Ð½Ð°Ð»Ð¸Ñ] dddd [Ð²] LT"}},sameElse:"L"},relativeTime:{future:"ÑÐ»ÐµÐ´ %s",past:"Ð¿Ñ€ÐµÐ´Ð¸ %s",s:"Ð½ÑÐºÐ¾Ð»ÐºÐ¾ ÑÐµÐºÑƒÐ½Ð´Ð¸",m:"Ð¼Ð¸Ð½ÑƒÑ‚Ð°",mm:"%d Ð¼Ð¸Ð½ÑƒÑ‚Ð¸",h:"Ñ‡Ð°Ñ",hh:"%d Ñ‡Ð°ÑÐ°",d:"Ð´ÐµÐ½",dd:"%d Ð´Ð½Ð¸",M:"Ð¼ÐµÑÐµÑ†",MM:"%d Ð¼ÐµÑÐµÑ†Ð°",y:"Ð³Ð¾Ð´Ð¸Ð½Ð°",yy:"%d Ð³Ð¾Ð´Ð¸Ð½Ð¸"},ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ÐµÐ²":0===c?a+"-ÐµÐ½":c>10&&20>c?a+"-Ñ‚Ð¸":1===b?a+"-Ð²Ð¸":2===b?a+"-Ñ€Ð¸":7===b||8===b?a+"-Ð¼Ð¸":a+"-Ñ‚Ð¸"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(b){function c(a,b,c){var d={mm:"munutenn",MM:"miz",dd:"devezh"};return a+" "+f(d[c],a)}function d(a){switch(e(a)){case 1:case 3:case 4:case 5:case 9:return a+" bloaz";default:return a+" vloaz"}}function e(a){return a>9?e(a%10):a}function f(a,b){return 2===b?g(a):a}function g(b){var c={m:"v",b:"v",d:"z"};return c[b.charAt(0)]===a?b:c[b.charAt(0)]+b.substring(1)}return b.lang("br",{months:"Genver_C'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_C'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Merc'her_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),longDateFormat:{LT:"h[e]mm A",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY LT",LLLL:"dddd, D [a viz] MMMM YYYY LT"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warc'hoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Dec'h da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s 'zo",s:"un nebeud segondennoÃ¹",m:"ur vunutenn",mm:c,h:"un eur",hh:"%d eur",d:"un devezh",dd:c,M:"ur miz",MM:c,y:"ur bloaz",yy:d},ordinal:function(a){var b=1===a?"aÃ±":"vet";return a+b},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";
case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}return a.lang("bs",{months:"januar_februar_mart_april_maj_juni_juli_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),weekdays:"nedjelja_ponedjeljak_utorak_srijeda_Äetvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._Äet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_Äe_pe_su".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juÄer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[proÅ¡lu] dddd [u] LT";case 6:return"[proÅ¡le] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[proÅ¡li] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:b,mm:b,h:b,hh:b,d:"dan",dd:b,M:"mjesec",MM:b,y:"godinu",yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("ca",{months:"gener_febrer_marÃ§_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),monthsShort:"gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.".split("_"),weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"Dg_Dl_Dt_Dc_Dj_Dv_Ds".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demÃ  a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"fa %s",s:"uns segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},ordinal:"%dÂº",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a){return a>1&&5>a&&1!==~~(a/10)}function c(a,c,d,e){var f=a+" ";switch(d){case"s":return c||e?"pÃ¡r sekund":"pÃ¡r sekundami";case"m":return c?"minuta":e?"minutu":"minutou";case"mm":return c||e?f+(b(a)?"minuty":"minut"):f+"minutami";break;case"h":return c?"hodina":e?"hodinu":"hodinou";case"hh":return c||e?f+(b(a)?"hodiny":"hodin"):f+"hodinami";break;case"d":return c||e?"den":"dnem";case"dd":return c||e?f+(b(a)?"dny":"dnÃ­"):f+"dny";break;case"M":return c||e?"mÄ›sÃ­c":"mÄ›sÃ­cem";case"MM":return c||e?f+(b(a)?"mÄ›sÃ­ce":"mÄ›sÃ­cÅ¯"):f+"mÄ›sÃ­ci";break;case"y":return c||e?"rok":"rokem";case"yy":return c||e?f+(b(a)?"roky":"let"):f+"lety"}}var d="leden_Ãºnor_bÅ™ezen_duben_kvÄ›ten_Äerven_Äervenec_srpen_zÃ¡Å™Ã­_Å™Ã­jen_listopad_prosinec".split("_"),e="led_Ãºno_bÅ™e_dub_kvÄ›_Ävn_Ävc_srp_zÃ¡Å™_Å™Ã­j_lis_pro".split("_");return a.lang("cs",{months:d,monthsShort:e,monthsParse:function(a,b){var c,d=[];for(c=0;12>c;c++)d[c]=new RegExp("^"+a[c]+"$|^"+b[c]+"$","i");return d}(d,e),weekdays:"nedÄ›le_pondÄ›lÃ­_ÃºterÃ½_stÅ™eda_Ätvrtek_pÃ¡tek_sobota".split("_"),weekdaysShort:"ne_po_Ãºt_st_Ät_pÃ¡_so".split("_"),weekdaysMin:"ne_po_Ãºt_st_Ät_pÃ¡_so".split("_"),longDateFormat:{LT:"H.mm",L:"DD.Â MM.Â YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd D. MMMM YYYY LT"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zÃ­tra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedÄ›li v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve stÅ™edu v] LT";case 4:return"[ve Ätvrtek v] LT";case 5:return"[v pÃ¡tek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[vÄera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou nedÄ›li v] LT";case 1:case 2:return"[minulÃ©] dddd [v] LT";case 3:return"[minulou stÅ™edu v] LT";case 4:case 5:return"[minulÃ½] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pÅ™ed %s",s:c,m:c,mm:c,h:c,hh:c,d:c,dd:c,M:c,MM:c,y:c,yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("cv",{months:"ÐºÄƒÑ€Ð»Ð°Ñ‡_Ð½Ð°Ñ€ÄƒÑ_Ð¿ÑƒÑˆ_Ð°ÐºÐ°_Ð¼Ð°Ð¹_Ã§Ä•Ñ€Ñ‚Ð¼Ðµ_ÑƒÑ‚Äƒ_Ã§ÑƒÑ€Ð»Ð°_Ð°Ð²ÄƒÐ½_ÑŽÐ¿Ð°_Ñ‡Ó³Ðº_Ñ€Ð°ÑˆÑ‚Ð°Ð²".split("_"),monthsShort:"ÐºÄƒÑ€_Ð½Ð°Ñ€_Ð¿ÑƒÑˆ_Ð°ÐºÐ°_Ð¼Ð°Ð¹_Ã§Ä•Ñ€_ÑƒÑ‚Äƒ_Ã§ÑƒÑ€_Ð°Ð²_ÑŽÐ¿Ð°_Ñ‡Ó³Ðº_Ñ€Ð°Ñˆ".split("_"),weekdays:"Ð²Ñ‹Ñ€ÑÐ°Ñ€Ð½Ð¸ÐºÑƒÐ½_Ñ‚ÑƒÐ½Ñ‚Ð¸ÐºÑƒÐ½_Ñ‹Ñ‚Ð»Ð°Ñ€Ð¸ÐºÑƒÐ½_ÑŽÐ½ÐºÑƒÐ½_ÐºÄ•Ã§Ð½ÐµÑ€Ð½Ð¸ÐºÑƒÐ½_ÑÑ€Ð½ÐµÐºÑƒÐ½_ÑˆÄƒÐ¼Ð°Ñ‚ÐºÑƒÐ½".split("_"),weekdaysShort:"Ð²Ñ‹Ñ€_Ñ‚ÑƒÐ½_Ñ‹Ñ‚Ð»_ÑŽÐ½_ÐºÄ•Ã§_ÑÑ€Ð½_ÑˆÄƒÐ¼".split("_"),weekdaysMin:"Ð²Ñ€_Ñ‚Ð½_Ñ‹Ñ‚_ÑŽÐ½_ÐºÃ§_ÑÑ€_ÑˆÐ¼".split("_"),longDateFormat:{LT:"HH:mm",L:"DD-MM-YYYY",LL:"YYYY [Ã§ÑƒÐ»Ñ…Ð¸] MMMM [ÑƒÐ¹ÄƒÑ…Ä•Ð½] D[-Ð¼Ä•ÑˆÄ•]",LLL:"YYYY [Ã§ÑƒÐ»Ñ…Ð¸] MMMM [ÑƒÐ¹ÄƒÑ…Ä•Ð½] D[-Ð¼Ä•ÑˆÄ•], LT",LLLL:"dddd, YYYY [Ã§ÑƒÐ»Ñ…Ð¸] MMMM [ÑƒÐ¹ÄƒÑ…Ä•Ð½] D[-Ð¼Ä•ÑˆÄ•], LT"},calendar:{sameDay:"[ÐŸÐ°ÑÐ½] LT [ÑÐµÑ…ÐµÑ‚Ñ€Ðµ]",nextDay:"[Ð«Ñ€Ð°Ð½] LT [ÑÐµÑ…ÐµÑ‚Ñ€Ðµ]",lastDay:"[Ä”Ð½ÐµÑ€] LT [ÑÐµÑ…ÐµÑ‚Ñ€Ðµ]",nextWeek:"[Ã‡Ð¸Ñ‚ÐµÑ] dddd LT [ÑÐµÑ…ÐµÑ‚Ñ€Ðµ]",lastWeek:"[Ð˜Ñ€Ñ‚Ð½Ä•] dddd LT [ÑÐµÑ…ÐµÑ‚Ñ€Ðµ]",sameElse:"L"},relativeTime:{future:function(a){var b=/ÑÐµÑ…ÐµÑ‚$/i.exec(a)?"Ñ€ÐµÐ½":/Ã§ÑƒÐ»$/i.exec(a)?"Ñ‚Ð°Ð½":"Ñ€Ð°Ð½";return a+b},past:"%s ÐºÐ°ÑÐ»Ð»Ð°",s:"Ð¿Ä•Ñ€-Ð¸Ðº Ã§ÐµÐºÐºÑƒÐ½Ñ‚",m:"Ð¿Ä•Ñ€ Ð¼Ð¸Ð½ÑƒÑ‚",mm:"%d Ð¼Ð¸Ð½ÑƒÑ‚",h:"Ð¿Ä•Ñ€ ÑÐµÑ…ÐµÑ‚",hh:"%d ÑÐµÑ…ÐµÑ‚",d:"Ð¿Ä•Ñ€ ÐºÑƒÐ½",dd:"%d ÐºÑƒÐ½",M:"Ð¿Ä•Ñ€ ÑƒÐ¹ÄƒÑ…",MM:"%d ÑƒÐ¹ÄƒÑ…",y:"Ð¿Ä•Ñ€ Ã§ÑƒÐ»",yy:"%d Ã§ÑƒÐ»"},ordinal:"%d-Ð¼Ä•Ñˆ",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn Ã l",s:"ychydig eiliadau",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},ordinal:function(a){var b=a,c="",d=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"];return b>20?c=40===b||50===b||60===b||80===b||100===b?"fed":"ain":b>0&&(c=d[b]),a+c},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"sÃ¸ndag_mandag_tirsdag_onsdag_torsdag_fredag_lÃ¸rdag".split("_"),weekdaysShort:"sÃ¸n_man_tir_ons_tor_fre_lÃ¸r".split("_"),weekdaysMin:"sÃ¸_ma_ti_on_to_fr_lÃ¸".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D. MMMM, YYYY LT"},calendar:{sameDay:"[I dag kl.] LT",nextDay:"[I morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[I gÃ¥r kl.] LT",lastWeek:"[sidste] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"fÃ¥ sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en mÃ¥ned",MM:"%d mÃ¥neder",y:"et Ã¥r",yy:"%d Ã¥r"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?d[c][0]:d[c][1]}return a.lang("de",{months:"Januar_Februar_MÃ¤rz_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm [Uhr]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Heute um] LT",sameElse:"L",nextDay:"[Morgen um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gestern um] LT",lastWeek:"[letzten] dddd [um] LT"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:b,mm:"%d Minuten",h:b,hh:"%d Stunden",d:b,dd:b,M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("el",{monthsNominativeEl:"Î™Î±Î½Î¿Ï…Î¬ÏÎ¹Î¿Ï‚_Î¦ÎµÎ²ÏÎ¿Ï…Î¬ÏÎ¹Î¿Ï‚_ÎœÎ¬ÏÏ„Î¹Î¿Ï‚_Î‘Ï€ÏÎ¯Î»Î¹Î¿Ï‚_ÎœÎ¬Î¹Î¿Ï‚_Î™Î¿ÏÎ½Î¹Î¿Ï‚_Î™Î¿ÏÎ»Î¹Î¿Ï‚_Î‘ÏÎ³Î¿Ï…ÏƒÏ„Î¿Ï‚_Î£ÎµÏ€Ï„Î­Î¼Î²ÏÎ¹Î¿Ï‚_ÎŸÎºÏ„ÏŽÎ²ÏÎ¹Î¿Ï‚_ÎÎ¿Î­Î¼Î²ÏÎ¹Î¿Ï‚_Î”ÎµÎºÎ­Î¼Î²ÏÎ¹Î¿Ï‚".split("_"),monthsGenitiveEl:"Î™Î±Î½Î¿Ï…Î±ÏÎ¯Î¿Ï…_Î¦ÎµÎ²ÏÎ¿Ï…Î±ÏÎ¯Î¿Ï…_ÎœÎ±ÏÏ„Î¯Î¿Ï…_Î‘Ï€ÏÎ¹Î»Î¯Î¿Ï…_ÎœÎ±ÎÎ¿Ï…_Î™Î¿Ï…Î½Î¯Î¿Ï…_Î™Î¿Ï…Î»Î¯Î¿Ï…_Î‘Ï…Î³Î¿ÏÏƒÏ„Î¿Ï…_Î£ÎµÏ€Ï„ÎµÎ¼Î²ÏÎ¯Î¿Ï…_ÎŸÎºÏ„Ï‰Î²ÏÎ¯Î¿Ï…_ÎÎ¿ÎµÎ¼Î²ÏÎ¯Î¿Ï…_Î”ÎµÎºÎµÎ¼Î²ÏÎ¯Î¿Ï…".split("_"),months:function(a,b){return/D/.test(b.substring(0,b.indexOf("MMMM")))?this._monthsGenitiveEl[a.month()]:this._monthsNominativeEl[a.month()]},monthsShort:"Î™Î±Î½_Î¦ÎµÎ²_ÎœÎ±Ï_Î‘Ï€Ï_ÎœÎ±ÏŠ_Î™Î¿Ï…Î½_Î™Î¿Ï…Î»_Î‘Ï…Î³_Î£ÎµÏ€_ÎŸÎºÏ„_ÎÎ¿Îµ_Î”ÎµÎº".split("_"),weekdays:"ÎšÏ…ÏÎ¹Î±ÎºÎ®_Î”ÎµÏ…Ï„Î­ÏÎ±_Î¤ÏÎ¯Ï„Î·_Î¤ÎµÏ„Î¬ÏÏ„Î·_Î Î­Î¼Ï€Ï„Î·_Î Î±ÏÎ±ÏƒÎºÎµÏ…Î®_Î£Î¬Î²Î²Î±Ï„Î¿".split("_"),weekdaysShort:"ÎšÏ…Ï_Î”ÎµÏ…_Î¤ÏÎ¹_Î¤ÎµÏ„_Î ÎµÎ¼_Î Î±Ï_Î£Î±Î²".split("_"),weekdaysMin:"ÎšÏ…_Î”Îµ_Î¤Ï_Î¤Îµ_Î Îµ_Î Î±_Î£Î±".split("_"),meridiem:function(a,b,c){return a>11?c?"Î¼Î¼":"ÎœÎœ":c?"Ï€Î¼":"Î Îœ"},longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendarEl:{sameDay:"[Î£Î®Î¼ÎµÏÎ± {}] LT",nextDay:"[Î‘ÏÏÎ¹Î¿ {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Î§Î¸ÎµÏ‚ {}] LT",lastWeek:"[Ï„Î·Î½ Ï€ÏÎ¿Î·Î³Î¿ÏÎ¼ÎµÎ½Î·] dddd [{}] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendarEl[a],d=b&&b.hours();return c.replace("{}",d%12===1?"ÏƒÏ„Î·":"ÏƒÏ„Î¹Ï‚")},relativeTime:{future:"ÏƒÎµ %s",past:"%s Ï€ÏÎ¹Î½",s:"Î´ÎµÏ…Ï„ÎµÏÏŒÎ»ÎµÏ€Ï„Î±",m:"Î­Î½Î± Î»ÎµÏ€Ï„ÏŒ",mm:"%d Î»ÎµÏ€Ï„Î¬",h:"Î¼Î¯Î± ÏŽÏÎ±",hh:"%d ÏŽÏÎµÏ‚",d:"Î¼Î¯Î± Î¼Î­ÏÎ±",dd:"%d Î¼Î­ÏÎµÏ‚",M:"Î­Î½Î±Ï‚ Î¼Î®Î½Î±Ï‚",MM:"%d Î¼Î®Î½ÎµÏ‚",y:"Î­Î½Î±Ï‚ Ï‡ÏÏŒÎ½Î¿Ï‚",yy:"%d Ï‡ÏÏŒÎ½Î¹Î±"},ordinal:function(a){return a+"Î·"},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"YYYY-MM-DD",LL:"D MMMM, YYYY",LLL:"D MMMM, YYYY LT",LLLL:"dddd, D MMMM, YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}})}),function(a){a(ib)}(function(a){return a.lang("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aÅ­gusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aÅ­g_sep_okt_nov_dec".split("_"),weekdays:"DimanÄ‰o_Lundo_Mardo_Merkredo_Ä´aÅ­do_Vendredo_Sabato".split("_"),weekdaysShort:"Dim_Lun_Mard_Merk_Ä´aÅ­_Ven_Sab".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Ä´a_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D[-an de] MMMM, YYYY",LLL:"D[-an de] MMMM, YYYY LT",LLLL:"dddd, [la] D[-an de] MMMM, YYYY LT"},meridiem:function(a,b,c){return a>11?c?"p.t.m.":"P.T.M.":c?"a.t.m.":"A.T.M."},calendar:{sameDay:"[HodiaÅ­ je] LT",nextDay:"[MorgaÅ­ je] LT",nextWeek:"dddd [je] LT",lastDay:"[HieraÅ­ je] LT",lastWeek:"[pasinta] dddd [je] LT",sameElse:"L"},relativeTime:{future:"je %s",past:"antaÅ­ %s",s:"sekundoj",m:"minuto",mm:"%d minutoj",h:"horo",hh:"%d horoj",d:"tago",dd:"%d tagoj",M:"monato",MM:"%d monatoj",y:"jaro",yy:"%d jaroj"},ordinal:"%da",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){var b="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),c="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_");return a.lang("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(a,d){return/-MMM-/.test(d)?c[a.month()]:b[a.month()]},weekdays:"domingo_lunes_martes_miÃ©rcoles_jueves_viernes_sÃ¡bado".split("_"),weekdaysShort:"dom._lun._mar._miÃ©._jue._vie._sÃ¡b.".split("_"),weekdaysMin:"Do_Lu_Ma_Mi_Ju_Vi_SÃ¡".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [del] YYYY",LLL:"D [de] MMMM [del] YYYY LT",LLLL:"dddd, D [de] MMMM [del] YYYY LT"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[maÃ±ana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un dÃ­a",dd:"%d dÃ­as",M:"un mes",MM:"%d meses",y:"un aÃ±o",yy:"%d aÃ±os"},ordinal:"%dÂº",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c,d){var e={s:["mÃµne sekundi","mÃµni sekund","paar sekundit"],m:["Ã¼he minuti","Ã¼ks minut"],mm:[a+" minuti",a+" minutit"],h:["Ã¼he tunni","tund aega","Ã¼ks tund"],hh:[a+" tunni",a+" tundi"],d:["Ã¼he pÃ¤eva","Ã¼ks pÃ¤ev"],M:["kuu aja","kuu aega","Ã¼ks kuu"],MM:[a+" kuu",a+" kuud"],y:["Ã¼he aasta","aasta","Ã¼ks aasta"],yy:[a+" aasta",a+" aastat"]};return b?e[c][2]?e[c][2]:e[c][1]:d?e[c][0]:e[c][1]}return a.lang("et",{months:"jaanuar_veebruar_mÃ¤rts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_mÃ¤rts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pÃ¼hapÃ¤ev_esmaspÃ¤ev_teisipÃ¤ev_kolmapÃ¤ev_neljapÃ¤ev_reede_laupÃ¤ev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[TÃ¤na,] LT",nextDay:"[Homme,] LT",nextWeek:"[JÃ¤rgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pÃ¤rast",past:"%s tagasi",s:b,m:b,mm:b,h:b,hh:b,d:b,dd:"%d pÃ¤eva",M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] LT",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] LT",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] LT",llll:"ddd, YYYY[ko] MMM D[a] LT"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){var b={1:"Û±",2:"Û²",3:"Û³",4:"Û´",5:"Ûµ",6:"Û¶",7:"Û·",8:"Û¸",9:"Û¹",0:"Û°"},c={"Û±":"1","Û²":"2","Û³":"3","Û´":"4","Ûµ":"5","Û¶":"6","Û·":"7","Û¸":"8","Û¹":"9","Û°":"0"};return a.lang("fa",{months:"Ú˜Ø§Ù†ÙˆÛŒÙ‡_ÙÙˆØ±ÛŒÙ‡_Ù…Ø§Ø±Ø³_Ø¢ÙˆØ±ÛŒÙ„_Ù…Ù‡_Ú˜ÙˆØ¦Ù†_Ú˜ÙˆØ¦ÛŒÙ‡_Ø§ÙˆØª_Ø³Ù¾ØªØ§Ù…Ø¨Ø±_Ø§Ú©ØªØ¨Ø±_Ù†ÙˆØ§Ù…Ø¨Ø±_Ø¯Ø³Ø§Ù…Ø¨Ø±".split("_"),monthsShort:"Ú˜Ø§Ù†ÙˆÛŒÙ‡_ÙÙˆØ±ÛŒÙ‡_Ù…Ø§Ø±Ø³_Ø¢ÙˆØ±ÛŒÙ„_Ù…Ù‡_Ú˜ÙˆØ¦Ù†_Ú˜ÙˆØ¦ÛŒÙ‡_Ø§ÙˆØª_Ø³Ù¾ØªØ§Ù…Ø¨Ø±_Ø§Ú©ØªØ¨Ø±_Ù†ÙˆØ§Ù…Ø¨Ø±_Ø¯Ø³Ø§Ù…Ø¨Ø±".split("_"),weekdays:"ÛŒÚ©â€ŒØ´Ù†Ø¨Ù‡_Ø¯ÙˆØ´Ù†Ø¨Ù‡_Ø³Ù‡â€ŒØ´Ù†Ø¨Ù‡_Ú†Ù‡Ø§Ø±Ø´Ù†Ø¨Ù‡_Ù¾Ù†Ø¬â€ŒØ´Ù†Ø¨Ù‡_Ø¬Ù…Ø¹Ù‡_Ø´Ù†Ø¨Ù‡".split("_"),weekdaysShort:"ÛŒÚ©â€ŒØ´Ù†Ø¨Ù‡_Ø¯ÙˆØ´Ù†Ø¨Ù‡_Ø³Ù‡â€ŒØ´Ù†Ø¨Ù‡_Ú†Ù‡Ø§Ø±Ø´Ù†Ø¨Ù‡_Ù¾Ù†Ø¬â€ŒØ´Ù†Ø¨Ù‡_Ø¬Ù…Ø¹Ù‡_Ø´Ù†Ø¨Ù‡".split("_"),weekdaysMin:"ÛŒ_Ø¯_Ø³_Ú†_Ù¾_Ø¬_Ø´".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},meridiem:function(a){return 12>a?"Ù‚Ø¨Ù„ Ø§Ø² Ø¸Ù‡Ø±":"Ø¨Ø¹Ø¯ Ø§Ø² Ø¸Ù‡Ø±"},calendar:{sameDay:"[Ø§Ù…Ø±ÙˆØ² Ø³Ø§Ø¹Øª] LT",nextDay:"[ÙØ±Ø¯Ø§ Ø³Ø§Ø¹Øª] LT",nextWeek:"dddd [Ø³Ø§Ø¹Øª] LT",lastDay:"[Ø¯ÛŒØ±ÙˆØ² Ø³Ø§Ø¹Øª] LT",lastWeek:"dddd [Ù¾ÛŒØ´] [Ø³Ø§Ø¹Øª] LT",sameElse:"L"},relativeTime:{future:"Ø¯Ø± %s",past:"%s Ù¾ÛŒØ´",s:"Ú†Ù†Ø¯ÛŒÙ† Ø«Ø§Ù†ÛŒÙ‡",m:"ÛŒÚ© Ø¯Ù‚ÛŒÙ‚Ù‡",mm:"%d Ø¯Ù‚ÛŒÙ‚Ù‡",h:"ÛŒÚ© Ø³Ø§Ø¹Øª",hh:"%d Ø³Ø§Ø¹Øª",d:"ÛŒÚ© Ø±ÙˆØ²",dd:"%d Ø±ÙˆØ²",M:"ÛŒÚ© Ù…Ø§Ù‡",MM:"%d Ù…Ø§Ù‡",y:"ÛŒÚ© Ø³Ø§Ù„",yy:"%d Ø³Ø§Ù„"},preparse:function(a){return a.replace(/[Û°-Û¹]/g,function(a){return c[a]}).replace(/ØŒ/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]}).replace(/,/g,"ØŒ")},ordinal:"%dÙ…",week:{dow:6,doy:12}})}),function(a){a(ib)}(function(a){function b(a,b,d,e){var f="";switch(d){case"s":return e?"muutaman sekunnin":"muutama sekunti";case"m":return e?"minuutin":"minuutti";case"mm":f=e?"minuutin":"minuuttia";break;case"h":return e?"tunnin":"tunti";case"hh":f=e?"tunnin":"tuntia";break;case"d":return e?"pÃ¤ivÃ¤n":"pÃ¤ivÃ¤";case"dd":f=e?"pÃ¤ivÃ¤n":"pÃ¤ivÃ¤Ã¤";break;case"M":return e?"kuukauden":"kuukausi";case"MM":f=e?"kuukauden":"kuukautta";break;case"y":return e?"vuoden":"vuosi";case"yy":f=e?"vuoden":"vuotta"}return f=c(a,e)+" "+f}function c(a,b){return 10>a?b?e[a]:d[a]:a}var d="nolla yksi kaksi kolme neljÃ¤ viisi kuusi seitsemÃ¤n kahdeksan yhdeksÃ¤n".split(" "),e=["nolla","yhden","kahden","kolmen","neljÃ¤n","viiden","kuuden",d[7],d[8],d[9]];return a.lang("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesÃ¤kuu_heinÃ¤kuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesÃ¤_heinÃ¤_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] LT",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] LT",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] LT",llll:"ddd, Do MMM YYYY, [klo] LT"},calendar:{sameDay:"[tÃ¤nÃ¤Ã¤n] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s pÃ¤Ã¤stÃ¤",past:"%s sitten",s:b,m:b,mm:b,h:b,hh:b,d:b,dd:b,M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("fo",{months:"januar_februar_mars_aprÃ­l_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_mÃ¡nadagur_tÃ½sdagur_mikudagur_hÃ³sdagur_frÃ­ggjadagur_leygardagur".split("_"),weekdaysShort:"sun_mÃ¡n_tÃ½s_mik_hÃ³s_frÃ­_ley".split("_"),weekdaysMin:"su_mÃ¡_tÃ½_mi_hÃ³_fr_le".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D. MMMM, YYYY LT"},calendar:{sameDay:"[Ã dag kl.] LT",nextDay:"[Ã morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Ã gjÃ¡r kl.] LT",lastWeek:"[sÃ­Ã°stu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s sÃ­Ã°ani",s:"fÃ¡ sekund",m:"ein minutt",mm:"%d minuttir",h:"ein tÃ­mi",hh:"%d tÃ­mar",d:"ein dagur",dd:"%d dagar",M:"ein mÃ¡naÃ°i",MM:"%d mÃ¡naÃ°ir",y:"eitt Ã¡r",yy:"%d Ã¡r"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("fr-ca",{months:"janvier_fÃ©vrier_mars_avril_mai_juin_juillet_aoÃ»t_septembre_octobre_novembre_dÃ©cembre".split("_"),monthsShort:"janv._fÃ©vr._mars_avr._mai_juin_juil._aoÃ»t_sept._oct._nov._dÃ©c.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Aujourd'hui Ã ] LT",nextDay:"[Demain Ã ] LT",nextWeek:"dddd [Ã ] LT",lastDay:"[Hier Ã ] LT",lastWeek:"dddd [dernier Ã ] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(a){return a+(1===a?"er":"")}})}),function(a){a(ib)}(function(a){return a.lang("fr",{months:"janvier_fÃ©vrier_mars_avril_mai_juin_juillet_aoÃ»t_septembre_octobre_novembre_dÃ©cembre".split("_"),monthsShort:"janv._fÃ©vr._mars_avr._mai_juin_juil._aoÃ»t_sept._oct._nov._dÃ©c.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Aujourd'hui Ã ] LT",nextDay:"[Demain Ã ] LT",nextWeek:"dddd [Ã ] LT",lastDay:"[Hier Ã ] LT",lastWeek:"dddd [dernier Ã ] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(a){return a+(1===a?"er":"")},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("gl",{months:"Xaneiro_Febreiro_Marzo_Abril_Maio_XuÃ±o_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro".split("_"),monthsShort:"Xan._Feb._Mar._Abr._Mai._XuÃ±._Xul._Ago._Set._Out._Nov._Dec.".split("_"),weekdays:"Domingo_Luns_Martes_MÃ©rcores_Xoves_Venres_SÃ¡bado".split("_"),weekdaysShort:"Dom._Lun._Mar._MÃ©r._Xov._Ven._SÃ¡b.".split("_"),weekdaysMin:"Do_Lu_Ma_MÃ©_Xo_Ve_SÃ¡".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"Ã¡s":"Ã¡")+"] LT"},nextDay:function(){return"[maÃ±Ã¡ "+(1!==this.hours()?"Ã¡s":"Ã¡")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"Ã¡s":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"Ã¡":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"Ã¡s":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(a){return"uns segundos"===a?"nuns segundos":"en "+a},past:"hai %s",s:"uns segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un dÃ­a",dd:"%d dÃ­as",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},ordinal:"%dÂº",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("he",{months:"×™× ×•××¨_×¤×‘×¨×•××¨_×ž×¨×¥_××¤×¨×™×œ_×ž××™_×™×•× ×™_×™×•×œ×™_××•×’×•×¡×˜_×¡×¤×˜×ž×‘×¨_××•×§×˜×•×‘×¨_× ×•×‘×ž×‘×¨_×“×¦×ž×‘×¨".split("_"),monthsShort:"×™× ×•×³_×¤×‘×¨×³_×ž×¨×¥_××¤×¨×³_×ž××™_×™×•× ×™_×™×•×œ×™_××•×’×³_×¡×¤×˜×³_××•×§×³_× ×•×‘×³_×“×¦×ž×³".split("_"),weekdays:"×¨××©×•×Ÿ_×©× ×™_×©×œ×™×©×™_×¨×‘×™×¢×™_×—×ž×™×©×™_×©×™×©×™_×©×‘×ª".split("_"),weekdaysShort:"××³_×‘×³_×’×³_×“×³_×”×³_×•×³_×©×³".split("_"),weekdaysMin:"×_×‘_×’_×“_×”_×•_×©".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [×‘]MMMM YYYY",LLL:"D [×‘]MMMM YYYY LT",LLLL:"dddd, D [×‘]MMMM YYYY LT",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY LT",llll:"ddd, D MMM YYYY LT"},calendar:{sameDay:"[×”×™×•× ×‘Ö¾]LT",nextDay:"[×ž×—×¨ ×‘Ö¾]LT",nextWeek:"dddd [×‘×©×¢×”] LT",lastDay:"[××ª×ž×•×œ ×‘Ö¾]LT",lastWeek:"[×‘×™×•×] dddd [×”××—×¨×•×Ÿ ×‘×©×¢×”] LT",sameElse:"L"},relativeTime:{future:"×‘×¢×•×“ %s",past:"×œ×¤× ×™ %s",s:"×ž×¡×¤×¨ ×©× ×™×•×ª",m:"×“×§×”",mm:"%d ×“×§×•×ª",h:"×©×¢×”",hh:function(a){return 2===a?"×©×¢×ª×™×™×":a+" ×©×¢×•×ª"},d:"×™×•×",dd:function(a){return 2===a?"×™×•×ž×™×™×":a+" ×™×ž×™×"},M:"×—×•×“×©",MM:function(a){return 2===a?"×—×•×“×©×™×™×":a+" ×—×•×“×©×™×"},y:"×©× ×”",yy:function(a){return 2===a?"×©× ×ª×™×™×":a+" ×©× ×™×"}}})}),function(a){a(ib)}(function(a){var b={1:"à¥§",2:"à¥¨",3:"à¥©",4:"à¥ª",5:"à¥«",6:"à¥¬",7:"à¥­",8:"à¥®",9:"à¥¯",0:"à¥¦"},c={"à¥§":"1","à¥¨":"2","à¥©":"3","à¥ª":"4","à¥«":"5","à¥¬":"6","à¥­":"7","à¥®":"8","à¥¯":"9","à¥¦":"0"};return a.lang("hi",{months:"à¤œà¤¨à¤µà¤°à¥€_à¤«à¤¼à¤°à¤µà¤°à¥€_à¤®à¤¾à¤°à¥à¤š_à¤…à¤ªà¥à¤°à¥ˆà¤²_à¤®à¤ˆ_à¤œà¥‚à¤¨_à¤œà¥à¤²à¤¾à¤ˆ_à¤…à¤—à¤¸à¥à¤¤_à¤¸à¤¿à¤¤à¤®à¥à¤¬à¤°_à¤…à¤•à¥à¤Ÿà¥‚à¤¬à¤°_à¤¨à¤µà¤®à¥à¤¬à¤°_à¤¦à¤¿à¤¸à¤®à¥à¤¬à¤°".split("_"),monthsShort:"à¤œà¤¨._à¤«à¤¼à¤°._à¤®à¤¾à¤°à¥à¤š_à¤…à¤ªà¥à¤°à¥ˆ._à¤®à¤ˆ_à¤œà¥‚à¤¨_à¤œà¥à¤²._à¤…à¤—._à¤¸à¤¿à¤¤._à¤…à¤•à¥à¤Ÿà¥‚._à¤¨à¤µ._à¤¦à¤¿à¤¸.".split("_"),weekdays:"à¤°à¤µà¤¿à¤µà¤¾à¤°_à¤¸à¥‹à¤®à¤µà¤¾à¤°_à¤®à¤‚à¤—à¤²à¤µà¤¾à¤°_à¤¬à¥à¤§à¤µà¤¾à¤°_à¤—à¥à¤°à¥‚à¤µà¤¾à¤°_à¤¶à¥à¤•à¥à¤°à¤µà¤¾à¤°_à¤¶à¤¨à¤¿à¤µà¤¾à¤°".split("_"),weekdaysShort:"à¤°à¤µà¤¿_à¤¸à¥‹à¤®_à¤®à¤‚à¤—à¤²_à¤¬à¥à¤§_à¤—à¥à¤°à¥‚_à¤¶à¥à¤•à¥à¤°_à¤¶à¤¨à¤¿".split("_"),weekdaysMin:"à¤°_à¤¸à¥‹_à¤®à¤‚_à¤¬à¥_à¤—à¥_à¤¶à¥_à¤¶".split("_"),longDateFormat:{LT:"A h:mm à¤¬à¤œà¥‡",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[à¤†à¤œ] LT",nextDay:"[à¤•à¤²] LT",nextWeek:"dddd, LT",lastDay:"[à¤•à¤²] LT",lastWeek:"[à¤ªà¤¿à¤›à¤²à¥‡] dddd, LT",sameElse:"L"},relativeTime:{future:"%s à¤®à¥‡à¤‚",past:"%s à¤ªà¤¹à¤²à¥‡",s:"à¤•à¥à¤› à¤¹à¥€ à¤•à¥à¤·à¤£",m:"à¤à¤• à¤®à¤¿à¤¨à¤Ÿ",mm:"%d à¤®à¤¿à¤¨à¤Ÿ",h:"à¤à¤• à¤˜à¤‚à¤Ÿà¤¾",hh:"%d à¤˜à¤‚à¤Ÿà¥‡",d:"à¤à¤• à¤¦à¤¿à¤¨",dd:"%d à¤¦à¤¿à¤¨",M:"à¤à¤• à¤®à¤¹à¥€à¤¨à¥‡",MM:"%d à¤®à¤¹à¥€à¤¨à¥‡",y:"à¤à¤• à¤µà¤°à¥à¤·",yy:"%d à¤µà¤°à¥à¤·"},preparse:function(a){return a.replace(/[à¥§à¥¨à¥©à¥ªà¥«à¥¬à¥­à¥®à¥¯à¥¦]/g,function(a){return c[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]})},meridiem:function(a){return 4>a?"à¤°à¤¾à¤¤":10>a?"à¤¸à¥à¤¬à¤¹":17>a?"à¤¦à¥‹à¤ªà¤¹à¤°":20>a?"à¤¶à¤¾à¤®":"à¤°à¤¾à¤¤"},week:{dow:0,doy:6}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}return a.lang("hr",{months:"sjeÄanj_veljaÄa_oÅ¾ujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_"),monthsShort:"sje._vel._oÅ¾u._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),weekdays:"nedjelja_ponedjeljak_utorak_srijeda_Äetvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._Äet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_Äe_pe_su".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juÄer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[proÅ¡lu] dddd [u] LT";case 6:return"[proÅ¡le] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[proÅ¡li] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:b,mm:b,h:b,hh:b,d:"dan",dd:b,M:"mjesec",MM:b,y:"godinu",yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){function b(a,b,c,d){var e=a;switch(c){case"s":return d||b?"nÃ©hÃ¡ny mÃ¡sodperc":"nÃ©hÃ¡ny mÃ¡sodperce";case"m":return"egy"+(d||b?" perc":" perce");case"mm":return e+(d||b?" perc":" perce");case"h":return"egy"+(d||b?" Ã³ra":" Ã³rÃ¡ja");case"hh":return e+(d||b?" Ã³ra":" Ã³rÃ¡ja");case"d":return"egy"+(d||b?" nap":" napja");case"dd":return e+(d||b?" nap":" napja");case"M":return"egy"+(d||b?" hÃ³nap":" hÃ³napja");case"MM":return e+(d||b?" hÃ³nap":" hÃ³napja");case"y":return"egy"+(d||b?" Ã©v":" Ã©ve");case"yy":return e+(d||b?" Ã©v":" Ã©ve")}return""}function c(a){return(a?"":"[mÃºlt] ")+"["+d[this.day()]+"] LT[-kor]"}var d="vasÃ¡rnap hÃ©tfÅ‘n kedden szerdÃ¡n csÃ¼tÃ¶rtÃ¶kÃ¶n pÃ©nteken szombaton".split(" ");return a.lang("hu",{months:"januÃ¡r_februÃ¡r_mÃ¡rcius_Ã¡prilis_mÃ¡jus_jÃºnius_jÃºlius_augusztus_szeptember_oktÃ³ber_november_december".split("_"),monthsShort:"jan_feb_mÃ¡rc_Ã¡pr_mÃ¡j_jÃºn_jÃºl_aug_szept_okt_nov_dec".split("_"),weekdays:"vasÃ¡rnap_hÃ©tfÅ‘_kedd_szerda_csÃ¼tÃ¶rtÃ¶k_pÃ©ntek_szombat".split("_"),weekdaysShort:"vas_hÃ©t_kedd_sze_csÃ¼t_pÃ©n_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D., LT",LLLL:"YYYY. MMMM D., dddd LT"},meridiem:function(a,b,c){return 12>a?c===!0?"de":"DE":c===!0?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return c.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return c.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s mÃºlva",past:"%s",s:b,m:b,mm:b,h:b,hh:b,d:b,dd:b,M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){function b(a,b){var c={nominative:"Õ°Õ¸Ö‚Õ¶Õ¾Õ¡Ö€_ÖƒÕ¥Õ¿Ö€Õ¾Õ¡Ö€_Õ´Õ¡Ö€Õ¿_Õ¡ÕºÖ€Õ«Õ¬_Õ´Õ¡ÕµÕ«Õ½_Õ°Õ¸Ö‚Õ¶Õ«Õ½_Õ°Õ¸Ö‚Õ¬Õ«Õ½_Ö…Õ£Õ¸Õ½Õ¿Õ¸Õ½_Õ½Õ¥ÕºÕ¿Õ¥Õ´Õ¢Õ¥Ö€_Õ°Õ¸Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö€_Õ¶Õ¸ÕµÕ¥Õ´Õ¢Õ¥Ö€_Õ¤Õ¥Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö€".split("_"),accusative:"Õ°Õ¸Ö‚Õ¶Õ¾Õ¡Ö€Õ«_ÖƒÕ¥Õ¿Ö€Õ¾Õ¡Ö€Õ«_Õ´Õ¡Ö€Õ¿Õ«_Õ¡ÕºÖ€Õ«Õ¬Õ«_Õ´Õ¡ÕµÕ«Õ½Õ«_Õ°Õ¸Ö‚Õ¶Õ«Õ½Õ«_Õ°Õ¸Ö‚Õ¬Õ«Õ½Õ«_Ö…Õ£Õ¸Õ½Õ¿Õ¸Õ½Õ«_Õ½Õ¥ÕºÕ¿Õ¥Õ´Õ¢Õ¥Ö€Õ«_Õ°Õ¸Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö€Õ«_Õ¶Õ¸ÕµÕ¥Õ´Õ¢Õ¥Ö€Õ«_Õ¤Õ¥Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö€Õ«".split("_")},d=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function c(a){var b="Õ°Õ¶Õ¾_ÖƒÕ¿Ö€_Õ´Ö€Õ¿_Õ¡ÕºÖ€_Õ´ÕµÕ½_Õ°Õ¶Õ½_Õ°Õ¬Õ½_Ö…Õ£Õ½_Õ½ÕºÕ¿_Õ°Õ¯Õ¿_Õ¶Õ´Õ¢_Õ¤Õ¯Õ¿".split("_");return b[a.month()]}function d(a){var b="Õ¯Õ«Ö€Õ¡Õ¯Õ«_Õ¥Ö€Õ¯Õ¸Ö‚Õ·Õ¡Õ¢Õ©Õ«_Õ¥Ö€Õ¥Ö„Õ·Õ¡Õ¢Õ©Õ«_Õ¹Õ¸Ö€Õ¥Ö„Õ·Õ¡Õ¢Õ©Õ«_Õ°Õ«Õ¶Õ£Õ·Õ¡Õ¢Õ©Õ«_Õ¸Ö‚Ö€Õ¢Õ¡Õ©_Õ·Õ¡Õ¢Õ¡Õ©".split("_");return b[a.day()]}return a.lang("hy-am",{months:b,monthsShort:c,weekdays:d,weekdaysShort:"Õ¯Ö€Õ¯_Õ¥Ö€Õ¯_Õ¥Ö€Ö„_Õ¹Ö€Ö„_Õ°Õ¶Õ£_Õ¸Ö‚Ö€Õ¢_Õ·Õ¢Õ©".split("_"),weekdaysMin:"Õ¯Ö€Õ¯_Õ¥Ö€Õ¯_Õ¥Ö€Ö„_Õ¹Ö€Ö„_Õ°Õ¶Õ£_Õ¸Ö‚Ö€Õ¢_Õ·Õ¢Õ©".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY Õ©.",LLL:"D MMMM YYYY Õ©., LT",LLLL:"dddd, D MMMM YYYY Õ©., LT"},calendar:{sameDay:"[Õ¡ÕµÕ½Ö…Ö€] LT",nextDay:"[Õ¾Õ¡Õ²Õ¨] LT",lastDay:"[Õ¥Ö€Õ¥Õ¯] LT",nextWeek:function(){return"dddd [Ö…Ö€Õ¨ ÕªÕ¡Õ´Õ¨] LT"},lastWeek:function(){return"[Õ¡Õ¶ÖÕ¡Õ®] dddd [Ö…Ö€Õ¨ ÕªÕ¡Õ´Õ¨] LT"},sameElse:"L"},relativeTime:{future:"%s Õ°Õ¥Õ¿Õ¸",past:"%s Õ¡Õ¼Õ¡Õ»",s:"Õ´Õ« Ö„Õ¡Õ¶Õ« Õ¾Õ¡ÕµÖ€Õ¯ÕµÕ¡Õ¶",m:"Ö€Õ¸ÕºÕ¥",mm:"%d Ö€Õ¸ÕºÕ¥",h:"ÕªÕ¡Õ´",hh:"%d ÕªÕ¡Õ´",d:"Ö…Ö€",dd:"%d Ö…Ö€",M:"Õ¡Õ´Õ«Õ½",MM:"%d Õ¡Õ´Õ«Õ½",y:"Õ¿Õ¡Ö€Õ«",yy:"%d Õ¿Õ¡Ö€Õ«"},meridiem:function(a){return 4>a?"Õ£Õ«Õ·Õ¥Ö€Õ¾Õ¡":12>a?"Õ¡Õ¼Õ¡Õ¾Õ¸Õ¿Õ¾Õ¡":17>a?"ÖÕ¥Ö€Õ¥Õ¯Õ¾Õ¡":"Õ¥Ö€Õ¥Õ¯Õ¸ÕµÕ¡Õ¶"},ordinal:function(a,b){switch(b){case"DDD":case"w":case"W":case"DDDo":return 1===a?a+"-Õ«Õ¶":a+"-Ö€Õ¤";default:return a}},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] LT",LLLL:"dddd, D MMMM YYYY [pukul] LT"},meridiem:function(a){return 11>a?"pagi":15>a?"siang":19>a?"sore":"malam"
},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){function b(a){return a%100===11?!0:a%10===1?!1:!0}function c(a,c,d,e){var f=a+" ";switch(d){case"s":return c||e?"nokkrar sekÃºndur":"nokkrum sekÃºndum";case"m":return c?"mÃ­nÃºta":"mÃ­nÃºtu";case"mm":return b(a)?f+(c||e?"mÃ­nÃºtur":"mÃ­nÃºtum"):c?f+"mÃ­nÃºta":f+"mÃ­nÃºtu";case"hh":return b(a)?f+(c||e?"klukkustundir":"klukkustundum"):f+"klukkustund";case"d":return c?"dagur":e?"dag":"degi";case"dd":return b(a)?c?f+"dagar":f+(e?"daga":"dÃ¶gum"):c?f+"dagur":f+(e?"dag":"degi");case"M":return c?"mÃ¡nuÃ°ur":e?"mÃ¡nuÃ°":"mÃ¡nuÃ°i";case"MM":return b(a)?c?f+"mÃ¡nuÃ°ir":f+(e?"mÃ¡nuÃ°i":"mÃ¡nuÃ°um"):c?f+"mÃ¡nuÃ°ur":f+(e?"mÃ¡nuÃ°":"mÃ¡nuÃ°i");case"y":return c||e?"Ã¡r":"Ã¡ri";case"yy":return b(a)?f+(c||e?"Ã¡r":"Ã¡rum"):f+(c||e?"Ã¡r":"Ã¡ri")}}return a.lang("is",{months:"janÃºar_febrÃºar_mars_aprÃ­l_maÃ­_jÃºnÃ­_jÃºlÃ­_Ã¡gÃºst_september_oktÃ³ber_nÃ³vember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maÃ­_jÃºn_jÃºl_Ã¡gÃº_sep_okt_nÃ³v_des".split("_"),weekdays:"sunnudagur_mÃ¡nudagur_Ã¾riÃ°judagur_miÃ°vikudagur_fimmtudagur_fÃ¶studagur_laugardagur".split("_"),weekdaysShort:"sun_mÃ¡n_Ã¾ri_miÃ°_fim_fÃ¶s_lau".split("_"),weekdaysMin:"Su_MÃ¡_Ãžr_Mi_Fi_FÃ¶_La".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] LT",LLLL:"dddd, D. MMMM YYYY [kl.] LT"},calendar:{sameDay:"[Ã­ dag kl.] LT",nextDay:"[Ã¡ morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Ã­ gÃ¦r kl.] LT",lastWeek:"[sÃ­Ã°asta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s sÃ­Ã°an",s:c,m:c,mm:c,h:"klukkustund",hh:c,d:c,dd:c,M:c,MM:c,y:c,yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("it",{months:"Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settembre_Ottobre_Novembre_Dicembre".split("_"),monthsShort:"Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic".split("_"),weekdays:"Domenica_LunedÃ¬_MartedÃ¬_MercoledÃ¬_GiovedÃ¬_VenerdÃ¬_Sabato".split("_"),weekdaysShort:"Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),weekdaysMin:"D_L_Ma_Me_G_V_S".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:"[lo scorso] dddd [alle] LT",sameElse:"L"},relativeTime:{future:function(a){return(/^[0-9].+$/.test(a)?"tra":"in")+" "+a},past:"%s fa",s:"alcuni secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:"%dÂº",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("ja",{months:"1æœˆ_2æœˆ_3æœˆ_4æœˆ_5æœˆ_6æœˆ_7æœˆ_8æœˆ_9æœˆ_10æœˆ_11æœˆ_12æœˆ".split("_"),monthsShort:"1æœˆ_2æœˆ_3æœˆ_4æœˆ_5æœˆ_6æœˆ_7æœˆ_8æœˆ_9æœˆ_10æœˆ_11æœˆ_12æœˆ".split("_"),weekdays:"æ—¥æ›œæ—¥_æœˆæ›œæ—¥_ç«æ›œæ—¥_æ°´æ›œæ—¥_æœ¨æ›œæ—¥_é‡‘æ›œæ—¥_åœŸæ›œæ—¥".split("_"),weekdaysShort:"æ—¥_æœˆ_ç«_æ°´_æœ¨_é‡‘_åœŸ".split("_"),weekdaysMin:"æ—¥_æœˆ_ç«_æ°´_æœ¨_é‡‘_åœŸ".split("_"),longDateFormat:{LT:"Ahæ™‚måˆ†",L:"YYYY/MM/DD",LL:"YYYYå¹´MæœˆDæ—¥",LLL:"YYYYå¹´MæœˆDæ—¥LT",LLLL:"YYYYå¹´MæœˆDæ—¥LT dddd"},meridiem:function(a){return 12>a?"åˆå‰":"åˆå¾Œ"},calendar:{sameDay:"[ä»Šæ—¥] LT",nextDay:"[æ˜Žæ—¥] LT",nextWeek:"[æ¥é€±]dddd LT",lastDay:"[æ˜¨æ—¥] LT",lastWeek:"[å‰é€±]dddd LT",sameElse:"L"},relativeTime:{future:"%så¾Œ",past:"%så‰",s:"æ•°ç§’",m:"1åˆ†",mm:"%dåˆ†",h:"1æ™‚é–“",hh:"%dæ™‚é–“",d:"1æ—¥",dd:"%dæ—¥",M:"1ãƒ¶æœˆ",MM:"%dãƒ¶æœˆ",y:"1å¹´",yy:"%då¹´"}})}),function(a){a(ib)}(function(a){function b(a,b){var c={nominative:"áƒ˜áƒáƒœáƒ•áƒáƒ áƒ˜_áƒ—áƒ”áƒ‘áƒ”áƒ áƒ•áƒáƒšáƒ˜_áƒ›áƒáƒ áƒ¢áƒ˜_áƒáƒžáƒ áƒ˜áƒšáƒ˜_áƒ›áƒáƒ˜áƒ¡áƒ˜_áƒ˜áƒ•áƒœáƒ˜áƒ¡áƒ˜_áƒ˜áƒ•áƒšáƒ˜áƒ¡áƒ˜_áƒáƒ’áƒ•áƒ˜áƒ¡áƒ¢áƒ_áƒ¡áƒ”áƒ¥áƒ¢áƒ”áƒ›áƒ‘áƒ”áƒ áƒ˜_áƒáƒ¥áƒ¢áƒáƒ›áƒ‘áƒ”áƒ áƒ˜_áƒœáƒáƒ”áƒ›áƒ‘áƒ”áƒ áƒ˜_áƒ“áƒ”áƒ™áƒ”áƒ›áƒ‘áƒ”áƒ áƒ˜".split("_"),accusative:"áƒ˜áƒáƒœáƒ•áƒáƒ áƒ¡_áƒ—áƒ”áƒ‘áƒ”áƒ áƒ•áƒáƒšáƒ¡_áƒ›áƒáƒ áƒ¢áƒ¡_áƒáƒžáƒ áƒ˜áƒšáƒ˜áƒ¡_áƒ›áƒáƒ˜áƒ¡áƒ¡_áƒ˜áƒ•áƒœáƒ˜áƒ¡áƒ¡_áƒ˜áƒ•áƒšáƒ˜áƒ¡áƒ¡_áƒáƒ’áƒ•áƒ˜áƒ¡áƒ¢áƒ¡_áƒ¡áƒ”áƒ¥áƒ¢áƒ”áƒ›áƒ‘áƒ”áƒ áƒ¡_áƒáƒ¥áƒ¢áƒáƒ›áƒ‘áƒ”áƒ áƒ¡_áƒœáƒáƒ”áƒ›áƒ‘áƒ”áƒ áƒ¡_áƒ“áƒ”áƒ™áƒ”áƒ›áƒ‘áƒ”áƒ áƒ¡".split("_")},d=/D[oD] *MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function c(a,b){var c={nominative:"áƒ™áƒ•áƒ˜áƒ áƒ_áƒáƒ áƒ¨áƒáƒ‘áƒáƒ—áƒ˜_áƒ¡áƒáƒ›áƒ¨áƒáƒ‘áƒáƒ—áƒ˜_áƒáƒ—áƒ®áƒ¨áƒáƒ‘áƒáƒ—áƒ˜_áƒ®áƒ£áƒ—áƒ¨áƒáƒ‘áƒáƒ—áƒ˜_áƒžáƒáƒ áƒáƒ¡áƒ™áƒ”áƒ•áƒ˜_áƒ¨áƒáƒ‘áƒáƒ—áƒ˜".split("_"),accusative:"áƒ™áƒ•áƒ˜áƒ áƒáƒ¡_áƒáƒ áƒ¨áƒáƒ‘áƒáƒ—áƒ¡_áƒ¡áƒáƒ›áƒ¨áƒáƒ‘áƒáƒ—áƒ¡_áƒáƒ—áƒ®áƒ¨áƒáƒ‘áƒáƒ—áƒ¡_áƒ®áƒ£áƒ—áƒ¨áƒáƒ‘áƒáƒ—áƒ¡_áƒžáƒáƒ áƒáƒ¡áƒ™áƒ”áƒ•áƒ¡_áƒ¨áƒáƒ‘áƒáƒ—áƒ¡".split("_")},d=/(áƒ¬áƒ˜áƒœáƒ|áƒ¨áƒ”áƒ›áƒ“áƒ”áƒ’)/.test(b)?"accusative":"nominative";return c[d][a.day()]}return a.lang("ka",{months:b,monthsShort:"áƒ˜áƒáƒœ_áƒ—áƒ”áƒ‘_áƒ›áƒáƒ _áƒáƒžáƒ _áƒ›áƒáƒ˜_áƒ˜áƒ•áƒœ_áƒ˜áƒ•áƒš_áƒáƒ’áƒ•_áƒ¡áƒ”áƒ¥_áƒáƒ¥áƒ¢_áƒœáƒáƒ”_áƒ“áƒ”áƒ™".split("_"),weekdays:c,weekdaysShort:"áƒ™áƒ•áƒ˜_áƒáƒ áƒ¨_áƒ¡áƒáƒ›_áƒáƒ—áƒ®_áƒ®áƒ£áƒ—_áƒžáƒáƒ _áƒ¨áƒáƒ‘".split("_"),weekdaysMin:"áƒ™áƒ•_áƒáƒ _áƒ¡áƒ_áƒáƒ—_áƒ®áƒ£_áƒžáƒ_áƒ¨áƒ".split("_"),longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[áƒ“áƒ¦áƒ”áƒ¡] LT[-áƒ–áƒ”]",nextDay:"[áƒ®áƒ•áƒáƒš] LT[-áƒ–áƒ”]",lastDay:"[áƒ’áƒ£áƒ¨áƒ˜áƒœ] LT[-áƒ–áƒ”]",nextWeek:"[áƒ¨áƒ”áƒ›áƒ“áƒ”áƒ’] dddd LT[-áƒ–áƒ”]",lastWeek:"[áƒ¬áƒ˜áƒœáƒ] dddd LT-áƒ–áƒ”",sameElse:"L"},relativeTime:{future:function(a){return/(áƒ¬áƒáƒ›áƒ˜|áƒ¬áƒ£áƒ—áƒ˜|áƒ¡áƒáƒáƒ—áƒ˜|áƒ¬áƒ”áƒšáƒ˜)/.test(a)?a.replace(/áƒ˜$/,"áƒ¨áƒ˜"):a+"áƒ¨áƒ˜"},past:function(a){return/(áƒ¬áƒáƒ›áƒ˜|áƒ¬áƒ£áƒ—áƒ˜|áƒ¡áƒáƒáƒ—áƒ˜|áƒ“áƒ¦áƒ”|áƒ—áƒ•áƒ”)/.test(a)?a.replace(/(áƒ˜|áƒ”)$/,"áƒ˜áƒ¡ áƒ¬áƒ˜áƒœ"):/áƒ¬áƒ”áƒšáƒ˜/.test(a)?a.replace(/áƒ¬áƒ”áƒšáƒ˜$/,"áƒ¬áƒšáƒ˜áƒ¡ áƒ¬áƒ˜áƒœ"):void 0},s:"áƒ áƒáƒ›áƒ“áƒ”áƒœáƒ˜áƒ›áƒ” áƒ¬áƒáƒ›áƒ˜",m:"áƒ¬áƒ£áƒ—áƒ˜",mm:"%d áƒ¬áƒ£áƒ—áƒ˜",h:"áƒ¡áƒáƒáƒ—áƒ˜",hh:"%d áƒ¡áƒáƒáƒ—áƒ˜",d:"áƒ“áƒ¦áƒ”",dd:"%d áƒ“áƒ¦áƒ”",M:"áƒ—áƒ•áƒ”",MM:"%d áƒ—áƒ•áƒ”",y:"áƒ¬áƒ”áƒšáƒ˜",yy:"%d áƒ¬áƒ”áƒšáƒ˜"},ordinal:function(a){return 0===a?a:1===a?a+"-áƒšáƒ˜":20>a||100>=a&&a%20===0||a%100===0?"áƒ›áƒ”-"+a:a+"-áƒ”"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("km",{months:"áž˜áž€ážšáž¶_áž€áž»áž˜áŸ’áž—áŸˆ_áž˜áž·áž“áž¶_áž˜áŸážŸáž¶_áž§ážŸáž—áž¶_áž˜áž·ážáž»áž“áž¶_áž€áž€áŸ’áž€ážŠáž¶_ážŸáž¸áž áž¶_áž€áž‰áŸ’áž‰áž¶_ážáž»áž›áž¶_ážœáž·áž…áŸ’áž†áž·áž€áž¶_áž’áŸ’áž“áž¼".split("_"),monthsShort:"áž˜áž€ážšáž¶_áž€áž»áž˜áŸ’áž—áŸˆ_áž˜áž·áž“áž¶_áž˜áŸážŸáž¶_áž§ážŸáž—áž¶_áž˜áž·ážáž»áž“áž¶_áž€áž€áŸ’áž€ážŠáž¶_ážŸáž¸áž áž¶_áž€áž‰áŸ’áž‰áž¶_ážáž»áž›áž¶_ážœáž·áž…áŸ’áž†áž·áž€áž¶_áž’áŸ’áž“áž¼".split("_"),weekdays:"áž¢áž¶áž‘áž·ážáŸ’áž™_áž…áŸáž“áŸ’áž‘_áž¢áž„áŸ’áž‚áž¶ážš_áž–áž»áž’_áž–áŸ’ážšáž ážŸáŸ’áž”ážáž·áŸ_ážŸáž»áž€áŸ’ážš_ážŸáŸ…ážšáŸ".split("_"),weekdaysShort:"áž¢áž¶áž‘áž·ážáŸ’áž™_áž…áŸáž“áŸ’áž‘_áž¢áž„áŸ’áž‚áž¶ážš_áž–áž»áž’_áž–áŸ’ážšáž ážŸáŸ’áž”ážáž·áŸ_ážŸáž»áž€áŸ’ážš_ážŸáŸ…ážšáŸ".split("_"),weekdaysMin:"áž¢áž¶áž‘áž·ážáŸ’áž™_áž…áŸáž“áŸ’áž‘_áž¢áž„áŸ’áž‚áž¶ážš_áž–áž»áž’_áž–áŸ’ážšáž ážŸáŸ’áž”ážáž·áŸ_ážŸáž»áž€áŸ’ážš_ážŸáŸ…ážšáŸ".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[ážáŸ’áž„áŸƒáž“áŸˆ áž˜áŸ‰áŸ„áž„] LT",nextDay:"[ážŸáŸ’áž¢áŸ‚áž€ áž˜áŸ‰áŸ„áž„] LT",nextWeek:"dddd [áž˜áŸ‰áŸ„áž„] LT",lastDay:"[áž˜áŸ’ážŸáž·áž›áž˜áž·áž‰ áž˜áŸ‰áŸ„áž„] LT",lastWeek:"dddd [ážŸáž”áŸ’ážáž¶áž áŸáž˜áž»áž“] [áž˜áŸ‰áŸ„áž„] LT",sameElse:"L"},relativeTime:{future:"%sáž‘áŸ€áž",past:"%sáž˜áž»áž“",s:"áž”áŸ‰áž»áž“áŸ’áž˜áž¶áž“ážœáž·áž“áž¶áž‘áž¸",m:"áž˜áž½áž™áž“áž¶áž‘áž¸",mm:"%d áž“áž¶áž‘áž¸",h:"áž˜áž½áž™áž˜áŸ‰áŸ„áž„",hh:"%d áž˜áŸ‰áŸ„áž„",d:"áž˜áž½áž™ážáŸ’áž„áŸƒ",dd:"%d ážáŸ’áž„áŸƒ",M:"áž˜áž½áž™ážáŸ‚",MM:"%d ážáŸ‚",y:"áž˜áž½áž™áž†áŸ’áž“áž¶áŸ†",yy:"%d áž†áŸ’áž“áž¶áŸ†"},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("ko",{months:"1ì›”_2ì›”_3ì›”_4ì›”_5ì›”_6ì›”_7ì›”_8ì›”_9ì›”_10ì›”_11ì›”_12ì›”".split("_"),monthsShort:"1ì›”_2ì›”_3ì›”_4ì›”_5ì›”_6ì›”_7ì›”_8ì›”_9ì›”_10ì›”_11ì›”_12ì›”".split("_"),weekdays:"ì¼ìš”ì¼_ì›”ìš”ì¼_í™”ìš”ì¼_ìˆ˜ìš”ì¼_ëª©ìš”ì¼_ê¸ˆìš”ì¼_í† ìš”ì¼".split("_"),weekdaysShort:"ì¼_ì›”_í™”_ìˆ˜_ëª©_ê¸ˆ_í† ".split("_"),weekdaysMin:"ì¼_ì›”_í™”_ìˆ˜_ëª©_ê¸ˆ_í† ".split("_"),longDateFormat:{LT:"A hì‹œ mmë¶„",L:"YYYY.MM.DD",LL:"YYYYë…„ MMMM Dì¼",LLL:"YYYYë…„ MMMM Dì¼ LT",LLLL:"YYYYë…„ MMMM Dì¼ dddd LT"},meridiem:function(a){return 12>a?"ì˜¤ì „":"ì˜¤í›„"},calendar:{sameDay:"ì˜¤ëŠ˜ LT",nextDay:"ë‚´ì¼ LT",nextWeek:"dddd LT",lastDay:"ì–´ì œ LT",lastWeek:"ì§€ë‚œì£¼ dddd LT",sameElse:"L"},relativeTime:{future:"%s í›„",past:"%s ì „",s:"ëª‡ì´ˆ",ss:"%dì´ˆ",m:"ì¼ë¶„",mm:"%dë¶„",h:"í•œì‹œê°„",hh:"%dì‹œê°„",d:"í•˜ë£¨",dd:"%dì¼",M:"í•œë‹¬",MM:"%dë‹¬",y:"ì¼ë…„",yy:"%dë…„"},ordinal:"%dì¼",meridiemParse:/(ì˜¤ì „|ì˜¤í›„)/,isPM:function(a){return"ì˜¤í›„"===a}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],dd:[a+" Deeg",a+" Deeg"],M:["ee Mount","engem Mount"],MM:[a+" MÃ©int",a+" MÃ©int"],y:["ee Joer","engem Joer"],yy:[a+" Joer",a+" Joer"]};return b?d[c][0]:d[c][1]}function c(a){var b=a.substr(0,a.indexOf(" "));return g(b)?"a "+a:"an "+a}function d(a){var b=a.substr(0,a.indexOf(" "));return g(b)?"viru "+a:"virun "+a}function e(){var a=this.format("d");return f(a)?"[Leschte] dddd [um] LT":"[Leschten] dddd [um] LT"}function f(a){switch(a=parseInt(a,10)){case 0:case 1:case 3:case 5:case 6:return!0;default:return!1}}function g(a){if(a=parseInt(a,10),isNaN(a))return!1;if(0>a)return!0;if(10>a)return a>=4&&7>=a?!0:!1;if(100>a){var b=a%10,c=a/10;return g(0===b?c:b)}if(1e4>a){for(;a>=10;)a/=10;return g(a)}return a/=1e3,g(a)}return a.lang("lb",{months:"Januar_Februar_MÃ¤erz_AbrÃ«ll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),weekdays:"Sonndeg_MÃ©indeg_DÃ«nschdeg_MÃ«ttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._MÃ©._DÃ«._MÃ«._Do._Fr._Sa.".split("_"),weekdaysMin:"So_MÃ©_DÃ«_MÃ«_Do_Fr_Sa".split("_"),longDateFormat:{LT:"H:mm [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[GÃ«schter um] LT",lastWeek:e},relativeTime:{future:c,past:d,s:"e puer Sekonnen",m:b,mm:"%d Minutten",h:b,hh:"%d Stonnen",d:b,dd:b,M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c,d){return b?"kelios sekundÄ—s":d?"keliÅ³ sekundÅ¾iÅ³":"kelias sekundes"}function c(a,b,c,d){return b?e(c)[0]:d?e(c)[1]:e(c)[2]}function d(a){return a%10===0||a>10&&20>a}function e(a){return h[a].split("_")}function f(a,b,f,g){var h=a+" ";return 1===a?h+c(a,b,f[0],g):b?h+(d(a)?e(f)[1]:e(f)[0]):g?h+e(f)[1]:h+(d(a)?e(f)[1]:e(f)[2])}function g(a,b){var c=-1===b.indexOf("dddd HH:mm"),d=i[a.weekday()];return c?d:d.substring(0,d.length-2)+"Ä¯"}var h={m:"minutÄ—_minutÄ—s_minutÄ™",mm:"minutÄ—s_minuÄiÅ³_minutes",h:"valanda_valandos_valandÄ…",hh:"valandos_valandÅ³_valandas",d:"diena_dienos_dienÄ…",dd:"dienos_dienÅ³_dienas",M:"mÄ—nuo_mÄ—nesio_mÄ—nesÄ¯",MM:"mÄ—nesiai_mÄ—nesiÅ³_mÄ—nesius",y:"metai_metÅ³_metus",yy:"metai_metÅ³_metus"},i="pirmadienis_antradienis_treÄiadienis_ketvirtadienis_penktadienis_Å¡eÅ¡tadienis_sekmadienis".split("_");return a.lang("lt",{months:"sausio_vasario_kovo_balandÅ¾io_geguÅ¾Ä—s_birÅ¾Ä—lio_liepos_rugpjÅ«Äio_rugsÄ—jo_spalio_lapkriÄio_gruodÅ¾io".split("_"),monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:g,weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_Å eÅ¡".split("_"),weekdaysMin:"S_P_A_T_K_Pn_Å ".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], LT [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, LT [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], LT [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, LT [val.]"},calendar:{sameDay:"[Å iandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[PraÄ—jusÄ¯] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prieÅ¡ %s",s:b,m:c,mm:f,h:c,hh:f,d:c,dd:f,M:c,MM:f,y:c,yy:f},ordinal:function(a){return a+"-oji"},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d=a.split("_");return c?b%10===1&&11!==b?d[2]:d[3]:b%10===1&&11!==b?d[0]:d[1]}function c(a,c,e){return a+" "+b(d[e],a,c)}var d={mm:"minÅ«ti_minÅ«tes_minÅ«te_minÅ«tes",hh:"stundu_stundas_stunda_stundas",dd:"dienu_dienas_diena_dienas",MM:"mÄ“nesi_mÄ“neÅ¡us_mÄ“nesis_mÄ“neÅ¡i",yy:"gadu_gadus_gads_gadi"};return a.lang("lv",{months:"janvÄris_februÄris_marts_aprÄ«lis_maijs_jÅ«nijs_jÅ«lijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jÅ«n_jÅ«l_aug_sep_okt_nov_dec".split("_"),weekdays:"svÄ“tdiena_pirmdiena_otrdiena_treÅ¡diena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, LT",LLLL:"YYYY. [gada] D. MMMM, dddd, LT"},calendar:{sameDay:"[Å odien pulksten] LT",nextDay:"[RÄ«t pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[PagÄjuÅ¡Ä] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"%s vÄ“lÄk",past:"%s agrÄk",s:"daÅ¾as sekundes",m:"minÅ«ti",mm:c,h:"stundu",hh:c,d:"dienu",dd:c,M:"mÄ“nesi",MM:c,y:"gadu",yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("mk",{months:"Ñ˜Ð°Ð½ÑƒÐ°Ñ€Ð¸_Ñ„ÐµÐ²Ñ€ÑƒÐ°Ñ€Ð¸_Ð¼Ð°Ñ€Ñ‚_Ð°Ð¿Ñ€Ð¸Ð»_Ð¼Ð°Ñ˜_Ñ˜ÑƒÐ½Ð¸_Ñ˜ÑƒÐ»Ð¸_Ð°Ð²Ð³ÑƒÑÑ‚_ÑÐµÐ¿Ñ‚ÐµÐ¼Ð²Ñ€Ð¸_Ð¾ÐºÑ‚Ð¾Ð¼Ð²Ñ€Ð¸_Ð½Ð¾ÐµÐ¼Ð²Ñ€Ð¸_Ð´ÐµÐºÐµÐ¼Ð²Ñ€Ð¸".split("_"),monthsShort:"Ñ˜Ð°Ð½_Ñ„ÐµÐ²_Ð¼Ð°Ñ€_Ð°Ð¿Ñ€_Ð¼Ð°Ñ˜_Ñ˜ÑƒÐ½_Ñ˜ÑƒÐ»_Ð°Ð²Ð³_ÑÐµÐ¿_Ð¾ÐºÑ‚_Ð½Ð¾Ðµ_Ð´ÐµÐº".split("_"),weekdays:"Ð½ÐµÐ´ÐµÐ»Ð°_Ð¿Ð¾Ð½ÐµÐ´ÐµÐ»Ð½Ð¸Ðº_Ð²Ñ‚Ð¾Ñ€Ð½Ð¸Ðº_ÑÑ€ÐµÐ´Ð°_Ñ‡ÐµÑ‚Ð²Ñ€Ñ‚Ð¾Ðº_Ð¿ÐµÑ‚Ð¾Ðº_ÑÐ°Ð±Ð¾Ñ‚Ð°".split("_"),weekdaysShort:"Ð½ÐµÐ´_Ð¿Ð¾Ð½_Ð²Ñ‚Ð¾_ÑÑ€Ðµ_Ñ‡ÐµÑ‚_Ð¿ÐµÑ‚_ÑÐ°Ð±".split("_"),weekdaysMin:"Ð½e_Ð¿o_Ð²Ñ‚_ÑÑ€_Ñ‡Ðµ_Ð¿Ðµ_Ña".split("_"),longDateFormat:{LT:"H:mm",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Ð”ÐµÐ½ÐµÑ Ð²Ð¾] LT",nextDay:"[Ð£Ñ‚Ñ€Ðµ Ð²Ð¾] LT",nextWeek:"dddd [Ð²Ð¾] LT",lastDay:"[Ð’Ñ‡ÐµÑ€Ð° Ð²Ð¾] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Ð’Ð¾ Ð¸Ð·Ð¼Ð¸Ð½Ð°Ñ‚Ð°Ñ‚Ð°] dddd [Ð²Ð¾] LT";case 1:case 2:case 4:case 5:return"[Ð’Ð¾ Ð¸Ð·Ð¼Ð¸Ð½Ð°Ñ‚Ð¸Ð¾Ñ‚] dddd [Ð²Ð¾] LT"}},sameElse:"L"},relativeTime:{future:"Ð¿Ð¾ÑÐ»Ðµ %s",past:"Ð¿Ñ€ÐµÐ´ %s",s:"Ð½ÐµÐºÐ¾Ð»ÐºÑƒ ÑÐµÐºÑƒÐ½Ð´Ð¸",m:"Ð¼Ð¸Ð½ÑƒÑ‚Ð°",mm:"%d Ð¼Ð¸Ð½ÑƒÑ‚Ð¸",h:"Ñ‡Ð°Ñ",hh:"%d Ñ‡Ð°ÑÐ°",d:"Ð´ÐµÐ½",dd:"%d Ð´ÐµÐ½Ð°",M:"Ð¼ÐµÑÐµÑ†",MM:"%d Ð¼ÐµÑÐµÑ†Ð¸",y:"Ð³Ð¾Ð´Ð¸Ð½Ð°",yy:"%d Ð³Ð¾Ð´Ð¸Ð½Ð¸"},ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ÐµÐ²":0===c?a+"-ÐµÐ½":c>10&&20>c?a+"-Ñ‚Ð¸":1===b?a+"-Ð²Ð¸":2===b?a+"-Ñ€Ð¸":7===b||8===b?a+"-Ð¼Ð¸":a+"-Ñ‚Ð¸"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("ml",{months:"à´œà´¨àµà´µà´°à´¿_à´«àµ†à´¬àµà´°àµà´µà´°à´¿_à´®à´¾àµ¼à´šàµà´šàµ_à´à´ªàµà´°à´¿àµ½_à´®àµ‡à´¯àµ_à´œàµ‚àµº_à´œàµ‚à´²àµˆ_à´“à´—à´¸àµà´±àµà´±àµ_à´¸àµ†à´ªàµà´±àµà´±à´‚à´¬àµ¼_à´’à´•àµà´Ÿàµ‹à´¬àµ¼_à´¨à´µà´‚à´¬àµ¼_à´¡à´¿à´¸à´‚à´¬àµ¼".split("_"),monthsShort:"à´œà´¨àµ._à´«àµ†à´¬àµà´°àµ._à´®à´¾àµ¼._à´à´ªàµà´°à´¿._à´®àµ‡à´¯àµ_à´œàµ‚àµº_à´œàµ‚à´²àµˆ._à´“à´—._à´¸àµ†à´ªàµà´±àµà´±._à´’à´•àµà´Ÿàµ‹._à´¨à´µà´‚._à´¡à´¿à´¸à´‚.".split("_"),weekdays:"à´žà´¾à´¯à´±à´¾à´´àµà´š_à´¤à´¿à´™àµà´•à´³à´¾à´´àµà´š_à´šàµŠà´µàµà´µà´¾à´´àµà´š_à´¬àµà´§à´¨à´¾à´´àµà´š_à´µàµà´¯à´¾à´´à´¾à´´àµà´š_à´µàµ†à´³àµà´³à´¿à´¯à´¾à´´àµà´š_à´¶à´¨à´¿à´¯à´¾à´´àµà´š".split("_"),weekdaysShort:"à´žà´¾à´¯àµ¼_à´¤à´¿à´™àµà´•àµ¾_à´šàµŠà´µàµà´µ_à´¬àµà´§àµ»_à´µàµà´¯à´¾à´´à´‚_à´µàµ†à´³àµà´³à´¿_à´¶à´¨à´¿".split("_"),weekdaysMin:"à´žà´¾_à´¤à´¿_à´šàµŠ_à´¬àµ_à´µàµà´¯à´¾_à´µàµ†_à´¶".split("_"),longDateFormat:{LT:"A h:mm -à´¨àµ",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[à´‡à´¨àµà´¨àµ] LT",nextDay:"[à´¨à´¾à´³àµ†] LT",nextWeek:"dddd, LT",lastDay:"[à´‡à´¨àµà´¨à´²àµ†] LT",lastWeek:"[à´•à´´à´¿à´žàµà´ž] dddd, LT",sameElse:"L"},relativeTime:{future:"%s à´•à´´à´¿à´žàµà´žàµ",past:"%s à´®àµàµ»à´ªàµ",s:"à´…àµ½à´ª à´¨à´¿à´®à´¿à´·à´™àµà´™àµ¾",m:"à´’à´°àµ à´®à´¿à´¨à´¿à´±àµà´±àµ",mm:"%d à´®à´¿à´¨à´¿à´±àµà´±àµ",h:"à´’à´°àµ à´®à´£à´¿à´•àµà´•àµ‚àµ¼",hh:"%d à´®à´£à´¿à´•àµà´•àµ‚àµ¼",d:"à´’à´°àµ à´¦à´¿à´µà´¸à´‚",dd:"%d à´¦à´¿à´µà´¸à´‚",M:"à´’à´°àµ à´®à´¾à´¸à´‚",MM:"%d à´®à´¾à´¸à´‚",y:"à´’à´°àµ à´µàµ¼à´·à´‚",yy:"%d à´µàµ¼à´·à´‚"},meridiem:function(a){return 4>a?"à´°à´¾à´¤àµà´°à´¿":12>a?"à´°à´¾à´µà´¿à´²àµ†":17>a?"à´‰à´šàµà´š à´•à´´à´¿à´žàµà´žàµ":20>a?"à´µàµˆà´•àµà´¨àµà´¨àµ‡à´°à´‚":"à´°à´¾à´¤àµà´°à´¿"}})}),function(a){a(ib)}(function(a){var b={1:"à¥§",2:"à¥¨",3:"à¥©",4:"à¥ª",5:"à¥«",6:"à¥¬",7:"à¥­",8:"à¥®",9:"à¥¯",0:"à¥¦"},c={"à¥§":"1","à¥¨":"2","à¥©":"3","à¥ª":"4","à¥«":"5","à¥¬":"6","à¥­":"7","à¥®":"8","à¥¯":"9","à¥¦":"0"};return a.lang("mr",{months:"à¤œà¤¾à¤¨à¥‡à¤µà¤¾à¤°à¥€_à¤«à¥‡à¤¬à¥à¤°à¥à¤µà¤¾à¤°à¥€_à¤®à¤¾à¤°à¥à¤š_à¤à¤ªà¥à¤°à¤¿à¤²_à¤®à¥‡_à¤œà¥‚à¤¨_à¤œà¥à¤²à¥ˆ_à¤‘à¤—à¤¸à¥à¤Ÿ_à¤¸à¤ªà¥à¤Ÿà¥‡à¤‚à¤¬à¤°_à¤‘à¤•à¥à¤Ÿà¥‹à¤¬à¤°_à¤¨à¥‹à¤µà¥à¤¹à¥‡à¤‚à¤¬à¤°_à¤¡à¤¿à¤¸à¥‡à¤‚à¤¬à¤°".split("_"),monthsShort:"à¤œà¤¾à¤¨à¥‡._à¤«à¥‡à¤¬à¥à¤°à¥._à¤®à¤¾à¤°à¥à¤š._à¤à¤ªà¥à¤°à¤¿._à¤®à¥‡._à¤œà¥‚à¤¨._à¤œà¥à¤²à¥ˆ._à¤‘à¤—._à¤¸à¤ªà¥à¤Ÿà¥‡à¤‚._à¤‘à¤•à¥à¤Ÿà¥‹._à¤¨à¥‹à¤µà¥à¤¹à¥‡à¤‚._à¤¡à¤¿à¤¸à¥‡à¤‚.".split("_"),weekdays:"à¤°à¤µà¤¿à¤µà¤¾à¤°_à¤¸à¥‹à¤®à¤µà¤¾à¤°_à¤®à¤‚à¤—à¤³à¤µà¤¾à¤°_à¤¬à¥à¤§à¤µà¤¾à¤°_à¤—à¥à¤°à¥‚à¤µà¤¾à¤°_à¤¶à¥à¤•à¥à¤°à¤µà¤¾à¤°_à¤¶à¤¨à¤¿à¤µà¤¾à¤°".split("_"),weekdaysShort:"à¤°à¤µà¤¿_à¤¸à¥‹à¤®_à¤®à¤‚à¤—à¤³_à¤¬à¥à¤§_à¤—à¥à¤°à¥‚_à¤¶à¥à¤•à¥à¤°_à¤¶à¤¨à¤¿".split("_"),weekdaysMin:"à¤°_à¤¸à¥‹_à¤®à¤‚_à¤¬à¥_à¤—à¥_à¤¶à¥_à¤¶".split("_"),longDateFormat:{LT:"A h:mm à¤µà¤¾à¤œà¤¤à¤¾",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[à¤†à¤œ] LT",nextDay:"[à¤‰à¤¦à¥à¤¯à¤¾] LT",nextWeek:"dddd, LT",lastDay:"[à¤•à¤¾à¤²] LT",lastWeek:"[à¤®à¤¾à¤—à¥€à¤²] dddd, LT",sameElse:"L"},relativeTime:{future:"%s à¤¨à¤‚à¤¤à¤°",past:"%s à¤ªà¥‚à¤°à¥à¤µà¥€",s:"à¤¸à¥‡à¤•à¤‚à¤¦",m:"à¤à¤• à¤®à¤¿à¤¨à¤¿à¤Ÿ",mm:"%d à¤®à¤¿à¤¨à¤¿à¤Ÿà¥‡",h:"à¤à¤• à¤¤à¤¾à¤¸",hh:"%d à¤¤à¤¾à¤¸",d:"à¤à¤• à¤¦à¤¿à¤µà¤¸",dd:"%d à¤¦à¤¿à¤µà¤¸",M:"à¤à¤• à¤®à¤¹à¤¿à¤¨à¤¾",MM:"%d à¤®à¤¹à¤¿à¤¨à¥‡",y:"à¤à¤• à¤µà¤°à¥à¤·",yy:"%d à¤µà¤°à¥à¤·à¥‡"},preparse:function(a){return a.replace(/[à¥§à¥¨à¥©à¥ªà¥«à¥¬à¥­à¥®à¥¯à¥¦]/g,function(a){return c[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]})},meridiem:function(a){return 4>a?"à¤°à¤¾à¤¤à¥à¤°à¥€":10>a?"à¤¸à¤•à¤¾à¤³à¥€":17>a?"à¤¦à¥à¤ªà¤¾à¤°à¥€":20>a?"à¤¸à¤¾à¤¯à¤‚à¤•à¤¾à¤³à¥€":"à¤°à¤¾à¤¤à¥à¤°à¥€"},week:{dow:0,doy:6}})}),function(a){a(ib)}(function(a){return a.lang("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] LT",LLLL:"dddd, D MMMM YYYY [pukul] LT"},meridiem:function(a){return 11>a?"pagi":15>a?"tengahari":19>a?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.".split("_"),weekdays:"sÃ¸ndag_mandag_tirsdag_onsdag_torsdag_fredag_lÃ¸rdag".split("_"),weekdaysShort:"sÃ¸._ma._ti._on._to._fr._lÃ¸.".split("_"),weekdaysMin:"sÃ¸_ma_ti_on_to_fr_lÃ¸".split("_"),longDateFormat:{LT:"H.mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] LT",LLLL:"dddd D. MMMM YYYY [kl.] LT"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i gÃ¥r kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"for %s siden",s:"noen sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",M:"en mÃ¥ned",MM:"%d mÃ¥neder",y:"ett Ã¥r",yy:"%d Ã¥r"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){var b={1:"à¥§",2:"à¥¨",3:"à¥©",4:"à¥ª",5:"à¥«",6:"à¥¬",7:"à¥­",8:"à¥®",9:"à¥¯",0:"à¥¦"},c={"à¥§":"1","à¥¨":"2","à¥©":"3","à¥ª":"4","à¥«":"5","à¥¬":"6","à¥­":"7","à¥®":"8","à¥¯":"9","à¥¦":"0"};return a.lang("ne",{months:"à¤œà¤¨à¤µà¤°à¥€_à¤«à¥‡à¤¬à¥à¤°à¥à¤µà¤°à¥€_à¤®à¤¾à¤°à¥à¤š_à¤…à¤ªà¥à¤°à¤¿à¤²_à¤®à¤ˆ_à¤œà¥à¤¨_à¤œà¥à¤²à¤¾à¤ˆ_à¤…à¤—à¤·à¥à¤Ÿ_à¤¸à¥‡à¤ªà¥à¤Ÿà¥‡à¤®à¥à¤¬à¤°_à¤…à¤•à¥à¤Ÿà¥‹à¤¬à¤°_à¤¨à¥‹à¤­à¥‡à¤®à¥à¤¬à¤°_à¤¡à¤¿à¤¸à¥‡à¤®à¥à¤¬à¤°".split("_"),monthsShort:"à¤œà¤¨._à¤«à¥‡à¤¬à¥à¤°à¥._à¤®à¤¾à¤°à¥à¤š_à¤…à¤ªà¥à¤°à¤¿._à¤®à¤ˆ_à¤œà¥à¤¨_à¤œà¥à¤²à¤¾à¤ˆ._à¤…à¤—._à¤¸à¥‡à¤ªà¥à¤Ÿ._à¤…à¤•à¥à¤Ÿà¥‹._à¤¨à¥‹à¤­à¥‡._à¤¡à¤¿à¤¸à¥‡.".split("_"),weekdays:"à¤†à¤‡à¤¤à¤¬à¤¾à¤°_à¤¸à¥‹à¤®à¤¬à¤¾à¤°_à¤®à¤™à¥à¤—à¤²à¤¬à¤¾à¤°_à¤¬à¥à¤§à¤¬à¤¾à¤°_à¤¬à¤¿à¤¹à¤¿à¤¬à¤¾à¤°_à¤¶à¥à¤•à¥à¤°à¤¬à¤¾à¤°_à¤¶à¤¨à¤¿à¤¬à¤¾à¤°".split("_"),weekdaysShort:"à¤†à¤‡à¤¤._à¤¸à¥‹à¤®._à¤®à¤™à¥à¤—à¤²._à¤¬à¥à¤§._à¤¬à¤¿à¤¹à¤¿._à¤¶à¥à¤•à¥à¤°._à¤¶à¤¨à¤¿.".split("_"),weekdaysMin:"à¤†à¤‡._à¤¸à¥‹._à¤®à¤™à¥_à¤¬à¥._à¤¬à¤¿._à¤¶à¥._à¤¶.".split("_"),longDateFormat:{LT:"Aà¤•à¥‹ h:mm à¤¬à¤œà¥‡",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},preparse:function(a){return a.replace(/[à¥§à¥¨à¥©à¥ªà¥«à¥¬à¥­à¥®à¥¯à¥¦]/g,function(a){return c[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]})},meridiem:function(a){return 3>a?"à¤°à¤¾à¤¤à¥€":10>a?"à¤¬à¤¿à¤¹à¤¾à¤¨":15>a?"à¤¦à¤¿à¤‰à¤à¤¸à¥‹":18>a?"à¤¬à¥‡à¤²à¥à¤•à¤¾":20>a?"à¤¸à¤¾à¤à¤":"à¤°à¤¾à¤¤à¥€"},calendar:{sameDay:"[à¤†à¤œ] LT",nextDay:"[à¤­à¥‹à¤²à¥€] LT",nextWeek:"[à¤†à¤‰à¤à¤¦à¥‹] dddd[,] LT",lastDay:"[à¤¹à¤¿à¤œà¥‹] LT",lastWeek:"[à¤—à¤à¤•à¥‹] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%sà¤®à¤¾",past:"%s à¤…à¤—à¤¾à¤¡à¥€",s:"à¤•à¥‡à¤¹à¥€ à¤¸à¤®à¤¯",m:"à¤à¤• à¤®à¤¿à¤¨à¥‡à¤Ÿ",mm:"%d à¤®à¤¿à¤¨à¥‡à¤Ÿ",h:"à¤à¤• à¤˜à¤£à¥à¤Ÿà¤¾",hh:"%d à¤˜à¤£à¥à¤Ÿà¤¾",d:"à¤à¤• à¤¦à¤¿à¤¨",dd:"%d à¤¦à¤¿à¤¨",M:"à¤à¤• à¤®à¤¹à¤¿à¤¨à¤¾",MM:"%d à¤®à¤¹à¤¿à¤¨à¤¾",y:"à¤à¤• à¤¬à¤°à¥à¤·",yy:"%d à¤¬à¤°à¥à¤·"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){var b="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),c="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_");return a.lang("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(a,d){return/-MMM-/.test(d)?c[a.month()]:b[a.month()]},weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"Zo_Ma_Di_Wo_Do_Vr_Za".split("_"),longDateFormat:{LT:"HH:mm",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",m:"Ã©Ã©n minuut",mm:"%d minuten",h:"Ã©Ã©n uur",hh:"%d uur",d:"Ã©Ã©n dag",dd:"%d dagen",M:"Ã©Ã©n maand",MM:"%d maanden",y:"Ã©Ã©n jaar",yy:"%d jaar"},ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sundag_mÃ¥ndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"sun_mÃ¥n_tys_ons_tor_fre_lau".split("_"),weekdaysMin:"su_mÃ¥_ty_on_to_fr_lÃ¸".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I gÃ¥r klokka] LT",lastWeek:"[FÃ¸regÃ¥ande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"for %s sidan",s:"nokre sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",M:"ein mÃ¥nad",MM:"%d mÃ¥nader",y:"eit Ã¥r",yy:"%d Ã¥r"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a){return 5>a%10&&a%10>1&&~~(a/10)%10!==1}function c(a,c,d){var e=a+" ";switch(d){case"m":return c?"minuta":"minutÄ™";case"mm":return e+(b(a)?"minuty":"minut");case"h":return c?"godzina":"godzinÄ™";case"hh":return e+(b(a)?"godziny":"godzin");case"MM":return e+(b(a)?"miesiÄ…ce":"miesiÄ™cy");case"yy":return e+(b(a)?"lata":"lat")}}var d="styczeÅ„_luty_marzec_kwiecieÅ„_maj_czerwiec_lipiec_sierpieÅ„_wrzesieÅ„_paÅºdziernik_listopad_grudzieÅ„".split("_"),e="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_wrzeÅ›nia_paÅºdziernika_listopada_grudnia".split("_");return a.lang("pl",{months:function(a,b){return/D MMMM/.test(b)?e[a.month()]:d[a.month()]},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paÅº_lis_gru".split("_"),weekdays:"niedziela_poniedziaÅ‚ek_wtorek_Å›roda_czwartek_piÄ…tek_sobota".split("_"),weekdaysShort:"nie_pon_wt_Å›r_czw_pt_sb".split("_"),weekdaysMin:"N_Pn_Wt_Åšr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[DziÅ› o] LT",nextDay:"[Jutro o] LT",nextWeek:"[W] dddd [o] LT",lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszÅ‚Ä… niedzielÄ™ o] LT";case 3:return"[W zeszÅ‚Ä… Å›rodÄ™ o] LT";case 6:return"[W zeszÅ‚Ä… sobotÄ™ o] LT";default:return"[W zeszÅ‚y] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",m:c,mm:c,h:c,hh:c,d:"1 dzieÅ„",dd:"%d dni",M:"miesiÄ…c",MM:c,y:"rok",yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("pt-br",{months:"janeiro_fevereiro_marÃ§o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_terÃ§a-feira_quarta-feira_quinta-feira_sexta-feira_sÃ¡bado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sÃ¡b".split("_"),weekdaysMin:"dom_2Âª_3Âª_4Âª_5Âª_6Âª_sÃ¡b".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [Ã s] LT",LLLL:"dddd, D [de] MMMM [de] YYYY [Ã s] LT"},calendar:{sameDay:"[Hoje Ã s] LT",nextDay:"[AmanhÃ£ Ã s] LT",nextWeek:"dddd [Ã s] LT",lastDay:"[Ontem Ã s] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Ãšltimo] dddd [Ã s] LT":"[Ãšltima] dddd [Ã s] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrÃ¡s",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mÃªs",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:"%dÂº"})}),function(a){a(ib)}(function(a){return a.lang("pt",{months:"janeiro_fevereiro_marÃ§o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_terÃ§a-feira_quarta-feira_quinta-feira_sexta-feira_sÃ¡bado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sÃ¡b".split("_"),weekdaysMin:"dom_2Âª_3Âª_4Âª_5Âª_6Âª_sÃ¡b".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY LT",LLLL:"dddd, D [de] MMMM [de] YYYY LT"},calendar:{sameDay:"[Hoje Ã s] LT",nextDay:"[AmanhÃ£ Ã s] LT",nextWeek:"dddd [Ã s] LT",lastDay:"[Ontem Ã s] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Ãšltimo] dddd [Ã s] LT":"[Ãšltima] dddd [Ã s] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrÃ¡s",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mÃªs",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:"%dÂº",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d={mm:"minute",hh:"ore",dd:"zile",MM:"luni",yy:"ani"},e=" ";return(a%100>=20||a>=100&&a%100===0)&&(e=" de "),a+e+d[c]}return a.lang("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),weekdays:"duminicÄƒ_luni_marÈ›i_miercuri_joi_vineri_sÃ¢mbÄƒtÄƒ".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_SÃ¢m".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_SÃ¢".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mÃ¢ine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s Ã®n urmÄƒ",s:"cÃ¢teva secunde",m:"un minut",mm:b,h:"o orÄƒ",hh:b,d:"o zi",dd:b,M:"o lunÄƒ",MM:b,y:"un an",yy:b},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){function b(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function c(a,c,d){var e={mm:c?"Ð¼Ð¸Ð½ÑƒÑ‚Ð°_Ð¼Ð¸Ð½ÑƒÑ‚Ñ‹_Ð¼Ð¸Ð½ÑƒÑ‚":"Ð¼Ð¸Ð½ÑƒÑ‚Ñƒ_Ð¼Ð¸Ð½ÑƒÑ‚Ñ‹_Ð¼Ð¸Ð½ÑƒÑ‚",hh:"Ñ‡Ð°Ñ_Ñ‡Ð°ÑÐ°_Ñ‡Ð°ÑÐ¾Ð²",dd:"Ð´ÐµÐ½ÑŒ_Ð´Ð½Ñ_Ð´Ð½ÐµÐ¹",MM:"Ð¼ÐµÑÑÑ†_Ð¼ÐµÑÑÑ†Ð°_Ð¼ÐµÑÑÑ†ÐµÐ²",yy:"Ð³Ð¾Ð´_Ð³Ð¾Ð´Ð°_Ð»ÐµÑ‚"};return"m"===d?c?"Ð¼Ð¸Ð½ÑƒÑ‚Ð°":"Ð¼Ð¸Ð½ÑƒÑ‚Ñƒ":a+" "+b(e[d],+a)}function d(a,b){var c={nominative:"ÑÐ½Ð²Ð°Ñ€ÑŒ_Ñ„ÐµÐ²Ñ€Ð°Ð»ÑŒ_Ð¼Ð°Ñ€Ñ‚_Ð°Ð¿Ñ€ÐµÐ»ÑŒ_Ð¼Ð°Ð¹_Ð¸ÑŽÐ½ÑŒ_Ð¸ÑŽÐ»ÑŒ_Ð°Ð²Ð³ÑƒÑÑ‚_ÑÐµÐ½Ñ‚ÑÐ±Ñ€ÑŒ_Ð¾ÐºÑ‚ÑÐ±Ñ€ÑŒ_Ð½Ð¾ÑÐ±Ñ€ÑŒ_Ð´ÐµÐºÐ°Ð±Ñ€ÑŒ".split("_"),accusative:"ÑÐ½Ð²Ð°Ñ€Ñ_Ñ„ÐµÐ²Ñ€Ð°Ð»Ñ_Ð¼Ð°Ñ€Ñ‚Ð°_Ð°Ð¿Ñ€ÐµÐ»Ñ_Ð¼Ð°Ñ_Ð¸ÑŽÐ½Ñ_Ð¸ÑŽÐ»Ñ_Ð°Ð²Ð³ÑƒÑÑ‚Ð°_ÑÐµÐ½Ñ‚ÑÐ±Ñ€Ñ_Ð¾ÐºÑ‚ÑÐ±Ñ€Ñ_Ð½Ð¾ÑÐ±Ñ€Ñ_Ð´ÐµÐºÐ°Ð±Ñ€Ñ".split("_")},d=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function e(a,b){var c={nominative:"ÑÐ½Ð²_Ñ„ÐµÐ²_Ð¼Ð°Ñ€_Ð°Ð¿Ñ€_Ð¼Ð°Ð¹_Ð¸ÑŽÐ½ÑŒ_Ð¸ÑŽÐ»ÑŒ_Ð°Ð²Ð³_ÑÐµÐ½_Ð¾ÐºÑ‚_Ð½Ð¾Ñ_Ð´ÐµÐº".split("_"),accusative:"ÑÐ½Ð²_Ñ„ÐµÐ²_Ð¼Ð°Ñ€_Ð°Ð¿Ñ€_Ð¼Ð°Ñ_Ð¸ÑŽÐ½Ñ_Ð¸ÑŽÐ»Ñ_Ð°Ð²Ð³_ÑÐµÐ½_Ð¾ÐºÑ‚_Ð½Ð¾Ñ_Ð´ÐµÐº".split("_")},d=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function f(a,b){var c={nominative:"Ð²Ð¾ÑÐºÑ€ÐµÑÐµÐ½ÑŒÐµ_Ð¿Ð¾Ð½ÐµÐ´ÐµÐ»ÑŒÐ½Ð¸Ðº_Ð²Ñ‚Ð¾Ñ€Ð½Ð¸Ðº_ÑÑ€ÐµÐ´Ð°_Ñ‡ÐµÑ‚Ð²ÐµÑ€Ð³_Ð¿ÑÑ‚Ð½Ð¸Ñ†Ð°_ÑÑƒÐ±Ð±Ð¾Ñ‚Ð°".split("_"),accusative:"Ð²Ð¾ÑÐºÑ€ÐµÑÐµÐ½ÑŒÐµ_Ð¿Ð¾Ð½ÐµÐ´ÐµÐ»ÑŒÐ½Ð¸Ðº_Ð²Ñ‚Ð¾Ñ€Ð½Ð¸Ðº_ÑÑ€ÐµÐ´Ñƒ_Ñ‡ÐµÑ‚Ð²ÐµÑ€Ð³_Ð¿ÑÑ‚Ð½Ð¸Ñ†Ñƒ_ÑÑƒÐ±Ð±Ð¾Ñ‚Ñƒ".split("_")},d=/\[ ?[Ð’Ð²] ?(?:Ð¿Ñ€Ð¾ÑˆÐ»ÑƒÑŽ|ÑÐ»ÐµÐ´ÑƒÑŽÑ‰ÑƒÑŽ)? ?\] ?dddd/.test(b)?"accusative":"nominative";return c[d][a.day()]}return a.lang("ru",{months:d,monthsShort:e,weekdays:f,weekdaysShort:"Ð²Ñ_Ð¿Ð½_Ð²Ñ‚_ÑÑ€_Ñ‡Ñ‚_Ð¿Ñ‚_ÑÐ±".split("_"),weekdaysMin:"Ð²Ñ_Ð¿Ð½_Ð²Ñ‚_ÑÑ€_Ñ‡Ñ‚_Ð¿Ñ‚_ÑÐ±".split("_"),monthsParse:[/^ÑÐ½Ð²/i,/^Ñ„ÐµÐ²/i,/^Ð¼Ð°Ñ€/i,/^Ð°Ð¿Ñ€/i,/^Ð¼Ð°[Ð¹|Ñ]/i,/^Ð¸ÑŽÐ½/i,/^Ð¸ÑŽÐ»/i,/^Ð°Ð²Ð³/i,/^ÑÐµÐ½/i,/^Ð¾ÐºÑ‚/i,/^Ð½Ð¾Ñ/i,/^Ð´ÐµÐº/i],longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY Ð³.",LLL:"D MMMM YYYY Ð³., LT",LLLL:"dddd, D MMMM YYYY Ð³., LT"},calendar:{sameDay:"[Ð¡ÐµÐ³Ð¾Ð´Ð½Ñ Ð²] LT",nextDay:"[Ð—Ð°Ð²Ñ‚Ñ€Ð° Ð²] LT",lastDay:"[Ð’Ñ‡ÐµÑ€Ð° Ð²] LT",nextWeek:function(){return 2===this.day()?"[Ð’Ð¾] dddd [Ð²] LT":"[Ð’] dddd [Ð²] LT"},lastWeek:function(){switch(this.day()){case 0:return"[Ð’ Ð¿Ñ€Ð¾ÑˆÐ»Ð¾Ðµ] dddd [Ð²] LT";case 1:case 2:case 4:return"[Ð’ Ð¿Ñ€Ð¾ÑˆÐ»Ñ‹Ð¹] dddd [Ð²] LT";case 3:case 5:case 6:return"[Ð’ Ð¿Ñ€Ð¾ÑˆÐ»ÑƒÑŽ] dddd [Ð²] LT"}},sameElse:"L"},relativeTime:{future:"Ñ‡ÐµÑ€ÐµÐ· %s",past:"%s Ð½Ð°Ð·Ð°Ð´",s:"Ð½ÐµÑÐºÐ¾Ð»ÑŒÐºÐ¾ ÑÐµÐºÑƒÐ½Ð´",m:c,mm:c,h:"Ñ‡Ð°Ñ",hh:c,d:"Ð´ÐµÐ½ÑŒ",dd:c,M:"Ð¼ÐµÑÑÑ†",MM:c,y:"Ð³Ð¾Ð´",yy:c},meridiem:function(a){return 4>a?"Ð½Ð¾Ñ‡Ð¸":12>a?"ÑƒÑ‚Ñ€Ð°":17>a?"Ð´Ð½Ñ":"Ð²ÐµÑ‡ÐµÑ€Ð°"},ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":return a+"-Ð¹";case"D":return a+"-Ð³Ð¾";case"w":case"W":return a+"-Ñ";default:return a}},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){function b(a){return a>1&&5>a}function c(a,c,d,e){var f=a+" ";switch(d){case"s":return c||e?"pÃ¡r sekÃºnd":"pÃ¡r sekundami";case"m":return c?"minÃºta":e?"minÃºtu":"minÃºtou";case"mm":return c||e?f+(b(a)?"minÃºty":"minÃºt"):f+"minÃºtami";break;case"h":return c?"hodina":e?"hodinu":"hodinou";case"hh":return c||e?f+(b(a)?"hodiny":"hodÃ­n"):f+"hodinami";break;case"d":return c||e?"deÅˆ":"dÅˆom";case"dd":return c||e?f+(b(a)?"dni":"dnÃ­"):f+"dÅˆami";break;case"M":return c||e?"mesiac":"mesiacom";case"MM":return c||e?f+(b(a)?"mesiace":"mesiacov"):f+"mesiacmi";break;case"y":return c||e?"rok":"rokom";case"yy":return c||e?f+(b(a)?"roky":"rokov"):f+"rokmi"}}var d="januÃ¡r_februÃ¡r_marec_aprÃ­l_mÃ¡j_jÃºn_jÃºl_august_september_oktÃ³ber_november_december".split("_"),e="jan_feb_mar_apr_mÃ¡j_jÃºn_jÃºl_aug_sep_okt_nov_dec".split("_");return a.lang("sk",{months:d,monthsShort:e,monthsParse:function(a,b){var c,d=[];for(c=0;12>c;c++)d[c]=new RegExp("^"+a[c]+"$|^"+b[c]+"$","i");return d}(d,e),weekdays:"nedeÄ¾a_pondelok_utorok_streda_Å¡tvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_Å¡t_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_Å¡t_pi_so".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd D. MMMM YYYY LT"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeÄ¾u o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo Å¡tvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[vÄera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulÃº nedeÄ¾u o] LT";case 1:case 2:return"[minulÃ½] dddd [o] LT";case 3:return"[minulÃº stredu o] LT";case 4:case 5:return"[minulÃ½] dddd [o] LT";case 6:return"[minulÃº sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:c,m:c,mm:c,h:c,hh:c,d:c,dd:c,M:c,MM:c,y:c,yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d=a+" ";switch(c){case"m":return b?"ena minuta":"eno minuto";case"mm":return d+=1===a?"minuta":2===a?"minuti":3===a||4===a?"minute":"minut";case"h":return b?"ena ura":"eno uro";case"hh":return d+=1===a?"ura":2===a?"uri":3===a||4===a?"ure":"ur";case"dd":return d+=1===a?"dan":"dni";case"MM":return d+=1===a?"mesec":2===a?"meseca":3===a||4===a?"mesece":"mesecev";case"yy":return d+=1===a?"leto":2===a?"leti":3===a||4===a?"leta":"let"}}return a.lang("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),weekdays:"nedelja_ponedeljek_torek_sreda_Äetrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._Äet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_Äe_pe_so".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[vÄeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[prejÅ¡nja] dddd [ob] LT";case 1:case 2:case 4:case 5:return"[prejÅ¡nji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"Äez %s",past:"%s nazaj",s:"nekaj sekund",m:b,mm:b,h:b,hh:b,d:"en dan",dd:b,M:"en mesec",MM:b,y:"eno leto",yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_NÃ«ntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_NÃ«n_Dhj".split("_"),weekdays:"E Diel_E HÃ«nÃ«_E MartÃ«_E MÃ«rkurÃ«_E Enjte_E Premte_E ShtunÃ«".split("_"),weekdaysShort:"Die_HÃ«n_Mar_MÃ«r_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_MÃ«_E_P_Sh".split("_"),meridiem:function(a){return 12>a?"PD":"MD"},longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Sot nÃ«] LT",nextDay:"[NesÃ«r nÃ«] LT",nextWeek:"dddd [nÃ«] LT",lastDay:"[Dje nÃ«] LT",lastWeek:"dddd [e kaluar nÃ«] LT",sameElse:"L"},relativeTime:{future:"nÃ« %s",past:"%s mÃ« parÃ«",s:"disa sekonda",m:"njÃ« minutÃ«",mm:"%d minuta",h:"njÃ« orÃ«",hh:"%d orÃ«",d:"njÃ« ditÃ«",dd:"%d ditÃ«",M:"njÃ« muaj",MM:"%d muaj",y:"njÃ« vit",yy:"%d vite"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){var b={words:{m:["Ñ˜ÐµÐ´Ð°Ð½ Ð¼Ð¸Ð½ÑƒÑ‚","Ñ˜ÐµÐ´Ð½Ðµ Ð¼Ð¸Ð½ÑƒÑ‚Ðµ"],mm:["Ð¼Ð¸Ð½ÑƒÑ‚","Ð¼Ð¸Ð½ÑƒÑ‚Ðµ","Ð¼Ð¸Ð½ÑƒÑ‚Ð°"],h:["Ñ˜ÐµÐ´Ð°Ð½ ÑÐ°Ñ‚","Ñ˜ÐµÐ´Ð½Ð¾Ð³ ÑÐ°Ñ‚Ð°"],hh:["ÑÐ°Ñ‚","ÑÐ°Ñ‚Ð°","ÑÐ°Ñ‚Ð¸"],dd:["Ð´Ð°Ð½","Ð´Ð°Ð½Ð°","Ð´Ð°Ð½Ð°"],MM:["Ð¼ÐµÑÐµÑ†","Ð¼ÐµÑÐµÑ†Ð°","Ð¼ÐµÑÐµÑ†Ð¸"],yy:["Ð³Ð¾Ð´Ð¸Ð½Ð°","Ð³Ð¾Ð´Ð¸Ð½Ðµ","Ð³Ð¾Ð´Ð¸Ð½Ð°"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]
},translate:function(a,c,d){var e=b.words[d];return 1===d.length?c?e[0]:e[1]:a+" "+b.correctGrammaticalCase(a,e)}};return a.lang("sr-cyr",{months:["Ñ˜Ð°Ð½ÑƒÐ°Ñ€","Ñ„ÐµÐ±Ñ€ÑƒÐ°Ñ€","Ð¼Ð°Ñ€Ñ‚","Ð°Ð¿Ñ€Ð¸Ð»","Ð¼Ð°Ñ˜","Ñ˜ÑƒÐ½","Ñ˜ÑƒÐ»","Ð°Ð²Ð³ÑƒÑÑ‚","ÑÐµÐ¿Ñ‚ÐµÐ¼Ð±Ð°Ñ€","Ð¾ÐºÑ‚Ð¾Ð±Ð°Ñ€","Ð½Ð¾Ð²ÐµÐ¼Ð±Ð°Ñ€","Ð´ÐµÑ†ÐµÐ¼Ð±Ð°Ñ€"],monthsShort:["Ñ˜Ð°Ð½.","Ñ„ÐµÐ±.","Ð¼Ð°Ñ€.","Ð°Ð¿Ñ€.","Ð¼Ð°Ñ˜","Ñ˜ÑƒÐ½","Ñ˜ÑƒÐ»","Ð°Ð²Ð³.","ÑÐµÐ¿.","Ð¾ÐºÑ‚.","Ð½Ð¾Ð².","Ð´ÐµÑ†."],weekdays:["Ð½ÐµÐ´ÐµÑ™Ð°","Ð¿Ð¾Ð½ÐµÐ´ÐµÑ™Ð°Ðº","ÑƒÑ‚Ð¾Ñ€Ð°Ðº","ÑÑ€ÐµÐ´Ð°","Ñ‡ÐµÑ‚Ð²Ñ€Ñ‚Ð°Ðº","Ð¿ÐµÑ‚Ð°Ðº","ÑÑƒÐ±Ð¾Ñ‚Ð°"],weekdaysShort:["Ð½ÐµÐ´.","Ð¿Ð¾Ð½.","ÑƒÑ‚Ð¾.","ÑÑ€Ðµ.","Ñ‡ÐµÑ‚.","Ð¿ÐµÑ‚.","ÑÑƒÐ±."],weekdaysMin:["Ð½Ðµ","Ð¿Ð¾","ÑƒÑ‚","ÑÑ€","Ñ‡Ðµ","Ð¿Ðµ","ÑÑƒ"],longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Ð´Ð°Ð½Ð°Ñ Ñƒ] LT",nextDay:"[ÑÑƒÑ‚Ñ€Ð° Ñƒ] LT",nextWeek:function(){switch(this.day()){case 0:return"[Ñƒ] [Ð½ÐµÐ´ÐµÑ™Ñƒ] [Ñƒ] LT";case 3:return"[Ñƒ] [ÑÑ€ÐµÐ´Ñƒ] [Ñƒ] LT";case 6:return"[Ñƒ] [ÑÑƒÐ±Ð¾Ñ‚Ñƒ] [Ñƒ] LT";case 1:case 2:case 4:case 5:return"[Ñƒ] dddd [Ñƒ] LT"}},lastDay:"[Ñ˜ÑƒÑ‡Ðµ Ñƒ] LT",lastWeek:function(){var a=["[Ð¿Ñ€Ð¾ÑˆÐ»Ðµ] [Ð½ÐµÐ´ÐµÑ™Ðµ] [Ñƒ] LT","[Ð¿Ñ€Ð¾ÑˆÐ»Ð¾Ð³] [Ð¿Ð¾Ð½ÐµÐ´ÐµÑ™ÐºÐ°] [Ñƒ] LT","[Ð¿Ñ€Ð¾ÑˆÐ»Ð¾Ð³] [ÑƒÑ‚Ð¾Ñ€ÐºÐ°] [Ñƒ] LT","[Ð¿Ñ€Ð¾ÑˆÐ»Ðµ] [ÑÑ€ÐµÐ´Ðµ] [Ñƒ] LT","[Ð¿Ñ€Ð¾ÑˆÐ»Ð¾Ð³] [Ñ‡ÐµÑ‚Ð²Ñ€Ñ‚ÐºÐ°] [Ñƒ] LT","[Ð¿Ñ€Ð¾ÑˆÐ»Ð¾Ð³] [Ð¿ÐµÑ‚ÐºÐ°] [Ñƒ] LT","[Ð¿Ñ€Ð¾ÑˆÐ»Ðµ] [ÑÑƒÐ±Ð¾Ñ‚Ðµ] [Ñƒ] LT"];return a[this.day()]},sameElse:"L"},relativeTime:{future:"Ð·Ð° %s",past:"Ð¿Ñ€Ðµ %s",s:"Ð½ÐµÐºÐ¾Ð»Ð¸ÐºÐ¾ ÑÐµÐºÑƒÐ½Ð´Ð¸",m:b.translate,mm:b.translate,h:b.translate,hh:b.translate,d:"Ð´Ð°Ð½",dd:b.translate,M:"Ð¼ÐµÑÐµÑ†",MM:b.translate,y:"Ð³Ð¾Ð´Ð¸Ð½Ñƒ",yy:b.translate},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){var b={words:{m:["jedan minut","jedne minute"],mm:["minut","minute","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mesec","meseca","meseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,c,d){var e=b.words[d];return 1===d.length?c?e[0]:e[1]:a+" "+b.correctGrammaticalCase(a,e)}};return a.lang("sr",{months:["januar","februar","mart","april","maj","jun","jul","avgust","septembar","oktobar","novembar","decembar"],monthsShort:["jan.","feb.","mar.","apr.","maj","jun","jul","avg.","sep.","okt.","nov.","dec."],weekdays:["nedelja","ponedeljak","utorak","sreda","Äetvrtak","petak","subota"],weekdaysShort:["ned.","pon.","uto.","sre.","Äet.","pet.","sub."],weekdaysMin:["ne","po","ut","sr","Äe","pe","su"],longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juÄe u] LT",lastWeek:function(){var a=["[proÅ¡le] [nedelje] [u] LT","[proÅ¡log] [ponedeljka] [u] LT","[proÅ¡log] [utorka] [u] LT","[proÅ¡le] [srede] [u] LT","[proÅ¡log] [Äetvrtka] [u] LT","[proÅ¡log] [petka] [u] LT","[proÅ¡le] [subote] [u] LT"];return a[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",m:b.translate,mm:b.translate,h:b.translate,hh:b.translate,d:"dan",dd:b.translate,M:"mesec",MM:b.translate,y:"godinu",yy:b.translate},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"sÃ¶ndag_mÃ¥ndag_tisdag_onsdag_torsdag_fredag_lÃ¶rdag".split("_"),weekdaysShort:"sÃ¶n_mÃ¥n_tis_ons_tor_fre_lÃ¶r".split("_"),weekdaysMin:"sÃ¶_mÃ¥_ti_on_to_fr_lÃ¶".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[IgÃ¥r] LT",nextWeek:"dddd LT",lastWeek:"[FÃ¶rra] dddd[en] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"fÃ¶r %s sedan",s:"nÃ¥gra sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en mÃ¥nad",MM:"%d mÃ¥nader",y:"ett Ã¥r",yy:"%d Ã¥r"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"e":1===b?"a":2===b?"a":3===b?"e":"e";return a+c},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("ta",{months:"à®œà®©à®µà®°à®¿_à®ªà®¿à®ªà¯à®°à®µà®°à®¿_à®®à®¾à®°à¯à®šà¯_à®à®ªà¯à®°à®²à¯_à®®à¯‡_à®œà¯‚à®©à¯_à®œà¯‚à®²à¯ˆ_à®†à®•à®¸à¯à®Ÿà¯_à®šà¯†à®ªà¯à®Ÿà¯†à®®à¯à®ªà®°à¯_à®…à®•à¯à®Ÿà¯‡à®¾à®ªà®°à¯_à®¨à®µà®®à¯à®ªà®°à¯_à®Ÿà®¿à®šà®®à¯à®ªà®°à¯".split("_"),monthsShort:"à®œà®©à®µà®°à®¿_à®ªà®¿à®ªà¯à®°à®µà®°à®¿_à®®à®¾à®°à¯à®šà¯_à®à®ªà¯à®°à®²à¯_à®®à¯‡_à®œà¯‚à®©à¯_à®œà¯‚à®²à¯ˆ_à®†à®•à®¸à¯à®Ÿà¯_à®šà¯†à®ªà¯à®Ÿà¯†à®®à¯à®ªà®°à¯_à®…à®•à¯à®Ÿà¯‡à®¾à®ªà®°à¯_à®¨à®µà®®à¯à®ªà®°à¯_à®Ÿà®¿à®šà®®à¯à®ªà®°à¯".split("_"),weekdays:"à®žà®¾à®¯à®¿à®±à¯à®±à¯à®•à¯à®•à®¿à®´à®®à¯ˆ_à®¤à®¿à®™à¯à®•à®Ÿà¯à®•à®¿à®´à®®à¯ˆ_à®šà¯†à®µà¯à®µà®¾à®¯à¯à®•à®¿à®´à®®à¯ˆ_à®ªà¯à®¤à®©à¯à®•à®¿à®´à®®à¯ˆ_à®µà®¿à®¯à®¾à®´à®•à¯à®•à®¿à®´à®®à¯ˆ_à®µà¯†à®³à¯à®³à®¿à®•à¯à®•à®¿à®´à®®à¯ˆ_à®šà®©à®¿à®•à¯à®•à®¿à®´à®®à¯ˆ".split("_"),weekdaysShort:"à®žà®¾à®¯à®¿à®±à¯_à®¤à®¿à®™à¯à®•à®³à¯_à®šà¯†à®µà¯à®µà®¾à®¯à¯_à®ªà¯à®¤à®©à¯_à®µà®¿à®¯à®¾à®´à®©à¯_à®µà¯†à®³à¯à®³à®¿_à®šà®©à®¿".split("_"),weekdaysMin:"à®žà®¾_à®¤à®¿_à®šà¯†_à®ªà¯_à®µà®¿_à®µà¯†_à®š".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[à®‡à®©à¯à®±à¯] LT",nextDay:"[à®¨à®¾à®³à¯ˆ] LT",nextWeek:"dddd, LT",lastDay:"[à®¨à¯‡à®±à¯à®±à¯] LT",lastWeek:"[à®•à®Ÿà®¨à¯à®¤ à®µà®¾à®°à®®à¯] dddd, LT",sameElse:"L"},relativeTime:{future:"%s à®‡à®²à¯",past:"%s à®®à¯à®©à¯",s:"à®’à®°à¯ à®šà®¿à®² à®µà®¿à®¨à®¾à®Ÿà®¿à®•à®³à¯",m:"à®’à®°à¯ à®¨à®¿à®®à®¿à®Ÿà®®à¯",mm:"%d à®¨à®¿à®®à®¿à®Ÿà®™à¯à®•à®³à¯",h:"à®’à®°à¯ à®®à®£à®¿ à®¨à¯‡à®°à®®à¯",hh:"%d à®®à®£à®¿ à®¨à¯‡à®°à®®à¯",d:"à®’à®°à¯ à®¨à®¾à®³à¯",dd:"%d à®¨à®¾à®Ÿà¯à®•à®³à¯",M:"à®’à®°à¯ à®®à®¾à®¤à®®à¯",MM:"%d à®®à®¾à®¤à®™à¯à®•à®³à¯",y:"à®’à®°à¯ à®µà®°à¯à®Ÿà®®à¯",yy:"%d à®†à®£à¯à®Ÿà¯à®•à®³à¯"},ordinal:function(a){return a+"à®µà®¤à¯"},meridiem:function(a){return a>=6&&10>=a?" à®•à®¾à®²à¯ˆ":a>=10&&14>=a?" à®¨à®£à¯à®ªà®•à®²à¯":a>=14&&18>=a?" à®Žà®±à¯à®ªà®¾à®Ÿà¯":a>=18&&20>=a?" à®®à®¾à®²à¯ˆ":a>=20&&24>=a?" à®‡à®°à®µà¯":a>=0&&6>=a?" à®µà¯ˆà®•à®±à¯ˆ":void 0},week:{dow:0,doy:6}})}),function(a){a(ib)}(function(a){return a.lang("th",{months:"à¸¡à¸à¸£à¸²à¸„à¸¡_à¸à¸¸à¸¡à¸ à¸²à¸žà¸±à¸™à¸˜à¹Œ_à¸¡à¸µà¸™à¸²à¸„à¸¡_à¹€à¸¡à¸©à¸²à¸¢à¸™_à¸žà¸¤à¸©à¸ à¸²à¸„à¸¡_à¸¡à¸´à¸–à¸¸à¸™à¸²à¸¢à¸™_à¸à¸£à¸à¸Žà¸²à¸„à¸¡_à¸ªà¸´à¸‡à¸«à¸²à¸„à¸¡_à¸à¸±à¸™à¸¢à¸²à¸¢à¸™_à¸•à¸¸à¸¥à¸²à¸„à¸¡_à¸žà¸¤à¸¨à¸ˆà¸´à¸à¸²à¸¢à¸™_à¸˜à¸±à¸™à¸§à¸²à¸„à¸¡".split("_"),monthsShort:"à¸¡à¸à¸£à¸²_à¸à¸¸à¸¡à¸ à¸²_à¸¡à¸µà¸™à¸²_à¹€à¸¡à¸©à¸²_à¸žà¸¤à¸©à¸ à¸²_à¸¡à¸´à¸–à¸¸à¸™à¸²_à¸à¸£à¸à¸Žà¸²_à¸ªà¸´à¸‡à¸«à¸²_à¸à¸±à¸™à¸¢à¸²_à¸•à¸¸à¸¥à¸²_à¸žà¸¤à¸¨à¸ˆà¸´à¸à¸²_à¸˜à¸±à¸™à¸§à¸²".split("_"),weekdays:"à¸­à¸²à¸—à¸´à¸•à¸¢à¹Œ_à¸ˆà¸±à¸™à¸—à¸£à¹Œ_à¸­à¸±à¸‡à¸„à¸²à¸£_à¸žà¸¸à¸˜_à¸žà¸¤à¸«à¸±à¸ªà¸šà¸”à¸µ_à¸¨à¸¸à¸à¸£à¹Œ_à¹€à¸ªà¸²à¸£à¹Œ".split("_"),weekdaysShort:"à¸­à¸²à¸—à¸´à¸•à¸¢à¹Œ_à¸ˆà¸±à¸™à¸—à¸£à¹Œ_à¸­à¸±à¸‡à¸„à¸²à¸£_à¸žà¸¸à¸˜_à¸žà¸¤à¸«à¸±à¸ª_à¸¨à¸¸à¸à¸£à¹Œ_à¹€à¸ªà¸²à¸£à¹Œ".split("_"),weekdaysMin:"à¸­à¸²._à¸ˆ._à¸­._à¸ž._à¸žà¸¤._à¸¨._à¸ª.".split("_"),longDateFormat:{LT:"H à¸™à¸²à¸¬à¸´à¸à¸² m à¸™à¸²à¸—à¸µ",L:"YYYY/MM/DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY à¹€à¸§à¸¥à¸² LT",LLLL:"à¸§à¸±à¸™ddddà¸—à¸µà¹ˆ D MMMM YYYY à¹€à¸§à¸¥à¸² LT"},meridiem:function(a){return 12>a?"à¸à¹ˆà¸­à¸™à¹€à¸—à¸µà¹ˆà¸¢à¸‡":"à¸«à¸¥à¸±à¸‡à¹€à¸—à¸µà¹ˆà¸¢à¸‡"},calendar:{sameDay:"[à¸§à¸±à¸™à¸™à¸µà¹‰ à¹€à¸§à¸¥à¸²] LT",nextDay:"[à¸žà¸£à¸¸à¹ˆà¸‡à¸™à¸µà¹‰ à¹€à¸§à¸¥à¸²] LT",nextWeek:"dddd[à¸«à¸™à¹‰à¸² à¹€à¸§à¸¥à¸²] LT",lastDay:"[à¹€à¸¡à¸·à¹ˆà¸­à¸§à¸²à¸™à¸™à¸µà¹‰ à¹€à¸§à¸¥à¸²] LT",lastWeek:"[à¸§à¸±à¸™]dddd[à¸—à¸µà¹ˆà¹à¸¥à¹‰à¸§ à¹€à¸§à¸¥à¸²] LT",sameElse:"L"},relativeTime:{future:"à¸­à¸µà¸ %s",past:"%sà¸—à¸µà¹ˆà¹à¸¥à¹‰à¸§",s:"à¹„à¸¡à¹ˆà¸à¸µà¹ˆà¸§à¸´à¸™à¸²à¸—à¸µ",m:"1 à¸™à¸²à¸—à¸µ",mm:"%d à¸™à¸²à¸—à¸µ",h:"1 à¸Šà¸±à¹ˆà¸§à¹‚à¸¡à¸‡",hh:"%d à¸Šà¸±à¹ˆà¸§à¹‚à¸¡à¸‡",d:"1 à¸§à¸±à¸™",dd:"%d à¸§à¸±à¸™",M:"1 à¹€à¸”à¸·à¸­à¸™",MM:"%d à¹€à¸”à¸·à¸­à¸™",y:"1 à¸›à¸µ",yy:"%d à¸›à¸µ"}})}),function(a){a(ib)}(function(a){return a.lang("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM DD, YYYY LT"},calendar:{sameDay:"[Ngayon sa] LT",nextDay:"[Bukas sa] LT",nextWeek:"dddd [sa] LT",lastDay:"[Kahapon sa] LT",lastWeek:"dddd [huling linggo] LT",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},ordinal:function(a){return a},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){var b={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'Ã¼ncÃ¼",4:"'Ã¼ncÃ¼",100:"'Ã¼ncÃ¼",6:"'ncÄ±",9:"'uncu",10:"'uncu",30:"'uncu",60:"'Ä±ncÄ±",90:"'Ä±ncÄ±"};return a.lang("tr",{months:"Ocak_Åžubat_Mart_Nisan_MayÄ±s_Haziran_Temmuz_AÄŸustos_EylÃ¼l_Ekim_KasÄ±m_AralÄ±k".split("_"),monthsShort:"Oca_Åžub_Mar_Nis_May_Haz_Tem_AÄŸu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_SalÄ±_Ã‡arÅŸamba_PerÅŸembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pts_Sal_Ã‡ar_Per_Cum_Cts".split("_"),weekdaysMin:"Pz_Pt_Sa_Ã‡a_Pe_Cu_Ct".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[bugÃ¼n saat] LT",nextDay:"[yarÄ±n saat] LT",nextWeek:"[haftaya] dddd [saat] LT",lastDay:"[dÃ¼n] LT",lastWeek:"[geÃ§en hafta] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s Ã¶nce",s:"birkaÃ§ saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gÃ¼n",dd:"%d gÃ¼n",M:"bir ay",MM:"%d ay",y:"bir yÄ±l",yy:"%d yÄ±l"},ordinal:function(a){if(0===a)return a+"'Ä±ncÄ±";var c=a%10,d=a%100-c,e=a>=100?100:null;return a+(b[c]||b[d]||b[e])},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("tzm-la",{months:"innayr_brË¤ayrË¤_marË¤sË¤_ibrir_mayyw_ywnyw_ywlywz_É£wÅ¡t_Å¡wtanbir_ktË¤wbrË¤_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brË¤ayrË¤_marË¤sË¤_ibrir_mayyw_ywnyw_ywlywz_É£wÅ¡t_Å¡wtanbir_ktË¤wbrË¤_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiá¸yas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiá¸yas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiá¸yas".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",m:"minuá¸",mm:"%d minuá¸",h:"saÉ›a",hh:"%d tassaÉ›in",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}})}),function(a){a(ib)}(function(a){return a.lang("tzm",{months:"âµ‰âµâµâ´°âµ¢âµ”_â´±âµ•â´°âµ¢âµ•_âµŽâ´°âµ•âµš_âµ‰â´±âµ”âµ‰âµ”_âµŽâ´°âµ¢âµ¢âµ“_âµ¢âµ“âµâµ¢âµ“_âµ¢âµ“âµâµ¢âµ“âµ£_âµ–âµ“âµ›âµœ_âµ›âµ“âµœâ´°âµâ´±âµ‰âµ”_â´½âµŸâµ“â´±âµ•_âµâµ“âµ¡â´°âµâ´±âµ‰âµ”_â´·âµ“âµŠâµâ´±âµ‰âµ”".split("_"),monthsShort:"âµ‰âµâµâ´°âµ¢âµ”_â´±âµ•â´°âµ¢âµ•_âµŽâ´°âµ•âµš_âµ‰â´±âµ”âµ‰âµ”_âµŽâ´°âµ¢âµ¢âµ“_âµ¢âµ“âµâµ¢âµ“_âµ¢âµ“âµâµ¢âµ“âµ£_âµ–âµ“âµ›âµœ_âµ›âµ“âµœâ´°âµâ´±âµ‰âµ”_â´½âµŸâµ“â´±âµ•_âµâµ“âµ¡â´°âµâ´±âµ‰âµ”_â´·âµ“âµŠâµâ´±âµ‰âµ”".split("_"),weekdays:"â´°âµ™â´°âµŽâ´°âµ™_â´°âµ¢âµâ´°âµ™_â´°âµ™âµ‰âµâ´°âµ™_â´°â´½âµ”â´°âµ™_â´°â´½âµ¡â´°âµ™_â´°âµ™âµ‰âµŽâµ¡â´°âµ™_â´°âµ™âµ‰â´¹âµ¢â´°âµ™".split("_"),weekdaysShort:"â´°âµ™â´°âµŽâ´°âµ™_â´°âµ¢âµâ´°âµ™_â´°âµ™âµ‰âµâ´°âµ™_â´°â´½âµ”â´°âµ™_â´°â´½âµ¡â´°âµ™_â´°âµ™âµ‰âµŽâµ¡â´°âµ™_â´°âµ™âµ‰â´¹âµ¢â´°âµ™".split("_"),weekdaysMin:"â´°âµ™â´°âµŽâ´°âµ™_â´°âµ¢âµâ´°âµ™_â´°âµ™âµ‰âµâ´°âµ™_â´°â´½âµ”â´°âµ™_â´°â´½âµ¡â´°âµ™_â´°âµ™âµ‰âµŽâµ¡â´°âµ™_â´°âµ™âµ‰â´¹âµ¢â´°âµ™".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[â´°âµ™â´·âµ… â´´] LT",nextDay:"[â´°âµ™â´½â´° â´´] LT",nextWeek:"dddd [â´´] LT",lastDay:"[â´°âµšâ´°âµâµœ â´´] LT",lastWeek:"dddd [â´´] LT",sameElse:"L"},relativeTime:{future:"â´·â´°â´·âµ… âµ™ âµ¢â´°âµ %s",past:"âµ¢â´°âµ %s",s:"âµ‰âµŽâµ‰â´½",m:"âµŽâµ‰âµâµ“â´º",mm:"%d âµŽâµ‰âµâµ“â´º",h:"âµ™â´°âµ„â´°",hh:"%d âµœâ´°âµ™âµ™â´°âµ„âµ‰âµ",d:"â´°âµ™âµ™",dd:"%d oâµ™âµ™â´°âµ",M:"â´°âµ¢oâµ“âµ”",MM:"%d âµ‰âµ¢âµ¢âµ‰âµ”âµ",y:"â´°âµ™â´³â´°âµ™",yy:"%d âµ‰âµ™â´³â´°âµ™âµ"},week:{dow:6,doy:12}})}),function(a){a(ib)}(function(a){function b(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function c(a,c,d){var e={mm:"Ñ…Ð²Ð¸Ð»Ð¸Ð½Ð°_Ñ…Ð²Ð¸Ð»Ð¸Ð½Ð¸_Ñ…Ð²Ð¸Ð»Ð¸Ð½",hh:"Ð³Ð¾Ð´Ð¸Ð½Ð°_Ð³Ð¾Ð´Ð¸Ð½Ð¸_Ð³Ð¾Ð´Ð¸Ð½",dd:"Ð´ÐµÐ½ÑŒ_Ð´Ð½Ñ–_Ð´Ð½Ñ–Ð²",MM:"Ð¼Ñ–ÑÑÑ†ÑŒ_Ð¼Ñ–ÑÑÑ†Ñ–_Ð¼Ñ–ÑÑÑ†Ñ–Ð²",yy:"Ñ€Ñ–Ðº_Ñ€Ð¾ÐºÐ¸_Ñ€Ð¾ÐºÑ–Ð²"};return"m"===d?c?"Ñ…Ð²Ð¸Ð»Ð¸Ð½Ð°":"Ñ…Ð²Ð¸Ð»Ð¸Ð½Ñƒ":"h"===d?c?"Ð³Ð¾Ð´Ð¸Ð½Ð°":"Ð³Ð¾Ð´Ð¸Ð½Ñƒ":a+" "+b(e[d],+a)}function d(a,b){var c={nominative:"ÑÑ–Ñ‡ÐµÐ½ÑŒ_Ð»ÑŽÑ‚Ð¸Ð¹_Ð±ÐµÑ€ÐµÐ·ÐµÐ½ÑŒ_ÐºÐ²Ñ–Ñ‚ÐµÐ½ÑŒ_Ñ‚Ñ€Ð°Ð²ÐµÐ½ÑŒ_Ñ‡ÐµÑ€Ð²ÐµÐ½ÑŒ_Ð»Ð¸Ð¿ÐµÐ½ÑŒ_ÑÐµÑ€Ð¿ÐµÐ½ÑŒ_Ð²ÐµÑ€ÐµÑÐµÐ½ÑŒ_Ð¶Ð¾Ð²Ñ‚ÐµÐ½ÑŒ_Ð»Ð¸ÑÑ‚Ð¾Ð¿Ð°Ð´_Ð³Ñ€ÑƒÐ´ÐµÐ½ÑŒ".split("_"),accusative:"ÑÑ–Ñ‡Ð½Ñ_Ð»ÑŽÑ‚Ð¾Ð³Ð¾_Ð±ÐµÑ€ÐµÐ·Ð½Ñ_ÐºÐ²Ñ–Ñ‚Ð½Ñ_Ñ‚Ñ€Ð°Ð²Ð½Ñ_Ñ‡ÐµÑ€Ð²Ð½Ñ_Ð»Ð¸Ð¿Ð½Ñ_ÑÐµÑ€Ð¿Ð½Ñ_Ð²ÐµÑ€ÐµÑÐ½Ñ_Ð¶Ð¾Ð²Ñ‚Ð½Ñ_Ð»Ð¸ÑÑ‚Ð¾Ð¿Ð°Ð´Ð°_Ð³Ñ€ÑƒÐ´Ð½Ñ".split("_")},d=/D[oD]? *MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function e(a,b){var c={nominative:"Ð½ÐµÐ´Ñ–Ð»Ñ_Ð¿Ð¾Ð½ÐµÐ´Ñ–Ð»Ð¾Ðº_Ð²Ñ–Ð²Ñ‚Ð¾Ñ€Ð¾Ðº_ÑÐµÑ€ÐµÐ´Ð°_Ñ‡ÐµÑ‚Ð²ÐµÑ€_Ð¿â€™ÑÑ‚Ð½Ð¸Ñ†Ñ_ÑÑƒÐ±Ð¾Ñ‚Ð°".split("_"),accusative:"Ð½ÐµÐ´Ñ–Ð»ÑŽ_Ð¿Ð¾Ð½ÐµÐ´Ñ–Ð»Ð¾Ðº_Ð²Ñ–Ð²Ñ‚Ð¾Ñ€Ð¾Ðº_ÑÐµÑ€ÐµÐ´Ñƒ_Ñ‡ÐµÑ‚Ð²ÐµÑ€_Ð¿â€™ÑÑ‚Ð½Ð¸Ñ†ÑŽ_ÑÑƒÐ±Ð¾Ñ‚Ñƒ".split("_"),genitive:"Ð½ÐµÐ´Ñ–Ð»Ñ–_Ð¿Ð¾Ð½ÐµÐ´Ñ–Ð»ÐºÐ°_Ð²Ñ–Ð²Ñ‚Ð¾Ñ€ÐºÐ°_ÑÐµÑ€ÐµÐ´Ð¸_Ñ‡ÐµÑ‚Ð²ÐµÑ€Ð³Ð°_Ð¿â€™ÑÑ‚Ð½Ð¸Ñ†Ñ–_ÑÑƒÐ±Ð¾Ñ‚Ð¸".split("_")},d=/(\[[Ð’Ð²Ð£Ñƒ]\]) ?dddd/.test(b)?"accusative":/\[?(?:Ð¼Ð¸Ð½ÑƒÐ»Ð¾Ñ—|Ð½Ð°ÑÑ‚ÑƒÐ¿Ð½Ð¾Ñ—)? ?\] ?dddd/.test(b)?"genitive":"nominative";return c[d][a.day()]}function f(a){return function(){return a+"Ð¾"+(11===this.hours()?"Ð±":"")+"] LT"}}return a.lang("uk",{months:d,monthsShort:"ÑÑ–Ñ‡_Ð»ÑŽÑ‚_Ð±ÐµÑ€_ÐºÐ²Ñ–Ñ‚_Ñ‚Ñ€Ð°Ð²_Ñ‡ÐµÑ€Ð²_Ð»Ð¸Ð¿_ÑÐµÑ€Ð¿_Ð²ÐµÑ€_Ð¶Ð¾Ð²Ñ‚_Ð»Ð¸ÑÑ‚_Ð³Ñ€ÑƒÐ´".split("_"),weekdays:e,weekdaysShort:"Ð½Ð´_Ð¿Ð½_Ð²Ñ‚_ÑÑ€_Ñ‡Ñ‚_Ð¿Ñ‚_ÑÐ±".split("_"),weekdaysMin:"Ð½Ð´_Ð¿Ð½_Ð²Ñ‚_ÑÑ€_Ñ‡Ñ‚_Ð¿Ñ‚_ÑÐ±".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY Ñ€.",LLL:"D MMMM YYYY Ñ€., LT",LLLL:"dddd, D MMMM YYYY Ñ€., LT"},calendar:{sameDay:f("[Ð¡ÑŒÐ¾Ð³Ð¾Ð´Ð½Ñ– "),nextDay:f("[Ð—Ð°Ð²Ñ‚Ñ€Ð° "),lastDay:f("[Ð’Ñ‡Ð¾Ñ€Ð° "),nextWeek:f("[Ð£] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return f("[ÐœÐ¸Ð½ÑƒÐ»Ð¾Ñ—] dddd [").call(this);case 1:case 2:case 4:return f("[ÐœÐ¸Ð½ÑƒÐ»Ð¾Ð³Ð¾] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"Ð·Ð° %s",past:"%s Ñ‚Ð¾Ð¼Ñƒ",s:"Ð´ÐµÐºÑ–Ð»ÑŒÐºÐ° ÑÐµÐºÑƒÐ½Ð´",m:c,mm:c,h:"Ð³Ð¾Ð´Ð¸Ð½Ñƒ",hh:c,d:"Ð´ÐµÐ½ÑŒ",dd:c,M:"Ð¼Ñ–ÑÑÑ†ÑŒ",MM:c,y:"Ñ€Ñ–Ðº",yy:c},meridiem:function(a){return 4>a?"Ð½Ð¾Ñ‡Ñ–":12>a?"Ñ€Ð°Ð½ÐºÑƒ":17>a?"Ð´Ð½Ñ":"Ð²ÐµÑ‡Ð¾Ñ€Ð°"},ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":case"w":case"W":return a+"-Ð¹";case"D":return a+"-Ð³Ð¾";default:return a}},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("uz",{months:"ÑÐ½Ð²Ð°Ñ€ÑŒ_Ñ„ÐµÐ²Ñ€Ð°Ð»ÑŒ_Ð¼Ð°Ñ€Ñ‚_Ð°Ð¿Ñ€ÐµÐ»ÑŒ_Ð¼Ð°Ð¹_Ð¸ÑŽÐ½ÑŒ_Ð¸ÑŽÐ»ÑŒ_Ð°Ð²Ð³ÑƒÑÑ‚_ÑÐµÐ½Ñ‚ÑÐ±Ñ€ÑŒ_Ð¾ÐºÑ‚ÑÐ±Ñ€ÑŒ_Ð½Ð¾ÑÐ±Ñ€ÑŒ_Ð´ÐµÐºÐ°Ð±Ñ€ÑŒ".split("_"),monthsShort:"ÑÐ½Ð²_Ñ„ÐµÐ²_Ð¼Ð°Ñ€_Ð°Ð¿Ñ€_Ð¼Ð°Ð¹_Ð¸ÑŽÐ½_Ð¸ÑŽÐ»_Ð°Ð²Ð³_ÑÐµÐ½_Ð¾ÐºÑ‚_Ð½Ð¾Ñ_Ð´ÐµÐº".split("_"),weekdays:"Ð¯ÐºÑˆÐ°Ð½Ð±Ð°_Ð”ÑƒÑˆÐ°Ð½Ð±Ð°_Ð¡ÐµÑˆÐ°Ð½Ð±Ð°_Ð§Ð¾Ñ€ÑˆÐ°Ð½Ð±Ð°_ÐŸÐ°Ð¹ÑˆÐ°Ð½Ð±Ð°_Ð–ÑƒÐ¼Ð°_Ð¨Ð°Ð½Ð±Ð°".split("_"),weekdaysShort:"Ð¯ÐºÑˆ_Ð”ÑƒÑˆ_Ð¡ÐµÑˆ_Ð§Ð¾Ñ€_ÐŸÐ°Ð¹_Ð–ÑƒÐ¼_Ð¨Ð°Ð½".split("_"),weekdaysMin:"Ð¯Ðº_Ð”Ñƒ_Ð¡Ðµ_Ð§Ð¾_ÐŸÐ°_Ð–Ñƒ_Ð¨Ð°".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"D MMMM YYYY, dddd LT"},calendar:{sameDay:"[Ð‘ÑƒÐ³ÑƒÐ½ ÑÐ¾Ð°Ñ‚] LT [Ð´Ð°]",nextDay:"[Ð­Ñ€Ñ‚Ð°Ð³Ð°] LT [Ð´Ð°]",nextWeek:"dddd [ÐºÑƒÐ½Ð¸ ÑÐ¾Ð°Ñ‚] LT [Ð´Ð°]",lastDay:"[ÐšÐµÑ‡Ð° ÑÐ¾Ð°Ñ‚] LT [Ð´Ð°]",lastWeek:"[Ð£Ñ‚Ð³Ð°Ð½] dddd [ÐºÑƒÐ½Ð¸ ÑÐ¾Ð°Ñ‚] LT [Ð´Ð°]",sameElse:"L"},relativeTime:{future:"Ð¯ÐºÐ¸Ð½ %s Ð¸Ñ‡Ð¸Ð´Ð°",past:"Ð‘Ð¸Ñ€ Ð½ÐµÑ‡Ð° %s Ð¾Ð»Ð´Ð¸Ð½",s:"Ñ„ÑƒÑ€ÑÐ°Ñ‚",m:"Ð±Ð¸Ñ€ Ð´Ð°ÐºÐ¸ÐºÐ°",mm:"%d Ð´Ð°ÐºÐ¸ÐºÐ°",h:"Ð±Ð¸Ñ€ ÑÐ¾Ð°Ñ‚",hh:"%d ÑÐ¾Ð°Ñ‚",d:"Ð±Ð¸Ñ€ ÐºÑƒÐ½",dd:"%d ÐºÑƒÐ½",M:"Ð±Ð¸Ñ€ Ð¾Ð¹",MM:"%d Ð¾Ð¹",y:"Ð±Ð¸Ñ€ Ð¹Ð¸Ð»",yy:"%d Ð¹Ð¸Ð»"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("vi",{months:"thÃ¡ng 1_thÃ¡ng 2_thÃ¡ng 3_thÃ¡ng 4_thÃ¡ng 5_thÃ¡ng 6_thÃ¡ng 7_thÃ¡ng 8_thÃ¡ng 9_thÃ¡ng 10_thÃ¡ng 11_thÃ¡ng 12".split("_"),monthsShort:"Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12".split("_"),weekdays:"chá»§ nháº­t_thá»© hai_thá»© ba_thá»© tÆ°_thá»© nÄƒm_thá»© sÃ¡u_thá»© báº£y".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM [nÄƒm] YYYY",LLL:"D MMMM [nÄƒm] YYYY LT",LLLL:"dddd, D MMMM [nÄƒm] YYYY LT",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY LT",llll:"ddd, D MMM YYYY LT"},calendar:{sameDay:"[HÃ´m nay lÃºc] LT",nextDay:"[NgÃ y mai lÃºc] LT",nextWeek:"dddd [tuáº§n tá»›i lÃºc] LT",lastDay:"[HÃ´m qua lÃºc] LT",lastWeek:"dddd [tuáº§n rá»“i lÃºc] LT",sameElse:"L"},relativeTime:{future:"%s tá»›i",past:"%s trÆ°á»›c",s:"vÃ i giÃ¢y",m:"má»™t phÃºt",mm:"%d phÃºt",h:"má»™t giá»",hh:"%d giá»",d:"má»™t ngÃ y",dd:"%d ngÃ y",M:"má»™t thÃ¡ng",MM:"%d thÃ¡ng",y:"má»™t nÄƒm",yy:"%d nÄƒm"},ordinal:function(a){return a},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("zh-cn",{months:"ä¸€æœˆ_äºŒæœˆ_ä¸‰æœˆ_å››æœˆ_äº”æœˆ_å…­æœˆ_ä¸ƒæœˆ_å…«æœˆ_ä¹æœˆ_åæœˆ_åä¸€æœˆ_åäºŒæœˆ".split("_"),monthsShort:"1æœˆ_2æœˆ_3æœˆ_4æœˆ_5æœˆ_6æœˆ_7æœˆ_8æœˆ_9æœˆ_10æœˆ_11æœˆ_12æœˆ".split("_"),weekdays:"æ˜ŸæœŸæ—¥_æ˜ŸæœŸä¸€_æ˜ŸæœŸäºŒ_æ˜ŸæœŸä¸‰_æ˜ŸæœŸå››_æ˜ŸæœŸäº”_æ˜ŸæœŸå…­".split("_"),weekdaysShort:"å‘¨æ—¥_å‘¨ä¸€_å‘¨äºŒ_å‘¨ä¸‰_å‘¨å››_å‘¨äº”_å‘¨å…­".split("_"),weekdaysMin:"æ—¥_ä¸€_äºŒ_ä¸‰_å››_äº”_å…­".split("_"),longDateFormat:{LT:"Ahç‚¹mm",L:"YYYY-MM-DD",LL:"YYYYå¹´MMMDæ—¥",LLL:"YYYYå¹´MMMDæ—¥LT",LLLL:"YYYYå¹´MMMDæ—¥ddddLT",l:"YYYY-MM-DD",ll:"YYYYå¹´MMMDæ—¥",lll:"YYYYå¹´MMMDæ—¥LT",llll:"YYYYå¹´MMMDæ—¥ddddLT"},meridiem:function(a,b){var c=100*a+b;return 600>c?"å‡Œæ™¨":900>c?"æ—©ä¸Š":1130>c?"ä¸Šåˆ":1230>c?"ä¸­åˆ":1800>c?"ä¸‹åˆ":"æ™šä¸Š"},calendar:{sameDay:function(){return 0===this.minutes()?"[ä»Šå¤©]Ah[ç‚¹æ•´]":"[ä»Šå¤©]LT"},nextDay:function(){return 0===this.minutes()?"[æ˜Žå¤©]Ah[ç‚¹æ•´]":"[æ˜Žå¤©]LT"},lastDay:function(){return 0===this.minutes()?"[æ˜¨å¤©]Ah[ç‚¹æ•´]":"[æ˜¨å¤©]LT"},nextWeek:function(){var b,c;return b=a().startOf("week"),c=this.unix()-b.unix()>=604800?"[ä¸‹]":"[æœ¬]",0===this.minutes()?c+"dddAhç‚¹æ•´":c+"dddAhç‚¹mm"},lastWeek:function(){var b,c;return b=a().startOf("week"),c=this.unix()<b.unix()?"[ä¸Š]":"[æœ¬]",0===this.minutes()?c+"dddAhç‚¹æ•´":c+"dddAhç‚¹mm"},sameElse:"LL"},ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"æ—¥";case"M":return a+"æœˆ";case"w":case"W":return a+"å‘¨";default:return a}},relativeTime:{future:"%så†…",past:"%så‰",s:"å‡ ç§’",m:"1åˆ†é’Ÿ",mm:"%dåˆ†é’Ÿ",h:"1å°æ—¶",hh:"%då°æ—¶",d:"1å¤©",dd:"%då¤©",M:"1ä¸ªæœˆ",MM:"%dä¸ªæœˆ",y:"1å¹´",yy:"%då¹´"},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("zh-tw",{months:"ä¸€æœˆ_äºŒæœˆ_ä¸‰æœˆ_å››æœˆ_äº”æœˆ_å…­æœˆ_ä¸ƒæœˆ_å…«æœˆ_ä¹æœˆ_åæœˆ_åä¸€æœˆ_åäºŒæœˆ".split("_"),monthsShort:"1æœˆ_2æœˆ_3æœˆ_4æœˆ_5æœˆ_6æœˆ_7æœˆ_8æœˆ_9æœˆ_10æœˆ_11æœˆ_12æœˆ".split("_"),weekdays:"æ˜ŸæœŸæ—¥_æ˜ŸæœŸä¸€_æ˜ŸæœŸäºŒ_æ˜ŸæœŸä¸‰_æ˜ŸæœŸå››_æ˜ŸæœŸäº”_æ˜ŸæœŸå…­".split("_"),weekdaysShort:"é€±æ—¥_é€±ä¸€_é€±äºŒ_é€±ä¸‰_é€±å››_é€±äº”_é€±å…­".split("_"),weekdaysMin:"æ—¥_ä¸€_äºŒ_ä¸‰_å››_äº”_å…­".split("_"),longDateFormat:{LT:"Ahé»žmm",L:"YYYYå¹´MMMDæ—¥",LL:"YYYYå¹´MMMDæ—¥",LLL:"YYYYå¹´MMMDæ—¥LT",LLLL:"YYYYå¹´MMMDæ—¥ddddLT",l:"YYYYå¹´MMMDæ—¥",ll:"YYYYå¹´MMMDæ—¥",lll:"YYYYå¹´MMMDæ—¥LT",llll:"YYYYå¹´MMMDæ—¥ddddLT"},meridiem:function(a,b){var c=100*a+b;return 900>c?"æ—©ä¸Š":1130>c?"ä¸Šåˆ":1230>c?"ä¸­åˆ":1800>c?"ä¸‹åˆ":"æ™šä¸Š"},calendar:{sameDay:"[ä»Šå¤©]LT",nextDay:"[æ˜Žå¤©]LT",nextWeek:"[ä¸‹]ddddLT",lastDay:"[æ˜¨å¤©]LT",lastWeek:"[ä¸Š]ddddLT",sameElse:"L"},ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"æ—¥";case"M":return a+"æœˆ";case"w":case"W":return a+"é€±";default:return a}},relativeTime:{future:"%så…§",past:"%så‰",s:"å¹¾ç§’",m:"ä¸€åˆ†é˜",mm:"%dåˆ†é˜",h:"ä¸€å°æ™‚",hh:"%då°æ™‚",d:"ä¸€å¤©",dd:"%då¤©",M:"ä¸€å€‹æœˆ",MM:"%då€‹æœˆ",y:"ä¸€å¹´",yy:"%då¹´"}})}),ib.lang("en"),xb?module.exports=ib:"function"==typeof define&&define.amd?(define("moment",function(a,b,c){return c.config&&c.config()&&c.config().noGlobal===!0&&(mb.moment=jb),ib}),hb(!0)):hb()}).call(this);/*

/ * author mail@markus-falk.com
 * description sets css min-height of given elements to the highest calculated value
 */
;(function($) {

  $.fn.mf_EqualHeight = function() {

    var heights = 0;

    this.each(function() {

      // cache object height
      var obj_height = $(this).height();

      // save it if it is higher than before
      if(heights < obj_height) {
        heights = obj_height;
      }
    });

    // set height of given elements to calculated value
    this.css('min-height', heights);

    // preserve chainability
    return this;
  };

})(jQuery);


/*
 * scroll to element with specified duration (default: 1000 ms)
 */
(function($) {
  $.fn.scrollTo = function(duration) {
    var dur = 1000;
    var pos = 0;

    if(duration >= 0) {
      dur = duration;
    }

    if(this && this.length > 0) {
      pos = this.offset().top;
    }

    $('html, body').animate({scrollTop: pos}, dur);
  };
})(jQuery);
;

/*jshint
   asi: true,
   unused: true,
   boss: true,
   loopfunc: true,
   eqnull: true
 */


/*!
 * Legacy browser support
 */


// Map array support
if ( ![].map ) {
    Array.prototype.map = function ( callback, self ) {
        var array = this, len = array.length, newArray = new Array( len )
        for ( var i = 0; i < len; i++ ) {
            if ( i in array ) {
                newArray[ i ] = callback.call( self, array[ i ], i, array )
            }
        }
        return newArray
    }
}


// Filter array support
if ( ![].filter ) {
    Array.prototype.filter = function( callback ) {
        if ( this == null ) throw new TypeError()
        var t = Object( this ), len = t.length >>> 0
        if ( typeof callback != 'function' ) throw new TypeError()
        var newArray = [], thisp = arguments[ 1 ]
        for ( var i = 0; i < len; i++ ) {
          if ( i in t ) {
            var val = t[ i ]
            if ( callback.call( thisp, val, i, t ) ) newArray.push( val )
          }
        }
        return newArray
    }
}


// Index of array support
if ( ![].indexOf ) {
    Array.prototype.indexOf = function( searchElement ) {
        if ( this == null ) throw new TypeError()
        var t = Object( this ), len = t.length >>> 0
        if ( len === 0 ) return -1
        var n = 0
        if ( arguments.length > 1 ) {
            n = Number( arguments[ 1 ] )
            if ( n != n ) {
                n = 0
            }
            else if ( n !== 0 && n != Infinity && n != -Infinity ) {
                n = ( n > 0 || -1 ) * Math.floor( Math.abs( n ) )
            }
        }
        if ( n >= len ) return -1
        var k = n >= 0 ? n : Math.max( len - Math.abs( n ), 0 )
        for ( ; k < len; k++ ) {
            if ( k in t && t[ k ] === searchElement ) return k
        }
        return -1
    }
}


///*!
// * Cross-Browser Split 1.1.1
// * Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
// * Available under the MIT License
// * http://blog.stevenlevithan.com/archives/cross-browser-split
// */
//var nativeSplit = String.prototype.split, compliantExecNpcg = /()??/.exec('')[1] === undefined
//String.prototype.split = function(separator, limit) {
//    var str = this
//    if (Object.prototype.toString.call(separator) !== '[object RegExp]') {
//        return nativeSplit.call(str, separator, limit)
//    }
//    var output = [],
//        flags = (separator.ignoreCase ? 'i' : '') +
//                (separator.multiline  ? 'm' : '') +
//                (separator.extended   ? 'x' : '') +
//                (separator.sticky     ? 'y' : ''),
//        lastLastIndex = 0,
//        separator2, match, lastIndex, lastLength
//    separator = new RegExp(separator.source, flags + 'g')
//    str += ''
//    if (!compliantExecNpcg) {
//        separator2 = new RegExp('^' + separator.source + '$(?!\\s)', flags)
//    }
//    limit = limit === undefined ? -1 >>> 0 : limit >>> 0
//    while (match = separator.exec(str)) {
//        lastIndex = match.index + match[0].length
//        if (lastIndex > lastLastIndex) {
//            output.push(str.slice(lastLastIndex, match.index))
//            if (!compliantExecNpcg && match.length > 1) {
//                match[0].replace(separator2, function () {
//                    for (var i = 1; i < arguments.length - 2; i++) {
//                        if (arguments[i] === undefined) {
//                            match[i] = undefined
//                        }
//                    }
//                })
//            }
//            if (match.length > 1 && match.index < str.length) {
//                Array.prototype.push.apply(output, match.slice(1))
//            }
//            lastLength = match[0].length
//            lastLastIndex = lastIndex
//            if (output.length >= limit) {
//                break
//            }
//        }
//        if (separator.lastIndex === match.index) {
//            separator.lastIndex++
//        }
//    }
//    if (lastLastIndex === str.length) {
//        if (lastLength || !separator.test('')) {
//            output.push('')
//        }
//    } else {
//        output.push(str.slice(lastLastIndex))
//    }
//    return output.length > limit ? output.slice(0, limit) : output
//};
;
/*!
 * pickadate.js v3.5.0, 2014/04/13
 * By Amsul, http://amsul.ca
 * Hosted on http://amsul.github.io/pickadate.js
 * Licensed under MIT
 */

(function (factory) {

  // AMD.
  if (typeof define == 'function' && define.amd)
    define('picker', ['jquery'], factory)

    // Node.js/browserify.
  else if (typeof exports == 'object')
    module.exports = factory(require('jquery'))

    // Browser globals.
  else this.Picker = factory(jQuery)

}(function ($) {

  var $window = $(window)
  var $document = $(document)
  var $html = $(document.documentElement)


  /**
   * The picker constructor that creates a blank picker.
   */
  function PickerConstructor(ELEMENT, NAME, COMPONENT, OPTIONS) {

    // If there’s no element, return the picker constructor.
    if (!ELEMENT) return PickerConstructor


    var
        IS_DEFAULT_THEME = false,


        // The state of the picker.
        STATE = {
          id: ELEMENT.id || 'P' + Math.abs(~~(Math.random() * new Date()))
        },


        // Merge the defaults and options passed.
        SETTINGS = COMPONENT ? $.extend(true, {}, COMPONENT.defaults, OPTIONS) : OPTIONS || {},


        // Merge the default classes with the settings classes.
        CLASSES = $.extend({}, PickerConstructor.klasses(), SETTINGS.klass),


        // The element node wrapper into a jQuery object.
        $ELEMENT = $(ELEMENT),


        // Pseudo picker constructor.
        PickerInstance = function () {
          return this.start()
        },


        // The picker prototype.
        P = PickerInstance.prototype = {

          constructor: PickerInstance,

          $node: $ELEMENT,


          /**
           * Initialize everything
           */
          start: function () {

            // If it’s already started, do nothing.
            if (STATE && STATE.start) return P


            // Update the picker states.
            STATE.methods = {}
            STATE.start = true
            STATE.open = false
            STATE.type = ELEMENT.type


            // Confirm focus state, convert into text input to remove UA stylings,
            // and set as readonly to prevent keyboard popup.
            ELEMENT.autofocus = ELEMENT == document.activeElement
            ELEMENT.readOnly = !SETTINGS.editable
            ELEMENT.id = ELEMENT.id || STATE.id
            if (ELEMENT.type != 'text') {
              ELEMENT.type = 'text'
            }


            // Create a new picker component with the settings.
            P.component = new COMPONENT(P, SETTINGS)


            // Create the picker root with a holder and then prepare it.
            P.$root = $(PickerConstructor._.node('div', createWrappedComponent(), CLASSES.picker, 'id="' + ELEMENT.id + '_root"'))
            prepareElementRoot()


            // If there’s a format for the hidden input element, create the element.
            if (SETTINGS.formatSubmit) {
              prepareElementHidden()
            }


            // Prepare the input element.
            prepareElement()


            // Insert the root as specified in the settings.
            if (SETTINGS.container) $(SETTINGS.container).append(P.$root)
            else $ELEMENT.after(P.$root)


            // Bind the default component and settings events.
            P.on({
              start: P.component.onStart,
              render: P.component.onRender,
              stop: P.component.onStop,
              open: P.component.onOpen,
              close: P.component.onClose,
              set: P.component.onSet
            }).on({
              start: SETTINGS.onStart,
              render: SETTINGS.onRender,
              stop: SETTINGS.onStop,
              open: SETTINGS.onOpen,
              close: SETTINGS.onClose,
              set: SETTINGS.onSet
            })


            // Once we’re all set, check the theme in use.
            IS_DEFAULT_THEME = isUsingDefaultTheme(P.$root.children()[0])


            // If the element has autofocus, open the picker.
            if (ELEMENT.autofocus) {
              P.open()
            }


            // Trigger queued the “start” and “render” events.
            return P.trigger('start').trigger('render')
          }, //start


          /**
           * Render a new picker
           */
          render: function (entireComponent) {

            // Insert a new component holder in the root or box.
            if (entireComponent) P.$root.html(createWrappedComponent())
            else P.$root.find('.' + CLASSES.box).html(P.component.nodes(STATE.open))

            // Trigger the queued “render” events.
            return P.trigger('render')
          }, //render


          /**
           * Destroy everything
           */
          stop: function () {

            // If it’s already stopped, do nothing.
            if (!STATE.start) return P

            // Then close the picker.
            P.close()

            // Remove the hidden field.
            if (P._hidden) {
              P._hidden.parentNode.removeChild(P._hidden)
            }

            // Remove the root.
            P.$root.remove()

            // Remove the input class, remove the stored data, and unbind
            // the events (after a tick for IE - see `P.close`).
            $ELEMENT.removeClass(CLASSES.input).removeData(NAME)
            setTimeout(function () {
              $ELEMENT.off('.' + STATE.id)
            }, 0)

            // Restore the element state
            ELEMENT.type = STATE.type
            ELEMENT.readOnly = false

            // Trigger the queued “stop” events.
            P.trigger('stop')

            // Reset the picker states.
            STATE.methods = {}
            STATE.start = false

            return P
          }, //stop


          /*
           * Open up the picker
           */
          open: function (dontGiveFocus) {

            // If it’s already open, do nothing.
            if (STATE.open) return P

            // Add the “active” class.
            $ELEMENT.addClass(CLASSES.active)
            aria(ELEMENT, 'expanded', true)

            // * A Firefox bug, when `html` has `overflow:hidden`, results in
            //   killing transitions :(. So add the “opened” state on the next tick.
            //   Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
            setTimeout(function () {

              // Add the “opened” class to the picker root.
              P.$root.addClass(CLASSES.opened)
              aria(P.$root[0], 'hidden', true)

            }, 0)

            // If we have to give focus, bind the element and doc events.
            if (dontGiveFocus !== false) {

              // Set it as open.
              STATE.open = true

              // Prevent the page from scrolling.
              if (IS_DEFAULT_THEME) {
                $html.
                    css('overflow', 'hidden').
                    css('padding-right', '+=' + getScrollbarWidth())
              }

              // Pass focus to the element’s jQuery object.
              $ELEMENT.trigger('focus')

              // Bind the document events.
              $document.on('click.' + STATE.id + ' focusin.' + STATE.id, function (event) {

                var target = event.target

                // If the target of the event is not the element, close the picker picker.
                // * Don’t worry about clicks or focusins on the root because those don’t bubble up.
                //   Also, for Firefox, a click on an `option` element bubbles up directly
                //   to the doc. So make sure the target wasn't the doc.
                // * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling,
                //   which causes the picker to unexpectedly close when right-clicking it. So make
                //   sure the event wasn’t a right-click.
                if (target != ELEMENT && target != document && event.which != 3) {

                  // If the target was the holder that covers the screen,
                  // keep the element focused to maintain tabindex.
                  P.close(target === P.$root.children()[0])
                }

              }).on('keydown.' + STATE.id, function (event) {

                var
                    // Get the keycode.
                    keycode = event.keyCode,

                    // Translate that to a selection change.
                    keycodeToMove = P.component.key[keycode],

                    // Grab the target.
                    target = event.target


                // On escape, close the picker and give focus.
                if (keycode == 27) {
                  P.close(true)
                }


                  // Check if there is a key movement or “enter” keypress on the element.
                else if (target == ELEMENT && (keycodeToMove || keycode == 13)) {

                  // Prevent the default action to stop page movement.
                  event.preventDefault()

                  // Trigger the key movement action.
                  if (keycodeToMove) {
                    PickerConstructor._.trigger(P.component.key.go, P, [PickerConstructor._.trigger(keycodeToMove)])
                  }

                    // On “enter”, if the highlighted item isn’t disabled, set the value and close.
                  else if (!P.$root.find('.' + CLASSES.highlighted).hasClass(CLASSES.disabled)) {
                  //webit patch timepicker: add additional values to onSet event context
                  P.component.item.highlight.value = target.value;
                  P.component.item.highlight.defaultValue = target.defaultValue;
                    P.set('select', P.component.item.highlight).close()
                  }
                }


                  // If the target is within the root and “enter” is pressed,
                  // prevent the default action and trigger a click on the target instead.
                else if ($.contains(P.$root[0], target) && keycode == 13) {
                  event.preventDefault()
                  target.click()
                }
              })
            }

            // Trigger the queued “open” events.
            return P.trigger('open')
          }, //open


          /**
           * Close the picker
           */
          close: function (giveFocus) {

            // If we need to give focus, do it before changing states.
            if (giveFocus) {
              // ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
              // The focus is triggered *after* the close has completed - causing it
              // to open again. So unbind and rebind the event at the next tick.
              $ELEMENT.off('focus.' + STATE.id).trigger('focus')
              setTimeout(function () {
                $ELEMENT.on('focus.' + STATE.id, focusToOpen)
              }, 0)
            }

            // Remove the “active” class.
            $ELEMENT.removeClass(CLASSES.active)
            aria(ELEMENT, 'expanded', false)

            // * A Firefox bug, when `html` has `overflow:hidden`, results in
            //   killing transitions :(. So remove the “opened” state on the next tick.
            //   Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
            setTimeout(function () {

              // Remove the “opened” and “focused” class from the picker root.
              P.$root.removeClass(CLASSES.opened + ' ' + CLASSES.focused)
              aria(P.$root[0], 'hidden', true)

            }, 0)

            // If it’s already closed, do nothing more.
            if (!STATE.open) return P

            // Set it as closed.
            STATE.open = false

            // Allow the page to scroll.
            if (IS_DEFAULT_THEME) {
              $html.
                  css('overflow', '').
                  css('padding-right', '-=' + getScrollbarWidth())
            }

            // Unbind the document events.
            $document.off('.' + STATE.id)

            // Trigger the queued “close” events.
            return P.trigger('close')
          }, //close


          /**
           * Clear the values
           */
          clear: function (options) {
            return P.set('clear', null, options)
          }, //clear


          /**
           * Set something
           */
          set: function (thing, value, options) {

            var thingItem, thingValue,
                thingIsObject = $.isPlainObject(thing),
                thingObject = thingIsObject ? thing : {}

            // Make sure we have usable options.
            options = thingIsObject && $.isPlainObject(value) ? value : options || {}

            if (thing) {

              // If the thing isn’t an object, make it one.
              if (!thingIsObject) {
                thingObject[thing] = value
              }

              // Go through the things of items to set.
              for (thingItem in thingObject) {

                // Grab the value of the thing.
                thingValue = thingObject[thingItem]

                // First, if the item exists and there’s a value, set it.
                if (thingItem in P.component.item) {
                  if (thingValue === undefined) thingValue = null
                  P.component.set(thingItem, thingValue, options)
                }

                // Then, check to update the element value and broadcast a change.
                if (thingItem == 'select' || thingItem == 'clear') {
                  $ELEMENT.
                      val(thingItem == 'clear' ? '' : P.get(thingItem, SETTINGS.format)).
                      trigger('change')
                }
              }

              // Render a new picker.
              P.render()
            }

            // When the method isn’t muted, trigger queued “set” events and pass the `thingObject`.
            return options.muted ? P : P.trigger('set', thingObject)
          }, //set


          /**
           * Get something
           */
          get: function (thing, format) {

            // Make sure there’s something to get.
            thing = thing || 'value'

            // If a picker state exists, return that.
            if (STATE[thing] != null) {
              return STATE[thing]
            }

            // Return the value, if that.
            if (thing == 'value') {
              return ELEMENT.value
            }

            // Check if a component item exists, return that.
            if (thing in P.component.item) {
              if (typeof format == 'string') {
                var thingValue = P.component.get(thing)
                return thingValue ?
                    PickerConstructor._.trigger(
                        P.component.formats.toString,
                        P.component,
                        [format, thingValue]
                    ) : ''
              }
              return P.component.get(thing)
            }
          }, //get



          /**
           * Bind events on the things.
           */
          on: function (thing, method) {

            var thingName, thingMethod,
                thingIsObject = $.isPlainObject(thing),
                thingObject = thingIsObject ? thing : {}

            if (thing) {

              // If the thing isn’t an object, make it one.
              if (!thingIsObject) {
                thingObject[thing] = method
              }

              // Go through the things to bind to.
              for (thingName in thingObject) {

                // Grab the method of the thing.
                thingMethod = thingObject[thingName]

                // Make sure the thing methods collection exists.
                STATE.methods[thingName] = STATE.methods[thingName] || []

                // Add the method to the relative method collection.
                STATE.methods[thingName].push(thingMethod)
              }
            }

            return P
          }, //on



          /**
           * Unbind events on the things.
           */
          off: function () {
            var i, thingName,
                names = arguments;
            for (i = 0, namesCount = names.length; i < namesCount; i += 1) {
              thingName = names[i]
              if (thingName in STATE.methods) {
                delete STATE.methods[thingName]
              }
            }
            return P
          },


          /**
           * Fire off method events.
           */
          trigger: function (name, data) {
            var methodList = STATE.methods[name]
            if (methodList) {
              methodList.map(function (method) {
                PickerConstructor._.trigger(method, P, [data])
              })
            }
            return P
          } //trigger
        } //PickerInstance.prototype


    /**
     * Wrap the picker holder components together.
     */
    function createWrappedComponent() {

      // Create a picker wrapper holder
      return PickerConstructor._.node('div',

          // Create a picker wrapper node
          PickerConstructor._.node('div',

              // Create a picker frame
              PickerConstructor._.node('div',

                  // Create a picker box node
                  PickerConstructor._.node('div',

                      // Create the components nodes.
                      P.component.nodes(STATE.open),

                      // The picker box class
                      CLASSES.box
                  ),

                  // Picker wrap class
                  CLASSES.wrap
              ),

              // Picker frame class
              CLASSES.frame
          ),

          // Picker holder class
          CLASSES.holder
      ) //endreturn
    } //createWrappedComponent



    /**
     * Prepare the input element with all bindings.
     */
    function prepareElement() {

      $ELEMENT.

          // Store the picker data by component name.
          data(NAME, P).

          // Add the “input” class name.
          addClass(CLASSES.input).

          // If there’s a `data-value`, update the value of the element.
          val($ELEMENT.data('value') ?
              P.get('select', SETTINGS.format) :
              ELEMENT.value
          ).

          // On focus/click, open the picker and adjust the root “focused” state.
          on('focus.' + STATE.id + ' click.' + STATE.id, focusToOpen)


      // Only bind keydown events if the element isn’t editable.
      if (!SETTINGS.editable) {

        // Handle keyboard event based on the picker being opened or not.
        $ELEMENT.on('keydown.' + STATE.id, function (event) {

          var keycode = event.keyCode,

              // Check if one of the delete keys was pressed.
              isKeycodeDelete = /^(8|46)$/.test(keycode)

          // For some reason IE clears the input value on “escape”.
          if (keycode == 27) {
            P.close()
            return false
          }

          // Check if `space` or `delete` was pressed or the picker is closed with a key movement.
          if (keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[keycode]) {

            // Prevent it from moving the page and bubbling to doc.
            event.preventDefault()
            event.stopPropagation()

            // If `delete` was pressed, clear the values and close the picker.
            // Otherwise open the picker.
            if (isKeycodeDelete) { P.clear().close() }
            else { P.open() }
          }
        })
      }


      // Update the aria attributes.
      aria(ELEMENT, {
        haspopup: true,
        expanded: false,
        readonly: false,
        owns: ELEMENT.id + '_root' + (P._hidden ? ' ' + P._hidden.id : '')
      })
    }


    /**
     * Prepare the root picker element with all bindings.
     */
    function prepareElementRoot() {

      P.$root.

          on({

            // When something within the root is focused, stop from bubbling
            // to the doc and remove the “focused” state from the root.
            focusin: function (event) {
              P.$root.removeClass(CLASSES.focused)
              event.stopPropagation()
            },

            // When something within the root holder is clicked, stop it
            // from bubbling to the doc.
            'mousedown click': function (event) {

              var target = event.target

              // Make sure the target isn’t the root holder so it can bubble up.
              if (target != P.$root.children()[0]) {

                event.stopPropagation()

                // * For mousedown events, cancel the default action in order to
                //   prevent cases where focus is shifted onto external elements
                //   when using things like jQuery mobile or MagnificPopup (ref: #249 & #120).
                //   Also, for Firefox, don’t prevent action on the `option` element.
                if (event.type == 'mousedown' && !$(target).is(':input') && target.nodeName != 'OPTION') {

                  event.preventDefault()

                  // Re-focus onto the element so that users can click away
                  // from elements focused within the picker.
                  ELEMENT.focus()
                }
              }
            }
          }).

          // If there’s a click on an actionable element, carry out the actions.
          on('click', '[data-pick], [data-nav], [data-clear]', function () {

            var $target = $(this),
                targetData = $target.data(),
                targetDisabled = $target.hasClass(CLASSES.navDisabled) || $target.hasClass(CLASSES.disabled),

                // * For IE, non-focusable elements can be active elements as well
                //   (http://stackoverflow.com/a/2684561).
                activeElement = document.activeElement
            activeElement = activeElement && (activeElement.type || activeElement.href) && activeElement

            // If it’s disabled or nothing inside is actively focused, re-focus the element.
            if (targetDisabled || activeElement && !$.contains(P.$root[0], activeElement)) {
              ELEMENT.focus()
            }

            // If something is superficially changed, update the `highlight` based on the `nav`.
            if (targetData.nav && !targetDisabled) {
              P.set('highlight', P.component.item.highlight, { nav: targetData.nav })
            }

              // If something is picked, set `select` then close with focus.
            else if (PickerConstructor._.isInteger(targetData.pick) && !targetDisabled) {
              P.set('select', targetData.pick).close(true)
            }

              // If a “clear” button is pressed, empty the values and close with focus.
            else if (targetData.clear) {
              P.clear().close(true)
            }
          }) //P.$root

      aria(P.$root[0], 'hidden', true)
    }


    /**
     * Prepare the hidden input element along with all bindings.
     */
    function prepareElementHidden() {

      var name

      if (SETTINGS.hiddenName === true) {
        name = ELEMENT.name
        ELEMENT.name = ''
      }
      else {
        name = [
            typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '',
            typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'
        ]
        name = name[0] + ELEMENT.name + name[1]
      }

      P._hidden = $(
          '<input ' +
          'type=hidden ' +

          // Create the name using the original input’s with a prefix and suffix.
          'name="' + name + '"' +

          // Create the ID using the original input’s; only if it has one.
          (ELEMENT.id ? 'id="' + ELEMENT.id + '_hidden"' : '') +

          // If the element has a value, set the hidden value as well.
          (
              $ELEMENT.data('value') || ELEMENT.value ?
                  ' value="' + P.get('select', SETTINGS.formatSubmit) + '"' :
                  ''
          ) +
          '>'
      )[0]

      $ELEMENT.

          // If the value changes, update the hidden input with the correct format.
          on('change.' + STATE.id, function () {
            P._hidden.value = ELEMENT.value ?
                P.get('select', SETTINGS.formatSubmit) :
                ''
          }).

          // Insert the hidden input after the element.
          after(P._hidden)
    }


    // Separated for IE
    function focusToOpen(event) {

      // Stop the event from propagating to the doc.
      event.stopPropagation()

      // If it’s a focus event, add the “focused” class to the root.
      if (event.type == 'focus') {
        P.$root.addClass(CLASSES.focused)
      }

      // And then finally open the picker.
      P.open()
    }


    // Return a new picker instance.
    return new PickerInstance()
  } //PickerConstructor



  /**
   * The default classes and prefix to use for the HTML classes.
   */
  PickerConstructor.klasses = function (prefix) {
    prefix = prefix || 'picker'
    return {

      picker: prefix,
      opened: prefix + '--opened',
      focused: prefix + '--focused',

      input: prefix + '__input',
      active: prefix + '__input--active',

      holder: prefix + '__holder',

      frame: prefix + '__frame',
      wrap: prefix + '__wrap',

      box: prefix + '__box'
    }
  } //PickerConstructor.klasses



  /**
   * Check if the default theme is being used.
   */
  function isUsingDefaultTheme(element) {

    var theme,
        prop = 'position'

    // For IE.
    if (element.currentStyle) {
      theme = element.currentStyle[prop]
    }

      // For normal browsers.
    else if (window.getComputedStyle) {
      theme = getComputedStyle(element)[prop]
    }

    return theme == 'fixed'
  }



  /**
   * Get the width of the browser’s scrollbar.
   * Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js
   */
  function getScrollbarWidth() {

    if ($html.height() <= $window.height()) {
      return 0
    }

    var $outer = $('<div style="visibility:hidden;width:100px" />').
        appendTo('body')

    // Get the width without scrollbars.
    var widthWithoutScroll = $outer[0].offsetWidth

    // Force adding scrollbars.
    $outer.css('overflow', 'scroll')

    // Add the inner div.
    var $inner = $('<div style="width:100%" />').appendTo($outer)

    // Get the width with scrollbars.
    var widthWithScroll = $inner[0].offsetWidth

    // Remove the divs.
    $outer.remove()

    // Return the difference between the widths.
    return widthWithoutScroll - widthWithScroll
  }



  /**
   * PickerConstructor helper methods.
   */
  PickerConstructor._ = {

    /**
     * Create a group of nodes. Expects:
     * `
        {
            min:    {Integer},
            max:    {Integer},
            i:      {Integer},
            node:   {String},
            item:   {Function}
        }
     * `
     */
    group: function (groupObject) {

      var
          // Scope for the looped object
          loopObjectScope,

          // Create the nodes list
          nodesList = '',

          // The counter starts from the `min`
          counter = PickerConstructor._.trigger(groupObject.min, groupObject)


      // Loop from the `min` to `max`, incrementing by `i`
      for (; counter <= PickerConstructor._.trigger(groupObject.max, groupObject, [counter]) ; counter += groupObject.i) {

        // Trigger the `item` function within scope of the object
        loopObjectScope = PickerConstructor._.trigger(groupObject.item, groupObject, [counter])

        // Splice the subgroup and create nodes out of the sub nodes
        nodesList += PickerConstructor._.node(
            groupObject.node,
            loopObjectScope[0],   // the node
            loopObjectScope[1],   // the classes
            loopObjectScope[2]    // the attributes
        )
      }

      // Return the list of nodes
      return nodesList
    }, //group


    /**
     * Create a dom node string
     */
    node: function (wrapper, item, klass, attribute) {

      // If the item is false-y, just return an empty string
      if (!item) return ''

      // If the item is an array, do a join
      item = $.isArray(item) ? item.join('') : item

      // Check for the class
      klass = klass ? ' class="' + klass + '"' : ''

      // Check for any attributes
      attribute = attribute ? ' ' + attribute : ''

      // Return the wrapped item
      return '<' + wrapper + klass + attribute + '>' + item + '</' + wrapper + '>'
    }, //node


    /**
     * Lead numbers below 10 with a zero.
     */
    lead: function (number) {
      return (number < 10 ? '0' : '') + number
    },


    /**
     * Trigger a function otherwise return the value.
     */
    trigger: function (callback, scope, args) {
      return typeof callback == 'function' ? callback.apply(scope, args || []) : callback
    },


    /**
     * If the second character is a digit, length is 2 otherwise 1.
     */
    digits: function (string) {
      return (/\d/).test(string[1]) ? 2 : 1
    },


    /**
     * Tell if something is a date object.
     */
    isDate: function (value) {
      return {}.toString.call(value).indexOf('Date') > -1 && this.isInteger(value.getUTCDate())
    },


    /**
     * Tell if something is an integer.
     */
    isInteger: function (value) {
      return {}.toString.call(value).indexOf('Number') > -1 && value % 1 === 0
    },


    /**
     * Create ARIA attribute strings.
     */
    ariaAttr: ariaAttr
  } //PickerConstructor._



  /**
   * Extend the picker with a component and defaults.
   */
  PickerConstructor.extend = function (name, Component) {

    // Extend jQuery.
    $.fn[name] = function (options, action) {

      // Grab the component data.
      var componentData = this.data(name)

      // If the picker is requested, return the data object.
      if (options == 'picker') {
        return componentData
      }

      // If the component data exists and `options` is a string, carry out the action.
      if (componentData && typeof options == 'string') {
        return PickerConstructor._.trigger(componentData[options], componentData, [action])
      }

      // Otherwise go through each matched element and if the component
      // doesn’t exist, create a new picker using `this` element
      // and merging the defaults and options with a deep copy.
      return this.each(function () {
        var $this = $(this)
        if (!$this.data(name)) {
          new PickerConstructor(this, name, Component, options)
        }
      })
    }

    // Set the defaults.
    $.fn[name].defaults = Component.defaults
  } //PickerConstructor.extend



  function aria(element, attribute, value) {
    if ($.isPlainObject(attribute)) {
      for (var key in attribute) {
        ariaSet(element, key, attribute[key])
      }
    }
    else {
      ariaSet(element, attribute, value)
    }
  }
  function ariaSet(element, attribute, value) {
    element.setAttribute(
        (attribute == 'role' ? '' : 'aria-') + attribute,
        value
    )
  }
  function ariaAttr(attribute, data) {
    if (!$.isPlainObject(attribute)) {
      attribute = { attribute: data }
    }
    data = ''
    for (var key in attribute) {
      var attr = (key == 'role' ? '' : 'aria-') + key,
          attrVal = attribute[key]
      data += attrVal == null ? '' : attr + '="' + attribute[key] + '"'
    }
    return data
  }



  // Expose the picker constructor.
  return PickerConstructor


}));




/*!
 * Date picker for pickadate.js v3.5.0
 * http://amsul.github.io/pickadate.js/date.htm
 */

(function (factory) {

  // AMD.
  if (typeof define == 'function' && define.amd)
    define(['picker', 'jquery'], factory)

    // Node.js/browserify.
  else if (typeof exports == 'object')
    module.exports = factory(require('./picker.js'), require('jquery'))

    // Browser globals.
  else factory(Picker, jQuery)

}(function (Picker, $) {


  /**
   * Globals and constants
   */
  var DAYS_IN_WEEK = 7,
      WEEKS_IN_CALENDAR = 6,
      _ = Picker._



  /**
   * The date picker constructor
   */
  function DatePicker(picker, settings) {

    var calendar = this,
        element = picker.$node[0],
        elementValue = element.value,
        elementDataValue = picker.$node.data('value'),
        valueString = elementDataValue || elementValue,
        formatString = elementDataValue ? settings.formatSubmit : settings.format,
        isRTL = function () {

          return element.currentStyle ?

              // For IE.
              element.currentStyle.direction == 'rtl' :

              // For normal browsers.
              getComputedStyle(picker.$root[0]).direction == 'rtl'
        }

    calendar.settings = settings
    calendar.$node = picker.$node

    // The queue of methods that will be used to build item objects.
    calendar.queue = {
      min: 'measure create',
      max: 'measure create',
      now: 'now create',
      select: 'parse create validate',
      highlight: 'parse navigate create validate',
      view: 'parse create validate viewset',
      disable: 'deactivate',
      enable: 'activate'
    }

    // The component's item object.
    calendar.item = {}

    calendar.item.clear = null
    calendar.item.disable = (settings.disable || []).slice(0)
    calendar.item.enable = -(function (collectionDisabled) {
      return collectionDisabled[0] === true ? collectionDisabled.shift() : -1
    })(calendar.item.disable)

    calendar.
        set('min', settings.min).
        set('max', settings.max).
        set('now')

    // When there’s a value, set the `select`, which in turn
    // also sets the `highlight` and `view`.
    if (valueString) {
      calendar.set('select', valueString, { format: formatString })
    }

      // If there’s no value, default to highlighting “today”.
    else {
      calendar.
          set('select', null).
          set('highlight', calendar.item.now)
    }


    // The keycode to movement mapping.
    calendar.key = {
      40: 7, // Down
      38: -7, // Up
      39: function () { return isRTL() ? -1 : 1 }, // Right
      37: function () { return isRTL() ? 1 : -1 }, // Left
      go: function (timeChange) {
        var highlightedObject = calendar.item.highlight,
            targetDate = new Date(Date.UTC(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange))
        calendar.set(
            'highlight',
            [targetDate.getUTCFullYear(), targetDate.getUTCMonth(), targetDate.getUTCDate()],
            { interval: timeChange }
        )
        $('#bitV_datepicker').html(this.get('highlight', calendar.settings.format));
        this.render()
      }
    }


    // Bind some picker events.
    picker.
        on('render', function () {
          picker.$root.find('.' + settings.klass.selectMonth).on('change', function () {
            var value = this.value
            if (value) {
              picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date])
              picker.$root.find('.' + settings.klass.selectMonth).trigger('focus')
            }
          })
          picker.$root.find('.' + settings.klass.selectYear).on('change', function () {
            var value = this.value
            if (value) {
              picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date])
              picker.$root.find('.' + settings.klass.selectYear).trigger('focus')
            }
          })
        }).
        on('open', function () {
          var includeToday = ''
          if (calendar.disabled(calendar.get('now'))) {
            includeToday = ':not(.' + settings.klass.buttonToday + ')'
          }
          picker.$root.find('button' + includeToday + ', select').attr('disabled', false)
        }).
        on('close', function () {
          picker.$root.find('button, select').attr('disabled', true)
        })

  } //DatePicker


  /**
   * Set a datepicker item object.
   */
  DatePicker.prototype.set = function (type, value, options) {

    var calendar = this,
        calendarItem = calendar.item

    // If the value is `null` just set it immediately.
    if (value === null) {
      if (type == 'clear') type = 'select'
      calendarItem[type] = value
      return calendar
    }

    // Otherwise go through the queue of methods, and invoke the functions.
    // Update this as the time unit, and set the final value as this item.
    // * In the case of `enable`, keep the queue but set `disable` instead.
    //   And in the case of `flip`, keep the queue but set `enable` instead.
    calendarItem[(type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type)] = calendar.queue[type].split(' ').map(function (method) {
      value = calendar[method](type, value, options)
      return value
    }).pop()

    // Check if we need to cascade through more updates.
    if (type == 'select') {
      calendar.set('highlight', calendarItem.select, options)
    }
    else if (type == 'highlight') {
      calendar.set('view', calendarItem.highlight, options)
    }
    else if (type.match(/^(flip|min|max|disable|enable)$/)) {
      if (calendarItem.select && calendar.disabled(calendarItem.select)) {
        calendar.set('select', calendarItem.select, options)
      }
      if (calendarItem.highlight && calendar.disabled(calendarItem.highlight)) {
        calendar.set('highlight', calendarItem.highlight, options)
      }
    }

    return calendar
  } //DatePicker.prototype.set


  /**
   * Get a datepicker item object.
   */
  DatePicker.prototype.get = function (type) {
    return this.item[type]
  } //DatePicker.prototype.get


  /**
   * Create a picker date object.
   */
  DatePicker.prototype.create = function (type, value, options) {

    var isInfiniteValue,
        calendar = this

    // If there’s no value, use the type as the value.
    value = value === undefined ? type : value


    // If it’s infinity, update the value.
    if (value == -Infinity || value == Infinity) {
      isInfiniteValue = value
    }

      // If it’s an object, use the native date object.
    else if ($.isPlainObject(value) && _.isInteger(value.pick)) {
      value = value.obj
    }

      // If it’s an array, convert it into a date and make sure
      // that it’s a valid date – otherwise default to today.
    else if ($.isArray(value)) {
      value = new Date(Date.UTC(value[0], value[1], value[2]))
      value = _.isDate(value) ? value : calendar.create().obj
    }

      // If it’s a number, make a normalized date.
    else if (_.isInteger(value)) {
      value = calendar.normalize(new Date(value), options)
    }

      // If it’s a date object, make a normalized date.
    else if (_.isDate(value)) {
      value = calendar.normalize(value, options)
    }

      // If it’s a literal true or any other case, set it to now.
    else /*if ( value === true )*/ {
      value = calendar.now(type, value, options)
    }

    // Return the compiled object.
    return {
      year: isInfiniteValue || value.getUTCFullYear(),
      month: isInfiniteValue || value.getUTCMonth(),
      date: isInfiniteValue || value.getUTCDate(),
      day: isInfiniteValue || value.getUTCDay(),
      obj: isInfiniteValue || value,
      pick: isInfiniteValue || value.getTime()
    }
  } //DatePicker.prototype.create


  /**
   * Create a range limit object using an array, date object,
   * literal “true”, or integer relative to another time.
   */
  DatePicker.prototype.createRange = function (from, to) {

    var calendar = this,
        createDate = function (date) {
          if (date === true || $.isArray(date) || _.isDate(date)) {
            return calendar.create(date)
          }
          return date
        }

    // Create objects if possible.
    if (!_.isInteger(from)) {
      from = createDate(from)
    }
    if (!_.isInteger(to)) {
      to = createDate(to)
    }

    // Create relative dates.
    if (_.isInteger(from) && $.isPlainObject(to)) {
      from = [to.year, to.month, to.date + from];
    }
    else if (_.isInteger(to) && $.isPlainObject(from)) {
      to = [from.year, from.month, from.date + to];
    }

    return {
      from: createDate(from),
      to: createDate(to)
    }
  } //DatePicker.prototype.createRange


  /**
   * Check if a date unit falls within a date range object.
   */
  DatePicker.prototype.withinRange = function (range, dateUnit) {
    range = this.createRange(range.from, range.to)
    return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick
  }


  /**
   * Check if two date range objects overlap.
   */
  DatePicker.prototype.overlapRanges = function (one, two) {

    var calendar = this

    // Convert the ranges into comparable dates.
    one = calendar.createRange(one.from, one.to)
    two = calendar.createRange(two.from, two.to)

    return calendar.withinRange(one, two.from) || calendar.withinRange(one, two.to) ||
        calendar.withinRange(two, one.from) || calendar.withinRange(two, one.to)
  }


  /**
   * Get the date today.
   */
  DatePicker.prototype.now = function (type, value, options) {
    value = new Date()
    if (options && options.rel) {
      value.setUTCDate(value.getUTCDate() + options.rel)
    }
    return this.normalize(value, options)
  }


  /**
   * Navigate to next/prev month.
   */
  DatePicker.prototype.navigate = function (type, value, options) {

    var targetDateObject,
        targetYear,
        targetMonth,
        targetDate,
        isTargetArray = $.isArray(value),
        isTargetObject = $.isPlainObject(value),
        viewsetObject = this.item.view/*,
        safety = 100*/


    if (isTargetArray || isTargetObject) {

      if (isTargetObject) {
        targetYear = value.year
        targetMonth = value.month
        targetDate = value.date
      }
      else {
        targetYear = +value[0]
        targetMonth = +value[1]
        targetDate = +value[2]
      }

      // If we’re navigating months but the view is in a different
      // month, navigate to the view’s year and month.
      if (options && options.nav && viewsetObject && viewsetObject.month !== targetMonth) {
        targetYear = viewsetObject.year
        targetMonth = viewsetObject.month
      }

      // Figure out the expected target year and month.
      targetDateObject = new Date(Date.UTC(targetYear, targetMonth + (options && options.nav ? options.nav : 0), 1))
      targetYear = targetDateObject.getUTCFullYear()
      targetMonth = targetDateObject.getUTCMonth()

      // If the month we’re going to doesn’t have enough days,
      // keep decreasing the date until we reach the month’s last date.
      while ( /*safety &&*/ new Date(Date.UTC(targetYear, targetMonth, targetDate)).getUTCMonth() !== targetMonth) {
        targetDate -= 1
        /*safety -= 1
        if ( !safety ) {
            throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
        }*/
      }

      value = [targetYear, targetMonth, targetDate]
    }

    return value
  } //DatePicker.prototype.navigate


  /**
   * Normalize a date by setting the hours to midnight.
   */
  DatePicker.prototype.normalize = function (value/*, options*/) {
    value.setUTCHours(0, 0, 0, 0)
    return value
  }


  /**
   * Measure the range of dates.
   */
  DatePicker.prototype.measure = function (type, value/*, options*/) {

    var calendar = this

    // If it's anything false-y, remove the limits.
    if (!value) {
      value = type == 'min' ? -Infinity : Infinity
    }

      // If it's an integer, get a date relative to today.
    else if (_.isInteger(value)) {
      value = calendar.now(type, value, { rel: value })
    }

    return value
  } ///DatePicker.prototype.measure


  /**
   * Create a viewset object based on navigation.
   */
  DatePicker.prototype.viewset = function (type, dateObject/*, options*/) {
    return this.create([dateObject.year, dateObject.month, 1])
  }


  /**
   * Validate a date as enabled and shift if needed.
   */
  DatePicker.prototype.validate = function (type, dateObject, options) {

    var calendar = this,

        // Keep a reference to the original date.
        originalDateObject = dateObject,

        // Make sure we have an interval.
        interval = options && options.interval ? options.interval : 1,

        // Check if the calendar enabled dates are inverted.
        isFlippedBase = calendar.item.enable === -1,

        // Check if we have any enabled dates after/before now.
        hasEnabledBeforeTarget, hasEnabledAfterTarget,

        // The min & max limits.
        minLimitObject = calendar.item.min,
        maxLimitObject = calendar.item.max,

        // Check if we’ve reached the limit during shifting.
        reachedMin, reachedMax,

        // Check if the calendar is inverted and at least one weekday is enabled.
        hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter(function (value) {

          // If there’s a date, check where it is relative to the target.
          if ($.isArray(value)) {
            var dateTime = calendar.create(value).pick
            if (dateTime < dateObject.pick) hasEnabledBeforeTarget = true
            else if (dateTime > dateObject.pick) hasEnabledAfterTarget = true
          }

          // Return only integers for enabled weekdays.
          return _.isInteger(value)
        }).length/*,

        safety = 100*/



    // Cases to validate for:
    // [1] Not inverted and date disabled.
    // [2] Inverted and some dates enabled.
    // [3] Not inverted and out of range.
    //
    // Cases to **not** validate for:
    // • Navigating months.
    // • Not inverted and date enabled.
    // • Inverted and all dates disabled.
    // • ..and anything else.
    if (!options || !options.nav) if (
      /* 1 */ (!isFlippedBase && calendar.disabled(dateObject)) ||
      /* 2 */ (isFlippedBase && calendar.disabled(dateObject) && (hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget)) ||
      /* 3 */ (!isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick))
    ) {


      // When inverted, flip the direction if there aren’t any enabled weekdays
      // and there are no enabled dates in the direction of the interval.
      if (isFlippedBase && !hasEnabledWeekdays && ((!hasEnabledAfterTarget && interval > 0) || (!hasEnabledBeforeTarget && interval < 0))) {
        interval *= -1
      }


      // Keep looping until we reach an enabled date.
      while ( /*safety &&*/ calendar.disabled(dateObject)) {

        /*safety -= 1
        if ( !safety ) {
            throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
        }*/


        // If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
        if (Math.abs(interval) > 1 && (dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month)) {
          dateObject = originalDateObject
          interval = interval > 0 ? 1 : -1
        }


        // If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
        if (dateObject.pick <= minLimitObject.pick) {
          reachedMin = true
          interval = 1
          dateObject = calendar.create([
              minLimitObject.year,
              minLimitObject.month,
              minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)
          ])
        }
        else if (dateObject.pick >= maxLimitObject.pick) {
          reachedMax = true
          interval = -1
          dateObject = calendar.create([
              maxLimitObject.year,
              maxLimitObject.month,
              maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)
          ])
        }


        // If we’ve reached both limits, just break out of the loop.
        if (reachedMin && reachedMax) {
          break
        }


        // Finally, create the shifted date using the interval and keep looping.
        dateObject = calendar.create([dateObject.year, dateObject.month, dateObject.date + interval])
      }

    } //endif


    // Return the date object settled on.
    return dateObject
  } //DatePicker.prototype.validate


  /**
   * Check if a date is disabled.
   */
  DatePicker.prototype.disabled = function (dateToVerify) {

    var
        calendar = this,

        // Filter through the disabled dates to check if this is one.
        isDisabledMatch = calendar.item.disable.filter(function (dateToDisable) {

          // If the date is a number, match the weekday with 0index and `firstDay` check.
          if (_.isInteger(dateToDisable)) {
            return dateToVerify.day === (calendar.settings.firstDay ? dateToDisable : dateToDisable - 1) % 7
          }

          // If it’s an array or a native JS date, create and match the exact date.
          if ($.isArray(dateToDisable) || _.isDate(dateToDisable)) {
            return dateToVerify.pick === calendar.create(dateToDisable).pick
          }

          // If it’s an object, match a date within the “from” and “to” range.
          if ($.isPlainObject(dateToDisable)) {
            return calendar.withinRange(dateToDisable, dateToVerify)
          }
        })

    // If this date matches a disabled date, confirm it’s not inverted.
    isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function (dateToDisable) {
      return $.isArray(dateToDisable) && dateToDisable[3] == 'inverted' ||
          $.isPlainObject(dateToDisable) && dateToDisable.inverted
    }).length

    // Check the calendar “enabled” flag and respectively flip the
    // disabled state. Then also check if it’s beyond the min/max limits.
    return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch ||
        dateToVerify.pick < calendar.item.min.pick ||
        dateToVerify.pick > calendar.item.max.pick

  } //DatePicker.prototype.disabled


  /**
   * Parse a string into a usable type.
   */
  DatePicker.prototype.parse = function (type, value, options) {

    var calendar = this,
        parsingObject = {}

    // If it’s already parsed, we’re good.
    if (!value || typeof value != 'string') {
      return value
    }

    // We need a `.format` to parse the value with.
    if (!(options && options.format)) {
      options = options || {}
      options.format = calendar.settings.format
    }

    // Convert the format into an array and then map through it.
    calendar.formats.toArray(options.format).map(function (label) {

      var
          // Grab the formatting label.
          formattingLabel = calendar.formats[label],

          // The format length is from the formatting label function or the
          // label length without the escaping exclamation (!) mark.
          formatLength = formattingLabel ? _.trigger(formattingLabel, calendar, [value, parsingObject]) : label.replace(/^!/, '').length

      // If there's a format label, split the value up to the format length.
      // Then add it to the parsing object with appropriate label.
      if (formattingLabel) {
        parsingObject[label] = value.substr(0, formatLength)
      }

      // Update the value as the substring from format length to end.
      value = value.substr(formatLength)
    })

    // Compensate for month 0index.
    return [
        parsingObject.yyyy || parsingObject.yy,
        +(parsingObject.mm || parsingObject.m) - 1,
        parsingObject.dd || parsingObject.d
    ]
  } //DatePicker.prototype.parse


  /**
   * Various formats to display the object in.
   */
  DatePicker.prototype.formats = (function () {

    // Return the length of the first word in a collection.
    function getWordLengthFromCollection(string, collection, dateObject) {

      // Grab the first word from the string.
      var word = string.match(/\w+/)[0]

      // If there's no month index, add it to the date object
      if (!dateObject.mm && !dateObject.m) {
        dateObject.m = collection.indexOf(word) + 1
      }

      // Return the length of the word.
      return word.length
    }

    // Get the length of the first word in a string.
    function getFirstWordLength(string) {
      return string.match(/\w+/)[0].length
    }

    return {

      d: function (string, dateObject) {

        // If there's string, then get the digits length.
        // Otherwise return the selected date.
        return string ? _.digits(string) : dateObject.date
      },
      dd: function (string, dateObject) {

        // If there's a string, then the length is always 2.
        // Otherwise return the selected date with a leading zero.
        return string ? 2 : _.lead(dateObject.date)
      },
      ddd: function (string, dateObject) {

        // If there's a string, then get the length of the first word.
        // Otherwise return the short selected weekday.
        return string ? getFirstWordLength(string) : this.settings.weekdaysShort[dateObject.day]
      },
      dddd: function (string, dateObject) {

        // If there's a string, then get the length of the first word.
        // Otherwise return the full selected weekday.
        return string ? getFirstWordLength(string) : this.settings.weekdaysFull[dateObject.day]
      },
      m: function (string, dateObject) {

        // If there's a string, then get the length of the digits
        // Otherwise return the selected month with 0index compensation.
        return string ? _.digits(string) : dateObject.month + 1
      },
      mm: function (string, dateObject) {

        // If there's a string, then the length is always 2.
        // Otherwise return the selected month with 0index and leading zero.
        return string ? 2 : _.lead(dateObject.month + 1)
      },
      mmm: function (string, dateObject) {

        var collection = this.settings.monthsShort

        // If there's a string, get length of the relevant month from the short
        // months collection. Otherwise return the selected month from that collection.
        return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month]
      },
      mmmm: function (string, dateObject) {

        var collection = this.settings.monthsFull

        // If there's a string, get length of the relevant month from the full
        // months collection. Otherwise return the selected month from that collection.
        return string ? getWordLengthFromCollection(string, collection, dateObject) : collection[dateObject.month]
      },
      yy: function (string, dateObject) {

        // If there's a string, then the length is always 2.
        // Otherwise return the selected year by slicing out the first 2 digits.
        return string ? 2 : ('' + dateObject.year).slice(2)
      },
      yyyy: function (string, dateObject) {

        // If there's a string, then the length is always 4.
        // Otherwise return the selected year.
        return string ? 4 : dateObject.year
      },

      // Create an array by splitting the formatting string passed.
      toArray: function (formatString) { return formatString.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g) },

      // Format an object into a string using the formatting options.
      toString: function (formatString, itemObject) {
        var calendar = this
        return calendar.formats.toArray(formatString).map(function (label) {
          return _.trigger(calendar.formats[label], calendar, [0, itemObject]) || label.replace(/^!/, '')
        }).join('')
      }
    }
  })() //DatePicker.prototype.formats




  /**
   * Check if two date units are the exact.
   */
  DatePicker.prototype.isDateExact = function (one, two) {

    var calendar = this

    // When we’re working with weekdays, do a direct comparison.
    if (
        (_.isInteger(one) && _.isInteger(two)) ||
        (typeof one == 'boolean' && typeof two == 'boolean')
     ) {
      return one === two
    }

    // When we’re working with date representations, compare the “pick” value.
    if (
        (_.isDate(one) || $.isArray(one)) &&
        (_.isDate(two) || $.isArray(two))
    ) {
      return calendar.create(one).pick === calendar.create(two).pick
    }

    // When we’re working with range objects, compare the “from” and “to”.
    if ($.isPlainObject(one) && $.isPlainObject(two)) {
      return calendar.isDateExact(one.from, two.from) && calendar.isDateExact(one.to, two.to)
    }

    return false
  }


  /**
   * Check if two date units overlap.
   */
  DatePicker.prototype.isDateOverlap = function (one, two) {

    var calendar = this,
        firstDay = calendar.settings.firstDay ? 1 : 0

    // When we’re working with a weekday index, compare the days.
    if (_.isInteger(one) && (_.isDate(two) || $.isArray(two))) {
      one = one % 7 + firstDay
      return one === calendar.create(two).day + 1
    }
    if (_.isInteger(two) && (_.isDate(one) || $.isArray(one))) {
      two = two % 7 + firstDay
      return two === calendar.create(one).day + 1
    }

    // When we’re working with range objects, check if the ranges overlap.
    if ($.isPlainObject(one) && $.isPlainObject(two)) {
      return calendar.overlapRanges(one, two)
    }

    return false
  }


  /**
   * Flip the “enabled” state.
   */
  DatePicker.prototype.flipEnable = function (val) {
    var itemObject = this.item
    itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1)
  }


  /**
   * Mark a collection of dates as “disabled”.
   */
  DatePicker.prototype.deactivate = function (type, datesToDisable) {

    var calendar = this,
        disabledItems = calendar.item.disable.slice(0)


    // If we’re flipping, that’s all we need to do.
    if (datesToDisable == 'flip') {
      calendar.flipEnable()
    }

    else if (datesToDisable === false) {
      calendar.flipEnable(1)
      disabledItems = []
    }

    else if (datesToDisable === true) {
      calendar.flipEnable(-1)
      disabledItems = []
    }

      // Otherwise go through the dates to disable.
    else {

      datesToDisable.map(function (unitToDisable) {

        var matchFound

        // When we have disabled items, check for matches.
        // If something is matched, immediately break out.
        for (var index = 0; index < disabledItems.length; index += 1) {
          if (calendar.isDateExact(unitToDisable, disabledItems[index])) {
            matchFound = true
            break
          }
        }

        // If nothing was found, add the validated unit to the collection.
        if (!matchFound) {
          if (
              _.isInteger(unitToDisable) ||
              _.isDate(unitToDisable) ||
              $.isArray(unitToDisable) ||
              ($.isPlainObject(unitToDisable) && unitToDisable.from && unitToDisable.to)
          ) {
            disabledItems.push(unitToDisable)
          }
        }
      })
    }

    // Return the updated collection.
    return disabledItems
  } //DatePicker.prototype.deactivate


  /**
   * Mark a collection of dates as “enabled”.
   */
  DatePicker.prototype.activate = function (type, datesToEnable) {

    var calendar = this,
        disabledItems = calendar.item.disable,
        disabledItemsCount = disabledItems.length

    // If we’re flipping, that’s all we need to do.
    if (datesToEnable == 'flip') {
      calendar.flipEnable()
    }

    else if (datesToEnable === true) {
      calendar.flipEnable(1)
      disabledItems = []
    }

    else if (datesToEnable === false) {
      calendar.flipEnable(-1)
      disabledItems = []
    }

      // Otherwise go through the disabled dates.
    else {

      datesToEnable.map(function (unitToEnable) {

        var matchFound,
            disabledUnit,
            index,
            isExactRange

        // Go through the disabled items and try to find a match.
        for (index = 0; index < disabledItemsCount; index += 1) {

          disabledUnit = disabledItems[index]

          // When an exact match is found, remove it from the collection.
          if (calendar.isDateExact(disabledUnit, unitToEnable)) {
            matchFound = disabledItems[index] = null
            isExactRange = true
            break
          }

            // When an overlapped match is found, add the “inverted” state to it.
          else if (calendar.isDateOverlap(disabledUnit, unitToEnable)) {
            if ($.isPlainObject(unitToEnable)) {
              unitToEnable.inverted = true
              matchFound = unitToEnable
            }
            else if ($.isArray(unitToEnable)) {
              matchFound = unitToEnable
              if (!matchFound[3]) matchFound.push('inverted')
            }
            else if (_.isDate(unitToEnable)) {
              matchFound = [unitToEnable.getUTCFullYear(), unitToEnable.getUTCMonth(), unitToEnable.getUTCDate(), 'inverted']
            }
            break
          }
        }

        // If a match was found, remove a previous duplicate entry.
        if (matchFound) for (index = 0; index < disabledItemsCount; index += 1) {
          if (calendar.isDateExact(disabledItems[index], unitToEnable)) {
            disabledItems[index] = null
            break
          }
        }

        // In the event that we’re dealing with an exact range of dates,
        // make sure there are no “inverted” dates because of it.
        if (isExactRange) for (index = 0; index < disabledItemsCount; index += 1) {
          if (calendar.isDateOverlap(disabledItems[index], unitToEnable)) {
            disabledItems[index] = null
            break
          }
        }

        // If something is still matched, add it into the collection.
        if (matchFound) {
          disabledItems.push(matchFound)
        }
      })
    }

    // Return the updated collection.
    return disabledItems.filter(function (val) { return val != null })
  } //DatePicker.prototype.activate


  /**
   * Create a string for the nodes in the picker.
   */
  DatePicker.prototype.nodes = function (isOpen) {

    var
        calendar = this,
        settings = calendar.settings,
        calendarItem = calendar.item,
        nowObject = calendarItem.now,
        selectedObject = calendarItem.select,
        highlightedObject = calendarItem.highlight,
        viewsetObject = calendarItem.view,
        disabledCollection = calendarItem.disable,
        minLimitObject = calendarItem.min,
        maxLimitObject = calendarItem.max,


        // Create the calendar table head using a copy of weekday labels collection.
        // * We do a copy so we don't mutate the original array.
        tableHead = (function (collection, fullCollection) {

          // If the first day should be Monday, move Sunday to the end.
          if (settings.firstDay) {
            collection.push(collection.shift())
            fullCollection.push(fullCollection.shift())
          }

          // Create and return the table head group.
          return _.node(
              'thead',
              _.node(
                  'tr',
                  _.group({
                    min: 0,
                    max: DAYS_IN_WEEK - 1,
                    i: 1,
                    node: 'th',
                    item: function (counter) {
                      return [
                          collection[counter],
                          settings.klass.weekdays,
                          'scope=col title="' + fullCollection[counter] + '"'
                      ]
                    }
                  })
              )
          ) //endreturn
        })((settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysShort).slice(0), settings.weekdaysFull.slice(0)), //tableHead


        // Create the nav for next/prev month.
        createMonthNav = function (next) {

          // Otherwise, return the created month tag.
          return _.node(
              'div',
              ' ',
              settings.klass['nav' + (next ? 'Next' : 'Prev')] + (

                  // If the focused month is outside the range, disabled the button.
                  (next && viewsetObject.year >= maxLimitObject.year && viewsetObject.month >= maxLimitObject.month) ||
                  (!next && viewsetObject.year <= minLimitObject.year && viewsetObject.month <= minLimitObject.month) ?
                  ' ' + settings.klass.navDisabled : ''
              ),
              'data-nav=' + (next || -1) + ' ' +
              _.ariaAttr({
                role: 'button',
                controls: calendar.$node[0].id + '_table'
              }) + ' ' +
              'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev) + '"'
          ) //endreturn
        }, //createMonthNav


        // Create the month label.
        createMonthLabel = function () {

          var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull

          // If there are months to select, add a dropdown menu.
          if (settings.selectMonths) {

            return _.node('select',
                _.group({
                  min: 0,
                  max: 11,
                  i: 1,
                  node: 'option',
                  item: function (loopedMonth) {

                    return [

                        // The looped month and no classes.
                        monthsCollection[loopedMonth], 0,

                        // Set the value and selected index.
                        'value=' + loopedMonth +
                        (viewsetObject.month == loopedMonth ? ' selected' : '') +
                        (
                            (
                                (viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month) ||
                                (viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month)
                            ) ?
                            ' disabled' : ''
                        )
                    ]
                  }
                }),
                settings.klass.selectMonth,
                (isOpen ? '' : 'disabled') + ' ' +
                _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
                'title="' + settings.labelMonthSelect + '"'
            )
          }

          // If there's a need for a month selector
          return _.node('div', monthsCollection[viewsetObject.month], settings.klass.month)
        }, //createMonthLabel


        // Create the year label.
        createYearLabel = function () {

          var focusedYear = viewsetObject.year,

          // If years selector is set to a literal "true", set it to 5. Otherwise
          // divide in half to get half before and half after focused year.
          numberYears = settings.selectYears === true ? 5 : ~~(settings.selectYears / 2)

          // If there are years to select, add a dropdown menu.
          if (numberYears) {

            var
                minYear = minLimitObject.year,
                maxYear = maxLimitObject.year,
                lowestYear = focusedYear - numberYears,
                highestYear = focusedYear + numberYears

            // If the min year is greater than the lowest year, increase the highest year
            // by the difference and set the lowest year to the min year.
            if (minYear > lowestYear) {
              highestYear += minYear - lowestYear
              lowestYear = minYear
            }

            // If the max year is less than the highest year, decrease the lowest year
            // by the lower of the two: available and needed years. Then set the
            // highest year to the max year.
            if (maxYear < highestYear) {

              var availableYears = lowestYear - minYear,
                  neededYears = highestYear - maxYear

              lowestYear -= availableYears > neededYears ? neededYears : availableYears
              highestYear = maxYear
            }

            return _.node('select',
                _.group({
                  min: lowestYear,
                  max: highestYear,
                  i: 1,
                  node: 'option',
                  item: function (loopedYear) {
                    return [

                        // The looped year and no classes.
                        loopedYear, 0,

                        // Set the value and selected index.
                        'value=' + loopedYear + (focusedYear == loopedYear ? ' selected' : '')
                    ]
                  }
                }),
                settings.klass.selectYear,
                (isOpen ? '' : 'disabled') + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
                'title="' + settings.labelYearSelect + '"'
            )
          }

          // Otherwise just return the year focused
          return _.node('div', focusedYear, settings.klass.year)
        } //createYearLabel


    // Create and return the entire calendar.
    return _.node(
        'div',
        (settings.selectYears ? createYearLabel() + createMonthLabel() : createMonthLabel() + createYearLabel()) +
        createMonthNav() + createMonthNav(1),
        settings.klass.header
    ) + _.node(
        'table',
        tableHead +
        _.node(
            'tbody',
            _.group({
              min: 0,
              max: WEEKS_IN_CALENDAR - 1,
              i: 1,
              node: 'tr',
              item: function (rowCounter) {

                // If Monday is the first day and the month starts on Sunday, shift the date back a week.
                var shiftDateBy = settings.firstDay && calendar.create([viewsetObject.year, viewsetObject.month, 1]).day === 0 ? -7 : 0

                return [
                    _.group({
                      min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1, // Add 1 for weekday 0index
                      max: function () {
                        return this.min + DAYS_IN_WEEK - 1
                      },
                      i: 1,
                      node: 'td',
                      item: function (targetDate) {

                        // Convert the time date from a relative date to a target date.
                        targetDate = calendar.create([viewsetObject.year, viewsetObject.month, targetDate + (settings.firstDay ? 1 : 0)])

                        var isSelected = selectedObject && selectedObject.pick == targetDate.pick,
                            isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick,
                            isDisabled = disabledCollection && calendar.disabled(targetDate) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick

                        return [
                            _.node(
                                'div',
                                targetDate.date,
                                (function (klasses) {

                                  // Add the `infocus` or `outfocus` classes based on month in view.
                                  klasses.push(viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus)

                                  // Add the `today` class if needed.
                                  if (nowObject.pick == targetDate.pick) {
                                    klasses.push(settings.klass.now)
                                  }

                                  // Add the `selected` class if something's selected and the time matches.
                                  if (isSelected) {
                                    klasses.push(settings.klass.selected)
                                  }

                                  // Add the `highlighted` class if something's highlighted and the time matches.
                                  if (isHighlighted) {
                                    klasses.push(settings.klass.highlighted)
                                  }

                                  // Add the `disabled` class if something's disabled and the object matches.
                                  if (isDisabled) {
                                    klasses.push(settings.klass.disabled)
                                  }

                                  return klasses.join(' ')
                                })([settings.klass.day]),
                                'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
                                  role: 'gridcell',
                                  selected: isSelected && calendar.$node.val() === _.trigger(
                                          calendar.formats.toString,
                                          calendar,
                                          [settings.format, targetDate]
                                      ) ? true : null,
                                  activedescendant: isHighlighted ? true : null,
                                  disabled: isDisabled ? true : null
                                })
                            ),
                            '',
                            _.ariaAttr({ role: 'presentation' })
                        ] //endreturn
                      }
                    })
                ] //endreturn
              }
            })
        ),
        settings.klass.table,
        'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
          role: 'grid',
          controls: calendar.$node[0].id,
          readonly: true
        })
    ) +

    // * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
    _.node(
        'div',
        _.node('button', settings.today, settings.klass.buttonToday,
            'type=button data-pick=' + nowObject.pick +
            (isOpen && !calendar.disabled(nowObject) ? '' : ' disabled') + ' ' +
            _.ariaAttr({ controls: calendar.$node[0].id })) +
        _.node('button', settings.clear, settings.klass.buttonClear,
            'type=button data-clear=1' +
            (isOpen ? '' : ' disabled') + ' ' +
            _.ariaAttr({ controls: calendar.$node[0].id })),
        settings.klass.footer
    ) //endreturn
  } //DatePicker.prototype.nodes




  /**
   * The date picker defaults.
   */
  DatePicker.defaults = (function (prefix) {

    return {

      // The title label to use for the month nav buttons
      labelMonthNext: 'Next month',
      labelMonthPrev: 'Previous month',

      // The title label to use for the dropdown selectors
      labelMonthSelect: 'Select a month',
      labelYearSelect: 'Select a year',

      // Months and weekdays
      monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
      monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
      weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
      weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],

      // Today and clear
      today: 'Today',
      clear: 'Clear',

      // The format to show on the `input` element
      format: 'd mmmm, yyyy',

      // Classes
      klass: {

        table: prefix + 'table',

        header: prefix + 'header',

        navPrev: prefix + 'nav--prev',
        navNext: prefix + 'nav--next',
        navDisabled: prefix + 'nav--disabled',

        month: prefix + 'month',
        year: prefix + 'year',

        selectMonth: prefix + 'select--month',
        selectYear: prefix + 'select--year',

        weekdays: prefix + 'weekday',

        day: prefix + 'day',
        disabled: prefix + 'day--disabled',
        selected: prefix + 'day--selected',
        highlighted: prefix + 'day--highlighted',
        now: prefix + 'day--today',
        infocus: prefix + 'day--infocus',
        outfocus: prefix + 'day--outfocus',

        footer: prefix + 'footer',

        buttonClear: prefix + 'button--clear',
        buttonToday: prefix + 'button--today'
      }
    }
  })(Picker.klasses().picker + '__')





  /**
   * Extend the picker to add the date picker.
   */
  Picker.extend('pickadate', DatePicker)


}));


/*!
 * Time picker for pickadate.js v3.5.0
 * http://amsul.github.io/pickadate.js/time.htm
 */

(function (factory) {

  // AMD.
  if (typeof define == 'function' && define.amd)
    define(['picker', 'jquery'], factory)

    // Node.js/browserify.
  else if (typeof exports == 'object')
    module.exports = factory(require('./picker.js'), require('jquery'))

    // Browser globals.
  else factory(Picker, jQuery)

}(function (Picker, $) {


  /**
   * Globals and constants
   */
  var HOURS_IN_DAY = 24,
      MINUTES_IN_HOUR = 60,
      HOURS_TO_NOON = 12,
      MINUTES_IN_DAY = HOURS_IN_DAY * MINUTES_IN_HOUR,
      _ = Picker._



  /**
   * The time picker constructor
   */
  function TimePicker(picker, settings) {

    var clock = this,
        elementValue = picker.$node[0].value,
        elementDataValue = picker.$node.data('value'),
        valueString = elementDataValue || elementValue,
        formatString = elementDataValue ? settings.formatSubmit : settings.format

    clock.settings = settings
    clock.$node = picker.$node

    // The queue of methods that will be used to build item objects.
    clock.queue = {
      interval: 'i',
      min: 'measure create',
      max: 'measure create',
      now: 'now create',
      select: 'parse create validate',
      highlight: 'parse create validate',
      view: 'parse create validate',
      disable: 'deactivate',
      enable: 'activate'
    }

    // The component's item object.
    clock.item = {}

    clock.item.clear = null
    clock.item.interval = settings.interval || 30
    clock.item.disable = (settings.disable || []).slice(0)
    clock.item.enable = -(function (collectionDisabled) {
      return collectionDisabled[0] === true ? collectionDisabled.shift() : -1
    })(clock.item.disable)

    clock.
        set('min', settings.min).
        set('max', settings.max).
        set('now')

    // When there’s a value, set the `select`, which in turn
    // also sets the `highlight` and `view`.
    if (valueString) {
      clock.set('select', valueString, {
        format: formatString,
        fromValue: !!elementValue
      })
    }

      // If there’s no value, default to highlighting “today”.
    else {
      clock.
          set('select', null).
          set('highlight', clock.item.now)
    }

    // The keycode to movement mapping.
    clock.key = {
      40: 1, // Down
      38: -1, // Up
      39: 1, // Right
      37: -1, // Left
      go: function (timeChange) {
        clock.set(
            'highlight',
            clock.item.highlight.pick + timeChange * clock.item.interval,
            { interval: timeChange * clock.item.interval }
        )
        $('#bitV_timepicker').html(this.get('highlight', clock.settings.format));
        this.render()
      }
    }


    // Bind some picker events.
    picker.
        on('render', function () {
          var $pickerHolder = picker.$root.children(),
              $viewset = $pickerHolder.find('.' + settings.klass.viewset)
          if ($viewset.length) {
            $pickerHolder[0].scrollTop = ~~$viewset.position().top - ($viewset[0].clientHeight * 2)
          }
        }).
        on('open', function () {
          picker.$root.find('button').attr('disabled', false)
        }).
        on('close', function () {
          picker.$root.find('button').attr('disabled', true)
        })

  } //TimePicker


  /**
   * Set a timepicker item object.
   */
  TimePicker.prototype.set = function (type, value, options) {

    var clock = this,
        clockItem = clock.item

    // If the value is `null` just set it immediately.
    if (value === null) {
      if (type == 'clear') type = 'select'
      clockItem[type] = value
      return clock
    }

    // Otherwise go through the queue of methods, and invoke the functions.
    // Update this as the time unit, and set the final value as this item.
    // * In the case of `enable`, keep the queue but set `disable` instead.
    //   And in the case of `flip`, keep the queue but set `enable` instead.
    clockItem[(type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type)] = clock.queue[type].split(' ').map(function (method) {
      value = clock[method](type, value, options)
      return value
    }).pop()

    // Check if we need to cascade through more updates.
    if (type == 'select') {
      clock.set('highlight', clockItem.select, options)
    }
    else if (type == 'highlight') {
      clock.set('view', clockItem.highlight, options)
    }
    else if (type == 'interval') {
      clock.
          set('min', clockItem.min, options).
          set('max', clockItem.max, options)
    }
    else if (type.match(/^(flip|min|max|disable|enable)$/)) {
      if (type == 'min') {
        clock.set('max', clockItem.max, options)
      }
      if (clockItem.select && clock.disabled(clockItem.select)) {
        clock.set('select', clockItem.select, options)
      }
      if (clockItem.highlight && clock.disabled(clockItem.highlight)) {
        clock.set('highlight', clockItem.highlight, options)
      }
    }

    return clock
  } //TimePicker.prototype.set


  /**
   * Get a timepicker item object.
   */
  TimePicker.prototype.get = function (type) {
    return this.item[type]
  } //TimePicker.prototype.get


  /**
   * Create a picker time object.
   */
  TimePicker.prototype.create = function (type, value, options) {

    var clock = this

    // If there’s no value, use the type as the value.
    value = value === undefined ? type : value

    // If it’s a date object, convert it into an array.
    if (_.isDate(value)) {
      value = [value.getUTCHours(), value.getUTCMinutes()]
    }

    // If it’s an object, use the “pick” value.
    if ($.isPlainObject(value) && _.isInteger(value.pick)) {
      value = value.pick
    }

      // If it’s an array, convert it into minutes.
    else if ($.isArray(value)) {
      value = +value[0] * MINUTES_IN_HOUR + (+value[1])
    }

      // If no valid value is passed, set it to “now”.
    else if (!_.isInteger(value)) {
      value = clock.now(type, value, options)
    }

    // If we’re setting the max, make sure it’s greater than the min.
    if (type == 'max' && value < clock.item.min.pick) {
      value += MINUTES_IN_DAY
    }

    // If the value doesn’t fall directly on the interval,
    // add one interval to indicate it as “passed”.
    if (type != 'min' && type != 'max' && (value - clock.item.min.pick) % clock.item.interval !== 0) {
      value += clock.item.interval
    }

    // Normalize it into a “reachable” interval.
    value = clock.normalize(type, value, options)

    // Return the compiled object.
    return {

      // Divide to get hours from minutes.
      hour: ~~(HOURS_IN_DAY + value / MINUTES_IN_HOUR) % HOURS_IN_DAY,

      // The remainder is the minutes.
      mins: (MINUTES_IN_HOUR + value % MINUTES_IN_HOUR) % MINUTES_IN_HOUR,

      // The time in total minutes.
      time: (MINUTES_IN_DAY + value) % MINUTES_IN_DAY,

      // Reference to the “relative” value to pick.
      pick: value
    }
  } //TimePicker.prototype.create


  /**
   * Create a range limit object using an array, date object,
   * literal “true”, or integer relative to another time.
   */
  TimePicker.prototype.createRange = function (from, to) {

    var clock = this,
        createTime = function (time) {
          if (time === true || $.isArray(time) || _.isDate(time)) {
            return clock.create(time)
          }
          return time
        }

    // Create objects if possible.
    if (!_.isInteger(from)) {
      from = createTime(from)
    }
    if (!_.isInteger(to)) {
      to = createTime(to)
    }

    // Create relative times.
    if (_.isInteger(from) && $.isPlainObject(to)) {
      from = [to.hour, to.mins + (from * clock.settings.interval)];
    }
    else if (_.isInteger(to) && $.isPlainObject(from)) {
      to = [from.hour, from.mins + (to * clock.settings.interval)];
    }

    return {
      from: createTime(from),
      to: createTime(to)
    }
  } //TimePicker.prototype.createRange


  /**
   * Check if a time unit falls within a time range object.
   */
  TimePicker.prototype.withinRange = function (range, timeUnit) {
    range = this.createRange(range.from, range.to)
    return timeUnit.pick >= range.from.pick && timeUnit.pick <= range.to.pick
  }


  /**
   * Check if two time range objects overlap.
   */
  TimePicker.prototype.overlapRanges = function (one, two) {

    var clock = this

    // Convert the ranges into comparable times.
    one = clock.createRange(one.from, one.to)
    two = clock.createRange(two.from, two.to)

    return clock.withinRange(one, two.from) || clock.withinRange(one, two.to) ||
        clock.withinRange(two, one.from) || clock.withinRange(two, one.to)
  }


  /**
   * Get the time relative to now.
   */
  TimePicker.prototype.now = function (type, value/*, options*/) {

    var interval = this.item.interval,
        date = new Date(),
        nowMinutes = date.getUTCHours() * MINUTES_IN_HOUR + date.getUTCMinutes(),
        isValueInteger = _.isInteger(value),
        isBelowInterval

    // Make sure “now” falls within the interval range.
    nowMinutes -= nowMinutes % interval

    // Check if the difference is less than the interval itself.
    isBelowInterval = value < 0 && interval * value + nowMinutes <= -interval

    // Add an interval because the time has “passed”.
    nowMinutes += type == 'min' && isBelowInterval ? 0 : interval

    // If the value is a number, adjust by that many intervals.
    if (isValueInteger) {
      nowMinutes += interval * (
          isBelowInterval && type != 'max' ?
              value + 1 :
              value
          )
    }

    // Return the final calculation.
    return nowMinutes
  } //TimePicker.prototype.now


  /**
   * Normalize minutes to be “reachable” based on the min and interval.
   */
  TimePicker.prototype.normalize = function (type, value/*, options*/) {

    var interval = this.item.interval,
        minTime = this.item.min && this.item.min.pick || 0

    // If setting min time, don’t shift anything.
    // Otherwise get the value and min difference and then
    // normalize the difference with the interval.
    value -= type == 'min' ? 0 : (value - minTime) % interval

    // Return the adjusted value.
    return value
  } //TimePicker.prototype.normalize


  /**
   * Measure the range of minutes.
   */
  TimePicker.prototype.measure = function (type, value, options) {

    var clock = this

    // If it’s anything false-y, set it to the default.
    if (!value) {
      value = type == 'min' ? [0, 0] : [HOURS_IN_DAY - 1, MINUTES_IN_HOUR - 1]
    }

      // If it’s a literal true, or an integer, make it relative to now.
    else if (value === true || _.isInteger(value)) {
      value = clock.now(type, value, options)
    }

      // If it’s an object already, just normalize it.
    else if ($.isPlainObject(value) && _.isInteger(value.pick)) {
      value = clock.normalize(type, value.pick, options)
    }

    return value
  } ///TimePicker.prototype.measure


  /**
   * Validate an object as enabled.
   */
  TimePicker.prototype.validate = function (type, timeObject, options) {

    var clock = this,
        interval = options && options.interval ? options.interval : clock.item.interval

    // Check if the object is disabled.
    if (clock.disabled(timeObject)) {

      // Shift with the interval until we reach an enabled time.
      timeObject = clock.shift(timeObject, interval)
    }

    // Scope the object into range.
    timeObject = clock.scope(timeObject)

    // Do a second check to see if we landed on a disabled min/max.
    // In that case, shift using the opposite interval as before.
    if (clock.disabled(timeObject)) {
      timeObject = clock.shift(timeObject, interval * -1)
    }

    // Return the final object.
    return timeObject
  } //TimePicker.prototype.validate


  /**
   * Check if an object is disabled.
   */
  TimePicker.prototype.disabled = function (timeToVerify) {

    var clock = this,

        // Filter through the disabled times to check if this is one.
        isDisabledMatch = clock.item.disable.filter(function (timeToDisable) {

          // If the time is a number, match the hours.
          if (_.isInteger(timeToDisable)) {
            return timeToVerify.hour == timeToDisable
          }

          // If it’s an array, create the object and match the times.
          if ($.isArray(timeToDisable) || _.isDate(timeToDisable)) {
            return timeToVerify.pick == clock.create(timeToDisable).pick
          }

          // If it’s an object, match a time within the “from” and “to” range.
          if ($.isPlainObject(timeToDisable)) {
            return clock.withinRange(timeToDisable, timeToVerify)
          }
        })

    // If this time matches a disabled time, confirm it’s not inverted.
    isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function (timeToDisable) {
      return $.isArray(timeToDisable) && timeToDisable[2] == 'inverted' ||
          $.isPlainObject(timeToDisable) && timeToDisable.inverted
    }).length

    // If the clock is "enabled" flag is flipped, flip the condition.
    return clock.item.enable === -1 ? !isDisabledMatch : isDisabledMatch ||
        timeToVerify.pick < clock.item.min.pick ||
        timeToVerify.pick > clock.item.max.pick
  } //TimePicker.prototype.disabled


  /**
   * Shift an object by an interval until we reach an enabled object.
   */
  TimePicker.prototype.shift = function (timeObject, interval) {

    var clock = this,
        minLimit = clock.item.min.pick,
        maxLimit = clock.item.max.pick/*,
        safety = 1000*/

    interval = interval || clock.item.interval

    // Keep looping as long as the time is disabled.
    while ( /*safety &&*/ clock.disabled(timeObject)) {

      /*safety -= 1
      if ( !safety ) {
          throw 'Fell into an infinite loop while shifting to ' + timeObject.hour + ':' + timeObject.mins + '.'
      }*/

      // Increase/decrease the time by the interval and keep looping.
      timeObject = clock.create(timeObject.pick += interval)

      // If we've looped beyond the limits, break out of the loop.
      if (timeObject.pick <= minLimit || timeObject.pick >= maxLimit) {
        break
      }
    }

    // Return the final object.
    return timeObject
  } //TimePicker.prototype.shift


  /**
   * Scope an object to be within range of min and max.
   */
  TimePicker.prototype.scope = function (timeObject) {
    var minLimit = this.item.min.pick,
        maxLimit = this.item.max.pick
    return this.create(timeObject.pick > maxLimit ? maxLimit : timeObject.pick < minLimit ? minLimit : timeObject)
  } //TimePicker.prototype.scope


  /**
   * Parse a string into a usable type.
   */
  TimePicker.prototype.parse = function (type, value, options) {

    var hour, minutes, isPM, item, parseValue,
        clock = this,
        parsingObject = {}

    // If it’s already parsed, we’re good.
    if (!value || typeof value != 'string') {
      return value
    }

    // We need a `.format` to parse the value with.
    if (!(options && options.format)) {
      options = options || {}
      options.format = clock.settings.format
    }

    // Convert the format into an array and then map through it.
    clock.formats.toArray(options.format).map(function (label) {

      var
          substring,

          // Grab the formatting label.
          formattingLabel = clock.formats[label],

          // The format length is from the formatting label function or the
          // label length without the escaping exclamation (!) mark.
          formatLength = formattingLabel ?
              _.trigger(formattingLabel, clock, [value, parsingObject]) :
              label.replace(/^!/, '').length

      // If there's a format label, split the value up to the format length.
      // Then add it to the parsing object with appropriate label.
      if (formattingLabel) {
        substring = value.substr(0, formatLength)
        parsingObject[label] = substring.match(/^\d+$/) ? +substring : substring
      }

      // Update the time value as the substring from format length to end.
      value = value.substr(formatLength)
    })

    // Grab the hour and minutes from the parsing object.
    for (item in parsingObject) {
      parseValue = parsingObject[item]
      if (_.isInteger(parseValue)) {
        if (item.match(/^(h|hh)$/i)) {
          hour = parseValue
          if (item == 'h' || item == 'hh') {
            hour %= 12
          }
        }
        else if (item == 'i') {
          minutes = parseValue
        }
      }
      else if (item.match(/^a$/i) && parseValue.match(/^p/i) && ('h' in parsingObject || 'hh' in parsingObject)) {
        isPM = true
      }
    }

    // Calculate it in minutes and return.
    return (isPM ? hour + 12 : hour) * MINUTES_IN_HOUR + minutes
  } //TimePicker.prototype.parse


  /**
   * Various formats to display the object in.
   */
  TimePicker.prototype.formats = {

    h: function (string, timeObject) {

      // If there's string, then get the digits length.
      // Otherwise return the selected hour in "standard" format.
      return string ? _.digits(string) : timeObject.hour % HOURS_TO_NOON || HOURS_TO_NOON
    },
    hh: function (string, timeObject) {

      // If there's a string, then the length is always 2.
      // Otherwise return the selected hour in "standard" format with a leading zero.
      return string ? 2 : _.lead(timeObject.hour % HOURS_TO_NOON || HOURS_TO_NOON)
    },
    H: function (string, timeObject) {

      // If there's string, then get the digits length.
      // Otherwise return the selected hour in "military" format as a string.
      return string ? _.digits(string) : '' + (timeObject.hour % 24)
    },
    HH: function (string, timeObject) {

      // If there's string, then get the digits length.
      // Otherwise return the selected hour in "military" format with a leading zero.
      return string ? _.digits(string) : _.lead(timeObject.hour % 24)
    },
    i: function (string, timeObject) {

      // If there's a string, then the length is always 2.
      // Otherwise return the selected minutes.
      return string ? 2 : _.lead(timeObject.mins)
    },
    a: function (string, timeObject) {

      // If there's a string, then the length is always 4.
      // Otherwise check if it's more than "noon" and return either am/pm.
      return string ? 4 : MINUTES_IN_DAY / 2 > timeObject.time % MINUTES_IN_DAY ? 'a.m.' : 'p.m.'
    },
    A: function (string, timeObject) {

      // If there's a string, then the length is always 2.
      // Otherwise check if it's more than "noon" and return either am/pm.
      return string ? 2 : MINUTES_IN_DAY / 2 > timeObject.time % MINUTES_IN_DAY ? 'AM' : 'PM'
    },

    // Create an array by splitting the formatting string passed.
    toArray: function (formatString) { return formatString.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g) },

    // Format an object into a string using the formatting options.
    toString: function (formatString, itemObject) {
      var clock = this
      return clock.formats.toArray(formatString).map(function (label) {
        return _.trigger(clock.formats[label], clock, [0, itemObject]) || label.replace(/^!/, '')
      }).join('')
    }
  } //TimePicker.prototype.formats




  /**
   * Check if two time units are the exact.
   */
  TimePicker.prototype.isTimeExact = function (one, two) {

    var clock = this

    // When we’re working with minutes, do a direct comparison.
    if (
        (_.isInteger(one) && _.isInteger(two)) ||
        (typeof one == 'boolean' && typeof two == 'boolean')
     ) {
      return one === two
    }

    // When we’re working with time representations, compare the “pick” value.
    if (
        (_.isDate(one) || $.isArray(one)) &&
        (_.isDate(two) || $.isArray(two))
    ) {
      return clock.create(one).pick === clock.create(two).pick
    }

    // When we’re working with range objects, compare the “from” and “to”.
    if ($.isPlainObject(one) && $.isPlainObject(two)) {
      return clock.isTimeExact(one.from, two.from) && clock.isTimeExact(one.to, two.to)
    }

    return false
  }


  /**
   * Check if two time units overlap.
   */
  TimePicker.prototype.isTimeOverlap = function (one, two) {

    var clock = this

    // When we’re working with an integer, compare the hours.
    if (_.isInteger(one) && (_.isDate(two) || $.isArray(two))) {
      return one === clock.create(two).hour
    }
    if (_.isInteger(two) && (_.isDate(one) || $.isArray(one))) {
      return two === clock.create(one).hour
    }

    // When we’re working with range objects, check if the ranges overlap.
    if ($.isPlainObject(one) && $.isPlainObject(two)) {
      return clock.overlapRanges(one, two)
    }

    return false
  }


  /**
   * Flip the “enabled” state.
   */
  TimePicker.prototype.flipEnable = function (val) {
    var itemObject = this.item
    itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1)
  }


  /**
   * Mark a collection of times as “disabled”.
   */
  TimePicker.prototype.deactivate = function (type, timesToDisable) {

    var clock = this,
        disabledItems = clock.item.disable.slice(0)


    // If we’re flipping, that’s all we need to do.
    if (timesToDisable == 'flip') {
      clock.flipEnable()
    }

    else if (timesToDisable === false) {
      clock.flipEnable(1)
      disabledItems = []
    }

    else if (timesToDisable === true) {
      clock.flipEnable(-1)
      disabledItems = []
    }

      // Otherwise go through the times to disable.
    else {

      timesToDisable.map(function (unitToDisable) {

        var matchFound

        // When we have disabled items, check for matches.
        // If something is matched, immediately break out.
        for (var index = 0; index < disabledItems.length; index += 1) {
          if (clock.isTimeExact(unitToDisable, disabledItems[index])) {
            matchFound = true
            break
          }
        }

        // If nothing was found, add the validated unit to the collection.
        if (!matchFound) {
          if (
              _.isInteger(unitToDisable) ||
              _.isDate(unitToDisable) ||
              $.isArray(unitToDisable) ||
              ($.isPlainObject(unitToDisable) && unitToDisable.from && unitToDisable.to)
          ) {
            disabledItems.push(unitToDisable)
          }
        }
      })
    }

    // Return the updated collection.
    return disabledItems
  } //TimePicker.prototype.deactivate


  /**
   * Mark a collection of times as “enabled”.
   */
  TimePicker.prototype.activate = function (type, timesToEnable) {

    var clock = this,
        disabledItems = clock.item.disable,
        disabledItemsCount = disabledItems.length

    // If we’re flipping, that’s all we need to do.
    if (timesToEnable == 'flip') {
      clock.flipEnable()
    }

    else if (timesToEnable === true) {
      clock.flipEnable(1)
      disabledItems = []
    }

    else if (timesToEnable === false) {
      clock.flipEnable(-1)
      disabledItems = []
    }

      // Otherwise go through the disabled times.
    else {

      timesToEnable.map(function (unitToEnable) {

        var matchFound,
            disabledUnit,
            index,
            isRangeMatched

        // Go through the disabled items and try to find a match.
        for (index = 0; index < disabledItemsCount; index += 1) {

          disabledUnit = disabledItems[index]

          // When an exact match is found, remove it from the collection.
          if (clock.isTimeExact(disabledUnit, unitToEnable)) {
            matchFound = disabledItems[index] = null
            isRangeMatched = true
            break
          }

            // When an overlapped match is found, add the “inverted” state to it.
          else if (clock.isTimeOverlap(disabledUnit, unitToEnable)) {
            if ($.isPlainObject(unitToEnable)) {
              unitToEnable.inverted = true
              matchFound = unitToEnable
            }
            else if ($.isArray(unitToEnable)) {
              matchFound = unitToEnable
              if (!matchFound[2]) matchFound.push('inverted')
            }
            else if (_.isDate(unitToEnable)) {
              matchFound = [unitToEnable.getUTCFullYear(), unitToEnable.getUTCMonth(), unitToEnable.getUTCDate(), 'inverted']
            }
            break
          }
        }

        // If a match was found, remove a previous duplicate entry.
        if (matchFound) for (index = 0; index < disabledItemsCount; index += 1) {
          if (clock.isTimeExact(disabledItems[index], unitToEnable)) {
            disabledItems[index] = null
            break
          }
        }

        // In the event that we’re dealing with an overlap of range times,
        // make sure there are no “inverted” times because of it.
        if (isRangeMatched) for (index = 0; index < disabledItemsCount; index += 1) {
          if (clock.isTimeOverlap(disabledItems[index], unitToEnable)) {
            disabledItems[index] = null
            break
          }
        }

        // If something is still matched, add it into the collection.
        if (matchFound) {
          disabledItems.push(matchFound)
        }
      })
    }

    // Return the updated collection.
    return disabledItems.filter(function (val) { return val != null })
  } //TimePicker.prototype.activate


  /**
   * The division to use for the range intervals.
   */
  TimePicker.prototype.i = function (type, value/*, options*/) {
    return _.isInteger(value) && value > 0 ? value : this.item.interval
  }


  /**
   * Create a string for the nodes in the picker.
   */
  TimePicker.prototype.nodes = function (isOpen) {

    var
        clock = this,
        settings = clock.settings,
        selectedObject = clock.item.select,
        highlightedObject = clock.item.highlight,
        viewsetObject = clock.item.view,
        disabledCollection = clock.item.disable

    return _.node(
        'ul',
        _.group({
          min: clock.item.min.pick,
          max: clock.item.max.pick,
          i: clock.item.interval,
          node: 'li',
          item: function (loopedTime) {
            loopedTime = clock.create(loopedTime)
            var timeMinutes = loopedTime.pick,
                isSelected = selectedObject && selectedObject.pick == timeMinutes,
                isHighlighted = highlightedObject && highlightedObject.pick == timeMinutes,
                isDisabled = disabledCollection && clock.disabled(loopedTime)
            return [
                _.trigger(clock.formats.toString, clock, [_.trigger(settings.formatLabel, clock, [loopedTime]) || settings.format, loopedTime]),
                (function (klasses) {

                  if (isSelected) {
                    klasses.push(settings.klass.selected)
                  }

                  if (isHighlighted) {
                    klasses.push(settings.klass.highlighted)
                  }

                  if (viewsetObject && viewsetObject.pick == timeMinutes) {
                    klasses.push(settings.klass.viewset)
                  }

                  if (isDisabled) {
                    klasses.push(settings.klass.disabled)
                  }

                  return klasses.join(' ')
                })([settings.klass.listItem]),
                'data-pick=' + loopedTime.pick + ' ' + _.ariaAttr({
                  role: 'option',
                  selected: isSelected && clock.$node.val() === _.trigger(
                          clock.formats.toString,
                          clock,
                          [settings.format, loopedTime]
                      ) ? true : null,
                  activedescendant: isHighlighted ? true : null,
                  disabled: isDisabled ? true : null
                })
            ]
          }
        }) +

        // * For Firefox forms to submit, make sure to set the button’s `type` attribute as “button”.
        _.node(
            'li',
            _.node(
                'button',
                settings.clear,
                settings.klass.buttonClear,
                'type=button data-clear=1' + (isOpen ? '' : ' disabled') + ' ' +
                _.ariaAttr({ controls: clock.$node[0].id })
            ),
            '', _.ariaAttr({ role: 'presentation' })
        ),
        settings.klass.list,
        _.ariaAttr({ role: 'listbox', controls: clock.$node[0].id })
    )
  } //TimePicker.prototype.nodes







  /* ==========================================================================
     Extend the picker to add the component with the defaults.
     ========================================================================== */

  TimePicker.defaults = (function (prefix) {

    return {

      // Clear
      clear: 'Clear',

      // The format to show on the `input` element
      format: 'h:i A',

      // The interval between each time
      interval: 30,

      // Classes
      klass: {

        picker: prefix + ' ' + prefix + '--time',
        holder: prefix + '__holder',

        list: prefix + '__list',
        listItem: prefix + '__list-item',

        disabled: prefix + '__list-item--disabled',
        selected: prefix + '__list-item--selected',
        highlighted: prefix + '__list-item--highlighted',
        viewset: prefix + '__list-item--viewset',
        now: prefix + '__list-item--now',

        buttonClear: prefix + '__button--clear'
      }
    }
  })(Picker.klasses().picker)





  /**
   * Extend the picker to add the time picker.
   */
  Picker.extend('pickatime', TimePicker)


}));







;
// Chosen, a Select Box Enhancer for jQuery and Prototype
// by Patrick Filler for Harvest, http://getharvest.com
//
// Version 1.0.0
// Full source at https://github.com/harvesthq/chosen
// Copyright (c) 2011 Harvest http://getharvest.com

// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md

// this file is patched and should not be updated! (original file see chosen.orig.js)

(function() {
  var $, AbstractChosen, Chosen, SelectParser, _ref,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  SelectParser = (function() {
    function SelectParser() {
      this.options_index = 0;
      this.parsed = [];
    }

    SelectParser.prototype.add_node = function(child) {
      if (child.nodeName.toUpperCase() === "OPTGROUP") {
        return this.add_group(child);
      } else {
        return this.add_option(child);
      }
    };

    SelectParser.prototype.add_group = function(group) {
      var group_position, option, _i, _len, _ref, _results;

      group_position = this.parsed.length;
      this.parsed.push({
        array_index: group_position,
        group: true,
        label: this.escapeExpression(group.label),
        children: 0,
        disabled: group.disabled
      });
      _ref = group.childNodes;
      _results = [];
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        option = _ref[_i];
        _results.push(this.add_option(option, group_position, group.disabled));
      }
      return _results;
    };

    SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
      if (option.nodeName.toUpperCase() === "OPTION") {
        if (option.text !== "") {
          if (group_position != null) {
            this.parsed[group_position].children += 1;
          }

          var text = "";
          if ($(option).find('.displayname').text().length) {
            text = $(option).find('.displayname').text();
          } else {
            text = option.text;
          }
          this.parsed.push({
            array_index: this.parsed.length,
            options_index: this.options_index,
            value: option.value,
            text: text,
            html: option.innerHTML,
            selected: option.selected,
            disabled: group_disabled === true ? group_disabled : option.disabled,
            group_array_index: group_position,
            classes: option.className,
            style: option.style.cssText
          });
        } else {
          this.parsed.push({
            array_index: this.parsed.length,
            options_index: this.options_index,
            empty: true
          });
        }
        return this.options_index += 1;
      }
    };

    SelectParser.prototype.escapeExpression = function(text) {
      var map, unsafe_chars;

      if ((text == null) || text === false) {
        return "";
      }
      if (!/[\&\<\>\"\'\`]/.test(text)) {
        return text;
      }
      map = {
        "<": "&lt;",
        ">": "&gt;",
        '"': "&quot;",
        "'": "&#x27;",
        "`": "&#x60;"
      };
      unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
      return text.replace(unsafe_chars, function(chr) {
        return map[chr] || "&amp;";
      });
    };

    return SelectParser;

  })();

  SelectParser.select_to_array = function(select) {
    var child, parser, _i, _len, _ref;

    parser = new SelectParser();
    _ref = select.childNodes;
    for (_i = 0, _len = _ref.length; _i < _len; _i++) {
      child = _ref[_i];
      parser.add_node(child);
    }
    return parser.parsed;
  };

  AbstractChosen = (function() {
    function AbstractChosen(form_field, options) {
      this.form_field = form_field;
      this.options = options != null ? options : {};
      if (!AbstractChosen.browser_is_supported()) {
        return;
      }
      this.is_multiple = this.form_field.multiple;
      this.set_default_text();
      this.set_default_values();
      this.setup();
      this.set_up_html();
      this.register_observers();
    }

    AbstractChosen.prototype.set_default_values = function() {
      var _this = this;

      this.click_test_action = function(evt) {
        return _this.test_active_click(evt);
      };
      this.activate_action = function(evt) {
        return _this.activate_field(evt);
      };
      this.active_field = false;
      this.mouse_on_container = false;
      this.results_showing = false;
      this.result_highlighted = null;
      this.result_single_selected = null;
      this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
      this.disable_search_threshold = this.options.disable_search_threshold || 0;
      this.disable_search = this.options.disable_search || false;
      this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
      this.group_search = this.options.group_search != null ? this.options.group_search : true;
      this.search_contains = this.options.search_contains || false;
      this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
      this.max_selected_options = this.options.max_selected_options || Infinity;
      this.inherit_select_classes = this.options.inherit_select_classes || false;
      this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
      return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
    };

    AbstractChosen.prototype.set_default_text = function() {
      if (this.form_field.getAttribute("data-placeholder")) {
        this.default_text = this.form_field.getAttribute("data-placeholder");
      } else if (this.is_multiple) {
        this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
      } else {
        this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
      }
      return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
    };

    AbstractChosen.prototype.mouse_enter = function() {
      return this.mouse_on_container = true;
    };

    AbstractChosen.prototype.mouse_leave = function() {
      return this.mouse_on_container = false;
    };

    AbstractChosen.prototype.input_focus = function(evt) {
      var _this = this;

     // if (this.is_multiple) {
        if (!this.active_field) {
          return setTimeout((function() {
            return _this.container_mousedown(evt);
          }), 50);
        }
      // } else {
      //   if (!this.active_field) {
      //     return this.activate_field();
      //   }
      // }
    };

    AbstractChosen.prototype.input_blur = function(evt) {
      var _this = this;

      if (!this.mouse_on_container) {
        this.active_field = false;
        return setTimeout((function() {
          return _this.blur_test();
        }), 100);
      }
    };

    AbstractChosen.prototype.results_option_build = function(options) {
      var content, data, _i, _len, _ref;

      content = '';
      _ref = this.results_data;
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        data = _ref[_i];
        if (data.group) {
          content += this.result_add_group(data);
        } else {
          content += this.result_add_option(data);
        }
        if (options != null ? options.first : void 0) {
          if (data.selected && this.is_multiple) {
            this.choice_build(data);
          } else if (data.selected && !this.is_multiple) {
            this.single_set_selected_html(data.html);
          }
        }
      }
      return content;
    };

    AbstractChosen.prototype.result_add_option = function(option) {
      var classes, style;

      if (!option.search_match) {
        return '';
      }
      if (!this.include_option_in_results(option)) {
        return '';
      }
      classes = [];
      if (!option.disabled && !(option.selected && this.is_multiple)) {
        classes.push("active-result");
      }
      if (option.disabled && !(option.selected && this.is_multiple)) {
        classes.push("disabled-result");
      }
      if (option.selected) {
        classes.push("result-selected");
      }
      if (option.group_array_index != null) {
        classes.push("group-option");
      }
      if (option.classes !== "") {
        classes.push(option.classes);
      }
      style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
      return "<li class=\"" + (classes.join(' ')) + "\"" + style + " data-option-array-index=\"" + option.array_index + "\">" + option.search_text + "</li>";
    };

    AbstractChosen.prototype.result_add_group = function(group) {
      if (!(group.search_match || group.group_match)) {
        return '';
      }
      if (!(group.active_options > 0)) {
        return '';
      }
      return "<li class=\"group-result\">" + group.search_text + "</li>";
    };

    AbstractChosen.prototype.results_update_field = function() {
      this.set_default_text();
      if (!this.is_multiple) {
        this.results_reset_cleanup();
      }
      this.result_clear_highlight();
      this.result_single_selected = null;
      this.results_build();
      if (this.results_showing) {
        return this.winnow_results();
      }
    };

    AbstractChosen.prototype.results_toggle = function() {
      if (this.results_showing) {
        return this.results_hide();
      } else {
        return this.results_show();
      }
    };

    AbstractChosen.prototype.results_search = function(evt) {
      if (this.results_showing) {
        this.winnow_results();

        // call custom autocompleter functions
        return this.customAutocomplete();
      } else {
        return this.results_show();
      }
    };

    // method to overwrite for custom autocompletion stuff
    AbstractChosen.prototype.customAutocomplete = function() { };

    AbstractChosen.prototype.winnow_results = function() {
      var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;

      //this.no_results_clear();
      results = 0;
      searchText = this.get_search_text();
      escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
      regexAnchor = this.search_contains ? "" : "^";
      regex = new RegExp(regexAnchor + escapedSearchText, 'i');
      zregex = new RegExp(escapedSearchText, 'i');
      _ref = this.results_data;
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        option = _ref[_i];
        option.search_match = false;
        results_group = null;
        if (this.include_option_in_results(option)) {
          if (option.group) {
            option.group_match = false;
            option.active_options = 0;
          }
          if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
            results_group = this.results_data[option.group_array_index];
            if (results_group.active_options === 0 && results_group.search_match) {
              results += 1;
            }
            results_group.active_options += 1;
          }
          if (!(option.group && !this.group_search)) {
            option.search_text = option.group ? option.label : option.html;
            option.search_match = true; // always return all values // this.search_string_match(option.search_text, regex);
            if (option.search_match && !option.group) {
              results += 1;
            }
            if (option.search_match) {
              if (searchText.length) {
                /* highlighting not here anymore
                option.search_text = option.search_text.replace(new RegExp('(' + searchText + ')', 'gi'), '<em>$1</em>');
                */
              }
              if (results_group != null) {
                results_group.group_match = true;
              }
            } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
              option.search_match = true;
            }
          }
        }
      }
      this.result_clear_highlight();
      if (results < 1 && searchText.length) {

        // if error message with link was shown, save it
        var search_no_results = this.container.find('li.no-results').first();
        this.update_results_content((search_no_results.text().indexOf(VVO.I18N.translate('searchinprogress')) > -1) ? '' : search_no_results);

        // don't output messages anymore
        // return this.no_results(searchText);
      } else {
        this.update_results_content(this.results_option_build());
        return this.winnow_results_set_highlight();
      }
    };

    AbstractChosen.prototype.search_string_match = function(search_string, regex) {
      var part, parts, _i, _len;

      if (regex.test(search_string)) {
        return true;
      } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
        parts = search_string.replace(/\[|\]/g, "").split(" ");
        if (parts.length) {
          for (_i = 0, _len = parts.length; _i < _len; _i++) {
            part = parts[_i];
            if (regex.test(part)) {
              return true;
            }
          }
        }
      }
    };

    AbstractChosen.prototype.choices_count = function() {
      var option, _i, _len, _ref;

      if (this.selected_option_count != null) {
        return this.selected_option_count;
      }
      this.selected_option_count = 0;
      _ref = this.form_field.options;
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        option = _ref[_i];
        if (option.selected) {
          this.selected_option_count += 1;
        }
      }
      return this.selected_option_count;
    };

    AbstractChosen.prototype.choices_click = function(evt) {
      evt.preventDefault();
      if (!(this.results_showing || this.is_disabled)) {
        return this.results_show();
      }
    };

    AbstractChosen.prototype.keyup_checker = function(evt) {
      var stroke, _ref;

      stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
      this.search_field_scale();
      switch (stroke) {
        case 8:
          if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
            return this.keydown_backstroke();
          } else if (!this.pending_backstroke) {
            this.result_clear_highlight();
            return this.results_search();
          }
          break;
        case 13:
          evt.preventDefault();
          if (this.results_showing) {
            return this.result_select(evt);
          }
          break;
        case 27:
          if (this.results_showing) {
            this.results_hide();
          }
          return true;
        case 9:
        case 38:
        case 40:
        case 16:
        case 91:
        case 17:
          break;
        default:
          return this.results_search();
      }
    };

    AbstractChosen.prototype.container_width = function() {
      if (this.options.width != null) {
        return this.options.width;
      } else {
        return "" + this.form_field.offsetWidth + "px";
      }
    };

    AbstractChosen.prototype.include_option_in_results = function(option) {
      if (this.is_multiple && (!this.display_selected_options && option.selected)) {
        return false;
      }
      if (!this.display_disabled_options && option.disabled) {
        return false;
      }
      if (option.empty) {
        return false;
      }
      return true;
    };

    AbstractChosen.browser_is_supported = function() {
      if (window.navigator.appName === "Microsoft Internet Explorer") {
        return document.documentMode >= 8;
      }
      // if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
      //   return false;
      // }
      // if (/Android/i.test(window.navigator.userAgent)) {
      //   if (/Mobile/i.test(window.navigator.userAgent)) {
      //     return false;
      //   }
      // }
      return true;
    };

    AbstractChosen.default_multiple_text = "Select Some Options";

    AbstractChosen.default_single_text = "Select an Option";

    AbstractChosen.default_no_result_text = "No results match";

    return AbstractChosen;

  })();

  $ = jQuery;

  $.fn.extend({
    chosen: function(options) {
      if (!AbstractChosen.browser_is_supported()) {
        return this;
      }
      return this.each(function(input_field) {
        var $this, chosen;

        $this = $(this);
        chosen = $this.data('chosen');
        if (options === 'destroy' && chosen) {
          chosen.destroy();
        } else if (!chosen) {
          $this.data('chosen', new Chosen(this, options));
        }
      });
    }
  });

  Chosen = (function(_super) {
    __extends(Chosen, _super);

    function Chosen() {
      _ref = Chosen.__super__.constructor.apply(this, arguments);
      return _ref;
    }

    Chosen.prototype.setup = function() {
      this.form_field_jq = $(this.form_field);
      this.current_selectedIndex = this.form_field.selectedIndex;
      return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
    };

    Chosen.prototype.set_up_html = function() {
      var container_classes, container_props;

      container_classes = ["chosen-container"];
      container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
      if (this.inherit_select_classes && this.form_field.className) {
        container_classes.push(this.form_field.className);
      }
      if (this.is_rtl) {
        container_classes.push("chosen-rtl");
      }
      container_props = {
        'class': container_classes.join(' '),
        'style': "width: " + (this.container_width()) + ";",
        'title': this.form_field.title
      };
      if (this.form_field.id.length) {
        container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
      }
      //set content of chosen, add bitV_chosen class --> can't be hidden, because it is not read by nvda anymore. So set position to somewhere not on display.
      this.container = $("<div />", container_props);
      if (this.is_multiple) {
        this.container.html('<ul class="chosen-choices"><li class="search-field"><input class="locationsearch" aria-hidden="true" type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /><a class="hidden delete-entry" href="#" role="button" tabindex="-1" title="' + VVO.I18N.translate('del') + '">' + VVO.I18N.translate('del') + '<span class="icon-font ico-close"></span></a><div class="bitV_chosen" style="position:absolute; top:-900px;"></div></li></ul><div class="chosen-drop" aria-live="polite"><ul class="chosen-results"></ul></div>');
      } else {
        this.container.html('<a class="chosen-single chosen-default"><span>' + this.default_text + '</span></a><div class="chosen-drop" aria-live="polite"><div class="chosen-search"><input class="locationsearch" aria-hidden="true" type="text" autocomplete="off" aria-label="' + VVO.I18N.translate('search') + '" /><a class="hidden delete-entry" href="#" role="button" tabindex="-1" title="' + VVO.I18N.translate('del') + '">' + VVO.I18N.translate('del') + '<span class="icon-font ico-close"></span></a><div class="bitV_chosen" style="position:absolute; top:-900px;"></div></div><ul class="chosen-results" tabindex="-1" ></ul></div>');
      }
      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();
      if (this.is_multiple) {
        this.search_choices = this.container.find('ul.chosen-choices').first();
        this.search_container = this.container.find('li.search-field').first();
      } else {
        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();
      return this.form_field_jq.trigger("chosen:ready", {
        chosen: this
      });
    };

    Chosen.prototype.register_observers = function() {
      var _this = this;
      //fix IE 8 focus problem by setting timeout
      var ua = window.navigator.userAgent;
      var msie = ua.indexOf("MSIE ");
      if (msie > 0 && parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) == 8 ) {     // If Internet Explorer 8
        this.container.bind('mousedown.chosen', function(evt) {
          setTimeout((function() {
            _this.container_mousedown(evt);
          }), 10);
         });
      }
      else {
        this.container.bind('mousedown.chosen', function(evt) {
               _this.container_mousedown(evt);
           });
      };
      // this.container.bind('mousedown.chosen', function(evt) {
      //   _this.container_mousedown(evt);
      // });
      this.container.bind('mouseup.chosen', function(evt) {
        _this.container_mouseup(evt);
      });
      this.container.bind('mouseenter.chosen', function(evt) {
        _this.mouse_enter(evt);
      });
      this.container.bind('mouseleave.chosen', function(evt) {
        if(!$(evt.relatedTarget).hasClass("delete-entry"))
          _this.mouse_leave(evt);
      });
      this.search_results.bind('mouseup.chosen:not(span.icon-font.ico-close)', function(evt) {
        if (!$(evt.target).is('span.icon-font.ico-close')) {
          _this.search_results_mouseup(evt);
        }
      });
      this.search_results.bind('mouseover.chosen', function(evt) {
        _this.search_results_mouseover(evt);
      });
      this.search_results.bind('mouseout.chosen', function(evt) {
        _this.search_results_mouseout(evt);
      });
      this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
        _this.search_results_mousewheel(evt);
      });
      this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
        _this.results_update_field(evt);
      });
      this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
        _this.activate_field(evt);
      });
      this.form_field_jq.bind("chosen:open.chosen", function(evt) {
        _this.container_mousedown(evt);
      });
      this.search_field.bind('blur.chosen', function(evt) {
        _this.input_blur(evt);
      });
      this.search_field.bind('keyup.chosen', function(evt) {
        _this.keyup_checker(evt);
      });
      this.search_field.bind('keydown.chosen', function(evt) {
        _this.keydown_checker(evt);
      });
      this.search_field.bind('focus.chosen', function(evt) {
        _this.input_focus(evt);
      });
      if (this.is_multiple) {
        return this.search_choices.bind('click.chosen', function(evt) {
          _this.choices_click(evt);
        });
      } else {
        return this.container.bind('click.chosen', function(evt) {
          evt.preventDefault();
        });
      }
    };

    Chosen.prototype.destroy = function() {
      $(document).unbind("click.chosen", this.click_test_action);
      if (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');
      return this.form_field_jq.show();
    };

    Chosen.prototype.search_field_disabled = function() {
      this.is_disabled = this.form_field_jq[0].disabled;
      if (this.is_disabled) {
        this.container.addClass('chosen-disabled');
        this.search_field[0].disabled = true;
        if (!this.is_multiple) {
          this.selected_item.unbind("focus.chosen", this.activate_action);
        }
        return this.close_field();
      } else {
        this.container.removeClass('chosen-disabled');
        this.search_field[0].disabled = false;
        if (!this.is_multiple) {
          return this.selected_item.bind("focus.chosen", this.activate_action);
        }
      }
    };

    Chosen.prototype.container_mousedown = function(evt) {

      //trigger change event for advanced options in tr
      if($('#tr').length)
      {
        $('.advanced-options').change();
      }

      if (!this.is_disabled) {
        if (evt && evt.type === "mousedown" && !this.results_showing) {
          //fix ie 8 problem with event.preventDefault
          var ua = window.navigator.userAgent;
          var msie = ua.indexOf("MSIE ");
          if (msie > 0) {     // If Internet Explorer 8
            if(parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) != 8)
            {
              evt.preventDefault();
            }
          } else
            evt.preventDefault();
        }
        if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
          if (!this.active_field) {
            if (this.is_multiple) {
              this.search_field.val("");
            }
            $(document).bind('click.chosen', this.click_test_action);
            this.results_show();
          } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
            //fix ie 8 problem with event.preventDefault
             var ua = window.navigator.userAgent;
              var msie = ua.indexOf("MSIE ");
              if (msie > 0) {     // If Internet Explorer 8
                if(parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) != 8)
                {
                  evt.preventDefault();
                }
              } else {
                evt.preventDefault();
              }
            this.results_toggle();
          }
          return this.activate_field();
        }
      }
    };

    Chosen.prototype.container_mouseup = function(evt) {
      if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
        return this.results_reset(evt);
      }
    };

    Chosen.prototype.search_results_mousewheel = function(evt) {
      var delta, _ref1, _ref2;

      delta = -((_ref1 = evt.originalEvent) != null ? _ref1.wheelDelta : void 0) || ((_ref2 = evt.originialEvent) != null ? _ref2.detail : void 0);
      if (delta != null) {
        evt.preventDefault();
        if (evt.type === 'DOMMouseScroll') {
          delta = delta * 40;
        }
        return this.search_results.scrollTop(delta + this.search_results.scrollTop());
      }
    };

    Chosen.prototype.blur_test = function(evt) {
      if (!this.active_field && this.container.hasClass("chosen-container-active")) {
        return this.close_field();
      }
    };

    Chosen.prototype.close_field = function() {
      $(document).unbind("click.chosen", this.click_test_action);
      this.active_field = false;
      this.results_hide();
      if (/*this.current_selectedIndex === 0 && !*/$(this.form_field).val()==='') {
        var container = this.container.find('a.chosen-single img');
        container.remove();
      }
      this.container.removeClass("chosen-container-active");
      this.clear_backstroke();
      this.show_search_field_default();
      return this.search_field_scale();
    };

    Chosen.prototype.activate_field = function() {
      this.container.addClass("chosen-container-active");
      this.active_field = true;
      this.search_field.val(this.search_field.val());
      return this.search_field.focus();
    };

    Chosen.prototype.test_active_click = function(evt) {
      if (this.container.is($(evt.target).closest('.chosen-container'))) {
        return this.active_field = true;
      } else {
        return this.close_field();
      }
    };

    Chosen.prototype.results_build = function() {
      this.parsing = true;
      this.selected_option_count = null;
      this.results_data = SelectParser.select_to_array(this.form_field);
      if (this.is_multiple) {
        this.search_choices.find("li.search-choice").remove();
      } else if (!this.is_multiple) {
        this.single_set_selected_text();
        if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
          this.search_field[0].readOnly = true;
          this.container.addClass("chosen-container-single-nosearch");
        } else {
          this.search_field[0].readOnly = false;
          this.container.removeClass("chosen-container-single-nosearch");
        }
      }
      this.update_results_content(this.results_option_build({
        first: true
      }));
      this.search_field_disabled();
      this.show_search_field_default();
      this.search_field_scale();
      return this.parsing = false;
    };

    Chosen.prototype.result_do_highlight = function(el) {
      var high_bottom, high_top, maxHeight, visible_bottom, visible_top;

      if (el.length) {
        this.result_clear_highlight();
        this.result_highlight = el;
        this.result_highlight.addClass("highlighted");
        var img = this.result_highlight.find('img');
        if(img.length && img.data('hoversrc')) {
          img.attr('src', img.data('hoversrc'));
        }

        maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
        visible_top = this.search_results.scrollTop();
        visible_bottom = maxHeight + visible_top;
        high_top = this.result_highlight.position().top + this.search_results.scrollTop();
        high_bottom = high_top + this.result_highlight.outerHeight();
        //set text into div for bitV
        // el.closest('.chosen-drop').find('.bitV_chosen').attr('role', 'alert');
        el.closest('.chosen-drop').find('.bitV_chosen').html(el.html());
        if (high_bottom >= visible_bottom) {
          return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
        } else if (high_top < visible_top) {
          return this.search_results.scrollTop(high_top);
        }
      }
    };

    Chosen.prototype.result_clear_highlight = function() {
      if (this.result_highlight) {

        var img = this.result_highlight.find('img');
        if(img.length && img.data('src')) {
          img.attr('src', img.data('src'));
        }

        this.result_highlight.removeClass("highlighted");
      }
      return this.result_highlight = null;
    };

    Chosen.prototype.results_show = function(withoutFocus) {
      // hide map/ favorites if list is expanded
      if($('.switch_content').length) {
        $('.switch_content').hide()
      }

      if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
        this.form_field_jq.trigger("chosen:maxselected", {
          chosen: this
        });
        return false;
      }
      this.container.addClass("chosen-with-drop");
      this.form_field_jq.trigger("chosen:showing_dropdown", {
        chosen: this
      });
      this.results_showing = true;

      //just focus, if not already
      if(withoutFocus!="true"){
        this.search_field.focus();
      }
      this.search_field.val($(this.form_field).find('option:selected').find('.displayname').text().trim());
      this.winnow_results();

      // call custom autocompleter functions
      this.customAutocomplete(true);

      // if input field is empty, show history list
      if(!this.search_field.val().length) {
        this.search_field.trigger('keyup');
      }
    };

    Chosen.prototype.update_results_content = function(content) {
      return this.search_results.html(content);
    };

    Chosen.prototype.results_hide = function() {
      if (this.results_showing) {
        this.result_clear_highlight();
        this.container.removeClass("chosen-with-drop");
        this.form_field_jq.trigger("chosen:hiding_dropdown", {
          chosen: this
        });
      }
      return this.results_showing = false;
    };

    Chosen.prototype.set_tab_index = function(el) {
      var ti;

      if (this.form_field.tabIndex) {
        ti = this.form_field.tabIndex;
        this.form_field.tabIndex = -1;
        return this.search_field[0].tabIndex = ti;
      }
    };

    Chosen.prototype.set_label_behavior = function() {
      var _this = this;

      this.form_field_label = this.form_field_jq.parents("label");
      if (!this.form_field_label.length && this.form_field.id.length) {
        this.form_field_label = $("label[for='" + this.form_field.id + "']");
      }
      if (this.form_field_label.length > 0) {
        return this.form_field_label.bind('click.chosen', function(evt) {
          if (_this.is_multiple) {
            return _this.container_mousedown(evt);
          } else {
            return _this.activate_field();
          }
        });
      }
    };

    Chosen.prototype.show_search_field_default = function() {
      if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
        this.search_field.val(this.default_text);
        return this.search_field.addClass("default");
      } else {
        // disable user input deletion
        //this.search_field.val("");
        return this.search_field.removeClass("default");
      }
    };

    Chosen.prototype.search_results_mouseup = function(evt) {
      var target;

      target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
      if (target.length) {
        this.result_highlight = target;
        this.result_select(evt);
        return this.search_field.focus();
      }
    };

    Chosen.prototype.search_results_mouseover = function(evt) {
      var target;

      target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
      if (target) {
        return this.result_do_highlight(target);
      }
    };

    Chosen.prototype.search_results_mouseout = function(evt) {
      if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
        return this.result_clear_highlight();
      }
    };

    Chosen.prototype.choice_build = function(item) {
      var choice, close_link,
        _this = this;

      choice = $('<li />', {
        "class": "search-choice"
      }).html("<span>" + item.html + "</span>");
      if (item.disabled) {
        choice.addClass('search-choice-disabled');
      } else {
        close_link = $('<a />', {
          "class": 'search-choice-close',
          'data-option-array-index': item.array_index
        });
        close_link.bind('click.chosen', function(evt) {
          return _this.choice_destroy_link_click(evt);
        });
        choice.append(close_link);
      }
      return this.search_container.before(choice);
    };

    Chosen.prototype.choice_destroy_link_click = function(evt) {
      evt.preventDefault();
      evt.stopPropagation();
      if (!this.is_disabled) {
        return this.choice_destroy($(evt.target));
      }
    };

    Chosen.prototype.choice_destroy = function(link) {
      if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
        this.show_search_field_default();
        if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
          this.results_hide();
        }
        link.parents('li').first().remove();
        return this.search_field_scale();
      }
    };

    Chosen.prototype.results_reset = function() {
      this.form_field.options[0].selected = true;
      this.selected_option_count = null;
      this.single_set_selected_text();
      this.show_search_field_default();
      this.results_reset_cleanup();
      this.form_field_jq.trigger("change");
      if (this.active_field) {
        return this.results_hide();
      }
    };

    Chosen.prototype.results_reset_cleanup = function() {
      this.current_selectedIndex = this.form_field.selectedIndex;
      return this.selected_item.find("abbr").remove();
    };

    Chosen.prototype.result_select = function(evt) {
      var high, item, selected_index;

      if (this.result_highlight) {
        high = this.result_highlight;
        this.result_clear_highlight();
        if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
          this.form_field_jq.trigger("chosen:maxselected", {
            chosen: this
          });
          return false;
        }
        if (this.is_multiple) {
          high.removeClass("active-result");
        } else {
          if (this.result_single_selected) {
            this.result_single_selected.removeClass("result-selected");
            selected_index = this.result_single_selected[0].getAttribute('data-option-array-index');
            this.results_data[selected_index].selected = false;
          }
          this.result_single_selected = high;
        }
        high.addClass("result-selected");
        item = this.results_data[high[0].getAttribute("data-option-array-index")];
        item.selected = true;

        // add data object of selected item to select element (used for getting coordinates in map)
        this.form_field_jq.find('option').each(function() {
          if($(this).val() === item.value) {
            $(this).closest('select').data('point', $(this).data('point'));
            $(this).closest('select').data('pointstring', $(this).data('pointstring'));
          }
        });

        this.form_field.options[item.options_index].selected = true;
        this.selected_option_count = null;
        if (this.is_multiple) {
          this.choice_build(item);
        } else {
          this.single_set_selected_html(item.html);
        }
        if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
          this.results_hide();
        }

        // set selected item as input text
        this.search_field.val(item.text);

        if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
          this.form_field_jq.trigger("change", {
            'selected': this.form_field.options[item.options_index].value
          });
        }
        this.current_selectedIndex = this.form_field.selectedIndex;

        // trigger element selected event for instant search
        this.form_field_jq.trigger('chosen:elementselected');

        return this.search_field_scale();
      }
    };

    Chosen.prototype.single_set_selected_text = function(text) {
      if (text == null) {
        text = this.default_text;
      }
      if (text === this.default_text) {
        this.selected_item.addClass("chosen-default");
      } else {
        this.single_deselect_control_build();
        this.selected_item.removeClass("chosen-default");
      }
      return this.selected_item.find("span").first().text(text);
    };

    Chosen.prototype.single_set_selected_html = function (html) {
      var container = this.container.find('a.chosen-single');

      if ($('<div></div>').html(html).text() !== html) {

        var pointString = $(html).find('span.displayname').data('pointstring');
        var point = VVO.PointHelper.toPoint(pointString);
        var favPointList = VVO.AutocompleteFavorite.getList('');
        var cleanPointString = pointString;

        if (point && point.ShortCuts !== '') {
          cleanPointString = pointString.replace(point.ShortCuts, '');
        }

        //check if point is fav
        if (favPointList.indexOf(cleanPointString) === -1) {
          VVO.Favourites.toggleFavIcon($(this.container).closest('.chosen-container'), false);
        } else {
          VVO.Favourites.toggleFavIcon($(this.container).closest('.chosen-container'), true);
        }

      }
      //set html and remove fav button if necessary
      container.addClass('chosen-default').empty().append(html);
      container.find('a').remove();
    };

    Chosen.prototype.result_deselect = function (pos) {
      var result_data;

      result_data = this.results_data[pos];
      if (!this.form_field.options[result_data.options_index].disabled) {
        result_data.selected = false;
        this.form_field.options[result_data.options_index].selected = false;
        this.selected_option_count = null;
        this.result_clear_highlight();
        if (this.results_showing) {
          this.winnow_results();

          // call custom autocompleter functions
          this.customAutocomplete();
        }
        this.form_field_jq.trigger("change", {
          deselected: this.form_field.options[result_data.options_index].value
        });
        this.search_field_scale();
        return true;
      } else {
        return false;
      }
    };

    Chosen.prototype.single_deselect_control_build = function() {
      if (!this.allow_single_deselect) {
        return;
      }
      if (!this.selected_item.find("abbr").length) {
        this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
      }
      return this.selected_item.addClass("chosen-single-with-deselect");
    };

    Chosen.prototype.get_search_text = function() {
      if (this.search_field.val() === this.default_text) {
        return "";
      } else {
        return $('<div/>').text($.trim(this.search_field.val())).html();
      }
    };

    Chosen.prototype.winnow_results_set_highlight = function() {
      var do_high, selected_results;

      selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
      do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
      if (do_high != null) {
        return this.result_do_highlight(do_high);
      }
    };

    /* not needed anymore
    Chosen.prototype.no_results = function(terms) {
      var no_results_html;

      no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
      no_results_html.find("span").first().html(terms);
      return this.search_results.append(no_results_html);
    };

    Chosen.prototype.no_results_clear = function() {
      return this.search_results.find(".no-results").remove();
    };*/

    Chosen.prototype.keydown_arrow = function() {
      var next_sib;

      if (this.results_showing && this.result_highlight) {
        next_sib = this.result_highlight.nextAll("li.active-result").first();
        if (next_sib) {
          return this.result_do_highlight(next_sib);
        }
      } else {
        return this.results_show();
      }
    };

    Chosen.prototype.keyup_arrow = function() {
      var prev_sibs;

      if (!this.results_showing && !this.is_multiple) {
        return this.results_show();
      } else if (this.result_highlight) {
        prev_sibs = this.result_highlight.prevAll("li.active-result");
        if (prev_sibs.length) {
          return this.result_do_highlight(prev_sibs.first());
        } else {
          if (this.choices_count() > 0) {
            this.results_hide();
          }
          return this.result_clear_highlight();
        }
      }
    };

    Chosen.prototype.keydown_backstroke = function() {
      var next_available_destroy;

      if (this.pending_backstroke) {
        this.choice_destroy(this.pending_backstroke.find("a").first());
        return this.clear_backstroke();
      } else {
        next_available_destroy = this.search_container.siblings("li.search-choice").last();
        if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
          this.pending_backstroke = next_available_destroy;
          if (this.single_backstroke_delete) {
            return this.keydown_backstroke();
          } else {
            return this.pending_backstroke.addClass("search-choice-focus");
          }
        }
      }
    };

    Chosen.prototype.clear_backstroke = function() {
      if (this.pending_backstroke) {
        this.pending_backstroke.removeClass("search-choice-focus");
      }
      return this.pending_backstroke = null;
    };

    Chosen.prototype.keydown_checker = function(evt) {
      var stroke, _ref1;

      stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
      this.search_field_scale();
      if (stroke !== 8 && this.pending_backstroke) {
        this.clear_backstroke();
      }
      switch (stroke) {
        case 8:
          this.backstroke_length = this.search_field.val().length;
          break;
        case 9:
          if (this.results_showing && !this.is_multiple) {
            //this.result_select(evt);
          }
          this.mouse_on_container = false;
          break;
        case 13:
          evt.preventDefault();
          break;
        case 38:
          evt.preventDefault();
          this.keyup_arrow();
          break;
        case 40:
          evt.preventDefault();
          this.keydown_arrow();
          break;
      }
    };

    Chosen.prototype.search_field_scale = function() {
      var div, f_width, h, style, style_block, styles, w, _i, _len;

      if (this.is_multiple) {
        h = 0;
        w = 0;
        style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
        styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
        for (_i = 0, _len = styles.length; _i < _len; _i++) {
          style = styles[_i];
          style_block += style + ":" + this.search_field.css(style) + ";";
        }
        div = $('<div />', {
          'style': style_block
        });
        div.text(this.search_field.val());
        $('body').append(div);
        w = div.width() + 25;
        div.remove();
        f_width = this.container.outerWidth();
        if (w > f_width - 10) {
          w = f_width - 10;
        }
        return this.search_field.css({
          'width': w + 'px'
        });
      }
    };

    return Chosen;

  })(AbstractChosen);

}).call(this);
;
/*
 * Adds missing IE8 features
 */
(function(fn){
    // .map     
    if (!fn.map) { 
      fn.map=function(f){
        var r=[];
        for(var i=0;i<this.length;i++) {
          r.push(f(this[i]));
        }
        return r;
      }
    }
    
    // .filter
    if (!fn.filter) {
      fn.filter=function(f){
        var r=[];
        for(var i=0;i<this.length;i++) {
          if(f(this[i])) {
            r.push(this[i]);
          }
        }
        return r;
      }
    }
    
    // .indexOf
    if (!fn.indexOf) {
      fn.indexOf=function(f){
        var len = this.length >>> 0;

        var from = Number(arguments[1]) || 0;
        from = (from < 0)
             ? Math.ceil(from)
             : Math.floor(from);
        if (from < 0)
          from += len;

        for (; from < len; from++)
        {
          if (from in this && this[from] === f) {
            return from;
          }
        }
        return -1;
      }
    }    
})(Array.prototype);

;
(function(e,t){"use strict";var n=e.History=e.History||{},r=e.jQuery;if(typeof n.Adapter!="undefined")throw new Error("History.js Adapter has already been loaded...");n.Adapter={bind:function(e,t,n){r(e).bind(t,n)},trigger:function(e,t,n){r(e).trigger(t,n)},extractEventData:function(e,n,r){var i=n&&n.originalEvent&&n.originalEvent[e]||r&&r[e]||t;return i},onDomLoad:function(e){r(e)}},typeof n.init!="undefined"&&n.init()})(window);
(function ($) {
    $.deserialize = function (str, options) {
        var pairs = str.split(/&amp;|&/i),
            h = {},
            options = options || {};
        for(var i = 0; i < pairs.length; i++) {
            var kv = pairs[i].split('=');
            kv[0] = decodeURIComponent(kv[0]);
            if(!options.except || options.except.indexOf(kv[0]) == -1) {
                if((/^\w+\[\w+\]$/).test(kv[0])) {
                    var matches = kv[0].match(/^(\w+)\[(\w+)\]$/);
                    if(typeof h[matches[1]] === 'undefined') {
                        h[matches[1]] = {};
                    }
                    h[matches[1]][matches[2]] = decodeURIComponent(kv[1]);
                } else {
                  if (h[kv[0]]) {
                    h[kv[0]] = h[kv[0]] + ","+ decodeURIComponent(kv[1]);
                  } else 
                  h[kv[0]] = decodeURIComponent(kv[1]);
                }
            }
        }
        return h;
    };

    $.fn.deserialize = function (options) {
        return $.deserialize($(this).serialize(), options);
    };
})(jQuery);

;
/*! rangeslider.js - v2.3.0 | (c) 2016 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use strict";function b(){var a=document.createElement("input");return a.setAttribute("type","range"),"text"!==a.type}function c(a,b){var c=Array.prototype.slice.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)}function d(a,b){return b=b||100,function(){if(!a.debouncing){var c=Array.prototype.slice.apply(arguments);a.lastReturnVal=a.apply(window,c),a.debouncing=!0}return clearTimeout(a.debounceTimeout),a.debounceTimeout=setTimeout(function(){a.debouncing=!1},b),a.lastReturnVal}}function e(a){return a&&(0===a.offsetWidth||0===a.offsetHeight||a.open===!1)}function f(a){for(var b=[],c=a.parentNode;e(c);)b.push(c),c=c.parentNode;return b}function g(a,b){function c(a){"undefined"!=typeof a.open&&(a.open=!a.open)}var d=f(a),e=d.length,g=[],h=a[b];if(e){for(var i=0;i<e;i++)g[i]=d[i].style.cssText,d[i].style.setProperty?d[i].style.setProperty("display","block","important"):d[i].style.cssText+=";display: block !important",d[i].style.height="0",d[i].style.overflow="hidden",d[i].style.visibility="hidden",c(d[i]);h=a[b];for(var j=0;j<e;j++)d[j].style.cssText=g[j],c(d[j])}return h}function h(a,b){var c=parseFloat(a);return Number.isNaN(c)?b:c}function i(a){return a.charAt(0).toUpperCase()+a.substr(1)}function j(b,e){if(this.$window=a(window),this.$document=a(document),this.$element=a(b),this.options=a.extend({},n,e),this.polyfill=this.options.polyfill,this.orientation=this.$element[0].getAttribute("data-orientation")||this.options.orientation,this.onInit=this.options.onInit,this.onSlide=this.options.onSlide,this.onSlideEnd=this.options.onSlideEnd,this.DIMENSION=o.orientation[this.orientation].dimension,this.DIRECTION=o.orientation[this.orientation].direction,this.DIRECTION_STYLE=o.orientation[this.orientation].directionStyle,this.COORDINATE=o.orientation[this.orientation].coordinate,this.polyfill&&m)return!1;this.identifier="js-"+k+"-"+l++,this.startEvent=this.options.startEvent.join("."+this.identifier+" ")+"."+this.identifier,this.moveEvent=this.options.moveEvent.join("."+this.identifier+" ")+"."+this.identifier,this.endEvent=this.options.endEvent.join("."+this.identifier+" ")+"."+this.identifier,this.toFixed=(this.step+"").replace(".","").length-1,this.$fill=a('<div class="'+this.options.fillClass+'" />'),this.$handle=a('<div class="'+this.options.handleClass+'" />'),this.$range=a('<div class="'+this.options.rangeClass+" "+this.options[this.orientation+"Class"]+'" id="'+this.identifier+'" />').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=a.proxy(this.handleDown,this),this.handleMove=a.proxy(this.handleMove,this),this.handleEnd=a.proxy(this.handleEnd,this),this.init();var f=this;this.$window.on("resize."+this.identifier,d(function(){c(function(){f.update(!1,!1)},300)},20)),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+this.identifier,function(a,b){if(!b||b.origin!==f.identifier){var c=a.target.value,d=f.getPositionFromValue(c);f.setPosition(d)}})}Number.isNaN=Number.isNaN||function(a){return"number"==typeof a&&a!==a};var k="rangeslider",l=0,m=b(),n={polyfill:!0,orientation:"horizontal",rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",activeClass:"rangeslider--active",horizontalClass:"rangeslider--horizontal",verticalClass:"rangeslider--vertical",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]},o={orientation:{horizontal:{dimension:"width",direction:"left",directionStyle:"left",coordinate:"x"},vertical:{dimension:"height",direction:"top",directionStyle:"bottom",coordinate:"y"}}};return j.prototype.init=function(){this.update(!0,!1),this.onInit&&"function"==typeof this.onInit&&this.onInit()},j.prototype.update=function(a,b){a=a||!1,a&&(this.min=h(this.$element[0].getAttribute("min"),0),this.max=h(this.$element[0].getAttribute("max"),100),this.value=h(this.$element[0].value,Math.round(this.min+(this.max-this.min)/2)),this.step=h(this.$element[0].getAttribute("step"),1)),this.handleDimension=g(this.$handle[0],"offset"+i(this.DIMENSION)),this.rangeDimension=g(this.$range[0],"offset"+i(this.DIMENSION)),this.maxHandlePos=this.rangeDimension-this.handleDimension,this.grabPos=this.handleDimension/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position,b)},j.prototype.handleDown=function(a){if(a.preventDefault(),this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),this.$range.addClass(this.options.activeClass),!((" "+a.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass)>-1)){var b=this.getRelativePosition(a),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=this.getPositionFromNode(this.$handle[0])-c,e="vertical"===this.orientation?this.maxHandlePos-(b-this.grabPos):b-this.grabPos;this.setPosition(e),b>=d&&b<d+this.handleDimension&&(this.grabPos=b-d)}},j.prototype.handleMove=function(a){a.preventDefault();var b=this.getRelativePosition(a),c="vertical"===this.orientation?this.maxHandlePos-(b-this.grabPos):b-this.grabPos;this.setPosition(c)},j.prototype.handleEnd=function(a){a.preventDefault(),this.$document.off(this.moveEvent,this.handleMove),this.$document.off(this.endEvent,this.handleEnd),this.$range.removeClass(this.options.activeClass),this.$element.trigger("change",{origin:this.identifier}),this.onSlideEnd&&"function"==typeof this.onSlideEnd&&this.onSlideEnd(this.position,this.value)},j.prototype.cap=function(a,b,c){return a<b?b:a>c?c:a},j.prototype.setPosition=function(a,b){var c,d;void 0===b&&(b=!0),c=this.getValueFromPosition(this.cap(a,0,this.maxHandlePos)),d=this.getPositionFromValue(c),this.$fill[0].style[this.DIMENSION]=d+this.grabPos+"px",this.$handle[0].style[this.DIRECTION_STYLE]=d+"px",this.setValue(c),this.position=d,this.value=c,b&&this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(d,c)},j.prototype.getPositionFromNode=function(a){for(var b=0;null!==a;)b+=a.offsetLeft,a=a.offsetParent;return b},j.prototype.getRelativePosition=function(a){var b=i(this.COORDINATE),c=this.$range[0].getBoundingClientRect()[this.DIRECTION],d=0;return"undefined"!=typeof a.originalEvent["client"+b]?d=a.originalEvent["client"+b]:a.originalEvent.touches&&a.originalEvent.touches[0]&&"undefined"!=typeof a.originalEvent.touches[0]["client"+b]?d=a.originalEvent.touches[0]["client"+b]:a.currentPoint&&"undefined"!=typeof a.currentPoint[this.COORDINATE]&&(d=a.currentPoint[this.COORDINATE]),d-c},j.prototype.getPositionFromValue=function(a){var b,c;return b=(a-this.min)/(this.max-this.min),c=Number.isNaN(b)?0:b*this.maxHandlePos},j.prototype.getValueFromPosition=function(a){var b,c;return b=a/(this.maxHandlePos||1),c=this.step*Math.round(b*(this.max-this.min)/this.step)+this.min,Number(c.toFixed(this.toFixed))},j.prototype.setValue=function(a){a===this.value&&""!==this.$element[0].value||this.$element.val(a).trigger("input",{origin:this.identifier})},j.prototype.destroy=function(){this.$document.off("."+this.identifier),this.$window.off("."+this.identifier),this.$element.off("."+this.identifier).removeAttr("style").removeData("plugin_"+k),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0])},a.fn[k]=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),e=d.data("plugin_"+k);e||d.data("plugin_"+k,e=new j(this,b)),"string"==typeof b&&e[b].apply(e,c)})},"rangeslider.js is available in jQuery context e.g $(selector).rangeslider(options);"});;
/*!
 * Vue.js v2.6.12
 * (c) 2014-2020 Evan You
 * Released under the MIT License.
 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vue=t()}(this,function(){"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i<r.length;i++)n[r[i]]=!0;return t?function(e){return n[e.toLowerCase()]}:function(e){return n[e]}}var d=p("slot,component",!0),v=p("key,ref,slot,slot-scope,is");function h(e,t){if(e.length){var n=e.indexOf(t);if(n>-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function k(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function A(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n<e.length;n++)e[n]&&A(t,e[n]);return t}function S(e,t,n){}var T=function(e,t,n){return!1},E=function(e){return e};function N(e,t){if(e===t)return!0;var n=o(e),r=o(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var i=Array.isArray(e),a=Array.isArray(t);if(i&&a)return e.length===t.length&&e.every(function(e,n){return N(e,t[n])});if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(i||a)return!1;var s=Object.keys(e),c=Object.keys(t);return s.length===c.length&&s.every(function(n){return N(e[n],t[n])})}catch(e){return!1}}function j(e,t){for(var n=0;n<e.length;n++)if(N(e[n],t))return n;return-1}function D(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}}var L="data-server-rendered",M=["component","directive","filter"],I=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch"],F={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:T,isReservedAttr:T,isUnknownElement:T,getTagNamespace:S,parsePlatformTagName:E,mustUseProp:T,async:!0,_lifecycleHooks:I},P=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function R(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}var H=new RegExp("[^"+P.source+".$_\\d]");var B,U="__proto__"in{},z="undefined"!=typeof window,V="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,K=V&&WXEnvironment.platform.toLowerCase(),J=z&&window.navigator.userAgent.toLowerCase(),q=J&&/msie|trident/.test(J),W=J&&J.indexOf("msie 9.0")>0,Z=J&&J.indexOf("edge/")>0,G=(J&&J.indexOf("android"),J&&/iphone|ipad|ipod|ios/.test(J)||"ios"===K),X=(J&&/chrome\/\d+/.test(J),J&&/phantomjs/.test(J),J&&J.match(/firefox\/(\d+)/)),Y={}.watch,Q=!1;if(z)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){Q=!0}}),window.addEventListener("test-passive",null,ee)}catch(e){}var te=function(){return void 0===B&&(B=!z&&!V&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),B},ne=z&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function re(e){return"function"==typeof e&&/native code/.test(e.toString())}var ie,oe="undefined"!=typeof Symbol&&re(Symbol)&&"undefined"!=typeof Reflect&&re(Reflect.ownKeys);ie="undefined"!=typeof Set&&re(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ae=S,se=0,ce=function(){this.id=se++,this.subs=[]};ce.prototype.addSub=function(e){this.subs.push(e)},ce.prototype.removeSub=function(e){h(this.subs,e)},ce.prototype.depend=function(){ce.target&&ce.target.addDep(this)},ce.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t<n;t++)e[t].update()},ce.target=null;var ue=[];function le(e){ue.push(e),ce.target=e}function fe(){ue.pop(),ce.target=ue[ue.length-1]}var pe=function(e,t,n,r,i,o,a,s){this.tag=e,this.data=t,this.children=n,this.text=r,this.elm=i,this.ns=void 0,this.context=o,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=t&&t.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1},de={child:{configurable:!0}};de.child.get=function(){return this.componentInstance},Object.defineProperties(pe.prototype,de);var ve=function(e){void 0===e&&(e="");var t=new pe;return t.text=e,t.isComment=!0,t};function he(e){return new pe(void 0,void 0,void 0,String(e))}function me(e){var t=new pe(e.tag,e.data,e.children&&e.children.slice(),e.text,e.elm,e.context,e.componentOptions,e.asyncFactory);return t.ns=e.ns,t.isStatic=e.isStatic,t.key=e.key,t.isComment=e.isComment,t.fnContext=e.fnContext,t.fnOptions=e.fnOptions,t.fnScopeId=e.fnScopeId,t.asyncMeta=e.asyncMeta,t.isCloned=!0,t}var ye=Array.prototype,ge=Object.create(ye);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(e){var t=ye[e];R(ge,e,function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];var i,o=t.apply(this,n),a=this.__ob__;switch(e){case"push":case"unshift":i=n;break;case"splice":i=n.slice(2)}return i&&a.observeArray(i),a.dep.notify(),o})});var _e=Object.getOwnPropertyNames(ge),be=!0;function $e(e){be=e}var we=function(e){var t;this.value=e,this.dep=new ce,this.vmCount=0,R(e,"__ob__",this),Array.isArray(e)?(U?(t=ge,e.__proto__=t):function(e,t,n){for(var r=0,i=n.length;r<i;r++){var o=n[r];R(e,o,t[o])}}(e,ge,_e),this.observeArray(e)):this.walk(e)};function Ce(e,t){var n;if(o(e)&&!(e instanceof pe))return y(e,"__ob__")&&e.__ob__ instanceof we?n=e.__ob__:be&&!te()&&(Array.isArray(e)||s(e))&&Object.isExtensible(e)&&!e._isVue&&(n=new we(e)),t&&n&&n.vmCount++,n}function xe(e,t,n,r,i){var o=new ce,a=Object.getOwnPropertyDescriptor(e,t);if(!a||!1!==a.configurable){var s=a&&a.get,c=a&&a.set;s&&!c||2!==arguments.length||(n=e[t]);var u=!i&&Ce(n);Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var t=s?s.call(e):n;return ce.target&&(o.depend(),u&&(u.dep.depend(),Array.isArray(t)&&function e(t){for(var n=void 0,r=0,i=t.length;r<i;r++)(n=t[r])&&n.__ob__&&n.__ob__.dep.depend(),Array.isArray(n)&&e(n)}(t))),t},set:function(t){var r=s?s.call(e):n;t===r||t!=t&&r!=r||s&&!c||(c?c.call(e,t):n=t,u=!i&&Ce(t),o.notify())}})}}function ke(e,t,n){if(Array.isArray(e)&&c(t))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(t in e&&!(t in Object.prototype))return e[t]=n,n;var r=e.__ob__;return e._isVue||r&&r.vmCount?n:r?(xe(r.value,t,n),r.dep.notify(),n):(e[t]=n,n)}function Ae(e,t){if(Array.isArray(e)&&c(t))e.splice(t,1);else{var n=e.__ob__;e._isVue||n&&n.vmCount||y(e,t)&&(delete e[t],n&&n.dep.notify())}}we.prototype.walk=function(e){for(var t=Object.keys(e),n=0;n<t.length;n++)xe(e,t[n])},we.prototype.observeArray=function(e){for(var t=0,n=e.length;t<n;t++)Ce(e[t])};var Oe=F.optionMergeStrategies;function Se(e,t){if(!t)return e;for(var n,r,i,o=oe?Reflect.ownKeys(t):Object.keys(t),a=0;a<o.length;a++)"__ob__"!==(n=o[a])&&(r=e[n],i=t[n],y(e,n)?r!==i&&s(r)&&s(i)&&Se(r,i):ke(e,n,i));return e}function Te(e,t,n){return n?function(){var r="function"==typeof t?t.call(n,n):t,i="function"==typeof e?e.call(n,n):e;return r?Se(r,i):i}:t?e?function(){return Se("function"==typeof t?t.call(this,this):t,"function"==typeof e?e.call(this,this):e)}:t:e}function Ee(e,t){var n=t?e?e.concat(t):Array.isArray(t)?t:[t]:e;return n?function(e){for(var t=[],n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t}(n):n}function Ne(e,t,n,r){var i=Object.create(e||null);return t?A(i,t):i}Oe.data=function(e,t,n){return n?Te(e,t,n):t&&"function"!=typeof t?e:Te(e,t)},I.forEach(function(e){Oe[e]=Ee}),M.forEach(function(e){Oe[e+"s"]=Ne}),Oe.watch=function(e,t,n,r){if(e===Y&&(e=void 0),t===Y&&(t=void 0),!t)return Object.create(e||null);if(!e)return t;var i={};for(var o in A(i,e),t){var a=i[o],s=t[o];a&&!Array.isArray(a)&&(a=[a]),i[o]=a?a.concat(s):Array.isArray(s)?s:[s]}return i},Oe.props=Oe.methods=Oe.inject=Oe.computed=function(e,t,n,r){if(!e)return t;var i=Object.create(null);return A(i,e),t&&A(i,t),i},Oe.provide=Te;var je=function(e,t){return void 0===t?e:t};function De(e,t,n){if("function"==typeof t&&(t=t.options),function(e,t){var n=e.props;if(n){var r,i,o={};if(Array.isArray(n))for(r=n.length;r--;)"string"==typeof(i=n[r])&&(o[b(i)]={type:null});else if(s(n))for(var a in n)i=n[a],o[b(a)]=s(i)?i:{type:i};e.props=o}}(t),function(e,t){var n=e.inject;if(n){var r=e.inject={};if(Array.isArray(n))for(var i=0;i<n.length;i++)r[n[i]]={from:n[i]};else if(s(n))for(var o in n){var a=n[o];r[o]=s(a)?A({from:o},a):{from:a}}}}(t),function(e){var t=e.directives;if(t)for(var n in t){var r=t[n];"function"==typeof r&&(t[n]={bind:r,update:r})}}(t),!t._base&&(t.extends&&(e=De(e,t.extends,n)),t.mixins))for(var r=0,i=t.mixins.length;r<i;r++)e=De(e,t.mixins[r],n);var o,a={};for(o in e)c(o);for(o in t)y(e,o)||c(o);function c(r){var i=Oe[r]||je;a[r]=i(e[r],t[r],n,r)}return a}function Le(e,t,n,r){if("string"==typeof n){var i=e[t];if(y(i,n))return i[n];var o=b(n);if(y(i,o))return i[o];var a=$(o);return y(i,a)?i[a]:i[n]||i[o]||i[a]}}function Me(e,t,n,r){var i=t[e],o=!y(n,e),a=n[e],s=Pe(Boolean,i.type);if(s>-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===C(e)){var c=Pe(String,i.type);(c<0||s<c)&&(a=!0)}if(void 0===a){a=function(e,t,n){if(!y(t,"default"))return;var r=t.default;if(e&&e.$options.propsData&&void 0===e.$options.propsData[n]&&void 0!==e._props[n])return e._props[n];return"function"==typeof r&&"Function"!==Ie(t.type)?r.call(e):r}(r,i,e);var u=be;$e(!0),Ce(a),$e(u)}return a}function Ie(e){var t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:""}function Fe(e,t){return Ie(e)===Ie(t)}function Pe(e,t){if(!Array.isArray(t))return Fe(t,e)?0:-1;for(var n=0,r=t.length;n<r;n++)if(Fe(t[n],e))return n;return-1}function Re(e,t,n){le();try{if(t)for(var r=t;r=r.$parent;){var i=r.$options.errorCaptured;if(i)for(var o=0;o<i.length;o++)try{if(!1===i[o].call(r,e,t,n))return}catch(e){Be(e,r,"errorCaptured hook")}}Be(e,t,n)}finally{fe()}}function He(e,t,n,r,i){var o;try{(o=n?e.apply(t,n):e.call(t))&&!o._isVue&&u(o)&&!o._handled&&(o.catch(function(e){return Re(e,r,i+" (Promise/async)")}),o._handled=!0)}catch(e){Re(e,r,i)}return o}function Be(e,t,n){if(F.errorHandler)try{return F.errorHandler.call(null,e,t,n)}catch(t){t!==e&&Ue(t,null,"config.errorHandler")}Ue(e,t,n)}function Ue(e,t,n){if(!z&&!V||"undefined"==typeof console)throw e;console.error(e)}var ze,Ve=!1,Ke=[],Je=!1;function qe(){Je=!1;var e=Ke.slice(0);Ke.length=0;for(var t=0;t<e.length;t++)e[t]()}if("undefined"!=typeof Promise&&re(Promise)){var We=Promise.resolve();ze=function(){We.then(qe),G&&setTimeout(S)},Ve=!0}else if(q||"undefined"==typeof MutationObserver||!re(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())ze="undefined"!=typeof setImmediate&&re(setImmediate)?function(){setImmediate(qe)}:function(){setTimeout(qe,0)};else{var Ze=1,Ge=new MutationObserver(qe),Xe=document.createTextNode(String(Ze));Ge.observe(Xe,{characterData:!0}),ze=function(){Ze=(Ze+1)%2,Xe.data=String(Ze)},Ve=!0}function Ye(e,t){var n;if(Ke.push(function(){if(e)try{e.call(t)}catch(e){Re(e,t,"nextTick")}else n&&n(t)}),Je||(Je=!0,ze()),!e&&"undefined"!=typeof Promise)return new Promise(function(e){n=e})}var Qe=new ie;function et(e){!function e(t,n){var r,i;var a=Array.isArray(t);if(!a&&!o(t)||Object.isFrozen(t)||t instanceof pe)return;if(t.__ob__){var s=t.__ob__.dep.id;if(n.has(s))return;n.add(s)}if(a)for(r=t.length;r--;)e(t[r],n);else for(i=Object.keys(t),r=i.length;r--;)e(t[i[r]],n)}(e,Qe),Qe.clear()}var tt=g(function(e){var t="&"===e.charAt(0),n="~"===(e=t?e.slice(1):e).charAt(0),r="!"===(e=n?e.slice(1):e).charAt(0);return{name:e=r?e.slice(1):e,once:n,capture:r,passive:t}});function nt(e,t){function n(){var e=arguments,r=n.fns;if(!Array.isArray(r))return He(r,null,arguments,t,"v-on handler");for(var i=r.slice(),o=0;o<i.length;o++)He(i[o],null,e,t,"v-on handler")}return n.fns=e,n}function rt(e,n,i,o,a,s){var c,u,l,f;for(c in e)u=e[c],l=n[c],f=tt(c),t(u)||(t(l)?(t(u.fns)&&(u=e[c]=nt(u,s)),r(f.once)&&(u=e[c]=a(f.name,u,f.capture)),i(f.name,u,f.capture,f.passive,f.params)):u!==l&&(l.fns=u,e[c]=l));for(c in n)t(e[c])&&o((f=tt(c)).name,n[c],f.capture)}function it(e,i,o){var a;e instanceof pe&&(e=e.data.hook||(e.data.hook={}));var s=e[i];function c(){o.apply(this,arguments),h(a.fns,c)}t(s)?a=nt([c]):n(s.fns)&&r(s.merged)?(a=s).fns.push(c):a=nt([s,c]),a.merged=!0,e[i]=a}function ot(e,t,r,i,o){if(n(t)){if(y(t,r))return e[r]=t[r],o||delete t[r],!0;if(y(t,i))return e[r]=t[i],o||delete t[i],!0}return!1}function at(e){return i(e)?[he(e)]:Array.isArray(e)?function e(o,a){var s=[];var c,u,l,f;for(c=0;c<o.length;c++)t(u=o[c])||"boolean"==typeof u||(l=s.length-1,f=s[l],Array.isArray(u)?u.length>0&&(st((u=e(u,(a||"")+"_"+c))[0])&&st(f)&&(s[l]=he(f.text+u[0].text),u.shift()),s.push.apply(s,u)):i(u)?st(f)?s[l]=he(f.text+u):""!==u&&s.push(he(u)):st(u)&&st(f)?s[l]=he(f.text+u.text):(r(o._isVList)&&n(u.tag)&&t(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(e):void 0}function st(e){return n(e)&&n(e.text)&&!1===e.isComment}function ct(e,t){if(e){for(var n=Object.create(null),r=oe?Reflect.ownKeys(e):Object.keys(e),i=0;i<r.length;i++){var o=r[i];if("__ob__"!==o){for(var a=e[o].from,s=t;s;){if(s._provided&&y(s._provided,a)){n[o]=s._provided[a];break}s=s.$parent}if(!s&&"default"in e[o]){var c=e[o].default;n[o]="function"==typeof c?c.call(t):c}}}return n}}function ut(e,t){if(!e||!e.length)return{};for(var n={},r=0,i=e.length;r<i;r++){var o=e[r],a=o.data;if(a&&a.attrs&&a.attrs.slot&&delete a.attrs.slot,o.context!==t&&o.fnContext!==t||!a||null==a.slot)(n.default||(n.default=[])).push(o);else{var s=a.slot,c=n[s]||(n[s]=[]);"template"===o.tag?c.push.apply(c,o.children||[]):c.push(o)}}for(var u in n)n[u].every(lt)&&delete n[u];return n}function lt(e){return e.isComment&&!e.asyncFactory||" "===e.text}function ft(t,n,r){var i,o=Object.keys(n).length>0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&r&&r!==e&&s===r.$key&&!o&&!r.$hasNormal)return r;for(var c in i={},t)t[c]&&"$"!==c[0]&&(i[c]=pt(n,c,t[c]))}else i={};for(var u in n)u in i||(i[u]=dt(n,u));return t&&Object.isExtensible(t)&&(t._normalized=i),R(i,"$stable",a),R(i,"$key",s),R(i,"$hasNormal",o),i}function pt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:at(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function dt(e,t){return function(){return e[t]}}function vt(e,t){var r,i,a,s,c;if(Array.isArray(e)||"string"==typeof e)for(r=new Array(e.length),i=0,a=e.length;i<a;i++)r[i]=t(e[i],i);else if("number"==typeof e)for(r=new Array(e),i=0;i<e;i++)r[i]=t(i+1,i);else if(o(e))if(oe&&e[Symbol.iterator]){r=[];for(var u=e[Symbol.iterator](),l=u.next();!l.done;)r.push(t(l.value,r.length)),l=u.next()}else for(s=Object.keys(e),r=new Array(s.length),i=0,a=s.length;i<a;i++)c=s[i],r[i]=t(e[c],c,i);return n(r)||(r=[]),r._isVList=!0,r}function ht(e,t,n,r){var i,o=this.$scopedSlots[e];o?(n=n||{},r&&(n=A(A({},r),n)),i=o(n)||t):i=this.$slots[e]||t;var a=n&&n.slot;return a?this.$createElement("template",{slot:a},i):i}function mt(e){return Le(this.$options,"filters",e)||E}function yt(e,t){return Array.isArray(e)?-1===e.indexOf(t):e!==t}function gt(e,t,n,r,i){var o=F.keyCodes[t]||n;return i&&r&&!F.keyCodes[t]?yt(i,r):o?yt(o,e):r?C(r)!==t:void 0}function _t(e,t,n,r,i){if(n)if(o(n)){var a;Array.isArray(n)&&(n=O(n));var s=function(o){if("class"===o||"style"===o||v(o))a=e;else{var s=e.attrs&&e.attrs.type;a=r||F.mustUseProp(t,s,o)?e.domProps||(e.domProps={}):e.attrs||(e.attrs={})}var c=b(o),u=C(o);c in a||u in a||(a[o]=n[o],i&&((e.on||(e.on={}))["update:"+o]=function(e){n[o]=e}))};for(var c in n)s(c)}else;return e}function bt(e,t){var n=this._staticTrees||(this._staticTrees=[]),r=n[e];return r&&!t?r:(wt(r=n[e]=this.$options.staticRenderFns[e].call(this._renderProxy,null,this),"__static__"+e,!1),r)}function $t(e,t,n){return wt(e,"__once__"+t+(n?"_"+n:""),!0),e}function wt(e,t,n){if(Array.isArray(e))for(var r=0;r<e.length;r++)e[r]&&"string"!=typeof e[r]&&Ct(e[r],t+"_"+r,n);else Ct(e,t,n)}function Ct(e,t,n){e.isStatic=!0,e.key=t,e.isOnce=n}function xt(e,t){if(t)if(s(t)){var n=e.on=e.on?A({},e.on):{};for(var r in t){var i=n[r],o=t[r];n[r]=i?[].concat(i,o):o}}else;return e}function kt(e,t,n,r){t=t||{$stable:!n};for(var i=0;i<e.length;i++){var o=e[i];Array.isArray(o)?kt(o,t,n):o&&(o.proxy&&(o.fn.proxy=!0),t[o.key]=o.fn)}return r&&(t.$key=r),t}function At(e,t){for(var n=0;n<t.length;n+=2){var r=t[n];"string"==typeof r&&r&&(e[t[n]]=t[n+1])}return e}function Ot(e,t){return"string"==typeof e?t+e:e}function St(e){e._o=$t,e._n=f,e._s=l,e._l=vt,e._t=ht,e._q=N,e._i=j,e._m=bt,e._f=mt,e._k=gt,e._b=_t,e._v=he,e._e=ve,e._u=kt,e._g=xt,e._d=At,e._p=Ot}function Tt(t,n,i,o,a){var s,c=this,u=a.options;y(o,"_uid")?(s=Object.create(o))._original=o:(s=o,o=o._original);var l=r(u._compiled),f=!l;this.data=t,this.props=n,this.children=i,this.parent=o,this.listeners=t.on||e,this.injections=ct(u.inject,o),this.slots=function(){return c.$slots||ft(t.scopedSlots,c.$slots=ut(i,o)),c.$slots},Object.defineProperty(this,"scopedSlots",{enumerable:!0,get:function(){return ft(t.scopedSlots,this.slots())}}),l&&(this.$options=u,this.$slots=this.slots(),this.$scopedSlots=ft(t.scopedSlots,this.$slots)),u._scopeId?this._c=function(e,t,n,r){var i=Pt(s,e,t,n,r,f);return i&&!Array.isArray(i)&&(i.fnScopeId=u._scopeId,i.fnContext=o),i}:this._c=function(e,t,n,r){return Pt(s,e,t,n,r,f)}}function Et(e,t,n,r,i){var o=me(e);return o.fnContext=n,o.fnOptions=r,t.slot&&((o.data||(o.data={})).slot=t.slot),o}function Nt(e,t){for(var n in t)e[b(n)]=t[n]}St(Tt.prototype);var jt={init:function(e,t){if(e.componentInstance&&!e.componentInstance._isDestroyed&&e.data.keepAlive){var r=e;jt.prepatch(r,r)}else{(e.componentInstance=function(e,t){var r={_isComponent:!0,_parentVnode:e,parent:t},i=e.data.inlineTemplate;n(i)&&(r.render=i.render,r.staticRenderFns=i.staticRenderFns);return new e.componentOptions.Ctor(r)}(e,Wt)).$mount(t?e.elm:void 0,t)}},prepatch:function(t,n){var r=n.componentOptions;!function(t,n,r,i,o){var a=i.data.scopedSlots,s=t.$scopedSlots,c=!!(a&&!a.$stable||s!==e&&!s.$stable||a&&t.$scopedSlots.$key!==a.$key),u=!!(o||t.$options._renderChildren||c);t.$options._parentVnode=i,t.$vnode=i,t._vnode&&(t._vnode.parent=i);if(t.$options._renderChildren=o,t.$attrs=i.data.attrs||e,t.$listeners=r||e,n&&t.$options.props){$e(!1);for(var l=t._props,f=t.$options._propKeys||[],p=0;p<f.length;p++){var d=f[p],v=t.$options.props;l[d]=Me(d,v,n,t)}$e(!0),t.$options.propsData=n}r=r||e;var h=t.$options._parentListeners;t.$options._parentListeners=r,qt(t,r,h),u&&(t.$slots=ut(o,i.context),t.$forceUpdate())}(n.componentInstance=t.componentInstance,r.propsData,r.listeners,n,r.children)},insert:function(e){var t,n=e.context,r=e.componentInstance;r._isMounted||(r._isMounted=!0,Yt(r,"mounted")),e.data.keepAlive&&(n._isMounted?((t=r)._inactive=!1,en.push(t)):Xt(r,!0))},destroy:function(e){var t=e.componentInstance;t._isDestroyed||(e.data.keepAlive?function e(t,n){if(n&&(t._directInactive=!0,Gt(t)))return;if(!t._inactive){t._inactive=!0;for(var r=0;r<t.$children.length;r++)e(t.$children[r]);Yt(t,"deactivated")}}(t,!0):t.$destroy())}},Dt=Object.keys(jt);function Lt(i,a,s,c,l){if(!t(i)){var f=s.$options._base;if(o(i)&&(i=f.extend(i)),"function"==typeof i){var p;if(t(i.cid)&&void 0===(i=function(e,i){if(r(e.error)&&n(e.errorComp))return e.errorComp;if(n(e.resolved))return e.resolved;var a=Ht;a&&n(e.owners)&&-1===e.owners.indexOf(a)&&e.owners.push(a);if(r(e.loading)&&n(e.loadingComp))return e.loadingComp;if(a&&!n(e.owners)){var s=e.owners=[a],c=!0,l=null,f=null;a.$on("hook:destroyed",function(){return h(s,a)});var p=function(e){for(var t=0,n=s.length;t<n;t++)s[t].$forceUpdate();e&&(s.length=0,null!==l&&(clearTimeout(l),l=null),null!==f&&(clearTimeout(f),f=null))},d=D(function(t){e.resolved=Bt(t,i),c?s.length=0:p(!0)}),v=D(function(t){n(e.errorComp)&&(e.error=!0,p(!0))}),m=e(d,v);return o(m)&&(u(m)?t(e.resolved)&&m.then(d,v):u(m.component)&&(m.component.then(d,v),n(m.error)&&(e.errorComp=Bt(m.error,i)),n(m.loading)&&(e.loadingComp=Bt(m.loading,i),0===m.delay?e.loading=!0:l=setTimeout(function(){l=null,t(e.resolved)&&t(e.error)&&(e.loading=!0,p(!1))},m.delay||200)),n(m.timeout)&&(f=setTimeout(function(){f=null,t(e.resolved)&&v(null)},m.timeout)))),c=!1,e.loading?e.loadingComp:e.resolved}}(p=i,f)))return function(e,t,n,r,i){var o=ve();return o.asyncFactory=e,o.asyncMeta={data:t,context:n,children:r,tag:i},o}(p,a,s,c,l);a=a||{},$n(i),n(a.model)&&function(e,t){var r=e.model&&e.model.prop||"value",i=e.model&&e.model.event||"input";(t.attrs||(t.attrs={}))[r]=t.model.value;var o=t.on||(t.on={}),a=o[i],s=t.model.callback;n(a)?(Array.isArray(a)?-1===a.indexOf(s):a!==s)&&(o[i]=[s].concat(a)):o[i]=s}(i.options,a);var d=function(e,r,i){var o=r.options.props;if(!t(o)){var a={},s=e.attrs,c=e.props;if(n(s)||n(c))for(var u in o){var l=C(u);ot(a,c,u,l,!0)||ot(a,s,u,l,!1)}return a}}(a,i);if(r(i.options.functional))return function(t,r,i,o,a){var s=t.options,c={},u=s.props;if(n(u))for(var l in u)c[l]=Me(l,u,r||e);else n(i.attrs)&&Nt(c,i.attrs),n(i.props)&&Nt(c,i.props);var f=new Tt(i,c,a,o,t),p=s.render.call(null,f._c,f);if(p instanceof pe)return Et(p,i,f.parent,s);if(Array.isArray(p)){for(var d=at(p)||[],v=new Array(d.length),h=0;h<d.length;h++)v[h]=Et(d[h],i,f.parent,s);return v}}(i,d,a,s,c);var v=a.on;if(a.on=a.nativeOn,r(i.options.abstract)){var m=a.slot;a={},m&&(a.slot=m)}!function(e){for(var t=e.hook||(e.hook={}),n=0;n<Dt.length;n++){var r=Dt[n],i=t[r],o=jt[r];i===o||i&&i._merged||(t[r]=i?Mt(o,i):o)}}(a);var y=i.options.name||l;return new pe("vue-component-"+i.cid+(y?"-"+y:""),a,void 0,void 0,void 0,s,{Ctor:i,propsData:d,listeners:v,tag:l,children:c},p)}}}function Mt(e,t){var n=function(n,r){e(n,r),t(n,r)};return n._merged=!0,n}var It=1,Ft=2;function Pt(e,a,s,c,u,l){return(Array.isArray(s)||i(s))&&(u=c,c=s,s=void 0),r(l)&&(u=Ft),function(e,i,a,s,c){if(n(a)&&n(a.__ob__))return ve();n(a)&&n(a.is)&&(i=a.is);if(!i)return ve();Array.isArray(s)&&"function"==typeof s[0]&&((a=a||{}).scopedSlots={default:s[0]},s.length=0);c===Ft?s=at(s):c===It&&(s=function(e){for(var t=0;t<e.length;t++)if(Array.isArray(e[t]))return Array.prototype.concat.apply([],e);return e}(s));var u,l;if("string"==typeof i){var f;l=e.$vnode&&e.$vnode.ns||F.getTagNamespace(i),u=F.isReservedTag(i)?new pe(F.parsePlatformTagName(i),a,s,void 0,void 0,e):a&&a.pre||!n(f=Le(e.$options,"components",i))?new pe(i,a,s,void 0,void 0,e):Lt(f,a,e,s,i)}else u=Lt(i,a,e,s);return Array.isArray(u)?u:n(u)?(n(l)&&function e(i,o,a){i.ns=o;"foreignObject"===i.tag&&(o=void 0,a=!0);if(n(i.children))for(var s=0,c=i.children.length;s<c;s++){var u=i.children[s];n(u.tag)&&(t(u.ns)||r(a)&&"svg"!==u.tag)&&e(u,o,a)}}(u,l),n(a)&&function(e){o(e.style)&&et(e.style);o(e.class)&&et(e.class)}(a),u):ve()}(e,a,s,c,u)}var Rt,Ht=null;function Bt(e,t){return(e.__esModule||oe&&"Module"===e[Symbol.toStringTag])&&(e=e.default),o(e)?t.extend(e):e}function Ut(e){return e.isComment&&e.asyncFactory}function zt(e){if(Array.isArray(e))for(var t=0;t<e.length;t++){var r=e[t];if(n(r)&&(n(r.componentOptions)||Ut(r)))return r}}function Vt(e,t){Rt.$on(e,t)}function Kt(e,t){Rt.$off(e,t)}function Jt(e,t){var n=Rt;return function r(){null!==t.apply(null,arguments)&&n.$off(e,r)}}function qt(e,t,n){Rt=e,rt(t,n||{},Vt,Kt,Jt,e),Rt=void 0}var Wt=null;function Zt(e){var t=Wt;return Wt=e,function(){Wt=t}}function Gt(e){for(;e&&(e=e.$parent);)if(e._inactive)return!0;return!1}function Xt(e,t){if(t){if(e._directInactive=!1,Gt(e))return}else if(e._directInactive)return;if(e._inactive||null===e._inactive){e._inactive=!1;for(var n=0;n<e.$children.length;n++)Xt(e.$children[n]);Yt(e,"activated")}}function Yt(e,t){le();var n=e.$options[t],r=t+" hook";if(n)for(var i=0,o=n.length;i<o;i++)He(n[i],e,null,e,r);e._hasHookEvent&&e.$emit("hook:"+t),fe()}var Qt=[],en=[],tn={},nn=!1,rn=!1,on=0;var an=0,sn=Date.now;if(z&&!q){var cn=window.performance;cn&&"function"==typeof cn.now&&sn()>document.createEvent("Event").timeStamp&&(sn=function(){return cn.now()})}function un(){var e,t;for(an=sn(),rn=!0,Qt.sort(function(e,t){return e.id-t.id}),on=0;on<Qt.length;on++)(e=Qt[on]).before&&e.before(),t=e.id,tn[t]=null,e.run();var n=en.slice(),r=Qt.slice();on=Qt.length=en.length=0,tn={},nn=rn=!1,function(e){for(var t=0;t<e.length;t++)e[t]._inactive=!0,Xt(e[t],!0)}(n),function(e){var t=e.length;for(;t--;){var n=e[t],r=n.vm;r._watcher===n&&r._isMounted&&!r._isDestroyed&&Yt(r,"updated")}}(r),ne&&F.devtools&&ne.emit("flush")}var ln=0,fn=function(e,t,n,r,i){this.vm=e,i&&(e._watcher=this),e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++ln,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new ie,this.newDepIds=new ie,this.expression="","function"==typeof t?this.getter=t:(this.getter=function(e){if(!H.test(e)){var t=e.split(".");return function(e){for(var n=0;n<t.length;n++){if(!e)return;e=e[t[n]]}return e}}}(t),this.getter||(this.getter=S)),this.value=this.lazy?void 0:this.get()};fn.prototype.get=function(){var e;le(this);var t=this.vm;try{e=this.getter.call(t,t)}catch(e){if(!this.user)throw e;Re(e,t,'getter for watcher "'+this.expression+'"')}finally{this.deep&&et(e),fe(),this.cleanupDeps()}return e},fn.prototype.addDep=function(e){var t=e.id;this.newDepIds.has(t)||(this.newDepIds.add(t),this.newDeps.push(e),this.depIds.has(t)||e.addSub(this))},fn.prototype.cleanupDeps=function(){for(var e=this.deps.length;e--;){var t=this.deps[e];this.newDepIds.has(t.id)||t.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0},fn.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():function(e){var t=e.id;if(null==tn[t]){if(tn[t]=!0,rn){for(var n=Qt.length-1;n>on&&Qt[n].id>e.id;)n--;Qt.splice(n+1,0,e)}else Qt.push(e);nn||(nn=!0,Ye(un))}}(this)},fn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||o(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Re(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},fn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},fn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},fn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var pn={enumerable:!0,configurable:!0,get:S,set:S};function dn(e,t,n){pn.get=function(){return this[t][n]},pn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,pn)}function vn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[];e.$parent&&$e(!1);var o=function(o){i.push(o);var a=Me(o,t,n,e);xe(r,o,a),o in e||dn(e,"_props",o)};for(var a in t)o(a);$e(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?S:x(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;s(t=e._data="function"==typeof t?function(e,t){le();try{return e.call(t,t)}catch(e){return Re(e,t,"data()"),{}}finally{fe()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,i=(e.$options.methods,n.length);for(;i--;){var o=n[i];r&&y(r,o)||(a=void 0,36!==(a=(o+"").charCodeAt(0))&&95!==a&&dn(e,"_data",o))}var a;Ce(t,!0)}(e):Ce(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=te();for(var i in t){var o=t[i],a="function"==typeof o?o:o.get;r||(n[i]=new fn(e,a||S,S,hn)),i in e||mn(e,i,o)}}(e,t.computed),t.watch&&t.watch!==Y&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i<r.length;i++)_n(e,n,r[i]);else _n(e,n,r)}}(e,t.watch)}var hn={lazy:!0};function mn(e,t,n){var r=!te();"function"==typeof n?(pn.get=r?yn(t):gn(n),pn.set=S):(pn.get=n.get?r&&!1!==n.cache?yn(t):gn(n.get):S,pn.set=n.set||S),Object.defineProperty(e,t,pn)}function yn(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),ce.target&&t.depend(),t.value}}function gn(e){return function(){return e.call(this,this)}}function _n(e,t,n,r){return s(n)&&(r=n,n=n.handler),"string"==typeof n&&(n=e[n]),e.$watch(t,n,r)}var bn=0;function $n(e){var t=e.options;if(e.super){var n=$n(e.super);if(n!==e.superOptions){e.superOptions=n;var r=function(e){var t,n=e.options,r=e.sealedOptions;for(var i in n)n[i]!==r[i]&&(t||(t={}),t[i]=n[i]);return t}(e);r&&A(e.extendOptions,r),(t=e.options=De(n,e.extendOptions)).name&&(t.components[t.name]=e)}}return t}function wn(e){this._init(e)}function Cn(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var n=this,r=n.cid,i=e._Ctor||(e._Ctor={});if(i[r])return i[r];var o=e.name||n.options.name,a=function(e){this._init(e)};return(a.prototype=Object.create(n.prototype)).constructor=a,a.cid=t++,a.options=De(n.options,e),a.super=n,a.options.props&&function(e){var t=e.options.props;for(var n in t)dn(e.prototype,"_props",n)}(a),a.options.computed&&function(e){var t=e.options.computed;for(var n in t)mn(e.prototype,n,t[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,M.forEach(function(e){a[e]=n[e]}),o&&(a.options.components[o]=a),a.superOptions=n.options,a.extendOptions=e,a.sealedOptions=A({},a.options),i[r]=a,a}}function xn(e){return e&&(e.Ctor.options.name||e.tag)}function kn(e,t){return Array.isArray(e)?e.indexOf(t)>-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function An(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=xn(a.componentOptions);s&&!t(s)&&On(n,o,r,i)}}}function On(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=bn++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=De($n(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(n),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&qt(e,t)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,i=r&&r.context;t.$slots=ut(n._renderChildren,i),t.$scopedSlots=e,t._c=function(e,n,r,i){return Pt(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return Pt(t,e,n,r,i,!0)};var o=r&&r.data;xe(t,"$attrs",o&&o.attrs||e,null,!0),xe(t,"$listeners",n._parentListeners||e,null,!0)}(n),Yt(n,"beforeCreate"),function(e){var t=ct(e.$options.inject,e);t&&($e(!1),Object.keys(t).forEach(function(n){xe(e,n,t[n])}),$e(!0))}(n),vn(n),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(n),Yt(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(wn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=ke,e.prototype.$delete=Ae,e.prototype.$watch=function(e,t,n){if(s(t))return _n(this,e,t,n);(n=n||{}).user=!0;var r=new fn(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Re(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(wn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var i=0,o=e.length;i<o;i++)r.$on(e[i],n);else(r._events[e]||(r._events[e]=[])).push(n),t.test(e)&&(r._hasHookEvent=!0);return r},e.prototype.$once=function(e,t){var n=this;function r(){n.$off(e,r),t.apply(n,arguments)}return r.fn=t,n.$on(e,r),n},e.prototype.$off=function(e,t){var n=this;if(!arguments.length)return n._events=Object.create(null),n;if(Array.isArray(e)){for(var r=0,i=e.length;r<i;r++)n.$off(e[r],t);return n}var o,a=n._events[e];if(!a)return n;if(!t)return n._events[e]=null,n;for(var s=a.length;s--;)if((o=a[s])===t||o.fn===t){a.splice(s,1);break}return n},e.prototype.$emit=function(e){var t=this._events[e];if(t){t=t.length>1?k(t):t;for(var n=k(arguments,1),r='event handler for "'+e+'"',i=0,o=t.length;i<o;i++)He(t[i],this,n,this,r)}return this}}(wn),function(e){e.prototype._update=function(e,t){var n=this,r=n.$el,i=n._vnode,o=Zt(n);n._vnode=e,n.$el=i?n.__patch__(i,e):n.__patch__(n.$el,e,t,!1),o(),r&&(r.__vue__=null),n.$el&&(n.$el.__vue__=n),n.$vnode&&n.$parent&&n.$vnode===n.$parent._vnode&&(n.$parent.$el=n.$el)},e.prototype.$forceUpdate=function(){this._watcher&&this._watcher.update()},e.prototype.$destroy=function(){var e=this;if(!e._isBeingDestroyed){Yt(e,"beforeDestroy"),e._isBeingDestroyed=!0;var t=e.$parent;!t||t._isBeingDestroyed||e.$options.abstract||h(t.$children,e),e._watcher&&e._watcher.teardown();for(var n=e._watchers.length;n--;)e._watchers[n].teardown();e._data.__ob__&&e._data.__ob__.vmCount--,e._isDestroyed=!0,e.__patch__(e._vnode,null),Yt(e,"destroyed"),e.$off(),e.$el&&(e.$el.__vue__=null),e.$vnode&&(e.$vnode.parent=null)}}}(wn),function(e){St(e.prototype),e.prototype.$nextTick=function(e){return Ye(e,this)},e.prototype._render=function(){var e,t=this,n=t.$options,r=n.render,i=n._parentVnode;i&&(t.$scopedSlots=ft(i.data.scopedSlots,t.$slots,t.$scopedSlots)),t.$vnode=i;try{Ht=t,e=r.call(t._renderProxy,t.$createElement)}catch(n){Re(n,t,"render"),e=t._vnode}finally{Ht=null}return Array.isArray(e)&&1===e.length&&(e=e[0]),e instanceof pe||(e=ve()),e.parent=i,e}}(wn);var Sn=[String,RegExp,Array],Tn={KeepAlive:{name:"keep-alive",abstract:!0,props:{include:Sn,exclude:Sn,max:[String,Number]},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var e in this.cache)On(this.cache,e,this.keys)},mounted:function(){var e=this;this.$watch("include",function(t){An(e,function(e){return kn(t,e)})}),this.$watch("exclude",function(t){An(e,function(e){return!kn(t,e)})})},render:function(){var e=this.$slots.default,t=zt(e),n=t&&t.componentOptions;if(n){var r=xn(n),i=this.include,o=this.exclude;if(i&&(!r||!kn(i,r))||o&&r&&kn(o,r))return t;var a=this.cache,s=this.keys,c=null==t.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):t.key;a[c]?(t.componentInstance=a[c].componentInstance,h(s,c),s.push(c)):(a[c]=t,s.push(c),this.max&&s.length>parseInt(this.max)&&On(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return F}};Object.defineProperty(e,"config",t),e.util={warn:ae,extend:A,mergeOptions:De,defineReactive:xe},e.set=ke,e.delete=Ae,e.nextTick=Ye,e.observable=function(e){return Ce(e),e},e.options=Object.create(null),M.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,A(e.options.components,Tn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=k(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=De(this.options,e),this}}(e),Cn(e),function(e){M.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&s(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(wn),Object.defineProperty(wn.prototype,"$isServer",{get:te}),Object.defineProperty(wn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(wn,"FunctionalRenderContext",{value:Tt}),wn.version="2.6.12";var En=p("style,class"),Nn=p("input,textarea,option,select,progress"),jn=function(e,t,n){return"value"===n&&Nn(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Dn=p("contenteditable,draggable,spellcheck"),Ln=p("events,caret,typing,plaintext-only"),Mn=function(e,t){return Hn(t)||"false"===t?"false":"contenteditable"===e&&Ln(t)?t:"true"},In=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Fn="http://www.w3.org/1999/xlink",Pn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Rn=function(e){return Pn(e)?e.slice(6,e.length):""},Hn=function(e){return null==e||!1===e};function Bn(e){for(var t=e.data,r=e,i=e;n(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(t=Un(i.data,t));for(;n(r=r.parent);)r&&r.data&&(t=Un(t,r.data));return function(e,t){if(n(e)||n(t))return zn(e,Vn(t));return""}(t.staticClass,t.class)}function Un(e,t){return{staticClass:zn(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function zn(e,t){return e?t?e+" "+t:e:t||""}function Vn(e){return Array.isArray(e)?function(e){for(var t,r="",i=0,o=e.length;i<o;i++)n(t=Vn(e[i]))&&""!==t&&(r&&(r+=" "),r+=t);return r}(e):o(e)?function(e){var t="";for(var n in e)e[n]&&(t&&(t+=" "),t+=n);return t}(e):"string"==typeof e?e:""}var Kn={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},Jn=p("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),qn=p("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),Wn=function(e){return Jn(e)||qn(e)};function Zn(e){return qn(e)?"svg":"math"===e?"math":void 0}var Gn=Object.create(null);var Xn=p("text,number,password,search,email,tel,url");function Yn(e){if("string"==typeof e){var t=document.querySelector(e);return t||document.createElement("div")}return e}var Qn=Object.freeze({createElement:function(e,t){var n=document.createElement(e);return"select"!==e?n:(t.data&&t.data.attrs&&void 0!==t.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)},createElementNS:function(e,t){return document.createElementNS(Kn[e],t)},createTextNode:function(e){return document.createTextNode(e)},createComment:function(e){return document.createComment(e)},insertBefore:function(e,t,n){e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},appendChild:function(e,t){e.appendChild(t)},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},tagName:function(e){return e.tagName},setTextContent:function(e,t){e.textContent=t},setStyleScope:function(e,t){e.setAttribute(t,"")}}),er={create:function(e,t){tr(t)},update:function(e,t){e.data.ref!==t.data.ref&&(tr(e,!0),tr(t))},destroy:function(e){tr(e,!0)}};function tr(e,t){var r=e.data.ref;if(n(r)){var i=e.context,o=e.componentInstance||e.elm,a=i.$refs;t?Array.isArray(a[r])?h(a[r],o):a[r]===o&&(a[r]=void 0):e.data.refInFor?Array.isArray(a[r])?a[r].indexOf(o)<0&&a[r].push(o):a[r]=[o]:a[r]=o}}var nr=new pe("",{},[]),rr=["create","activate","update","remove","destroy"];function ir(e,i){return e.key===i.key&&(e.tag===i.tag&&e.isComment===i.isComment&&n(e.data)===n(i.data)&&function(e,t){if("input"!==e.tag)return!0;var r,i=n(r=e.data)&&n(r=r.attrs)&&r.type,o=n(r=t.data)&&n(r=r.attrs)&&r.type;return i===o||Xn(i)&&Xn(o)}(e,i)||r(e.isAsyncPlaceholder)&&e.asyncFactory===i.asyncFactory&&t(i.asyncFactory.error))}function or(e,t,r){var i,o,a={};for(i=t;i<=r;++i)n(o=e[i].key)&&(a[o]=i);return a}var ar={create:sr,update:sr,destroy:function(e){sr(e,nr)}};function sr(e,t){(e.data.directives||t.data.directives)&&function(e,t){var n,r,i,o=e===nr,a=t===nr,s=ur(e.data.directives,e.context),c=ur(t.data.directives,t.context),u=[],l=[];for(n in c)r=s[n],i=c[n],r?(i.oldValue=r.value,i.oldArg=r.arg,fr(i,"update",t,e),i.def&&i.def.componentUpdated&&l.push(i)):(fr(i,"bind",t,e),i.def&&i.def.inserted&&u.push(i));if(u.length){var f=function(){for(var n=0;n<u.length;n++)fr(u[n],"inserted",t,e)};o?it(t,"insert",f):f()}l.length&&it(t,"postpatch",function(){for(var n=0;n<l.length;n++)fr(l[n],"componentUpdated",t,e)});if(!o)for(n in s)c[n]||fr(s[n],"unbind",e,e,a)}(e,t)}var cr=Object.create(null);function ur(e,t){var n,r,i=Object.create(null);if(!e)return i;for(n=0;n<e.length;n++)(r=e[n]).modifiers||(r.modifiers=cr),i[lr(r)]=r,r.def=Le(t.$options,"directives",r.name);return i}function lr(e){return e.rawName||e.name+"."+Object.keys(e.modifiers||{}).join(".")}function fr(e,t,n,r,i){var o=e.def&&e.def[t];if(o)try{o(n.elm,e,n,r,i)}catch(r){Re(r,n.context,"directive "+e.name+" "+t+" hook")}}var pr=[er,ar];function dr(e,r){var i=r.componentOptions;if(!(n(i)&&!1===i.Ctor.options.inheritAttrs||t(e.data.attrs)&&t(r.data.attrs))){var o,a,s=r.elm,c=e.data.attrs||{},u=r.data.attrs||{};for(o in n(u.__ob__)&&(u=r.data.attrs=A({},u)),u)a=u[o],c[o]!==a&&vr(s,o,a);for(o in(q||Z)&&u.value!==c.value&&vr(s,"value",u.value),c)t(u[o])&&(Pn(o)?s.removeAttributeNS(Fn,Rn(o)):Dn(o)||s.removeAttribute(o))}}function vr(e,t,n){e.tagName.indexOf("-")>-1?hr(e,t,n):In(t)?Hn(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Dn(t)?e.setAttribute(t,Mn(t,n)):Pn(t)?Hn(n)?e.removeAttributeNS(Fn,Rn(t)):e.setAttributeNS(Fn,t,n):hr(e,t,n)}function hr(e,t,n){if(Hn(n))e.removeAttribute(t);else{if(q&&!W&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var mr={create:dr,update:dr};function yr(e,r){var i=r.elm,o=r.data,a=e.data;if(!(t(o.staticClass)&&t(o.class)&&(t(a)||t(a.staticClass)&&t(a.class)))){var s=Bn(r),c=i._transitionClasses;n(c)&&(s=zn(s,Vn(c))),s!==i._prevClass&&(i.setAttribute("class",s),i._prevClass=s)}}var gr,_r,br,$r,wr,Cr,xr={create:yr,update:yr},kr=/[\w).+\-_$\]]/;function Ar(e){var t,n,r,i,o,a=!1,s=!1,c=!1,u=!1,l=0,f=0,p=0,d=0;for(r=0;r<e.length;r++)if(n=t,t=e.charCodeAt(r),a)39===t&&92!==n&&(a=!1);else if(s)34===t&&92!==n&&(s=!1);else if(c)96===t&&92!==n&&(c=!1);else if(u)47===t&&92!==n&&(u=!1);else if(124!==t||124===e.charCodeAt(r+1)||124===e.charCodeAt(r-1)||l||f||p){switch(t){case 34:s=!0;break;case 39:a=!0;break;case 96:c=!0;break;case 40:p++;break;case 41:p--;break;case 91:f++;break;case 93:f--;break;case 123:l++;break;case 125:l--}if(47===t){for(var v=r-1,h=void 0;v>=0&&" "===(h=e.charAt(v));v--);h&&kr.test(h)||(u=!0)}}else void 0===i?(d=r+1,i=e.slice(0,r).trim()):m();function m(){(o||(o=[])).push(e.slice(d,r).trim()),d=r+1}if(void 0===i?i=e.slice(0,r).trim():0!==d&&m(),o)for(r=0;r<o.length;r++)i=Or(i,o[r]);return i}function Or(e,t){var n=t.indexOf("(");if(n<0)return'_f("'+t+'")('+e+")";var r=t.slice(0,n),i=t.slice(n+1);return'_f("'+r+'")('+e+(")"!==i?","+i:i)}function Sr(e,t){console.error("[Vue compiler]: "+e)}function Tr(e,t){return e?e.map(function(e){return e[t]}).filter(function(e){return e}):[]}function Er(e,t,n,r,i){(e.props||(e.props=[])).push(Rr({name:t,value:n,dynamic:i},r)),e.plain=!1}function Nr(e,t,n,r,i){(i?e.dynamicAttrs||(e.dynamicAttrs=[]):e.attrs||(e.attrs=[])).push(Rr({name:t,value:n,dynamic:i},r)),e.plain=!1}function jr(e,t,n,r){e.attrsMap[t]=n,e.attrsList.push(Rr({name:t,value:n},r))}function Dr(e,t,n,r,i,o,a,s){(e.directives||(e.directives=[])).push(Rr({name:t,rawName:n,value:r,arg:i,isDynamicArg:o,modifiers:a},s)),e.plain=!1}function Lr(e,t,n){return n?"_p("+t+',"'+e+'")':e+t}function Mr(t,n,r,i,o,a,s,c){var u;(i=i||e).right?c?n="("+n+")==='click'?'contextmenu':("+n+")":"click"===n&&(n="contextmenu",delete i.right):i.middle&&(c?n="("+n+")==='click'?'mouseup':("+n+")":"click"===n&&(n="mouseup")),i.capture&&(delete i.capture,n=Lr("!",n,c)),i.once&&(delete i.once,n=Lr("~",n,c)),i.passive&&(delete i.passive,n=Lr("&",n,c)),i.native?(delete i.native,u=t.nativeEvents||(t.nativeEvents={})):u=t.events||(t.events={});var l=Rr({value:r.trim(),dynamic:c},s);i!==e&&(l.modifiers=i);var f=u[n];Array.isArray(f)?o?f.unshift(l):f.push(l):u[n]=f?o?[l,f]:[f,l]:l,t.plain=!1}function Ir(e,t,n){var r=Fr(e,":"+t)||Fr(e,"v-bind:"+t);if(null!=r)return Ar(r);if(!1!==n){var i=Fr(e,t);if(null!=i)return JSON.stringify(i)}}function Fr(e,t,n){var r;if(null!=(r=e.attrsMap[t]))for(var i=e.attrsList,o=0,a=i.length;o<a;o++)if(i[o].name===t){i.splice(o,1);break}return n&&delete e.attrsMap[t],r}function Pr(e,t){for(var n=e.attrsList,r=0,i=n.length;r<i;r++){var o=n[r];if(t.test(o.name))return n.splice(r,1),o}}function Rr(e,t){return t&&(null!=t.start&&(e.start=t.start),null!=t.end&&(e.end=t.end)),e}function Hr(e,t,n){var r=n||{},i=r.number,o="$$v";r.trim&&(o="(typeof $$v === 'string'? $$v.trim(): $$v)"),i&&(o="_n("+o+")");var a=Br(t,o);e.model={value:"("+t+")",expression:JSON.stringify(t),callback:"function ($$v) {"+a+"}"}}function Br(e,t){var n=function(e){if(e=e.trim(),gr=e.length,e.indexOf("[")<0||e.lastIndexOf("]")<gr-1)return($r=e.lastIndexOf("."))>-1?{exp:e.slice(0,$r),key:'"'+e.slice($r+1)+'"'}:{exp:e,key:null};_r=e,$r=wr=Cr=0;for(;!zr();)Vr(br=Ur())?Jr(br):91===br&&Kr(br);return{exp:e.slice(0,wr),key:e.slice(wr+1,Cr)}}(e);return null===n.key?e+"="+t:"$set("+n.exp+", "+n.key+", "+t+")"}function Ur(){return _r.charCodeAt(++$r)}function zr(){return $r>=gr}function Vr(e){return 34===e||39===e}function Kr(e){var t=1;for(wr=$r;!zr();)if(Vr(e=Ur()))Jr(e);else if(91===e&&t++,93===e&&t--,0===t){Cr=$r;break}}function Jr(e){for(var t=e;!zr()&&(e=Ur())!==t;);}var qr,Wr="__r",Zr="__c";function Gr(e,t,n){var r=qr;return function i(){null!==t.apply(null,arguments)&&Qr(e,i,n,r)}}var Xr=Ve&&!(X&&Number(X[1])<=53);function Yr(e,t,n,r){if(Xr){var i=an,o=t;t=o._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=i||e.timeStamp<=0||e.target.ownerDocument!==document)return o.apply(this,arguments)}}qr.addEventListener(e,t,Q?{capture:n,passive:r}:n)}function Qr(e,t,n,r){(r||qr).removeEventListener(e,t._wrapper||t,n)}function ei(e,r){if(!t(e.data.on)||!t(r.data.on)){var i=r.data.on||{},o=e.data.on||{};qr=r.elm,function(e){if(n(e[Wr])){var t=q?"change":"input";e[t]=[].concat(e[Wr],e[t]||[]),delete e[Wr]}n(e[Zr])&&(e.change=[].concat(e[Zr],e.change||[]),delete e[Zr])}(i),rt(i,o,Yr,Qr,Gr,r.context),qr=void 0}}var ti,ni={create:ei,update:ei};function ri(e,r){if(!t(e.data.domProps)||!t(r.data.domProps)){var i,o,a=r.elm,s=e.data.domProps||{},c=r.data.domProps||{};for(i in n(c.__ob__)&&(c=r.data.domProps=A({},c)),s)i in c||(a[i]="");for(i in c){if(o=c[i],"textContent"===i||"innerHTML"===i){if(r.children&&(r.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i&&"PROGRESS"!==a.tagName){a._value=o;var u=t(o)?"":String(o);ii(a,u)&&(a.value=u)}else if("innerHTML"===i&&qn(a.tagName)&&t(a.innerHTML)){(ti=ti||document.createElement("div")).innerHTML="<svg>"+o+"</svg>";for(var l=ti.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}else if(o!==s[i])try{a[i]=o}catch(e){}}}}function ii(e,t){return!e.composing&&("OPTION"===e.tagName||function(e,t){var n=!0;try{n=document.activeElement!==e}catch(e){}return n&&e.value!==t}(e,t)||function(e,t){var r=e.value,i=e._vModifiers;if(n(i)){if(i.number)return f(r)!==f(t);if(i.trim)return r.trim()!==t.trim()}return r!==t}(e,t))}var oi={create:ri,update:ri},ai=g(function(e){var t={},n=/:(.+)/;return e.split(/;(?![^(]*\))/g).forEach(function(e){if(e){var r=e.split(n);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t});function si(e){var t=ci(e.style);return e.staticStyle?A(e.staticStyle,t):t}function ci(e){return Array.isArray(e)?O(e):"string"==typeof e?ai(e):e}var ui,li=/^--/,fi=/\s*!important$/,pi=function(e,t,n){if(li.test(t))e.style.setProperty(t,n);else if(fi.test(n))e.style.setProperty(C(t),n.replace(fi,""),"important");else{var r=vi(t);if(Array.isArray(n))for(var i=0,o=n.length;i<o;i++)e.style[r]=n[i];else e.style[r]=n}},di=["Webkit","Moz","ms"],vi=g(function(e){if(ui=ui||document.createElement("div").style,"filter"!==(e=b(e))&&e in ui)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=0;n<di.length;n++){var r=di[n]+t;if(r in ui)return r}});function hi(e,r){var i=r.data,o=e.data;if(!(t(i.staticStyle)&&t(i.style)&&t(o.staticStyle)&&t(o.style))){var a,s,c=r.elm,u=o.staticStyle,l=o.normalizedStyle||o.style||{},f=u||l,p=ci(r.data.style)||{};r.data.normalizedStyle=n(p.__ob__)?A({},p):p;var d=function(e,t){var n,r={};if(t)for(var i=e;i.componentInstance;)(i=i.componentInstance._vnode)&&i.data&&(n=si(i.data))&&A(r,n);(n=si(e.data))&&A(r,n);for(var o=e;o=o.parent;)o.data&&(n=si(o.data))&&A(r,n);return r}(r,!0);for(s in f)t(d[s])&&pi(c,s,"");for(s in d)(a=d[s])!==f[s]&&pi(c,s,null==a?"":a)}}var mi={create:hi,update:hi},yi=/\s+/;function gi(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(yi).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function _i(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(yi).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?e.setAttribute("class",n):e.removeAttribute("class")}}function bi(e){if(e){if("object"==typeof e){var t={};return!1!==e.css&&A(t,$i(e.name||"v")),A(t,e),t}return"string"==typeof e?$i(e):void 0}}var $i=g(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),wi=z&&!W,Ci="transition",xi="animation",ki="transition",Ai="transitionend",Oi="animation",Si="animationend";wi&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(ki="WebkitTransition",Ai="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Oi="WebkitAnimation",Si="webkitAnimationEnd"));var Ti=z?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Ei(e){Ti(function(){Ti(e)})}function Ni(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),gi(e,t))}function ji(e,t){e._transitionClasses&&h(e._transitionClasses,t),_i(e,t)}function Di(e,t,n){var r=Mi(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===Ci?Ai:Si,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c<a&&u()},o+1),e.addEventListener(s,l)}var Li=/\b(transform|all)(,|$)/;function Mi(e,t){var n,r=window.getComputedStyle(e),i=(r[ki+"Delay"]||"").split(", "),o=(r[ki+"Duration"]||"").split(", "),a=Ii(i,o),s=(r[Oi+"Delay"]||"").split(", "),c=(r[Oi+"Duration"]||"").split(", "),u=Ii(s,c),l=0,f=0;return t===Ci?a>0&&(n=Ci,l=a,f=o.length):t===xi?u>0&&(n=xi,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?Ci:xi:null)?n===Ci?o.length:c.length:0,{type:n,timeout:l,propCount:f,hasTransform:n===Ci&&Li.test(r[ki+"Property"])}}function Ii(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max.apply(null,t.map(function(t,n){return Fi(t)+Fi(e[n])}))}function Fi(e){return 1e3*Number(e.slice(0,-1).replace(",","."))}function Pi(e,r){var i=e.elm;n(i._leaveCb)&&(i._leaveCb.cancelled=!0,i._leaveCb());var a=bi(e.data.transition);if(!t(a)&&!n(i._enterCb)&&1===i.nodeType){for(var s=a.css,c=a.type,u=a.enterClass,l=a.enterToClass,p=a.enterActiveClass,d=a.appearClass,v=a.appearToClass,h=a.appearActiveClass,m=a.beforeEnter,y=a.enter,g=a.afterEnter,_=a.enterCancelled,b=a.beforeAppear,$=a.appear,w=a.afterAppear,C=a.appearCancelled,x=a.duration,k=Wt,A=Wt.$vnode;A&&A.parent;)k=A.context,A=A.parent;var O=!k._isMounted||!e.isRootInsert;if(!O||$||""===$){var S=O&&d?d:u,T=O&&h?h:p,E=O&&v?v:l,N=O&&b||m,j=O&&"function"==typeof $?$:y,L=O&&w||g,M=O&&C||_,I=f(o(x)?x.enter:x),F=!1!==s&&!W,P=Bi(j),R=i._enterCb=D(function(){F&&(ji(i,E),ji(i,T)),R.cancelled?(F&&ji(i,S),M&&M(i)):L&&L(i),i._enterCb=null});e.data.show||it(e,"insert",function(){var t=i.parentNode,n=t&&t._pending&&t._pending[e.key];n&&n.tag===e.tag&&n.elm._leaveCb&&n.elm._leaveCb(),j&&j(i,R)}),N&&N(i),F&&(Ni(i,S),Ni(i,T),Ei(function(){ji(i,S),R.cancelled||(Ni(i,E),P||(Hi(I)?setTimeout(R,I):Di(i,c,R)))})),e.data.show&&(r&&r(),j&&j(i,R)),F||P||R()}}}function Ri(e,r){var i=e.elm;n(i._enterCb)&&(i._enterCb.cancelled=!0,i._enterCb());var a=bi(e.data.transition);if(t(a)||1!==i.nodeType)return r();if(!n(i._leaveCb)){var s=a.css,c=a.type,u=a.leaveClass,l=a.leaveToClass,p=a.leaveActiveClass,d=a.beforeLeave,v=a.leave,h=a.afterLeave,m=a.leaveCancelled,y=a.delayLeave,g=a.duration,_=!1!==s&&!W,b=Bi(v),$=f(o(g)?g.leave:g),w=i._leaveCb=D(function(){i.parentNode&&i.parentNode._pending&&(i.parentNode._pending[e.key]=null),_&&(ji(i,l),ji(i,p)),w.cancelled?(_&&ji(i,u),m&&m(i)):(r(),h&&h(i)),i._leaveCb=null});y?y(C):C()}function C(){w.cancelled||(!e.data.show&&i.parentNode&&((i.parentNode._pending||(i.parentNode._pending={}))[e.key]=e),d&&d(i),_&&(Ni(i,u),Ni(i,p),Ei(function(){ji(i,u),w.cancelled||(Ni(i,l),b||(Hi($)?setTimeout(w,$):Di(i,c,w)))})),v&&v(i,w),_||b||w())}}function Hi(e){return"number"==typeof e&&!isNaN(e)}function Bi(e){if(t(e))return!1;var r=e.fns;return n(r)?Bi(Array.isArray(r)?r[0]:r):(e._length||e.length)>1}function Ui(e,t){!0!==t.data.show&&Pi(t)}var zi=function(e){var o,a,s={},c=e.modules,u=e.nodeOps;for(o=0;o<rr.length;++o)for(s[rr[o]]=[],a=0;a<c.length;++a)n(c[a][rr[o]])&&s[rr[o]].push(c[a][rr[o]]);function l(e){var t=u.parentNode(e);n(t)&&u.removeChild(t,e)}function f(e,t,i,o,a,c,l){if(n(e.elm)&&n(c)&&(e=c[l]=me(e)),e.isRootInsert=!a,!function(e,t,i,o){var a=e.data;if(n(a)){var c=n(e.componentInstance)&&a.keepAlive;if(n(a=a.hook)&&n(a=a.init)&&a(e,!1),n(e.componentInstance))return d(e,t),v(i,e.elm,o),r(c)&&function(e,t,r,i){for(var o,a=e;a.componentInstance;)if(a=a.componentInstance._vnode,n(o=a.data)&&n(o=o.transition)){for(o=0;o<s.activate.length;++o)s.activate[o](nr,a);t.push(a);break}v(r,e.elm,i)}(e,t,i,o),!0}}(e,t,i,o)){var f=e.data,p=e.children,m=e.tag;n(m)?(e.elm=e.ns?u.createElementNS(e.ns,m):u.createElement(m,e),g(e),h(e,p,t),n(f)&&y(e,t),v(i,e.elm,o)):r(e.isComment)?(e.elm=u.createComment(e.text),v(i,e.elm,o)):(e.elm=u.createTextNode(e.text),v(i,e.elm,o))}}function d(e,t){n(e.data.pendingInsert)&&(t.push.apply(t,e.data.pendingInsert),e.data.pendingInsert=null),e.elm=e.componentInstance.$el,m(e)?(y(e,t),g(e)):(tr(e),t.push(e))}function v(e,t,r){n(e)&&(n(r)?u.parentNode(r)===e&&u.insertBefore(e,t,r):u.appendChild(e,t))}function h(e,t,n){if(Array.isArray(t))for(var r=0;r<t.length;++r)f(t[r],n,e.elm,null,!0,t,r);else i(e.text)&&u.appendChild(e.elm,u.createTextNode(String(e.text)))}function m(e){for(;e.componentInstance;)e=e.componentInstance._vnode;return n(e.tag)}function y(e,t){for(var r=0;r<s.create.length;++r)s.create[r](nr,e);n(o=e.data.hook)&&(n(o.create)&&o.create(nr,e),n(o.insert)&&t.push(e))}function g(e){var t;if(n(t=e.fnScopeId))u.setStyleScope(e.elm,t);else for(var r=e;r;)n(t=r.context)&&n(t=t.$options._scopeId)&&u.setStyleScope(e.elm,t),r=r.parent;n(t=Wt)&&t!==e.context&&t!==e.fnContext&&n(t=t.$options._scopeId)&&u.setStyleScope(e.elm,t)}function _(e,t,n,r,i,o){for(;r<=i;++r)f(n[r],o,e,t,!1,n,r)}function b(e){var t,r,i=e.data;if(n(i))for(n(t=i.hook)&&n(t=t.destroy)&&t(e),t=0;t<s.destroy.length;++t)s.destroy[t](e);if(n(t=e.children))for(r=0;r<e.children.length;++r)b(e.children[r])}function $(e,t,r){for(;t<=r;++t){var i=e[t];n(i)&&(n(i.tag)?(w(i),b(i)):l(i.elm))}}function w(e,t){if(n(t)||n(e.data)){var r,i=s.remove.length+1;for(n(t)?t.listeners+=i:t=function(e,t){function n(){0==--n.listeners&&l(e)}return n.listeners=t,n}(e.elm,i),n(r=e.componentInstance)&&n(r=r._vnode)&&n(r.data)&&w(r,t),r=0;r<s.remove.length;++r)s.remove[r](e,t);n(r=e.data.hook)&&n(r=r.remove)?r(e,t):t()}else l(e.elm)}function C(e,t,r,i){for(var o=r;o<i;o++){var a=t[o];if(n(a)&&ir(e,a))return o}}function x(e,i,o,a,c,l){if(e!==i){n(i.elm)&&n(a)&&(i=a[c]=me(i));var p=i.elm=e.elm;if(r(e.isAsyncPlaceholder))n(i.asyncFactory.resolved)?O(e.elm,i,o):i.isAsyncPlaceholder=!0;else if(r(i.isStatic)&&r(e.isStatic)&&i.key===e.key&&(r(i.isCloned)||r(i.isOnce)))i.componentInstance=e.componentInstance;else{var d,v=i.data;n(v)&&n(d=v.hook)&&n(d=d.prepatch)&&d(e,i);var h=e.children,y=i.children;if(n(v)&&m(i)){for(d=0;d<s.update.length;++d)s.update[d](e,i);n(d=v.hook)&&n(d=d.update)&&d(e,i)}t(i.text)?n(h)&&n(y)?h!==y&&function(e,r,i,o,a){for(var s,c,l,p=0,d=0,v=r.length-1,h=r[0],m=r[v],y=i.length-1,g=i[0],b=i[y],w=!a;p<=v&&d<=y;)t(h)?h=r[++p]:t(m)?m=r[--v]:ir(h,g)?(x(h,g,o,i,d),h=r[++p],g=i[++d]):ir(m,b)?(x(m,b,o,i,y),m=r[--v],b=i[--y]):ir(h,b)?(x(h,b,o,i,y),w&&u.insertBefore(e,h.elm,u.nextSibling(m.elm)),h=r[++p],b=i[--y]):ir(m,g)?(x(m,g,o,i,d),w&&u.insertBefore(e,m.elm,h.elm),m=r[--v],g=i[++d]):(t(s)&&(s=or(r,p,v)),t(c=n(g.key)?s[g.key]:C(g,r,p,v))?f(g,o,e,h.elm,!1,i,d):ir(l=r[c],g)?(x(l,g,o,i,d),r[c]=void 0,w&&u.insertBefore(e,l.elm,h.elm)):f(g,o,e,h.elm,!1,i,d),g=i[++d]);p>v?_(e,t(i[y+1])?null:i[y+1].elm,i,d,y,o):d>y&&$(r,p,v)}(p,h,y,o,l):n(y)?(n(e.text)&&u.setTextContent(p,""),_(p,null,y,0,y.length-1,o)):n(h)?$(h,0,h.length-1):n(e.text)&&u.setTextContent(p,""):e.text!==i.text&&u.setTextContent(p,i.text),n(v)&&n(d=v.hook)&&n(d=d.postpatch)&&d(e,i)}}}function k(e,t,i){if(r(i)&&n(e.parent))e.parent.data.pendingInsert=t;else for(var o=0;o<t.length;++o)t[o].data.hook.insert(t[o])}var A=p("attrs,class,staticClass,staticStyle,key");function O(e,t,i,o){var a,s=t.tag,c=t.data,u=t.children;if(o=o||c&&c.pre,t.elm=e,r(t.isComment)&&n(t.asyncFactory))return t.isAsyncPlaceholder=!0,!0;if(n(c)&&(n(a=c.hook)&&n(a=a.init)&&a(t,!0),n(a=t.componentInstance)))return d(t,i),!0;if(n(s)){if(n(u))if(e.hasChildNodes())if(n(a=c)&&n(a=a.domProps)&&n(a=a.innerHTML)){if(a!==e.innerHTML)return!1}else{for(var l=!0,f=e.firstChild,p=0;p<u.length;p++){if(!f||!O(f,u[p],i,o)){l=!1;break}f=f.nextSibling}if(!l||f)return!1}else h(t,u,i);if(n(c)){var v=!1;for(var m in c)if(!A(m)){v=!0,y(t,i);break}!v&&c.class&&et(c.class)}}else e.data!==t.text&&(e.data=t.text);return!0}return function(e,i,o,a){if(!t(i)){var c,l=!1,p=[];if(t(e))l=!0,f(i,p);else{var d=n(e.nodeType);if(!d&&ir(e,i))x(e,i,p,null,null,a);else{if(d){if(1===e.nodeType&&e.hasAttribute(L)&&(e.removeAttribute(L),o=!0),r(o)&&O(e,i,p))return k(i,p,!0),e;c=e,e=new pe(u.tagName(c).toLowerCase(),{},[],void 0,c)}var v=e.elm,h=u.parentNode(v);if(f(i,p,v._leaveCb?null:h,u.nextSibling(v)),n(i.parent))for(var y=i.parent,g=m(i);y;){for(var _=0;_<s.destroy.length;++_)s.destroy[_](y);if(y.elm=i.elm,g){for(var w=0;w<s.create.length;++w)s.create[w](nr,y);var C=y.data.hook.insert;if(C.merged)for(var A=1;A<C.fns.length;A++)C.fns[A]()}else tr(y);y=y.parent}n(h)?$([e],0,0):n(e.tag)&&b(e)}}return k(i,p,l),i.elm}n(e)&&b(e)}}({nodeOps:Qn,modules:[mr,xr,ni,oi,mi,z?{create:Ui,activate:Ui,remove:function(e,t){!0!==e.data.show?Ri(e,t):t()}}:{}].concat(pr)});W&&document.addEventListener("selectionchange",function(){var e=document.activeElement;e&&e.vmodel&&Xi(e,"input")});var Vi={inserted:function(e,t,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?it(n,"postpatch",function(){Vi.componentUpdated(e,t,n)}):Ki(e,t,n.context),e._vOptions=[].map.call(e.options,Wi)):("textarea"===n.tag||Xn(e.type))&&(e._vModifiers=t.modifiers,t.modifiers.lazy||(e.addEventListener("compositionstart",Zi),e.addEventListener("compositionend",Gi),e.addEventListener("change",Gi),W&&(e.vmodel=!0)))},componentUpdated:function(e,t,n){if("select"===n.tag){Ki(e,t,n.context);var r=e._vOptions,i=e._vOptions=[].map.call(e.options,Wi);if(i.some(function(e,t){return!N(e,r[t])}))(e.multiple?t.value.some(function(e){return qi(e,i)}):t.value!==t.oldValue&&qi(t.value,i))&&Xi(e,"change")}}};function Ki(e,t,n){Ji(e,t,n),(q||Z)&&setTimeout(function(){Ji(e,t,n)},0)}function Ji(e,t,n){var r=t.value,i=e.multiple;if(!i||Array.isArray(r)){for(var o,a,s=0,c=e.options.length;s<c;s++)if(a=e.options[s],i)o=j(r,Wi(a))>-1,a.selected!==o&&(a.selected=o);else if(N(Wi(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function qi(e,t){return t.every(function(t){return!N(t,e)})}function Wi(e){return"_value"in e?e._value:e.value}function Zi(e){e.target.composing=!0}function Gi(e){e.target.composing&&(e.target.composing=!1,Xi(e.target,"input"))}function Xi(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function Yi(e){return!e.componentInstance||e.data&&e.data.transition?e:Yi(e.componentInstance._vnode)}var Qi={model:Vi,show:{bind:function(e,t,n){var r=t.value,i=(n=Yi(n)).data&&n.data.transition,o=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&i?(n.data.show=!0,Pi(n,function(){e.style.display=o})):e.style.display=r?o:"none"},update:function(e,t,n){var r=t.value;!r!=!t.oldValue&&((n=Yi(n)).data&&n.data.transition?(n.data.show=!0,r?Pi(n,function(){e.style.display=e.__vOriginalDisplay}):Ri(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none")},unbind:function(e,t,n,r,i){i||(e.style.display=e.__vOriginalDisplay)}}},eo={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function to(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?to(zt(t.children)):e}function no(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var i=n._parentListeners;for(var o in i)t[b(o)]=i[o];return t}function ro(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}var io=function(e){return e.tag||Ut(e)},oo=function(e){return"show"===e.name},ao={name:"transition",props:eo,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(io)).length){var r=this.mode,o=n[0];if(function(e){for(;e=e.parent;)if(e.data.transition)return!0}(this.$vnode))return o;var a=to(o);if(!a)return o;if(this._leaving)return ro(e,o);var s="__transition-"+this._uid+"-";a.key=null==a.key?a.isComment?s+"comment":s+a.tag:i(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var c=(a.data||(a.data={})).transition=no(this),u=this._vnode,l=to(u);if(a.data.directives&&a.data.directives.some(oo)&&(a.data.show=!0),l&&l.data&&!function(e,t){return t.key===e.key&&t.tag===e.tag}(a,l)&&!Ut(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=A({},c);if("out-in"===r)return this._leaving=!0,it(f,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),ro(e,o);if("in-out"===r){if(Ut(a))return u;var p,d=function(){p()};it(c,"afterEnter",d),it(c,"enterCancelled",d),it(f,"delayLeave",function(e){p=e})}}return o}}},so=A({tag:String,moveClass:String},eo);function co(e){e.elm._moveCb&&e.elm._moveCb(),e.elm._enterCb&&e.elm._enterCb()}function uo(e){e.data.newPos=e.elm.getBoundingClientRect()}function lo(e){var t=e.data.pos,n=e.data.newPos,r=t.left-n.left,i=t.top-n.top;if(r||i){e.data.moved=!0;var o=e.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}delete so.mode;var fo={Transition:ao,TransitionGroup:{props:so,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var i=Zt(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,i(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],a=no(this),s=0;s<i.length;s++){var c=i[s];c.tag&&null!=c.key&&0!==String(c.key).indexOf("__vlist")&&(o.push(c),n[c.key]=c,(c.data||(c.data={})).transition=a)}if(r){for(var u=[],l=[],f=0;f<r.length;f++){var p=r[f];p.data.transition=a,p.data.pos=p.elm.getBoundingClientRect(),n[p.key]?u.push(p):l.push(p)}this.kept=e(t,null,u),this.removed=l}return e(t,null,o)},updated:function(){var e=this.prevChildren,t=this.moveClass||(this.name||"v")+"-move";e.length&&this.hasMove(e[0].elm,t)&&(e.forEach(co),e.forEach(uo),e.forEach(lo),this._reflow=document.body.offsetHeight,e.forEach(function(e){if(e.data.moved){var n=e.elm,r=n.style;Ni(n,t),r.transform=r.WebkitTransform=r.transitionDuration="",n.addEventListener(Ai,n._moveCb=function e(r){r&&r.target!==n||r&&!/transform$/.test(r.propertyName)||(n.removeEventListener(Ai,e),n._moveCb=null,ji(n,t))})}}))},methods:{hasMove:function(e,t){if(!wi)return!1;if(this._hasMove)return this._hasMove;var n=e.cloneNode();e._transitionClasses&&e._transitionClasses.forEach(function(e){_i(n,e)}),gi(n,t),n.style.display="none",this.$el.appendChild(n);var r=Mi(n);return this.$el.removeChild(n),this._hasMove=r.hasTransform}}}};wn.config.mustUseProp=jn,wn.config.isReservedTag=Wn,wn.config.isReservedAttr=En,wn.config.getTagNamespace=Zn,wn.config.isUnknownElement=function(e){if(!z)return!0;if(Wn(e))return!1;if(e=e.toLowerCase(),null!=Gn[e])return Gn[e];var t=document.createElement(e);return e.indexOf("-")>-1?Gn[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:Gn[e]=/HTMLUnknownElement/.test(t.toString())},A(wn.options.directives,Qi),A(wn.options.components,fo),wn.prototype.__patch__=z?zi:S,wn.prototype.$mount=function(e,t){return function(e,t,n){var r;return e.$el=t,e.$options.render||(e.$options.render=ve),Yt(e,"beforeMount"),r=function(){e._update(e._render(),n)},new fn(e,r,S,{before:function(){e._isMounted&&!e._isDestroyed&&Yt(e,"beforeUpdate")}},!0),n=!1,null==e.$vnode&&(e._isMounted=!0,Yt(e,"mounted")),e}(this,e=e&&z?Yn(e):void 0,t)},z&&setTimeout(function(){F.devtools&&ne&&ne.emit("init",wn)},0);var po=/\{\{((?:.|\r?\n)+?)\}\}/g,vo=/[-.*+?^${}()|[\]\/\\]/g,ho=g(function(e){var t=e[0].replace(vo,"\\$&"),n=e[1].replace(vo,"\\$&");return new RegExp(t+"((?:.|\\n)+?)"+n,"g")});var mo={staticKeys:["staticClass"],transformNode:function(e,t){t.warn;var n=Fr(e,"class");n&&(e.staticClass=JSON.stringify(n));var r=Ir(e,"class",!1);r&&(e.classBinding=r)},genData:function(e){var t="";return e.staticClass&&(t+="staticClass:"+e.staticClass+","),e.classBinding&&(t+="class:"+e.classBinding+","),t}};var yo,go={staticKeys:["staticStyle"],transformNode:function(e,t){t.warn;var n=Fr(e,"style");n&&(e.staticStyle=JSON.stringify(ai(n)));var r=Ir(e,"style",!1);r&&(e.styleBinding=r)},genData:function(e){var t="";return e.staticStyle&&(t+="staticStyle:"+e.staticStyle+","),e.styleBinding&&(t+="style:("+e.styleBinding+"),"),t}},_o=function(e){return(yo=yo||document.createElement("div")).innerHTML=e,yo.textContent},bo=p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),$o=p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),wo=p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),Co=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,xo=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,ko="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+P.source+"]*",Ao="((?:"+ko+"\\:)?"+ko+")",Oo=new RegExp("^<"+Ao),So=/^\s*(\/?)>/,To=new RegExp("^<\\/"+Ao+"[^>]*>"),Eo=/^<!DOCTYPE [^>]+>/i,No=/^<!\--/,jo=/^<!\[/,Do=p("script,style,textarea",!0),Lo={},Mo={"&lt;":"<","&gt;":">","&quot;":'"',"&amp;":"&","&#10;":"\n","&#9;":"\t","&#39;":"'"},Io=/&(?:lt|gt|quot|amp|#39);/g,Fo=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Po=p("pre,textarea",!0),Ro=function(e,t){return e&&Po(e)&&"\n"===t[0]};function Ho(e,t){var n=t?Fo:Io;return e.replace(n,function(e){return Mo[e]})}var Bo,Uo,zo,Vo,Ko,Jo,qo,Wo,Zo=/^@|^v-on:/,Go=/^v-|^@|^:|^#/,Xo=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Yo=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Qo=/^\(|\)$/g,ea=/^\[.*\]$/,ta=/:(.*)$/,na=/^:|^\.|^v-bind:/,ra=/\.[^.\]]+(?=[^\]]*$)/g,ia=/^v-slot(:|$)|^#/,oa=/[\r\n]/,aa=/\s+/g,sa=g(_o),ca="_empty_";function ua(e,t,n){return{type:1,tag:e,attrsList:t,attrsMap:ma(t),rawAttrsMap:{},parent:n,children:[]}}function la(e,t){Bo=t.warn||Sr,Jo=t.isPreTag||T,qo=t.mustUseProp||T,Wo=t.getTagNamespace||T;t.isReservedTag;zo=Tr(t.modules,"transformNode"),Vo=Tr(t.modules,"preTransformNode"),Ko=Tr(t.modules,"postTransformNode"),Uo=t.delimiters;var n,r,i=[],o=!1!==t.preserveWhitespace,a=t.whitespace,s=!1,c=!1;function u(e){if(l(e),s||e.processed||(e=fa(e,t)),i.length||e===n||n.if&&(e.elseif||e.else)&&da(n,{exp:e.elseif,block:e}),r&&!e.forbidden)if(e.elseif||e.else)a=e,(u=function(e){var t=e.length;for(;t--;){if(1===e[t].type)return e[t];e.pop()}}(r.children))&&u.if&&da(u,{exp:a.elseif,block:a});else{if(e.slotScope){var o=e.slotTarget||'"default"';(r.scopedSlots||(r.scopedSlots={}))[o]=e}r.children.push(e),e.parent=r}var a,u;e.children=e.children.filter(function(e){return!e.slotScope}),l(e),e.pre&&(s=!1),Jo(e.tag)&&(c=!1);for(var f=0;f<Ko.length;f++)Ko[f](e,t)}function l(e){if(!c)for(var t;(t=e.children[e.children.length-1])&&3===t.type&&" "===t.text;)e.children.pop()}return function(e,t){for(var n,r,i=[],o=t.expectHTML,a=t.isUnaryTag||T,s=t.canBeLeftOpenTag||T,c=0;e;){if(n=e,r&&Do(r)){var u=0,l=r.toLowerCase(),f=Lo[l]||(Lo[l]=new RegExp("([\\s\\S]*?)(</"+l+"[^>]*>)","i")),p=e.replace(f,function(e,n,r){return u=r.length,Do(l)||"noscript"===l||(n=n.replace(/<!\--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)]]>/g,"$1")),Ro(l,n)&&(n=n.slice(1)),t.chars&&t.chars(n),""});c+=e.length-p.length,e=p,A(l,c-u,c)}else{var d=e.indexOf("<");if(0===d){if(No.test(e)){var v=e.indexOf("--\x3e");if(v>=0){t.shouldKeepComment&&t.comment(e.substring(4,v),c,c+v+3),C(v+3);continue}}if(jo.test(e)){var h=e.indexOf("]>");if(h>=0){C(h+2);continue}}var m=e.match(Eo);if(m){C(m[0].length);continue}var y=e.match(To);if(y){var g=c;C(y[0].length),A(y[1],g,c);continue}var _=x();if(_){k(_),Ro(_.tagName,e)&&C(1);continue}}var b=void 0,$=void 0,w=void 0;if(d>=0){for($=e.slice(d);!(To.test($)||Oo.test($)||No.test($)||jo.test($)||(w=$.indexOf("<",1))<0);)d+=w,$=e.slice(d);b=e.substring(0,d)}d<0&&(b=e),b&&C(b.length),t.chars&&b&&t.chars(b,c-b.length,c)}if(e===n){t.chars&&t.chars(e);break}}function C(t){c+=t,e=e.substring(t)}function x(){var t=e.match(Oo);if(t){var n,r,i={tagName:t[1],attrs:[],start:c};for(C(t[0].length);!(n=e.match(So))&&(r=e.match(xo)||e.match(Co));)r.start=c,C(r[0].length),r.end=c,i.attrs.push(r);if(n)return i.unarySlash=n[1],C(n[0].length),i.end=c,i}}function k(e){var n=e.tagName,c=e.unarySlash;o&&("p"===r&&wo(n)&&A(r),s(n)&&r===n&&A(n));for(var u=a(n)||!!c,l=e.attrs.length,f=new Array(l),p=0;p<l;p++){var d=e.attrs[p],v=d[3]||d[4]||d[5]||"",h="a"===n&&"href"===d[1]?t.shouldDecodeNewlinesForHref:t.shouldDecodeNewlines;f[p]={name:d[1],value:Ho(v,h)}}u||(i.push({tag:n,lowerCasedTag:n.toLowerCase(),attrs:f,start:e.start,end:e.end}),r=n),t.start&&t.start(n,f,u,e.start,e.end)}function A(e,n,o){var a,s;if(null==n&&(n=c),null==o&&(o=c),e)for(s=e.toLowerCase(),a=i.length-1;a>=0&&i[a].lowerCasedTag!==s;a--);else a=0;if(a>=0){for(var u=i.length-1;u>=a;u--)t.end&&t.end(i[u].tag,n,o);i.length=a,r=a&&i[a-1].tag}else"br"===s?t.start&&t.start(e,[],!0,n,o):"p"===s&&(t.start&&t.start(e,[],!1,n,o),t.end&&t.end(e,n,o))}A()}(e,{warn:Bo,expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,canBeLeftOpenTag:t.canBeLeftOpenTag,shouldDecodeNewlines:t.shouldDecodeNewlines,shouldDecodeNewlinesForHref:t.shouldDecodeNewlinesForHref,shouldKeepComment:t.comments,outputSourceRange:t.outputSourceRange,start:function(e,o,a,l,f){var p=r&&r.ns||Wo(e);q&&"svg"===p&&(o=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];ya.test(r.name)||(r.name=r.name.replace(ga,""),t.push(r))}return t}(o));var d,v=ua(e,o,r);p&&(v.ns=p),"style"!==(d=v).tag&&("script"!==d.tag||d.attrsMap.type&&"text/javascript"!==d.attrsMap.type)||te()||(v.forbidden=!0);for(var h=0;h<Vo.length;h++)v=Vo[h](v,t)||v;s||(!function(e){null!=Fr(e,"v-pre")&&(e.pre=!0)}(v),v.pre&&(s=!0)),Jo(v.tag)&&(c=!0),s?function(e){var t=e.attrsList,n=t.length;if(n)for(var r=e.attrs=new Array(n),i=0;i<n;i++)r[i]={name:t[i].name,value:JSON.stringify(t[i].value)},null!=t[i].start&&(r[i].start=t[i].start,r[i].end=t[i].end);else e.pre||(e.plain=!0)}(v):v.processed||(pa(v),function(e){var t=Fr(e,"v-if");if(t)e.if=t,da(e,{exp:t,block:e});else{null!=Fr(e,"v-else")&&(e.else=!0);var n=Fr(e,"v-else-if");n&&(e.elseif=n)}}(v),function(e){null!=Fr(e,"v-once")&&(e.once=!0)}(v)),n||(n=v),a?u(v):(r=v,i.push(v))},end:function(e,t,n){var o=i[i.length-1];i.length-=1,r=i[i.length-1],u(o)},chars:function(e,t,n){if(r&&(!q||"textarea"!==r.tag||r.attrsMap.placeholder!==e)){var i,u,l,f=r.children;if(e=c||e.trim()?"script"===(i=r).tag||"style"===i.tag?e:sa(e):f.length?a?"condense"===a&&oa.test(e)?"":" ":o?" ":"":"")c||"condense"!==a||(e=e.replace(aa," ")),!s&&" "!==e&&(u=function(e,t){var n=t?ho(t):po;if(n.test(e)){for(var r,i,o,a=[],s=[],c=n.lastIndex=0;r=n.exec(e);){(i=r.index)>c&&(s.push(o=e.slice(c,i)),a.push(JSON.stringify(o)));var u=Ar(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+r[0].length}return c<e.length&&(s.push(o=e.slice(c)),a.push(JSON.stringify(o))),{expression:a.join("+"),tokens:s}}}(e,Uo))?l={type:2,expression:u.expression,tokens:u.tokens,text:e}:" "===e&&f.length&&" "===f[f.length-1].text||(l={type:3,text:e}),l&&f.push(l)}},comment:function(e,t,n){if(r){var i={type:3,text:e,isComment:!0};r.children.push(i)}}}),n}function fa(e,t){var n,r;(r=Ir(n=e,"key"))&&(n.key=r),e.plain=!e.key&&!e.scopedSlots&&!e.attrsList.length,function(e){var t=Ir(e,"ref");t&&(e.ref=t,e.refInFor=function(e){var t=e;for(;t;){if(void 0!==t.for)return!0;t=t.parent}return!1}(e))}(e),function(e){var t;"template"===e.tag?(t=Fr(e,"scope"),e.slotScope=t||Fr(e,"slot-scope")):(t=Fr(e,"slot-scope"))&&(e.slotScope=t);var n=Ir(e,"slot");n&&(e.slotTarget='""'===n?'"default"':n,e.slotTargetDynamic=!(!e.attrsMap[":slot"]&&!e.attrsMap["v-bind:slot"]),"template"===e.tag||e.slotScope||Nr(e,"slot",n,function(e,t){return e.rawAttrsMap[":"+t]||e.rawAttrsMap["v-bind:"+t]||e.rawAttrsMap[t]}(e,"slot")));if("template"===e.tag){var r=Pr(e,ia);if(r){var i=va(r),o=i.name,a=i.dynamic;e.slotTarget=o,e.slotTargetDynamic=a,e.slotScope=r.value||ca}}else{var s=Pr(e,ia);if(s){var c=e.scopedSlots||(e.scopedSlots={}),u=va(s),l=u.name,f=u.dynamic,p=c[l]=ua("template",[],e);p.slotTarget=l,p.slotTargetDynamic=f,p.children=e.children.filter(function(e){if(!e.slotScope)return e.parent=p,!0}),p.slotScope=s.value||ca,e.children=[],e.plain=!1}}}(e),function(e){"slot"===e.tag&&(e.slotName=Ir(e,"name"))}(e),function(e){var t;(t=Ir(e,"is"))&&(e.component=t);null!=Fr(e,"inline-template")&&(e.inlineTemplate=!0)}(e);for(var i=0;i<zo.length;i++)e=zo[i](e,t)||e;return function(e){var t,n,r,i,o,a,s,c,u=e.attrsList;for(t=0,n=u.length;t<n;t++)if(r=i=u[t].name,o=u[t].value,Go.test(r))if(e.hasBindings=!0,(a=ha(r.replace(Go,"")))&&(r=r.replace(ra,"")),na.test(r))r=r.replace(na,""),o=Ar(o),(c=ea.test(r))&&(r=r.slice(1,-1)),a&&(a.prop&&!c&&"innerHtml"===(r=b(r))&&(r="innerHTML"),a.camel&&!c&&(r=b(r)),a.sync&&(s=Br(o,"$event"),c?Mr(e,'"update:"+('+r+")",s,null,!1,0,u[t],!0):(Mr(e,"update:"+b(r),s,null,!1,0,u[t]),C(r)!==b(r)&&Mr(e,"update:"+C(r),s,null,!1,0,u[t])))),a&&a.prop||!e.component&&qo(e.tag,e.attrsMap.type,r)?Er(e,r,o,u[t],c):Nr(e,r,o,u[t],c);else if(Zo.test(r))r=r.replace(Zo,""),(c=ea.test(r))&&(r=r.slice(1,-1)),Mr(e,r,o,a,!1,0,u[t],c);else{var l=(r=r.replace(Go,"")).match(ta),f=l&&l[1];c=!1,f&&(r=r.slice(0,-(f.length+1)),ea.test(f)&&(f=f.slice(1,-1),c=!0)),Dr(e,r,i,o,f,c,a,u[t])}else Nr(e,r,JSON.stringify(o),u[t]),!e.component&&"muted"===r&&qo(e.tag,e.attrsMap.type,r)&&Er(e,r,"true",u[t])}(e),e}function pa(e){var t;if(t=Fr(e,"v-for")){var n=function(e){var t=e.match(Xo);if(!t)return;var n={};n.for=t[2].trim();var r=t[1].trim().replace(Qo,""),i=r.match(Yo);i?(n.alias=r.replace(Yo,"").trim(),n.iterator1=i[1].trim(),i[2]&&(n.iterator2=i[2].trim())):n.alias=r;return n}(t);n&&A(e,n)}}function da(e,t){e.ifConditions||(e.ifConditions=[]),e.ifConditions.push(t)}function va(e){var t=e.name.replace(ia,"");return t||"#"!==e.name[0]&&(t="default"),ea.test(t)?{name:t.slice(1,-1),dynamic:!0}:{name:'"'+t+'"',dynamic:!1}}function ha(e){var t=e.match(ra);if(t){var n={};return t.forEach(function(e){n[e.slice(1)]=!0}),n}}function ma(e){for(var t={},n=0,r=e.length;n<r;n++)t[e[n].name]=e[n].value;return t}var ya=/^xmlns:NS\d+/,ga=/^NS\d+:/;function _a(e){return ua(e.tag,e.attrsList.slice(),e.parent)}var ba=[mo,go,{preTransformNode:function(e,t){if("input"===e.tag){var n,r=e.attrsMap;if(!r["v-model"])return;if((r[":type"]||r["v-bind:type"])&&(n=Ir(e,"type")),r.type||n||!r["v-bind"]||(n="("+r["v-bind"]+").type"),n){var i=Fr(e,"v-if",!0),o=i?"&&("+i+")":"",a=null!=Fr(e,"v-else",!0),s=Fr(e,"v-else-if",!0),c=_a(e);pa(c),jr(c,"type","checkbox"),fa(c,t),c.processed=!0,c.if="("+n+")==='checkbox'"+o,da(c,{exp:c.if,block:c});var u=_a(e);Fr(u,"v-for",!0),jr(u,"type","radio"),fa(u,t),da(c,{exp:"("+n+")==='radio'"+o,block:u});var l=_a(e);return Fr(l,"v-for",!0),jr(l,":type",n),fa(l,t),da(c,{exp:i,block:l}),a?c.else=!0:s&&(c.elseif=s),c}}}}];var $a,wa,Ca={expectHTML:!0,modules:ba,directives:{model:function(e,t,n){var r=t.value,i=t.modifiers,o=e.tag,a=e.attrsMap.type;if(e.component)return Hr(e,r,i),!1;if("select"===o)!function(e,t,n){var r='var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return '+(n&&n.number?"_n(val)":"val")+"});";r=r+" "+Br(t,"$event.target.multiple ? $$selectedVal : $$selectedVal[0]"),Mr(e,"change",r,null,!0)}(e,r,i);else if("input"===o&&"checkbox"===a)!function(e,t,n){var r=n&&n.number,i=Ir(e,"value")||"null",o=Ir(e,"true-value")||"true",a=Ir(e,"false-value")||"false";Er(e,"checked","Array.isArray("+t+")?_i("+t+","+i+")>-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),Mr(e,"change","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Br(t,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Br(t,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Br(t,"$$c")+"}",null,!0)}(e,r,i);else if("input"===o&&"radio"===a)!function(e,t,n){var r=n&&n.number,i=Ir(e,"value")||"null";Er(e,"checked","_q("+t+","+(i=r?"_n("+i+")":i)+")"),Mr(e,"change",Br(t,i),null,!0)}(e,r,i);else if("input"===o||"textarea"===o)!function(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?Wr:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=Br(t,l);c&&(f="if($event.target.composing)return;"+f),Er(e,"value","("+t+")"),Mr(e,u,f,null,!0),(s||a)&&Mr(e,"blur","$forceUpdate()")}(e,r,i);else if(!F.isReservedTag(o))return Hr(e,r,i),!1;return!0},text:function(e,t){t.value&&Er(e,"textContent","_s("+t.value+")",t)},html:function(e,t){t.value&&Er(e,"innerHTML","_s("+t.value+")",t)}},isPreTag:function(e){return"pre"===e},isUnaryTag:bo,mustUseProp:jn,canBeLeftOpenTag:$o,isReservedTag:Wn,getTagNamespace:Zn,staticKeys:function(e){return e.reduce(function(e,t){return e.concat(t.staticKeys||[])},[]).join(",")}(ba)},xa=g(function(e){return p("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(e?","+e:""))});function ka(e,t){e&&($a=xa(t.staticKeys||""),wa=t.isReservedTag||T,function e(t){t.static=function(e){if(2===e.type)return!1;if(3===e.type)return!0;return!(!e.pre&&(e.hasBindings||e.if||e.for||d(e.tag)||!wa(e.tag)||function(e){for(;e.parent;){if("template"!==(e=e.parent).tag)return!1;if(e.for)return!0}return!1}(e)||!Object.keys(e).every($a)))}(t);if(1===t.type){if(!wa(t.tag)&&"slot"!==t.tag&&null==t.attrsMap["inline-template"])return;for(var n=0,r=t.children.length;n<r;n++){var i=t.children[n];e(i),i.static||(t.static=!1)}if(t.ifConditions)for(var o=1,a=t.ifConditions.length;o<a;o++){var s=t.ifConditions[o].block;e(s),s.static||(t.static=!1)}}}(e),function e(t,n){if(1===t.type){if((t.static||t.once)&&(t.staticInFor=n),t.static&&t.children.length&&(1!==t.children.length||3!==t.children[0].type))return void(t.staticRoot=!0);if(t.staticRoot=!1,t.children)for(var r=0,i=t.children.length;r<i;r++)e(t.children[r],n||!!t.for);if(t.ifConditions)for(var o=1,a=t.ifConditions.length;o<a;o++)e(t.ifConditions[o].block,n)}}(e,!1))}var Aa=/^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/,Oa=/\([^)]*?\);*$/,Sa=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Ta={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Ea={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Na=function(e){return"if("+e+")return null;"},ja={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Na("$event.target !== $event.currentTarget"),ctrl:Na("!$event.ctrlKey"),shift:Na("!$event.shiftKey"),alt:Na("!$event.altKey"),meta:Na("!$event.metaKey"),left:Na("'button' in $event && $event.button !== 0"),middle:Na("'button' in $event && $event.button !== 1"),right:Na("'button' in $event && $event.button !== 2")};function Da(e,t){var n=t?"nativeOn:":"on:",r="",i="";for(var o in e){var a=La(e[o]);e[o]&&e[o].dynamic?i+=o+","+a+",":r+='"'+o+'":'+a+","}return r="{"+r.slice(0,-1)+"}",i?n+"_d("+r+",["+i.slice(0,-1)+"])":n+r}function La(e){if(!e)return"function(){}";if(Array.isArray(e))return"["+e.map(function(e){return La(e)}).join(",")+"]";var t=Sa.test(e.value),n=Aa.test(e.value),r=Sa.test(e.value.replace(Oa,""));if(e.modifiers){var i="",o="",a=[];for(var s in e.modifiers)if(ja[s])o+=ja[s],Ta[s]&&a.push(s);else if("exact"===s){var c=e.modifiers;o+=Na(["ctrl","shift","alt","meta"].filter(function(e){return!c[e]}).map(function(e){return"$event."+e+"Key"}).join("||"))}else a.push(s);return a.length&&(i+=function(e){return"if(!$event.type.indexOf('key')&&"+e.map(Ma).join("&&")+")return null;"}(a)),o&&(i+=o),"function($event){"+i+(t?"return "+e.value+"($event)":n?"return ("+e.value+")($event)":r?"return "+e.value:e.value)+"}"}return t||n?e.value:"function($event){"+(r?"return "+e.value:e.value)+"}"}function Ma(e){var t=parseInt(e,10);if(t)return"$event.keyCode!=="+t;var n=Ta[e],r=Ea[e];return"_k($event.keyCode,"+JSON.stringify(e)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Ia={on:function(e,t){e.wrapListeners=function(e){return"_g("+e+","+t.value+")"}},bind:function(e,t){e.wrapData=function(n){return"_b("+n+",'"+e.tag+"',"+t.value+","+(t.modifiers&&t.modifiers.prop?"true":"false")+(t.modifiers&&t.modifiers.sync?",true":"")+")"}},cloak:S},Fa=function(e){this.options=e,this.warn=e.warn||Sr,this.transforms=Tr(e.modules,"transformCode"),this.dataGenFns=Tr(e.modules,"genData"),this.directives=A(A({},Ia),e.directives);var t=e.isReservedTag||T;this.maybeComponent=function(e){return!!e.component||!t(e.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Pa(e,t){var n=new Fa(t);return{render:"with(this){return "+(e?Ra(e,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Ra(e,t){if(e.parent&&(e.pre=e.pre||e.parent.pre),e.staticRoot&&!e.staticProcessed)return Ha(e,t);if(e.once&&!e.onceProcessed)return Ba(e,t);if(e.for&&!e.forProcessed)return za(e,t);if(e.if&&!e.ifProcessed)return Ua(e,t);if("template"!==e.tag||e.slotTarget||t.pre){if("slot"===e.tag)return function(e,t){var n=e.slotName||'"default"',r=qa(e,t),i="_t("+n+(r?","+r:""),o=e.attrs||e.dynamicAttrs?Ga((e.attrs||[]).concat(e.dynamicAttrs||[]).map(function(e){return{name:b(e.name),value:e.value,dynamic:e.dynamic}})):null,a=e.attrsMap["v-bind"];!o&&!a||r||(i+=",null");o&&(i+=","+o);a&&(i+=(o?"":",null")+","+a);return i+")"}(e,t);var n;if(e.component)n=function(e,t,n){var r=t.inlineTemplate?null:qa(t,n,!0);return"_c("+e+","+Va(t,n)+(r?","+r:"")+")"}(e.component,e,t);else{var r;(!e.plain||e.pre&&t.maybeComponent(e))&&(r=Va(e,t));var i=e.inlineTemplate?null:qa(e,t,!0);n="_c('"+e.tag+"'"+(r?","+r:"")+(i?","+i:"")+")"}for(var o=0;o<t.transforms.length;o++)n=t.transforms[o](e,n);return n}return qa(e,t)||"void 0"}function Ha(e,t){e.staticProcessed=!0;var n=t.pre;return e.pre&&(t.pre=e.pre),t.staticRenderFns.push("with(this){return "+Ra(e,t)+"}"),t.pre=n,"_m("+(t.staticRenderFns.length-1)+(e.staticInFor?",true":"")+")"}function Ba(e,t){if(e.onceProcessed=!0,e.if&&!e.ifProcessed)return Ua(e,t);if(e.staticInFor){for(var n="",r=e.parent;r;){if(r.for){n=r.key;break}r=r.parent}return n?"_o("+Ra(e,t)+","+t.onceId+++","+n+")":Ra(e,t)}return Ha(e,t)}function Ua(e,t,n,r){return e.ifProcessed=!0,function e(t,n,r,i){if(!t.length)return i||"_e()";var o=t.shift();return o.exp?"("+o.exp+")?"+a(o.block)+":"+e(t,n,r,i):""+a(o.block);function a(e){return r?r(e,n):e.once?Ba(e,n):Ra(e,n)}}(e.ifConditions.slice(),t,n,r)}function za(e,t,n,r){var i=e.for,o=e.alias,a=e.iterator1?","+e.iterator1:"",s=e.iterator2?","+e.iterator2:"";return e.forProcessed=!0,(r||"_l")+"(("+i+"),function("+o+a+s+"){return "+(n||Ra)(e,t)+"})"}function Va(e,t){var n="{",r=function(e,t){var n=e.directives;if(!n)return;var r,i,o,a,s="directives:[",c=!1;for(r=0,i=n.length;r<i;r++){o=n[r],a=!0;var u=t.directives[o.name];u&&(a=!!u(e,o,t.warn)),a&&(c=!0,s+='{name:"'+o.name+'",rawName:"'+o.rawName+'"'+(o.value?",value:("+o.value+"),expression:"+JSON.stringify(o.value):"")+(o.arg?",arg:"+(o.isDynamicArg?o.arg:'"'+o.arg+'"'):"")+(o.modifiers?",modifiers:"+JSON.stringify(o.modifiers):"")+"},")}if(c)return s.slice(0,-1)+"]"}(e,t);r&&(n+=r+","),e.key&&(n+="key:"+e.key+","),e.ref&&(n+="ref:"+e.ref+","),e.refInFor&&(n+="refInFor:true,"),e.pre&&(n+="pre:true,"),e.component&&(n+='tag:"'+e.tag+'",');for(var i=0;i<t.dataGenFns.length;i++)n+=t.dataGenFns[i](e);if(e.attrs&&(n+="attrs:"+Ga(e.attrs)+","),e.props&&(n+="domProps:"+Ga(e.props)+","),e.events&&(n+=Da(e.events,!1)+","),e.nativeEvents&&(n+=Da(e.nativeEvents,!0)+","),e.slotTarget&&!e.slotScope&&(n+="slot:"+e.slotTarget+","),e.scopedSlots&&(n+=function(e,t,n){var r=e.for||Object.keys(t).some(function(e){var n=t[e];return n.slotTargetDynamic||n.if||n.for||Ka(n)}),i=!!e.if;if(!r)for(var o=e.parent;o;){if(o.slotScope&&o.slotScope!==ca||o.for){r=!0;break}o.if&&(i=!0),o=o.parent}var a=Object.keys(t).map(function(e){return Ja(t[e],n)}).join(",");return"scopedSlots:_u(["+a+"]"+(r?",null,true":"")+(!r&&i?",null,false,"+function(e){var t=5381,n=e.length;for(;n;)t=33*t^e.charCodeAt(--n);return t>>>0}(a):"")+")"}(e,e.scopedSlots,t)+","),e.model&&(n+="model:{value:"+e.model.value+",callback:"+e.model.callback+",expression:"+e.model.expression+"},"),e.inlineTemplate){var o=function(e,t){var n=e.children[0];if(n&&1===n.type){var r=Pa(n,t.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map(function(e){return"function(){"+e+"}"}).join(",")+"]}"}}(e,t);o&&(n+=o+",")}return n=n.replace(/,$/,"")+"}",e.dynamicAttrs&&(n="_b("+n+',"'+e.tag+'",'+Ga(e.dynamicAttrs)+")"),e.wrapData&&(n=e.wrapData(n)),e.wrapListeners&&(n=e.wrapListeners(n)),n}function Ka(e){return 1===e.type&&("slot"===e.tag||e.children.some(Ka))}function Ja(e,t){var n=e.attrsMap["slot-scope"];if(e.if&&!e.ifProcessed&&!n)return Ua(e,t,Ja,"null");if(e.for&&!e.forProcessed)return za(e,t,Ja);var r=e.slotScope===ca?"":String(e.slotScope),i="function("+r+"){return "+("template"===e.tag?e.if&&n?"("+e.if+")?"+(qa(e,t)||"undefined")+":undefined":qa(e,t)||"undefined":Ra(e,t))+"}",o=r?"":",proxy:true";return"{key:"+(e.slotTarget||'"default"')+",fn:"+i+o+"}"}function qa(e,t,n,r,i){var o=e.children;if(o.length){var a=o[0];if(1===o.length&&a.for&&"template"!==a.tag&&"slot"!==a.tag){var s=n?t.maybeComponent(a)?",1":",0":"";return""+(r||Ra)(a,t)+s}var c=n?function(e,t){for(var n=0,r=0;r<e.length;r++){var i=e[r];if(1===i.type){if(Wa(i)||i.ifConditions&&i.ifConditions.some(function(e){return Wa(e.block)})){n=2;break}(t(i)||i.ifConditions&&i.ifConditions.some(function(e){return t(e.block)}))&&(n=1)}}return n}(o,t.maybeComponent):0,u=i||Za;return"["+o.map(function(e){return u(e,t)}).join(",")+"]"+(c?","+c:"")}}function Wa(e){return void 0!==e.for||"template"===e.tag||"slot"===e.tag}function Za(e,t){return 1===e.type?Ra(e,t):3===e.type&&e.isComment?(r=e,"_e("+JSON.stringify(r.text)+")"):"_v("+(2===(n=e).type?n.expression:Xa(JSON.stringify(n.text)))+")";var n,r}function Ga(e){for(var t="",n="",r=0;r<e.length;r++){var i=e[r],o=Xa(i.value);i.dynamic?n+=i.name+","+o+",":t+='"'+i.name+'":'+o+","}return t="{"+t.slice(0,-1)+"}",n?"_d("+t+",["+n.slice(0,-1)+"])":t}function Xa(e){return e.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}new RegExp("\\b"+"do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,super,throw,while,yield,delete,export,import,return,switch,default,extends,finally,continue,debugger,function,arguments".split(",").join("\\b|\\b")+"\\b");function Ya(e,t){try{return new Function(e)}catch(n){return t.push({err:n,code:e}),S}}function Qa(e){var t=Object.create(null);return function(n,r,i){(r=A({},r)).warn;delete r.warn;var o=r.delimiters?String(r.delimiters)+n:n;if(t[o])return t[o];var a=e(n,r),s={},c=[];return s.render=Ya(a.render,c),s.staticRenderFns=a.staticRenderFns.map(function(e){return Ya(e,c)}),t[o]=s}}var es,ts,ns=(es=function(e,t){var n=la(e.trim(),t);!1!==t.optimize&&ka(n,t);var r=Pa(n,t);return{ast:n,render:r.render,staticRenderFns:r.staticRenderFns}},function(e){function t(t,n){var r=Object.create(e),i=[],o=[];if(n)for(var a in n.modules&&(r.modules=(e.modules||[]).concat(n.modules)),n.directives&&(r.directives=A(Object.create(e.directives||null),n.directives)),n)"modules"!==a&&"directives"!==a&&(r[a]=n[a]);r.warn=function(e,t,n){(n?o:i).push(e)};var s=es(t.trim(),r);return s.errors=i,s.tips=o,s}return{compile:t,compileToFunctions:Qa(t)}})(Ca),rs=(ns.compile,ns.compileToFunctions);function is(e){return(ts=ts||document.createElement("div")).innerHTML=e?'<a href="\n"/>':'<div a="\n"/>',ts.innerHTML.indexOf("&#10;")>0}var os=!!z&&is(!1),as=!!z&&is(!0),ss=g(function(e){var t=Yn(e);return t&&t.innerHTML}),cs=wn.prototype.$mount;return wn.prototype.$mount=function(e,t){if((e=e&&Yn(e))===document.body||e===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=ss(r));else{if(!r.nodeType)return this;r=r.innerHTML}else e&&(r=function(e){if(e.outerHTML)return e.outerHTML;var t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}(e));if(r){var i=rs(r,{outputSourceRange:!1,shouldDecodeNewlines:os,shouldDecodeNewlinesForHref:as,delimiters:n.delimiters,comments:n.comments},this),o=i.render,a=i.staticRenderFns;n.render=o,n.staticRenderFns=a}}return cs.call(this,e,t)},wn.compile=rs,wn});
;
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueColor=t():e.VueColor=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=60)}([function(e,t){function n(e,t){var n=e[1]||"",i=e[3];if(!i)return n;if(t&&"function"==typeof btoa){var o=r(i);return[n].concat(i.sources.map(function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"})).concat([o]).join("\n")}return[n].join("\n")}function r(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var r=n(t,e);return t[2]?"@media "+t[2]+"{"+r+"}":r}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},i=0;i<this.length;i++){var o=this[i][0];"number"==typeof o&&(r[o]=!0)}for(i=0;i<e.length;i++){var a=e[i];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(e,t,n){function r(e){for(var t=0;t<e.length;t++){var n=e[t],r=u[n.id];if(r){r.refs++;for(var i=0;i<r.parts.length;i++)r.parts[i](n.parts[i]);for(;i<n.parts.length;i++)r.parts.push(o(n.parts[i]));r.parts.length>n.parts.length&&(r.parts.length=n.parts.length)}else{for(var a=[],i=0;i<n.parts.length;i++)a.push(o(n.parts[i]));u[n.id]={id:n.id,refs:1,parts:a}}}}function i(){var e=document.createElement("style");return e.type="text/css",f.appendChild(e),e}function o(e){var t,n,r=document.querySelector("style["+b+'~="'+e.id+'"]');if(r){if(p)return v;r.parentNode.removeChild(r)}if(x){var o=h++;r=d||(d=i()),t=a.bind(null,r,o,!1),n=a.bind(null,r,o,!0)}else r=i(),t=s.bind(null,r),n=function(){r.parentNode.removeChild(r)};return t(e),function(r){if(r){if(r.css===e.css&&r.media===e.media&&r.sourceMap===e.sourceMap)return;t(e=r)}else n()}}function a(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=m(t,i);else{var o=document.createTextNode(i),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(o,a[t]):e.appendChild(o)}}function s(e,t){var n=t.css,r=t.media,i=t.sourceMap;if(r&&e.setAttribute("media",r),g.ssrId&&e.setAttribute(b,t.id),i&&(n+="\n/*# sourceURL="+i.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var c="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!c)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var l=n(64),u={},f=c&&(document.head||document.getElementsByTagName("head")[0]),d=null,h=0,p=!1,v=function(){},g=null,b="data-vue-ssr-id",x="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());e.exports=function(e,t,n,i){p=n,g=i||{};var o=l(e,t);return r(o),function(t){for(var n=[],i=0;i<o.length;i++){var a=o[i],s=u[a.id];s.refs--,n.push(s)}t?(o=l(e,t),r(o)):o=[];for(var i=0;i<n.length;i++){var s=n[i];if(0===s.refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete u[s.id]}}}};var m=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=function(e,t,n,r,i,o){var a,s=e=e||{},c=typeof e.default;"object"!==c&&"function"!==c||(a=e,s=e.default);var l="function"==typeof s?s.options:s;t&&(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0),n&&(l.functional=!0),i&&(l._scopeId=i);var u;if(o?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},l._ssrRegister=u):r&&(u=r),u){var f=l.functional,d=f?l.render:l.beforeCreate;f?(l._injectStyles=u,l.render=function(e,t){return u.call(t),d(e,t)}):l.beforeCreate=d?[].concat(d,u):[u]}return{esModule:a,exports:s,options:l}}},function(e,t,n){"use strict";function r(e,t){var n,r=e&&e.a;!(n=e&&e.hsl?(0,o.default)(e.hsl):e&&e.hex&&e.hex.length>0?(0,o.default)(e.hex):e&&e.hsv?(0,o.default)(e.hsv):e&&e.rgba?(0,o.default)(e.rgba):e&&e.rgb?(0,o.default)(e.rgb):(0,o.default)(e))||void 0!==n._a&&null!==n._a||n.setAlpha(r||1);var i=n.toHsl(),a=n.toHsv();return 0===i.s&&(a.h=i.h=e.h||e.hsl&&e.hsl.h||t||0),{hsl:i,hex:n.toHexString().toUpperCase(),hex8:n.toHex8String().toUpperCase(),rgba:n.toRgb(),hsv:a,oldHue:e.h||t||i.h,source:e.source,a:e.a||n.getAlpha()}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(65),o=function(e){return e&&e.__esModule?e:{default:e}}(i);t.default={props:["value"],data:function(){return{val:r(this.value)}},computed:{colors:{get:function(){return this.val},set:function(e){this.val=e,this.$emit("input",e)}}},watch:{value:function(e){this.val=r(e)}},methods:{colorChange:function(e,t){this.oldHue=this.colors.hsl.h,this.colors=r(e,t||this.oldHue)},isValidHex:function(e){return(0,o.default)(e).isValid()},simpleCheckForValidColor:function(e){for(var t=["r","g","b","a","h","s","l","v"],n=0,r=0,i=0;i<t.length;i++){var o=t[i];e[o]&&(n++,isNaN(e[o])||r++)}if(n===r)return e},paletteUpperCase:function(e){return e.map(function(e){return e.toUpperCase()})},isTransparent:function(e){return 0===(0,o.default)(e).getAlpha()}}}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";function r(e){c||n(66)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(36),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(68),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/common/EditableInput.vue",t.default=f.exports},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(8),i=n(18);e.exports=n(9)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(16),i=n(42),o=n(25),a=Object.defineProperty;t.f=n(9)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){e.exports=!n(17)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(90),i=n(24);e.exports=function(e){return r(i(e))}},function(e,t,n){var r=n(29)("wks"),i=n(19),o=n(4).Symbol,a="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=r},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){"use strict";function r(e){c||n(111)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(51),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(113),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/common/Hue.vue",t.default=f.exports},function(e,t){e.exports=!0},function(e,t){var n=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(12);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){"use strict";function r(e){c||n(123)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(54),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(127),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/common/Saturation.vue",t.default=f.exports},function(e,t,n){"use strict";function r(e){c||n(128)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(55),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(133),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/common/Alpha.vue",t.default=f.exports},function(e,t,n){"use strict";function r(e){c||n(130)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(56),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(132),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/common/Checkboard.vue",t.default=f.exports},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on  "+e);return e}},function(e,t,n){var r=n(12);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports={}},function(e,t,n){var r=n(46),i=n(30);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t,n){var r=n(29)("keys"),i=n(19);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){var r=n(15),i=n(4),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(14)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(8).f,i=n(6),o=n(11)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t,n){t.f=n(11)},function(e,t,n){var r=n(4),i=n(15),o=n(14),a=n(32),s=n(8).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:a.f(e)})}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(5),s=r(a),c=["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#CCCCCC","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"];t.default={name:"Compact",mixins:[o.default],props:{palette:{type:Array,default:function(){return c}}},components:{"ed-in":s.default},computed:{pick:function(){return this.colors.hex.toUpperCase()}},methods:{handlerClick:function(e){this.colorChange({hex:e,source:"hex"})}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={name:"editableInput",props:{label:String,labelText:String,desc:String,value:[String,Number],max:Number,min:Number,arrowOffset:{type:Number,default:1}},computed:{val:{get:function(){return this.value},set:function(e){if(!(void 0!==this.max&&+e>this.max))return e;this.$refs.input.value=this.max}},labelId:function(){return"input__label__"+this.label+"__"+Math.random().toString().slice(2,5)},labelSpanText:function(){return this.labelText||this.label}},methods:{update:function(e){this.handleChange(e.target.value)},handleChange:function(e){var t={};t[this.label]=e,void 0===t.hex&&void 0===t["#"]?this.$emit("change",t):e.length>5&&this.$emit("change",t)},handleKeyDown:function(e){var t=this.val,n=Number(t);if(n){var r=this.arrowOffset||1;38===e.keyCode&&(t=n+r,this.handleChange(t),e.preventDefault()),40===e.keyCode&&(t=n-r,this.handleChange(t),e.preventDefault())}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=["#FFFFFF","#F2F2F2","#E6E6E6","#D9D9D9","#CCCCCC","#BFBFBF","#B3B3B3","#A6A6A6","#999999","#8C8C8C","#808080","#737373","#666666","#595959","#4D4D4D","#404040","#333333","#262626","#0D0D0D","#000000"];t.default={name:"Grayscale",mixins:[i.default],props:{palette:{type:Array,default:function(){return o}}},components:{},computed:{pick:function(){return this.colors.hex.toUpperCase()}},methods:{handlerClick:function(e){this.colorChange({hex:e,source:"hex"})}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(5),o=r(i),a=n(3),s=r(a);t.default={name:"Material",mixins:[s.default],components:{"ed-in":o.default},methods:{onChange:function(e){e&&(e.hex?this.isValidHex(e.hex)&&this.colorChange({hex:e.hex,source:"hex"}):(e.r||e.g||e.b)&&this.colorChange({r:e.r||this.colors.rgba.r,g:e.g||this.colors.rgba.g,b:e.b||this.colors.rgba.b,a:e.a||this.colors.rgba.a,source:"rgba"}))}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(81),o=r(i),a=n(3),s=r(a),c=n(13),l=r(c);t.default={name:"Slider",mixins:[s.default],props:{swatches:{type:Array,default:function(){return[{s:.5,l:.8},{s:.5,l:.65},{s:.5,l:.5},{s:.5,l:.35},{s:.5,l:.2}]}}},components:{hue:l.default},computed:{normalizedSwatches:function(){return this.swatches.map(function(e){return"object"!==(void 0===e?"undefined":(0,o.default)(e))?{s:.5,l:e}:e})}},methods:{isActive:function(e,t){var n=this.colors.hsl;return 1===n.l&&1===e.l||(0===n.l&&0===e.l||Math.abs(n.l-e.l)<.01&&Math.abs(n.s-e.s)<.01)},hueChange:function(e){this.colorChange(e)},handleSwClick:function(e,t){this.colorChange({h:this.colors.hsl.h,s:t.s,l:t.l,source:"hsl"})}}}},function(e,t,n){"use strict";var r=n(14),i=n(41),o=n(44),a=n(7),s=n(26),c=n(88),l=n(31),u=n(95),f=n(11)("iterator"),d=!([].keys&&"next"in[].keys()),h=function(){return this};e.exports=function(e,t,n,p,v,g,b){c(n,t,p);var x,m,_,w=function(e){if(!d&&e in F)return F[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},y=t+" Iterator",C="values"==v,k=!1,F=e.prototype,S=F[f]||F["@@iterator"]||v&&F[v],A=S||w(v),O=v?C?w("entries"):A:void 0,E="Array"==t?F.entries||S:S;if(E&&(_=u(E.call(new e)))!==Object.prototype&&_.next&&(l(_,y,!0),r||"function"==typeof _[f]||a(_,f,h)),C&&S&&"values"!==S.name&&(k=!0,A=function(){return S.call(this)}),r&&!b||!d&&!k&&F[f]||a(F,f,A),s[t]=A,s[y]=h,v)if(x={values:C?A:w("values"),keys:g?A:w("keys"),entries:O},b)for(m in x)m in F||o(F,m,x[m]);else i(i.P+i.F*(d||k),t,x);return x}},function(e,t,n){var r=n(4),i=n(15),o=n(86),a=n(7),s=n(6),c=function(e,t,n){var l,u,f,d=e&c.F,h=e&c.G,p=e&c.S,v=e&c.P,g=e&c.B,b=e&c.W,x=h?i:i[t]||(i[t]={}),m=x.prototype,_=h?r:p?r[t]:(r[t]||{}).prototype;h&&(n=t);for(l in n)(u=!d&&_&&void 0!==_[l])&&s(x,l)||(f=u?_[l]:n[l],x[l]=h&&"function"!=typeof _[l]?n[l]:g&&u?o(f,r):b&&_[l]==f?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(f):v&&"function"==typeof f?o(Function.call,f):f,v&&((x.virtual||(x.virtual={}))[l]=f,e&c.R&&m&&!m[l]&&a(m,l,f)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t,n){e.exports=!n(9)&&!n(17)(function(){return 7!=Object.defineProperty(n(43)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(12),i=n(4).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t,n){e.exports=n(7)},function(e,t,n){var r=n(16),i=n(89),o=n(30),a=n(28)("IE_PROTO"),s=function(){},c=function(){var e,t=n(43)("iframe"),r=o.length;for(t.style.display="none",n(94).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;r--;)delete c.prototype[o[r]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=r(e),n=new s,s.prototype=null,n[a]=e):n=c(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(6),i=n(10),o=n(91)(!1),a=n(28)("IE_PROTO");e.exports=function(e,t){var n,s=i(e),c=0,l=[];for(n in s)n!=a&&r(s,n)&&l.push(n);for(;t.length>c;)r(s,n=t[c++])&&(~o(l,n)||l.push(n));return l}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(24);e.exports=function(e){return Object(r(e))}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(46),i=n(30).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={name:"Hue",props:{value:Object,direction:{type:String,default:"horizontal"}},data:function(){return{oldHue:0,pullDirection:""}},computed:{colors:function(){var e=this.value.hsl.h;return 0!==e&&e-this.oldHue>0&&(this.pullDirection="right"),0!==e&&e-this.oldHue<0&&(this.pullDirection="left"),this.oldHue=e,this.value},directionClass:function(){return{"vc-hue--horizontal":"horizontal"===this.direction,"vc-hue--vertical":"vertical"===this.direction}},pointerTop:function(){return"vertical"===this.direction?0===this.colors.hsl.h&&"right"===this.pullDirection?0:-100*this.colors.hsl.h/360+100+"%":0},pointerLeft:function(){return"vertical"===this.direction?0:0===this.colors.hsl.h&&"right"===this.pullDirection?"100%":100*this.colors.hsl.h/360+"%"}},methods:{handleChange:function(e,t){!t&&e.preventDefault();var n=this.$refs.container;if(n){var r,i,o=n.clientWidth,a=n.clientHeight,s=n.getBoundingClientRect().left+window.pageXOffset,c=n.getBoundingClientRect().top+window.pageYOffset,l=e.pageX||(e.touches?e.touches[0].pageX:0),u=e.pageY||(e.touches?e.touches[0].pageY:0),f=l-s,d=u-c;"vertical"===this.direction?(d<0?r=360:d>a?r=0:(i=-100*d/a+100,r=360*i/100),this.colors.hsl.h!==r&&this.$emit("change",{h:r,s:this.colors.hsl.s,l:this.colors.hsl.l,a:this.colors.hsl.a,source:"hsl"})):(f<0?r=0:f>o?r=360:(i=100*f/o,r=360*i/100),this.colors.hsl.h!==r&&this.$emit("change",{h:r,s:this.colors.hsl.s,l:this.colors.hsl.l,a:this.colors.hsl.a,source:"hsl"}))}},handleMouseDown:function(e){this.handleChange(e,!0),window.addEventListener("mousemove",this.handleChange),window.addEventListener("mouseup",this.handleMouseUp)},handleMouseUp:function(e){this.unbindEventListeners()},unbindEventListeners:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(118),o=r(i),a=n(3),s=r(a),c=["red","pink","purple","deepPurple","indigo","blue","lightBlue","cyan","teal","green","lightGreen","lime","yellow","amber","orange","deepOrange","brown","blueGrey","black"],l=["900","700","500","300","100"],u=function(){var e=[];return c.forEach(function(t){var n=[];"black"===t.toLowerCase()||"white"===t.toLowerCase()?n=n.concat(["#000000","#FFFFFF"]):l.forEach(function(e){var r=o.default[t][e];n.push(r.toUpperCase())}),e.push(n)}),e}();t.default={name:"Swatches",mixins:[s.default],props:{palette:{type:Array,default:function(){return u}}},computed:{pick:function(){return this.colors.hex}},methods:{equal:function(e){return e.toLowerCase()===this.colors.hex.toLowerCase()},handlerClick:function(e){this.colorChange({hex:e,source:"hex"})}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(5),s=r(a),c=n(20),l=r(c),u=n(13),f=r(u),d=n(21),h=r(d);t.default={name:"Photoshop",mixins:[o.default],props:{head:{type:String,default:"Color Picker"},disableFields:{type:Boolean,default:!1},hasResetButton:{type:Boolean,default:!1},acceptLabel:{type:String,default:"OK"},cancelLabel:{type:String,default:"Cancel"},resetLabel:{type:String,default:"Reset"},newLabel:{type:String,default:"new"},currentLabel:{type:String,default:"current"}},components:{saturation:l.default,hue:f.default,alpha:h.default,"ed-in":s.default},data:function(){return{currentColor:"#FFF"}},computed:{hsv:function(){var e=this.colors.hsv;return{h:e.h.toFixed(),s:(100*e.s).toFixed(),v:(100*e.v).toFixed()}},hex:function(){var e=this.colors.hex;return e&&e.replace("#","")}},created:function(){this.currentColor=this.colors.hex},methods:{childChange:function(e){this.colorChange(e)},inputChange:function(e){e&&(e["#"]?this.isValidHex(e["#"])&&this.colorChange({hex:e["#"],source:"hex"}):e.r||e.g||e.b||e.a?this.colorChange({r:e.r||this.colors.rgba.r,g:e.g||this.colors.rgba.g,b:e.b||this.colors.rgba.b,a:e.a||this.colors.rgba.a,source:"rgba"}):(e.h||e.s||e.v)&&this.colorChange({h:e.h||this.colors.hsv.h,s:e.s/100||this.colors.hsv.s,v:e.v/100||this.colors.hsv.v,source:"hsv"}))},clickCurrentColor:function(){this.colorChange({hex:this.currentColor,source:"hex"})},handleAccept:function(){this.$emit("ok")},handleCancel:function(){this.$emit("cancel")},handleReset:function(){this.$emit("reset")}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(125),o=r(i),a=n(126),s=r(a);t.default={name:"Saturation",props:{value:Object},computed:{colors:function(){return this.value},bgColor:function(){return"hsl("+this.colors.hsv.h+", 100%, 50%)"},pointerTop:function(){return-100*this.colors.hsv.v+1+100+"%"},pointerLeft:function(){return 100*this.colors.hsv.s+"%"}},methods:{throttle:(0,s.default)(function(e,t){e(t)},20,{leading:!0,trailing:!1}),handleChange:function(e,t){!t&&e.preventDefault();var n=this.$refs.container;if(n){var r=n.clientWidth,i=n.clientHeight,a=n.getBoundingClientRect().left+window.pageXOffset,s=n.getBoundingClientRect().top+window.pageYOffset,c=e.pageX||(e.touches?e.touches[0].pageX:0),l=e.pageY||(e.touches?e.touches[0].pageY:0),u=(0,o.default)(c-a,0,r),f=(0,o.default)(l-s,0,i),d=u/r,h=(0,o.default)(-f/i+1,0,1);this.throttle(this.onChange,{h:this.colors.hsv.h,s:d,v:h,a:this.colors.hsv.a,source:"hsva"})}},onChange:function(e){this.$emit("change",e)},handleMouseDown:function(e){window.addEventListener("mousemove",this.handleChange),window.addEventListener("mouseup",this.handleChange),window.addEventListener("mouseup",this.handleMouseUp)},handleMouseUp:function(e){this.unbindEventListeners()},unbindEventListeners:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(22),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default={name:"Alpha",props:{value:Object,onChange:Function},components:{checkboard:i.default},computed:{colors:function(){return this.value},gradientColor:function(){var e=this.colors.rgba,t=[e.r,e.g,e.b].join(",");return"linear-gradient(to right, rgba("+t+", 0) 0%, rgba("+t+", 1) 100%)"}},methods:{handleChange:function(e,t){!t&&e.preventDefault();var n=this.$refs.container;if(n){var r,i=n.clientWidth,o=n.getBoundingClientRect().left+window.pageXOffset,a=e.pageX||(e.touches?e.touches[0].pageX:0),s=a-o;r=s<0?0:s>i?1:Math.round(100*s/i)/100,this.colors.a!==r&&this.$emit("change",{h:this.colors.hsl.h,s:this.colors.hsl.s,l:this.colors.hsl.l,a:r,source:"rgba"})}},handleMouseDown:function(e){this.handleChange(e,!0),window.addEventListener("mousemove",this.handleChange),window.addEventListener("mouseup",this.handleMouseUp)},handleMouseUp:function(){this.unbindEventListeners()},unbindEventListeners:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}}}},function(e,t,n){"use strict";function r(e,t,n){if("undefined"==typeof document)return null;var r=document.createElement("canvas");r.width=r.height=2*n;var i=r.getContext("2d");return i?(i.fillStyle=e,i.fillRect(0,0,r.width,r.height),i.fillStyle=t,i.fillRect(0,0,n,n),i.translate(n,n),i.fillRect(0,0,n,n),r.toDataURL()):null}function i(e,t,n){var i=e+","+t+","+n;if(o[i])return o[i];var a=r(e,t,n);return o[i]=a,a}Object.defineProperty(t,"__esModule",{value:!0});var o={};t.default={name:"Checkboard",props:{size:{type:[Number,String],default:8},white:{type:String,default:"#fff"},grey:{type:String,default:"#e6e6e6"}},computed:{bgStyle:function(){return{"background-image":"url("+i(this.white,this.grey,this.size)+")"}}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(5),s=r(a),c=n(20),l=r(c),u=n(13),f=r(u),d=n(21),h=r(d),p=n(22),v=r(p),g=["#D0021B","#F5A623","#F8E71C","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF","rgba(0,0,0,0)"];t.default={name:"Sketch",mixins:[o.default],components:{saturation:l.default,hue:f.default,alpha:h.default,"ed-in":s.default,checkboard:v.default},props:{presetColors:{type:Array,default:function(){return g}},disableAlpha:{type:Boolean,default:!1},disableFields:{type:Boolean,default:!1}},computed:{hex:function(){var e=void 0;return e=this.colors.a<1?this.colors.hex8:this.colors.hex,e.replace("#","")},activeColor:function(){var e=this.colors.rgba;return"rgba("+[e.r,e.g,e.b,e.a].join(",")+")"}},methods:{handlePreset:function(e){this.colorChange({hex:e,source:"hex"})},childChange:function(e){this.colorChange(e)},inputChange:function(e){e&&(e.hex?this.isValidHex(e.hex)&&this.colorChange({hex:e.hex,source:"hex"}):(e.r||e.g||e.b||e.a)&&this.colorChange({r:e.r||this.colors.rgba.r,g:e.g||this.colors.rgba.g,b:e.b||this.colors.rgba.b,a:e.a||this.colors.rgba.a,source:"rgba"}))}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(5),s=r(a),c=n(20),l=r(c),u=n(13),f=r(u),d=n(21),h=r(d),p=n(22),v=r(p);t.default={name:"Chrome",mixins:[o.default],props:{disableAlpha:{type:Boolean,default:!1},disableFields:{type:Boolean,default:!1}},components:{saturation:l.default,hue:f.default,alpha:h.default,"ed-in":s.default,checkboard:v.default},data:function(){return{fieldsIndex:0,highlight:!1}},computed:{hsl:function(){var e=this.colors.hsl,t=e.h,n=e.s,r=e.l;return{h:t.toFixed(),s:(100*n).toFixed()+"%",l:(100*r).toFixed()+"%"}},activeColor:function(){var e=this.colors.rgba;return"rgba("+[e.r,e.g,e.b,e.a].join(",")+")"},hasAlpha:function(){return this.colors.a<1}},methods:{childChange:function(e){this.colorChange(e)},inputChange:function(e){if(e)if(e.hex)this.isValidHex(e.hex)&&this.colorChange({hex:e.hex,source:"hex"});else if(e.r||e.g||e.b||e.a)this.colorChange({r:e.r||this.colors.rgba.r,g:e.g||this.colors.rgba.g,b:e.b||this.colors.rgba.b,a:e.a||this.colors.rgba.a,source:"rgba"});else if(e.h||e.s||e.l){var t=e.s?e.s.replace("%","")/100:this.colors.hsl.s,n=e.l?e.l.replace("%","")/100:this.colors.hsl.l;this.colorChange({h:e.h||this.colors.hsl.h,s:t,l:n,source:"hsl"})}},toggleViews:function(){if(this.fieldsIndex>=2)return void(this.fieldsIndex=0);this.fieldsIndex++},showHighlight:function(){this.highlight=!0},hideHighlight:function(){this.highlight=!1}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(5),o=r(i),a=n(3),s=r(a),c=["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"];t.default={name:"Twitter",mixins:[s.default],components:{editableInput:o.default},props:{width:{type:[String,Number],default:276},defaultColors:{type:Array,default:function(){return c}},triangle:{default:"top-left",validator:function(e){return["hide","top-left","top-right"].includes(e)}}},computed:{hsv:function(){var e=this.colors.hsv;return{h:e.h.toFixed(),s:(100*e.s).toFixed(),v:(100*e.v).toFixed()}},hex:function(){var e=this.colors.hex;return e&&e.replace("#","")}},methods:{equal:function(e){return e.toLowerCase()===this.colors.hex.toLowerCase()},handlerClick:function(e){this.colorChange({hex:e,source:"hex"})},inputChange:function(e){e&&(e["#"]?this.isValidHex(e["#"])&&this.colorChange({hex:e["#"],source:"hex"}):e.r||e.g||e.b||e.a?this.colorChange({r:e.r||this.colors.rgba.r,g:e.g||this.colors.rgba.g,b:e.b||this.colors.rgba.b,a:e.a||this.colors.rgba.a,source:"rgba"}):(e.h||e.s||e.v)&&this.colorChange({h:e.h||this.colors.hsv.h,s:e.s/100||this.colors.hsv.s,v:e.v/100||this.colors.hsv.v,source:"hsv"}))}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(61),o=r(i),a=n(70),s=r(a),c=n(74),l=r(c),u=n(78),f=r(u),d=n(115),h=r(d),p=n(120),v=r(p),g=n(135),b=r(g),x=n(139),m=r(x),_=n(143),w=r(_),y=n(21),C=r(y),k=n(22),F=r(k),S=n(5),A=r(S),O=n(13),E=r(O),M=n(20),j=r(M),L=n(3),P=r(L),R={version:"2.8.1",Compact:o.default,Grayscale:s.default,Twitter:w.default,Material:l.default,Slider:f.default,Swatches:h.default,Photoshop:v.default,Sketch:b.default,Chrome:m.default,Alpha:C.default,Checkboard:F.default,EditableInput:A.default,Hue:E.default,Saturation:j.default,ColorMixin:P.default};e.exports=R},function(e,t,n){"use strict";function r(e){c||n(62)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(35),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(69),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/Compact.vue",t.default=f.exports},function(e,t,n){var r=n(63);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("6ce8a5a8",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-compact {\n  padding-top: 5px;\n  padding-left: 5px;\n  width: 245px;\n  border-radius: 2px;\n  box-sizing: border-box;\n  box-shadow: 0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16);\n  background-color: #fff;\n}\n.vc-compact-colors {\n  overflow: hidden;\n  padding: 0;\n  margin: 0;\n}\n.vc-compact-color-item {\n  list-style: none;\n  width: 15px;\n  height: 15px;\n  float: left;\n  margin-right: 5px;\n  margin-bottom: 5px;\n  position: relative;\n  cursor: pointer;\n}\n.vc-compact-color-item--white {\n  box-shadow: inset 0 0 0 1px #ddd;\n}\n.vc-compact-color-item--white .vc-compact-dot {\n  background: #000;\n}\n.vc-compact-dot {\n  position: absolute;\n  top: 5px;\n  right: 5px;\n  bottom: 5px;\n  left: 5px;\n  border-radius: 50%;\n  opacity: 1;\n  background: #fff;\n}\n",""])},function(e,t){e.exports=function(e,t){for(var n=[],r={},i=0;i<t.length;i++){var o=t[i],a=o[0],s=o[1],c=o[2],l=o[3],u={id:e+":"+i,css:s,media:c,sourceMap:l};r[a]?r[a].parts.push(u):n.push(r[a]={id:a,parts:[u]})}return n}},function(e,t,n){var r;!function(i){function o(e,t){if(e=e||"",t=t||{},e instanceof o)return e;if(!(this instanceof o))return new o(e,t);var n=a(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=G(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=G(this._r)),this._g<1&&(this._g=G(this._g)),this._b<1&&(this._b=G(this._b)),this._ok=n.ok,this._tc_id=U++}function a(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,o=null,a=!1,c=!1;return"string"==typeof e&&(e=N(e)),"object"==typeof e&&(H(e.r)&&H(e.g)&&H(e.b)?(t=s(e.r,e.g,e.b),a=!0,c="%"===String(e.r).substr(-1)?"prgb":"rgb"):H(e.h)&&H(e.s)&&H(e.v)?(r=D(e.s),i=D(e.v),t=f(e.h,r,i),a=!0,c="hsv"):H(e.h)&&H(e.s)&&H(e.l)&&(r=D(e.s),o=D(e.l),t=l(e.h,r,o),a=!0,c="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=O(n),{ok:a,format:e.format||c,r:V(255,q(t.r,0)),g:V(255,q(t.g,0)),b:V(255,q(t.b,0)),a:n}}function s(e,t,n){return{r:255*E(e,255),g:255*E(t,255),b:255*E(n,255)}}function c(e,t,n){e=E(e,255),t=E(t,255),n=E(n,255);var r,i,o=q(e,t,n),a=V(e,t,n),s=(o+a)/2;if(o==a)r=i=0;else{var c=o-a;switch(i=s>.5?c/(2-o-a):c/(o+a),o){case e:r=(t-n)/c+(t<n?6:0);break;case t:r=(n-e)/c+2;break;case n:r=(e-t)/c+4}r/=6}return{h:r,s:i,l:s}}function l(e,t,n){function r(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var i,o,a;if(e=E(e,360),t=E(t,100),n=E(n,100),0===t)i=o=a=n;else{var s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;i=r(c,s,e+1/3),o=r(c,s,e),a=r(c,s,e-1/3)}return{r:255*i,g:255*o,b:255*a}}function u(e,t,n){e=E(e,255),t=E(t,255),n=E(n,255);var r,i,o=q(e,t,n),a=V(e,t,n),s=o,c=o-a;if(i=0===o?0:c/o,o==a)r=0;else{switch(o){case e:r=(t-n)/c+(t<n?6:0);break;case t:r=(n-e)/c+2;break;case n:r=(e-t)/c+4}r/=6}return{h:r,s:i,v:s}}function f(e,t,n){e=6*E(e,360),t=E(t,100),n=E(n,100);var r=i.floor(e),o=e-r,a=n*(1-t),s=n*(1-o*t),c=n*(1-(1-o)*t),l=r%6;return{r:255*[n,s,a,a,c,n][l],g:255*[c,n,n,s,a,a][l],b:255*[a,a,c,n,n,s][l]}}function d(e,t,n,r){var i=[R(G(e).toString(16)),R(G(t).toString(16)),R(G(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function h(e,t,n,r,i){var o=[R(G(e).toString(16)),R(G(t).toString(16)),R(G(n).toString(16)),R(B(r))];return i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}function p(e,t,n,r){return[R(B(r)),R(G(e).toString(16)),R(G(t).toString(16)),R(G(n).toString(16))].join("")}function v(e,t){t=0===t?0:t||10;var n=o(e).toHsl();return n.s-=t/100,n.s=M(n.s),o(n)}function g(e,t){t=0===t?0:t||10;var n=o(e).toHsl();return n.s+=t/100,n.s=M(n.s),o(n)}function b(e){return o(e).desaturate(100)}function x(e,t){t=0===t?0:t||10;var n=o(e).toHsl();return n.l+=t/100,n.l=M(n.l),o(n)}function m(e,t){t=0===t?0:t||10;var n=o(e).toRgb();return n.r=q(0,V(255,n.r-G(-t/100*255))),n.g=q(0,V(255,n.g-G(-t/100*255))),n.b=q(0,V(255,n.b-G(-t/100*255))),o(n)}function _(e,t){t=0===t?0:t||10;var n=o(e).toHsl();return n.l-=t/100,n.l=M(n.l),o(n)}function w(e,t){var n=o(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,o(n)}function y(e){var t=o(e).toHsl();return t.h=(t.h+180)%360,o(t)}function C(e){var t=o(e).toHsl(),n=t.h;return[o(e),o({h:(n+120)%360,s:t.s,l:t.l}),o({h:(n+240)%360,s:t.s,l:t.l})]}function k(e){var t=o(e).toHsl(),n=t.h;return[o(e),o({h:(n+90)%360,s:t.s,l:t.l}),o({h:(n+180)%360,s:t.s,l:t.l}),o({h:(n+270)%360,s:t.s,l:t.l})]}function F(e){var t=o(e).toHsl(),n=t.h;return[o(e),o({h:(n+72)%360,s:t.s,l:t.l}),o({h:(n+216)%360,s:t.s,l:t.l})]}function S(e,t,n){t=t||6,n=n||30;var r=o(e).toHsl(),i=360/n,a=[o(e)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(o(r));return a}function A(e,t){t=t||6;for(var n=o(e).toHsv(),r=n.h,i=n.s,a=n.v,s=[],c=1/t;t--;)s.push(o({h:r,s:i,v:a})),a=(a+c)%1;return s}function O(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function E(e,t){L(e)&&(e="100%");var n=P(e);return e=V(t,q(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),i.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function M(e){return V(1,q(0,e))}function j(e){return parseInt(e,16)}function L(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)}function P(e){return"string"==typeof e&&-1!=e.indexOf("%")}function R(e){return 1==e.length?"0"+e:""+e}function D(e){return e<=1&&(e=100*e+"%"),e}function B(e){return i.round(255*parseFloat(e)).toString(16)}function T(e){return j(e)/255}function H(e){return!!J.CSS_UNIT.exec(e)}function N(e){e=e.replace(I,"").replace($,"").toLowerCase();var t=!1;if(W[e])e=W[e],t=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=J.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=J.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=J.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=J.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=J.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=J.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=J.hex8.exec(e))?{r:j(n[1]),g:j(n[2]),b:j(n[3]),a:T(n[4]),format:t?"name":"hex8"}:(n=J.hex6.exec(e))?{r:j(n[1]),g:j(n[2]),b:j(n[3]),format:t?"name":"hex"}:(n=J.hex4.exec(e))?{r:j(n[1]+""+n[1]),g:j(n[2]+""+n[2]),b:j(n[3]+""+n[3]),a:T(n[4]+""+n[4]),format:t?"name":"hex8"}:!!(n=J.hex3.exec(e))&&{r:j(n[1]+""+n[1]),g:j(n[2]+""+n[2]),b:j(n[3]+""+n[3]),format:t?"name":"hex"}}function z(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:t,size:n}}var I=/^\s+/,$=/\s+$/,U=0,G=i.round,V=i.min,q=i.max,X=i.random;o.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,n,r,o,a,s=this.toRgb();return e=s.r/255,t=s.g/255,n=s.b/255,r=e<=.03928?e/12.92:i.pow((e+.055)/1.055,2.4),o=t<=.03928?t/12.92:i.pow((t+.055)/1.055,2.4),a=n<=.03928?n/12.92:i.pow((n+.055)/1.055,2.4),.2126*r+.7152*o+.0722*a},setAlpha:function(e){return this._a=O(e),this._roundA=G(100*this._a)/100,this},toHsv:function(){var e=u(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=u(this._r,this._g,this._b),t=G(360*e.h),n=G(100*e.s),r=G(100*e.v);return 1==this._a?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=c(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=c(this._r,this._g,this._b),t=G(360*e.h),n=G(100*e.s),r=G(100*e.l);return 1==this._a?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return h(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:G(this._r),g:G(this._g),b:G(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+G(this._r)+", "+G(this._g)+", "+G(this._b)+")":"rgba("+G(this._r)+", "+G(this._g)+", "+G(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:G(100*E(this._r,255))+"%",g:G(100*E(this._g,255))+"%",b:G(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+G(100*E(this._r,255))+"%, "+G(100*E(this._g,255))+"%, "+G(100*E(this._b,255))+"%)":"rgba("+G(100*E(this._r,255))+"%, "+G(100*E(this._g,255))+"%, "+G(100*E(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+p(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var i=o(e);n="#"+p(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0;return t||!r||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return o(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(x,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(_,arguments)},desaturate:function(){return this._applyModification(v,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(b,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(F,arguments)},triad:function(){return this._applyCombination(C,arguments)},tetrad:function(){return this._applyCombination(k,arguments)}},o.fromRatio=function(e,t){if("object"==typeof e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]="a"===r?e[r]:D(e[r]));e=n}return o(e,t)},o.equals=function(e,t){return!(!e||!t)&&o(e).toRgbString()==o(t).toRgbString()},o.random=function(){return o.fromRatio({r:X(),g:X(),b:X()})},o.mix=function(e,t,n){n=0===n?0:n||50;var r=o(e).toRgb(),i=o(t).toRgb(),a=n/100;return o({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},o.readability=function(e,t){var n=o(e),r=o(t);return(i.max(n.getLuminance(),r.getLuminance())+.05)/(i.min(n.getLuminance(),r.getLuminance())+.05)},o.isReadable=function(e,t,n){var r,i,a=o.readability(e,t);switch(i=!1,r=z(n),r.level+r.size){case"AAsmall":case"AAAlarge":i=a>=4.5;break;case"AAlarge":i=a>=3;break;case"AAAsmall":i=a>=7}return i},o.mostReadable=function(e,t,n){var r,i,a,s,c=null,l=0;n=n||{},i=n.includeFallbackColors,a=n.level,s=n.size;for(var u=0;u<t.length;u++)(r=o.readability(e,t[u]))>l&&(l=r,c=o(t[u]));return o.isReadable(e,c,{level:a,size:s})||!i?c:(n.includeFallbackColors=!1,o.mostReadable(e,["#fff","#000"],n))};var W=o.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=o.hexNames=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}(W),J=function(){var e="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",t="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?",n="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";return{CSS_UNIT:new RegExp(e),rgb:new RegExp("rgb"+t),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+t),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+t),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();void 0!==e&&e.exports?e.exports=o:void 0!==(r=function(){return o}.call(t,n,t,e))&&(e.exports=r)}(Math)},function(e,t,n){var r=n(67);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("0f73e73c",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-editable-input {\n  position: relative;\n}\n.vc-input__input {\n  padding: 0;\n  border: 0;\n  outline: none;\n}\n.vc-input__label {\n  text-transform: capitalize;\n}\n",""])},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vc-editable-input"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.val,expression:"val"}],ref:"input",staticClass:"vc-input__input",attrs:{"aria-labelledby":e.labelId},domProps:{value:e.val},on:{keydown:e.handleKeyDown,input:[function(t){t.target.composing||(e.val=t.target.value)},e.update]}}),e._v(" "),n("span",{staticClass:"vc-input__label",attrs:{for:e.label,id:e.labelId}},[e._v(e._s(e.labelSpanText))]),e._v(" "),n("span",{staticClass:"vc-input__desc"},[e._v(e._s(e.desc))])])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vc-compact",attrs:{role:"application","aria-label":"Compact color picker"}},[n("ul",{staticClass:"vc-compact-colors",attrs:{role:"listbox"}},e._l(e.paletteUpperCase(e.palette),function(t){return n("li",{key:t,staticClass:"vc-compact-color-item",class:{"vc-compact-color-item--white":"#FFFFFF"===t},style:{background:t},attrs:{role:"option","aria-label":"color:"+t,"aria-selected":t===e.pick},on:{click:function(n){return e.handlerClick(t)}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t===e.pick,expression:"c === pick"}],staticClass:"vc-compact-dot"})])}),0)])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";function r(e){c||n(71)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(37),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(73),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/Grayscale.vue",t.default=f.exports},function(e,t,n){var r=n(72);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("21ddbb74",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-grayscale {\n  width: 125px;\n  border-radius: 2px;\n  box-shadow: 0 2px 15px rgba(0,0,0,.12), 0 2px 10px rgba(0,0,0,.16);\n  background-color: #fff;\n}\n.vc-grayscale-colors {\n  border-radius: 2px;\n  overflow: hidden;\n  padding: 0;\n  margin: 0;\n}\n.vc-grayscale-color-item {\n  list-style: none;\n  width: 25px;\n  height: 25px;\n  float: left;\n  position: relative;\n  cursor: pointer;\n}\n.vc-grayscale-color-item--white .vc-grayscale-dot {\n  background: #000;\n}\n.vc-grayscale-dot {\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  width: 6px;\n  height: 6px;\n  margin: -3px 0 0 -2px;\n  border-radius: 50%;\n  opacity: 1;\n  background: #fff;\n}\n",""])},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vc-grayscale",attrs:{role:"application","aria-label":"Grayscale color picker"}},[n("ul",{staticClass:"vc-grayscale-colors",attrs:{role:"listbox"}},e._l(e.paletteUpperCase(e.palette),function(t){return n("li",{key:t,staticClass:"vc-grayscale-color-item",class:{"vc-grayscale-color-item--white":"#FFFFFF"==t},style:{background:t},attrs:{role:"option","aria-label":"Color:"+t,"aria-selected":t===e.pick},on:{click:function(n){return e.handlerClick(t)}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t===e.pick,expression:"c === pick"}],staticClass:"vc-grayscale-dot"})])}),0)])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";function r(e){c||n(75)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(38),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(77),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/Material.vue",t.default=f.exports},function(e,t,n){var r=n(76);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("1ff3af73",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,'\n.vc-material {\n  width: 98px;\n  height: 98px;\n  padding: 16px;\n  font-family: "Roboto";\n  position: relative;\n  border-radius: 2px;\n  box-shadow: 0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16);\n  background-color: #fff;\n}\n.vc-material .vc-input__input {\n  width: 100%;\n  margin-top: 12px;\n  font-size: 15px;\n  color: #333;\n  height: 30px;\n}\n.vc-material .vc-input__label {\n  position: absolute;\n  top: 0;\n  left: 0;\n  font-size: 11px;\n  color: #999;\n  text-transform: capitalize;\n}\n.vc-material-hex {\n  border-bottom-width: 2px;\n  border-bottom-style: solid;\n}\n.vc-material-split {\n  display: flex;\n  margin-right: -10px;\n  padding-top: 11px;\n}\n.vc-material-third {\n  flex: 1;\n  padding-right: 10px;\n}\n',""])},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vc-material",attrs:{role:"application","aria-label":"Material color picker"}},[n("ed-in",{staticClass:"vc-material-hex",style:{borderColor:e.colors.hex},attrs:{label:"hex"},on:{change:e.onChange},model:{value:e.colors.hex,callback:function(t){e.$set(e.colors,"hex",t)},expression:"colors.hex"}}),e._v(" "),n("div",{staticClass:"vc-material-split"},[n("div",{staticClass:"vc-material-third"},[n("ed-in",{attrs:{label:"r"},on:{change:e.onChange},model:{value:e.colors.rgba.r,callback:function(t){e.$set(e.colors.rgba,"r",t)},expression:"colors.rgba.r"}})],1),e._v(" "),n("div",{staticClass:"vc-material-third"},[n("ed-in",{attrs:{label:"g"},on:{change:e.onChange},model:{value:e.colors.rgba.g,callback:function(t){e.$set(e.colors.rgba,"g",t)},expression:"colors.rgba.g"}})],1),e._v(" "),n("div",{staticClass:"vc-material-third"},[n("ed-in",{attrs:{label:"b"},on:{change:e.onChange},model:{value:e.colors.rgba.b,callback:function(t){e.$set(e.colors.rgba,"b",t)},expression:"colors.rgba.b"}})],1)])],1)},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";function r(e){c||n(79)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(39),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(114),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/Slider.vue",t.default=f.exports},function(e,t,n){var r=n(80);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("7982aa43",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-slider {\n  position: relative;\n  width: 410px;\n}\n.vc-slider-hue-warp {\n  height: 12px;\n  position: relative;\n}\n.vc-slider-hue-warp .vc-hue-picker {\n  width: 14px;\n  height: 14px;\n  border-radius: 6px;\n  transform: translate(-7px, -2px);\n  background-color: rgb(248, 248, 248);\n  box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.37);\n}\n.vc-slider-swatches {\n  display: flex;\n  margin-top: 20px;\n}\n.vc-slider-swatch {\n  margin-right: 1px;\n  flex: 1;\n  width: 20%;\n}\n.vc-slider-swatch:first-child {\n  margin-right: 1px;\n}\n.vc-slider-swatch:first-child .vc-slider-swatch-picker {\n  border-radius: 2px 0px 0px 2px;\n}\n.vc-slider-swatch:last-child {\n  margin-right: 0;\n}\n.vc-slider-swatch:last-child .vc-slider-swatch-picker {\n  border-radius: 0px 2px 2px 0px;\n}\n.vc-slider-swatch-picker {\n  cursor: pointer;\n  height: 12px;\n}\n.vc-slider-swatch:nth-child(n) .vc-slider-swatch-picker.vc-slider-swatch-picker--active {\n  transform: scaleY(1.8);\n  border-radius: 3.6px/2px;\n}\n.vc-slider-swatch-picker--white {\n  box-shadow: inset 0 0 0 1px #ddd;\n}\n.vc-slider-swatch-picker--active.vc-slider-swatch-picker--white {\n  box-shadow: inset 0 0 0 0.6px #ddd;\n}\n",""])},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(82),o=r(i),a=n(100),s=r(a),c="function"==typeof s.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":typeof e};t.default="function"==typeof s.default&&"symbol"===c(o.default)?function(e){return void 0===e?"undefined":c(e)}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":void 0===e?"undefined":c(e)}},function(e,t,n){e.exports={default:n(83),__esModule:!0}},function(e,t,n){n(84),n(96),e.exports=n(32).f("iterator")},function(e,t,n){"use strict";var r=n(85)(!0);n(40)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){var r=n(23),i=n(24);e.exports=function(e){return function(t,n){var o,a,s=String(i(t)),c=r(n),l=s.length;return c<0||c>=l?e?"":void 0:(o=s.charCodeAt(c),o<55296||o>56319||c+1===l||(a=s.charCodeAt(c+1))<56320||a>57343?e?s.charAt(c):o:e?s.slice(c,c+2):a-56320+(o-55296<<10)+65536)}}},function(e,t,n){var r=n(87);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){"use strict";var r=n(45),i=n(18),o=n(31),a={};n(7)(a,n(11)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(a,{next:i(1,n)}),o(e,t+" Iterator")}},function(e,t,n){var r=n(8),i=n(16),o=n(27);e.exports=n(9)?Object.defineProperties:function(e,t){i(e);for(var n,a=o(t),s=a.length,c=0;s>c;)r.f(e,n=a[c++],t[n]);return e}},function(e,t,n){var r=n(47);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(10),i=n(92),o=n(93);e.exports=function(e){return function(t,n,a){var s,c=r(t),l=i(c.length),u=o(a,l);if(e&&n!=n){for(;l>u;)if((s=c[u++])!=s)return!0}else for(;l>u;u++)if((e||u in c)&&c[u]===n)return e||u||0;return!e&&-1}}},function(e,t,n){var r=n(23),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t,n){var r=n(23),i=Math.max,o=Math.min;e.exports=function(e,t){return e=r(e),e<0?i(e+t,0):o(e,t)}},function(e,t,n){var r=n(4).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(6),i=n(48),o=n(28)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){n(97);for(var r=n(4),i=n(7),o=n(26),a=n(11)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),c=0;c<s.length;c++){var l=s[c],u=r[l],f=u&&u.prototype;f&&!f[a]&&i(f,a,l),o[l]=o.Array}},function(e,t,n){"use strict";var r=n(98),i=n(99),o=n(26),a=n(10);e.exports=n(40)(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,n):"values"==t?i(0,e[n]):i(0,[n,e[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){e.exports={default:n(101),__esModule:!0}},function(e,t,n){n(102),n(108),n(109),n(110),e.exports=n(15).Symbol},function(e,t,n){"use strict";var r=n(4),i=n(6),o=n(9),a=n(41),s=n(44),c=n(103).KEY,l=n(17),u=n(29),f=n(31),d=n(19),h=n(11),p=n(32),v=n(33),g=n(104),b=n(105),x=n(16),m=n(12),_=n(48),w=n(10),y=n(25),C=n(18),k=n(45),F=n(106),S=n(107),A=n(49),O=n(8),E=n(27),M=S.f,j=O.f,L=F.f,P=r.Symbol,R=r.JSON,D=R&&R.stringify,B=h("_hidden"),T=h("toPrimitive"),H={}.propertyIsEnumerable,N=u("symbol-registry"),z=u("symbols"),I=u("op-symbols"),$=Object.prototype,U="function"==typeof P&&!!A.f,G=r.QObject,V=!G||!G.prototype||!G.prototype.findChild,q=o&&l(function(){return 7!=k(j({},"a",{get:function(){return j(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=M($,t);r&&delete $[t],j(e,t,n),r&&e!==$&&j($,t,r)}:j,X=function(e){var t=z[e]=k(P.prototype);return t._k=e,t},W=U&&"symbol"==typeof P.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof P},Y=function(e,t,n){return e===$&&Y(I,t,n),x(e),t=y(t,!0),x(n),i(z,t)?(n.enumerable?(i(e,B)&&e[B][t]&&(e[B][t]=!1),n=k(n,{enumerable:C(0,!1)})):(i(e,B)||j(e,B,C(1,{})),e[B][t]=!0),q(e,t,n)):j(e,t,n)},J=function(e,t){x(e);for(var n,r=g(t=w(t)),i=0,o=r.length;o>i;)Y(e,n=r[i++],t[n]);return e},K=function(e,t){return void 0===t?k(e):J(k(e),t)},Z=function(e){var t=H.call(this,e=y(e,!0));return!(this===$&&i(z,e)&&!i(I,e))&&(!(t||!i(this,e)||!i(z,e)||i(this,B)&&this[B][e])||t)},Q=function(e,t){if(e=w(e),t=y(t,!0),e!==$||!i(z,t)||i(I,t)){var n=M(e,t);return!n||!i(z,t)||i(e,B)&&e[B][t]||(n.enumerable=!0),n}},ee=function(e){for(var t,n=L(w(e)),r=[],o=0;n.length>o;)i(z,t=n[o++])||t==B||t==c||r.push(t);return r},te=function(e){for(var t,n=e===$,r=L(n?I:w(e)),o=[],a=0;r.length>a;)!i(z,t=r[a++])||n&&!i($,t)||o.push(z[t]);return o};U||(P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var e=d(arguments.length>0?arguments[0]:void 0),t=function(n){this===$&&t.call(I,n),i(this,B)&&i(this[B],e)&&(this[B][e]=!1),q(this,e,C(1,n))};return o&&V&&q($,e,{configurable:!0,set:t}),X(e)},s(P.prototype,"toString",function(){return this._k}),S.f=Q,O.f=Y,n(50).f=F.f=ee,n(34).f=Z,A.f=te,o&&!n(14)&&s($,"propertyIsEnumerable",Z,!0),p.f=function(e){return X(h(e))}),a(a.G+a.W+a.F*!U,{Symbol:P});for(var ne="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),re=0;ne.length>re;)h(ne[re++]);for(var ie=E(h.store),oe=0;ie.length>oe;)v(ie[oe++]);a(a.S+a.F*!U,"Symbol",{for:function(e){return i(N,e+="")?N[e]:N[e]=P(e)},keyFor:function(e){if(!W(e))throw TypeError(e+" is not a symbol!");for(var t in N)if(N[t]===e)return t},useSetter:function(){V=!0},useSimple:function(){V=!1}}),a(a.S+a.F*!U,"Object",{create:K,defineProperty:Y,defineProperties:J,getOwnPropertyDescriptor:Q,getOwnPropertyNames:ee,getOwnPropertySymbols:te});var ae=l(function(){A.f(1)});a(a.S+a.F*ae,"Object",{getOwnPropertySymbols:function(e){return A.f(_(e))}}),R&&a(a.S+a.F*(!U||l(function(){var e=P();return"[null]"!=D([e])||"{}"!=D({a:e})||"{}"!=D(Object(e))})),"JSON",{stringify:function(e){for(var t,n,r=[e],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=t=r[1],(m(t)||void 0!==e)&&!W(e))return b(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!W(t))return t}),r[1]=t,D.apply(R,r)}}),P.prototype[T]||n(7)(P.prototype,T,P.prototype.valueOf),f(P,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(e,t,n){var r=n(19)("meta"),i=n(12),o=n(6),a=n(8).f,s=0,c=Object.isExtensible||function(){return!0},l=!n(17)(function(){return c(Object.preventExtensions({}))}),u=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},f=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!c(e))return"F";if(!t)return"E";u(e)}return e[r].i},d=function(e,t){if(!o(e,r)){if(!c(e))return!0;if(!t)return!1;u(e)}return e[r].w},h=function(e){return l&&p.NEED&&c(e)&&!o(e,r)&&u(e),e},p=e.exports={KEY:r,NEED:!1,fastKey:f,getWeak:d,onFreeze:h}},function(e,t,n){var r=n(27),i=n(49),o=n(34);e.exports=function(e){var t=r(e),n=i.f;if(n)for(var a,s=n(e),c=o.f,l=0;s.length>l;)c.call(e,a=s[l++])&&t.push(a);return t}},function(e,t,n){var r=n(47);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(10),i=n(50).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(e){try{return i(e)}catch(e){return a.slice()}};e.exports.f=function(e){return a&&"[object Window]"==o.call(e)?s(e):i(r(e))}},function(e,t,n){var r=n(34),i=n(18),o=n(10),a=n(25),s=n(6),c=n(42),l=Object.getOwnPropertyDescriptor;t.f=n(9)?l:function(e,t){if(e=o(e),t=a(t,!0),c)try{return l(e,t)}catch(e){}if(s(e,t))return i(!r.f.call(e,t),e[t])}},function(e,t){},function(e,t,n){n(33)("asyncIterator")},function(e,t,n){n(33)("observable")},function(e,t,n){var r=n(112);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("7c5f1a1c",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-hue {\n  position: absolute;\n  top: 0px;\n  right: 0px;\n  bottom: 0px;\n  left: 0px;\n  border-radius: 2px;\n}\n.vc-hue--horizontal {\n  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n}\n.vc-hue--vertical {\n  background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n}\n.vc-hue-container {\n  cursor: pointer;\n  margin: 0 2px;\n  position: relative;\n  height: 100%;\n}\n.vc-hue-pointer {\n  z-index: 2;\n  position: absolute;\n}\n.vc-hue-picker {\n  cursor: pointer;\n  margin-top: 1px;\n  width: 4px;\n  border-radius: 1px;\n  height: 8px;\n  box-shadow: 0 0 2px rgba(0, 0, 0, .6);\n  background: #fff;\n  transform: translateX(-2px) ;\n}\n",""])},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{class:["vc-hue",e.directionClass]},[n("div",{ref:"container",staticClass:"vc-hue-container",attrs:{role:"slider","aria-valuenow":e.colors.hsl.h,"aria-valuemin":"0","aria-valuemax":"360"},on:{mousedown:e.handleMouseDown,touchmove:e.handleChange,touchstart:e.handleChange}},[n("div",{staticClass:"vc-hue-pointer",style:{top:e.pointerTop,left:e.pointerLeft},attrs:{role:"presentation"}},[n("div",{staticClass:"vc-hue-picker"})])])])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vc-slider",attrs:{role:"application","aria-label":"Slider color picker"}},[n("div",{staticClass:"vc-slider-hue-warp"},[n("hue",{on:{change:e.hueChange},model:{value:e.colors,callback:function(t){e.colors=t},expression:"colors"}})],1),e._v(" "),n("div",{staticClass:"vc-slider-swatches",attrs:{role:"group"}},e._l(e.normalizedSwatches,function(t,r){return n("div",{key:r,staticClass:"vc-slider-swatch",attrs:{"data-index":r,"aria-label":"color:"+e.colors.hex,role:"button"},on:{click:function(n){return e.handleSwClick(r,t)}}},[n("div",{staticClass:"vc-slider-swatch-picker",class:{"vc-slider-swatch-picker--active":e.isActive(t,r),"vc-slider-swatch-picker--white":1===t.l},style:{background:"hsl("+e.colors.hsl.h+", "+100*t.s+"%, "+100*t.l+"%)"}})])}),0)])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";function r(e){c||n(116)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(52),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(119),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/Swatches.vue",t.default=f.exports},function(e,t,n){var r=n(117);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("10f839a2",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-swatches {\n  width: 320px;\n  height: 240px;\n  overflow-y: scroll;\n  background-color: #fff;\n  box-shadow: 0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16);\n}\n.vc-swatches-box {\n  padding: 16px 0 6px 16px;\n  overflow: hidden;\n}\n.vc-swatches-color-group {\n  padding-bottom: 10px;\n  width: 40px;\n  float: left;\n  margin-right: 10px;\n}\n.vc-swatches-color-it {\n  box-sizing: border-box;\n  width: 40px;\n  height: 24px;\n  cursor: pointer;\n  background: #880e4f;\n  margin-bottom: 1px;\n  overflow: hidden;\n  -ms-border-radius: 2px 2px 0 0;\n  -moz-border-radius: 2px 2px 0 0;\n  -o-border-radius: 2px 2px 0 0;\n  -webkit-border-radius: 2px 2px 0 0;\n  border-radius: 2px 2px 0 0;\n}\n.vc-swatches-color--white {\n  border: 1px solid #DDD;\n}\n.vc-swatches-pick {\n  fill: rgb(255, 255, 255);\n  margin-left: 8px;\n  display: block;\n}\n.vc-swatches-color--white .vc-swatches-pick {\n  fill: rgb(51, 51, 51);\n}\n",""])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"red",function(){return r}),n.d(t,"pink",function(){return i}),n.d(t,"purple",function(){return o}),n.d(t,"deepPurple",function(){return a}),n.d(t,"indigo",function(){return s}),n.d(t,"blue",function(){return c}),n.d(t,"lightBlue",function(){return l}),n.d(t,"cyan",function(){return u}),n.d(t,"teal",function(){return f}),n.d(t,"green",function(){return d}),n.d(t,"lightGreen",function(){return h}),n.d(t,"lime",function(){return p}),n.d(t,"yellow",function(){return v}),n.d(t,"amber",function(){return g}),n.d(t,"orange",function(){return b}),n.d(t,"deepOrange",function(){return x}),n.d(t,"brown",function(){return m}),n.d(t,"grey",function(){return _}),n.d(t,"blueGrey",function(){return w}),n.d(t,"darkText",function(){return y}),n.d(t,"lightText",function(){return C}),n.d(t,"darkIcons",function(){return k}),n.d(t,"lightIcons",function(){return F}),n.d(t,"white",function(){return S}),n.d(t,"black",function(){return A});var r={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",a100:"#ff8a80",a200:"#ff5252",a400:"#ff1744",a700:"#d50000"},i={50:"#fce4ec",100:"#f8bbd0",200:"#f48fb1",300:"#f06292",400:"#ec407a",500:"#e91e63",600:"#d81b60",700:"#c2185b",800:"#ad1457",900:"#880e4f",a100:"#ff80ab",a200:"#ff4081",a400:"#f50057",a700:"#c51162"},o={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",a100:"#ea80fc",a200:"#e040fb",a400:"#d500f9",a700:"#aa00ff"},a={50:"#ede7f6",100:"#d1c4e9",200:"#b39ddb",300:"#9575cd",400:"#7e57c2",500:"#673ab7",600:"#5e35b1",700:"#512da8",800:"#4527a0",900:"#311b92",a100:"#b388ff",a200:"#7c4dff",a400:"#651fff",a700:"#6200ea"},s={50:"#e8eaf6",100:"#c5cae9",200:"#9fa8da",300:"#7986cb",400:"#5c6bc0",500:"#3f51b5",600:"#3949ab",700:"#303f9f",800:"#283593",900:"#1a237e",a100:"#8c9eff",a200:"#536dfe",a400:"#3d5afe",a700:"#304ffe"},c={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",a100:"#82b1ff",a200:"#448aff",a400:"#2979ff",a700:"#2962ff"},l={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",a100:"#80d8ff",a200:"#40c4ff",a400:"#00b0ff",a700:"#0091ea"},u={50:"#e0f7fa",100:"#b2ebf2",200:"#80deea",300:"#4dd0e1",400:"#26c6da",500:"#00bcd4",600:"#00acc1",700:"#0097a7",800:"#00838f",900:"#006064",a100:"#84ffff",a200:"#18ffff",a400:"#00e5ff",a700:"#00b8d4"},f={50:"#e0f2f1",100:"#b2dfdb",200:"#80cbc4",300:"#4db6ac",400:"#26a69a",500:"#009688",600:"#00897b",700:"#00796b",800:"#00695c",900:"#004d40",a100:"#a7ffeb",a200:"#64ffda",a400:"#1de9b6",a700:"#00bfa5"},d={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",a100:"#b9f6ca",a200:"#69f0ae",a400:"#00e676",a700:"#00c853"},h={50:"#f1f8e9",100:"#dcedc8",200:"#c5e1a5",300:"#aed581",400:"#9ccc65",500:"#8bc34a",600:"#7cb342",700:"#689f38",800:"#558b2f",900:"#33691e",a100:"#ccff90",a200:"#b2ff59",a400:"#76ff03",a700:"#64dd17"},p={50:"#f9fbe7",100:"#f0f4c3",200:"#e6ee9c",300:"#dce775",400:"#d4e157",500:"#cddc39",600:"#c0ca33",700:"#afb42b",800:"#9e9d24",900:"#827717",a100:"#f4ff81",a200:"#eeff41",a400:"#c6ff00",a700:"#aeea00"},v={50:"#fffde7",100:"#fff9c4",200:"#fff59d",300:"#fff176",400:"#ffee58",500:"#ffeb3b",600:"#fdd835",700:"#fbc02d",800:"#f9a825",900:"#f57f17",a100:"#ffff8d",a200:"#ffff00",a400:"#ffea00",a700:"#ffd600"},g={50:"#fff8e1",100:"#ffecb3",200:"#ffe082",300:"#ffd54f",400:"#ffca28",500:"#ffc107",600:"#ffb300",700:"#ffa000",800:"#ff8f00",900:"#ff6f00",a100:"#ffe57f",a200:"#ffd740",a400:"#ffc400",a700:"#ffab00"},b={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",a100:"#ffd180",a200:"#ffab40",a400:"#ff9100",a700:"#ff6d00"},x={50:"#fbe9e7",100:"#ffccbc",200:"#ffab91",300:"#ff8a65",400:"#ff7043",500:"#ff5722",600:"#f4511e",700:"#e64a19",800:"#d84315",900:"#bf360c",a100:"#ff9e80",a200:"#ff6e40",a400:"#ff3d00",a700:"#dd2c00"},m={50:"#efebe9",100:"#d7ccc8",200:"#bcaaa4",300:"#a1887f",400:"#8d6e63",500:"#795548",600:"#6d4c41",700:"#5d4037",800:"#4e342e",900:"#3e2723"},_={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121"},w={50:"#eceff1",100:"#cfd8dc",200:"#b0bec5",300:"#90a4ae",400:"#78909c",500:"#607d8b",600:"#546e7a",700:"#455a64",800:"#37474f",900:"#263238"},y={primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.54)",disabled:"rgba(0, 0, 0, 0.38)",dividers:"rgba(0, 0, 0, 0.12)"},C={primary:"rgba(255, 255, 255, 1)",secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",dividers:"rgba(255, 255, 255, 0.12)"},k={active:"rgba(0, 0, 0, 0.54)",inactive:"rgba(0, 0, 0, 0.38)"},F={active:"rgba(255, 255, 255, 1)",inactive:"rgba(255, 255, 255, 0.5)"},S="#ffffff",A="#000000";t.default={red:r,pink:i,purple:o,deepPurple:a,indigo:s,blue:c,lightBlue:l,cyan:u,teal:f,green:d,lightGreen:h,lime:p,yellow:v,amber:g,orange:b,deepOrange:x,brown:m,grey:_,blueGrey:w,darkText:y,lightText:C,darkIcons:k,lightIcons:F,white:S,black:A}},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vc-swatches",attrs:{role:"application","aria-label":"Swatches color picker","data-pick":e.pick}},[n("div",{staticClass:"vc-swatches-box",attrs:{role:"listbox"}},e._l(e.palette,function(t,r){return n("div",{key:r,staticClass:"vc-swatches-color-group"},e._l(t,function(t){return n("div",{key:t,class:["vc-swatches-color-it",{"vc-swatches-color--white":"#FFFFFF"===t}],style:{background:t},attrs:{role:"option","aria-label":"Color:"+t,"aria-selected":e.equal(t),"data-color":t},on:{click:function(n){return e.handlerClick(t)}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:e.equal(t),expression:"equal(c)"}],staticClass:"vc-swatches-pick"},[n("svg",{staticStyle:{width:"24px",height:"24px"},attrs:{viewBox:"0 0 24 24"}},[n("path",{attrs:{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}})])])])}),0)}),0)])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";function r(e){c||n(121)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(53),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(134),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/Photoshop.vue",t.default=f.exports},function(e,t,n){var r=n(122);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("080365d4",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,'\n.vc-photoshop {\n  background: #DCDCDC;\n  border-radius: 4px;\n  box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 8px 16px rgba(0,0,0,.15);\n  box-sizing: initial;\n  width: 513px;\n  font-family: Roboto;\n}\n.vc-photoshop__disable-fields {\n  width: 390px;\n}\n.vc-ps-head {\n  background-image: linear-gradient(-180deg, #F0F0F0 0%, #D4D4D4 100%);\n  border-bottom: 1px solid #B1B1B1;\n  box-shadow: inset 0 1px 0 0 rgba(255,255,255,.2), inset 0 -1px 0 0 rgba(0,0,0,.02);\n  height: 23px;\n  line-height: 24px;\n  border-radius: 4px 4px 0 0;\n  font-size: 13px;\n  color: #4D4D4D;\n  text-align: center;\n}\n.vc-ps-body {\n  padding: 15px;\n  display: flex;\n}\n.vc-ps-saturation-wrap {\n  width: 256px;\n  height: 256px;\n  position: relative;\n  border: 2px solid #B3B3B3;\n  border-bottom: 2px solid #F0F0F0;\n  overflow: hidden;\n}\n.vc-ps-saturation-wrap .vc-saturation-circle {\n  width: 12px;\n  height: 12px;\n}\n.vc-ps-hue-wrap {\n  position: relative;\n  height: 256px;\n  width: 19px;\n  margin-left: 10px;\n  border: 2px solid #B3B3B3;\n  border-bottom: 2px solid #F0F0F0;\n}\n.vc-ps-hue-pointer {\n  position: relative;\n}\n.vc-ps-hue-pointer--left,\n.vc-ps-hue-pointer--right {\n  position: absolute;\n  width: 0;\n  height: 0;\n  border-style: solid;\n  border-width: 5px 0 5px 8px;\n  border-color: transparent transparent transparent #555;\n}\n.vc-ps-hue-pointer--left:after,\n.vc-ps-hue-pointer--right:after {\n  content: "";\n  width: 0;\n  height: 0;\n  border-style: solid;\n  border-width: 4px 0 4px 6px;\n  border-color: transparent transparent transparent #fff;\n  position: absolute;\n  top: 1px;\n  left: 1px;\n  transform: translate(-8px, -5px);\n}\n.vc-ps-hue-pointer--left {\n  transform: translate(-13px, -4px);\n}\n.vc-ps-hue-pointer--right {\n  transform: translate(20px, -4px) rotate(180deg);\n}\n.vc-ps-controls {\n  width: 180px;\n  margin-left: 10px;\n  display: flex;\n}\n.vc-ps-controls__disable-fields {\n  width: auto;\n}\n.vc-ps-actions {\n  margin-left: 20px;\n  flex: 1;\n}\n.vc-ps-ac-btn {\n  cursor: pointer;\n  background-image: linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%);\n  border: 1px solid #878787;\n  border-radius: 2px;\n  height: 20px;\n  box-shadow: 0 1px 0 0 #EAEAEA;\n  font-size: 14px;\n  color: #000;\n  line-height: 20px;\n  text-align: center;\n  margin-bottom: 10px;\n}\n.vc-ps-previews {\n  width: 60px;\n}\n.vc-ps-previews__swatches {\n  border: 1px solid #B3B3B3;\n  border-bottom: 1px solid #F0F0F0;\n  margin-bottom: 2px;\n  margin-top: 1px;\n}\n.vc-ps-previews__pr-color {\n  height: 34px;\n  box-shadow: inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000;\n}\n.vc-ps-previews__label {\n  font-size: 14px;\n  color: #000;\n  text-align: center;\n}\n.vc-ps-fields {\n  padding-top: 5px;\n  padding-bottom: 9px;\n  width: 80px;\n  position: relative;\n}\n.vc-ps-fields .vc-input__input {\n  margin-left: 40%;\n  width: 40%;\n  height: 18px;\n  border: 1px solid #888888;\n  box-shadow: inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC;\n  margin-bottom: 5px;\n  font-size: 13px;\n  padding-left: 3px;\n  margin-right: 10px;\n}\n.vc-ps-fields .vc-input__label, .vc-ps-fields .vc-input__desc {\n  top: 0;\n  text-transform: uppercase;\n  font-size: 13px;\n  height: 18px;\n  line-height: 22px;\n  position: absolute;\n}\n.vc-ps-fields .vc-input__label {\n  left: 0;\n  width: 34px;\n}\n.vc-ps-fields .vc-input__desc {\n  right: 0;\n  width: 0;\n}\n.vc-ps-fields__divider {\n  height: 5px;\n}\n.vc-ps-fields__hex .vc-input__input {\n  margin-left: 20%;\n  width: 80%;\n  height: 18px;\n  border: 1px solid #888888;\n  box-shadow: inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC;\n  margin-bottom: 6px;\n  font-size: 13px;\n  padding-left: 3px;\n}\n.vc-ps-fields__hex .vc-input__label {\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 14px;\n  text-transform: uppercase;\n  font-size: 13px;\n  height: 18px;\n  line-height: 22px;\n}\n',""])},function(e,t,n){var r=n(124);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("b5380e52",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-saturation,\n.vc-saturation--white,\n.vc-saturation--black {\n  cursor: pointer;\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n}\n.vc-saturation--white {\n  background: linear-gradient(to right, #fff, rgba(255,255,255,0));\n}\n.vc-saturation--black {\n  background: linear-gradient(to top, #000, rgba(0,0,0,0));\n}\n.vc-saturation-pointer {\n  cursor: pointer;\n  position: absolute;\n}\n.vc-saturation-circle {\n  cursor: head;\n  width: 4px;\n  height: 4px;\n  box-shadow: 0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3), 0 0 1px 2px rgba(0,0,0,.4);\n  border-radius: 50%;\n  transform: translate(-2px, -2px);\n}\n",""])},function(e,t){function n(e,t,n){return t<n?e<t?t:e>n?n:e:e<n?n:e>t?t:e}e.exports=n},function(e,t){function n(e,t,n){function r(t){var n=v,r=g;return v=g=void 0,k=t,x=e.apply(r,n)}function o(e){return k=e,m=setTimeout(u,t),F?r(e):x}function a(e){var n=e-_,r=e-k,i=t-n;return S?y(i,b-r):i}function l(e){var n=e-_,r=e-k;return void 0===_||n>=t||n<0||S&&r>=b}function u(){var e=C();if(l(e))return f(e);m=setTimeout(u,a(e))}function f(e){return m=void 0,A&&v?r(e):(v=g=void 0,x)}function d(){void 0!==m&&clearTimeout(m),k=0,v=_=g=m=void 0}function h(){return void 0===m?x:f(C())}function p(){var e=C(),n=l(e);if(v=arguments,g=this,_=e,n){if(void 0===m)return o(_);if(S)return m=setTimeout(u,t),r(_)}return void 0===m&&(m=setTimeout(u,t)),x}var v,g,b,x,m,_,k=0,F=!1,S=!1,A=!0;if("function"!=typeof e)throw new TypeError(c);return t=s(t)||0,i(n)&&(F=!!n.leading,S="maxWait"in n,b=S?w(s(n.maxWait)||0,t):b,A="trailing"in n?!!n.trailing:A),p.cancel=d,p.flush=h,p}function r(e,t,r){var o=!0,a=!0;if("function"!=typeof e)throw new TypeError(c);return i(r)&&(o="leading"in r?!!r.leading:o,a="trailing"in r?!!r.trailing:a),n(e,t,{leading:o,maxWait:t,trailing:a})}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function o(e){return!!e&&"object"==typeof e}function a(e){return"symbol"==typeof e||o(e)&&_.call(e)==u}function s(e){if("number"==typeof e)return e;if(a(e))return l;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(f,"");var n=h.test(e);return n||p.test(e)?v(e.slice(2),n?2:8):d.test(e)?l:+e}var c="Expected a function",l=NaN,u="[object Symbol]",f=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,p=/^0o[0-7]+$/i,v=parseInt,g="object"==typeof global&&global&&global.Object===Object&&global,b="object"==typeof self&&self&&self.Object===Object&&self,x=g||b||Function("return this")(),m=Object.prototype,_=m.toString,w=Math.max,y=Math.min,C=function(){return x.Date.now()};e.exports=r},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{ref:"container",staticClass:"vc-saturation",style:{background:e.bgColor},on:{mousedown:e.handleMouseDown,touchmove:e.handleChange,touchstart:e.handleChange}},[n("div",{staticClass:"vc-saturation--white"}),e._v(" "),n("div",{staticClass:"vc-saturation--black"}),e._v(" "),n("div",{staticClass:"vc-saturation-pointer",style:{top:e.pointerTop,left:e.pointerLeft}},[n("div",{staticClass:"vc-saturation-circle"})])])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){var r=n(129);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("4dc1b086",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-alpha {\n  position: absolute;\n  top: 0px;\n  right: 0px;\n  bottom: 0px;\n  left: 0px;\n}\n.vc-alpha-checkboard-wrap {\n  position: absolute;\n  top: 0px;\n  right: 0px;\n  bottom: 0px;\n  left: 0px;\n  overflow: hidden;\n}\n.vc-alpha-gradient {\n  position: absolute;\n  top: 0px;\n  right: 0px;\n  bottom: 0px;\n  left: 0px;\n}\n.vc-alpha-container {\n  cursor: pointer;\n  position: relative;\n  z-index: 2;\n  height: 100%;\n  margin: 0 3px;\n}\n.vc-alpha-pointer {\n  z-index: 2;\n  position: absolute;\n}\n.vc-alpha-picker {\n  cursor: pointer;\n  width: 4px;\n  border-radius: 1px;\n  height: 8px;\n  box-shadow: 0 0 2px rgba(0, 0, 0, .6);\n  background: #fff;\n  margin-top: 1px;\n  transform: translateX(-2px);\n}\n",""])},function(e,t,n){var r=n(131);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("7e15c05b",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-checkerboard {\n  position: absolute;\n  top: 0px;\n  right: 0px;\n  bottom: 0px;\n  left: 0px;\n  background-size: contain;\n}\n",""])},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{staticClass:"vc-checkerboard",style:e.bgStyle})},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vc-alpha"},[n("div",{staticClass:"vc-alpha-checkboard-wrap"},[n("checkboard")],1),e._v(" "),n("div",{staticClass:"vc-alpha-gradient",style:{background:e.gradientColor}}),e._v(" "),n("div",{ref:"container",staticClass:"vc-alpha-container",on:{mousedown:e.handleMouseDown,touchmove:e.handleChange,touchstart:e.handleChange}},[n("div",{staticClass:"vc-alpha-pointer",style:{left:100*e.colors.a+"%"}},[n("div",{staticClass:"vc-alpha-picker"})])])])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{class:["vc-photoshop",e.disableFields?"vc-photoshop__disable-fields":""],attrs:{role:"application","aria-label":"PhotoShop color picker"}},[n("div",{staticClass:"vc-ps-head",attrs:{role:"heading"}},[e._v(e._s(e.head))]),e._v(" "),n("div",{staticClass:"vc-ps-body"},[n("div",{staticClass:"vc-ps-saturation-wrap"},[n("saturation",{on:{change:e.childChange},model:{value:e.colors,callback:function(t){e.colors=t},expression:"colors"}})],1),e._v(" "),n("div",{staticClass:"vc-ps-hue-wrap"},[n("hue",{attrs:{direction:"vertical"},on:{change:e.childChange},model:{value:e.colors,callback:function(t){e.colors=t},expression:"colors"}},[n("div",{staticClass:"vc-ps-hue-pointer"},[n("i",{staticClass:"vc-ps-hue-pointer--left"}),n("i",{staticClass:"vc-ps-hue-pointer--right"})])])],1),e._v(" "),n("div",{class:["vc-ps-controls",e.disableFields?"vc-ps-controls__disable-fields":""]},[n("div",{staticClass:"vc-ps-previews"},[n("div",{staticClass:"vc-ps-previews__label"},[e._v(e._s(e.newLabel))]),e._v(" "),n("div",{staticClass:"vc-ps-previews__swatches"},[n("div",{staticClass:"vc-ps-previews__pr-color",style:{background:e.colors.hex},attrs:{"aria-label":"New color is "+e.colors.hex}}),e._v(" "),n("div",{staticClass:"vc-ps-previews__pr-color",style:{background:e.currentColor},attrs:{"aria-label":"Current color is "+e.currentColor},on:{click:e.clickCurrentColor}})]),e._v(" "),n("div",{staticClass:"vc-ps-previews__label"},[e._v(e._s(e.currentLabel))])]),e._v(" "),e.disableFields?e._e():n("div",{staticClass:"vc-ps-actions"},[n("div",{staticClass:"vc-ps-ac-btn",attrs:{role:"button","aria-label":e.acceptLabel},on:{click:e.handleAccept}},[e._v(e._s(e.acceptLabel))]),e._v(" "),n("div",{staticClass:"vc-ps-ac-btn",attrs:{role:"button","aria-label":e.cancelLabel},on:{click:e.handleCancel}},[e._v(e._s(e.cancelLabel))]),e._v(" "),n("div",{staticClass:"vc-ps-fields"},[n("ed-in",{attrs:{label:"h",desc:"°",value:e.hsv.h},on:{change:e.inputChange}}),e._v(" "),n("ed-in",{attrs:{label:"s",desc:"%",value:e.hsv.s,max:100},on:{change:e.inputChange}}),e._v(" "),n("ed-in",{attrs:{label:"v",desc:"%",value:e.hsv.v,max:100},on:{change:e.inputChange}}),e._v(" "),n("div",{staticClass:"vc-ps-fields__divider"}),e._v(" "),n("ed-in",{attrs:{label:"r",value:e.colors.rgba.r},on:{change:e.inputChange}}),e._v(" "),n("ed-in",{attrs:{label:"g",value:e.colors.rgba.g},on:{change:e.inputChange}}),e._v(" "),n("ed-in",{attrs:{label:"b",value:e.colors.rgba.b},on:{change:e.inputChange}}),e._v(" "),n("div",{staticClass:"vc-ps-fields__divider"}),e._v(" "),n("ed-in",{staticClass:"vc-ps-fields__hex",attrs:{label:"#",value:e.hex},on:{change:e.inputChange}})],1),e._v(" "),e.hasResetButton?n("div",{staticClass:"vc-ps-ac-btn",attrs:{"aria-label":"reset"},on:{click:e.handleReset}},[e._v(e._s(e.resetLabel))]):e._e()])])])])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";function r(e){c||n(136)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(57),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(138),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/Sketch.vue",t.default=f.exports},function(e,t,n){var r=n(137);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("612c6604",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-sketch {\n  position: relative;\n  width: 200px;\n  padding: 10px 10px 0;\n  box-sizing: initial;\n  background: #fff;\n  border-radius: 4px;\n  box-shadow: 0 0 0 1px rgba(0, 0, 0, .15), 0 8px 16px rgba(0, 0, 0, .15);\n}\n.vc-sketch-saturation-wrap {\n  width: 100%;\n  padding-bottom: 75%;\n  position: relative;\n  overflow: hidden;\n}\n.vc-sketch-controls {\n  display: flex;\n}\n.vc-sketch-sliders {\n  padding: 4px 0;\n  flex: 1;\n}\n.vc-sketch-sliders .vc-hue,\n.vc-sketch-sliders .vc-alpha-gradient {\n  border-radius: 2px;\n}\n.vc-sketch-hue-wrap {\n  position: relative;\n  height: 10px;\n}\n.vc-sketch-alpha-wrap {\n  position: relative;\n  height: 10px;\n  margin-top: 4px;\n  overflow: hidden;\n}\n.vc-sketch-color-wrap {\n  width: 24px;\n  height: 24px;\n  position: relative;\n  margin-top: 4px;\n  margin-left: 4px;\n  border-radius: 3px;\n}\n.vc-sketch-active-color {\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  border-radius: 2px;\n  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), inset 0 0 4px rgba(0, 0, 0, .25);\n  z-index: 2;\n}\n.vc-sketch-color-wrap .vc-checkerboard {\n  background-size: auto;\n}\n.vc-sketch-field {\n  display: flex;\n  padding-top: 4px;\n}\n.vc-sketch-field .vc-input__input {\n  width: 90%;\n  padding: 4px 0 3px 10%;\n  border: none;\n  box-shadow: inset 0 0 0 1px #ccc;\n  font-size: 10px;\n}\n.vc-sketch-field .vc-input__label {\n  display: block;\n  text-align: center;\n  font-size: 11px;\n  color: #222;\n  padding-top: 3px;\n  padding-bottom: 4px;\n  text-transform: capitalize;\n}\n.vc-sketch-field--single {\n  flex: 1;\n  padding-left: 6px;\n}\n.vc-sketch-field--double {\n  flex: 2;\n}\n.vc-sketch-presets {\n  margin-right: -10px;\n  margin-left: -10px;\n  padding-left: 10px;\n  padding-top: 10px;\n  border-top: 1px solid #eee;\n}\n.vc-sketch-presets-color {\n  border-radius: 3px;\n  overflow: hidden;\n  position: relative;\n  display: inline-block;\n  margin: 0 10px 10px 0;\n  vertical-align: top;\n  cursor: pointer;\n  width: 16px;\n  height: 16px;\n  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);\n}\n.vc-sketch-presets-color .vc-checkerboard {\n  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);\n  border-radius: 3px;\n}\n.vc-sketch__disable-alpha .vc-sketch-color-wrap {\n  height: 10px;\n}\n",""])},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{class:["vc-sketch",e.disableAlpha?"vc-sketch__disable-alpha":""],attrs:{role:"application","aria-label":"Sketch color picker"}},[n("div",{staticClass:"vc-sketch-saturation-wrap"},[n("saturation",{on:{change:e.childChange},model:{value:e.colors,callback:function(t){e.colors=t},expression:"colors"}})],1),e._v(" "),n("div",{staticClass:"vc-sketch-controls"},[n("div",{staticClass:"vc-sketch-sliders"},[n("div",{staticClass:"vc-sketch-hue-wrap"},[n("hue",{on:{change:e.childChange},model:{value:e.colors,callback:function(t){e.colors=t},expression:"colors"}})],1),e._v(" "),e.disableAlpha?e._e():n("div",{staticClass:"vc-sketch-alpha-wrap"},[n("alpha",{on:{change:e.childChange},model:{value:e.colors,callback:function(t){e.colors=t},expression:"colors"}})],1)]),e._v(" "),n("div",{staticClass:"vc-sketch-color-wrap"},[n("div",{staticClass:"vc-sketch-active-color",style:{background:e.activeColor},attrs:{"aria-label":"Current color is "+e.activeColor}}),e._v(" "),n("checkboard")],1)]),e._v(" "),e.disableFields?e._e():n("div",{staticClass:"vc-sketch-field"},[n("div",{staticClass:"vc-sketch-field--double"},[n("ed-in",{attrs:{label:"hex",value:e.hex},on:{change:e.inputChange}})],1),e._v(" "),n("div",{staticClass:"vc-sketch-field--single"},[n("ed-in",{attrs:{label:"r",value:e.colors.rgba.r},on:{change:e.inputChange}})],1),e._v(" "),n("div",{staticClass:"vc-sketch-field--single"},[n("ed-in",{attrs:{label:"g",value:e.colors.rgba.g},on:{change:e.inputChange}})],1),e._v(" "),n("div",{staticClass:"vc-sketch-field--single"},[n("ed-in",{attrs:{label:"b",value:e.colors.rgba.b},on:{change:e.inputChange}})],1),e._v(" "),e.disableAlpha?e._e():n("div",{staticClass:"vc-sketch-field--single"},[n("ed-in",{attrs:{label:"a",value:e.colors.a,"arrow-offset":.01,max:1},on:{change:e.inputChange}})],1)]),e._v(" "),n("div",{staticClass:"vc-sketch-presets",attrs:{role:"group","aria-label":"A color preset, pick one to set as current color"}},[e._l(e.presetColors,function(t){return[e.isTransparent(t)?n("div",{key:t,staticClass:"vc-sketch-presets-color",attrs:{"aria-label":"Color:"+t},on:{click:function(n){return e.handlePreset(t)}}},[n("checkboard")],1):n("div",{key:t,staticClass:"vc-sketch-presets-color",style:{background:t},attrs:{"aria-label":"Color:"+t},on:{click:function(n){return e.handlePreset(t)}}})]})],2)])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";function r(e){c||n(140)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(58),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(142),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/Chrome.vue",t.default=f.exports},function(e,t,n){var r=n(141);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("1cd16048",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-chrome {\n  background: #fff;\n  border-radius: 2px;\n  box-shadow: 0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3);\n  box-sizing: initial;\n  width: 225px;\n  font-family: Menlo;\n  background-color: #fff;\n}\n.vc-chrome-controls {\n  display: flex;\n}\n.vc-chrome-color-wrap {\n  position: relative;\n  width: 36px;\n}\n.vc-chrome-active-color {\n  position: relative;\n  width: 30px;\n  height: 30px;\n  border-radius: 15px;\n  overflow: hidden;\n  z-index: 1;\n}\n.vc-chrome-color-wrap .vc-checkerboard {\n  width: 30px;\n  height: 30px;\n  border-radius: 15px;\n  background-size: auto;\n}\n.vc-chrome-sliders {\n  flex: 1;\n}\n.vc-chrome-fields-wrap {\n  display: flex;\n  padding-top: 16px;\n}\n.vc-chrome-fields {\n  display: flex;\n  margin-left: -6px;\n  flex: 1;\n}\n.vc-chrome-field {\n  padding-left: 6px;\n  width: 100%;\n}\n.vc-chrome-toggle-btn {\n  width: 32px;\n  text-align: right;\n  position: relative;\n}\n.vc-chrome-toggle-icon {\n  margin-right: -4px;\n  margin-top: 12px;\n  cursor: pointer;\n  position: relative;\n  z-index: 2;\n}\n.vc-chrome-toggle-icon-highlight {\n  position: absolute;\n  width: 24px;\n  height: 28px;\n  background: #eee;\n  border-radius: 4px;\n  top: 10px;\n  left: 12px;\n}\n.vc-chrome-hue-wrap {\n  position: relative;\n  height: 10px;\n  margin-bottom: 8px;\n}\n.vc-chrome-alpha-wrap {\n  position: relative;\n  height: 10px;\n}\n.vc-chrome-hue-wrap .vc-hue {\n  border-radius: 2px;\n}\n.vc-chrome-alpha-wrap .vc-alpha-gradient {\n  border-radius: 2px;\n}\n.vc-chrome-hue-wrap .vc-hue-picker, .vc-chrome-alpha-wrap .vc-alpha-picker {\n  width: 12px;\n  height: 12px;\n  border-radius: 6px;\n  transform: translate(-6px, -2px);\n  background-color: rgb(248, 248, 248);\n  box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.37);\n}\n.vc-chrome-body {\n  padding: 16px 16px 12px;\n  background-color: #fff;\n}\n.vc-chrome-saturation-wrap {\n  width: 100%;\n  padding-bottom: 55%;\n  position: relative;\n  border-radius: 2px 2px 0 0;\n  overflow: hidden;\n}\n.vc-chrome-saturation-wrap .vc-saturation-circle {\n  width: 12px;\n  height: 12px;\n}\n.vc-chrome-fields .vc-input__input {\n  font-size: 11px;\n  color: #333;\n  width: 100%;\n  border-radius: 2px;\n  border: none;\n  box-shadow: inset 0 0 0 1px #dadada;\n  height: 21px;\n  text-align: center;\n}\n.vc-chrome-fields .vc-input__label {\n  text-transform: uppercase;\n  font-size: 11px;\n  line-height: 11px;\n  color: #969696;\n  text-align: center;\n  display: block;\n  margin-top: 12px;\n}\n.vc-chrome__disable-alpha .vc-chrome-active-color {\n  width: 18px;\n  height: 18px;\n}\n.vc-chrome__disable-alpha .vc-chrome-color-wrap {\n  width: 30px;\n}\n.vc-chrome__disable-alpha .vc-chrome-hue-wrap {\n  margin-top: 4px;\n  margin-bottom: 4px;\n}\n",""])},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{class:["vc-chrome",e.disableAlpha?"vc-chrome__disable-alpha":""],attrs:{role:"application","aria-label":"Chrome color picker"}},[n("div",{staticClass:"vc-chrome-saturation-wrap"},[n("saturation",{on:{change:e.childChange},model:{value:e.colors,callback:function(t){e.colors=t},expression:"colors"}})],1),e._v(" "),n("div",{staticClass:"vc-chrome-body"},[n("div",{staticClass:"vc-chrome-controls"},[n("div",{staticClass:"vc-chrome-color-wrap"},[n("div",{staticClass:"vc-chrome-active-color",style:{background:e.activeColor},attrs:{"aria-label":"current color is "+e.colors.hex}}),e._v(" "),e.disableAlpha?e._e():n("checkboard")],1),e._v(" "),n("div",{staticClass:"vc-chrome-sliders"},[n("div",{staticClass:"vc-chrome-hue-wrap"},[n("hue",{on:{change:e.childChange},model:{value:e.colors,callback:function(t){e.colors=t},expression:"colors"}})],1),e._v(" "),e.disableAlpha?e._e():n("div",{staticClass:"vc-chrome-alpha-wrap"},[n("alpha",{on:{change:e.childChange},model:{value:e.colors,callback:function(t){e.colors=t},expression:"colors"}})],1)])]),e._v(" "),e.disableFields?e._e():n("div",{staticClass:"vc-chrome-fields-wrap"},[n("div",{directives:[{name:"show",rawName:"v-show",value:0===e.fieldsIndex,expression:"fieldsIndex === 0"}],staticClass:"vc-chrome-fields"},[n("div",{staticClass:"vc-chrome-field"},[e.hasAlpha?e._e():n("ed-in",{attrs:{label:"hex",value:e.colors.hex},on:{change:e.inputChange}}),e._v(" "),e.hasAlpha?n("ed-in",{attrs:{label:"hex",value:e.colors.hex8},on:{change:e.inputChange}}):e._e()],1)]),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:1===e.fieldsIndex,expression:"fieldsIndex === 1"}],staticClass:"vc-chrome-fields"},[n("div",{staticClass:"vc-chrome-field"},[n("ed-in",{attrs:{label:"r",value:e.colors.rgba.r},on:{change:e.inputChange}})],1),e._v(" "),n("div",{staticClass:"vc-chrome-field"},[n("ed-in",{attrs:{label:"g",value:e.colors.rgba.g},on:{change:e.inputChange}})],1),e._v(" "),n("div",{staticClass:"vc-chrome-field"},[n("ed-in",{attrs:{label:"b",value:e.colors.rgba.b},on:{change:e.inputChange}})],1),e._v(" "),e.disableAlpha?e._e():n("div",{staticClass:"vc-chrome-field"},[n("ed-in",{attrs:{label:"a",value:e.colors.a,"arrow-offset":.01,max:1},on:{change:e.inputChange}})],1)]),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:2===e.fieldsIndex,expression:"fieldsIndex === 2"}],staticClass:"vc-chrome-fields"},[n("div",{staticClass:"vc-chrome-field"},[n("ed-in",{attrs:{label:"h",value:e.hsl.h},on:{change:e.inputChange}})],1),e._v(" "),n("div",{staticClass:"vc-chrome-field"},[n("ed-in",{attrs:{label:"s",value:e.hsl.s},on:{change:e.inputChange}})],1),e._v(" "),n("div",{staticClass:"vc-chrome-field"},[n("ed-in",{attrs:{label:"l",value:e.hsl.l},on:{change:e.inputChange}})],1),e._v(" "),e.disableAlpha?e._e():n("div",{staticClass:"vc-chrome-field"},[n("ed-in",{attrs:{label:"a",value:e.colors.a,"arrow-offset":.01,max:1},on:{change:e.inputChange}})],1)]),e._v(" "),n("div",{staticClass:"vc-chrome-toggle-btn",attrs:{role:"button","aria-label":"Change another color definition"},on:{click:e.toggleViews}},[n("div",{staticClass:"vc-chrome-toggle-icon"},[n("svg",{staticStyle:{width:"24px",height:"24px"},attrs:{viewBox:"0 0 24 24"},on:{mouseover:e.showHighlight,mouseenter:e.showHighlight,mouseout:e.hideHighlight}},[n("path",{attrs:{fill:"#333",d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}})])]),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.highlight,expression:"highlight"}],staticClass:"vc-chrome-toggle-icon-highlight"})])])])])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o},function(e,t,n){"use strict";function r(e){c||n(144)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(59),o=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var s=n(146),c=!1,l=n(2),u=r,f=l(o.a,s.a,!1,u,null,null);f.options.__file="src/components/Twitter.vue",t.default=f.exports},function(e,t,n){var r=n(145);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("669a48a5",r,!1,{})},function(e,t,n){t=e.exports=n(0)(!1),t.push([e.i,"\n.vc-twitter {\n  background: #fff;\n  border: 0 solid rgba(0,0,0,0.25);\n  box-shadow: 0 1px 4px rgba(0,0,0,0.25);\n  border-radius: 4px;\n  position: relative;\n}\n.vc-twitter-triangle {\n  width: 0px;\n  height: 0px;\n  border-style: solid;\n  border-width: 0 9px 10px 9px;\n  border-color: transparent transparent #fff transparent;\n  position: absolute;\n}\n.vc-twitter-triangle-shadow {\n  width: 0px;\n  height: 0px;\n  border-style: solid;\n  border-width: 0 9px 10px 9px;\n  border-color: transparent transparent rgba(0, 0, 0, .1) transparent;\n  position: absolute;\n}\n.vc-twitter-body {\n  padding: 15px 9px 9px 15px;\n}\n.vc-twitter .vc-editable-input {\n  position: relative;\n}\n.vc-twitter .vc-editable-input input {\n  width: 100px;\n  font-size: 14px;\n  color: #666;\n  border: 0px;\n  outline: none;\n  height: 28px;\n  box-shadow: inset 0 0 0 1px #F0F0F0;\n  box-sizing: content-box;\n  border-radius: 0 4px 4px 0;\n  float: left;\n  padding: 1px;\n  padding-left: 8px;\n}\n.vc-twitter .vc-editable-input span {\n  display: none;\n}\n.vc-twitter-hash {\n  background: #F0F0F0;\n  height: 30px;\n  width: 30px;\n  border-radius: 4px 0 0 4px;\n  float: left;\n  color: #98A1A4;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n}\n.vc-twitter-swatch {\n  width: 30px;\n  height: 30px;\n  float: left;\n  border-radius: 4px;\n  margin: 0 6px 6px 0;\n  cursor: pointer;\n  position: relative;\n  outline: none;\n}\n.vc-twitter-clear {\n  clear: both;\n}\n.vc-twitter-hide-triangle .vc-twitter-triangle {\n  display: none;\n}\n.vc-twitter-hide-triangle .vc-twitter-triangle-shadow {\n  display: none;\n}\n.vc-twitter-top-left-triangle .vc-twitter-triangle{\n  top: -10px;\n  left: 12px;\n}\n.vc-twitter-top-left-triangle .vc-twitter-triangle-shadow{\n  top: -11px;\n  left: 12px;\n}\n.vc-twitter-top-right-triangle .vc-twitter-triangle{\n  top: -10px;\n  right: 12px;\n}\n.vc-twitter-top-right-triangle .vc-twitter-triangle-shadow{\n  top: -11px;\n  right: 12px;\n}\n",""])},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vc-twitter",class:{"vc-twitter-hide-triangle ":"hide"===e.triangle,"vc-twitter-top-left-triangle ":"top-left"===e.triangle,"vc-twitter-top-right-triangle ":"top-right"===e.triangle},style:{width:"number"==typeof e.width?e.width+"px":e.width}},[n("div",{staticClass:"vc-twitter-triangle-shadow"}),e._v(" "),n("div",{staticClass:"vc-twitter-triangle"}),e._v(" "),n("div",{staticClass:"vc-twitter-body"},[e._l(e.defaultColors,function(t,r){return n("span",{key:r,staticClass:"vc-twitter-swatch",style:{background:t,boxShadow:"0 0 4px "+(e.equal(t)?t:"transparent")},on:{click:function(n){return e.handlerClick(t)}}})}),e._v(" "),n("div",{staticClass:"vc-twitter-hash"},[e._v("#")]),e._v(" "),n("editable-input",{attrs:{label:"#",value:e.hex},on:{change:e.inputChange}}),e._v(" "),n("div",{staticClass:"vc-twitter-clear"})],2)])},i=[];r._withStripped=!0;var o={render:r,staticRenderFns:i};t.a=o}])});
;
/*! iFrame Resizer (iframeSizer.contentWindow.min.js) - v2.8.3 - 2015-01-29
 *  Desc: Include this file in any page being loaded into an iframe
 *        to force the iframe to resize to the content size.
 *  Requires: iframeResizer.min.js on host page.
 *  Copyright: (c) 2015 David J. Bradshaw - dave@bradshaw.net
 *  License: MIT
 */

!function(){"use strict";function a(a,b,c){"addEventListener"in window?a.addEventListener(b,c,!1):"attachEvent"in window&&a.attachEvent("on"+b,c)}function b(a){return ab+"["+cb+"] "+a}function c(a){_&&"object"==typeof window.console&&console.log(b(a))}function d(a){"object"==typeof window.console&&console.warn(b(a))}function e(){c("Initialising iFrame"),f(),i(),h("background",M),h("padding",P),o(),m(),j(),q(),n(),Z=p(),E("init","Init message from host page")}function f(){function a(a){return"true"===a?!0:!1}var b=Y.substr(bb).split(":");cb=b[0],N=void 0!==b[1]?Number(b[1]):N,Q=void 0!==b[2]?a(b[2]):Q,_=void 0!==b[3]?a(b[3]):_,$=void 0!==b[4]?Number(b[4]):$,db=void 0!==b[5]?a(b[5]):db,K=void 0!==b[6]?a(b[6]):K,O=b[7],W=void 0!==b[8]?b[8]:W,M=b[9],P=b[10],hb=void 0!==b[11]?Number(b[11]):hb}function g(a,b){return-1!==b.indexOf("-")&&(d("Negative CSS value ignored for "+a),b=""),b}function h(a,b){void 0!==b&&""!==b&&"null"!==b&&(document.body.style[a]=b,c("Body "+a+' set to "'+b+'"'))}function i(){void 0===O&&(O=N+"px"),g("margin",O),h("margin",O)}function j(){document.documentElement.style.height="",document.body.style.height="",c('HTML & body height set to "auto"')}function k(b){function d(c){a(window,c,function(){E(b.eventName,b.eventType)})}b.eventNames&&Array.prototype.map?(b.eventName=b.eventNames[0],b.eventNames.map(d)):d(b.eventName),c("Added event listener: "+b.eventType)}function l(){k({eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),k({eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),k({eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),k({eventType:"Device Orientation Change",eventName:"deviceorientation"}),k({eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),k({eventType:"Window Clicked",eventName:"click"}),k({eventType:"Window Resized",eventName:"resize"})}function m(){V!==W&&(W in lb||(d(W+" is not a valid option for heightCalculationMethod."),W="bodyScroll"),c('Height calculation method set to "'+W+'"'))}function n(){!0===K?(l(),t()):c("Auto Resize disabled")}function o(){var a=document.createElement("div");a.style.clear="both",a.style.display="block",document.body.appendChild(a)}function p(){function b(){return{x:void 0!==window.pageXOffset?window.pageXOffset:document.documentElement.scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:document.documentElement.scrollTop}}function e(a){var c=a.getBoundingClientRect(),d=b();return{x:parseInt(c.left,10)+parseInt(d.x,10),y:parseInt(c.top,10)+parseInt(d.y,10)}}function f(a){function b(a){var b=e(a);c("Moving to in page link (#"+d+") at x: "+b.x+" y: "+b.y),I(b.y,b.x,"scrollToOffset")}var d=a.split("#")[1]||"",f=decodeURIComponent(d),g=document.getElementById(f)||document.getElementsByName(f)[0];g?b(g):(c("In page link (#"+d+") not found in iFrame, so sending to parent"),I(0,0,"inPageLink","#"+d))}function g(){""!==location.hash&&"#"!==location.hash&&f(location.href)}function h(){function b(b){function c(a){a.preventDefault(),f(this.getAttribute("href"))}"#"!==b.getAttribute("href")&&a(b,"click",c)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),b)}function i(){a(window,"hashchange",g)}function j(){setTimeout(g,S)}return Array.prototype.forEach&&document.querySelectorAll?(c("Setting up location.hash handlers"),h(),i(),j()):d("In page linking not fully supported in this browser! (See README.md for IE8 workaround)"),{findTarget:f}}function q(){db&&(c("Enable public methods"),window.parentIFrame={close:function(){E("close","parentIFrame.close()",0,0)},getId:function(){return cb},moveToAnchor:function(a){Z.findTarget(a)},reset:function(){H("parentIFrame.reset")},scrollTo:function(a,b){I(b,a,"scrollTo")},scrollToOffset:function(a,b){I(b,a,"scrollToOffset")},sendMessage:function(a,b){I(0,0,"message",JSON.stringify(a),b)},setHeightCalculationMethod:function(a){W=a,m()},setTargetOrigin:function(a){c("Set targetOrigin: "+a),fb=a},size:function(a,b){var c=""+(a?a:"")+(b?","+b:"");F(),E("size","parentIFrame.size("+c+")",a,b)}})}function r(){0!==$&&(c("setInterval: "+$+"ms"),setInterval(function(){E("interval","setInterval: "+$)},Math.abs($)))}function s(b){function d(b){(void 0===b.height||void 0===b.width||0===b.height||0===b.width)&&(c("Attach listerner to "+b.src),a(b,"load",function(){E("imageLoad","Image loaded")}))}b.forEach(function(a){if("attributes"===a.type&&"src"===a.attributeName)d(a.target);else if("childList"===a.type){var b=a.target.querySelectorAll("img");Array.prototype.forEach.call(b,function(a){d(a)})}})}function t(){function a(){var a=document.querySelector("body"),d={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},e=new b(function(a){E("mutationObserver","mutationObserver: "+a[0].target+" "+a[0].type),s(a)});c("Enable MutationObserver"),e.observe(a,d)}var b=window.MutationObserver||window.WebKitMutationObserver;b?0>$?r():a():(d("MutationObserver not supported in this browser!"),r())}function u(){function a(a){function b(a){var b=/^\d+(px)?$/i;if(b.test(a))return parseInt(a,L);var d=c.style.left,e=c.runtimeStyle.left;return c.runtimeStyle.left=c.currentStyle.left,c.style.left=a||0,a=c.style.pixelLeft,c.style.left=d,c.runtimeStyle.left=e,a}var c=document.body,d=0;return"defaultView"in document&&"getComputedStyle"in document.defaultView?(d=document.defaultView.getComputedStyle(c,null),d=null!==d?d[a]:0):d=b(c.currentStyle[a]),parseInt(d,L)}return document.body.offsetHeight+a("marginTop")+a("marginBottom")}function v(){return document.body.scrollHeight}function w(){return document.documentElement.offsetHeight}function x(){return document.documentElement.scrollHeight}function y(){for(var a=document.querySelectorAll("body *"),b=a.length,d=0,e=(new Date).getTime(),f=0;b>f;f++)a[f].getBoundingClientRect().bottom>d&&(d=a[f].getBoundingClientRect().bottom);return e=(new Date).getTime()-e,c("Parsed "+b+" HTML elements"),c("LowestElement bottom position calculated in "+e+"ms"),d}function z(){return[u(),v(),w(),x()]}function A(){return Math.max.apply(null,z())}function B(){return Math.min.apply(null,z())}function C(){return Math.max(u(),y())}function D(){return Math.max(document.documentElement.scrollWidth,document.body.scrollWidth)}function E(a,b,d,e){function f(){a in{reset:1,resetPage:1,init:1}||c("Trigger event: "+b)}function g(){T=n,kb=o,I(T,kb,a)}function h(){return ib&&a in R}function i(){function a(a,b){var c=Math.abs(a-b)<=hb;return!c}return n=void 0!==d?d:lb[W](),o=void 0!==e?e:D(),a(T,n)||Q&&a(kb,o)}function j(){return!(a in{init:1,interval:1,size:1})}function k(){return W in eb}function l(){c("No change in size detected")}function m(){j()&&k()?H(b):a in{interval:1}||(f(),l())}var n,o;h()?c("Trigger event cancelled: "+a):i()?(f(),F(),g()):m()}function F(){ib||(ib=!0,c("Trigger event lock on")),clearTimeout(jb),jb=setTimeout(function(){ib=!1,c("Trigger event lock off"),c("--")},S)}function G(a){T=lb[W](),kb=D(),I(T,kb,a)}function H(a){var b=W;W=V,c("Reset trigger event: "+a),F(),G("reset"),W=b}function I(a,b,d,e,f){function g(){void 0===f?f=fb:c("Message targetOrigin: "+f)}function h(){var g=a+":"+b,h=cb+":"+g+":"+d+(void 0!==e?":"+e:"");c("Sending message to host page ("+h+")"),gb.postMessage(ab+h,f)}g(),h()}function J(a){function b(){return ab===(""+a.data).substr(0,bb)}function f(){Y=a.data,gb=a.source,e(),U=!1,setTimeout(function(){X=!1},S)}function g(){X?c("Page reset ignored by init"):(c("Page size reset by host page"),G("resetPage"))}function h(){return a.data.split("]")[1]}function i(){return"iFrameResize"in window}function j(){return a.data.split(":")[2]in{"true":1,"false":1}}b()&&(U&&j()?f():"reset"===h()?g():a.data===Y||i()||d("Unexpected message ("+a.data+")"))}var K=!0,L=10,M="",N=0,O="",P="",Q=!1,R={resize:1,click:1},S=128,T=1,U=!0,V="offset",W=V,X=!0,Y="",Z={},$=32,_=!1,ab="[iFrameSizer]",bb=ab.length,cb="",db=!1,eb={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},fb="*",gb=window.parent,hb=0,ib=!1,jb=null,kb=1,lb={offset:u,bodyOffset:u,bodyScroll:v,documentElementOffset:w,scroll:x,documentElementScroll:x,max:A,min:B,grow:A,lowestElement:C};a(window,"message",J)}();
//# sourceMappingURL=iframeResizer.contentWindow.map;
/***
 * get translation by current language
 * (this file has to be included first)
 ***/
var VVO = VVO || {};
VVO.I18N = function() {

  /***
   * translations
   ***/
  var translations = {
    de: {
      addfavorite: 'Punkt als Favorit speichern',
      ajax_error: 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es später erneut.',
      animate_route: 'Fahrt animieren',
      autocomplete_error: 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es später erneut.',
      autocompleter_point_not_found: 'Punkt konnte nicht gefunden werden.',
      autocompleter_line_not_found: 'Linie konnte nicht gefunden werden.',
      autocompleter_results: 'Ergebnisse wurden gefunden. Bitte benutzen Sie die Pfeiltasten nach oben und nach unten zum Navigieren oder tippen Sie um eine Eingabe zu machen.',
      btn_close: 'schließen',
      btn_next: 'nächstes',
      btn_previous: 'vorheriges',
      image: 'Bild',
      image_of: 'von',
      carsharing: 'CarSharing',
      citymap: 'Karte',
      connectionsfrom: 'Verbindungen von hier',
      connectionsto: 'Verbindungen hierher',
      del: 'Eintrag Löschen',
      delete_confirmationquestion: "Achtung, hiermit wird Ihr Mein VVO Profil inkl. aller gespeicherten Daten (Abonnements und Einstellungen) gelöscht. Möchten Sie fortfahren?",
      farezonemap: 'Tarifzonenplan',
      filter_viaid: 'Zwischenhalt ausgewählt',
      filter_length_of_stay: 'Aufenthaltsdauer ausgewählt',
      // filter_no_disabillities: 'Ohne Einschränkungen', Default
      filter_unaided_wheelchair_user: 'Rollstuhlfahrer ohne fremde Hilfe',
      filter_walking_frame_pushchair: 'Rollator, Kinderwagen',
      filter_individual_settings: 'individuelle Einstellungen',
      // filter_unlimited_number_of_changes: 'beliebig oft umsteigen', Default
      filter_two_changes_at_most: 'max. 2x umsteigen',
      filter_one_change_at_most: 'max. 1x umsteigen',
      filter_direct_connections_only: 'Nur Direktverbindungen',
      // filter_all_routes: 'Alle Linien', Default
      filter_all_routes_except_ice: 'Alle Linien ohne ICE',
      filter_just_regional_network: 'Nur Verbund und Nahverkehr',
      filter_very_slow: 'sehr langsame Gehgeschwindigkeit',
      filter_slow: 'langsame Gehgeschwindigkeit',
      // filter_normal: 'normale Gehgeschwindigkeit', Default
      filter_fast: 'schnelle Gehgeschwindigkeit',
      // filter_m5: 'max. 5 min zur Haltestelle', Default
      filter_m10: 'max. 10 min zur Haltestelle',
      filter_m15: 'max. 15 min zur Haltestelle',
      filter_m20: 'max. 20 min zur Haltestelle',
      filter_m30: 'max. 30 min zur Haltestelle',
      filter_public_transport_restricted: 'Verkehrsmittel eingeschränkt',
      filter_alternativ_stops: 'Alternativhaltestellen nicht einbeziehen',
      furtherInput: 'Bitte geben Sie weitere Zeichen ein ...',
      guestbook_confirmationquestion:"Soll der ausgewählte Beitrag wirklich gelöscht werden?",
      hide_stopovers: 'Zwischenhaltestellen ausblenden',
      magnify_open: 'Vollbildansicht öffnen',
      magnify_close: 'Vollbildansicht schließen',
      nextdepartures: 'Aktuelle Abfahrten',
      newsletter_confirmationquestion: "Soll der ausgewählte Newsletter wirklich gelöscht werden? (Bitte beachten Sie, dass der Newsletter zuerst im CMS entfernt werden muss, sonst erscheint dieser hier weiterhin)",
      no_favouritetrips_saved: 'Bisher sind keine Verbindungsfavoriten gespeichert',
      no_favouritepoints_saved: 'Bisher sind keine Punktfavoriten gespeichert',
      pause: 'Pause',
      panel: 'Folie',
      play: 'Abspielen',
      poi: 'Wichtige Punkte (POI)',
      pointfavourites: 'Punktfavoriten',
      route:'Liniennetzplan VVO',
      dresden: 'Liniennetzplan Dresden',
      parkandride: 'Park & Ride (P+R)',
      platform: 'Steige',
      platform_sing: 'Steig',
      rentabike: 'Mietfahrräder',
      routechangesub_confirmationquestion: "Soll das ausgewählte Abonnements wirklich gelöscht werden?",
      routesmap: 'Liniennetzplan',
      saveasfavourite: 'Als Favorit speichern',
      removeasfavourite: 'Favorit löschen',
      search: 'Suche',
      searchinprogress: 'Bitte warten ...',
      show_stopovers: 'Zwischenhaltestellen einblenden',
      showasfavourite: 'Favoriten anzeigen',
      showmewhereiam: 'Meinen Standort anzeigen',
      showonmap : 'Auf der Karte anzeigen',
      showstreetview: 'Google Street View anzeigen',
      showradius: 'Radius anzeigen',
      hideradius: 'Radius ausblenden',
      stop: 'Haltestellen',
      subportal_confirmationquestion: "Soll die ausgewählte Aktion wirklich gelöscht werden? (Bitte beachten Sie, dass mit dem Löschen der Aktion auch sämtliche Teilnehmerdaten gelöscht werden. Beachten Sie außerdem, dass die Aktion zuerst im CMS entfernt werden muss, sonst erscheint dieser hier weiterhin.)",
      ticketmachine: 'Fahrkartenautomaten',
      servicepoint: 'Servicestellen',
      useasstop: 'Punkt übernehmen',
      useasorigin: 'Startpunkt übernehmen',
      useasdestination: 'Zielpunkt übernehmen',
      useasvia: 'Zwischenhalt übernehmen',
      unidentifiedmappoint: 'Freier Kartenpunkt',
      webcam: 'Webcams',
      newsletter_confirm_unsent: 'Der Newsletter wurde noch nicht versendet. Klicken Sie auf OK, um den Newsletter jetzt zu versenden.',
      newsletter_confirm_sent: 'Der Newsletter wurde bereits versendet. Möchten Sie Ihn erneut an ALLE E-Mail-Adressen versenden?',
      farezones: 'Tarifzonen',
      download: 'Download',
      errornextdepartures: 'Beim Laden der nächsten Abfahrten ist ein Fehler aufgetreten.',
      route_change_not_found: 'Die Fahrplanänderung konnte nicht gefunden werden.',
      radius500m: '500m (5min Fußweg)',
      radius1000m: '1km (10min Fußweg)',
      radius5000m: '5km (1h Fußweg)',
      radius15000m: '15km',
      parking_lot_not_occupied_not_disabled: 'frei',
      parking_lot_occupied_not_disabled: 'belegt',
      parking_lot_not_occupied_disabled: 'Behindertenparkplatz frei',
      parking_lot_occupied_disabled: 'Behindertenparkplatz belegt',
      sd_stops_notice: '... erreichen Sie folgende Haltestellen:',
      sd_stops_notice2: 'Bedingung: ohne Umstieg, ohne Fahrtunterbrechung',
      sd_stops_error: 'Es existieren keine Kurzstrecken für die Haltestelle ',
      time: 'Uhr',
      favorites: 'Favoriten',
      last_inputs: 'Letzte Eingaben',
      gbform_submit: 'Vielen Dank für Ihren Eintrag bei Lob & Kritik. Sie erhalten nun eine E-Mail an die von Ihnen eingegebene Adresse. Bitte klicken Sie auf den enthaltenen Bestätigungslink, damit Ihre Anfrage verarbeitet werden kann (Andernfalls wird diese ignoriert). Anschließend wird die Anfrage geprüft, ggf. kommentiert und erst dann freigeschaltet.\r\n\r\nBitte haben Sie etwas Geduld, die Bearbeitung kann mehrere Tage dauern - insbesondere wenn wir für die Beantwortung auf Zuarbeiten warten müssen.\r\n\r\nViele Grüße,\r\nIhr VVO-Team',
      further_maps: 'weitere Karten',
      zoom_in: 'größer',
      zoom_out: 'kleiner',
      full_screen: 'Vollbild',
      my_location: 'Mein Standort'
    },
    en: {
      addfavorite: 'Save point as Favorite',
      ajax_error: 'An error has occurred. Please try again later.',
      animate_route: 'Animate journey',
      autocomplete_error: 'An error has occured. Please try again later.',
      autocompleter_point_not_found: 'Point could not be found.',
      autocompleter_line_not_found: 'Line could not be found.',
      autocompleter_results: 'Results have been found. Please use the up and down arrow keys to navigate, or type to make an input.',
      btn_close: 'Close',
      btn_next: 'Next',
      btn_previous: 'Previous',
      image: 'image',
      image_of: 'of',
      carsharing: 'CarSharing',
      citymap: 'Street map',
      connectionsfrom: 'Connections from here',
      connectionsto: 'Connections to here',
      del: 'Delete',
      delete_confirmationquestion: 'Please note: this will delete your My VVO profile including all your saved data (subscriptions and settings). Do you want to continue?',
      farezonemap: 'Tariff zone plan',
      filter_viaid: 'Intermediate stop selected',
      filter_length_of_stay: 'Length of stay selected',
      // filter_no_disabillities: 'Without restrictions', Default
      filter_unaided_wheelchair_user: 'Unassisted wheelchair users',
      filter_walking_frame_pushchair: 'Rollator, stroller',
      filter_individual_settings: 'individual settings',
      // filter_unlimited_number_of_changes: 'change as often as you like', Default
      filter_two_changes_at_most: 'change max. 2x',
      filter_one_change_at_most: 'change max. 1x',
      filter_direct_connections_only: 'only direct connections',
      // filter_all_routes: 'All lines', Default
      filter_all_routes_except_ice: 'All lines without ICE',
      filter_just_regional_network: 'Only network and local transport',
      filter_very_slow: 'very slow walking speed',
      filter_slow: 'slow walking speed',
      // filter_normal: 'normal walking speed', Default
      filter_fast: 'fast walking speed',
      // filter_m5: 'max. 5 min to the stop', Default
      filter_m10: 'max. 10 minutes to the stop',
      filter_m15: 'max. 15 minutes to the stop',
      filter_m20: 'max. 20 minutes to the stop',
      filter_m30: 'max. 30 minutes to the stop',
      filter_public_transport_restricted: 'Limited means of transport',
      filter_alternativ_stops: 'Do not include alternative stops',
      furtherInput: 'Please enter more characters ...',
      guestbook_confirmationquestion: 'Do you really want to delete the selected text?',
      hide_stopovers: 'Hide intermediary stops',
      magnify_open: 'Open fullscreen view',
      magnify_close: 'Close fullscreen view',
      nextdepartures: 'Current departures',
      newsletter_confirmationquestion: 'Do you really want to delete the selected newsletter ? (Please note that the newsletter first needs to be deleted in the CMS, otherwise it will continue to appear here)',
      no_favouritetrips_saved: 'No favorite connections have yet been saved',
      no_favouritepoints_saved: 'No favorite points have yet been saved',
      pause: 'Pause',
      panel: 'Slide',
      parkandride: 'Park and Ride',
      platform: 'Platforms',
      platform_sing: 'platform',
      play: 'Play',
      poi: 'Key points',
      pointfavourites: 'Favorite points',
      rentabike: 'Rent a bike',
      route: 'Network plan',
      dresden: 'Dresden',
      routechangesub_confirmationquestion: 'Do you really want to delete the selected subscriptions?',
      routesmap: 'Network plan',
      saveasfavourite: 'Save as Favorite',
      removeasfavourite: 'Delete favorite',
      search: 'Search',
      searchinprogress: 'Please wait ...',
      show_stopovers: 'Show intermediary stops',
      showasfavourite: 'Show Favorites',
      showmewhereiam: 'Show my location',
      showonmap : 'Show on the map',
      showstreetview: 'Show Google Street View',
      stop: 'Stops',
      subportal_confirmationquestion: 'Do you really want to delete the selected draw? (Please note that all the participant data will be deleted if the draw is deleted. Note, too, that the draw first needs to be deleted in the CMS, otherwise it will continue to appear here.)',
      ticketmachine: 'Ticket machine',
      servicepoint: 'Service points',
      useasstop: 'Copy point',
      useasorigin: 'take origin',
      useasdestination: 'take destination',
      useasvia: 'take stopover',
      unidentifiedmappoint: 'Free map point',
      webcam: 'Webcams',
      farezones: 'Fare zones',
      download: 'Download',
      errornextdepartures: 'Error loading next departures.',
      route_change_not_found: 'The route change could not be found.',
      radius500m: '500m (5min footpath)',
      radius1000m: '1km (10min footpath)',
      radius5000m: '5km (1h footpath)',
      radius15000m: '15km',
      parking_lot_not_occupied_not_disabled: 'available',
      parking_lot_occupied_not_disabled: 'occupied',
      parking_lot_not_occupied_disabled: 'available disabled parking space',
      parking_lot_occupied_disabled: 'occupied disabled parking space',
      sd_stops_notice: '... you can reach the following stops:',
      sd_stops_notice2: 'Condition: no interchange, no route disruption',
      sd_stops_error: 'There are no short distances for stop  ',
      time: '',
      favorites: 'favourites',
      last_inputs: 'last input',
      further_maps: 'further maps',
      zoom_in: 'zoom in',
      zoom_out: 'zoom out',
      full_screen: 'fullscreen',
      my_location: 'my location'
    },
    cs: {
      addfavorite: 'Uložit stanoviště mezi Oblíbené',
      ajax_error: 'Došlo k chybě. Zkuste to prosím znovu později.',
      animate_route: 'Spustit animaci trasy',
      autocomplete_error: 'Došlo k chybě. Zkuste to prosím znovu později.',
      autocompleter_point_not_found: 'Stanoviště se nepodařilo nalézt.',
      autocompleter_line_not_found: 'Linku nelze nalézt.',
      autocompleter_results: 'Byly nalezeny výsledky. K navigování použijte tlačítka se šipkami nahoru a dolů, anebo můžete hodnoty zadat vyťukáním na klávesnici.',
      btn_close: 'zavřít',
      btn_next: 'další',
      btn_previous: 'předchozí',
      image: 'obraz',
      image_of: 'z',
      carsharing: 'CarSharing',
      citymap: 'Mapa města',
      connectionsfrom: 'spoje odtud',
      connectionsto: 'spoje sem',
      del: 'smazat',
      delete_confirmationquestion: 'Upozornění: tímto krokem si smažete Můj profil VVO včetně všech uložených dat (předplatné a nastavení). Chcete pokračovat?',
      farezonemap: 'Mapa tarifních zón',
      filter_viaid: 'Byla zvolena mezipřistání',
      filter_length_of_stay: 'Zvolená délka pobytu',
      // filter_no_disabillities: 'Bez omezení', Default
      filter_unaided_wheelchair_user: 'Nepomáhající uživatelé invalidního vozíku',
      filter_walking_frame_pushchair: 'Kolečko, kočárek',
      filter_individual_settings: 'individuální nastavení',
      // filter_unlimited_number_of_changes: 'měňte tak často, jak chcete', Default
      filter_two_changes_at_most: 'změnit max. 2x',
      filter_one_change_at_most: 'změnit max. 1x',
      filter_direct_connections_only: 'pouze přímé spojení',
      // filter_all_routes: 'Všechny řádky', Default
      filter_all_routes_except_ice: 'Všechny řádky bez ICE',
      filter_just_regional_network: 'Pouze síťová a místní doprava',
      filter_very_slow: 'velmi pomalá rychlost chůze',
      filter_slow: 'pomalá rychlost chůze',
      // filter_normal: 'normální rychlost chůze', Default
      filter_fast: 'vysoká rychlost chůze',
      // filter_m5: 'max. 5 minut na zastávku', Default
      filter_m10: 'max. 10 minut na zastávku',
      filter_m15: 'max. 15 minut na zastávku',
      filter_m20: 'max. 20 minut na zastávku',
      filter_m30: 'max. 30 minut na zastávku',
      filter_public_transport_restricted: 'Omezený dopravní prostředek',
      filter_alternativ_stops: 'Nezahrnujte alternativní zastávky',
      furtherInput: 'Vložte ještě další znaky...',
      guestbook_confirmationquestion:	'Má se vybraný příspěvek skutečně smazat?',
      hide_stopovers: 'Skrýt zastávky na trase',
      magnify: 'zvětšit',
      magnify_open: 'Otevřete zobrazení na celou obrazovku',
      magnify_close: 'Zavřete zobrazení na celou obrazovku',
      nextdepartures: 'Aktuální odjezdy',
      newsletter_confirmationquestion: 'Má se vybraný newsletter skutečně smazat? (Nezapomeňte, že newsletter musí být nejdříve odstraněn z CMS, jinak se tu bude stále zobrazovat)',
      no_favouritetrips_saved: 'Zatím nebyly uloženy žádné spoje mezi Oblíbené.',
      no_favouritepoints_saved: 'Zatím nebyla uložena žádná stanoviště mezi Oblíbené.',
      pause: 'pauza',
      panel: 'fólie',
      parkandride: 'Park and Ride',
      play: 'přehrát',
      poi: 'Důležitá stanoviště',
      pointfavourites: 'Oblíbená stanoviště',
      route:	'Mapa linek',
      dresden: 'Drážďany',
      platform: 'Chodník',
      platform_sing: "Chodník",
      rentabike: 'Kola k pronájmu',
      routechangesub_confirmationquestion: 'Má se vybrané předplatné skutečně smazat?',
      routesmap: 'Mapa linek',
      saveasfavourite: 'uložit mezi Oblíbené',
      removeasfavourite: 'smazat ze složky Oblíbené',
      search: 'Vyhledávání',
      searchinprogress: 'Chvilku strpení prosím...',
      show_stopovers: 'Ukázat všechny zastávky na trase',
      showasfavourite: 'Zobrazit složku Oblíbené',
      showmewhereiam: 'Zobrazit moje stanoviště',
      showonmap : 'Zobrazit na mapě',
      showstreetview: 'Zobrazit Google Street View',
      stop: 'Zastávky',
      subportal_confirmationquestion: 'Má se vybraná akce skutečně smazat? (Nezapomeňte, že vymazáním akce budou zároveň smazány všechny údaje o účastníkovi. Pamatujte i na to, že akce musí být nejdříve odstraněna z CMS, jinak se tu bude stále zobrazovat.)',
      ticketmachine: 'Automat na jízdenky',
      servicepoint: 'Servisní pobočky',
      useasstop: 'Převzít stanoviště',
      useasorigin: 'jako výchozí bod',
      useasdestination: 'jako cílový bod',
      useasvia: 'jako mezilehlá zastávka',
      unidentifiedmappoint: 'Libovolné stanoviště na mapě',
      webcam: 'Webkamery',
      farezones: 'Tarifní zóny',
      download: 'Stáhnout',
      errornextdepartures: 'Při načítání dalších odletů došlo k chybě.',
      route_change_not_found: 'Změna jízdního řádu nebyla nalezena.',
      radius500m: '500m (5min pěšina)',
      radius1000m: '1km (10min pěšina)',
      radius5000m: '5km (1h pěšina)',
      radius15000m: '15km',
      parking_lot_not_occupied_not_disabled: 'bezplatné parkovací místo',
      parking_lot_occupied_not_disabled: 'obsazené parkoviště',
      parking_lot_not_occupied_disabled: 'zdarma hendikepované parkovací místo',
      parking_lot_occupied_disabled: 'obsazené invalidní parkovací místo',
      sd_stops_notice: '... se dostanete na následující zastávky:',
      sd_stops_notice2: 'Stav: beze změny, bez přerušení cesty',
      sd_stops_error: 'Neexistují krátké trasy k zastávce  ',
      time: 'hod.',
      favorites: 'Oblíbené',
      last_inputs: 'Poslední záznamy',
      further_maps: 'více karet',
      zoom_in: 'přiblížit',
      zoom_out: 'oddálit',
      full_screen: 'celá obrazovka',
      my_location: 'moje lokace'
    }
  },

  /***
   * get translation for current language
   ***/
  translate = function(key) {
    return translations[currentLanguage()][key];
  },

  /***
  * translate back
  ***/
  translateBack = function(value){
      for (var key in translations[currentLanguage()]){
       if (translations[currentLanguage()][key] == value)
            return key;
      };
  },

  /***
   * get current language from uri
   ***/
  currentLanguage = function() {
    if (location.href.match(/.+\/\/[^\/]+\/(de|en|cs)/)) {
      return RegExp.$1;
    }

    return 'de';
  };

  // return public methods
  return {
    translate: translate,
    translateBack : translateBack,
    currentLanguage: currentLanguage
  };
}();
;
/***
 * output log messages in browser console, if available
 **/

VVO.Log = function() {
  return function(msg) {
    if(window.console && window.console.log) {
      console.log(msg);
    }

    if(window.opera && window.opera.postError) {
    opera.postError(msg);
    }
  };
}();
;
/***
 * validation helpers (f.ex. disabling submit button, if inputs are empty)
 **/
VVO.Validation = function() {

  /***
   * disable submit button if all inputs are empty
   * parameter jquery object with input fields that don't have to be empty
   **/
  var initHandleEmpytInputs = function($inputs) {
    $inputs.on( "change keyup keypress focus blur", function () {
      var isEmpty = false;
      $inputs.each(function(idx, val) {
        if(!val.value) {
          isEmpty = true;
          return false;
        }
      });

      var $form = $(this).parents('form');
      var $button = form.find('button[type="submit"]');

      if(isEmpty) {
        $button.attr('disabled','disabled');
      } else {
        button.removeAttr('disabled');
      }
    });

    // disable submit button on init
    $inputs.first().change();
  };
  
  // return public methods
  return {
    initHandleEmpytInputs: initHandleEmpytInputs
  };
}();
;
/***
 * ajax link
 * form-parameter: jquery Selector of  a tag
 * http://www.mattlunn.me.uk/blog/2012/10/submitting-a-form-as-an-ajax-request-using-jquery/
 ***/
lastXhr = null;

VVO.AjaxLink = function() {

  var i18n = VVO.I18N.translate;

  var init = function($link, successhandler, errorhandler, boolpushstate) {


    $link.on('click', function(event) {
      // avoid default handling
      event.preventDefault();
      event.stopPropagation();

      // show spinner if submit button is available
      var offset = $(this).offset();
      var that = this;
      VVO.Spinner.show(offset.left - 22, offset.top + 14);

      if(lastXhr != null) {
        lastXhr.abort();
      }

      lastXhr = $.ajax({
        url: $(that).attr('href'),
        method: $(that).method || 'GET',
        success: function(data) {
          $('#' + $(that).data('ajax-destination')).replaceWith(data);
          if(successhandler) {
            //add that to successhandler to get clicked object
            successhandler(that);
          }
        },

        error: function(jqXHR, status, exception) {
          // ajax request was aborted by user
          if(status === 'abort') {
            return;
          }
        
          // todo
          VVO.Log(i18n('ajax_error'));
          VVO.Log(exception);
          if(errorhandler) {
            //add that to errorhandler to get clicked object
            errorhandler(that);
          }
        },

        complete: function () {

          //push to history for browser back button
          //if not from backbutton click --> push state
          if (history.pushState) {
            if (!backButtonPressed && boolpushstate != false) {
              //set last pushed state
              var state = { type: "link", id: $(that).attr('id'), url: $(that).attr('href') };
              //push state to history
              history.pushState(state, null, document.URL);
              backButtonPressed = false;
            } else {
              backButtonPressed = false;
            }
          }

          // hide spinner
          VVO.Spinner.hide();
          lastXhr = null;
        }
      });
    });
  };

  // return public methods
  return init;
}();
;
/***
 * submit form via ajax
 * form-parameter: jquery Selector of form tag
 * http://www.mattlunn.me.uk/blog/2012/10/submitting-a-form-as-an-ajax-request-using-jquery/
 ***/
VVO.AjaxForm = function() {

  var i18n = VVO.I18N.translate;

  var init = function($form, scroll, focusId, successhandler, errorhandler, spinnerLeft, spinnerTop) {

    $form.on('submit', function(event) {
      // avoid page load on submit
      event.preventDefault();
      
      // if spinnerleft and spinnertop is not set and submit button is available, show spinner on left
      if(!spinnerLeft && !spinnerTop && $(this).find("button[type='submit']").length) {
        var offset = $(this).find("button[type='submit']").offset();
        spinnerLeft = offset.left - 22;
        spinnerTop = offset.top + 18;
      }

      // show spinner
      if(spinnerLeft && spinnerTop) {
        VVO.Spinner.show(spinnerLeft, spinnerTop);
      }

      if(lastXhr !== null) {
        lastXhr.abort();
      }

      lastXhr = $.ajax({
        url: $form.attr('action'),
        method: $form.attr('method') || 'GET',
        data: $form.serialize(),
        success: function(data) {
          $('#' + $form.data('ajax-destination')).replaceWith(data);
          if(successhandler) {
            successhandler(data);
          }
        },

        error: function(jqXHR, status, exception) {
          // ajax request was aborted by user
          if(status === 'abort') {
            return;
          }
          
          VVO.Log(i18n('ajax_error'));
          VVO.Log(exception);
          if(errorhandler) {
            errorhandler();
          }
        },

        complete: function() {
          if(scroll)
          {
           $('#' + $form.data('ajax-destination')).scrollTo();
          }
          //set focus
          if(focusId.length)
          {
            $('#'+focusId).focus();
          }

          //push to history for browser back button
          //if not from backbutton click --> push state
          if (history.pushState) {
            if (!backButtonPressed) {
              var pointdata = {};
              //get displayed text of select
              $.each($form.find('select'), function (index, select) {
                pointdata[select.name] = $('#' + select.id + ' option:selected').text();
              });
              var state = { type: "form", data: $form.serialize(), selectdata: JSON.stringify(pointdata), id: $form.attr('id') };
              //push state to history
              history.pushState(state, null);
            } else {
              backButtonPressed = false;
            }
          }

          // hide spinner
          VVO.Spinner.hide();

          lastXhr = null;
        }
      });
    });
  };

  // return public methods
  return init;
}();
;
/***
 * date/time picker application logic using moment.js as date format helper
 **/
VVO.DatePicker = function() {

  var momentDateFormat = 'DD.MM.YYYY',
      dateOptions = {
        clear: '',
        format: 'dd.mm.yyyy',
        formatSubmit: false,
        klass: {
          navPrev: 'picker__nav--prev icon-font ico-arrow-left',
          navNext: 'picker__nav--next icon-font ico-arrow-right'
        },
        editable: true
      },

  /***
   * initialize datepicker with jquery selector on datepicker
   * div that contains prev/next link & input field
   ***/
  initDate = function($datePicker, allowEmpty) {

    var $dateInput = $datePicker.find('.moment-date');
    dateOptions.min = $dateInput.data('min') ? moment($dateInput.data('min'), momentDateFormat).toDate() : undefined;
    dateOptions.max = $dateInput.data('max') ? moment($dateInput.data('max'), momentDateFormat).toDate(): undefined;

    // set current date if empty
    if(!$dateInput.val() && $dateInput.data('prevent-default') === undefined && !allowEmpty) {
      $dateInput.val(moment().format(momentDateFormat));
    }

    dateOptions.onClose = function() {
      $datePicker.trigger('dateselected');
    };

    // initialize datepicker
    $datePicker.data('picker', $dateInput.pickadate(dateOptions));

    // init handler for increasing date
    $datePicker.find('.moment-date-forward').on('click', function(event) {
      event.preventDefault();

      var datePicker = $(this).parent();
      var date = moment(datePicker.find('.moment-date').val(), momentDateFormat).add('d', 1);
      datePicker.data('picker').data('pickadate').set('select', [date.year(), date.month(),date.date()]);
    });

    // init handler for decreasing date
    $datePicker.find('.moment-date-back').on('click', function(event) {
      event.preventDefault();

      var datePicker = $(this).parent();
      var date = moment(datePicker.find('.moment-date').val(), momentDateFormat).subtract('d', 1);
      datePicker.data('picker').data('pickadate').set('select', [date.year(), date.month(),date.date()]);
    });
  },

  /***
   * initialize global settings (set translations)
   ***/
  init = function() {
    if(VVO.I18N.currentLanguage() === 'de') {
      jQuery.extend( jQuery.fn.pickadate.defaults, {
          monthsFull: [ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' ],
          monthsShort: [ 'Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez' ],
          weekdaysFull: [ 'Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag' ],
          weekdaysShort: [ 'So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa' ],
          today: 'Heute',
          clear: 'Löschen',
          firstDay: 1,
          format: 'dddd, dd. mmmm yyyy',
          formatSubmit: 'yyyy/mm/dd'
      });
    }
    else if(VVO.I18N.currentLanguage() === 'cz')
    {
      jQuery.extend( jQuery.fn.pickadate.defaults, {
          monthsFull: [ 'leden', 'únor', 'brezen', 'duben', 'kveten', 'cerven', 'cervenec', 'srpen', 'zárí', 'ríjen', 'listopad', 'prosinec' ],
          monthsShort: [ 'led', 'úno', 'bre', 'dub', 'kve', 'cer', 'cvc', 'srp', 'zár', 'ríj', 'lis', 'pro' ],
          weekdaysFull: [ 'nedele', 'pondelí', 'úterý', 'streda', 'ctvrtek', 'pátek', 'sobota' ],
          weekdaysShort: [ 'ne', 'po', 'út', 'st', 'ct', 'pá', 'so' ],
          today: 'dnes',
          clear: 'vymazat',
          firstDay: 1,
          format: 'd. mmmm yyyy',
          formatSubmit: 'yyyy/mm/dd'
      });
    }
  };

  init();

  // return public methods
  return initDate;
}();
;
/***
 * time picker application logic using moment.js as date format helper
 **/
 VVO.TimePicker = function($timePicker) {

  var i18n = VVO.I18N.translate;

  // defaults
  momentTimeFormat = 'HH:mm',
  timeOptions = {
    clear: '',
    format: 'HH:i',
    formatSubmit: false,
    editable: true,
    onSet: function(context) {
      var timeInput = $timePicker.find('.moment-time');
      if (context.select.value !== context.select.defaultValue) {
        timeInput.val(context.select.value);
      }
    }
  },

  /***
   * initialize timepicker with jquery selector on timepicker div that contains prev/next link & input field
   ***/
  initTime = function(allowEmpty) {
    var $timeInput = $timePicker.find('.moment-time');

    var isJourneyPlanner = false;

    var momentFormatInitOption = 'HH:i';
    var momentFormatString = '';

    if($timeInput.closest('.journey-planner-search').length && !($timeInput.closest('#viainput').length)) {
      isJourneyPlanner = true;
    }

    if(isJourneyPlanner) {
      momentFormatInitOption = 'HH:i ' + (i18n('time')).replace(/h/g, '!h').replace(/i/g, '!i');
      momentFormatString = ' ' + i18n('time');

      timeOptions = {
        clear: '',
        format: momentFormatInitOption,
        formatSubmit: false,
        editable: true,
        onSet: function(context) {
          var timeInput = $timePicker.find('.moment-time');
          if (context.select.value !== context.select.defaultValue) {
            timeInput.val(context.select.value);
          }
        }
      };
    }

    // initialize timepicker
    if ($timeInput.closest('#viainput').length) {
      $timePicker.data('picker', $timeInput.pickatime({
        interval: 5,
        min: [0,0],
        max:  [1,0],
        clear: '',
        format: 'HH:i',
        formatSubmit: false,
        editable: true
      }));
    } else {
      // set current time if empty
      if (!$timeInput.val().length && $timeInput.data('prevent-default') === undefined && !allowEmpty) {
        $timeInput.val(moment().format(momentTimeFormat) + momentFormatString);
      }

      $timePicker.data('picker', $timeInput.pickatime(timeOptions));
    }

    // auto scroll to selected time
    $timePicker.data('picker').data('pickatime').on('open', function(e) {
      var top = $timePicker.find('li.picker__list-item--selected')[0].offsetTop;
      $timePicker.find('div.picker__holder').scrollTop(top);
      
      // fixes error in edge (#111733)
      setTimeout(function() { $('.picker__list').toggle().toggle()}, 100);
    });

     // init handler for increasing time
    $timePicker.find('.moment-time-forward').on('click', function(event) {

      event.preventDefault();

      var $datePicker = $(this).closest('.cols24').find('.datepicker');
      var timeInput = $(this).parent().find('.moment-time');
      var time = moment(timeInput.val(), momentTimeFormat);

      // init moment with date from datepicker if exists
      if ($datePicker.length) {
        time = moment($datePicker.find('.moment-date').val() + ' ' + timeInput.val(), 'DD.MM.YYYY ' + momentTimeFormat)
      }

       //substract time difference when click on forward
      if ($(this).closest('#dm').length || $(this).closest('#viainput').length)
      {
        //if in dm add 5 minutes
        time = time.add('m', roundDiff5(time)).add('m', 5);
        timeInput.val(time.format(momentTimeFormat) + momentFormatString);
      } else
      {
        //add 30 minutes
        time = time.add('m', roundDiff(time)).add('m', 30);
        timeInput.val(time.format(momentTimeFormat) + momentFormatString);
      }

      // set date when changing day
      if ($datePicker.length && $datePicker.data('picker')) {
        $datePicker.data('picker').data('pickadate').set('select', [time.year(), time.month(), time.date()]);
      }

      timeInput.trigger('change');
    });

    // init handler for decreasing time
    $timePicker.find('.moment-time-back').on('click', function(event) {
      event.preventDefault();

      var $datePicker = $(this).closest('.cols24').find('.datepicker');
      var timeInput = $(this).parent().find('.moment-time');
      var time = moment(timeInput.val(), momentTimeFormat);

      // init moment with date from datepicker if exists
      if ($datePicker.length) {
        time = moment($datePicker.find('.moment-date').val() + ' ' + timeInput.val(), 'DD.MM.YYYY ' + momentTimeFormat)
      }

      //substract time difference when click on back
      if ($(this).closest('#dm').length || $(this).closest('#viainput').length)
      {
        //if in dm substract 5 minutes
        time = time.add('m', roundDiff5(time)).subtract('m', 5);
        timeInput.val(time.format(momentTimeFormat) + momentFormatString);
      } else
      {
        //substract 30 minutes
        time = time.add('m', roundDiff(time)).subtract('m', 30);
        timeInput.val(time.format(momentTimeFormat) + momentFormatString);
      }

      // set date when changing day
      if ($datePicker.length && $datePicker.data('picker')) {
        $datePicker.data('picker').data('pickadate').set('select', [time.year(), time.month(), time.date()]);
      }

      timeInput.trigger('change');
    });
  },

  /***
   * difference in minutes to closest 30 minutes
   ***/
  roundDiff = function (time) {
    return Math.round(time.minutes()/30)*30 - time.minutes();
  },

  /***
  * difference in minutes to closest 5 minutes
  **/
  roundDiff5 = function(time){
    return Math.floor(time.minutes()/5)*5 - time.minutes();
  },

  /***
  * transforms time into a valid format using moment.js
  ***/
  validateTime = function(){
    var $timeInput = $timePicker.find('.moment-time');

    //validate time
    if (!$timeInput.closest('#viainput').length) {
      var time = moment($timeInput.val(), "HH:mm").isValid()? moment($timeInput.val(), "HH:mm").format("HH:mm"): "  ";
      $timeInput.val(time);
    }
  };

  // return public methods
  return {
    initTime: initTime,
    validateTime : validateTime
  }
};
;
/***
 * switching between tabs (f.ex. trips/ departures on start page, slider)
 **/
VVO.Tabs = function() {

  /***
   * bind mouse and enter events for changing tab
   ***/
  var nextTab = function($tabsContainer, $targetTab, $targetTabNav) {
    var $currentTab = $tabsContainer.find('> div > .current-tab'),
        $currentTabNav = $tabsContainer.find('> div > .current-tab-nav');

    // set next tab if manually clicked ($targetTab parameter not set on animation), otherwise increase tab on autoplay
    if (!$targetTab) {
      // if current tab index is less than tab count set next tab, otherwise restart
      if ($tabsContainer.data('tabindex') < $tabsContainer.find('> .tab-content > div').length) {
        $targetTab = $currentTab.next();
        $targetTabNav = $currentTabNav.next();
        $tabsContainer.data('tabindex', $tabsContainer.data('tabindex') + 1);
      } else {
        $targetTab = $tabsContainer.find('> .tab-content > div:first-child');
        $targetTabNav = $tabsContainer.find('.tab-nav > .tab-header:first-child');
        $tabsContainer.data('tabindex', 1);
      }
    } else {
      if($tabsContainer.hasClass('animated-tabs')) {
        $tabsContainer.data('tabindex', $targetTabNav.index() + 1);
      }
    }

    // animate change betwenn old and new current
    $currentTab.hide(0, function() {
      // change state of content tab
      $currentTab.removeClass('current-tab').
        attr('aria-expanded', 'false').
        attr('aria-hidden', 'true');

      // change state of navi
      $currentTabNav.
        removeClass('current-tab-nav').
        attr('tabindex', '0').
        attr('aria-selected', 'false').
        addClass('green');

      // change state of new tab
      $targetTab.
        show().
        attr('aria-expanded', 'true').
        attr('aria-hidden', 'false').
        addClass('current-tab');

      // remove prev/next classes
      $currentTabNav.prev().removeClass('prev-tab');
      $currentTabNav.next().removeClass('next-tab');

      // change current navi state
      $targetTabNav.
        addClass('current-tab-nav').
        removeAttr('tabindex').
        attr('aria-selected', 'true').
        removeClass('green');

      // re-create prev/next classes
      $targetTabNav.next().addClass('next-tab');
      $targetTabNav.prev().addClass('prev-tab');

      // animate/show contents
      $targetTab.children().hide().delay(0).fadeIn(200);
    });
  },

  /***
   * start animation
   ***/
  startAnimation = function($tabsContainer) {

    // prevent init call from .animated-tabs
    if ($tabsContainer.data('skipAnimation') > 0) {
      $tabsContainer.find('.animated-tabs').each(function() {
        VVO.Tabs.nextTab($(this));
      });
    }

    // create timeout and increase skip for triggering if
    $tabsContainer.data('timeout', setTimeout(VVO.Tabs.startAnimation, 5000));
    $tabsContainer.data('skipAnimation', $tabsContainer.data('skipAnimation') + 1);
  },

  /***
   * stop animation
   ***/
  stopAnimation = function($tabsContainer) {
    clearTimeout($tabsContainer.data('timeout'));
  },

  /***
   * add ARIA labels
   ***/
  addARIAlabels = function($tabsContainer) {
    $tabsContainer.each(function(index) {

      // set aria-controls
      $(this).find('> .tab-nav').find('> h2, > a').each(function (index) {
        index++;
        $(this).attr('aria-controls', $(this).closest('.tabs').find('> .tab-content > :nth-child('+ index +')').attr('id'));
      });

      // set aria-labelledby
      $(this).find('> .tab-content').find('> div').each(function (index) {
        index++;
        $(this).attr('aria-labelledby', $(this).closest('.tabs').find('> .tab-nav > :nth-child('+ index +')').attr('id'));
      });
    });
  },

  /***
   * initialize tabs
   ***/
  init = function($tabsContainer) {

    // tab navigation: add aria roles and current/next tab class on init
    $tabsContainer.find('.tab-nav > :first-child').
      addClass('current-tab-nav').
      removeAttr('tabindex').
      attr('aria-selected', 'true').
      next().
      addClass('next-tab');

    // tab navigation: add tablist role to all tabs
    $tabsContainer.find('.tab-nav').attr('role', 'tablist');

    // tab content: add aria roles and current tab class on init
    $tabsContainer.find('.tab-content > div:first-child').
      attr('aria-expanded', 'true').
      attr('aria-hidden', 'false').
      addClass('current-tab');

    // tab content: add tabpanel role to all tabs
    $tabsContainer.find('.tab-content > div').
      attr('role', 'tabpanel');

    // tab content: hide content for non-visible tabs and add aria roles
    $tabsContainer.find('.tab-content > div').not('.tab-content > div:first-child').
      hide().
      attr('aria-expanded', 'false').
      attr('aria-hidden', 'true').
      attr('role', 'tabpanel');

    // add roles to tab links
    var $tabLinks = $tabsContainer.find('.tab-nav h2, .tab-nav a').
      addClass('tab-header').
      attr('role', 'tab').
      attr('tabindex', '0').
      attr('aria-selected', 'false');

    // set tabindex to first tab, skipanimation to 0
    $tabsContainer.data('tabindex', 1);
    $tabsContainer.data('skipAnimation', 0);

    // bind mouse and enter events for changing tab
    $tabsContainer.find('.tab-nav h2, .tab-nav a').on('click keydown', function(event) {
      if (event.keyCode === 13 || event.type === 'click') {
        event.preventDefault();
        VVO.Tabs.nextTab($tabsContainer, $('#' + $(this).attr('data-rel')), $(this));
      }
    });

    // stop animation on hover and focus on a tab
    $tabsContainer.find('.main-theme').on('mouseenter', function() {
      VVO.Tabs.stopAnimation($tabsContainer);
    });

    $tabLinks.on('focus', function(event) {
      VVO.Tabs.stopAnimation($tabsContainer);
    });

    // resume animation
    $tabsContainer.find('.main-theme').on('mouseleave', function(event) {
      $tabsContainer.data('skipAnimation', 0);
      VVO.Tabs.startAnimation($tabsContainer);
    });

    addARIAlabels($tabsContainer);
  };


  // return public methods
  return {
    nextTab: nextTab,
    startAnimation: startAnimation,
    stopAnimation: stopAnimation,
    init: init
  };
}();
;
/***
 * simple accordion script that allows multiple tabs to be open
 * sets ARIA-roles as well
**/
VVO.Accordion = function() {

  /************************************************************
    Strict Mode
    @see http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more
    *************************************************************/
  'use strict';

  /***
   * initialize single accordion
   ***/
  var initAccordion = function($header, $content, index) {

    var
      contentId = $content.attr('id') || 'accordion-content-' + index,
      headerId = $header.attr('id') || 'accordion-header-' + index;

    // add attributes to header
    $header.
      attr('role', 'tab').
      attr('tabindex', '0').
      attr('aria-selected', 'false').
      attr('id', headerId).
      attr('aria-controls', contentId);

    // add attributes to content
    $content.
      attr('aria-expanded', 'false').
      attr('role', 'tabpanel').
      attr('id', contentId).
      attr('aria-labelledby', headerId);

    var showOnInit = ($content.data('showoninit') !== undefined && $content.data('showoninit')) ||
                     (!!window.location.hash && (window.location.hash.substring(1) === contentId ||
                                                 window.location.hash.substring(1) === headerId));

    // sync height for content
    $content.find('.syncheight-element').mf_EqualHeight();

    // add icon
    $header.
      find('.animated-arrow').
      addClass('ico-arrow-' + (showOnInit ? 'up' : 'down'));

    $content.toggle(showOnInit);

    // bind click and keypress accordion header
    $header.on('click keydown', $content, function(e) {

      var
      content = e.data;

      if (e.keyCode === 13 || e.type === 'click') {
        e.preventDefault();

        // set aria roles
        var selected = $(this).attr('aria-selected') === 'true';

        // if event parameter "onlyopen" is set, do not close accordion
        if (!selected || !e.onlyOpen) {
          $(this).attr('aria-selected', (!selected).toString());

          content.attr('aria-expanded', (!selected).toString()).attr('aria-hidden', selected.toString());

          // toggle
          $(this).toggleClass('active');

          // toggle icon classes
          $(this).find('.animated-arrow').toggleClass('ico-arrow-down').toggleClass('ico-arrow-up');

          // change header label if defined
          var labelOpen = $(this).data('label-open') || '';
          var labelClosed = $(this).data('label-closed') || '';
          if (labelOpen || labelClosed) {
            $(this).find('p').html(selected ? labelClosed : labelOpen);
          }

          content.slideToggle();
        }
        $('body').trigger({type:"accordion-open", accordion: $(this), sourceId: e.sourceId });
      }
    });
  },


  /***
   * initialize accordion container with accordions
   ***/
  init = function($container) {

    if ($container === undefined || !$container.find('.accordion-header').length) {
      return;
    }

    // set role
    $container
      .attr('role', 'tablist')

      .find('.accordion-header').each(function () {
        initAccordion($(this), $(this).next('.accordion-content').length ? $(this).next('.accordion-content') : $(this).prev('.accordion-content'), $('.accordion-header').index($(this)));
      });
    $container.trigger({type:"accordion-initialized", accordion: $(this) });
  };

  // return public methods
  return init;
}();
;
/***
 * custom styled radio buttons
 **/
VVO.RadioSwitcher = function() {

  /***
   * change state of radios/ checkboxes
   ***/
  var changeState = function($container, $input, type) {
    if(type == 'h' || type == 'v') {
      $container.find('.switch-active').removeClass('switch-active');
      $input.next().addClass('switch-active');
    }
    else {
      $input.next().toggleClass('switch-active');
    }
  },

  /***
   * initialize accordion
   ***/
  init = function($container) {
    // get type by class name: switch-h (horizontal radio buttons), switch-v (vertical readio buttons), switch-checks (checkboxes)
    var type = $container.is('.switch-h') ? 'h' :
               $container.is('.switch-v') ? 'v' : 'cb';

    $container.find('label').addClass('switch-' + (type == 'h' ? 'label-h' :
                                                   type == 'v' ? 'label-v' : 'checks-label'));

    // set state to active on click
    $container.find('input').on('change', function() {
      VVO.RadioSwitcher.changeState($container, $(this), type);
    });

    // focus on label for accessibility
    $container.find('input').on('focus', function() {
      $(this).next().addClass('general-focus');
    });
    $container.find('input').on('blur', function() {
      $('.general-focus').removeClass('general-focus');
    });

    // set classes for first/last
    if(type === 'h' || type === 'v') {
      $container.find('label:first').addClass('switch-first-' + type);
      $container.find('label:last').addClass('switch-last-' + type);
    }

    // set width for horizontal radiobuttons
    if(type == 'h') {
      var count = $container.find('input').length,
          labels = $container.find('label');

      // set width of radios
      labels.css('width', (100/count + '%'));

      // set positioning within fieldset
      labels.each(function(index) {
        $(this).css('left', ((index * (100/count))) + '%');
      });
    }

    // select checked radio buttons
    VVO.RadioSwitcher.changeState($container, $container.find(':checked'), type);
  };

  // return public methods
  return {
    init: init,
    changeState: changeState
  };
}();
;
/***
 * dropdown box (used for form input icons (map, favorites,...) or search, meinvvo login dropdown)
 **/
VVO.DropDownBox = function() {

  /***
   * init drop down box
   * parameter $linkElement: jquery selector of clickable element with class switch_btn
   * parameter showCallback: function that is called after showing box
   * parameter hideCallback: function that is called after hiding box
   ***/
  var init = function($linkElement, showCallback, hideCallback) {

    var $box = $('#' + $linkElement.data('switch-rel'));
    // add tab index, aria roles
    $linkElement.
      attr('tabindex', '0').
      attr('aria-selected', 'false').
      data('switcher', 0);

    $box.attr('aria-expanded', 'false');

    // bind click event on link element
    $linkElement.off().on('click keydown', function (event) {
      event.stopPropagation();

      $box = $('#' + $(this).data('switch-rel'));

      // on click and enter
      if (event.keyCode === 13 || event.type === 'click') {
        event.preventDefault();

        // only one box can be opened at same time -> hide current active boxes
        $('.active-switch').
          removeClass('active-switch').
          attr('aria-selected', 'false');

        // increment switcher
        $linkElement.data('switcher', $linkElement.data('switcher') + 1);

        // reset switcher var of all other dropdown boxes to 0
        $('.switch_btn').not($linkElement).data('switcher', 0);

        // hide all other current active boxes
        $('.switch_content').not($box).
          attr('aria-expanded', 'false').
          hide();

        // decide wether to hide or show box
        if ($box.is(':visible')) {
          $linkElement.attr('aria-selected', 'false');
          $box.
            attr('aria-expanded', 'false').
            hide();

          // start callback function after hiding box
          if (hideCallback) {
            hideCallback();
          }
        } else {
          $linkElement.
            attr('aria-selected', 'true').
            addClass('active-switch');

          $box.
            attr('aria-expanded', 'true').
            show();

          // start callback function after showing box
          if (showCallback) {
            showCallback();
          }
        }
      }
    });

  },

  hide = function($map){
    if($map){
      //restore old div after close and delete data('map') information - allows new initialzing everytime map
      //is opened
      //data('html') is written in map-jquery.js
      if($map.data('map')){
        //remove map
        $map.data('map').remove();
        $map.removeData('map');
        
       }
    }
    //hide dropdownbox
    $('.switch_content_close').attr('aria-expanded', 'false').hide();
    $('.active-switch').
      removeClass('active-switch').
      attr('aria-selected', 'false');

    // hide all other current active boxes
    $('.switch_content').
      attr('aria-expanded', 'false').
      hide();
  };

  //return public methods
  return {
    init:init,
    hide : hide
  };
}();
;
/***
 * simple accordion script that allows multiple tabs to be open
 * sets ARIA-roles as well
**/
VVO.Colorbox = function () {

  /***
   * initialize accordion
   ***/
  var init = function () {

      var i18n = VVO.I18N.translate;

    // open colorbox when click on leafletlink
    $('body').on('click', '.leaflet-ajax-link', function () {

      $(this).colorbox({
        width: '1040px',
        maxHeight: $(window).height() * 0.8,
        height: $(window).height() * 0.8,
        opacity: 0.6,
        onComplete: function () {
          $('body').addClass("print-overlay");
          $('#colorbox').addClass('refresh');
          $('#cboxClose').append('<span class="icon-font ico-close"/>');
          VVO.Leaflet();
          $(this).trigger('cbox_ready');
        },
        onClosed: function () {
          $('body').removeClass("print-overlay");
        },

      });
    });

    // open colorbox when click on registerlink
    $('body').on('click', '.register-ajax-link', function () {
      $(this).colorbox({
        width: '50%',
        maxWidth: '60%',
        maxHeight: $(window).height() * 0.8,
        height: $(window).height() * 0.8,
        opacity: 0.6,
        onComplete: function () {
          $('body').addClass("print-overlay");
          $('#cboxClose').append('<span class="icon-font ico-close"/>');
          VVO.Account();
          $(this).trigger('cbox_ready');
        },
        onClosed: function () {
          $('body').removeClass("print-overlay");
        },

      });
    });

    // init overlay for inline-content
    $('body').on('click', '.js-inline-content', function () {
      $(this).colorbox({
        inline: true,
        opacity: 0.6,
        initialHeight: false,
        width: $(this).attr('data-colorbox') || '1000px',
        scrolling: false,
        top: '5%',
        onComplete: function () {
          $('body').addClass("print-overlay");
          $('#cboxClose').append('<span class="icon-font ico-close"/>');
          $(this).trigger('cbox_ready');
        },
        onClosed: function () {
          $('body').removeClass("print-overlay");
        }
      });
    });

    // overlay for ajax content
    $('body').on('click', '.ajax-content', function () {
      // width varies according to type of ajax-content
      let width = 60;
      if (window.location.href.indexOf('iframe=true') > -1) {
        width = 100;
      }
      // ajax-content of the timetablebook
      if ($(this).attr('id') === 'ttb-btn') {
        width = 90;
      }

      $(this).colorbox({
        width: `${width}%`,
        maxHeight: $(window).height() * 0.8,
        opacity: 0.6,
        onComplete: function () {
          $('body').addClass("print-overlay");
          $('body').addClass("no-scroll");
          $('#cboxClose').append('<span class="icon-font ico-close"/>');
          $(this).trigger('cbox_ready');
        },
        onClosed: function () {
          $('body').removeClass("print-overlay");
          $('body').removeClass("no-scroll");
        }
      });
    });

    // init overlay for images
    if ($('.zoom').length) {
      $('.zoom').colorbox({
        close: i18n('btn_close'),
        next: i18n('btn_next'),
        current: i18n('image') + ' {current} ' + i18n('image_of') + ' {total}',
        opacity: 0.6,
        open: false,
        innerHeight: 731,
        innerWidth: 827,
        className: function () {
          var extra_class = 'cbox-gallery';
          return $(this).hasClass('zoom-video') ? extra_class + ' cbox-video' : extra_class;
        },
        html: function () {
          var
            $zoom_element = $(this),
            html_content = false;

          if ($zoom_element.hasClass('zoom-audio')) {
            html_content = $zoom_element.find('.overlay-content').html();
          }

          return html_content;
        },
        previous: i18n('btn_previous'),
        transition: 'none',
        iframe: function () {
          return $(this).hasClass('zoom-video');
        },
        fixed: false,
        rel: function () {
          return $(this).closest('.gallery').data("rel");
        },
        title: function () {
          return $(this).next('.overlay-description').html();
        },
        onComplete: function () {
          $('body').addClass("print-overlay");
          $('#cboxPrevious').append('<span class="icon-font ico-arrow-slider-left"/>');
          $('#cboxNext').append('<span class="icon-font ico-arrow-slider-right"/>');
          $('#cboxClose').append('<span class="icon-font ico-close"/>');
          $(this).trigger('cbox_ready');
        },
        onClosed: function () {
          $('body').removeClass("print-overlay");
        }
      });

      // Listen to hashChange to open Gallery per Hash
      $(window).on('hashchange', function () {
        VVO.Colorbox.overlayPerHash();
      });
      VVO.Colorbox.overlayPerHash();

      $('.open-gallery').on('click', function (event) {
        event.preventDefault();

        $(this).closest('.gallery').find('.zoom').first().trigger('click');
      });
    }
  },

    // Open gallery with hash parameters
    overlayPerHash = function () {
      var hash = window.location.hash.slice(1);

      if (hash.indexOf(':') !== -1) {
        var
          gallery_id = hash.split(':')[0],
          image = hash.split(':')[1],

          $gallery = $('.gallery[data-rel="' + gallery_id + '"]'),
          $gallery_entry = $gallery.find('.zoom[data-id="' + image + '"]');

        if ($gallery.length && $gallery_entry.length) {
          $gallery_entry.trigger('click');
        }
      }
    },

    hide = function (that) {
      that.colorbox.close();
    }

  // return public methods
  return {
    init: init,
    hide: hide,
    overlayPerHash: overlayPerHash
  };
}();
;
/***
 * spinner (only one spinner simultaneously allowed)
 **/
VVO.Spinner = function() {

  var intervalId = false,
      spritePos = 0,
      spriteIdx = 0,
      
  /***
   * show spinner
   ***/
  show = function(mouseX, mouseY) {
    var $spinner = $('#loaderImage');
    
    // create spinner if not exists
    if(!$spinner.length) {
      $('body').append('<div id="loaderImage" style="background-image:url(/assets/img/spinner-528x24.png);width:24px;height:24px;"></div>');
      $spinner = $('#loaderImage');
    }
            
    if(!mouseX || !mouseY) {
      mouseX = '50%';
      mouseY = '50px';
    }
    else {
      // move spinner centered under mouse cursor
      mouseX -= 12;
      mouseY -= 12;
    }
    
    // positioning spinner under mouse or on screen center
    $spinner.css({
      'top': mouseY + 'px',
      'left': mouseX + 'px'
    });
    
    $spinner.show();
    
    if(intervalId) {
      clearInterval(intervalId);
    }
    
    intervalId = setInterval(function() { VVO.Spinner.proceed(); }, 100);
  },
  
  proceed = function() {
    //increase the index so we know which frame of our animation we are currently on
    spritePos += 24; // framewidth
    spriteIdx++;
     
    //if our spriteIdx is higher than our total number of frames, we're at the end and should restart
    if (spriteIdx >= 22) {
      spritePos = 0;
      spriteIdx = 0;
    }

    $('#loaderImage').css({ 'backgroundPosition': (-spritePos)+'px 0'});
  },
  
  hide = function() {
    $('#loaderImage').hide();
    
    clearTimeout(intervalId);
    intervalId = false;
    spritePos = 0;
    spriteIdx = 0;
  };
  
  // return public methods
  return {
    show: show,
    hide: hide,
    proceed: proceed
  };
}();
;
/***
 * autocompleter for points
 * based on https://github.com/meltingice/ajax-chosen/blob/master/index.html 09.03.2013
 **/
VVO.Autocompleter = function() {

  var i18n = VVO.I18N.translate;
  var log = VVO.Log;


  /***
   * main initalization
   ***/
  var init = function($select, toggleValues) {

    if(!$select.length) {
      return;
    }

    var
      chosenXhr = null, // current ajax request for autocompletion
      cache = {}, // request cache
      $chosenContainer, // container for chosen
      minTermLength = 3, // minimum length after which request should be triggered
      afterTypeDelay = 500, // delay after which request should be triggered
      ajaxOptions = {
        // ajax options
        type: 'GET', // method
        data: {}, // additional query paramters
        url: '/pointfinder/index', // url to pointfinder service
        dataType: 'json' // data type
      },
      icoPoiContainerId = $select.data('ico-poi-container'),
      icoFavoriteContainerId = $select.data('ico-favorite-container'),
      stopsOnly = $select.data('stops-only') || false,
      regionalOnly = $select.data('regional-only') || false,
      StopShortCuts = true,
      $otherAutocompleters = [];

    // get other autocompleters for disabling entries of already selected items
    if($select.data('other-autocompleters')) {
      var autocompleters = $select.data('other-autocompleters').split(',');
      for(var i = 0; i < autocompleters.length; i++) {
        $otherAutocompleters[i] = $('#' + autocompleters[i].trim());
      }
    }

    // call chosen
    $select.chosen();

    $chosenContainer = $select.next('.chosen-container');

    // add map icon
    if(icoPoiContainerId) {
      // $chosenContainer.find('.tooltip-icons').append('<li><a href="#" title="'+i18n('showonmap')+'" class="switch_btn active-switch-tooltip" data-switch-rel="' + icoPoiContainerId + '">'+
      //     '<span class="icon-font ico-poi" aria-hidden="true"></span>'+
      //     '<span class="text-hidden">'+i18n('showonmap')+'</span>'+
      //   '</a></li>');
      $chosenContainer.find('.ico-poi').on('click', function() {
        $select.data().chosen.results_hide();
      });
    }

    // add favorite icon
    if(icoFavoriteContainerId) {
      // $chosenContainer.find('.tooltip-icons').append('<li><a href="#" title="'+i18n('showasfavourite')+ '" class="switch_btn active-switch-tooltip" data-switch-rel="' + icoFavoriteContainerId + '" >'+
      //   '<span class="icon-font ico-favourite" aria-hidden="true"></span>'+
      //   '<span class="text-hidden">'+i18n('showasfavourite')+'</span>'+
      //   '</a></li>');
      $chosenContainer.find('.ico-favourite').on('click', function() {
        $select.data().chosen.results_hide();
      });
    }

    //bind click on delete button
    $('.autocompleter').off('click', '.delete-entry.autocompleter').on('click', '.delete-entry.autocompleter', function (event) {
      event.preventDefault();
      event.stopPropagation();

      var $input = $(this).closest('.chosen-search').find('.locationsearch');
      var $select = $input.parents('.chosen-container').siblings('select');
      $(this).addClass('hidden');
      $input.val('');

      $input.focus();
      $select.val('');
      $select.data('pointstring', VVO.PointHelper.getEmptyString());
      $select.html('<option value=""></option>');
      $select.data().chosen.results_build();
      $select.change();
      $input.trigger("keyup"); // trigger list refresh
      $('.advanced-options').trigger('change');
      $('#lineid').prop("disabled", true).trigger("chosen:updated");

      //toggle fav icon
      $(event.target).closest('.chosen-container').next('ul.tooltip-icons').find('.ico-favourite-filled,.ico-favourite')
        .removeClass('ico-favourite-filled').removeClass('ico-favourite').addClass('ico-favourite');
      $(event.target).closest('.chosen-container').next('ul.tooltip-icons').find('a.switch-btn-favorite').addClass('disabled');
    });

    //bind click on delete favorite button
    $('.autocompleter').off('click', '.delete-favorite.autocompleter-favorite').on('click', '.delete-favorite.autocompleter-favorite', function (event) {
      event.preventDefault();
      event.stopPropagation();

      var pointString = $(event.target).parents('li').find('span.displayname').data('pointstring');

      VVO.AutocompleteFavorite.del(pointString);
      VVO.AutocompleteHistory.del(pointString);

      VVO.Favourites.removeDeleteLink(event);

      $(this).closest('li').remove();
    });

    // show delete button
    $('.autocompleter').on('keyup focus', '.locationsearch', function (event) {
      $(this).next('.delete-entry').addClass('autocompleter').toggleClass('hidden', !$(this).val().length);
    });

    // when from homepagelink set preselection and open autocompleter
    if($select.data('preselection') && $select.data('preselection') !="")
    {
      //trigger mousedown event
      $select.data().chosen.container_mousedown($.Event);
      //set value
      $select.closest('div').find('input').val($select.data('preselection'));
    }


    // extend chosen autocomplete (noupdate = true -> don't clear select list)
    $select.data().chosen.customAutocomplete = function (noupdate) {

      var
        val = $chosenContainer.find('.chosen-search > input').val(),
        $resultsContainer = $chosenContainer.find('ul.chosen-results'),
        typeImages = {
          address: '/assets/img/autocomplete/ico-address.svg',
          coordinate: '/assets/img/autocomplete/ico-coordinate.svg',
          poi: '/assets/img/autocomplete/ico-poi.png',
          stop: '/assets/img/autocomplete/ico-stop.svg'
        },

        typeHoverImages = {
          address: '/assets/img/autocomplete/ico-address-h.svg',
          coordinate: '/assets/img/autocomplete/ico-coordinate-h.svg',
          poi: '/assets/img/autocomplete/ico-poi-h.png',
          stop: '/assets/img/autocomplete/ico-stop-h.svg'
        },

        typeAltText = {
          address: 'Adresse',
          coordinate: 'Koordinate',
          poi: 'Wichtiger Punkt',
          stop: 'Haltestelle'
        },

        // highlight search results
        highlight = function() {
          $resultsContainer.not('.no-results').find('span').each(function() {
            //$(this).html($(this).html().replace(new RegExp('(' + val + ')', "gi"),'<em>$1</em>'));
          });
        };


      // if timer of last input already running, cancel it
      if (this.timer) {
        clearTimeout(this.timer);
      }

      // set query parameter
      ajaxOptions.data = ajaxOptions.data || {};
      ajaxOptions.data.query = val;
      ajaxOptions.data.stopsonly = stopsOnly;
      ajaxOptions.data.regionalonly = regionalOnly;
      ajaxOptions.data.stopshortcuts = StopShortCuts;
      ajaxOptions.data.bsd = 1; // block bot witha.name when this parameter is missing

      // ajax error handler
      ajaxOptions.error = function(jqXHR, status, exception) {
        // ajax request was aborted by user
        if(status === 'abort') {
          return;
        }

        $resultsContainer.find(".no-results").html(i18n('autocomplete_error'));
      };

      // ajax success handler
      ajaxOptions.success = function (compressedPoints, isFavoritesList) {
        // initialize groups
        var favGroup=$('<optgroup label="' + i18n('favorites') + '"></optgroup>');
        var historyGroup=$('<optgroup label="' + i18n('last_inputs') + '"></optgroup>');

        // remove message list item
        $resultsContainer.find(".no-results").remove();

        // got no data -> show link for searching more
        if (compressedPoints && compressedPoints.length) {
          var favList = VVO.AutocompleteFavorite.getList();

          // add items to select list
          $.each(compressedPoints, function (i, compressedPoint) {
            var
              point = VVO.PointHelper.toPoint(compressedPoint);

            //remove shortcut from point string
            var cleanPointString = compressedPoint;
            if (point.ShortCuts !== '') {
              cleanPointString = compressedPoint.replace(point.ShortCuts, '');
            }

            var isFav = favList.indexOf(cleanPointString) !== -1;

            value = point.Id,
              text = '<img style="display:inline" aria-label="' +
              typeAltText[point.Type] +
              '" src="' +
              typeImages[point.Type] +
              '" data-hoversrc="' +
              typeHoverImages[point.Type] +
              '" data-src="' +
              typeImages[point.Type] +
              '"/><span class="clearfix"><strong class="right">' +
              point.ShortCuts +
              '</strong><span class="displayname" data-pointstring="' + compressedPoint + '" data-fav="' + isFav + '">' +
              point.Name +
              ', ' +
              point.Place +
              '</span></span>';

            // add option to select
            var option = $("<option />").attr('value', value).html(text);

            // add to favorite group
            if (typeof isFavoritesList === "boolean" && isFav && isFavoritesList) {
              option.appendTo(favGroup)
            }

            // add to history group
            if (typeof isFavoritesList === "boolean" && !isFav && isFavoritesList) {
              option.appendTo(historyGroup)
              option.find('strong.right')
                .before('<a class="delete-favorite history autocompleter-favorite right" href="#" role="button" tabindex="-1" title="'
                  + VVO.I18N.translate('removeasfavourite') + '"><span class="icon-font ico-close"></span></a>');
            }

            // add to select when points are requested with ajax call (more then 3 characters in input)
            if (typeof isFavoritesList !== "boolean"){
              option.appendTo($select);
            }

            // add groups if fav/history list is shown in select (less or equal 3 characters)
            if (typeof isFavoritesList === "boolean" && isFavoritesList && i === compressedPoints.length - 1) {
              favGroup.appendTo($select);
              historyGroup.appendTo($select);
            }

            if (isFav) {
              option.find('strong.right')
                .before('<a class="delete-favorite autocompleter-favorite right" href="#" role="button" tabindex="-1" title="'
                  + VVO.I18N.translate('removeasfavourite') + '"><span class="icon-font ico-favourite-filled"></span></a>');
            }

            option.data('point', point);
            option.data('pointstring', compressedPoint);

            // if exactly one element, set in select data-container for map
            if (compressedPoints.length === 1) {
              $select.data('point', point);
            }
          });

          // add element to cache
          cache[val] = compressedPoints;

          // update list
          $select.data().chosen.results_update_field();
          if ($('#lineid').length > 0) {
            $('#lineid').chosen();
            $('#lineid').html('<option value=""></option>');
            $('#lineid').data().chosen.results_build();
          }

          // set highlighting
          highlight();

          //add amount of results for bitV
          $resultsContainer.append('<span role="status" style="position:absolute; top:-900px;">'+compressedPoints.length +' '+ i18n('autocompleter_results') +'</span>');
        }
        else {
          $resultsContainer.append($('<li class="no-results">' + i18n('autocompleter_point_not_found') + '</li>'));
        }
      };


      // input field is empty and selectbox value is preset, don't show list with history
      // additionally when toggling origin/destination, no ajax request is needed
      if ((toggleValues || !val) && $select.val() && $.trim($select.val()) && $select.data('pointstring')) {
        toggleValues = false;
        $select.html('');

        if (typeof ($select.data('pointstring')) === 'string') {
          ajaxOptions.success([$select.data('pointstring')]);
        }

        return;
      }

      // if noupdate is true/ last state should be shown exit
      if (noupdate) {
        // highlight search results
        highlight();

        return;
      }

      // remove old entries
      $select.html('<option value=""></option>');
      $select.data().chosen.results_build();

      // create message list item if not exists, set message while typing
      if (!$resultsContainer.find(".no-results").length) {
        var msg = val.length < minTermLength ? i18n('furtherInput') : i18n('searchinprogress') + ' <img src="/assets/img/spinner.gif" style="display:inline">';
        $resultsContainer.append($('<li class="no-results">' + msg + '</li>'));
      }

      // if input is too short, try to get user favorites or history
      if (val.length < minTermLength) {
        var favorites = VVO.AutocompleteFavorite.getList(val.toLowerCase(), stopsOnly);

        if (favorites.length < VVO.AutocompleteHistory.maxListSize) {
          favorites = VVO.AutocompleteHistory.getList(val.toLowerCase(), stopsOnly, favorites);
        }

        ajaxOptions.success(favorites, true);
        return;
      }

      // set timeout after key has been pressed
      this.timer = setTimeout(function () {
        // abort current pending requests
        if (chosenXhr) {
          chosenXhr.abort();
        }

        // check if element exists in cache
        var cacheKey = val;
        if (cacheKey in cache) {
          ajaxOptions.success(cache[cacheKey]);
          return;
        }

        // trigger ajax request now
        chosenXhr = $.ajax(ajaxOptions);
      }, afterTypeDelay);
    };

    // initialization for preset value
    $select.data().chosen.customAutocomplete();


    // handler for setting selection to user history cookie if enabled
    var enableCookies = $select.data('enable-cookies') === undefined ? true : $select.data('enable-cookies');
    if(enableCookies) {
      $select.closest('form').on('submit', function (event) {
        if ($select.val()) {
          for (var i in cache) {
            for (var j = 0; j < cache[i].length; j++) {
              if (cache[i][j].indexOf($select.val()) === 0) {
                VVO.AutocompleteHistory.set(cache[i][j]);
                break;
              }
            }
          }
        }
      });
    }
  };

  // return public methods
  return init;
}();
;
/***
 * methods for storing autocomplete point selections of user
 ***/
VVO.AutocompleteHistory = {
  maxEntries: 3,   // max number of entries in history
  maxListSize: 10,   // max number of elements that should be shown in list

  /***
   * get all objects of a list
   * term         : optional parameter for filtering
   * stopsOnly    : filter stops only
   * favorites    : list of favorites
   **/
  getList: function(term, stopsOnly, favorites) {
    var retval = VVO.PointCookie.getList('ac_hist', term, stopsOnly).reverse();

    if (favorites) {
      $.merge(favorites, retval);
      retval = VVO.AutocompleteHistory.unique(favorites);
    }

    // reduce amount of entries that should be shown
    if(retval.length > VVO.AutocompleteHistory.maxListSize) {
      retval = retval.slice(0, VVO.AutocompleteHistory.maxListSize);
    }

    return retval;
  },


  /***
   * add a single object to history
   * if already exists, only order in list is modified
   **/
  set: function(pointString) {
    //remove shortcut from point string
    var point = VVO.PointHelper.toPoint(pointString);
    var cleanPointString = pointString;
    if (point.ShortCuts !== '') {
      cleanPointString = pointString.replace(point.ShortCuts, '');
    }

    VVO.PointCookie.set('ac_hist', cleanPointString, VVO.AutocompleteHistory.maxEntries);
  },


  /***
   * delete cookie, only for test purposes
   **/
  del: function() {
    $.cookie('ac_hist','');
    $.cookie('ac_hist', null, { expires: -1});
  },

  /***
   * delete cookie entry
   **/
  del: function (point) {
    VVO.PointCookie.deleteByPoint('ac_hist', point);
  },


  /**
   * get list with distinct values
   */
  unique: function unique(list) {
    var result = [];
    $.each(list, function (i, e) {
      if ($.inArray(e, result) === -1) result.push(e);
    });
    return result;
  }
};
;
/***
 * methods for storing autocomplete point selections of user
 ***/
VVO.AutocompleteFavorite = {
  maxEntries: 10,   // max number of entries in favorites
  maxListSize: 5,   // max number of elements that should be shown in list

  /***
   * get all objects of a list
   * term         : optional parameter for filtering
   * stopsOnly    : filter stops only
   **/
  getList: function (term, stopsOnly) {
    var retval = VVO.PointCookie.getList('fav_points', term, stopsOnly).reverse();

    // reduce amount of entries that should be shown
    if (retval.length > VVO.AutocompleteFavorite.maxEntries) {
      retval = retval.slice(0, VVO.AutocompleteFavorite.maxEntries);
    }
    return retval;
  },


  /***
   * add a single object to favorite
   * if already exists, only order in list is modified
   **/
  set: function (point) {
    VVO.PointCookie.set('fav_points', point, VVO.AutocompleteFavorite.maxEntries);
  },


  /***
   * delete cookie entry
   **/
  del: function (point) {
    VVO.PointCookie.deleteByPoint('fav_points', point);
  }
};;
/***
 * departure monitor application logic
 **/
VVO.DepartureMonitor = function() {

  var i18n = VVO.I18N.translate;
  var log = VVO.Log;
  var updatingDepartures = false;

  /***
   * filter departures list
   ***/
  var initFilter = function() {
    // avoid page load on submit
    $('.filter:parent').on('submit', function(event) {
      event.preventDefault();
    });

    // filter list on keypress (order of keyup input is important for IE < 10)
    $('.filter').on('keyup input', function() {
      // basic view: one item list, extended view: two
      var
      $itemLists = $('.departures-arrivals .item-list').filter(':visible'),
      value = $(this).val();

      // iterate over all lists
      $itemLists.each(function(i, itemList) {
        // check if input is substring of data-filter attribute in each list item and show/hide item
        $(itemList).find('> li:not(".empty-list")').each(function() {
          $(this).toggle($(this).data('filter').toLowerCase().indexOf(value.toLowerCase()) !== -1);
        });

        // if nothing found try to get parent trans-info div and hide
        if($(itemList).parent().find('.trans-info').length) {
          $($(itemList).parent().find('.trans-info')[i]).toggle($(itemList).find('> li').filter(':visible').not('.empty-list').length !== 0);
        }
      });

      // show/hide error message
      $itemLists.find('.empty-list').toggle($itemLists.find('> li').filter(':visible').not('.empty-list').length === 0);
    });
  },

  /***
   * helper for switching between basic and extended view (toggle list & links, set cookie)
   ***/
  toggleView = function(isBasic) {
    // clear filter value
    $('.filter').val('');
    $('.filter').trigger('keyup');

    // toggle list (a - basic, b - extended)
    $('.option-a').toggle(isBasic);
    $('.option-b').toggle(!isBasic);

    // toggle links
    $('.lnk-opt-b').toggle(isBasic);
    $('.lnk-opt-a').toggle(!isBasic);

    // save value to cookie (no expiration)
    $.cookie('dmviewmode', isBasic ? 'basic' : 'advanced', { expires: 999});
  },

  /***
   * switch between basic and extended view
   ***/
  initViewSwitch = function() {

    // set last selection from cookie
    toggleView($.cookie('dmviewmode') !== 'advanced');

    // action for extend mode
    $('.lnk-opt-b').on('click', function(event) {
      event.preventDefault();
      toggleView(false);
    });

    // action for basic mode
    $('.lnk-opt-a').on('click', function(event) {
      event.preventDefault();
      toggleView(true);
    });
  },

  adjustMapSize = function() {
    // initialize and set height of map, find generated id
    $('.details:visible').each(function() {
      var
        $id = $(this).find('.col:last .map-output'),
        id = $id.attr('id'),
        height = 600,
        map = $id.data('map');

      // reset height of map to get height of left column
      $id.css('height', height);
      $('#' + id + '-geographic').css('height', height);

      height = Math.max(600, $(this).find('.col:first').height());

      // set new height
      $id.css('height', height);
      $('#' + id + '-geographic').css('height', height);

      if (map) {
        map.invalidateSize(false);
      }
    });
  },

  /***
   * logic for getting details
   ***/
  initDetails = function () {

    $('.departures-arrivals').find('.load-details').not('.active-details').each(function () {

      var that = $(this);

      // one-time-event for loading details
      that.off().one('click keypress', function(event) {

        var code = event.keyCode ? event.keyCode : event.which;

        // 13 = Enter
        if (code === 13 || event.type === 'click') {

          // change icon classes
          that.find('.ico-accordion').toggleClass('ico-arrow-down').toggleClass('ico-arrow-up');

          // show spinner
          VVO.Spinner.show(event.pageX, event.pageY);

          // toggle active class
          that.toggleClass('active-details');

          $.ajax({
            url: that.data('id'), // from data-id of li
            success: function(data) {

              // insert data into DOM
              data = $(data).filter('*');
              that.after(data);
              data.slideDown(0);

              that.off().on('click keypress', function(event) {

                var code = event.keyCode ? event.keyCode : event.which;

                // 13 = Enter
                if (code === 13 || event.type === 'click') {

                  // change icon classes
                  that.find('.ico-accordion').toggleClass('ico-arrow-down').toggleClass('ico-arrow-up');

                  // new event for li: toggle new data
                  that.next().slideToggle(0);

                  // toggle active class
                  that.toggleClass('active-details');

                  // init menu on each entry
                  $('.departures-arrivals .switch_btn').each(function () {
                    VVO.DropDownBox.init($(this), adjustMapSize, adjustMapSize);
                  });
                }
              });
            },

            error: function(jqXHR, status, exception) {
              that.after('<div class="details">' +
                            '<div class="msg msg-error" role="alert">' +
                              '<a title="' + i18n('close') + '" class="msg-close" href="#"><span class="icon-font ico-close"></span></a>' +
                              '<p>' + i18n('ajax_error') + '</p>' +
                            '</div>'+
                          '</div>');
            },

            complete: function () {
              //init save favourite functionality
              VVO.Favourites.init();
              //init subscribe routchanges functionality
              VVO.RouteChangesSubscription.init();
              // hide spinner
              VVO.Spinner.hide();

              // initialize and set height of map, find generated id
              var id = that.next().find('.map-output').attr('id');
              adjustMapSize();

              // initialize map
              VVO.OsmMap(id);

              // init menu on each entry
              $('.departures-arrivals .switch_btn').each(function () {
                VVO.DropDownBox.init($(this), adjustMapSize, adjustMapSize);
              });

              // auto close menu on click
              $('body').not('.switch_btn').click(function () {
                VVO.DropDownBox.hide();
              });
            }
          });
        }
      });

      // add icon class
      that.find('.animated-arrow').addClass('ico-arrow-down');
    });
  },

  initInstantSearch=function(){
    $("#departureform :input").not('input[name="mot"]').not('.moment-time').not('.moment-date').off('change').on('change',function() {
     $("#departureform").submit();
    });

    var oldValue="";
    var timer = 0;
    $("#departureform .moment-date, .moment-time").on('change', function(){
      if(oldValue === $(this).val()) {
        return;
      }

      if(timer != 0) {
        clearTimeout(timer);
        timer = 0;
      }

      timer = setTimeout( function() {
        VVO.TimePicker($('.timepicker')).validateTime();
        $('#departureform').submit();
        clearTimeout(timer);
        timer = 0;
      }, 500);
    });

   oldValue="";
   timer = 0;
   $('#departureform input[type="text"]').not('.moment-date, .moment-time').off('keyup').on('keyup', function(){
       // if nothing has changed (special key)
      if(oldValue === $(this).val()) {
        return;
      }

      if(timer != 0) {
        clearTimeout(timer);
        timer = 0;
      }

      timer = setTimeout( function() {
        $('#departureform').submit();
        clearTimeout(timer);
        timer = 0;
      }, 2000);
   });

   $("#departureform input[name='mot']").off('change').on('change', function(){
      // if nothing has changed (special key)
      if(oldValue === $(this).val()) {
        return;
      }

      if(timer != 0) {
        clearTimeout(timer);
        timer = 0;
      }

      timer = setTimeout( function() {
        $('#departureform').submit();
        clearTimeout(timer);
        timer = 0;
      }, 1000);
   });

   $('body').off('selectChanged').on("selectChanged", function(){
     $("#departureform").submit();
   });
  },

    initEndlessScroll = function () {
      var win = $(window);
      win.scroll(function () {
        // End of the document reached?
        if (!updatingDepartures && $(window).scrollTop() + $(window).height() > $(document).height() - $("footer").height() - 100) {
          updatingDepartures = true;
          var lastdeparture = $("#departureList li:last").prev();
          if (lastdeparture.find(".msg-error").length > 0) {
            lastdeparture = lastdeparture.prev();
          }
          var data = $('#departureform').serializeArray();

          data.push({ name: 'lastDepartureId', value: lastdeparture.data('departure-id') });
          data.push({ name: 'lastDepartureTime', value: lastdeparture.data('departure-time') });

          $.ajax({
            url: '/de/fahrplan/aktuelle-abfahrten-ankuenfte/abfahrten',
            data: $.param(data),
            success: function (result) {
              if (typeof result.success !== 'undefined' && !result.success) {
                if ($("#departureList li:last").prev().find(".msg-error").length === 0) {
                  lastdeparture.after('<li>' +
                  '<div class="details">' +
                  '<div class="msg msg-error" role="alert">' +
                  '<a title="' +
                  i18n('close') +
                  '" class="msg-close" href="#"><span class="icon-font ico-close"></span></a>' +
                  '<p>' + (result.message || i18n('errornextdepartures')) +
                  '</p>' +
                  '</div>' +
                  '</div>' +
                  '</li>');
                }
              } else {
                if ($("#departureList li:last").prev().find(".msg-error").length > 0) {
                  $("#departureList li:last").prev().remove();
                }
                lastdeparture.after(result);
                initDetails();
              }
              updatingDepartures = false;
            },
            error: function () {
              if ($("#departureList li:last").prev().find(".msg-error").length === 0) {
              lastdeparture.after('<li>' +
                '<div class="details">' +
                '<div class="msg msg-error" role="alert">' +
                '<a title="' +
                i18n('close') +
                '" class="msg-close" href="#"><span class="icon-font ico-close"></span></a>' +
                '<p>' +
                '<p>' + i18n('errornextdepartures') +
                '</p>' +
                '</div>' +
                '</div>' +
                '</li>');
              }
              updatingDepartures = false;
            }
          });
        }
      });
    },

  /***
   * main init for all components
   ***/
    init = function () {
    initFilter();
    initViewSwitch();
    initDetails();
    initInstantSearch();
    initEndlessScroll();

    //init save favourite
    VVO.Favourites.initSaveFavourite();

    // disable submit button if stop, time or date is empty
    //VVO.Validation.initHandleEmpytInputs($('#start-loc,#datepicker1,#timepicker1'));

    // open accordion and initialize map if necessary
    $('div.accordion-map').on('accordion-initialized', function () {
      if ($('#stopid').val() === "") {
        $(this).find('.accordion-header').trigger('click');
        VVO.OsmMap('inputmap', { zoomToId: 'stopid', extendLegend: true });
      }
    });

    return null;
  };

  // return public methods
  return init;
}();
;
/***
 * short distance stop application logic
 **/
VVO.ShortDistanceStops = function() {

  var i18n = VVO.I18N.translate;
  
  /***
   * show short distance stops
   * @param {objectlist} stops string list of short distance stops
   ***/
  var showStops = function (stops) {
    var html = '<div id="sdstopscontainer">';
    var coordinates = '';
    var leafletCoords = [];
    if (stops.length) {
      html += '<p><b>' + i18n('sd_stops_notice') + '</b></p>';

      var itemsPerCol = Math.round(stops.length / 2);
      html += '<div class="cols12">';
      for (var j = 1; j <= 2; j++) {
        html += '<div class="col c6of12"><ul>';
        for (var i = (j - 1) * itemsPerCol; i < j * itemsPerCol && i < stops.length; i++) {
          html += '<li><p>' + stops[i].Name;
          
          if ($('#stopid').data('point').Place !== stops[i].Place) {
            html += ', ' + stops[i].Place;
          }
          
          html += '</p></li>';
          coordinates += stops[i].Longitude + '|' + stops[i].Latitude + ',';
          leafletCoords.push(new L.LatLng(stops[i].Latitude, stops[i].Longitude));
        }
        html += '</ul></div>';
      }
      html += '</div>' +
        '<p class="error"><b>' + i18n('sd_stops_notice2') + '</b></p>';

      coordinates = coordinates.slice(0, -1);
    }

    $('#sdstops').html(html + '</div>');

    if (!stops.length && $('#stopid').val()) {
      VVO.Helper.showMessage($('#sdstopscontainer'), 'error', i18n('sd_stops_error') + $('#stopid').children("option:selected").text() + '.');
    }

    // set assigned stops and reload map
    $('#inputmap').data('stops', coordinates);
    VVO.OsmMap('inputmap', { zoomToId: 'stopid' });
  },

  /***
   * main init for all components
   ***/
    init = function () {
      VVO.CommonInitAjax();
      VVO.WebsiteInitAjax();

      // init autocompletion
      VVO.Autocompleter($('#stopid'));

      // map accordion
      VVO.Accordion($('.accordion-map'));

      // init drop down box for map
      $('#sdform .ico-poi').on('click keydown', function (e) {
        e.preventDefault();
        $('.accordion-map .accordion-header').trigger({ type: "click", onlyOpen: true });
      });

      $('body').off('accordion-open').on('accordion-open', function () {
        // only initialize map if accordion was opened
        if ($('.accordion-map .accordion-header').attr('aria-selected') === 'true') {
          VVO.OsmMap('inputmap', { activePinTypes: ['stop'], ignoreCookiePinTypes: true, zoomToId: 'stopid', extendLegend: true });
        }
      });

      if ($('#stopid').val() !== "" && isNaN($('#stopid').val()) || $('#inputmap').hasClass('visible')) {
        $('.accordion-map .accordion-header').trigger({ type: "click", onlyOpen: true });
      }

      // init ajax form
      VVO.AjaxForm($('#sdform'), false, 'stopid', showStops, function() {
        VVO.Helper.showMessage($('#message'), 'error', VVO.I18N.translate('ajax_error'));
      });
  };

  // return public methods
  return {
    Init: init,
    ShowStops: showStops
  };
}();
;
// ReSharper disable UseOfImplicitGlobalInFunctionScope, PossiblyUnassignedProperty

/***
 * trip request application logic
 **/
VVO.TripRequest = function () {
  var i18N = VVO.I18N.translate;
  var originPoint = null;
  var originPointMarker = null;
  var viaPoint = null;
  var viaPointMarker = null;
  var destinationPoint = null;
  var destinationPointMarker = null;
  var defaultMap = null;
  var connectionLine = null;
  var latlngs = [];

  /***
   * change origin with destination
   ***/
  var initChangeOrigDest = function () {
    $('.from-to-switch').off('click').on('click', function (event) {
      event.preventDefault();

      var originId = $('#originid').val();
      var originVal = $('#originid option[value="' + originId + '"]').html();
      var originPointString = $('#originid.select').data('pointstring');

      var destinationId = $('#destinationid').val();
      var destinationVal = $('#destinationid option[value="' + destinationId + '"]').html();
      var destinationPointString = $('#destinationid.select').data('pointstring');

      $('#originid').html('<option value="' + destinationId + '">' + destinationVal + '</option>');
      $('#originid').data().chosen.results_update_field();
      $('#originid.select').data('pointstring', destinationPointString);

      $('#destinationid').html('<option value="' + originId + '">' + originVal + '</option>');
      $('#destinationid').data().chosen.results_update_field();
      $('#destinationid.select').data('pointstring', originPointString);

      if (!$('#originid').val()) {
        var originImgContainer = $("#originid_chosen>a img");
        originImgContainer.remove();
      }

      if (!$('#destinationid').val()) {
        var destinationImgContainer = $("#destinationid_chosen>a img");
        destinationImgContainer.remove();
      }

      VVO.Autocompleter($('#originid'), true);
      VVO.Autocompleter($('#destinationid'), true);
    });
  },


  /**
   * adjust size of map
   */
  adjustMapSize = function () {
    // initialize and set height of map, find generated id
    $('.journey-detail:visible').each(function () {
      var
        $id = $(this).find('.col:last .map-output'),
        id = $id.attr('id'),
        height = 600,
        map = $id.data('map');

      // reset height of map to get height of left column
      $id.css('height', height);
      $('#' + id + '-geographic').css('height', height);

      height = Math.max(600, $(this).find('.col:first').height());

      // set new height
      $id.css('height', height);
      $('#' + id + '-geographic').css('height', height);

      if (map) {
        map.invalidateSize(false);
      }
    });
  },


  /***
   * show trip details
   ***/
  initDetails = function () {

    // init drop down box for print menu
    $('.print-menu-container').find('.switch_btn').each(function () {
      VVO.DropDownBox.init($(this));
    });

    $('body').not('.print-menu-container .switch_btn,.search-menu input').click(function (e) {
      if (e.target !== $('.search-menu input')[0]) {
        VVO.DropDownBox.hide();
      }
    });

    //init save favourite functionality
    VVO.Favourites.init();

    //init subscribe routchanges functionality
    VVO.RouteChangesSubscription.init();

    //add click functionality for showing details
    $('.tour-content > ul > li').children().not('.journey-detail').off('click keypress').on('click keypress', function (event) {
      var code = event.keyCode ? event.keyCode : event.which;

      //exclude checkbox from click
      if ($(event.target).closest('.counter').length > 0) {
        return;
      }

      // 13 = Enter
      if (code === 13 || event.type === 'click') {

        // toggle active class
        $(this).toggleClass('active-trip-info');

        // toggle icon classes
        $(this).find('.animated-arrow').toggleClass('ico-arrow-down').toggleClass('ico-arrow-up');

        // initialize and set height of map
        adjustMapSize();

        // init map
        VVO.OsmMap($(this).closest('li').find('.map-output').attr('id'));
      }
    });

    //remove checkboxes from showing details functionality
    $('.tour-content > ul > li').find('input').off('click').on('click', function (event) {

      event.stopPropagation();
    });
  },


  /***
   * show intermediate stops and route changes
   ***/
  initShowIntermediateStops = function () {

    $('.journey-planner .stopover-switch').closest('small,p').on('click', function (event) {
      event.stopPropagation();
      event.preventDefault();

      var
        that = $(this),
        intermediateStops = that.closest('ul.connection-detail').find('.stopover[data-partialrouteid="' + that.closest('li').data('partialrouteid') + '"]');

      // add consecutive stopovers even when partial route id is not equal (used for footpaths!)
      var li = that.closest('li');
      while (li.next().get(0) !== undefined && li.next().get(0) === li.next('.stopover').get(0)) {
        intermediateStops = intermediateStops.add(li.next('.stopover'));
        li = li.next();
      }
      //add previous stopovers (used for last footpath in partial route
      while (li.prev().get(0) !== undefined && li.prev().get(0) === li.prev('.stopover').get(0)) {
        intermediateStops = intermediateStops.add(li.prev('.stopover'));
        li = li.prev();
      }

      // toggle icon
      $(this).find('a span')
        .toggleClass('ico-arrow-down')
        .toggleClass('ico-arrow-right');

      // show intermediate stops
      intermediateStops.toggle();

      // change link text
      if (intermediateStops.first().is(':visible')) {
        that.find('.text').text(i18N('hide_stopovers'));
      } else {
        that.find('.text').text(i18N('show_stopovers'));
      }

      // fix map height
      adjustMapSize();
    });
  },

  /***
   * toggle individual mobility settings
   ***/
  initToggleIndividualSettings = function () {

    $('.mobility-options').find('input').on('change', function () {
      $('.individual-settings-container').toggle($(this).val() === 'Individual');
    });
  },

  /***
   * reset default options
   **/
  initOptions = function () {

    // reset options button click handler
    $('.js-resettodefault').on('click', function (event) {
      event.preventDefault();
      //delete Mobility cookie
      $.cookie('mobility', '', { path: '/', expires: -5 });

      //reset savemobility checkbox
      $('#savemobility').attr('checked', false);

      $('#unlimited-number-of-changes').click();
      $('#all-routes').click();

      var mots = ['check-train', 'check-metropolitan-railway', 'check-tram', 'check-citybus', 'check-regiobus', 'check-cablerailway', 'check-ferry', 'check-ast'];
      for (var i = 0; i < mots.length; i++) {
        $('#' + mots[i]).prop('checked', true);
        $('.' + mots[i]).addClass('switch-active');
      }

      $('#normal').click();
      $('#m5').click();
      $('#no-disabillities').click();

      if (!$('#no-alternativestops').prop('checked')) {
        $('#no-alternativestops').click();
      }

      // reset via
      $('#viaid').html('<option value=""></option>');
      $('#viaid').data().chosen.results_update_field();
      $('input[name="durationofstay"]').val('00:00');

      // trigger change event to set active flag
      $('.advanced-options').trigger('change');

      // hide active option flags
      $(".advanced-options--active").addClass("hidden");
      $(".advanced-options--active ul li:not(:last-child)").remove();
    });

    // toggle options active flag when changing options
    $('.advanced-options').on('change', function () {
      var mots = ['check-train', 'check-metropolitan-railway', 'check-tram', 'check-citybus', 'check-regiobus', 'check-cablerailway', 'check-ferry', 'check-ast'];
      var motsChecked = true;
      for (var i = 0; i < mots.length; i++) {
        if (!$('#' + mots[i]).prop('checked')) {
          motsChecked = false;
          break;
        }
      }

      if (!$('#unlimited-number-of-changes').prop('checked') || !$('#all-routes').prop('checked') || !motsChecked ||
        !$('#normal').prop('checked') || !$('#m5').prop('checked') || !$('#no-disabillities').prop('checked') || !$('#no-alternativestops').prop('checked')
        || ($('#viaid').val() !== null && $('#viaid').val().length !== 0)) {
        $('.options-status').css('display', 'inline');
      }
      else {
        $('.options-status').hide();
      }

      if (!$('#unlimited-number-of-changes').prop('checked') || !$('#all-routes').prop('checked') || !motsChecked ||
        !$('#normal').prop('checked') || !$('#m5').prop('checked') || !$('#no-disabillities').prop('checked') || !$('#no-alternativestops').prop('checked')) {
        $.cookie('mobility', $('#triprequestform .advanced-options input').serialize(), { expires: 99999, path: '/' });
        if ($('#triprequestform .advanced-options input').serialize() !== $.cookie('mobility')) {
          VVO.Log('couldnt write cookie');
        }
      }
      else {
        $.cookie('mobility', $(this).val(), { path: '/', expires: -5 });
      }
    });

    [
      {
        nameDefaultValue: 'no-disabillities',
        nameGroup: 'mobilityrestriction', // frontend: mobility-options
        nameWrapper: 'mobility-options',
      },
      {
        nameDefaultValue: 'unlimited-number-of-changes',
        nameGroup: 'maxchanges', // frontend: number-of-changes
        nameWrapper: 'number-of-changes-options',
      },
      {
        nameDefaultValue: 'all-routes',
        nameGroup: 'extracharge', // frontend: surcharge
        nameWrapper: 'route-options',
      },
      {
        nameDefaultValue: 'normal',
        nameGroup: 'walkingspeed', // frontend: walking-speed
        nameWrapper: 'walking-options',
      },
      {
        nameDefaultValue: 'm5',
        nameGroup: 'footpathtostop', // frontend: footpath
        nameWrapper: 'footpath-options',
      },
    ].forEach(function (option) {
      // initiate advanced options on ajax reload
      if ($('.' + option.nameWrapper + ' input[name="' + option.nameGroup + '"]:checked')[0]) {
        var currentValueId = $('.' + option.nameWrapper + ' input[name="' + option.nameGroup + '"]:checked')[0].id;

        if (currentValueId !== option.nameDefaultValue) {
          var i18nCode = 'filter_' + currentValueId.toLowerCase().replace(/-/g, '_');
          var parentList = $('.advanced-options--active ul');
          var optionLabelBox = $('.advanced-options--active');
          var optionLabelBoxLastItem = $('.advanced-options--active ul li:last-child');

          if (i18N(i18nCode) !== undefined) {
            optionLabelBoxLastItem.before('<li><button type="button" class="btn icon-btn flat-btn" data-reset="' + option.nameDefaultValue + '" data-group="' + option.nameWrapper + '">' + i18N(i18nCode) + ' <span class="icon-font ico-close" aria-hidden="true"></span></button></li>');
          }

          checkForEmptyList(parentList, optionLabelBox);
        }


        $('.' + option.nameWrapper + ' input[name="' + option.nameGroup + '"]').on('change', function () {
          var i18nCode = 'filter_' + this.id.toLowerCase().replace(/-/g, '_');
          var parentList = $('.advanced-options--active ul');
          var optionLabelBox = $('.advanced-options--active');
          var optionLabelBoxLastItem = $('.advanced-options--active ul li:last-child');

          optionLabelBox.find('[data-group="' + option.nameWrapper + '"]').closest('li').remove();

          if (i18N(i18nCode) !== undefined) {

            optionLabelBoxLastItem.before('<li><button type="button" class="btn icon-btn flat-btn" data-reset="' + option.nameDefaultValue + '" data-group="' + option.nameWrapper + '">' + i18N(i18nCode) + ' <span class="icon-font ico-close" aria-hidden="true"></span></button></li>');

            $('.advanced-options--active ul li:nth-last-child(2) button').click(function () {
              removeLabelFromList(this);
            });
          } else {
            $('#' + option.nameDefaultValue).click();
          }

          checkForEmptyList(parentList, optionLabelBox);
        });
      }
    });


    var transportOptionActive = false;

    [
      'check-train',
      'check-metropolitan-railway',
      'check-tram',
      'check-citybus',
      'check-regiobus',
      'check-cablerailway',
      'check-ferry',
      'check-ast'
    ].forEach(function (element) {
      // initiate advanced options on ajax reload
      if (!$('.transport-options #' + element + ':checked').length) {
        transportOptionActive = element;
      }

      $('.transport-options #' + element).change(function () {
        var parentList = $('.advanced-options--active ul');
        var optionLabelBox = $('.advanced-options--active');
        var optionLabelBoxLastItem = $('.advanced-options--active ul li:last-child');

        if (this.checked) {
          if ($('.advanced-options .transport-options input:not(:checked)').length < 1) {
            $('.advanced-options--active ul [data-reset^="check-"]').closest('li').remove();
          }
        } else {
          if ($('.advanced-options--active [data-reset^="check-"]').length < 1) {
            optionLabelBoxLastItem.before('<li><button type="button" class="btn icon-btn flat-btn" data-reset="' + element + '">' + i18N('filter_public_transport_restricted') + ' <span class="icon-font ico-close" aria-hidden="true"></span></button></li>');

            $('.advanced-options--active ul li:nth-last-child(2) button').click(function () {
              removeLabelFromList(this);
            });
          }
        }

        checkForEmptyList(parentList, optionLabelBox);
      });
    });

    if(transportOptionActive) {
      var parentList = $('.advanced-options--active ul');
      var optionLabelBox = $('.advanced-options--active');
      var optionLabelBoxLastItem = $('.advanced-options--active ul li:last-child');

      optionLabelBoxLastItem.before('<li><button type="button" class="btn icon-btn flat-btn" data-reset="' + transportOptionActive + '">' + i18N('filter_public_transport_restricted') + ' <span class="icon-font ico-close" aria-hidden="true"></span></button></li>');

      checkForEmptyList(parentList, optionLabelBox);
    }


    $('#viaid').change(function () {
      var parentList = $('.advanced-options--active ul');
      var optionLabelBox = $('.advanced-options--active');
      var optionLabelBoxLastItem = $('.advanced-options--active ul li:last-child');

      if (this.value !== '') {
        if ($('.advanced-options--active ul [data-reset="viaid"]').length < 1) {
          optionLabelBoxLastItem.before('<li><button type="button" class="btn icon-btn flat-btn" data-reset="viaid">' + i18N('filter_viaid') + ' <span class="icon-font ico-close" aria-hidden="true"></span></button></li>');

          $('.advanced-options--active ul li:nth-last-child(2) button').click(function () {
            removeLabelFromList(this);
          });
        }
      } else {
        $('.advanced-options--active ul [data-reset="viaid"]').closest('li').remove();
      }

      checkForEmptyList(parentList, optionLabelBox);
    });

    // initiate advanced options on ajax reload
    if ($('#viaid')[0] && $('#viaid')[0].value) {
      var parentList = $('.advanced-options--active ul');
      var optionLabelBox = $('.advanced-options--active');
      var optionLabelBoxLastItem = $('.advanced-options--active ul li:last-child');

      optionLabelBoxLastItem.before('<li><button type="button" class="btn icon-btn flat-btn" data-reset="viaid">' + i18N('filter_viaid') + ' <span class="icon-font ico-close" aria-hidden="true"></span></button></li>');

      checkForEmptyList(parentList, optionLabelBox);
    }


    $('#length-of-stay input').on('click keyup change', function () {
      var parentList = $('.advanced-options--active ul');
      var optionLabelBox = $('.advanced-options--active');
      var optionLabelBoxLastItem = $('.advanced-options--active ul li:last-child');

      if (this.value === '00:00') {
        $('.advanced-options--active ul [data-reset="length-of-stay"]').closest('li').remove();
      } else {
        if ($('.advanced-options--active ul [data-reset="length-of-stay"]').length < 1) {
          optionLabelBoxLastItem.before('<li><button type="button" class="btn icon-btn flat-btn" data-reset="length-of-stay">' + i18N('filter_length_of_stay') + ' <span class="icon-font ico-close" aria-hidden="true"></span></button></li>');

          $('.advanced-options--active ul li:nth-last-child(2) button').click(function () {
            removeLabelFromList(this);
          });
        }
      }

      checkForEmptyList(parentList, optionLabelBox);
    });

    // initiate advanced options on ajax reload
    if ($('#length-of-stay input')[0] && $('#length-of-stay input')[0].value !== '00:00') {
      var parentList = $('.advanced-options--active ul');
      var optionLabelBox = $('.advanced-options--active');
      var optionLabelBoxLastItem = $('.advanced-options--active ul li:last-child');

      optionLabelBoxLastItem.before('<li><button type="button" class="btn icon-btn flat-btn" data-reset="length-of-stay">' + i18N('filter_length_of_stay') + ' <span class="icon-font ico-close" aria-hidden="true"></span></button></li>');

      checkForEmptyList(parentList, optionLabelBox);
    }


    $('#no-alternativestops').change(function () {
      var parentList = $('.advanced-options--active ul');
      var optionLabelBox = $('.advanced-options--active');
      var optionLabelBoxLastItem = $('.advanced-options--active ul li:last-child');

      if (this.checked) {
        $('.advanced-options--active ul [data-reset="no-alternativestops"]').closest('li').remove();
      } else {
        optionLabelBoxLastItem.before('<li><button type="button" class="btn icon-btn flat-btn" data-reset="no-alternativestops">' + i18N('filter_alternativ_stops') + ' <span class="icon-font ico-close" aria-hidden="true"></span></button></li>');

        $('.advanced-options--active ul li:nth-last-child(2) button').click(function () {
          removeLabelFromList(this);
        });
      }

      checkForEmptyList(parentList, optionLabelBox);
    });

    // initiate advanced options on ajax reload
    if (!$('#no-alternativestops:checked').length) {
      var parentList = $('.advanced-options--active ul');
      var optionLabelBox = $('.advanced-options--active');
      var optionLabelBoxLastItem = $('.advanced-options--active ul li:last-child');

      optionLabelBoxLastItem.before('<li><button type="button" class="btn icon-btn flat-btn" data-reset="no-alternativestops">' + i18N('filter_alternativ_stops') + ' <span class="icon-font ico-close" aria-hidden="true"></span></button></li>');

      checkForEmptyList(parentList, optionLabelBox);
    }


    // Bind initial events for already existing filters
    $('.advanced-options--active button:not(.js-resettodefault)').click(function () {
      removeLabelFromList(this);
    });
  },


  /***
   * init ajax link for send mail
   ***/
  initTripMailForm = function () {
    // init ajax form
    VVO.AjaxForm($('#trMail').find('form'), false, '', initTripMailForm, function () {
      VVO.Helper.showMessage($('#trMail').find('#message'), 'error', i18N('ajax_error'));
    });
  },


  /***
  * init ajax links for single trip
  ***/
  initTripLinks = function () {

    // trip leaflet
    $('.tripleaflet').on('click', function (event) {
      event.preventDefault();
      var that = this;

      //show leaflet
      $('#leafletLink').show();

      $.ajax({
        dataType: 'json',
        url: $(this).attr('href'),
        success: function (data) {
          VVO.Helper.showMessage($(that).closest('ul').prev(), data[0], data[1]);
        },

        error: function () {
          VVO.Helper.showMessage($(that).closest('ul').prev(), 'error', i18N('ajax_error'));
        },

        complete: function () {

          // set leaflet count
          $('#leafletcount').html(+$.cookie('leafletcount') || 0);
        }
      });
    });

    // trip mail
    $('.tripmail').on('click', function (event) {
      event.preventDefault();
      $(this).colorbox({
        width: '60%',
        opacity: 0.6,
        onComplete: function () {
          $('#cboxClose').append('<span class="icon-font ico-close"/>');
          initTripMailForm();
        }
      });
    });

    //// trip pdf
    //$('.trippdflink').on('click', function(event) {
    //  event.preventDefault();

    //  $iframe = $('<iframe>')
    //            .hide()
    //            .prop('src', $(this).attr('href'))
    //            .load(function(){
    //              var error = $(this).contents().find("body").text().trim();
    //              // add new message
    //              if(error)
    //              {
    //                VVO.Helper.showMessage($(this).closest('ul').prev(), 'error', error);
    //              }
    //            })
    //            .appendTo($(this));
    //});

    // map pdf
    $('.mappdflink').on('click', function (event) {
      event.preventDefault();

      $('<iframe>')
        .hide()
        .prop('src', $(this).attr('href'))
        .load(function () {
          var error = $(this).contents().find('body').text().trim();
          // add new message
          if (error) {
            alert(error);
          }
        })
        .appendTo($(this));
    });
  },


  /***
   * init ajax links for multiple trips
   ***/
  initTripsLinks = function () {

    //// logic for getting overview trip pdf
    $('#tripspdf').on('click', function (event) {
      event.preventDefault();

      var that = this;

      var src = $(this).attr('href');

      $('.journey-header').each(function (idx) {
        src += '&index=' + idx;
      });

      var $iframe = $('<iframe>')
        .hide()
        .prop('src', src)
        .appendTo($(this));

      $iframe.on('load', function () {
        var error = $(this).contents().find('body').text().trim();

        // add new message
        if (error) {
          VVO.Helper.showMessage($(that).closest('.inner').find('.message-box-container:first'), 'error', error);
        }
      });
    });

    // logic for getting overview trip mail
    $('#tripsmail,.tripdetailmail').off('click').on('click', function (event) {
      event.preventDefault();

      var that = this;

      var src = $(this).attr('href');

      //store old link
      $(this).data('href', src);
      if ($(this).attr('id') === 'tripsmail') {

        var nothingSelected = !$('.active-trip').find('.journey-detail:visible').length;
        $('.active-trip').each(function (idx) {
          if (nothingSelected || $(this).find('.journey-detail').is(":visible")) {
            src += '&index=' + idx;
          }
        });
      }

      $(this).attr('href', src);

      $(this).colorbox({
        width: '60%',
        opacity: 0.6,
        onComplete: function () {
          $('#cboxClose').append('<span class="icon-font ico-close"/>');
          initTripMailForm();
          $(that).attr('href', $(that).data('href'));
        }
      });
    });

    // logic for printing multiple trips
    $('#tripsprint').off('click').on('click', function (event) {
      event.preventDefault();

      var src = $(this).attr('href');

      //store old link
      $(this).data('href', src);

      $('.active-trip-info').each(function (idx) {
        src += '&index=' + idx;
      });

      if ($('.journey-detail:visible').length === 0) {
        $('.journey-header').each(function (idx) {
          src += '&index=' + idx;
        });
      }

      //open link
      window.open(src);
    });

    // logic for getting multiple ics
    $('#tripsics').on('click', function (event) {
      event.preventDefault();

      var src = $(this).attr('href');
      $('.active-trip-info').each(function (idx) {
        src += '&index=' + idx;
      });

      if ($('.journey-detail:visible').length === 0) {
        $('.journey-header').each(function (idx) {
          src += '&index=' + idx;
        });
      }

      location.href = src;
    });

    // logic for saving multiple trips to leaflet
    $('#tripsleaflet').on('click', function (event) {
      event.preventDefault();
      var that = this;

      //show leaflet
      $('#leafletLink').show();

      var src = $(this).attr('href');
      $('.active-trip-info').each(function (idx) {
        src += '&index=' + idx;
      });

      if ($('.journey-detail:visible').length === 0) {
        $('.journey-header').each(function (idx) {
          src += '&index=' + idx;
        });
      }

      $.ajax({
        dataType: 'json',
        url: src,
        success: function (data) {
          VVO.Helper.showMessage($(that).closest('.inner').find('.message-box-container:first'), data[0], data[1]);
        },

        error: function () {
          VVO.Helper.showMessage($(that).closest('.inner').find('.message-box-container:first'), 'error', i18N('ajax_error'));
        },

        complete: function () {
          // set leaflet count
          $('#leafletcount').html(+$.cookie('leafletcount') || 0);
        }
      });
    });
  },


  initAjaxSoonerLater = function () {
    // init ajaxlinks
    VVO.AjaxLink($('#earliertrips'), function () { VVO.TripRequest.Init(); VVO.CommonInitAjax(); }, null, false);
    VVO.AjaxLink($('#latertrips'), function () { VVO.TripRequest.Init(); VVO.CommonInitAjax(); }, null, false);
  },


  initFormSubmitFunctionality = function () {
    $('#triprequestform').on('submit', function () {
      var timeInputs = $('.moment-time');

      timeInputs.each(function(_, timeInput) {
        timeInput.value = timeInput.value.replace(i18N('time'), '').trim();
      });

      //validate time
      VVO.TimePicker($('.timepicker')).validateTime();
    });
  },


  /***
  * show connection line between start and end point if selected
  * @param {string} map map instance
  ***/
  showConnectionLineOnMap = function(map) {
    //remove old line
    if (connectionLine !== null) {
      map.removeLayer(connectionLine);
    }

    //reset latlng array
    if (latlngs.length > 0) {
      latlngs = [];
    }

    //push points in latlng array
    if (originPoint !== null && originPoint.Id !== '') {
      latlngs.push([originPoint.Lat, originPoint.Lng]);
    }

    if (viaPoint !== null && viaPoint.Id !== '') {
      latlngs.push([viaPoint.Lat, viaPoint.Lng]);
    }

    if (destinationPoint !== null && destinationPoint.Id !== '') {
      latlngs.push([destinationPoint.Lat, destinationPoint.Lng]);
    }

    //create line if multiple points exist
    if (latlngs.length > 1) {
      try {
        connectionLine = L.polyline(latlngs, { color: '#003ea1' }).addTo(map);
        map.fitBounds(connectionLine.getBounds());
      } catch(e) {
        // do nothing
      }
    }
    else
    {
      map.fitBounds(latlngs);
    }
  },


  /**
   * add markers and connection line
   * @param {string} map map instance
   */
  showPinsAndConnection = function (map) {

    if(!map)
    {
      return;
    }

    //set map
    defaultMap = map;

    //get points from inputs
    originPoint = VVO.PointHelper.toPoint($('#originid').data('pointstring'));
    viaPoint = VVO.PointHelper.toPoint($('#viaid').data('pointstring'));
    destinationPoint = VVO.PointHelper.toPoint($('#destinationid').data('pointstring'));

    //add marker if point exists
    if (originPoint !== null && originPoint.Id !== '') {
      if (originPointMarker !== null) {
        map.removeLayer(originPointMarker);
      }

      originPointMarker = new L.Marker.Interactive([originPoint.Lat, originPoint.Lng], { icon: L.Icon.get('usermarker') })
        .addTo(map);
    }

    //add marker if point exists
    if (viaPoint !== null && viaPoint.Id !== '') {
      if (viaPointMarker !== null) {
        map.removeLayer(viaPointMarker);
      }

      viaPointMarker = new L.Marker.Interactive([viaPoint.Lat, viaPoint.Lng], { icon: L.Icon.get('usermarker') })
        .addTo(map);
    }

    //add marker if point exists
    if (destinationPoint !== null && destinationPoint.Id !== "") {
      if (destinationPointMarker !== null) {
        map.removeLayer(destinationPointMarker);
      }

      destinationPointMarker = new L.Marker.Interactive([destinationPoint.Lat, destinationPoint.Lng], { icon: new L.Icon.get('usermarker') })
        .addTo(map);
    }

    //create line
    showConnectionLineOnMap(map);
  },

  /***
   * check if advanced filters are selected and if not hide it
   ***/
  checkForEmptyList = function (parentList, optionLabelBox) {
    if (parentList.find('li').length <= 1) { // remaining list entry is the reset filter button
      optionLabelBox.addClass('hidden');
    } else {
      optionLabelBox.removeClass('hidden');
    }
  },

  /***
   * just remove a filter label from its list
   ***/
  removeLabelFromList = function (button) {
    var fieldReset = $(button).attr('data-reset');
    var parentListEntry = $(button).closest('li');
    var parentList = parentListEntry.closest('ul');
    var optionLabelBox = parentList.closest('.advanced-options--active');

    if (fieldReset === 'no-alternativestops') {
      $('#no-alternativestops').trigger('click');
    } else if (fieldReset === 'length-of-stay') {
      $('#length-of-stay input').val('00:00');
    } else if (fieldReset === 'viaid') {
      $('#viaid').val($("#viaid option:first").val());
    } else if (fieldReset.indexOf('check-') === 0) {
      [
        'check-train',
        'check-train2',
        'check-metropolitan-railway',
        'check-metropolitan-railway2',
        'check-tram',
        'check-tram2',
        'check-citybus',
        'check-citybus2',
        'check-regiobus',
        'check-regiobus2',
        'check-cablerailway',
        'check-overhead-railway2',
        'check-ferry',
        'check-ferry2',
        'check-ast',
        'check-ast2',
      ].forEach(function (element) {
        var input = document.querySelector('.advanced-options .transport-options #' + element);

        if (input && !input.checked) {
          $(input).trigger('click');
        }
      });
    } else {
      $('#' + fieldReset).click();
    }

    parentListEntry.remove();

    checkForEmptyList(parentList, optionLabelBox);
  },

  /***
   * main init for all components
   ***/
  init = function () {
    initChangeOrigDest();
    initDetails();
    initShowIntermediateStops();
    initToggleIndividualSettings();
    initOptions();
    initTripLinks();
    initTripsLinks();
    initTripMailForm();
    initAjaxSoonerLater();
    initFormSubmitFunctionality();

    // init drop down box for journey-planner
    $('.journey-planner .switch_btn').each(function () {
      VVO.DropDownBox.init($(this), adjustMapSize, adjustMapSize);
    });

    // open accordion and initialize map if necessary
    $('div.accordion-map').on('accordion-initialized', function () {

      // if we are on detail page, don't open map and don't save cookie
      if($('#tr_overview').length)
      {
        return;
      }

      var mapVisible = $.cookie('trmapvisible');

      // open map if cookie is set to true. if cookie is not set, show map if input fields are empty.
      if (mapVisible === '1' || (mapVisible === null && $('#originid').val() === ' ' && $('#destinationid').val() === ' ')) {
        $(this).find('.accordion-header').trigger('click');
        defaultMap = VVO.OsmMap('inputmap', { zoomToId: 'stopid', extendLegend: true });
        mapVisible = '1';
      }
      else
      {
        mapVisible = '0';
      }

      $.cookie('trmapvisible', mapVisible);
    });

    //origin input change event
    $('#originid').chosen().change(function () {
      showPinsAndConnection(defaultMap);
    });

    //via input change event
    $('#viaid').chosen().change(function () {
      showPinsAndConnection(defaultMap);
    });

    //destination input change event
    $('#destinationid').chosen().change(function () {
      showPinsAndConnection(defaultMap);
    });

    // trigger change event to correct active flag
    $('.advanced-options').trigger('change');
  };

  // return public methods
  return {
    Init: init,
    ShowPinsAndConnection: showPinsAndConnection
  };
}();
;
/***
 * route changes application logic
 **/
VVO.RouteChanges = function() {

  var i18n = VVO.I18N.translate;
  var log = VVO.Log;

  /***
   * filter changes list
   ***/
  var initFilter = function() {
    // avoid page load on submit
    $('.filter:parent').on('submit', function(event) {
      event.preventDefault();
    });

    // filter list on keypress (order of keyup input is important for IE < 10)
    $('.filter').on('keyup input', function() {
      filterValues();
    });

    // trigger filter when preselected
    if($('.filter').val().length) {
      $('.filter').trigger('keyup');
    }

    // init mot filter
    $('input[name="mot"]').on('change', function(){
      filterValues();
    });
  },

  filterValues = function(text, mot) {
    var
      value = $('.filter').val(),
      $itemList = $('#rc .item-list'),
      mots = $('.switch-checks input');

    // for each line entry check if mot filter is activated and input is substring of data-filter attribute
    $itemList.find('> li:not(".empty-list")').each(function() {
      var motActivated = $('.switch-checks input[value="' + $(this).data('mot') + '"]').prop('checked');
      var filterMatching = !$(this).data('filter') || $(this).data('filter').toLowerCase().indexOf(value.toLowerCase()) !== -1;

      $(this).toggle(motActivated && filterMatching);
    })

    // show/hide error message
    $itemList.find('.empty-list').toggle($itemList.find('> li').filter(':visible').not('.empty-list').length === 0);
  },


  /***
   * init preselection with change id
   ***/
  initPreselection = function() {
    // init filter
    var filterValue = (new RegExp('[?&]filter=([^&]*)')).exec(decodeURI(location.search));
    if (filterValue && filterValue[1]) {
      $('#filter').val(filterValue[1]).trigger('keyup');
    }

    // open overlay with route change
    var id = (new RegExp('[?&]id=([^&]*)')).exec(decodeURI(location.search));
    if (id && id[1] && !isNaN(+id[1])) {
      var routeChange = $('a[href="#changenews' + (+id[1]) + '"]:first');

      if (!routeChange.length) {
        $('#rc').prepend(
          '<div class="msg msg-warning" role="alert">' +
          '  <a href="#" class="msg-close" title="' + i18n('close') + '">' +
          '    <span class="icon-font ico-close" aria-hidden="true"></span>' +
          '  </a>' +
          '  <p>' + i18n('route_change_not_found') + '</p>' +
          '</div><br/><br/>');
      } else {
        routeChange.click();
      }
    }
  },


  /***
  * init subscription
  ***/
  initSubscription = function()
  {
    VVO.RouteChangesSubscription.init();
  },

  /***
   * init
   ***/
  init = function() {
    initFilter();
    initPreselection();
    initSubscription();
  };

  // return public methods
  return init;
}();
;
/***
 * stop timetable application logic
 **/
VVO.StopTimetable = function() {

  var i18n = VVO.I18N.translate;
  var log = VVO.Log;

  /***
   * filter lines list
   ***/
  var initFilter = function() {
    // avoid page load on submit
    $('.filter:parent').on('submit', function(event) {
      event.preventDefault();
    });

    // filter list on keypress (order of keyup input is important for IE < 10)
    $('.filter').on('keyup input', function() {

      var
      $itemList = $('#stt .item-list').filter(':visible'),
      value = $(this).val();

      // check if input is substring of data-filter attribute in each list item and show/hide item
      $itemList.find('> li:not(".empty-list")').each(function() {
        $(this).toggle($(this).data('filter').toLowerCase().indexOf(value.toLowerCase()) !== -1);
      });

      // show/hide error message
      $itemList.find('.empty-list').toggle($itemList.find('> li').filter(':visible').not('.empty-list').length === 0);
    });
  },


  /***
   * logic for getting pdf
   ***/
  initPdfLink = function() {
    $('.pdflink').on('click', function(event) {
      event.preventDefault();

      $iframe = $('<iframe>')
                .hide()
                .prop('src', $(this).attr('href'))
                .appendTo($(this));

      $iframe.on('load', function() {
        var error = $(this).contents().find("body").text().trim();

        // remove old messages
        $(this).closest('.box').closest('li').find('.msg').remove();

        // add new message
        if(error)
        {
          VVO.Helper.showMessage($(this).closest('.box').closest('li').find('.message'), 'error', error );
        }
      });
    });
  },

  /***
  * init instantsearch
  ***/
  initInstantSearch = function(){
    $("#sttform :input").off('change').on('change',function() {
     $("#sttform").submit();
    });
    $('body').off('selectChanged').on("selectChanged", function(){
      $("#sttform").submit();
    });
  },

  /***
   * main init for all components
   ***/
  init = function() {
    initFilter();
    initPdfLink();
    initInstantSearch();

    // (re)initialize colorbox for route changes
    VVO.Colorbox.init();

    //init subscribe routchanges functionality
    VVO.RouteChangesSubscription.init();

    //init save favourite
    VVO.Favourites.initSaveFavourite();

    // disable submit button if stop is empty
    //VVO.Validation.initHandleEmpytInputs($('#start-loc'));

    // open accordion and initialize map if necessary
    $('div.accordion-map').on('accordion-initialized', function () {
      if ($('#stopid').val() === "") {
        $(this).find('.accordion-header').trigger('click');
        VVO.OsmMap('inputmap', { zoomToId: 'stopid', extendLegend: true });
      }
    });

    return null;
  };

  // return public methods
  return init;
}();
;
/***
 * timetable book application logic
 **/
VVO.TimetableBook = (function () {

  /***
   * filter lines by mot selection
   ***/
  var initFilter = function () {

        $('input[name="mot"]').off('change').on("change", function () {
          $('.item-list li[data-mot="' + $(this).val() + '"]').toggle(
              $(this).is(":checked")
          );
        });
      },

      /***
       * logic for getting pdf/ showing an error message
       ***/
      initPdfLink = function () {
        $(".pdflink").off('click').on("click", function (event) {
          event.preventDefault();

          var $iframe = $("<iframe>")
              .hide()
              .prop("src", $(this).attr("href"))
              .appendTo($(this));

          $iframe.on("load", function () {
            var error = $(this).contents().find("body").text().trim();

            // remove old messages
            $(this).closest(".box").closest("li").find(".msg").remove();

            // add new message
            if (error) {
              VVO.Helper.showMessage(
                  $(this).closest(".box").closest("li").find(".message"),
                  "error",
                  error
              );
            }
          });
        });
      },

      /***
       * init cart interactions (add/ remove single or all pdfs)
       ***/
      initCartInteractions = function () {
        var $body = $('body');

        // add/ select a pdf file
        $body.off('click', ".add-pdf").on("click", ".add-pdf", function (event) {
          event.preventDefault();
          var links = $(".add-pdf[pdf-id='" + $(this).attr('pdf-id') + "']");
          var link = $(this);

          $.ajax({
            url: links.first().attr("href"),
            success: function () {
              links.hide();
              links.next().show();

              // additional pdfs on overlay: toggle entry
              if (link.closest('.additional-pdfs').length) {
                links.parent().parent().find('.pdflink').removeClass("inactive");
                // for title page and table of content paragraph elements must be adressed
                $("#" + link.attr("pdf-id")).removeClass("inactive")
              }
              // pdfs on overlay and main page: update pdf count
              else
              {
                $('.selected-pdf-count').each(function() {
                  $(this).text(+$(this).text() + 1);
                });
              }
            },
          });
        });

        // remove a selected pdf
        $body.off('click', ".remove-pdf").on("click", ".remove-pdf", function (event) {
          event.preventDefault();
          var links = $(".remove-pdf[pdf-id='" + $(this).attr('pdf-id') + "']");
          var link = $(this);

          $.ajax({
            url: links.first().attr("href"),
            success: function () {

              // additional pdfs on overlay: toggle entry
              if (link.closest('.additional-pdfs').length) {
                links.hide();
                links.prev().show();
                links.parent().parent().find('.pdflink').addClass("inactive");
                // for title page and table of content paragraph elements must be adressed
                $("#" + link.attr("pdf-id")).addClass("inactive")
              }
              else
              {
                // pdfs on overlay: remove whole entry
                if (link.closest('#overlay-pdfs').length) {
                  link.closest('li').remove();

                  if($(".move-pdf").length === 1)
                  {
                    $('.move-pdf').remove();
                  }

                  // close colorbox when all entries were removed
                  if (!$('#overlay-pdfs .remove-pdf:visible').length) {
                    $('#cboxClose').click();
                  }
                }

                // pdfs on main page: toggle remove/add link
                links.hide();
                links.prev().show();

                // update pdf count
                $('.selected-pdf-count').each(function() {
                  $(this).text(+$(this).text() - 1);
                });
              }
            },
          });
        });

        // add all pdfs
        $("#add-all-pdfs").off('click').on("click", function (event) {
          event.preventDefault();

          var params = [];
          $(".add-pdf").each(function () {

            // convert querystring of url to json object
            var queryString = $(this).attr("href").split("?")[1];
            var pairs = queryString.split('&');
            var pdfObject = {};
            pairs.forEach(function(pair) {
              pair = pair.split('=');
              pdfObject[pair[0]] = decodeURIComponent(pair[1] || '');
            });
            params.push(pdfObject);

            $(this).hide();
            $(this).next().show();
          });

          var link = $(this);
          $.ajax({
            url: link.attr("href"),
            data: '{ "PdfFiles": ' + JSON.stringify(params) + '}',
            contentType: "application/json; charset=utf-8",
            type: "POST",
            success: function () {
              $(".selected-pdf-count").text(
                +$(".selected-pdf-count").text() + $(".add-pdf").length
              );
            },
          });
        });

        // remove all selected pdfs
        $body.off("click", "#remove-all-pdfs").on("click", "#remove-all-pdfs", function (event) {
          event.preventDefault();
          var link = $(this);

          $.ajax({
            url: link.attr("href"),
            success: function () {
              $(".remove-pdf").hide();
              $(".add-pdf").show();
              $('.selected-pdf-count').text(0);
              $('#cboxClose').click();
            },
          });
        });

        // change the selection for an additional pdf
        $body.off("change", ".additional-pdf").on("change", ".additional-pdf", function () {
          var parameters = "";
          $(".additional-pdf:checkbox:checked").each(function () {
            parameters += "selectedPdfs=" + $(this).val() + "&";
          });

          $.ajax({
            url:
                $("#pdf-cart").attr("set-additional-pdfs-url") + "?" + parameters,
          });
        });
      },

      /***
       * init option facets
       **/
      initOptions = function () {
        // reset options button click handler
        $(".js-resettodefault")
          .off("click")
          .on("click", function (event) {
            event.preventDefault();

          $('#line').val('');

          // reset transportation company
          resetSelectedTransportationCompany();

          // reset selected stop
          resetSelectedStop();
        });
      },


      /***
       * reset selected stop
       ***/
      resetSelectedStop = function () {
        var $stopId = $('#stopid');
        $stopId.html('<option value=""></option>');
        $stopId.data().chosen.results_update_field();
        $stopId.trigger('change');
      },

      /***
       * reset selected transportation company
       ***/
      resetSelectedTransportationCompany = function () {
        $('#transportationcompany').prop('selectedIndex',0);
        $("#transportationcompany").val("").trigger("chosen:updated");
      },

      /***
       * initialize sortable pdf entries when overlay is opened
       ***/
      initSortable = function () {
        $('body').on('cbox_ready', function() {
          $("#overlay-pdfs").sortable({
            handle: ".move-pdf",
            axis: "y",
            placeholder: "ui-sortable-placeholder",
            stop: function() {
              var params = "";
              $("#overlay-pdfs li .pdflink").each(function () {
                params += 'ids=' + $(this).attr("pdf-id") + "&";
              });

              $.ajax({
                url: $('#pdf-cart').attr("order-pdfs-url"),
                data: params,
                type: "POST"
              });
            }
          });
        });
      };

  /***
   * main init for all components
   ***/
  return function () {
    initFilter();
    initOptions();
    initPdfLink();
    initCartInteractions();
    initSortable();

    //init save favourite
    VVO.Favourites.initSaveFavourite();

    // (re)initialize colorbox for route changes
    VVO.Colorbox.init();

    $('input[name="mot"]').trigger("change");

    // handle option facets on init
    $('#stopid').change();
    $('input[name="transportationcompany"]').change();

    return null;
  };
})();
;
/***
 * shopping cart application logic
 **/
VVO.ShoppingCart = function() {

  var init = function() {
    $('#sfform .forward').on('click', function (event) {
      event.preventDefault();

      var input = $(this).parent().find('.input');
      input.val(parseInt(input.val(), 10) + 1);
      $(this).closest('form').submit();
    });

    $('#sfform .back').on('click', function (event) {
      event.preventDefault();

      var input = $(this).parent().find('.input');
      if(input.val() > 1) {
        input.val(parseInt(input.val(), 10) - 1);

        $(this).closest('form').submit();
      }
    });

    var timer;
    // replace all values exept numbers
    $('#sfform .input').keyup(function () {
      var that = this;
      timer = setTimeout( function(){ $(that).closest('form').submit();}, 1000 );
      this.value = this.value.replace(/[^0-9\.]/g,'');
    });

    $('#sfform .input').keydown(function(){
      clearTimeout(timer);
    });

    // init ajax form
    VVO.AjaxForm($('#sfform'), false,'', function() {
      VVO.ShoppingCart();
    }, function() {
      VVO.Helper.showMessage($('#message'), 'error', i18n('ajax_error'));
    });

    // init delete ajax link
    VVO.AjaxLink($('.removeproduct'), VVO.ShoppingCart, function() {
      VVO.Helper.showMessage($('#message'), 'error', i18n('ajax_error'));
    }, false);
  };

  return init();
};
;
/***
 * shopping cart application logic
 **/
VVO.Newsletter = function () {

  var init = function () {
    //admin area
    $('#nf').find('.circle-white-border').on('click', function (event) {
      if (!confirm(i18n('newsletter_confirmationquestion'))) {
        event.preventDefault();
      }
    });

    $('.sendnl').on('click', function (event) {
      var message = $(this).data("newsletter-sent") ? i18n('newsletter_confirm_sent') : i18n('newsletter_confirm_unsent');

      if (!confirm(message)) {
        event.preventDefault();
      }
    });
  }

  return init();
}
;
/***
 * subportal application logic
 **/
VVO.Subportal = function() {

 var init = function() {
    //admin area
    $('#sp').find('.circle-white-border').on('click', function(event){
        if(!confirm(i18n('subportal_confirmationquestion'))){
         event.preventDefault();
       }
      } );

    // init ajax form
    VVO.AjaxForm($('#spform'), false,'', VVO.Subportal, function() {
      VVO.Helper.showMessage($('#message'), 'error', i18n('ajax_error'));
    });


    if($('#sp').length)
    {
      // find link which refs on #sp who has colorbox and resize
      $('a[href$="#sp"]').colorbox.resize();
    };
  };

  return init;

}();
;
//leaflet functionality
VVO.Leaflet = function() {
  var i18n = VVO.I18N.translate;
  var init = function () {

    if($.cookie('leafletcount') && +$.cookie('leafletcount')!=0 ){
      $('#leafletLink').show();
    } else
    {
      $('#leafletLink').hide();
    }

    // leaflet delete link
    VVO.AjaxLink($('.delete-from-notepad'), VVO.Leaflet, null, false)

    // leaflet accordion for details
    VVO.Accordion($('#leaflet'));

    // set leaflet count
    $('#leafletcount').html(+$.cookie('leafletcount')  || 0);

    $('#printLeafletButton').off('click').on('click', function(event){
      window.print();

    });

    $('.notepad-content .stopover-switch').closest('small,p').on('click', function (event) {
      event.stopPropagation();
      event.preventDefault();

      var
        that = $(this),
        intermediateStops = that.closest('ul.connection-detail').find('.stopover[data-partialrouteid="' + that.closest('li').data('partialrouteid') + '"]');

      // add consecutive stopovers even when partial route id is not equal (used for footpaths!)
      var li = that.closest('li');
      while (li.next().get(0) !== undefined && li.next().get(0) === li.next('.stopover').get(0)) {
        intermediateStops = intermediateStops.add(li.next('.stopover'));
        li = li.next();
      }
      //add previous stopovers (used for last footpath in partial route
      while (li.prev().get(0) !== undefined && li.prev().get(0) === li.prev('.stopover').get(0)) {
        intermediateStops = intermediateStops.add(li.prev('.stopover'));
        li = li.prev();
      }


      // show intermediate stops
      intermediateStops.toggle();

      // toggle icon
      $(this).find('a span')
        .toggleClass('ico-arrow-down')
        .toggleClass('ico-arrow-right');

      // change link text
      if (intermediateStops.first().is(":visible")) {
        that.find('.text').text(i18n('hide_stopovers'));
      } else {
        that.find('.text').text(i18n('show_stopovers'));
      }
    });
  }

  return init;
}();
;
/***
 * guestbook application logic
 **/
VVO.Guestbook = function() {
  var i18n = VVO.I18N.translate;

  var init = function() {

    // init datepicker
    VVO.DatePicker($('.guestbook-filter'));

    $('.guestbook-filter').on('dateselected', function() {
      $('.search-button').click();
    });

    // init reset button
    $('#allentries').on('click', function() {
      $('#query').val('');
      $('#commented').prop('checked', false);
      $('#guestbook-filter').val('');
    });

    // set submit message
    $('#gbsubmitform').on('submit', function (){

      if($('#author').val().trim() && $('#message').val().trim() && $('input[name="netiquette"]').prop('checked') &&
         $('input[name="privacypolicy"]').prop('checked'))
      {
        alert(i18n('gbform_submit'));
      }
    });

    // init form
    VVO.AjaxForm($('#gbform'), false, '', function() {
      initPaging('true');
    });

    //init colorbox for registration
    $('#guestbook-register').colorbox({
      width: '60%',
      opacity: 0.6,
      onComplete: function() {
        $('body').addClass("print-overlay");
        $('#cboxClose').append('<span class="icon-font ico-close"/>');
        initRegisterAjaxForm();
      },
      onClosed: function() {
        $('body').removeClass("print-overlay");
      }
    });

    //init colorbox for deletion
    $('#guestbook-delete').colorbox({
      width: '60%',
      opacity: 0.6,
      onComplete: function() {
        $('body').addClass("print-overlay");
        $('#cboxClose').append('<span class="icon-font ico-close"/>');
        initDeleteAuthorAjaxForm();
      },
      onClosed: function() {
        $('body').removeClass("print-overlay");
      }
    });

    // submit form on comment checkbox change
    $('#commented').on('change',
      function() {
        $('#gbform').submit();
      });

    // save old value, abort pending ajax requests
    var oldValue = '';
    $('#query').on('keydown',
      function(event) {
        if (lastXhr != null) {
          lastXhr.abort();
        }
        oldValue = $('#query').val();
      });

    // submit form after input delay
    var timer = 0;
    $('#query').on('keyup', function(event) {

      // if nothing has changed (special key)
      if (oldValue === $(this).val()) {
        return;
      }

      if (timer != 0) {
        clearTimeout(timer);
        timer = 0;
      }

      timer = setTimeout(function() {
        $('#gbform').submit();
        clearTimeout(timer);
        timer = 0;
      }, 500);
    });

    // initPaging
    initPaging();

    //init authors ajax request
    initAuthorAjaxRequest();
  },

  // init paging
  initPaging = function(scroll) {
    // init ckeditor
    // set basepath
    window.CKEDITOR_BASEPATH = '/assets/js/base/ckeditor/';

    // get ckeditor scripts
    $.getScript(window.CKEDITOR_BASEPATH + 'ckeditor.js', function () {

      $.getScript(window.CKEDITOR_BASEPATH + 'adapters/jquery.js', function () {
        $("textarea:not('.no-ckeditor')").ckeditor({
          language: 'de'
        });
      });

      VVO.AjaxLink($('#gbentries .pagination a, #allentries'), function() {
        initPaging('true');
      });
    });

      //scroll if no anchor in url
      if (scroll == "true") {
        // scroll to anchor if exists
        if ($('#dateanchor').length) {
          $('#dateanchor').scrollTo();
        } else {
          //scroll to top
          $('#ag').scrollTo();
        }
      }
      //if in admin --> init admin
      if ($('#ag').length > 0) {
        adminInit();
      }
    },

    //init register ajax Form
    initRegisterAjaxForm = function() {
      VVO.AjaxForm($('#gbregisterform'),
        false,
        '',
        function() {
          $('#guestbook-register').colorbox.resize();
          initRegisterAjaxForm();
        });
    },

    //init delete author ajax form
    initDeleteAuthorAjaxForm = function() {
      VVO.AjaxForm($('#gbdeleteauthorform'),
        false,
        '',
        function() {
          $('#guestbook-delete').colorbox.resize();
          initDeleteAuthorAjaxForm();
        });
    },

    //init ajax request for author name
    initAuthorAjaxRequest = function() {
      var xhr = null;
      var timer = null;
      var runTimer = function() {
        timer = setTimeout(function() {
            if (xhr) {
              xhr.abort();
            }
            xhr = $.ajax({
                url: '/de/lob-kritik/CheckIfRegistered',
                method: 'POST',
                data: { 'authorname': $('#author').val() },
                success: function(data) {
                  if (data === true) {
                    $('#passwordwrap').removeClass('visuallyhidden');
                    $('#emailwrap').addClass('visuallyhidden');
                  } else {
                    $('#passwordwrap').addClass('visuallyhidden');
                    $('#emailwrap').removeClass('visuallyhidden');
                  }
                }
              }
            );
          },
          500);
      }

  $('#author').on('keyup',function(event) {
    //if timer already running,cancel it
    clearTimeout(timer);
    runTimer();
    });
  },
  // init admin guestbook
  adminInit = function() {

    //cancel button
    $('.agcancel').off('click').on('click', function(event){
      event.preventDefault();
      event.stopPropagation();
      $(this).closest('li').find('.entry').show();
      $(this).closest('li').find('.edit').hide();
      $(this).closest('li').find('.ageditarea').show();
    });

    //edit functionality
    $('.agedit').off('click').on('click', function(event){
        event.preventDefault();
        event.stopPropagation();
        $(this).closest('li').find('.entry').hide();
        $(this).closest('li').find('.edit').show();
        $(this).closest('li').find('.ageditarea').hide();
    });


    //ajax form
    $('.agform').find('.agpublish').not('.disabled').off('click').on('click',function(event){
      event.preventDefault();
      event.stopPropagation();
      //get workflowState and append it as input
      var input = $("<input>")
               .attr("type", "hidden")
               .attr("name", "GuestbookItem.WorkflowState").val($(this).data('workflowstate'));
      $('.agform').append($(input));
      VVO.Spinner.show($(this).offset().left - 22, $(this).offset().top + 14);
      var that = this;
      $.ajax({
        url: $(this).closest('form').attr('action'),
        method: $(this).closest('form').attr('method') || 'GET',
        data: $(this).closest('form').serialize(),
        success: function(data) {
          $('#' + $(that).closest('form').data('ajax-destination')).replaceWith(data);
          VVO.Guestbook.adminInit();
        },

        error: function(jqXHR, status, exception) {
             VVO.Helper.showMessage($(that).closest('.edit').find('.message-box-container'), 'error', i18n('ajax_error'));
        },

        complete: function() {
          // hide spinner
          VVO.Spinner.hide();

        }
      });
    });

    //prevent default for disabled links
     $('.agform').find('.agpublish.disabled').off('click').on('click', function(event){
      event.preventDefault();
      event.stopPropagation();
     });

    //delete functionality
    $('.agdelete').off('click').on('click', function(event){
      event.preventDefault();
      event.stopPropagation();

      if(!confirm(i18n('guestbook_confirmationquestion'))){
         return;
      }
      else {
        var that = this;
         $.ajax({
          url: $(this).attr('href'),
          method: $(this).method || 'GET',
          success: function(data) {
            $('#' + $(that).data('ajax-destination')).replaceWith(data);
            VVO.Guestbook.adminInit();
          },

          error: function(jqXHR, status, exception) {
            log(i18n('ajax_error'));
            log(exception);
            VVO.Helper.showMessage($(that).parent().find('.message-box-container'), 'error', i18n('ajax_error'));
          },

          complete: function() {
            // hide spinner
            VVO.Spinner.hide();

          }
        });
     }
  });
  };

  // return public methods
  return {
    init: init,
    adminInit: adminInit
  };
}();
;
/***
 * search statistic application logic
 **/
VVO.SearchStatistic = function() {

  var init = function() {

    // init paging ajax links
    VVO.AjaxLink($('#ByWord .pagination a'), VVO.SearchStatistic);
    VVO.AjaxLink($('#ByQuery .pagination a'), VVO.SearchStatistic);
    VVO.AjaxLink($('#ByEmptyHitCount .pagination a'), VVO.SearchStatistic);
  };

  return init();
};
;
/***
 * logic for setting default urls
 **/
VVO.Homepagedefaults = function() {
  var map = null;
  var init = function () {

    map = VVO.OsmMap('defaultsinputmap', { zoomToId: 'addefaultsid', extendLegend: true });
    map.on('zoomend', show);
    map.on("moveend", show);

    VVO.Autocompleter($('#addefaultsid'));

    //add event listener for clicks on map (triggered in tooltip), which cause select field to change -> when clicked then update result list
    $('body').off('selectChanged').on('selectChanged', function () {
      //update result list
      VVO.Homepagedefaults.show();
    });

    //listen change data event (triggered in autocompleter) and update result list if changed
    $('#addefaultsid').on('chosen:elementselected', function () {
      //update map
      map = VVO.OsmMap('defaultsinputmap', { zoomToId: 'addefaultsid', extendLegend: true });

      //bind zoom event
      map.on('zoomend', show);
      map.on('moveend', show);

      //update links
      VVO.Homepagedefaults.show();
    });

    // update map parameters on click in legend
    $('body').off('click', '.leaflet-control-layers-list').on('click', '.leaflet-control-layers-list', function () {
      setTimeout(show, 50);
    });

    //init admin defaults -> listener for buttonclicks
    $('body').off('click', '#addefaultsbutton').on('click', '#addefaultsbutton', show);

    // init drop down box for map
    $('body').off('click keydown', '#addefaults .ico-poi').on('click keydown', '#addefaults .ico-poi', function (e) {
      e.preventDefault();

      //update map
      map = VVO.OsmMap('defaultsinputmap', { zoomToId: 'addefaultsid', extendLegend: true });

      //bind zoom event
      map.on('zoomend', show);
      map.on("moveend", show);
    });
  },

    show = function () {
      var pointId = $('#addefaultsid').val();
      var mapLayers = $.cookie('maplayers');

      if (!pointId) {
        return;
      }

      // if pointId is a stop, show all, else only dm, ttb, stt
      if (!isNaN(+pointId)) {
        $('#addmdefaults').closest('tr').show();
        $('#addmarrdefaults').closest('tr').show();
        $('#adstdefaults').closest('tr').show();
        $('#adtbdefaults').closest('tr').show();
      }
      else {
        $('#addmdefaults').closest('tr').hide();
        $('#addmarrdefaults').closest('tr').hide();
        $('#adstdefaults').closest('tr').hide();
        $('#adtbdefaults').closest('tr').hide();
      }

      setLink($('#addmdefaults'), pointId);
      setLink($('#addmarrdefaults'), pointId);
      setLink($('#adstdefaults'), pointId);
      setLink($('#adtbdefaults'), pointId);

      // always visible
      $('#adtrdefaults1').closest('tr').show();
      $('#adtrdefaults2').closest('tr').show();
      $('#addmmapdefaults').closest('tr').show();
      $('#addmarrmapdefaults').closest('tr').show();

      setLink($('#adtrdefaults1'), pointId);
      setLink($('#adtrdefaults2'), pointId);

      var mapParams = pointId + "&zoomlevel=" + map.getZoom() + "&layers=" + mapLayers + "&lat=" + map.getCenter().lat +
        "&lng=" + map.getCenter().lng + "&showMap=true"
      setLink($('#addmmapdefaults'), mapParams);
      setLink($('#addmarrmapdefaults'), mapParams);
    },

    setLink = function($textarea, queryParameters){
      var url = $textarea.data('url') + queryParameters;
      $textarea.html(url);
      $textarea.closest('tr').find('a').attr('href', url);
    },

    hide = function () {
      $('#adresult').hide();
    };


  return {
    init: init,
    show: show,
    hide: hide
  }

}()
;
/***
 * logic for setting default urls
 **/
VVO.Admindefaults = function() {
  var map = null;
  var init = function () {

    map = VVO.OsmMap('defaultsinputmap', { zoomToId: 'addefaultsid' });
    map.on('zoomend', show);
    map.on("moveend", show);

    VVO.Autocompleter($('#addefaultsid'));

    //add event listener for clicks on map (triggered in tooltip), which cause select field to change -> when clicked then update result list
    $('body').off('selectChanged').on('selectChanged', function () {
      //update result list
      VVO.Admindefaults.show();
    });

    //listen change data event (triggered in autocompleter) and update result list if changed
    $('#addefaultsid').on('chosen:elementselected', function () {
      //update map
      map = VVO.OsmMap('defaultsinputmap', { zoomToId: 'addefaultsid' });

      //bind zoom event
      map.on('zoomend', show);
      map.on('moveend', show);

      //update links
      VVO.Admindefaults.show();
    });

    // update map parameters on click in legend
    $('body').off('click', '.leaflet-control-layers-list').on('click', '.leaflet-control-layers-list', function () {
      setTimeout(show, 50);
    });

    //init admin defaults -> listener for buttonclicks
    $('body').off('click', '#addefaultsbutton').on('click', '#addefaultsbutton', show);

    // init drop down box for map
    $('body').off('click keydown', '#addefaults .ico-poi').on('click keydown', '#addefaults .ico-poi', function (e) {
      e.preventDefault();

      //update map
      map = VVO.OsmMap('defaultsinputmap', { zoomToId: 'addefaultsid' });

      //bind zoom event
      map.on('zoomend', show);
      map.on("moveend", show);
    });

    // init links
    $('#adresult a').on('click', function (event) {
      event.preventDefault();
      location.href = $(this).closest('tr').find('textarea').val();
    });
  },

    show = function () {
      var pointId = $('#addefaultsid').val();
      var mapLayers = $.cookie('maplayers');

      if (!pointId) {
        return;
      }
      
      // if pointId is a stop, show all, else only dm, ttb, stt
      if (!isNaN(+pointId)) {
        $('#addmdefaults').closest('tr').show();
        $('#adstdefaults').closest('tr').show();
        $('#adtbdefaults').closest('tr').show();
      }
      else {
        $('#addmdefaults').closest('tr').hide();
        $('#adstdefaults').closest('tr').hide();
        $('#adtbdefaults').closest('tr').hide();
      }

      $('#addmdefaults').html($('#addmdefaults').data('url') + pointId);
      $('#adstdefaults').html($('#adstdefaults').data('url') + pointId);
      $('#adtbdefaults').html($('#adtbdefaults').data('url') + pointId);

      // always visible
      $('#adtrdefaults1').closest('tr').show();
      $('#adtrdefaults2').closest('tr').show();
      $('#addmmapdefaults').closest('tr').show();

      $('#adtrdefaults1').html($('#adtrdefaults1').data('url') + pointId);
      $('#adtrdefaults2').html($('#adtrdefaults2').data('url') + pointId);
      $('#addmmapdefaults').html($('#addmmapdefaults').data('url') + pointId + "&zoomlevel=" + map.getZoom() + "&layers=" + mapLayers +
        "&lat=" + map.getCenter().lat + "&lng=" + map.getCenter().lng + "&showMap=true");
    },

    hide = function () {
      $('#adresult').hide();
    };


  return {
    init: init,
    show: show,
    hide: hide
  }

}()
;
/***
 * logic for initializing selects
 **/
VVO.AdminBanners = function() {

  var init = function() {

    $('.chosen-select').each(function() {
      var $select = $(this);
      $select.chosen();

      $select.find('option').each(function() {
        var desc = $('<p>' + $(this).data('description') + '</p>').text();
        if (desc.length > 300) {
          desc = desc.substring(0,300) + '...';
        }

        $(this).html('<b>' + $(this).data('date') +
          ($(this).data('title') ? ' - ' : '') + $(this).data('title') +
          (desc ? ' - ' : '') + '</b>' + desc);
      });

      $select.data().chosen.results_update_field();

      $select.on('change', function() {
        $('#' + $select.data("title-id")).val($(this).find("option:selected").data('title'));
        $('#' + $select.data("description-id")).val($(this).find("option:selected").data('description'));
      });
    });
  };

  return init();
};
;
/***
 * account logic
 **/
VVO.Account = function() {

  var initRegistrationForm = function() {
    // init ajax form
    VVO.AjaxForm($('#acregform'), false, '', VVO.Account, function() {
      VVO.Helper.showMessage($('#acreg').find('#message'), 'error', i18n('ajax_error'));
    });

    if($('#acreg').length)
    {
      // find link which refs on acreg who has colorbox and resize
      $('.register-ajax-link').colorbox.resize();
      $('#acregsubmit').on('click', function(){
        $('#acregform').submit();
      })

    };
  },

  initPasswordforgottenForm = function(){
     // init ajax form
    VVO.AjaxForm($('#acpwfform'), false,'', VVO.Account, function() {
      VVO.Helper.showMessage($('#acpwf').find('#message'), 'error', i18n('ajax_error'));
    });

    if($('#acpwf').length)
    {
      // find link which refs on acpwf who has colorbox and resize
      $('.register-ajax-link').colorbox.resize();
      $('#acpwfsubmit').on('click', function(){
        $('#acpwfform').submit();
      })

    };
  },

  initLoginForm = function() {
    // init ajax form
    VVO.AjaxForm($('#loginform'), false,'', VVO.Account, function() {
      VVO.Helper.showMessage($('#loginmessage'), 'error', i18n('ajax_error'));
    });

  },

  initLogoutLink = function() {
    VVO.AjaxLink($('#logoutlink'), false, VVO.Account, function() {
      VVO.Helper.showMessage($('#loginmessage'), 'error', i18n('ajax_error'));
    }, false);
  },


  init = function() {
    initRegistrationForm();
    initPasswordforgottenForm();
    initLoginForm();
    initLogoutLink();
  };

  return init;

}();
;

/************************************************************
	@description favourite logic - all events are bind to body!

	 favourites should look like this:
	<a id="addfavoriteLink" class="ico-favorite-saved pointfavourite" href="#" role="button" 
		data-pointstring="id|type|place|name|lat|lng|0"  ***** if trip favourite : data-pointstring-origin and data-pointstring-destination
		data-saved="true" 
		data-titlesave="Punkt als Favorit speichern" 
		data-titledelete="Punkt als Favorit l�schen">Punkt als Favorit l�schen</a>
	*************************************************************/

/***
 * favourite logic
 **/
VVO.Favourites = function() {
	var maxEntries = 10,

    /**
     * toggle favourite icon
     */
    toggleFavIcon = function (chosenContainer, isFav) {
      $(chosenContainer).next('ul.tooltip-icons').find('a.switch-btn-favorite').removeClass('disabled');
      if (!isFav) {
        //set link icon
        $(chosenContainer).next('ul.tooltip-icons').find('.ico-favourite-filled,.ico-favourite')
          .removeClass('ico-favourite-filled').removeClass('ico-favourite').addClass('ico-favourite');
        //set link title
        $(chosenContainer).next('ul.tooltip-icons').find('a.switch-btn-favorite')
          .attr('title', VVO.I18N.translate('saveasfavourite'));
        //set span text
        $(chosenContainer).next('ul.tooltip-icons').find('a.switch-btn-favorite').find('span.text-hidden').val(VVO.I18N.translate('saveasfavourite'));
      } else {
        //set link icon
        $(chosenContainer).next('ul.tooltip-icons').find('.ico-favourite-filled,.ico-favourite')
          .removeClass('ico-favourite-filled').removeClass('ico-favourite').addClass('ico-favourite-filled');
        //set link title
        $(chosenContainer).next('ul.tooltip-icons').find('a.switch-btn-favorite')
          .attr('title', VVO.I18N.translate('removeasfavourite'));
        //set span text
        $(chosenContainer).next('ul.tooltip-icons').find('a.switch-btn-favorite').find('span.text-hidden').val(VVO.I18N.translate('removeasfavourite'));
      }
    },

    /**
     * add delete link to favourite in select results
     */
    addDeleteLink = function (event) {
      var pointString = $(event.target).closest('div').find('li.active-result.result-selected ').find('span.displayname')
        .data('pointstring');
      var select = $(event.target).closest('div').find('select').data().chosen;

      if (typeof pointString === 'undefined') {
        pointString = $(event.target).closest('div.journey-location').find('a.chosen-single').find('span.displayname').data('pointstring');
      }

      var point = VVO.PointHelper.toPoint(pointString);
      var option = $(event.target).closest('div').find("option[value~='" + point.Id + "']");

      $(option).find('span.displayname').remove();
      $(option).find('span.clearfix').append(
        '<span class="displayname" data-pointstring="' + pointString + '" data-fav="true">' + point.Name + ', ' + point.Place + '</span>'
      );
      $(option).find('span.displayname').data('fav', true);
      $(option).find('strong.right').before(
        '<a class="delete-favorite autocompleter-favorite right" href="#" role="button" tabindex="-1" title="' + VVO.I18N.translate('removeasfavourite') + '"><span class="icon-font ico-favourite-filled"></span></a>'
      );

      select.results_update_field();
    },

    /**
     * remove delete link from favourite in select results
     */
    removeDeleteLink = function (event) {
      var pointString = $(event.target).closest('div.journey-location').find('li.active-result.result-selected ').find('span.displayname')
        .data('pointstring');
			var select=$(event.target).closest('div.journey-location').find('select').data().chosen;

      if (typeof pointString === 'undefined') {
        pointString = $(event.target).closest('div.journey-location').find('a.chosen-single').find('span.displayname').data('pointstring');
      }

      if (typeof pointString === 'undefined') {
        pointString = $(event.target).closest('span.clearfix').find('span.displayname').data('pointstring');
      }

      var point = VVO.PointHelper.toPoint(pointString);
      var option = $(event.target).closest('div.journey-location').find("option[value~='" + point.Id + "']");

      $(option).find('span.displayname').remove();
      $(option).find('a').remove();

      $(event.target).closest('span.clearfix').find('a').remove();
      $(event.target).closest('span.clearfix').find('span.displayname').data('fav', false);

      $(option).find('span.clearfix').append(
        '<span class="displayname" data-pointstring="' + pointString + '" data-fav="false">' +
        point.Name +
        ', ' +
        point.Place +
        '</span>'
      );

      $(option).find('span.displayname').data('fav', false);

      select.results_update_field();
    },

    /**
     * save or delete point from favourites
     */
    saveOrDeleteFavourite = function (event) {
      if (event.type === "click" || event.keyCode === "13") {
        event.preventDefault();
        event.stopPropagation();

        var pointString = $(event.target).closest('div').find('select').data('pointstring');

        if ($(event.target).closest('div').find('select').val()) {
          var favPointList = VVO.AutocompleteFavorite.getList('');

          //remove shortcut from point string
          var point = VVO.PointHelper.toPoint(pointString);
          var cleanPointString = pointString;
          if (point.ShortCuts !== '') {
            cleanPointString = pointString.replace(point.ShortCuts, '');
          }

          //check if point exists in favourites
          if (favPointList.indexOf(cleanPointString) !== -1) {
            //remove from favourites
            VVO.AutocompleteFavorite.del(cleanPointString);
            VVO.AutocompleteHistory.del(cleanPointString);

            //toggleFavIcon($(event.target).closest('.chosen-container'), true);

            removeDeleteLink(event);
          } else {
            //add to favourites
            VVO.AutocompleteFavorite.set(cleanPointString);

            //toggleFavIcon($(event.target).closest('.chosen-container'), false);

            addDeleteLink(event);
          }
        }
      }
    },

		/***
	  ** init save favourite functionality do ajax request and add success or error message
	  **/
    initSaveFavourite = function () {
      //init set point favourite triprequest
      $('#triprequestform .ico-favourite, #triprequestform .ico-favourite-filled').parent().each(function () {
        $(this).off().on('click keydown',
          function (event) {
            saveOrDeleteFavourite(event);
          });
      });

      //init set point favourite departure monitor
      $('#dm .ico-favourite, #dm .ico-favourite-filled').parent().off().on('click keydown', function (event) {
        saveOrDeleteFavourite(event);
      });

      //init set point favourite stop timetable
      $('#stt .ico-favourite, #stt .ico-favourite-filled').parent().off().on('click keydown', function (event) {
        saveOrDeleteFavourite(event);
      });

      //init set point favourite timetable book
      $('#ttb .ico-favourite, #ttb .ico-favourite-filled').parent().off().on('click keydown', function (event) {
        saveOrDeleteFavourite(event);
      });

			//init set point favourite homepagelink
      $('#hldetails .ico-favourite, #hldetails .ico-favourite-filled').parent().off().on('click keydown', function (event) {
        saveOrDeleteFavourite(event);
      });


			//init set cookie
      $('.print-menu-container .ico-favourite, .print-menu-container .ico-favourite-filled').parent().off('click keydown').on('click keydown', function(event) {
				if (event.type === "click" || event.keyCode === "13") {
					event.preventDefault();
					event.stopPropagation();
					//delete if already saved
					if ($(this).data('saved') === true) {
						$(this).data('saved', false);
						VVO.PointCookie.deleteByPoint('fav_points', $(this).data('pointstring'));
            $(this).find('span').first().attr('class', 'icon-font icon-reset ico-favourite');
						$(this).attr('title', $(this).data('titlesave'));
						$($(this).find('span')[1]).html($(this).data('titlesave'));
						return;
					}
					//save is if not yet saved
					if ($(this).data('saved') === false) {
						$(this).data('saved', true);
						VVO.PointCookie.set('fav_points', $(this).data('pointstring'), maxEntries);
            $(this).find('span').first().attr('class', 'icon-font icon-reset ico-favourite-filled');
						$(this).attr('title', $(this).data('titledelete'));
						$($(this).find('span')[1]).html($(this).data('titledelete'));
					}
				}
			});
    },


/***
	*  sets value of select
	***/
		_setSelect = function(select, pointstring) {
			//create destionation point object
			var title,
				point = VVO.PointHelper.toPoint(pointstring);

			//title
			if (point.Name && point.Place) {
				title = point.Name + ", " + point.Place;
			} else if (!point.Place) {
				title = point.Name;
			}
			//set data-point of select
			$(select).data('point', point);

			//set option of select
			$(select).html('<option value="' + point.Id + '">' + title + ' </option>');
			$(select).data().chosen.results_update_field();
		},


		init = function() {
			initSaveFavourite();
		};



	return {
		init:init,
    initSaveFavourite: initSaveFavourite,
		removeDeleteLink: removeDeleteLink,
    toggleFavIcon: toggleFavIcon
	};

}();
;
/***
 * personaldata logic
 **/
VVO.Personaldata = function() {
  var init = function() {

    // init ajax form
    VVO.AjaxForm($('#accpdform'), false, '', VVO.Personaldata.init, function() {
      VVO.Helper.showMessage($('#message'), 'error', i18n('ajax_error'));
      });

    // init ajax form
    VVO.AjaxForm($('#accpwform'), false, '', VVO.Personaldata.init, function() {
      VVO.Helper.showMessage($('#message'), 'error', i18n('ajax_error'));
      });

    $('#pddelete').off('click').on('click',function()
    {
      if(!confirm(i18n('delete_confirmationquestion'))){
         event.preventDefault();
       }
    });

  };



  return {
    init: init
  };

}();
;
  /************************************************************
    @description helper to convert points to pointstrings and the other way around
  *************************************************************/
  VVO.PointHelper = function () {
    var pinToPointString = function(pin) {

          return pin.Id + "|" +
            pin.Type + "|" +
            pin.Place + "|" +
            pin.Name + "|" +
            pin.Lat + "|" +
            pin.Lng + "|0";
        },

      toPoint = function (pointstring) {
        if (!pointstring) {
          return null;
        }

        var cPoint = pointstring.split('|');

        var shortcutstring = "";
        if (cPoint[8]) {
          //get short cuts, split by # and combine again
          var shortCuts = cPoint[8].split('#');
          if (shortCuts.length > 0) {
            $.each(shortCuts, function(idx, val) {
              shortcutstring += val + ", ";
            });
            shortcutstring = shortcutstring.substring(0, shortcutstring.length - 2);
          }
        }

        // detect type if type is usermarker
        var type = cPoint[1];
        if (type === 'usermarker') {
          type = cPoint[0].indexOf("poiID:") === 0 ? "p" : cPoint[0].indexOf("streetID:") === 0 ? "a" : "c";
        }

        var pin = {
          Id: cPoint[0],
          Type: type === 'a' || type === 'address' ? 'address' : type === 'c' || type === 'coordinate' ? 'coordinate' : type === 'p' || type === 'poi' ? 'poi' : 'stop',
          Place: !cPoint[2] ? 'Dresden' : cPoint[2],
          Name: cPoint[3],
          Lat: parseFloat(cPoint[4]),
          Lng: parseFloat(cPoint[5]),
          ShortCuts: shortcutstring
        };
        return pin;

      },

      getEmptyString = function() {
        return "|a|||0|0|0||";
      };

    return {
      toPoint: toPoint,
      pinToPointString: pinToPointString,
      getEmptyString: getEmptyString
    };
  }();
;
/***
 * point cookie logic
 **/
VVO.PointCookie = function() {
   /***
   * get all objects of a list
   * name         : name parameter
   * term         : optional parameter for filtering
   * stopsOnly    : filter stops only
   **/
  var getList= function(name, term, stopsOnly) {
    var val = $.cookie(name);
    if(!val || $.trim(val).length < 1 || !eval(val)) {
      return [];
    }

    var retval = eval(val);
    var newRetval = [];

    // manually filter and resort list
    if(typeof(term) !== 'undefined' && term.length > 0) {
      for (var j = 0; j < retval.length; j++) {
        var point = retval[j].split('|'),
            place = !point[3] ? 'Dresden' : point[3],
            name = point[4];

        if((name + place).toLowerCase().indexOf(term) > -1) {
          newRetval.push(retval[j]);
        }
      }

      retval = newRetval;
    }

    // filter for stops
    if(typeof(stopsOnly) !== 'undefined' && stopsOnly) {
      newRetval = [];
      for (var k = 0; k < retval.length; k++) {
        var point = retval[k].split('|');

        // point[1] == type; type is empty for stop
        if(!point[1]) {
          newRetval.push(retval[k]);
        }
      }
      retval = newRetval;
    }

    return retval;
  },

  set = function(name, point, maxEntries){
    var list = getList(name);
    var found = false;

    var dataId = point.split('|')[0];

    if(list.length > 0){
      for (var i = 0; i < list.length; i++) {
        var idx = parseInt(i,10); // otherwise addition operations are handled as string concat!
        var listDataId = list[idx].split('|')[0];
        if(listDataId === dataId) {
          // move element to end of list
          list = list.slice(0,idx).concat(list.slice(idx+1)).concat(list[idx]);

          found = true;
          break;
        }
      }
    }

    // add new elements to end of list
    if(!found) {
      list.push(point);
    }

    // remove first entry if exceeded max count
    if(list.length > maxEntries) {
      list.shift();
    }

    var cookieVal = _serializeListIntoCookie(list);

    $.cookie(name, cookieVal, { expires: 99999, path: '/'});

    // check if cookie was written correct (RFC says 4KB max size, test with FF3 was 3425 chars)
    if(cookieVal != $.cookie(name)) {
      VVO.Log('couldnt write cookie, maybe maxsize reached');
      // Extension: handle split cookie
    }
  },

  setTrips = function (name, point1, point2, maxEntries)
  {
    var list = getList(name).reverse();

    var favId = point1.split('|')[0]+point2.split('|')[0];
    //check if already exists
    var found = false;
    if(list.length > 0) {
      for (var i = 0; i < list.length-1; i=i+2) {
        var idx = parseInt(i,10); // otherwise addition operations are handled as string concat!
        var originId = list[idx].split('|')[0];
        var destinationId = list[idx+1].split('|')[0];
        if (favId == originId+destinationId){
          found=true;
          return;
        }
      }
    }

    // add new elements to list
    list.push(point2);
    list.push(point1);


    // remove first entry if exceeded max count
    if(list.length > maxEntries*2) {
      list.shift();
      list.shift();
    }

    var cookieVal = _serializeListIntoCookie(list);

    $.cookie(name, cookieVal, { expires: 99999, path: '/'});

    // check if cookie was written correct (RFC says 4KB max size, test with FF3 was 3425 chars)
    if(cookieVal != $.cookie(name)) {
      VVO.Log('couldnt write cookie, maybe maxsize reached');
      // Extension: handle split cookie
    }
  },

  deleteTrip = function(name, point1, point2)
  {
    var list = getList(name).reverse();
    var favId = point1.split('|')[0]+point2.split('|')[0].toString();
    //create list of connected favouritetrip ids
    var idList = [];
    if(list.length > 0) {
      for (var i = 0; i < list.length-1; i=i+2) {
        var idx = parseInt(i,10); // otherwise addition operations are handled as string concat!
        var originId = list[idx].split('|')[0];
        var destinationId = list[idx+1].split('|')[0];
        idList.push(originId+destinationId);
      }
    }

    //remove elements in favourite list
    var idx = idList.indexOf(favId);
    if(idx!=-1)
    {
      list.splice(idx*2,1);
      list.splice(idx*2,1);
    }

    var cookieVal = _serializeListIntoCookie(list);

    $.cookie(name, cookieVal, { expires: 99999, path: '/'});

    // check if cookie was written correct (RFC says 4KB max size, test with FF3 was 3425 chars)
    if(cookieVal != $.cookie(name)) {
      VVO.Log('couldnt write cookie, maybe maxsize reached');
      // Extension: handle split cookie
    }

    return list;

  },

  deleteTripById = function(name, id)
  {
    var list = getList(name).reverse();

    //create list of connected favouritetrip ids
    var idList = [];
    if(list.length > 0) {
      for (var i = 0; i < list.length-1; i=i+2) {
        var idx = parseInt(i,10); // otherwise addition operations are handled as string concat!
        var originId = list[idx].split('|')[0];
        var destinationId = list[idx+1].split('|')[0];
        idList.push(originId+destinationId);
      }
    }

    //remove elements in favourite list
    var idx = idList.indexOf(id.toString())
    if(idx!=-1)
    {
      list.splice(idx*2,1);
      list.splice(idx*2,1);
    }

    var cookieVal = _serializeListIntoCookie(list);

    $.cookie(name, cookieVal, { expires: 99999, path: '/'});

    // check if cookie was written correct (RFC says 4KB max size, test with FF3 was 3425 chars)
    if(cookieVal != $.cookie(name)) {
      VVO.Log('couldnt write cookie, maybe maxsize reached');
      // Extension: handle split cookie
    }

    return list;

  },

  deleteByPoint = function(name, point){
    var list = getList(name);

    var dataId = point.split('|')[0];

    if(list.length > 0) {
      for (var i = 0; i < list.length; i++) {
        var idx = parseInt(i,10); // otherwise addition operations are handled as string concat!
        var listDataId = list[idx].split('|')[0];
        if(listDataId === dataId) {
          // remove element
          list.splice(idx,1);
          break;
        }
      }
    }

    var cookieVal = _serializeListIntoCookie(list);

    $.cookie(name, cookieVal, { expires: 99999, path: '/'});

    // check if cookie was written correct (RFC says 4KB max size, test with FF3 was 3425 chars)
    if(cookieVal != $.cookie(name)) {
      VVO.Log('couldnt write cookie, maybe maxsize reached');
      // Extension: handle split cookie
    }

    return list;
  },

  deleteById = function(name, id){
    var list = getList(name);
    if(list.length > 0) {
      for (var i = 0; i < list.length; i++) {
        var idx = parseInt(i,10); // otherwise addition operations are handled as string concat!
        var listDataId = list[idx].split('|')[0];
        if(listDataId == id) {
          // remove element
          list.splice(idx,1);
          break;
        }
      }
    }

    var cookieVal = _serializeListIntoCookie(list);

    $.cookie(name, cookieVal, { expires: 99999, path: '/'});

    // check if cookie was written correct (RFC says 4KB max size, test with FF3 was 3425 chars)
    if(cookieVal != $.cookie(name)) {
      VVO.Log('couldnt write cookie, maybe maxsize reached');
      // Extension: handle split cookie
    }

    return list;
  },

  _serializeListIntoCookie = function(list){
     // serialize list into cookie
    var cookieVal = '[';

    for(var k = 0; k < list.length; k++) {
      cookieVal += '"' + list[k].replace(/"/g, '\\"') + '"';

      if(k < list.length -1) {
        cookieVal += ',';
      }
    }

    cookieVal += ']';

    return cookieVal;
  };

  return {
    getList: getList,
    set: set,
    deleteByPoint: deleteByPoint,
    deleteById :deleteById,
    deleteTrip: deleteTrip,
    deleteTripById: deleteTripById,
    setTrips:setTrips
  };


}();
;
/***
 * park and ride application logic
 **/
VVO.ParkAndRide = function () {

  // init map
  VVO.OsmMap('parkandridemap', { activePinTypes: ['parkandride', 'stop'] }, { zoom: 2, center: new L.LatLng(6654913.5, 1534091) });

  // trigger event to scroll to p+r map and open marker
  $('#pr').find('.list-entry').on('click',
    function () {
      jQuery('body').trigger({ type: "map:openmarker", markerType: "parkandride", markerId: $(this).data('id'), centerAndZoom: true, extendLegend: true });
      $('#parkandridemap').scrollTo();
    });

  // init favourites
  VVO.Favourites.init();

  // center on given latitude and longitude
  setTimeout(function () {
    var lat = (new RegExp('[?&]lat=([^&]*)')).exec(location.search);
    var lng = (new RegExp('[?&]lng=([^&]*)')).exec(location.search);
    if (lat && lat[1] && lng && lng[1]) {
      $('#pr')
        .find('.list-entry[data-lat="' + lat[1] + '"][data-lng="' + lng[1] + '"]')
        .trigger('click');
    }
  }, 500);
};
;
/***
 * route changes application logic
 **/
VVO.RouteChangesSubscription = function() {

  var initSubscribe = function(){
    var handler = function(event){
      if(event.type=='click' || event.keyCode == '13')
      {
        event.preventDefault();
        event.stopPropagation();


        //show spinenr
        VVO.Spinner.show($(this).offset().left - 22, $(this).offset().top + 10);
        var that = this;
        //init ajaxLink for subscribing
        _InitAjaxLink(that, $(this).data('saveurl'), true);
        
      }
    };

    $('.js-subscription').off('click').on('click keydown', handler);
    $('body').off('click', '.js-subscription').on('click keydown', '.js-subscription', handler);
  },


  _InitAjaxLink = function(obj, url, save){
     $.ajax({
        url:url,
        method: 'GET',
        success: function (data) {
          //open colorbox 

          // ask for mail-adress
          //open Colorbox
            $.colorbox({
              html:data,
              opacity: 0.6,
              width: '665px',
              onComplete: function(){
                _initAjaxForm();
              }
            });
       },
       error: function() {},
       complete: function() {
          VVO.Spinner.hide();
          $('#cboxClose').append('<span class="icon-font ico-close"/>');
        }
    });

  },

  _initAjaxForm = function(){
    $('#cbloginsubmit').off('click').on('click', function(event){
          $('#cbloginform').submit();
    });
    // init ajax form
    VVO.AjaxForm($('#cbloginform'), false, '', function() {
        _initAjaxForm();
      }, function() {
         VVO.Helper.showMessage($('#message-subscribe'), 'error', i18n('ajax_error'))
      }
    );
  },

  initFavouritesOverview = function () {
    //delete confirmation question
    $('#rcsub').find('.circle-white-border').off('click').on('click', function(event){
       event.stopPropagation();
       if(!confirm(i18n('routechangesub_confirmationquestion'))){
         event.preventDefault();
       }

    })
  },

  /***
   * init
   ***/
  init = function() {
    initSubscribe();

  };

  // return public methods
  return {
    init:init,
    initFavouritesOverview:initFavouritesOverview
  };
}();
;
/***
 * helper functions
 **/
VVO.Helper = function() {

  var i18n = VVO.I18N.translate;

  var showMessage = function($node, type, msg){
    $node.html(
    '<div class="msg msg-' + type + '" style="display:block" role="alert">' +
      '<a title="' + i18n('btn_close') + '" class="msg-close" href="#"><span class="icon-font ico-close" aria-hidden="true"></span></a>' +
      '<p>' + msg + '</p>' +
    '</div>');
  };

  return {
    showMessage:showMessage
  }
}()
;
var backButtonPressed = false;

VVO.BackButton = function () {
  //add listener for popstate
  var attachListener = function () {
    $(window).off('popstate').on("popstate", function (event) {
      VVO.BackButton().popstate();
    });
  },

  popstate = function () {

    if (!history || !history.state) {
      return;
    }

    //if pagereload true- > reload page
    if (history.state.pagereload === true) {
      window.location.href = document.URL;
    }

    if (history.state.type === "form") {
      if (history.state.data === null) {
        return;
      }

      //uncheck all boxes
      $('#' + history.state.id).find(':checkbox').attr('checked', false);

      //parse json of selectdata
      var selectdata = $.parseJSON(history.state.selectdata);
      //deserialize obj
      var obj = $.deserialize(history.state.data);

      //loop through object
      var key;
      for (key in obj) {
        var objValue = obj[key].replace(/\+/g, ' ');

        //if select - add option and set to value
        if ($('[name=' + key + ']').is('select')) {
          var selectValue = $.trim(selectdata[key]).length !== 0 ? objValue : "";
          //set option of select
          $('[name=' + key + ']').html('<option value="' + selectValue + '">' + selectdata[key] + '</option>');
          //trigger chosen update
          $('[name=' + key + ']').trigger("chosen:updated");
        } else {
          var type = $('[name=' + key + ']').attr('type');
          switch (type) {
            case "radio":
              //set radio as checked
              $('[name=' + key + '][value=' + objValue + ']').attr('checked', 'checked');
              break;
            case "checkbox":
              //get checkbox values
              var checkboxValues = objValue.split(',');
              //set concerning checkbox to checked
              var i;
              for (i in checkboxValues) {
                $('[name=' + key + '][value=' + checkboxValues[i] + ']').prop('checked', true);
              }
              break;
            default: $('[name=' + key + ']').val(objValue);
          }
        }
      }

      backButtonPressed = true;
      //submit form again 
      if ($('#' + history.state.id)) {
        $('#' + history.state.id).submit();
      }
    }
      //if link
    else {
      if (history.state.type === "link") {
        backButtonPressed = true;

        // if no id return
        if (!history.state.id) {
          return;
        }

        //reset url
        $('#' + history.state.id).attr('href', history.state.url);
        //trigger click event 
        $('#' + history.state.id).trigger('click');
      }
    }
  };

  return {
    attachListener: attachListener,
    popstate: popstate
  };

};
/***
 * issuu logic
 **/
VVO.Issuu = function() {
  if($('.issuuembed').length) {
    $.getScript( '//e.issuu.com/embed.js');
  }
};
;
/***
 * autocompleter for points
 * based on https://github.com/meltingice/ajax-chosen/blob/master/index.html 09.03.2013
 **/
VVO.Lineautocompleter = function() {

  var i18n = VVO.I18N.translate;

  /***
   * main initalization
   ***/
  var init = function($select) {

    if (!$select.length) {
      return;
    }

    // don't do anything when only showing radius stops
    if ($('#inputmap').data('stops')) {
      $select.data().chosen.results_build();
      return;
    }

    var
      chosenXhr = null, // current ajax request for autocompletion
      $chosenContainer, // container for chosen
      afterTypeDelay = 500, // delay after which request should be triggered
      ajaxOptions = {
        // ajax options
        type: 'GET', // method
        data: {}, // additional query paramters
        url: '/de/fahrplan/aktuelle-abfahrten-ankuenfte/lines', // url to linefinder service
        dataType: 'json' // data type
      };

    // call chosen
    $select.chosen();

    $chosenContainer = $select.next('.chosen-container');

    //bind click on delete button
    $('.linecompleter').off('click', '.delete-entry.linecompleter').on('click', '.delete-entry.linecompleter', function (event) {
    	event.preventDefault();
    	event.stopPropagation();

    	var $input = $(this).closest('.chosen-search').find('.locationsearch');
      var $select = $input.parents('.chosen-container').siblings('select');
    	$(this).addClass('hidden');
    	$input.val('');

    	$input.focus();
    	$select.val('');
    	$select.data('linestring', '');
    	$select.html('<option value=""></option>');
    	$select.data().chosen.results_build();
    	$input.trigger("keyup"); // trigger list refresh
    	$('.advanced-options').trigger('change');
      $select.change();
    });

    // show delete button
    $('.linecompleter').on('keyup focus', '.locationsearch', function (event) {
      $(this).next('.delete-entry').addClass('linecompleter').toggleClass('hidden', !$(this).val().length);
    });

    // extend chosen autocomplete (noupdate = true -> don't clear select list)
    $select.data().chosen.customAutocomplete = function (noupdate) {

      var
        dontUpdate = typeof (noupdate) !== "undefined" && noupdate,
        val = $chosenContainer.find('.chosen-search > input').val(),
        $resultsContainer = $chosenContainer.find('ul.chosen-results'),
        typeImages = {
          Cableway:'/assets/img/trans-icon/ico-cable-railway.svg',
          CityBus:'/assets/img/trans-icon/ico-bus.svg',
          IntercityBus:'/assets/img/trans-icon/ico-bus.svg',
          Ferry:'/assets/img/trans-icon/ico-ferry.svg',
          HailedSharedTaxi:'/assets/img/trans-icon/ico-taxi.svg',
          BusOnRequest: '/assets/img/trans-icon/ico-taxi.svg',
          CitizenBus: '/assets/img/trans-icon/ico-bus.svg',
          SchoolBus: '/assets/img/trans-icon/ico-schoolbus.svg',
          VvvCityBus: '/assets/img/trans-icon/ico-bus.svg',
          ClockBus: '/assets/img/trans-icon/ico-bus.svg',
          SuburbanRailway:'/assets/img/trans-icon/ico-metropolitan-railway.svg',
          Train:'/assets/img/trans-icon/ico-train.svg',
          Tram: '/assets/img/trans-icon/ico-tram.svg',
          PlusBus: '/assets/img/trans-icon/ico-bus.svg'
        },

        typeHoverImages = {
          Cableway:'/assets/img/trans-icon/ico-cable-railway-h.svg',
          CityBus:'/assets/img/trans-icon/ico-bus-h.svg',
          IntercityBus:'/assets/img/trans-icon/ico-bus-h.svg',
          Ferry:'/assets/img/trans-icon/ico-ferry-h.svg',
          HailedSharedTaxi:'/assets/img/trans-icon/ico-taxi-h.svg',
          BusOnRequest: '/assets/img/trans-icon/ico-taxi-h.svg',
          CitizenBus: '/assets/img/trans-icon/ico-bus-h.svg',
          SchoolBus: '/assets/img/trans-icon/ico-schoolbus.svg',
          VvvCityBus: '/assets/img/trans-icon/ico-bus-h.svg',
          ClockBus: '/assets/img/trans-icon/ico-bus-h.svg',
          SuburbanRailway:'/assets/img/trans-icon/ico-metropolitan-railway-h.svg',
          Train:'/assets/img/trans-icon/ico-train-h.svg',
          Tram: '/assets/img/trans-icon/ico-tram-h.svg',
          PlusBus: '/assets/img/trans-icon/ico-bus-h.svg'
        },

        typeAltText = {
          Cableway:'Seilbahn',
          CityBus:'Bus',
          IntercityBus: 'Regionalbus',
          Ferry:'Fähre',
          HailedSharedTaxi:'Taxi',
          SuburbanRailway:'S-Bahn',
          Train:'Zug',
          BusOnRequest: 'Rufbus',
          CitizenBus: 'Bürgerbus',
          SchoolBus: 'Schulbus',
          VvvCityBus: 'Stadtbus',
          ClockBus: 'Taktbus',
          Tram: 'Straßenbahn',
          PlusBus: 'Plusbus'
        },

        // highlight search results
        highlight = function() {
          $resultsContainer.not('.no-results').find('span').each(function() {
            //$(this).html($(this).html().replace(new RegExp('(' + val + ')', "gi"),'<em>$1</em>'));
          });
        };


      // if timer of last input already running, cancel it
      if (this.timer) {
        clearTimeout(this.timer);
      }

      // set query parameter
      ajaxOptions.data = ajaxOptions.data || {};
      ajaxOptions.data.query = val;
      ajaxOptions.data.stopId = $('#stopid').val();
      ajaxOptions.data.isArrival = $('#arrive').prop('checked');

      // ajax error handler
      ajaxOptions.error = function(jqXHR, status, exception) {
        // ajax request was aborted by user
        if(status === 'abort') {
          return;
        }

        $resultsContainer.find(".no-results").html(i18n('autocomplete_error'));
      };

      // ajax success handler
      ajaxOptions.success = function(lines) {
        // remove message list item
        $resultsContainer.find(".no-results").remove();

        // got no data -> show link for searching more
        if (lines && lines.length) {

          // add items to select list
          $.each(lines, function(i, line) {
            if (typeof(line) === 'string') {
              var cLine=line.split('|');
              line = {
                Id: cLine[0],
                Name: cLine[1],
                TransportationCompany: cLine[2],
                Mot: cLine[3]
              };
            }
            var
              lineId = line.Id,
              lineText = '<img width="16" height="16" style="display:inline" aria-label="' + typeAltText[line.Mot] + '" src="' + typeImages[line.Mot] + '" data-hoversrc="' + typeHoverImages[line.Mot] + '" data-src="' + typeImages[line.Mot] + '"/><span class="clearfix"><strong class="right">' + line.TransportationCompany + '</strong><span class="displayname">' + line.Name + '</span></span>';

            // add option to select
            var option = $("<option />").attr('value', lineId).html(lineText).appendTo($select);
            option.data('line', line);
            option.data('linestring', line);

            // if exactly one element, set in select data-container for map
            if(lines.length === 1) {
              $select.data('line', line);
            }
          });

          // update list
          if ($select.data().chosen) {
            $select.data().chosen.results_update_field();
          }

          // set highlighting
          highlight();

          //add amount of results for bitV
          $resultsContainer.append('<span role="status" style="position:absolute; top:-900px;">'+lines.length +' '+ i18n('autocompleter_results') +'</span>');
        }
        else {
          $resultsContainer.append($('<li class="no-results">' + i18n('autocompleter_line_not_found') + '</li>'));
        }
      };


      // input field is empty and selectbox value is preset, don't show list with history
      if($select.data('linestring')) {
        $select.html('');

        if(typeof($select.data('linestring')) === 'string') {
          ajaxOptions.success([ $select.data('linestring') ]);
        }

        return;
      }

      // if noupdate is true/ last state should be shown exit
      if (dontUpdate)
      {
        // highlight search results
        highlight();

        return;
      }

      // remove old entries
      $select.html('<option value=""></option>');
      $select.data().chosen.results_build();

      // create message list item if not exists, set message while typing
      if(!$resultsContainer.find(".no-results").length) {
        var msg = i18n('searchinprogress') + ' <img src="/assets/img/spinner.gif" style="display:inline">';
        $resultsContainer.append($('<li class="no-results">' + msg + '</li>'));
      }

      // set timeout after key has been pressed
      this.timer = setTimeout(function() {
        // abort current pending requests
        if (chosenXhr) {
          chosenXhr.abort();
        }

        // trigger ajax request now
        chosenXhr = $.ajax(ajaxOptions);
      }, afterTypeDelay);
    };

    // initialization for preset value
    $select.data().chosen.customAutocomplete();
  };

  // return public methods
  return init;
}();
;
// define(['jquery', 'modules/issuu', 'libs/jquery/jquery.cookie'], function($, issuu) {

VVO.CookieContent = (function () {
  /************************************************************
   @description CookieContent
   *************************************************************/

  var init = function () {
      if (document.querySelector(".cookie-content-container")) {
        Array.prototype.slice
          .call(document.querySelectorAll(".cookie-content-container"))
          .forEach(function (container) {
            if (container.querySelector(".cookie-content-placeholder-body")) {
              var cookie = $.cookie(container.dataset.cookieName);
              if (!cookie) {
                bindEvents(container);
              } else if (cookie === "allowed") {
                getModules(container);
              }
            }
            if (container.querySelector(".issuuembed")) {
              container.style.paddingTop = 0;
            }
          });
      }
    },
    bindEvents = function (container) {
      container
        .querySelector(".js-load-cookie-content")
        .addEventListener("click", function () {
          $.cookie(container.dataset.cookieName, "allowed");

          getModules(container);
        });
    },
    getModules = function (container) {
      var moduleCookieName = container.getAttribute("data-cookie-name");
      var similarModules = document.body.querySelectorAll(
        '.cookie-content-container[data-cookie-name="' + moduleCookieName + '"]'
      );

      Array.prototype.slice
        .call(similarModules)
        .forEach(function (similarModule) {
          loadContent(similarModule);
        });
    },
    loadContent = function (container) {
      container.querySelector(".cookie-content").innerHTML =
        '<div class="iframe-container"><iframe src="' +
        container.dataset.iframeSrc +
        '" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div></div>';
    };

  // return public methods
  return {
    init: init,
  };
})();
;
/***
 * tourmap logic
 **/
 VVO.Tourmap = function() {
  if($('.tourmap').length) {
    var tourmap = $('#tourmap');

    var mouseOut = function() {
      tourmap.attr('src', '/assets/img/tourmap/img-tourmap.png');
    };

    [
      'dresden-active',
      'elbland-active',
      'lausitz-active',
      'osterzgebirge-active',
    ].forEach(function(region) {
      $('[data-id="' + region + '"]').on('mouseout', mouseOut);

      $('[data-id="' + region + '"]').on('mouseenter', function() {
        tourmap.attr('src', '/assets/img/tourmap/img-tourmap-' + region + '.png');
      });
    });
  }
};
;
/*
 Leaflet, a JavaScript library for mobile-friendly interactive maps. http://leafletjs.com
 (c) 2010-2013, Vladimir Agafonkin
 (c) 2010-2011, CloudMade
*/
(function (window, document, undefined) {
  var oldL = window.L,
      L = {};

  L.version = '0.7.3';

  // define Leaflet for Node module pattern loaders, including Browserify
  if (typeof module === 'object' && typeof module.exports === 'object') {
    module.exports = L;

    // define Leaflet as an AMD module
  } else if (typeof define === 'function' && define.amd) {
    define(L);
  }

  // define Leaflet as a global L variable, saving the original L to restore later if needed

  L.noConflict = function () {
    window.L = oldL;
    return this;
  };

  window.L = L;


  /*
   * L.Util contains various utility functions used throughout Leaflet code.
   */

  L.Util = {
    extend: function (dest) { // (Object[, Object, ...]) ->
      var sources = Array.prototype.slice.call(arguments, 1),
          i, j, len, src;

      for (j = 0, len = sources.length; j < len; j++) {
        src = sources[j] || {};
        for (i in src) {
          if (src.hasOwnProperty(i)) {
            dest[i] = src[i];
          }
        }
      }
      return dest;
    },

    bind: function (fn, obj) { // (Function, Object) -> Function
      var args = arguments.length > 2 ? Array.prototype.slice.call(arguments, 2) : null;
      return function () {
        return fn.apply(obj, args || arguments);
      };
    },

    stamp: (function () {
      var lastId = 0,
          key = '_leaflet_id';
      return function (obj) {
        obj[key] = obj[key] || ++lastId;
        return obj[key];
      };
    }()),

    invokeEach: function (obj, method, context) {
      var i, args;

      if (typeof obj === 'object') {
        args = Array.prototype.slice.call(arguments, 3);

        for (i in obj) {
          method.apply(context, [i, obj[i]].concat(args));
        }
        return true;
      }

      return false;
    },

    limitExecByInterval: function (fn, time, context) {
      var lock, execOnUnlock;

      return function wrapperFn() {
        var args = arguments;

        if (lock) {
          execOnUnlock = true;
          return;
        }

        lock = true;

        setTimeout(function () {
          lock = false;

          if (execOnUnlock) {
            wrapperFn.apply(context, args);
            execOnUnlock = false;
          }
        }, time);

        fn.apply(context, args);
      };
    },

    falseFn: function () {
      return false;
    },

    formatNum: function (num, digits) {
      var pow = Math.pow(10, digits || 5);
      return Math.round(num * pow) / pow;
    },

    trim: function (str) {
      return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
    },

    splitWords: function (str) {
      return L.Util.trim(str).split(/\s+/);
    },

    setOptions: function (obj, options) {
      obj.options = L.extend({}, obj.options, options);
      return obj.options;
    },

    getParamString: function (obj, existingUrl, uppercase) {
      var params = [];
      for (var i in obj) {
        params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i]));
      }
      return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&');
    },
    template: function (str, data) {
      return str.replace(/\{ *([\w_]+) *\}/g, function (str, key) {
        var value = data[key];
        if (value === undefined) {
          throw new Error('No value provided for variable ' + str);
        } else if (typeof value === 'function') {
          value = value(data);
        }
        return value;
      });
    },

    isArray: Array.isArray || function (obj) {
      return (Object.prototype.toString.call(obj) === '[object Array]');
    },

    emptyImageUrl: 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='
  };

  (function () {

    // inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/

    function getPrefixed(name) {
      var i, fn,
          prefixes = ['webkit', 'moz', 'o', 'ms'];

      for (i = 0; i < prefixes.length && !fn; i++) {
        fn = window[prefixes[i] + name];
      }

      return fn;
    }

    var lastTime = 0;

    function timeoutDefer(fn) {
      var time = +new Date(),
          timeToCall = Math.max(0, 16 - (time - lastTime));

      lastTime = time + timeToCall;
      return window.setTimeout(fn, timeToCall);
    }

    var requestFn = window.requestAnimationFrame ||
            getPrefixed('RequestAnimationFrame') || timeoutDefer;

    var cancelFn = window.cancelAnimationFrame ||
            getPrefixed('CancelAnimationFrame') ||
            getPrefixed('CancelRequestAnimationFrame') ||
            function (id) { window.clearTimeout(id); };


    L.Util.requestAnimFrame = function (fn, context, immediate, element) {
      fn = L.bind(fn, context);

      if (immediate && requestFn === timeoutDefer) {
        fn();
      } else {
        return requestFn.call(window, fn, element);
      }
    };

    L.Util.cancelAnimFrame = function (id) {
      if (id) {
        cancelFn.call(window, id);
      }
    };

  }());

  // shortcuts for most used utility functions
  L.extend = L.Util.extend;
  L.bind = L.Util.bind;
  L.stamp = L.Util.stamp;
  L.setOptions = L.Util.setOptions;


  /*
   * L.Class powers the OOP facilities of the library.
   * Thanks to John Resig and Dean Edwards for inspiration!
   */

  L.Class = function () { };

  L.Class.extend = function (props) {

    // extended class with the new prototype
    var NewClass = function () {

      // call the constructor
      if (this.initialize) {
        this.initialize.apply(this, arguments);
      }

      // call all constructor hooks
      if (this._initHooks) {
        this.callInitHooks();
      }
    };

    // instantiate class without calling constructor
    var F = function () { };
    F.prototype = this.prototype;

    var proto = new F();
    proto.constructor = NewClass;

    NewClass.prototype = proto;

    //inherit parent's statics
    for (var i in this) {
      if (this.hasOwnProperty(i) && i !== 'prototype') {
        NewClass[i] = this[i];
      }
    }

    // mix static properties into the class
    if (props.statics) {
      L.extend(NewClass, props.statics);
      delete props.statics;
    }

    // mix includes into the prototype
    if (props.includes) {
      L.Util.extend.apply(null, [proto].concat(props.includes));
      delete props.includes;
    }

    // merge options
    if (props.options && proto.options) {
      props.options = L.extend({}, proto.options, props.options);
    }

    // mix given properties into the prototype
    L.extend(proto, props);

    proto._initHooks = [];

    var parent = this;
    // jshint camelcase: false
    NewClass.__super__ = parent.prototype;

    // add method for calling all hooks
    proto.callInitHooks = function () {

      if (this._initHooksCalled) { return; }

      if (parent.prototype.callInitHooks) {
        parent.prototype.callInitHooks.call(this);
      }

      this._initHooksCalled = true;

      for (var i = 0, len = proto._initHooks.length; i < len; i++) {
        proto._initHooks[i].call(this);
      }
    };

    return NewClass;
  };


  // method for adding properties to prototype
  L.Class.include = function (props) {
    L.extend(this.prototype, props);
  };

  // merge new default options to the Class
  L.Class.mergeOptions = function (options) {
    L.extend(this.prototype.options, options);
  };

  // add a constructor hook
  L.Class.addInitHook = function (fn) { // (Function) || (String, args...)
    var args = Array.prototype.slice.call(arguments, 1);

    var init = typeof fn === 'function' ? fn : function () {
      this[fn].apply(this, args);
    };

    this.prototype._initHooks = this.prototype._initHooks || [];
    this.prototype._initHooks.push(init);
  };


  /*
   * L.Mixin.Events is used to add custom events functionality to Leaflet classes.
   */

  var eventsKey = '_leaflet_events';

  L.Mixin = {};

  L.Mixin.Events = {

    addEventListener: function (types, fn, context) { // (String, Function[, Object]) or (Object[, Object])

      // types can be a map of types/handlers
      if (L.Util.invokeEach(types, this.addEventListener, this, fn, context)) { return this; }

      var events = this[eventsKey] = this[eventsKey] || {},
          contextId = context && context !== this && L.stamp(context),
          i, len, event, type, indexKey, indexLenKey, typeIndex;

      // types can be a string of space-separated words
      types = L.Util.splitWords(types);

      for (i = 0, len = types.length; i < len; i++) {
        event = {
          action: fn,
          context: context || this
        };
        type = types[i];

        if (contextId) {
          // store listeners of a particular context in a separate hash (if it has an id)
          // gives a major performance boost when removing thousands of map layers

          indexKey = type + '_idx';
          indexLenKey = indexKey + '_len';

          typeIndex = events[indexKey] = events[indexKey] || {};

          if (!typeIndex[contextId]) {
            typeIndex[contextId] = [];

            // keep track of the number of keys in the index to quickly check if it's empty
            events[indexLenKey] = (events[indexLenKey] || 0) + 1;
          }

          typeIndex[contextId].push(event);


        } else {
          events[type] = events[type] || [];
          events[type].push(event);
        }
      }

      return this;
    },

    hasEventListeners: function (type) { // (String) -> Boolean
      var events = this[eventsKey];
      return !!events && ((type in events && events[type].length > 0) ||
                          (type + '_idx' in events && events[type + '_idx_len'] > 0));
    },

    removeEventListener: function (types, fn, context) { // ([String, Function, Object]) or (Object[, Object])

      if (!this[eventsKey]) {
        return this;
      }

      if (!types) {
        return this.clearAllEventListeners();
      }

      if (L.Util.invokeEach(types, this.removeEventListener, this, fn, context)) { return this; }

      var events = this[eventsKey],
          contextId = context && context !== this && L.stamp(context),
          i, len, type, listeners, j, indexKey, indexLenKey, typeIndex, removed;

      types = L.Util.splitWords(types);

      for (i = 0, len = types.length; i < len; i++) {
        type = types[i];
        indexKey = type + '_idx';
        indexLenKey = indexKey + '_len';

        typeIndex = events[indexKey];

        if (!fn) {
          // clear all listeners for a type if function isn't specified
          delete events[type];
          delete events[indexKey];
          delete events[indexLenKey];

        } else {
          listeners = contextId && typeIndex ? typeIndex[contextId] : events[type];

          if (listeners) {
            for (j = listeners.length - 1; j >= 0; j--) {
              if ((listeners[j].action === fn) && (!context || (listeners[j].context === context))) {
                removed = listeners.splice(j, 1);
                // set the old action to a no-op, because it is possible
                // that the listener is being iterated over as part of a dispatch
                removed[0].action = L.Util.falseFn;
              }
            }

            if (context && typeIndex && (listeners.length === 0)) {
              delete typeIndex[contextId];
              events[indexLenKey]--;
            }
          }
        }
      }

      return this;
    },

    clearAllEventListeners: function () {
      delete this[eventsKey];
      return this;
    },

    fireEvent: function (type, data) { // (String[, Object])
      if (!this.hasEventListeners(type)) {
        return this;
      }

      var event = L.Util.extend({}, data, { type: type, target: this });

      var events = this[eventsKey],
          listeners, i, len, typeIndex, contextId;

      if (events[type]) {
        // make sure adding/removing listeners inside other listeners won't cause infinite loop
        listeners = events[type].slice();

        for (i = 0, len = listeners.length; i < len; i++) {
          listeners[i].action.call(listeners[i].context, event);
        }
      }

      // fire event for the context-indexed listeners as well
      typeIndex = events[type + '_idx'];

      for (contextId in typeIndex) {
        listeners = typeIndex[contextId].slice();

        if (listeners) {
          for (i = 0, len = listeners.length; i < len; i++) {
            listeners[i].action.call(listeners[i].context, event);
          }
        }
      }

      return this;
    },

    addOneTimeEventListener: function (types, fn, context) {

      if (L.Util.invokeEach(types, this.addOneTimeEventListener, this, fn, context)) { return this; }

      var handler = L.bind(function () {
        this
            .removeEventListener(types, fn, context)
            .removeEventListener(types, handler, context);
      }, this);

      return this
          .addEventListener(types, fn, context)
          .addEventListener(types, handler, context);
    }
  };

  L.Mixin.Events.on = L.Mixin.Events.addEventListener;
  L.Mixin.Events.off = L.Mixin.Events.removeEventListener;
  L.Mixin.Events.once = L.Mixin.Events.addOneTimeEventListener;
  L.Mixin.Events.fire = L.Mixin.Events.fireEvent;


  /*
   * L.Browser handles different browser and feature detections for internal Leaflet use.
   */

  (function () {

    var ie = 'ActiveXObject' in window,
      ielt9 = ie && !document.addEventListener,

        // terrible browser detection to work around Safari / iOS / Android browser bugs
        ua = navigator.userAgent.toLowerCase(),
        webkit = ua.indexOf('webkit') !== -1,
        chrome = ua.indexOf('chrome') !== -1,
        phantomjs = ua.indexOf('phantom') !== -1,
        android = ua.indexOf('android') !== -1,
        android23 = ua.search('android [23]') !== -1,
      gecko = ua.indexOf('gecko') !== -1,

        mobile = typeof orientation !== undefined + '',
        msPointer = window.navigator && window.navigator.msPointerEnabled &&
                  window.navigator.msMaxTouchPoints && !window.PointerEvent,
      pointer = (window.PointerEvent && window.navigator.pointerEnabled && window.navigator.maxTouchPoints) ||
            msPointer,
        retina = ('devicePixelRatio' in window && window.devicePixelRatio > 1) ||
                 ('matchMedia' in window && window.matchMedia('(min-resolution:144dpi)') &&
                  window.matchMedia('(min-resolution:144dpi)').matches),

        doc = document.documentElement,
        ie3d = ie && ('transition' in doc.style),
        webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23,
        gecko3d = 'MozPerspective' in doc.style,
        opera3d = 'OTransition' in doc.style,
        any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d) && !phantomjs;


    // PhantomJS has 'ontouchstart' in document.documentElement, but doesn't actually support touch.
    // https://github.com/Leaflet/Leaflet/pull/1434#issuecomment-13843151

    var touch = !window.L_NO_TOUCH && !phantomjs && (function () {

      var startName = 'ontouchstart';

      // IE10+ (We simulate these into touch* events in L.DomEvent and L.DomEvent.Pointer) or WebKit, etc.
      if (pointer || (startName in doc)) {
        return true;
      }

      // Firefox/Gecko
      var div = document.createElement('div'),
          supported = false;

      if (!div.setAttribute) {
        return false;
      }
      div.setAttribute(startName, 'return;');

      if (typeof div[startName] === 'function') {
        supported = true;
      }

      div.removeAttribute(startName);
      div = null;

      return supported;
    }());


    L.Browser = {
      ie: ie,
      ielt9: ielt9,
      webkit: webkit,
      gecko: gecko && !webkit && !window.opera && !ie,

      android: android,
      android23: android23,

      chrome: chrome,

      ie3d: ie3d,
      webkit3d: webkit3d,
      gecko3d: gecko3d,
      opera3d: opera3d,
      any3d: any3d,

      mobile: mobile,
      mobileWebkit: mobile && webkit,
      mobileWebkit3d: mobile && webkit3d,
      mobileOpera: mobile && window.opera,

      touch: touch,
      msPointer: msPointer,
      pointer: pointer,

      retina: retina
    };

  }());


  /*
   * L.Point represents a point with x and y coordinates.
   */

  L.Point = function (/*Number*/ x, /*Number*/ y, /*Boolean*/ round) {
    this.x = (round ? Math.round(x) : x);
    this.y = (round ? Math.round(y) : y);
  };

  L.Point.prototype = {

    clone: function () {
      return new L.Point(this.x, this.y);
    },

    // non-destructive, returns a new point
    add: function (point) {
      return this.clone()._add(L.point(point));
    },

    // destructive, used directly for performance in situations where it's safe to modify existing point
    _add: function (point) {
      this.x += point.x;
      this.y += point.y;
      return this;
    },

    subtract: function (point) {
      return this.clone()._subtract(L.point(point));
    },

    _subtract: function (point) {
      this.x -= point.x;
      this.y -= point.y;
      return this;
    },

    divideBy: function (num) {
      return this.clone()._divideBy(num);
    },

    _divideBy: function (num) {
      this.x /= num;
      this.y /= num;
      return this;
    },

    multiplyBy: function (num) {
      return this.clone()._multiplyBy(num);
    },

    _multiplyBy: function (num) {
      this.x *= num;
      this.y *= num;
      return this;
    },

    round: function () {
      return this.clone()._round();
    },

    _round: function () {
      this.x = Math.round(this.x);
      this.y = Math.round(this.y);
      return this;
    },

    floor: function () {
      return this.clone()._floor();
    },

    _floor: function () {
      this.x = Math.floor(this.x);
      this.y = Math.floor(this.y);
      return this;
    },

    distanceTo: function (point) {
      point = L.point(point);

      var x = point.x - this.x,
          y = point.y - this.y;

      return Math.sqrt(x * x + y * y);
    },

    equals: function (point) {
      point = L.point(point);

      return point.x === this.x &&
             point.y === this.y;
    },

    contains: function (point) {
      point = L.point(point);

      return Math.abs(point.x) <= Math.abs(this.x) &&
             Math.abs(point.y) <= Math.abs(this.y);
    },

    toString: function () {
      return 'Point(' +
              L.Util.formatNum(this.x) + ', ' +
              L.Util.formatNum(this.y) + ')';
    }
  };

  L.point = function (x, y, round) {
    if (x instanceof L.Point) {
      return x;
    }
    if (L.Util.isArray(x)) {
      return new L.Point(x[0], x[1]);
    }
    if (x === undefined || x === null) {
      return x;
    }
    return new L.Point(x, y, round);
  };


  /*
   * L.Bounds represents a rectangular area on the screen in pixel coordinates.
   */

  L.Bounds = function (a, b) { //(Point, Point) or Point[]
    if (!a) { return; }

    var points = b ? [a, b] : a;

    for (var i = 0, len = points.length; i < len; i++) {
      this.extend(points[i]);
    }
  };

  L.Bounds.prototype = {
    // extend the bounds to contain the given point
    extend: function (point) { // (Point)
      point = L.point(point);

      if (!this.min && !this.max) {
        this.min = point.clone();
        this.max = point.clone();
      } else {
        this.min.x = Math.min(point.x, this.min.x);
        this.max.x = Math.max(point.x, this.max.x);
        this.min.y = Math.min(point.y, this.min.y);
        this.max.y = Math.max(point.y, this.max.y);
      }
      return this;
    },

    getCenter: function (round) { // (Boolean) -> Point
      return new L.Point(
              (this.min.x + this.max.x) / 2,
              (this.min.y + this.max.y) / 2, round);
    },

    getBottomLeft: function () { // -> Point
      return new L.Point(this.min.x, this.max.y);
    },

    getTopRight: function () { // -> Point
      return new L.Point(this.max.x, this.min.y);
    },

    getSize: function () {
      return this.max.subtract(this.min);
    },

    contains: function (obj) { // (Bounds) or (Point) -> Boolean
      var min, max;

      if (typeof obj[0] === 'number' || obj instanceof L.Point) {
        obj = L.point(obj);
      } else {
        obj = L.bounds(obj);
      }

      if (obj instanceof L.Bounds) {
        min = obj.min;
        max = obj.max;
      } else {
        min = max = obj;
      }

      return (min.x >= this.min.x) &&
             (max.x <= this.max.x) &&
             (min.y >= this.min.y) &&
             (max.y <= this.max.y);
    },

    intersects: function (bounds) { // (Bounds) -> Boolean
      bounds = L.bounds(bounds);

      var min = this.min,
          max = this.max,
          min2 = bounds.min,
          max2 = bounds.max,
          xIntersects = (max2.x >= min.x) && (min2.x <= max.x),
          yIntersects = (max2.y >= min.y) && (min2.y <= max.y);

      return xIntersects && yIntersects;
    },

    isValid: function () {
      return !!(this.min && this.max);
    }
  };

  L.bounds = function (a, b) { // (Bounds) or (Point, Point) or (Point[])
    if (!a || a instanceof L.Bounds) {
      return a;
    }
    return new L.Bounds(a, b);
  };


  /*
   * L.Transformation is an utility class to perform simple point transformations through a 2d-matrix.
   */

  L.Transformation = function (a, b, c, d) {
    this._a = a;
    this._b = b;
    this._c = c;
    this._d = d;
  };

  L.Transformation.prototype = {
    transform: function (point, scale) { // (Point, Number) -> Point
      return this._transform(point.clone(), scale);
    },

    // destructive transform (faster)
    _transform: function (point, scale) {
      scale = scale || 1;
      point.x = scale * (this._a * point.x + this._b);
      point.y = scale * (this._c * point.y + this._d);
      return point;
    },

    untransform: function (point, scale) {
      scale = scale || 1;
      return new L.Point(
              (point.x / scale - this._b) / this._a,
              (point.y / scale - this._d) / this._c);
    }
  };


  /*
   * L.DomUtil contains various utility functions for working with DOM.
   */

  L.DomUtil = {
    get: function (id) {
      return (typeof id === 'string' ? document.getElementById(id) : id);
    },

    getStyle: function (el, style) {

      var value = el.style[style];

      if (!value && el.currentStyle) {
        value = el.currentStyle[style];
      }

      if ((!value || value === 'auto') && document.defaultView) {
        var css = document.defaultView.getComputedStyle(el, null);
        value = css ? css[style] : null;
      }

      return value === 'auto' ? null : value;
    },

    getViewportOffset: function (element) {

      var top = 0,
          left = 0,
          el = element,
          docBody = document.body,
          docEl = document.documentElement,
          pos;

      do {
        top += el.offsetTop || 0;
        left += el.offsetLeft || 0;

        //add borders
        top += parseInt(L.DomUtil.getStyle(el, 'borderTopWidth'), 10) || 0;
        left += parseInt(L.DomUtil.getStyle(el, 'borderLeftWidth'), 10) || 0;

        pos = L.DomUtil.getStyle(el, 'position');

        if (el.offsetParent === docBody && pos === 'absolute') { break; }

        if (pos === 'fixed') {
          top += docBody.scrollTop || docEl.scrollTop || 0;
          left += docBody.scrollLeft || docEl.scrollLeft || 0;
          break;
        }

        if (pos === 'relative' && !el.offsetLeft) {
          var width = L.DomUtil.getStyle(el, 'width'),
              maxWidth = L.DomUtil.getStyle(el, 'max-width'),
              r = el.getBoundingClientRect();

          if (width !== 'none' || maxWidth !== 'none') {
            left += r.left + el.clientLeft;
          }

          //calculate full y offset since we're breaking out of the loop
          top += r.top + (docBody.scrollTop || docEl.scrollTop || 0);

          break;
        }

        el = el.offsetParent;

      } while (el);

      el = element;

      do {
        if (el === docBody) { break; }

        top -= el.scrollTop || 0;
        left -= el.scrollLeft || 0;

        el = el.parentNode;
      } while (el);

      return new L.Point(left, top);
    },

    documentIsLtr: function () {
      if (!L.DomUtil._docIsLtrCached) {
        L.DomUtil._docIsLtrCached = true;
        L.DomUtil._docIsLtr = L.DomUtil.getStyle(document.body, 'direction') === 'ltr';
      }
      return L.DomUtil._docIsLtr;
    },

    create: function (tagName, className, container) {

      var el = document.createElement(tagName);
      el.className = className;

      if (container) {
        container.appendChild(el);
      }

      return el;
    },

    hasClass: function (el, name) {
      if (el.classList !== undefined) {
        return el.classList.contains(name);
      }
      var className = L.DomUtil._getClass(el);
      return className.length > 0 && new RegExp('(^|\\s)' + name + '(\\s|$)').test(className);
    },

    addClass: function (el, name) {
      if (el.classList !== undefined) {
        var classes = L.Util.splitWords(name);
        for (var i = 0, len = classes.length; i < len; i++) {
          el.classList.add(classes[i]);
        }
      } else if (!L.DomUtil.hasClass(el, name)) {
        var className = L.DomUtil._getClass(el);
        L.DomUtil._setClass(el, (className ? className + ' ' : '') + name);
      }
    },

    removeClass: function (el, name) {
      if (el.classList !== undefined) {
        el.classList.remove(name);
      } else {
        L.DomUtil._setClass(el, L.Util.trim((' ' + L.DomUtil._getClass(el) + ' ').replace(' ' + name + ' ', ' ')));
      }
    },

    _setClass: function (el, name) {
      if (el.className.baseVal === undefined) {
        el.className = name;
      } else {
        // in case of SVG element
        el.className.baseVal = name;
      }
    },

    _getClass: function (el) {
      return el.className.baseVal === undefined ? el.className : el.className.baseVal;
    },

    setOpacity: function (el, value) {

      if ('opacity' in el.style) {
        el.style.opacity = value;

      } else if ('filter' in el.style) {

        var filter = false,
            filterName = 'DXImageTransform.Microsoft.Alpha';

        // filters collection throws an error if we try to retrieve a filter that doesn't exist
        try {
          filter = el.filters.item(filterName);
        } catch (e) {
          // don't set opacity to 1 if we haven't already set an opacity,
          // it isn't needed and breaks transparent pngs.
          if (value === 1) { return; }
        }

        value = Math.round(value * 100);

        if (filter) {
          filter.Enabled = (value !== 100);
          filter.Opacity = value;
        } else {
          el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')';
        }
      }
    },

    testProp: function (props) {

      var style = document.documentElement.style;

      for (var i = 0; i < props.length; i++) {
        if (props[i] in style) {
          return props[i];
        }
      }
      return false;
    },

    getTranslateString: function (point) {
      // on WebKit browsers (Chrome/Safari/iOS Safari/Android) using translate3d instead of translate
      // makes animation smoother as it ensures HW accel is used. Firefox 13 doesn't care
      // (same speed either way), Opera 12 doesn't support translate3d

      var is3d = L.Browser.webkit3d,
          open = 'translate' + (is3d ? '3d' : '') + '(',
          close = (is3d ? ',0' : '') + ')';

      return open + point.x + 'px,' + point.y + 'px' + close;
    },

    getScaleString: function (scale, origin) {

      var preTranslateStr = L.DomUtil.getTranslateString(origin.add(origin.multiplyBy(-1 * scale))),
          scaleStr = ' scale(' + scale + ') ';

      return preTranslateStr + scaleStr;
    },

    setPosition: function (el, point, disable3D) { // (HTMLElement, Point[, Boolean])

      // jshint camelcase: false
      el._leaflet_pos = point;

      if (!disable3D && L.Browser.any3d) {
        el.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString(point);
      } else {
        el.style.left = point.x + 'px';
        el.style.top = point.y + 'px';
      }
    },

    getPosition: function (el) {
      // this method is only used for elements previously positioned using setPosition,
      // so it's safe to cache the position for performance

      // jshint camelcase: false
      return el._leaflet_pos;
    }
  };


  // prefix style property names

  L.DomUtil.TRANSFORM = L.DomUtil.testProp(
          ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform']);

  // webkitTransition comes first because some browser versions that drop vendor prefix don't do
  // the same for the transitionend event, in particular the Android 4.1 stock browser

  L.DomUtil.TRANSITION = L.DomUtil.testProp(
          ['webkitTransition', 'transition', 'OTransition', 'MozTransition', 'msTransition']);

  L.DomUtil.TRANSITION_END =
          L.DomUtil.TRANSITION === 'webkitTransition' || L.DomUtil.TRANSITION === 'OTransition' ?
          L.DomUtil.TRANSITION + 'End' : 'transitionend';

  (function () {
    if ('onselectstart' in document) {
      L.extend(L.DomUtil, {
        disableTextSelection: function () {
          L.DomEvent.on(window, 'selectstart', L.DomEvent.preventDefault);
        },

        enableTextSelection: function () {
          L.DomEvent.off(window, 'selectstart', L.DomEvent.preventDefault);
        }
      });
    } else {
      var userSelectProperty = L.DomUtil.testProp(
          ['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']);

      L.extend(L.DomUtil, {
        disableTextSelection: function () {
          if (userSelectProperty) {
            var style = document.documentElement.style;
            this._userSelect = style[userSelectProperty];
            style[userSelectProperty] = 'none';
          }
        },

        enableTextSelection: function () {
          if (userSelectProperty) {
            document.documentElement.style[userSelectProperty] = this._userSelect;
            delete this._userSelect;
          }
        }
      });
    }

    L.extend(L.DomUtil, {
      disableImageDrag: function () {
        L.DomEvent.on(window, 'dragstart', L.DomEvent.preventDefault);
      },

      enableImageDrag: function () {
        L.DomEvent.off(window, 'dragstart', L.DomEvent.preventDefault);
      }
    });
  })();


  /*
   * L.LatLng represents a geographical point with latitude and longitude coordinates.
   */

  L.LatLng = function (lat, lng, alt) { // (Number, Number, Number)
    lat = parseFloat(lat);
    lng = parseFloat(lng);

    if (isNaN(lat) || isNaN(lng)) {
      throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')');
    }

    this.lat = lat;
    this.lng = lng;

    if (alt !== undefined) {
      this.alt = parseFloat(alt);
    }
  };

  L.extend(L.LatLng, {
    DEG_TO_RAD: Math.PI / 180,
    RAD_TO_DEG: 180 / Math.PI,
    MAX_MARGIN: 1.0E-9 // max margin of error for the "equals" check
  });

  L.LatLng.prototype = {
    equals: function (obj) { // (LatLng) -> Boolean
      if (!obj) { return false; }

      obj = L.latLng(obj);

      var margin = Math.max(
              Math.abs(this.lat - obj.lat),
              Math.abs(this.lng - obj.lng));

      return margin <= L.LatLng.MAX_MARGIN;
    },

    toString: function (precision) { // (Number) -> String
      return 'LatLng(' +
              L.Util.formatNum(this.lat, precision) + ', ' +
              L.Util.formatNum(this.lng, precision) + ')';
    },

    // Haversine distance formula, see http://en.wikipedia.org/wiki/Haversine_formula
    // TODO move to projection code, LatLng shouldn't know about Earth
    distanceTo: function (other) { // (LatLng) -> Number
      other = L.latLng(other);

      var R = 6378137, // earth radius in meters
          d2r = L.LatLng.DEG_TO_RAD,
          dLat = (other.lat - this.lat) * d2r,
          dLon = (other.lng - this.lng) * d2r,
          lat1 = this.lat * d2r,
          lat2 = other.lat * d2r,
          sin1 = Math.sin(dLat / 2),
          sin2 = Math.sin(dLon / 2);

      var a = sin1 * sin1 + sin2 * sin2 * Math.cos(lat1) * Math.cos(lat2);

      return R * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
    },

    wrap: function (a, b) { // (Number, Number) -> LatLng
      var lng = this.lng;

      a = a || -180;
      b = b || 180;

      lng = (lng + b) % (b - a) + (lng < a || lng === b ? b : a);

      return new L.LatLng(this.lat, lng);
    }
  };

  L.latLng = function (a, b) { // (LatLng) or ([Number, Number]) or (Number, Number)
    if (a instanceof L.LatLng) {
      return a;
    }
    if (L.Util.isArray(a)) {
      if (typeof a[0] === 'number' || typeof a[0] === 'string') {
        return new L.LatLng(a[0], a[1], a[2]);
      } else {
        return null;
      }
    }
    if (a === undefined || a === null) {
      return a;
    }
    if (typeof a === 'object' && 'lat' in a) {
      return new L.LatLng(a.lat, 'lng' in a ? a.lng : a.lon);
    }
    if (b === undefined) {
      return null;
    }
    return new L.LatLng(a, b);
  };



  /*
   * L.LatLngBounds represents a rectangular area on the map in geographical coordinates.
   */

  L.LatLngBounds = function (southWest, northEast) { // (LatLng, LatLng) or (LatLng[])
    if (!southWest) { return; }

    var latlngs = northEast ? [southWest, northEast] : southWest;

    for (var i = 0, len = latlngs.length; i < len; i++) {
      this.extend(latlngs[i]);
    }
  };

  L.LatLngBounds.prototype = {
    // extend the bounds to contain the given point or bounds
    extend: function (obj) { // (LatLng) or (LatLngBounds)
      if (!obj) { return this; }

      var latLng = L.latLng(obj);
      if (latLng !== null) {
        obj = latLng;
      } else {
        obj = L.latLngBounds(obj);
      }

      if (obj instanceof L.LatLng) {
        if (!this._southWest && !this._northEast) {
          this._southWest = new L.LatLng(obj.lat, obj.lng);
          this._northEast = new L.LatLng(obj.lat, obj.lng);
        } else {
          this._southWest.lat = Math.min(obj.lat, this._southWest.lat);
          this._southWest.lng = Math.min(obj.lng, this._southWest.lng);

          this._northEast.lat = Math.max(obj.lat, this._northEast.lat);
          this._northEast.lng = Math.max(obj.lng, this._northEast.lng);
        }
      } else if (obj instanceof L.LatLngBounds) {
        this.extend(obj._southWest);
        this.extend(obj._northEast);
      }
      return this;
    },

    // extend the bounds by a percentage
    pad: function (bufferRatio) { // (Number) -> LatLngBounds
      var sw = this._southWest,
          ne = this._northEast,
          heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio,
          widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio;

      return new L.LatLngBounds(
              new L.LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer),
              new L.LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer));
    },

    getCenter: function () { // -> LatLng
      return new L.LatLng(
              (this._southWest.lat + this._northEast.lat) / 2,
              (this._southWest.lng + this._northEast.lng) / 2);
    },

    getSouthWest: function () {
      return this._southWest;
    },

    getNorthEast: function () {
      return this._northEast;
    },

    getNorthWest: function () {
      return new L.LatLng(this.getNorth(), this.getWest());
    },

    getSouthEast: function () {
      return new L.LatLng(this.getSouth(), this.getEast());
    },

    getWest: function () {
      return this._southWest.lng;
    },

    getSouth: function () {
      return this._southWest.lat;
    },

    getEast: function () {
      return this._northEast.lng;
    },

    getNorth: function () {
      return this._northEast.lat;
    },

    contains: function (obj) { // (LatLngBounds) or (LatLng) -> Boolean
      if (typeof obj[0] === 'number' || obj instanceof L.LatLng) {
        obj = L.latLng(obj);
      } else {
        obj = L.latLngBounds(obj);
      }

      var sw = this._southWest,
          ne = this._northEast,
          sw2, ne2;

      if (obj instanceof L.LatLngBounds) {
        sw2 = obj.getSouthWest();
        ne2 = obj.getNorthEast();
      } else {
        sw2 = ne2 = obj;
      }

      return (sw2.lat >= sw.lat) && (ne2.lat <= ne.lat) &&
             (sw2.lng >= sw.lng) && (ne2.lng <= ne.lng);
    },

    intersects: function (bounds) { // (LatLngBounds)
      bounds = L.latLngBounds(bounds);

      var sw = this._southWest,
          ne = this._northEast,
          sw2 = bounds.getSouthWest(),
          ne2 = bounds.getNorthEast(),

          latIntersects = (ne2.lat >= sw.lat) && (sw2.lat <= ne.lat),
          lngIntersects = (ne2.lng >= sw.lng) && (sw2.lng <= ne.lng);

      return latIntersects && lngIntersects;
    },

    toBBoxString: function () {
      return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(',');
    },

    equals: function (bounds) { // (LatLngBounds)
      if (!bounds) { return false; }

      bounds = L.latLngBounds(bounds);

      return this._southWest.equals(bounds.getSouthWest()) &&
             this._northEast.equals(bounds.getNorthEast());
    },

    isValid: function () {
      return !!(this._southWest && this._northEast);
    }
  };

  //TODO International date line?

  L.latLngBounds = function (a, b) { // (LatLngBounds) or (LatLng, LatLng)
    if (!a || a instanceof L.LatLngBounds) {
      return a;
    }
    return new L.LatLngBounds(a, b);
  };


  /*
   * L.Projection contains various geographical projections used by CRS classes.
   */

  L.Projection = {};


  /*
   * Spherical Mercator is the most popular map projection, used by EPSG:3857 CRS used by default.
   */

  L.Projection.SphericalMercator = {
    MAX_LATITUDE: 85.0511287798,

    project: function (latlng) { // (LatLng) -> Point
      var d = L.LatLng.DEG_TO_RAD,
          max = this.MAX_LATITUDE,
          lat = Math.max(Math.min(max, latlng.lat), -max),
          x = latlng.lng * d,
          y = lat * d;

      y = Math.log(Math.tan((Math.PI / 4) + (y / 2)));

      return new L.Point(x, y);
    },

    unproject: function (point) { // (Point, Boolean) -> LatLng
      var d = L.LatLng.RAD_TO_DEG,
          lng = point.x * d,
          lat = (2 * Math.atan(Math.exp(point.y)) - (Math.PI / 2)) * d;

      return new L.LatLng(lat, lng);
    }
  };


  /*
   * Simple equirectangular (Plate Carree) projection, used by CRS like EPSG:4326 and Simple.
   */

  L.Projection.LonLat = {
    project: function (latlng) {
      return new L.Point(latlng.lng, latlng.lat);
    },

    unproject: function (point) {
      return new L.LatLng(point.y, point.x);
    }
  };


  /*
   * L.CRS is a base object for all defined CRS (Coordinate Reference Systems) in Leaflet.
   */

  L.CRS = {
    latLngToPoint: function (latlng, zoom) { // (LatLng, Number) -> Point
      var projectedPoint = this.projection.project(latlng),
          scale = this.scale(zoom);

      return this.transformation._transform(projectedPoint, scale);
    },

    pointToLatLng: function (point, zoom) { // (Point, Number[, Boolean]) -> LatLng
      var scale = this.scale(zoom),
          untransformedPoint = this.transformation.untransform(point, scale);

      return this.projection.unproject(untransformedPoint);
    },

    project: function (latlng) {
      return this.projection.project(latlng);
    },

    scale: function (zoom) {
      return 256 * Math.pow(2, zoom);
    },

    getSize: function (zoom) {
      var s = this.scale(zoom);
      return L.point(s, s);
    }
  };


  /*
   * A simple CRS that can be used for flat non-Earth maps like panoramas or game maps.
   */

  L.CRS.Simple = L.extend({}, L.CRS, {
    projection: L.Projection.LonLat,
    transformation: new L.Transformation(1, 0, -1, 0),

    scale: function (zoom) {
      return Math.pow(2, zoom);
    }
  });


  /*
   * L.CRS.EPSG3857 (Spherical Mercator) is the most common CRS for web mapping
   * and is used by Leaflet by default.
   */

  L.CRS.EPSG3857 = L.extend({}, L.CRS, {
    code: 'EPSG:3857',

    projection: L.Projection.SphericalMercator,
    transformation: new L.Transformation(0.5 / Math.PI, 0.5, -0.5 / Math.PI, 0.5),

    project: function (latlng) { // (LatLng) -> Point
      var projectedPoint = this.projection.project(latlng),
          earthRadius = 6378137;
      return projectedPoint.multiplyBy(earthRadius);
    }
  });

  L.CRS.EPSG900913 = L.extend({}, L.CRS.EPSG3857, {
    code: 'EPSG:900913'
  });


  /*
   * L.CRS.EPSG4326 is a CRS popular among advanced GIS specialists.
   */

  L.CRS.EPSG4326 = L.extend({}, L.CRS, {
    code: 'EPSG:4326',

    projection: L.Projection.LonLat,
    transformation: new L.Transformation(1 / 360, 0.5, -1 / 360, 0.5)
  });


  /*
   * L.Map is the central class of the API - it is used to create a map.
   */

  L.Map = L.Class.extend({

    includes: L.Mixin.Events,

    options: {
      crs: L.CRS.EPSG3857,

      /*
      center: LatLng,
      zoom: Number,
      layers: Array,
      */

      fadeAnimation: L.DomUtil.TRANSITION && !L.Browser.android23,
      trackResize: true,
      markerZoomAnimation: L.DomUtil.TRANSITION && L.Browser.any3d
    },

    initialize: function (id, options) { // (HTMLElement or String, Object)
      options = L.setOptions(this, options);


      this._initContainer(id);
      this._initLayout();

      // hack for https://github.com/Leaflet/Leaflet/issues/1980
      this._onResize = L.bind(this._onResize, this);

      this._initEvents();

      if (options.maxBounds) {
        this.setMaxBounds(options.maxBounds);
      }

      if (options.center && options.zoom !== undefined) {
        this.setView(L.latLng(options.center), options.zoom, { reset: true });
      }

      this._handlers = [];

      this._layers = {};
      this._zoomBoundLayers = {};
      this._tileLayersNum = 0;

      this.callInitHooks();

      this._addLayers(options.layers);
    },


    // public methods that modify map state

    // replaced by animation-powered implementation in Map.PanAnimation.js
    setView: function (center, zoom) {
      zoom = zoom === undefined ? this.getZoom() : zoom;
      this._resetView(L.latLng(center), this._limitZoom(zoom));
      return this;
    },

    setZoom: function (zoom, options) {
      if (!this._loaded) {
        this._zoom = this._limitZoom(zoom);
        return this;
      }
      return this.setView(this.getCenter(), zoom, { zoom: options });
    },

    zoomIn: function (delta, options) {
      return this.setZoom(this._zoom + (delta || 1), options);
    },

    zoomOut: function (delta, options) {
      return this.setZoom(this._zoom - (delta || 1), options);
    },

    setZoomAround: function (latlng, zoom, options) {
      var scale = this.getZoomScale(zoom),
          viewHalf = this.getSize().divideBy(2),
          containerPoint = latlng instanceof L.Point ? latlng : this.latLngToContainerPoint(latlng),

          centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale),
          newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));

      return this.setView(newCenter, zoom, { zoom: options });
    },

    fitBounds: function (bounds, options) {

      options = options || {};
      bounds = bounds.getBounds ? bounds.getBounds() : L.latLngBounds(bounds);

      var paddingTL = L.point(options.paddingTopLeft || options.padding || [0, 0]),
          paddingBR = L.point(options.paddingBottomRight || options.padding || [0, 0]),

          zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR)),
          paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),

          swPoint = this.project(bounds.getSouthWest(), zoom),
          nePoint = this.project(bounds.getNorthEast(), zoom),
          center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);

      zoom = options && options.maxZoom ? Math.min(options.maxZoom, zoom) : zoom;

      return this.setView(center, zoom, options);
    },

    fitWorld: function (options) {
      return this.fitBounds([[-90, -180], [90, 180]], options);
    },

    panTo: function (center, options) { // (LatLng)
      return this.setView(center, this._zoom, { pan: options });
    },

    panBy: function (offset) { // (Point)
      // replaced with animated panBy in Map.PanAnimation.js
      this.fire('movestart');

      this._rawPanBy(L.point(offset));

      this.fire('move');
      return this.fire('moveend');
    },

    setMaxBounds: function (bounds) {
      bounds = L.latLngBounds(bounds);

      this.options.maxBounds = bounds;

      if (!bounds) {
        return this.off('moveend', this._panInsideMaxBounds, this);
      }

      if (this._loaded) {
        this._panInsideMaxBounds();
      }

      return this.on('moveend', this._panInsideMaxBounds, this);
    },

    panInsideBounds: function (bounds, options) {
      var center = this.getCenter(),
        newCenter = this._limitCenter(center, this._zoom, bounds);

      if (center.equals(newCenter)) { return this; }

      return this.panTo(newCenter, options);
    },

    addLayer: function (layer) {
      // TODO method is too big, refactor

      var id = L.stamp(layer);

      if (this._layers[id]) { return this; }

      this._layers[id] = layer;

      // TODO getMaxZoom, getMinZoom in ILayer (instead of options)
      if (layer.options && (!isNaN(layer.options.maxZoom) || !isNaN(layer.options.minZoom))) {
        this._zoomBoundLayers[id] = layer;
        this._updateZoomLevels();
      }

      // TODO looks ugly, refactor!!!
      if (this.options.zoomAnimation && L.TileLayer && (layer instanceof L.TileLayer)) {
        this._tileLayersNum++;
        this._tileLayersToLoad++;
        layer.on('load', this._onTileLayerLoad, this);
      }

      if (this._loaded) {
        this._layerAdd(layer);
      }

      return this;
    },

    removeLayer: function (layer) {
      var id = L.stamp(layer);

      if (!this._layers[id]) { return this; }

      if (this._loaded) {
        layer.onRemove(this);
      }

      delete this._layers[id];

      if (this._loaded) {
        this.fire('layerremove', { layer: layer });
      }

      if (this._zoomBoundLayers[id]) {
        delete this._zoomBoundLayers[id];
        this._updateZoomLevels();
      }

      // TODO looks ugly, refactor
      if (this.options.zoomAnimation && L.TileLayer && (layer instanceof L.TileLayer)) {
        this._tileLayersNum--;
        this._tileLayersToLoad--;
        layer.off('load', this._onTileLayerLoad, this);
      }

      return this;
    },

    hasLayer: function (layer) {
      if (!layer) { return false; }

      return (L.stamp(layer) in this._layers);
    },

    eachLayer: function (method, context) {
      for (var i in this._layers) {
        method.call(context, this._layers[i]);
      }
      return this;
    },

    invalidateSize: function (options) {
      if (!this._loaded) { return this; }

      options = L.extend({
        animate: false,
        pan: true
      }, options === true ? { animate: true } : options);

      var oldSize = this.getSize();
      this._sizeChanged = true;
      this._initialCenter = null;

      var newSize = this.getSize(),
          oldCenter = oldSize.divideBy(2).round(),
          newCenter = newSize.divideBy(2).round(),
          offset = oldCenter.subtract(newCenter);

      if (!offset.x && !offset.y) { return this; }

      if (options.animate && options.pan) {
        this.panBy(offset);

      } else {
        if (options.pan) {
          this._rawPanBy(offset);
        }

        this.fire('move');

        if (options.debounceMoveend) {
          clearTimeout(this._sizeTimer);
          this._sizeTimer = setTimeout(L.bind(this.fire, this, 'moveend'), 200);
        } else {
          this.fire('moveend');
        }
      }

      return this.fire('resize', {
        oldSize: oldSize,
        newSize: newSize
      });
    },

    // TODO handler.addTo
    addHandler: function (name, HandlerClass) {
      if (!HandlerClass) { return this; }

      var handler = this[name] = new HandlerClass(this);

      this._handlers.push(handler);

      if (this.options[name]) {
        handler.enable();
      }

      return this;
    },

    remove: function () {
      if (this._loaded) {
        this.fire('unload');
      }

      this._initEvents('off');

      try {
        // throws error in IE6-8
        delete this._container._leaflet;
      } catch (e) {
        this._container._leaflet = undefined;
      }

      this._clearPanes();
      if (this._clearControlPos) {
        this._clearControlPos();
      }

      this._clearHandlers();

      return this;
    },


    // public methods for getting map state

    getCenter: function () { // (Boolean) -> LatLng
      this._checkIfLoaded();

      if (this._initialCenter && !this._moved()) {
        return this._initialCenter;
      }
      return this.layerPointToLatLng(this._getCenterLayerPoint());
    },

    getZoom: function () {
      return this._zoom;
    },

    getBounds: function () {
      var bounds = this.getPixelBounds(),
          sw = this.unproject(bounds.getBottomLeft()),
          ne = this.unproject(bounds.getTopRight());

      return new L.LatLngBounds(sw, ne);
    },

    getMinZoom: function () {
      return this.options.minZoom === undefined ?
        (this._layersMinZoom === undefined ? 0 : this._layersMinZoom) :
        this.options.minZoom;
    },

    getMaxZoom: function () {
      return this.options.maxZoom === undefined ?
        (this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom) :
        this.options.maxZoom;
    },

    getBoundsZoom: function (bounds, inside, padding) { // (LatLngBounds[, Boolean, Point]) -> Number
      bounds = L.latLngBounds(bounds);

      var zoom = this.getMinZoom() - (inside ? 1 : 0),
          maxZoom = this.getMaxZoom(),
          size = this.getSize(),

          nw = bounds.getNorthWest(),
          se = bounds.getSouthEast(),

          zoomNotFound = true,
          boundsSize;

      padding = L.point(padding || [0, 0]);

      do {
        zoom++;
        boundsSize = this.project(se, zoom).subtract(this.project(nw, zoom)).add(padding);
        zoomNotFound = !inside ? size.contains(boundsSize) : boundsSize.x < size.x || boundsSize.y < size.y;

      } while (zoomNotFound && zoom <= maxZoom);

      if (zoomNotFound && inside) {
        return null;
      }

      return inside ? zoom : zoom - 1;
    },

    getSize: function () {
      if (!this._size || this._sizeChanged) {
        this._size = new L.Point(
          this._container.clientWidth,
          this._container.clientHeight);

        this._sizeChanged = false;
      }
      return this._size.clone();
    },

    getPixelBounds: function () {
      var topLeftPoint = this._getTopLeftPoint();
      return new L.Bounds(topLeftPoint, topLeftPoint.add(this.getSize()));
    },

    getPixelOrigin: function () {
      this._checkIfLoaded();
      return this._initialTopLeftPoint;
    },

    getPanes: function () {
      return this._panes;
    },

    getContainer: function () {
      return this._container;
    },


    // TODO replace with universal implementation after refactoring projections

    getZoomScale: function (toZoom) {
      var crs = this.options.crs;
      return crs.scale(toZoom) / crs.scale(this._zoom);
    },

    getScaleZoom: function (scale) {
      return this._zoom + (Math.log(scale) / Math.LN2);
    },


    // conversion methods

    project: function (latlng, zoom) { // (LatLng[, Number]) -> Point
      zoom = zoom === undefined ? this._zoom : zoom;
      return this.options.crs.latLngToPoint(L.latLng(latlng), zoom);
    },

    unproject: function (point, zoom) { // (Point[, Number]) -> LatLng
      zoom = zoom === undefined ? this._zoom : zoom;
      return this.options.crs.pointToLatLng(L.point(point), zoom);
    },

    layerPointToLatLng: function (point) { // (Point)
      var projectedPoint = L.point(point).add(this.getPixelOrigin());
      return this.unproject(projectedPoint);
    },

    latLngToLayerPoint: function (latlng) { // (LatLng)
      var projectedPoint = this.project(L.latLng(latlng))._round();
      return projectedPoint._subtract(this.getPixelOrigin());
    },

    containerPointToLayerPoint: function (point) { // (Point)
      return L.point(point).subtract(this._getMapPanePos());
    },

    layerPointToContainerPoint: function (point) { // (Point)
      return L.point(point).add(this._getMapPanePos());
    },

    containerPointToLatLng: function (point) {
      var layerPoint = this.containerPointToLayerPoint(L.point(point));
      return this.layerPointToLatLng(layerPoint);
    },

    latLngToContainerPoint: function (latlng) {
      return this.layerPointToContainerPoint(this.latLngToLayerPoint(L.latLng(latlng)));
    },

    mouseEventToContainerPoint: function (e) { // (MouseEvent)
      return L.DomEvent.getMousePosition(e, this._container);
    },

    mouseEventToLayerPoint: function (e) { // (MouseEvent)
      return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e));
    },

    mouseEventToLatLng: function (e) { // (MouseEvent)
      return this.layerPointToLatLng(this.mouseEventToLayerPoint(e));
    },


    // map initialization methods

    _initContainer: function (id) {
      var container = this._container = L.DomUtil.get(id);

      if (!container) {
        throw new Error('Map container not found.');
      } else if (container._leaflet) {
        throw new Error('Map container is already initialized.');
      }

      container._leaflet = true;
    },

    _initLayout: function () {
      var container = this._container;

      L.DomUtil.addClass(container, 'leaflet-container' +
        (L.Browser.touch ? ' leaflet-touch' : '') +
        (L.Browser.retina ? ' leaflet-retina' : '') +
        (L.Browser.ielt9 ? ' leaflet-oldie' : '') +
        (this.options.fadeAnimation ? ' leaflet-fade-anim' : ''));

      var position = L.DomUtil.getStyle(container, 'position');

      if (position !== 'absolute' && position !== 'relative' && position !== 'fixed') {
        container.style.position = 'relative';
      }

      this._initPanes();

      if (this._initControlPos) {
        this._initControlPos();
      }
    },

    _initPanes: function () {
      var panes = this._panes = {};

      this._mapPane = panes.mapPane = this._createPane('leaflet-map-pane', this._container);

      this._tilePane = panes.tilePane = this._createPane('leaflet-tile-pane', this._mapPane);
      panes.objectsPane = this._createPane('leaflet-objects-pane', this._mapPane);
      panes.shadowPane = this._createPane('leaflet-shadow-pane');
      panes.overlayPane = this._createPane('leaflet-overlay-pane');
      panes.markerPane = this._createPane('leaflet-marker-pane');
      panes.popupPane = this._createPane('leaflet-popup-pane');

      var zoomHide = ' leaflet-zoom-hide';

      if (!this.options.markerZoomAnimation) {
        L.DomUtil.addClass(panes.markerPane, zoomHide);
        L.DomUtil.addClass(panes.shadowPane, zoomHide);
        L.DomUtil.addClass(panes.popupPane, zoomHide);
      }
    },

    _createPane: function (className, container) {
      return L.DomUtil.create('div', className, container || this._panes.objectsPane);
    },

    _clearPanes: function () {
      this._container.removeChild(this._mapPane);
    },

    _addLayers: function (layers) {
      layers = layers ? (L.Util.isArray(layers) ? layers : [layers]) : [];

      for (var i = 0, len = layers.length; i < len; i++) {
        this.addLayer(layers[i]);
      }
    },


    // private methods that modify map state

    _resetView: function (center, zoom, preserveMapOffset, afterZoomAnim) {

      var zoomChanged = (this._zoom !== zoom);

      if (!afterZoomAnim) {
        this.fire('movestart');

        if (zoomChanged) {
          this.fire('zoomstart');
        }
      }

      this._zoom = zoom;
      this._initialCenter = center;

      this._initialTopLeftPoint = this._getNewTopLeftPoint(center);

      if (!preserveMapOffset) {
        L.DomUtil.setPosition(this._mapPane, new L.Point(0, 0));
      } else {
        this._initialTopLeftPoint._add(this._getMapPanePos());
      }

      this._tileLayersToLoad = this._tileLayersNum;

      var loading = !this._loaded;
      this._loaded = true;

      this.fire('viewreset', { hard: !preserveMapOffset });

      if (loading) {
        this.fire('load');
        this.eachLayer(this._layerAdd, this);
      }

      this.fire('move');

      if (zoomChanged || afterZoomAnim) {
        this.fire('zoomend');
      }

      this.fire('moveend', { hard: !preserveMapOffset });
    },

    _rawPanBy: function (offset) {
      L.DomUtil.setPosition(this._mapPane, this._getMapPanePos().subtract(offset));
    },

    _getZoomSpan: function () {
      return this.getMaxZoom() - this.getMinZoom();
    },

    _updateZoomLevels: function () {
      var i,
        minZoom = Infinity,
        maxZoom = -Infinity,
        oldZoomSpan = this._getZoomSpan();

      for (i in this._zoomBoundLayers) {
        var layer = this._zoomBoundLayers[i];
        if (!isNaN(layer.options.minZoom)) {
          minZoom = Math.min(minZoom, layer.options.minZoom);
        }
        if (!isNaN(layer.options.maxZoom)) {
          maxZoom = Math.max(maxZoom, layer.options.maxZoom);
        }
      }

      if (i === undefined) { // we have no tilelayers
        this._layersMaxZoom = this._layersMinZoom = undefined;
      } else {
        this._layersMaxZoom = maxZoom;
        this._layersMinZoom = minZoom;
      }

      if (oldZoomSpan !== this._getZoomSpan()) {
        this.fire('zoomlevelschange');
      }
    },

    _panInsideMaxBounds: function () {
      this.panInsideBounds(this.options.maxBounds);
    },

    _checkIfLoaded: function () {
      if (!this._loaded) {
        throw new Error('Set map center and zoom first.');
      }
    },

    // map events

    _initEvents: function (onOff) {
      if (!L.DomEvent) { return; }

      onOff = onOff || 'on';

      L.DomEvent[onOff](this._container, 'click', this._onMouseClick, this);

      var events = ['dblclick', 'mousedown', 'mouseup', 'mouseenter',
                    'mouseleave', 'mousemove', 'contextmenu'],
          i, len;

      for (i = 0, len = events.length; i < len; i++) {
        L.DomEvent[onOff](this._container, events[i], this._fireMouseEvent, this);
      }

      if (this.options.trackResize) {
        L.DomEvent[onOff](window, 'resize', this._onResize, this);
      }
    },

    _onResize: function () {
      L.Util.cancelAnimFrame(this._resizeRequest);
      this._resizeRequest = L.Util.requestAnimFrame(
              function () { this.invalidateSize({ debounceMoveend: true }); }, this, false, this._container);
    },

    _onMouseClick: function (e) {
      if (!this._loaded || (!e._simulated &&
              ((this.dragging && this.dragging.moved()) ||
               (this.boxZoom && this.boxZoom.moved()))) ||
                  L.DomEvent._skipped(e)) { return; }

      this.fire('preclick');
      this._fireMouseEvent(e);
    },

    _fireMouseEvent: function (e) {
      if (!this._loaded || L.DomEvent._skipped(e)) { return; }

      var type = e.type;

      type = (type === 'mouseenter' ? 'mouseover' : (type === 'mouseleave' ? 'mouseout' : type));

      if (!this.hasEventListeners(type)) { return; }

      if (type === 'contextmenu') {
        L.DomEvent.preventDefault(e);
      }

      var containerPoint = this.mouseEventToContainerPoint(e),
          layerPoint = this.containerPointToLayerPoint(containerPoint),
          latlng = this.layerPointToLatLng(layerPoint);

      this.fire(type, {
        latlng: latlng,
        layerPoint: layerPoint,
        containerPoint: containerPoint,
        originalEvent: e
      });
    },

    _onTileLayerLoad: function () {
      this._tileLayersToLoad--;
      if (this._tileLayersNum && !this._tileLayersToLoad) {
        this.fire('tilelayersload');
      }
    },

    _clearHandlers: function () {
      for (var i = 0, len = this._handlers.length; i < len; i++) {
        this._handlers[i].disable();
      }
    },

    whenReady: function (callback, context) {
      if (this._loaded) {
        callback.call(context || this, this);
      } else {
        this.on('load', callback, context);
      }
      return this;
    },

    _layerAdd: function (layer) {
      layer.onAdd(this);
      this.fire('layeradd', { layer: layer });
    },


    // private methods for getting map state

    _getMapPanePos: function () {
      return L.DomUtil.getPosition(this._mapPane);
    },

    _moved: function () {
      var pos = this._getMapPanePos();
      return pos && !pos.equals([0, 0]);
    },

    _getTopLeftPoint: function () {
      return this.getPixelOrigin().subtract(this._getMapPanePos());
    },

    _getNewTopLeftPoint: function (center, zoom) {
      var viewHalf = this.getSize()._divideBy(2);
      // TODO round on display, not calculation to increase precision?
      return this.project(center, zoom)._subtract(viewHalf)._round();
    },

    _latLngToNewLayerPoint: function (latlng, newZoom, newCenter) {
      var topLeft = this._getNewTopLeftPoint(newCenter, newZoom).add(this._getMapPanePos());
      return this.project(latlng, newZoom)._subtract(topLeft);
    },

    // layer point of the current center
    _getCenterLayerPoint: function () {
      return this.containerPointToLayerPoint(this.getSize()._divideBy(2));
    },

    // offset of the specified place to the current center in pixels
    _getCenterOffset: function (latlng) {
      return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint());
    },

    // adjust center for view to get inside bounds
    _limitCenter: function (center, zoom, bounds) {

      if (!bounds) { return center; }

      var centerPoint = this.project(center, zoom),
          viewHalf = this.getSize().divideBy(2),
          viewBounds = new L.Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)),
          offset = this._getBoundsOffset(viewBounds, bounds, zoom);

      return this.unproject(centerPoint.add(offset), zoom);
    },

    // adjust offset for view to get inside bounds
    _limitOffset: function (offset, bounds) {
      if (!bounds) { return offset; }

      var viewBounds = this.getPixelBounds(),
          newBounds = new L.Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset));

      return offset.add(this._getBoundsOffset(newBounds, bounds));
    },

    // returns offset needed for pxBounds to get inside maxBounds at a specified zoom
    _getBoundsOffset: function (pxBounds, maxBounds, zoom) {
      var nwOffset = this.project(maxBounds.getNorthWest(), zoom).subtract(pxBounds.min),
          seOffset = this.project(maxBounds.getSouthEast(), zoom).subtract(pxBounds.max),

          dx = this._rebound(nwOffset.x, -seOffset.x),
          dy = this._rebound(nwOffset.y, -seOffset.y);

      return new L.Point(dx, dy);
    },

    _rebound: function (left, right) {
      return left + right > 0 ?
        Math.round(left - right) / 2 :
        Math.max(0, Math.ceil(left)) - Math.max(0, Math.floor(right));
    },

    _limitZoom: function (zoom) {
      var min = this.getMinZoom(),
          max = this.getMaxZoom();

      return Math.max(min, Math.min(max, zoom));
    }
  });

  L.map = function (id, options) {
    return new L.Map(id, options);
  };


  /*
   * Mercator projection that takes into account that the Earth is not a perfect sphere.
   * Less popular than spherical mercator; used by projections like EPSG:3395.
   */

  L.Projection.Mercator = {
    MAX_LATITUDE: 85.0840591556,

    R_MINOR: 6356752.314245179,
    R_MAJOR: 6378137,

    project: function (latlng) { // (LatLng) -> Point
      var d = L.LatLng.DEG_TO_RAD,
          max = this.MAX_LATITUDE,
          lat = Math.max(Math.min(max, latlng.lat), -max),
          r = this.R_MAJOR,
          r2 = this.R_MINOR,
          x = latlng.lng * d * r,
          y = lat * d,
          tmp = r2 / r,
          eccent = Math.sqrt(1.0 - tmp * tmp),
          con = eccent * Math.sin(y);

      con = Math.pow((1 - con) / (1 + con), eccent * 0.5);

      var ts = Math.tan(0.5 * ((Math.PI * 0.5) - y)) / con;
      y = -r * Math.log(ts);

      return new L.Point(x, y);
    },

    unproject: function (point) { // (Point, Boolean) -> LatLng
      var d = L.LatLng.RAD_TO_DEG,
          r = this.R_MAJOR,
          r2 = this.R_MINOR,
          lng = point.x * d / r,
          tmp = r2 / r,
          eccent = Math.sqrt(1 - (tmp * tmp)),
          ts = Math.exp(-point.y / r),
          phi = (Math.PI / 2) - 2 * Math.atan(ts),
          numIter = 15,
          tol = 1e-7,
          i = numIter,
          dphi = 0.1,
          con;

      while ((Math.abs(dphi) > tol) && (--i > 0)) {
        con = eccent * Math.sin(phi);
        dphi = (Math.PI / 2) - 2 * Math.atan(ts *
                    Math.pow((1.0 - con) / (1.0 + con), 0.5 * eccent)) - phi;
        phi += dphi;
      }

      return new L.LatLng(phi * d, lng);
    }
  };



  L.CRS.EPSG3395 = L.extend({}, L.CRS, {
    code: 'EPSG:3395',

    projection: L.Projection.Mercator,

    transformation: (function () {
      var m = L.Projection.Mercator,
          r = m.R_MAJOR,
          scale = 0.5 / (Math.PI * r);

      return new L.Transformation(scale, 0.5, -scale, 0.5);
    }())
  });


  /*
   * L.TileLayer is used for standard xyz-numbered tile layers.
   */

  L.TileLayer = L.Class.extend({
    includes: L.Mixin.Events,

    options: {
      minZoom: 0,
      maxZoom: 18,
      tileSize: 256,
      subdomains: 'abc',
      errorTileUrl: '',
      attribution: '',
      zoomOffset: 0,
      opacity: 1,
      /*
      maxNativeZoom: null,
      zIndex: null,
      tms: false,
      continuousWorld: false,
      noWrap: false,
      zoomReverse: false,
      detectRetina: false,
      reuseTiles: false,
      bounds: false,
      */
      unloadInvisibleTiles: L.Browser.mobile,
      updateWhenIdle: L.Browser.mobile
    },

    initialize: function (url, options) {
      options = L.setOptions(this, options);

      // detecting retina displays, adjusting tileSize and zoom levels
      if (options.detectRetina && L.Browser.retina && options.maxZoom > 0) {

        options.tileSize = Math.floor(options.tileSize / 2);
        options.zoomOffset++;

        if (options.minZoom > 0) {
          options.minZoom--;
        }
        this.options.maxZoom--;
      }

      if (options.bounds) {
        options.bounds = L.latLngBounds(options.bounds);
      }

      this._url = url;

      var subdomains = this.options.subdomains;

      if (typeof subdomains === 'string') {
        this.options.subdomains = subdomains.split('');
      }
    },

    onAdd: function (map) {
      this._map = map;
      this._animated = map._zoomAnimated;

      // create a container div for tiles
      this._initContainer();

      // set up events
      map.on({
        'viewreset': this._reset,
        'moveend': this._update
      }, this);

      if (this._animated) {
        map.on({
          'zoomanim': this._animateZoom,
          'zoomend': this._endZoomAnim
        }, this);
      }

      if (!this.options.updateWhenIdle) {
        this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this);
        map.on('move', this._limitedUpdate, this);
      }

      this._reset();
      this._update();
    },

    addTo: function (map) {
      map.addLayer(this);
      return this;
    },

    onRemove: function (map) {
      this._container.parentNode.removeChild(this._container);

      map.off({
        'viewreset': this._reset,
        'moveend': this._update
      }, this);

      if (this._animated) {
        map.off({
          'zoomanim': this._animateZoom,
          'zoomend': this._endZoomAnim
        }, this);
      }

      if (!this.options.updateWhenIdle) {
        map.off('move', this._limitedUpdate, this);
      }

      this._container = null;
      this._map = null;
    },

    bringToFront: function () {
      var pane = this._map._panes.tilePane;

      if (this._container) {
        pane.appendChild(this._container);
        this._setAutoZIndex(pane, Math.max);
      }

      return this;
    },

    bringToBack: function () {
      var pane = this._map._panes.tilePane;

      if (this._container) {
        pane.insertBefore(this._container, pane.firstChild);
        this._setAutoZIndex(pane, Math.min);
      }

      return this;
    },

    getAttribution: function () {
      return this.options.attribution;
    },

    getContainer: function () {
      return this._container;
    },

    setOpacity: function (opacity) {
      this.options.opacity = opacity;

      if (this._map) {
        this._updateOpacity();
      }

      return this;
    },

    setZIndex: function (zIndex) {
      this.options.zIndex = zIndex;
      this._updateZIndex();

      return this;
    },

    setUrl: function (url, noRedraw) {
      this._url = url;

      if (!noRedraw) {
        this.redraw();
      }

      return this;
    },

    redraw: function () {
      if (this._map) {
        this._reset({ hard: true });
        this._update();
      }
      return this;
    },

    _updateZIndex: function () {
      if (this._container && this.options.zIndex !== undefined) {
        this._container.style.zIndex = this.options.zIndex;
      }
    },

    _setAutoZIndex: function (pane, compare) {

      var layers = pane.children,
          edgeZIndex = -compare(Infinity, -Infinity), // -Infinity for max, Infinity for min
          zIndex, i, len;

      for (i = 0, len = layers.length; i < len; i++) {

        if (layers[i] !== this._container) {
          zIndex = parseInt(layers[i].style.zIndex, 10);

          if (!isNaN(zIndex)) {
            edgeZIndex = compare(edgeZIndex, zIndex);
          }
        }
      }

      this.options.zIndex = this._container.style.zIndex =
              (isFinite(edgeZIndex) ? edgeZIndex : 0) + compare(1, -1);
    },

    _updateOpacity: function () {
      var i,
          tiles = this._tiles;

      if (L.Browser.ielt9) {
        for (i in tiles) {
          L.DomUtil.setOpacity(tiles[i], this.options.opacity);
        }
      } else {
        L.DomUtil.setOpacity(this._container, this.options.opacity);
      }
    },

    _initContainer: function () {
      var tilePane = this._map._panes.tilePane;

      if (!this._container) {
        this._container = L.DomUtil.create('div', 'leaflet-layer');

        this._updateZIndex();

        if (this._animated) {
          var className = 'leaflet-tile-container';

          this._bgBuffer = L.DomUtil.create('div', className, this._container);
          this._tileContainer = L.DomUtil.create('div', className, this._container);

        } else {
          this._tileContainer = this._container;
        }

        tilePane.appendChild(this._container);

        if (this.options.opacity < 1) {
          this._updateOpacity();
        }
      }
    },

    _reset: function (e) {
      for (var key in this._tiles) {
        this.fire('tileunload', { tile: this._tiles[key] });
      }

      this._tiles = {};
      this._tilesToLoad = 0;

      if (this.options.reuseTiles) {
        this._unusedTiles = [];
      }

      this._tileContainer.innerHTML = '';

      if (this._animated && e && e.hard) {
        this._clearBgBuffer();
      }

      this._initContainer();
    },

    _getTileSize: function () {
      var map = this._map,
          zoom = map.getZoom() + this.options.zoomOffset,
          zoomN = this.options.maxNativeZoom,
          tileSize = this.options.tileSize;

      if (zoomN && zoom > zoomN) {
        tileSize = Math.round(map.getZoomScale(zoom) / map.getZoomScale(zoomN) * tileSize);
      }

      return tileSize;
    },

    _update: function () {

      if (!this._map) { return; }

      var map = this._map,
          bounds = map.getPixelBounds(),
          zoom = map.getZoom(),
          tileSize = this._getTileSize();

      if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {
        return;
      }

      var tileBounds = L.bounds(
              bounds.min.divideBy(tileSize)._floor(),
              bounds.max.divideBy(tileSize)._floor());

      this._addTilesFromCenterOut(tileBounds);

      if (this.options.unloadInvisibleTiles || this.options.reuseTiles) {
        this._removeOtherTiles(tileBounds);
      }
    },

    _addTilesFromCenterOut: function (bounds) {
      var queue = [],
          center = bounds.getCenter();

      var j, i, point;

      for (j = bounds.min.y; j <= bounds.max.y; j++) {
        for (i = bounds.min.x; i <= bounds.max.x; i++) {
          point = new L.Point(i, j);

          if (this._tileShouldBeLoaded(point)) {
            queue.push(point);
          }
        }
      }

      var tilesToLoad = queue.length;

      if (tilesToLoad === 0) { return; }

      // load tiles in order of their distance to center
      queue.sort(function (a, b) {
        return a.distanceTo(center) - b.distanceTo(center);
      });

      var fragment = document.createDocumentFragment();

      // if its the first batch of tiles to load
      if (!this._tilesToLoad) {
        this.fire('loading');
      }

      this._tilesToLoad += tilesToLoad;

      for (i = 0; i < tilesToLoad; i++) {
        this._addTile(queue[i], fragment);
      }

      this._tileContainer.appendChild(fragment);
    },

    _tileShouldBeLoaded: function (tilePoint) {
      if ((tilePoint.x + ':' + tilePoint.y) in this._tiles) {
        return false; // already loaded
      }

      var options = this.options;

      if (!options.continuousWorld) {
        var limit = this._getWrapTileNum();

        // don't load if exceeds world bounds
        if ((options.noWrap && (tilePoint.x < 0 || tilePoint.x >= limit.x)) ||
          tilePoint.y < 0 || tilePoint.y >= limit.y) { return false; }
      }

      if (options.bounds) {
        var tileSize = options.tileSize,
            nwPoint = tilePoint.multiplyBy(tileSize),
            sePoint = nwPoint.add([tileSize, tileSize]),
            nw = this._map.unproject(nwPoint),
            se = this._map.unproject(sePoint);

        // TODO temporary hack, will be removed after refactoring projections
        // https://github.com/Leaflet/Leaflet/issues/1618
        if (!options.continuousWorld && !options.noWrap) {
          nw = nw.wrap();
          se = se.wrap();
        }

        if (!options.bounds.intersects([nw, se])) { return false; }
      }

      return true;
    },

    _removeOtherTiles: function (bounds) {
      var kArr, x, y, key;

      for (key in this._tiles) {
        kArr = key.split(':');
        x = parseInt(kArr[0], 10);
        y = parseInt(kArr[1], 10);

        // remove tile if it's out of bounds
        if (x < bounds.min.x || x > bounds.max.x || y < bounds.min.y || y > bounds.max.y) {
          this._removeTile(key);
        }
      }
    },

    _removeTile: function (key) {
      var tile = this._tiles[key];

      this.fire('tileunload', { tile: tile, url: tile.src });

      if (this.options.reuseTiles) {
        L.DomUtil.removeClass(tile, 'leaflet-tile-loaded');
        this._unusedTiles.push(tile);

      } else if (tile.parentNode === this._tileContainer) {
        this._tileContainer.removeChild(tile);
      }

      // for https://github.com/CloudMade/Leaflet/issues/137
      if (!L.Browser.android) {
        tile.onload = null;
        tile.src = L.Util.emptyImageUrl;
      }

      delete this._tiles[key];
    },

    _addTile: function (tilePoint, container) {
      var tilePos = this._getTilePos(tilePoint);

      // get unused tile - or create a new tile
      var tile = this._getTile();

      /*
      Chrome 20 layouts much faster with top/left (verify with timeline, frames)
      Android 4 browser has display issues with top/left and requires transform instead
      (other browsers don't currently care) - see debug/hacks/jitter.html for an example
      */
      L.DomUtil.setPosition(tile, tilePos, L.Browser.chrome);

      this._tiles[tilePoint.x + ':' + tilePoint.y] = tile;

      this._loadTile(tile, tilePoint);

      if (tile.parentNode !== this._tileContainer) {
        container.appendChild(tile);
      }
    },

    _getZoomForUrl: function () {

      var options = this.options,
          zoom = this._map.getZoom();

      if (options.zoomReverse) {
        zoom = options.maxZoom - zoom;
      }

      zoom += options.zoomOffset;

      return options.maxNativeZoom ? Math.min(zoom, options.maxNativeZoom) : zoom;
    },

    _getTilePos: function (tilePoint) {
      var origin = this._map.getPixelOrigin(),
          tileSize = this._getTileSize();

      return tilePoint.multiplyBy(tileSize).subtract(origin);
    },

    // image-specific code (override to implement e.g. Canvas or SVG tile layer)

    getTileUrl: function (tilePoint) {
      return L.Util.template(this._url, L.extend({
        s: this._getSubdomain(tilePoint),
        z: tilePoint.z,
        x: tilePoint.x,
        y: tilePoint.y
      }, this.options));
    },

    _getWrapTileNum: function () {
      var crs = this._map.options.crs,
          size = crs.getSize(this._map.getZoom());
      return size.divideBy(this._getTileSize())._floor();
    },

    _adjustTilePoint: function (tilePoint) {

      var limit = this._getWrapTileNum();

      // wrap tile coordinates
      if (!this.options.continuousWorld && !this.options.noWrap) {
        tilePoint.x = ((tilePoint.x % limit.x) + limit.x) % limit.x;
      }

      if (this.options.tms) {
        tilePoint.y = limit.y - tilePoint.y - 1;
      }

      tilePoint.z = this._getZoomForUrl();
    },

    _getSubdomain: function (tilePoint) {
      var index = Math.abs(tilePoint.x + tilePoint.y) % this.options.subdomains.length;
      return this.options.subdomains[index];
    },

    _getTile: function () {
      if (this.options.reuseTiles && this._unusedTiles.length > 0) {
        var tile = this._unusedTiles.pop();
        this._resetTile(tile);
        return tile;
      }
      return this._createTile();
    },

    // Override if data stored on a tile needs to be cleaned up before reuse
    _resetTile: function (/*tile*/) { },

    _createTile: function () {
      var tile = L.DomUtil.create('img', 'leaflet-tile');
      tile.style.width = tile.style.height = this._getTileSize() + 'px';
      tile.galleryimg = 'no';

      tile.onselectstart = tile.onmousemove = L.Util.falseFn;

      if (L.Browser.ielt9 && this.options.opacity !== undefined) {
        L.DomUtil.setOpacity(tile, this.options.opacity);
      }
      // without this hack, tiles disappear after zoom on Chrome for Android
      // https://github.com/Leaflet/Leaflet/issues/2078
      if (L.Browser.mobileWebkit3d) {
        tile.style.WebkitBackfaceVisibility = 'hidden';
      }
      return tile;
    },

    _loadTile: function (tile, tilePoint) {
      tile._layer = this;
      tile.onload = this._tileOnLoad;
      tile.onerror = this._tileOnError;

      this._adjustTilePoint(tilePoint);
      tile.src = this.getTileUrl(tilePoint);

      this.fire('tileloadstart', {
        tile: tile,
        url: tile.src
      });
    },

    _tileLoaded: function () {
      this._tilesToLoad--;

      if (this._animated) {
        L.DomUtil.addClass(this._tileContainer, 'leaflet-zoom-animated');
      }

      if (!this._tilesToLoad) {
        this.fire('load');

        if (this._animated) {
          // clear scaled tiles after all new tiles are loaded (for performance)
          clearTimeout(this._clearBgBufferTimer);
          this._clearBgBufferTimer = setTimeout(L.bind(this._clearBgBuffer, this), 500);
        }
      }
    },

    _tileOnLoad: function () {
      var layer = this._layer;

      //Only if we are loading an actual image
      if (this.src !== L.Util.emptyImageUrl) {
        L.DomUtil.addClass(this, 'leaflet-tile-loaded');

        layer.fire('tileload', {
          tile: this,
          url: this.src
        });
      }

      layer._tileLoaded();
    },

    _tileOnError: function () {
      var layer = this._layer;

      layer.fire('tileerror', {
        tile: this,
        url: this.src
      });

      var newUrl = layer.options.errorTileUrl;
      if (newUrl) {
        this.src = newUrl;
      }

      layer._tileLoaded();
    }
  });

  L.tileLayer = function (url, options) {
    return new L.TileLayer(url, options);
  };


  /*
   * L.TileLayer.WMS is used for putting WMS tile layers on the map.
   */

  L.TileLayer.WMS = L.TileLayer.extend({

    defaultWmsParams: {
      service: 'WMS',
      request: 'GetMap',
      version: '1.1.1',
      layers: '',
      styles: '',
      format: 'image/jpeg',
      transparent: false
    },

    initialize: function (url, options) { // (String, Object)

      this._url = url;

      var wmsParams = L.extend({}, this.defaultWmsParams),
          tileSize = options.tileSize || this.options.tileSize;

      if (options.detectRetina && L.Browser.retina) {
        wmsParams.width = wmsParams.height = tileSize * 2;
      } else {
        wmsParams.width = wmsParams.height = tileSize;
      }

      for (var i in options) {
        // all keys that are not TileLayer options go to WMS params
        if (!this.options.hasOwnProperty(i) && i !== 'crs') {
          wmsParams[i] = options[i];
        }
      }

      this.wmsParams = wmsParams;

      L.setOptions(this, options);
    },

    onAdd: function (map) {

      this._crs = this.options.crs || map.options.crs;

      this._wmsVersion = parseFloat(this.wmsParams.version);

      var projectionKey = this._wmsVersion >= 1.3 ? 'crs' : 'srs';
      this.wmsParams[projectionKey] = this._crs.code;

      L.TileLayer.prototype.onAdd.call(this, map);
    },

    getTileUrl: function (tilePoint) { // (Point, Number) -> String

      var map = this._map,
          tileSize = this.options.tileSize,

          nwPoint = tilePoint.multiplyBy(tileSize),
          sePoint = nwPoint.add([tileSize, tileSize]),

          nw = this._crs.project(map.unproject(nwPoint, tilePoint.z)),
          se = this._crs.project(map.unproject(sePoint, tilePoint.z)),
          bbox = this._wmsVersion >= 1.3 && this._crs === L.CRS.EPSG4326 ?
              [se.y, nw.x, nw.y, se.x].join(',') :
              [nw.x, se.y, se.x, nw.y].join(','),

          url = L.Util.template(this._url, { s: this._getSubdomain(tilePoint) });

      return url + L.Util.getParamString(this.wmsParams, url, true) + '&BBOX=' + bbox;
    },

    setParams: function (params, noRedraw) {

      L.extend(this.wmsParams, params);

      if (!noRedraw) {
        this.redraw();
      }

      return this;
    }
  });

  L.tileLayer.wms = function (url, options) {
    return new L.TileLayer.WMS(url, options);
  };


  /*
   * L.TileLayer.Canvas is a class that you can use as a base for creating
   * dynamically drawn Canvas-based tile layers.
   */

  L.TileLayer.Canvas = L.TileLayer.extend({
    options: {
      async: false
    },

    initialize: function (options) {
      L.setOptions(this, options);
    },

    redraw: function () {
      if (this._map) {
        this._reset({ hard: true });
        this._update();
      }

      for (var i in this._tiles) {
        this._redrawTile(this._tiles[i]);
      }
      return this;
    },

    _redrawTile: function (tile) {
      this.drawTile(tile, tile._tilePoint, this._map._zoom);
    },

    _createTile: function () {
      var tile = L.DomUtil.create('canvas', 'leaflet-tile');
      tile.width = tile.height = this.options.tileSize;
      tile.onselectstart = tile.onmousemove = L.Util.falseFn;
      return tile;
    },

    _loadTile: function (tile, tilePoint) {
      tile._layer = this;
      tile._tilePoint = tilePoint;

      this._redrawTile(tile);

      if (!this.options.async) {
        this.tileDrawn(tile);
      }
    },

    drawTile: function (/*tile, tilePoint*/) {
      // override with rendering code
    },

    tileDrawn: function (tile) {
      this._tileOnLoad.call(tile);
    }
  });


  L.tileLayer.canvas = function (options) {
    return new L.TileLayer.Canvas(options);
  };


  /*
   * L.ImageOverlay is used to overlay images over the map (to specific geographical bounds).
   */

  L.ImageOverlay = L.Class.extend({
    includes: L.Mixin.Events,

    options: {
      opacity: 1
    },

    initialize: function (url, bounds, options) { // (String, LatLngBounds, Object)
      this._url = url;
      this._bounds = L.latLngBounds(bounds);

      L.setOptions(this, options);
    },

    onAdd: function (map) {
      this._map = map;

      if (!this._image) {
        this._initImage();
      }

      map._panes.overlayPane.appendChild(this._image);

      map.on('viewreset', this._reset, this);

      if (map.options.zoomAnimation && L.Browser.any3d) {
        map.on('zoomanim', this._animateZoom, this);
      }

      this._reset();
    },

    onRemove: function (map) {
      map.getPanes().overlayPane.removeChild(this._image);

      map.off('viewreset', this._reset, this);

      if (map.options.zoomAnimation) {
        map.off('zoomanim', this._animateZoom, this);
      }
    },

    addTo: function (map) {
      map.addLayer(this);
      return this;
    },

    setOpacity: function (opacity) {
      this.options.opacity = opacity;
      this._updateOpacity();
      return this;
    },

    // TODO remove bringToFront/bringToBack duplication from TileLayer/Path
    bringToFront: function () {
      if (this._image) {
        this._map._panes.overlayPane.appendChild(this._image);
      }
      return this;
    },

    bringToBack: function () {
      var pane = this._map._panes.overlayPane;
      if (this._image) {
        pane.insertBefore(this._image, pane.firstChild);
      }
      return this;
    },

    setUrl: function (url) {
      this._url = url;
      this._image.src = this._url;
    },

    getAttribution: function () {
      return this.options.attribution;
    },

    _initImage: function () {
      this._image = L.DomUtil.create('img', 'leaflet-image-layer');

      if (this._map.options.zoomAnimation && L.Browser.any3d) {
        L.DomUtil.addClass(this._image, 'leaflet-zoom-animated');
      } else {
        L.DomUtil.addClass(this._image, 'leaflet-zoom-hide');
      }

      this._updateOpacity();

      //TODO createImage util method to remove duplication
      L.extend(this._image, {
        galleryimg: 'no',
        onselectstart: L.Util.falseFn,
        onmousemove: L.Util.falseFn,
        onload: L.bind(this._onImageLoad, this),
        src: this._url
      });
    },

    _animateZoom: function (e) {
      var map = this._map,
          image = this._image,
          scale = map.getZoomScale(e.zoom),
          nw = this._bounds.getNorthWest(),
          se = this._bounds.getSouthEast(),

          topLeft = map._latLngToNewLayerPoint(nw, e.zoom, e.center),
          size = map._latLngToNewLayerPoint(se, e.zoom, e.center)._subtract(topLeft),
          origin = topLeft._add(size._multiplyBy((1 / 2) * (1 - 1 / scale)));

      image.style[L.DomUtil.TRANSFORM] =
              L.DomUtil.getTranslateString(origin) + ' scale(' + scale + ') ';
    },

    _reset: function () {
      var image = this._image,
          topLeft = this._map.latLngToLayerPoint(this._bounds.getNorthWest()),
          size = this._map.latLngToLayerPoint(this._bounds.getSouthEast())._subtract(topLeft);

      L.DomUtil.setPosition(image, topLeft);

      image.style.width = size.x + 'px';
      image.style.height = size.y + 'px';
    },

    _onImageLoad: function () {
      this.fire('load');
    },

    _updateOpacity: function () {
      L.DomUtil.setOpacity(this._image, this.options.opacity);
    }
  });

  L.imageOverlay = function (url, bounds, options) {
    return new L.ImageOverlay(url, bounds, options);
  };


  /*
   * L.Icon is an image-based icon class that you can use with L.Marker for custom markers.
   */

  L.Icon = L.Class.extend({
    options: {
      /*
      iconUrl: (String) (required)
      iconRetinaUrl: (String) (optional, used for retina devices if detected)
      iconSize: (Point) (can be set through CSS)
      iconAnchor: (Point) (centered by default, can be set in CSS with negative margins)
      popupAnchor: (Point) (if not specified, popup opens in the anchor point)
      shadowUrl: (String) (no shadow by default)
      shadowRetinaUrl: (String) (optional, used for retina devices if detected)
      shadowSize: (Point)
      shadowAnchor: (Point)
      */
      className: ''
    },

    initialize: function (options) {
      L.setOptions(this, options);
    },

    createIcon: function (oldIcon) {
      return this._createIcon('icon', oldIcon);
    },

    createShadow: function (oldIcon) {
      return this._createIcon('shadow', oldIcon);
    },

    _createIcon: function (name, oldIcon) {
      var src = this._getIconUrl(name);

      if (!src) {
        if (name === 'icon') {
          throw new Error('iconUrl not set in Icon options (see the docs).');
        }
        return null;
      }

      var img;
      if (!oldIcon || oldIcon.tagName !== 'IMG') {
        img = this._createImg(src);
      } else {
        img = this._createImg(src, oldIcon);
      }
      this._setIconStyles(img, name);

      return img;
    },

    _setIconStyles: function (img, name) {
      var options = this.options,
          size = L.point(options[name + 'Size']),
          anchor;

      if (name === 'shadow') {
        anchor = L.point(options.shadowAnchor || options.iconAnchor);
      } else {
        anchor = L.point(options.iconAnchor);
      }

      if (!anchor && size) {
        anchor = size.divideBy(2, true);
      }

      img.className = 'leaflet-marker-' + name + ' ' + options.className;

      if (anchor) {
        img.style.marginLeft = (-anchor.x) + 'px';
        img.style.marginTop = (-anchor.y) + 'px';
      }

      if (size) {
        img.style.width = size.x + 'px';
        img.style.height = size.y + 'px';
      }
    },

    _createImg: function (src, el) {
      el = el || document.createElement('img');
      el.src = src;
      return el;
    },

    _getIconUrl: function (name) {
      if (L.Browser.retina && this.options[name + 'RetinaUrl']) {
        return this.options[name + 'RetinaUrl'];
      }
      return this.options[name + 'Url'];
    }
  });

  L.icon = function (options) {
    return new L.Icon(options);
  };


  /*
   * L.Icon.Default is the blue marker icon used by default in Leaflet.
   */

  L.Icon.Default = L.Icon.extend({

    options: {
      iconSize: [25, 41],
      iconAnchor: [12, 41],
      popupAnchor: [1, -34],

      shadowSize: [41, 41]
    },

    _getIconUrl: function (name) {
      var key = name + 'Url';

      if (this.options[key]) {
        return this.options[key];
      }

      if (L.Browser.retina && name === 'icon') {
        name += '-2x';
      }

      var path = L.Icon.Default.imagePath;

      if (!path) {
        throw new Error('Couldn\'t autodetect L.Icon.Default.imagePath, set it manually.');
      }

      return path + '/marker-' + name + '.svg';
    }
  });

  L.Icon.Default.imagePath = (function () {
    var scripts = document.getElementsByTagName('script'),
        leafletRe = /[\/^]leaflet[\-\._]?([\w\-\._]*)\.js\??/;

    var i, len, src, matches, path;

    for (i = 0, len = scripts.length; i < len; i++) {
      src = scripts[i].src;
      matches = src.match(leafletRe);

      if (matches) {
        path = src.split(leafletRe)[0];
        return (path ? path + '/' : '') + 'images';
      }
    }
  }());


  /*
   * L.Marker is used to display clickable/draggable icons on the map.
   */

  L.Marker = L.Class.extend({

    includes: L.Mixin.Events,

    options: {
      icon: new L.Icon.Default(),
      title: '',
      alt: '',
      clickable: true,
      draggable: false,
      keyboard: true,
      zIndexOffset: 0,
      opacity: 1,
      riseOnHover: false,
      riseOffset: 250
    },

    initialize: function (latlng, options) {
      L.setOptions(this, options);
      this._latlng = L.latLng(latlng);
    },

    onAdd: function (map) {
      this._map = map;

      map.on('viewreset', this.update, this);

      this._initIcon();
      this.update();
      this.fire('add');

      if (map.options.zoomAnimation && map.options.markerZoomAnimation) {
        map.on('zoomanim', this._animateZoom, this);
      }
    },

    addTo: function (map) {
      map.addLayer(this);
      return this;
    },

    onRemove: function (map) {
      if (this.dragging) {
        this.dragging.disable();
      }

      this._removeIcon();
      this._removeShadow();

      this.fire('remove');

      map.off({
        'viewreset': this.update,
        'zoomanim': this._animateZoom
      }, this);

      this._map = null;
    },

    getLatLng: function () {
      return this._latlng;
    },

    setLatLng: function (latlng) {
      this._latlng = L.latLng(latlng);

      this.update();

      return this.fire('move', { latlng: this._latlng });
    },

    setZIndexOffset: function (offset) {
      this.options.zIndexOffset = offset;
      this.update();

      return this;
    },

    setIcon: function (icon) {

      this.options.icon = icon;

      if (this._map) {
        this._initIcon();
        this.update();
      }

      if (this._popup) {
        this.bindPopup(this._popup);
      }

      return this;
    },

    update: function () {
      if (this._icon) {
        var pos = this._map.latLngToLayerPoint(this._latlng).round();
        this._setPos(pos);
      }

      return this;
    },

    _initIcon: function () {
      var options = this.options,
          map = this._map,
          animation = (map.options.zoomAnimation && map.options.markerZoomAnimation),
          classToAdd = animation ? 'leaflet-zoom-animated' : 'leaflet-zoom-hide';

      var icon = options.icon.createIcon(this._icon),
        addIcon = false;

      // if we're not reusing the icon, remove the old one and init new one
      if (icon !== this._icon) {
        if (this._icon) {
          this._removeIcon();
        }
        addIcon = true;

        if (options.title) {
          icon.title = options.title;
        }

        if (options.alt) {
          icon.alt = options.alt;
        }
      }

      L.DomUtil.addClass(icon, classToAdd);

      if (options.keyboard) {
        icon.tabIndex = '0';
      }

      this._icon = icon;

      this._initInteraction();

      if (options.riseOnHover) {
        L.DomEvent
          .on(icon, 'mouseover', this._bringToFront, this)
          .on(icon, 'mouseout', this._resetZIndex, this);
      }

      var newShadow = options.icon.createShadow(this._shadow),
        addShadow = false;

      if (newShadow !== this._shadow) {
        this._removeShadow();
        addShadow = true;
      }

      if (newShadow) {
        L.DomUtil.addClass(newShadow, classToAdd);
      }
      this._shadow = newShadow;


      if (options.opacity < 1) {
        this._updateOpacity();
      }


      var panes = this._map._panes;

      if (addIcon) {
        panes.markerPane.appendChild(this._icon);
      }

      if (newShadow && addShadow) {
        panes.shadowPane.appendChild(this._shadow);
      }
    },

    _removeIcon: function () {
      if (this.options.riseOnHover) {
        L.DomEvent
            .off(this._icon, 'mouseover', this._bringToFront)
            .off(this._icon, 'mouseout', this._resetZIndex);
      }

      this._map._panes.markerPane.removeChild(this._icon);

      this._icon = null;
    },

    _removeShadow: function () {
      if (this._shadow) {
        this._map._panes.shadowPane.removeChild(this._shadow);
      }
      this._shadow = null;
    },

    _setPos: function (pos) {
      L.DomUtil.setPosition(this._icon, pos);

      if (this._shadow) {
        L.DomUtil.setPosition(this._shadow, pos);
      }

      this._zIndex = pos.y + this.options.zIndexOffset;

      this._resetZIndex();
    },

    _updateZIndex: function (offset) {
      this._icon.style.zIndex = this._zIndex + offset;
    },

    _animateZoom: function (opt) {
      var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();

      this._setPos(pos);
    },

    _initInteraction: function () {

      if (!this.options.clickable) { return; }

      // TODO refactor into something shared with Map/Path/etc. to DRY it up

      var icon = this._icon,
          events = ['dblclick', 'mousedown', 'mouseover', 'mouseout', 'contextmenu'];

      L.DomUtil.addClass(icon, 'leaflet-clickable');
      L.DomEvent.on(icon, 'click', this._onMouseClick, this);
      L.DomEvent.on(icon, 'keypress', this._onKeyPress, this);

      for (var i = 0; i < events.length; i++) {
        L.DomEvent.on(icon, events[i], this._fireMouseEvent, this);
      }

      if (L.Handler.MarkerDrag) {
        this.dragging = new L.Handler.MarkerDrag(this);

        if (this.options.draggable) {
          this.dragging.enable();
        }
      }
    },

    _onMouseClick: function (e) {
      var wasDragged = this.dragging && this.dragging.moved();

      if (this.hasEventListeners(e.type) || wasDragged) {
        L.DomEvent.stopPropagation(e);
      }

      if (wasDragged) { return; }

      if ((!this.dragging || !this.dragging._enabled) && this._map.dragging && this._map.dragging.moved()) { return; }

      this.fire(e.type, {
        originalEvent: e,
        latlng: this._latlng
      });
    },

    _onKeyPress: function (e) {
      if (e.keyCode === 13) {
        this.fire('click', {
          originalEvent: e,
          latlng: this._latlng
        });
      }
    },

    _fireMouseEvent: function (e) {

      this.fire(e.type, {
        originalEvent: e,
        latlng: this._latlng
      });

      // TODO proper custom event propagation
      // this line will always be called if marker is in a FeatureGroup
      if (e.type === 'contextmenu' && this.hasEventListeners(e.type)) {
        L.DomEvent.preventDefault(e);
      }
      if (e.type !== 'mousedown') {
        L.DomEvent.stopPropagation(e);
      } else {
        L.DomEvent.preventDefault(e);
      }
    },

    setOpacity: function (opacity) {
      this.options.opacity = opacity;
      if (this._map) {
        this._updateOpacity();
      }

      return this;
    },

    _updateOpacity: function () {
      L.DomUtil.setOpacity(this._icon, this.options.opacity);
      if (this._shadow) {
        L.DomUtil.setOpacity(this._shadow, this.options.opacity);
      }
    },

    _bringToFront: function () {
      this._updateZIndex(this.options.riseOffset);
    },

    _resetZIndex: function () {
      this._updateZIndex(0);
    }
  });

  L.marker = function (latlng, options) {
    return new L.Marker(latlng, options);
  };


  /*
   * L.DivIcon is a lightweight HTML-based icon class (as opposed to the image-based L.Icon)
   * to use with L.Marker.
   */

  L.DivIcon = L.Icon.extend({
    options: {
      iconSize: [12, 12], // also can be set through CSS
      /*
      iconAnchor: (Point)
      popupAnchor: (Point)
      html: (String)
      bgPos: (Point)
      */
      className: 'leaflet-div-icon',
      html: false
    },

    createIcon: function (oldIcon) {
      var div = (oldIcon && oldIcon.tagName === 'DIV') ? oldIcon : document.createElement('div'),
          options = this.options;

      if (options.html !== false) {
        div.innerHTML = options.html;
      } else {
        div.innerHTML = '';
      }

      if (options.bgPos) {
        div.style.backgroundPosition =
                (-options.bgPos.x) + 'px ' + (-options.bgPos.y) + 'px';
      }

      this._setIconStyles(div, 'icon');
      return div;
    },

    createShadow: function () {
      return null;
    }
  });

  L.divIcon = function (options) {
    return new L.DivIcon(options);
  };


  /*
   * L.Popup is used for displaying popups on the map.
   */

  L.Map.mergeOptions({
    closePopupOnClick: true
  });

  L.Popup = L.Class.extend({
    includes: L.Mixin.Events,

    options: {
      minWidth: 50,
      maxWidth: 300,
      // maxHeight: null,
      autoPan: true,
      closeButton: true,
      offset: [0, 7],
      autoPanPadding: [5, 5],
      // autoPanPaddingTopLeft: null,
      // autoPanPaddingBottomRight: null,
      keepInView: false,
      className: '',
      zoomAnimation: true
    },

    initialize: function (options, source) {
      L.setOptions(this, options);

      this._source = source;
      this._animated = L.Browser.any3d && this.options.zoomAnimation;
      this._isOpen = false;
    },

    onAdd: function (map) {
      this._map = map;

      if (!this._container) {
        this._initLayout();
      }

      var animFade = map.options.fadeAnimation;

      if (animFade) {
        L.DomUtil.setOpacity(this._container, 0);
      }
      map._panes.popupPane.appendChild(this._container);

      map.on(this._getEvents(), this);

      this.update();

      if (animFade) {
        L.DomUtil.setOpacity(this._container, 1);
      }

      this.fire('open');

      map.fire('popupopen', { popup: this });

      if (this._source) {
        this._source.fire('popupopen', { popup: this });
      }
    },

    addTo: function (map) {
      map.addLayer(this);
      return this;
    },

    openOn: function (map) {
      map.openPopup(this);
      return this;
    },

    onRemove: function (map) {
      map._panes.popupPane.removeChild(this._container);

      L.Util.falseFn(this._container.offsetWidth); // force reflow

      map.off(this._getEvents(), this);

      if (map.options.fadeAnimation) {
        L.DomUtil.setOpacity(this._container, 0);
      }

      this._map = null;

      this.fire('close');

      map.fire('popupclose', { popup: this });

      if (this._source) {
        this._source.fire('popupclose', { popup: this });
      }
    },

    getLatLng: function () {
      return this._latlng;
    },

    setLatLng: function (latlng) {
      this._latlng = L.latLng(latlng);
      if (this._map) {
        this._updatePosition();
        this._adjustPan();
      }
      return this;
    },

    getContent: function () {
      return this._content;
    },

    setContent: function (content) {
      this._content = content;
      this.update();
      return this;
    },

    update: function () {
      if (!this._map) { return; }

      this._container.style.visibility = 'hidden';

      this._updateContent();
      this._updateLayout();
      this._updatePosition();

      this._container.style.visibility = '';

      this._adjustPan();
    },

    _getEvents: function () {
      var events = {
        viewreset: this._updatePosition
      };

      if (this._animated) {
        events.zoomanim = this._zoomAnimation;
      }
      if ('closeOnClick' in this.options ? this.options.closeOnClick : this._map.options.closePopupOnClick) {
        events.preclick = this._close;
      }
      if (this.options.keepInView) {
        events.moveend = this._adjustPan;
      }

      return events;
    },

    _close: function () {
      if (this._map) {
        this._map.closePopup(this);
      }
    },

    _initLayout: function () {
      var prefix = 'leaflet-popup',
        containerClass = prefix + ' ' + this.options.className + ' leaflet-zoom-' +
                (this._animated ? 'animated' : 'hide'),
        container = this._container = L.DomUtil.create('div', containerClass),
        closeButton;

      if (this.options.closeButton) {
        closeButton = this._closeButton =
                L.DomUtil.create('a', prefix + '-close-button', container);
        closeButton.href = '#close';
        closeButton.innerHTML = '&#215;';
        L.DomEvent.disableClickPropagation(closeButton);

        L.DomEvent.on(closeButton, 'click', this._onCloseButtonClick, this);
      }

      var wrapper = this._wrapper =
              L.DomUtil.create('div', prefix + '-content-wrapper', container);
      L.DomEvent.disableClickPropagation(wrapper);

      this._contentNode = L.DomUtil.create('div', prefix + '-content', wrapper);

      L.DomEvent.disableScrollPropagation(this._contentNode);
      L.DomEvent.on(wrapper, 'contextmenu', L.DomEvent.stopPropagation);

      this._tipContainer = L.DomUtil.create('div', prefix + '-tip-container', container);
      this._tip = L.DomUtil.create('div', prefix + '-tip', this._tipContainer);
    },

    _updateContent: function () {
      if (!this._content) { return; }

      if (typeof this._content === 'string') {
        this._contentNode.innerHTML = this._content;
      } else {
        while (this._contentNode.hasChildNodes()) {
          this._contentNode.removeChild(this._contentNode.firstChild);
        }
        this._contentNode.appendChild(this._content);
      }
      this.fire('contentupdate');
    },

    _updateLayout: function () {
      var container = this._contentNode,
          style = container.style;

      style.width = '';
      style.whiteSpace = 'nowrap';

      var width = container.offsetWidth;
      width = Math.min(width, this.options.maxWidth);
      width = Math.max(width, this.options.minWidth);

      style.width = (width + 1) + 'px';
      style.whiteSpace = '';

      style.height = '';

      var height = container.offsetHeight,
          maxHeight = this.options.maxHeight,
          scrolledClass = 'leaflet-popup-scrolled';

      if (maxHeight && height > maxHeight) {
        style.height = maxHeight + 'px';
        L.DomUtil.addClass(container, scrolledClass);
      } else {
        L.DomUtil.removeClass(container, scrolledClass);
      }

      this._containerWidth = this._container.offsetWidth;
    },

    _updatePosition: function () {
      if (!this._map) { return; }

      var pos = this._map.latLngToLayerPoint(this._latlng),
          animated = this._animated,
          offset = L.point(this.options.offset);

      if (animated) {
        L.DomUtil.setPosition(this._container, pos);
      }

      this._containerBottom = -offset.y - (animated ? 0 : pos.y);
      this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x + (animated ? 0 : pos.x);

      // bottom position the popup in case the height of the popup changes (images loading etc)
      this._container.style.bottom = this._containerBottom + 'px';
      this._container.style.left = this._containerLeft + 'px';
    },

    _zoomAnimation: function (opt) {
      var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center);

      L.DomUtil.setPosition(this._container, pos);
    },

    _adjustPan: function () {
      if (!this.options.autoPan) { return; }

      var map = this._map,
          containerHeight = this._container.offsetHeight,
          containerWidth = this._containerWidth,

          layerPos = new L.Point(this._containerLeft, -containerHeight - this._containerBottom);

      if (this._animated) {
        layerPos._add(L.DomUtil.getPosition(this._container));
      }

      var containerPos = map.layerPointToContainerPoint(layerPos),
          padding = L.point(this.options.autoPanPadding),
          paddingTL = L.point(this.options.autoPanPaddingTopLeft || padding),
          paddingBR = L.point(this.options.autoPanPaddingBottomRight || padding),
          size = map.getSize(),
          dx = 0,
          dy = 0;

      if (containerPos.x + containerWidth + paddingBR.x > size.x) { // right
        dx = containerPos.x + containerWidth - size.x + paddingBR.x;
      }
      if (containerPos.x - dx - paddingTL.x < 0) { // left
        dx = containerPos.x - paddingTL.x;
      }
      if (containerPos.y + containerHeight + paddingBR.y > size.y) { // bottom
        dy = containerPos.y + containerHeight - size.y + paddingBR.y;
      }
      if (containerPos.y - dy - paddingTL.y < 0) { // top
        dy = containerPos.y - paddingTL.y;
      }

      if (dx || dy) {
        map
            .fire('autopanstart')
            .panBy([dx, dy]);
      }
    },

    _onCloseButtonClick: function (e) {
      this._close();
      L.DomEvent.stop(e);
    }
  });

  L.popup = function (options, source) {
    return new L.Popup(options, source);
  };


  L.Map.include({
    openPopup: function (popup, latlng, options) { // (Popup) or (String || HTMLElement, LatLng[, Object])
      this.closePopup();

      if (!(popup instanceof L.Popup)) {
        var content = popup;

        popup = new L.Popup(options)
            .setLatLng(latlng)
            .setContent(content);
      }
      popup._isOpen = true;

      this._popup = popup;
      return this.addLayer(popup);
    },

    closePopup: function (popup) {
      if (!popup || popup === this._popup) {
        popup = this._popup;
        this._popup = null;
      }
      if (popup) {
        this.removeLayer(popup);
        popup._isOpen = false;
      }
      return this;
    }
  });


  /*
   * Popup extension to L.Marker, adding popup-related methods.
   */

  L.Marker.include({
    openPopup: function () {
      if (this._popup && this._map && !this._map.hasLayer(this._popup)) {
        this._popup.setLatLng(this._latlng);
        this._map.openPopup(this._popup);
      }

      return this;
    },

    closePopup: function () {
      if (this._popup) {
        this._popup._close();
      }
      return this;
    },

    togglePopup: function () {
      if (this._popup) {
        if (this._popup._isOpen) {
          this.closePopup();
        } else {
          this.openPopup();
        }
      }
      return this;
    },

    bindPopup: function (content, options) {
      var anchor = L.point(this.options.icon.options.popupAnchor || [0, 0]);

      anchor = anchor.add(L.Popup.prototype.options.offset);

      if (options && options.offset) {
        anchor = anchor.add(options.offset);
      }

      options = L.extend({ offset: anchor }, options);

      if (!this._popupHandlersAdded) {
        this
            .on('click', this.togglePopup, this)
            .on('remove', this.closePopup, this)
            .on('move', this._movePopup, this);
        this._popupHandlersAdded = true;
      }

      if (content instanceof L.Popup) {
        L.setOptions(content, options);
        this._popup = content;
      } else {
        this._popup = new L.Popup(options, this)
          .setContent(content);
      }

      return this;
    },

    setPopupContent: function (content) {
      if (this._popup) {
        this._popup.setContent(content);
      }
      return this;
    },

    unbindPopup: function () {
      if (this._popup) {
        this._popup = null;
        this
            .off('click', this.togglePopup, this)
            .off('remove', this.closePopup, this)
            .off('move', this._movePopup, this);
        this._popupHandlersAdded = false;
      }
      return this;
    },

    getPopup: function () {
      return this._popup;
    },

    _movePopup: function (e) {
      this._popup.setLatLng(e.latlng);
    }
  });


  /*
   * L.LayerGroup is a class to combine several layers into one so that
   * you can manipulate the group (e.g. add/remove it) as one layer.
   */

  L.LayerGroup = L.Class.extend({
    initialize: function (layers) {
      this._layers = {};

      var i, len;

      if (layers) {
        for (i = 0, len = layers.length; i < len; i++) {
          this.addLayer(layers[i]);
        }
      }
    },

    addLayer: function (layer) {
      var id = this.getLayerId(layer);

      this._layers[id] = layer;

      if (this._map) {
        this._map.addLayer(layer);
      }

      return this;
    },

    removeLayer: function (layer) {
      var id = layer in this._layers ? layer : this.getLayerId(layer);

      if (this._map && this._layers[id]) {
        this._map.removeLayer(this._layers[id]);
      }

      delete this._layers[id];

      return this;
    },

    hasLayer: function (layer) {
      if (!layer) { return false; }

      return (layer in this._layers || this.getLayerId(layer) in this._layers);
    },

    clearLayers: function () {
      this.eachLayer(this.removeLayer, this);
      return this;
    },

    invoke: function (methodName) {
      var args = Array.prototype.slice.call(arguments, 1),
          i, layer;

      for (i in this._layers) {
        layer = this._layers[i];

        if (layer[methodName]) {
          layer[methodName].apply(layer, args);
        }
      }

      return this;
    },

    onAdd: function (map) {
      this._map = map;
      this.eachLayer(map.addLayer, map);
    },

    onRemove: function (map) {
      this.eachLayer(map.removeLayer, map);
      this._map = null;
    },

    addTo: function (map) {
      map.addLayer(this);
      return this;
    },

    eachLayer: function (method, context) {
      for (var i in this._layers) {
        method.call(context, this._layers[i]);
      }
      return this;
    },

    getLayer: function (id) {
      return this._layers[id];
    },

    getLayers: function () {
      var layers = [];

      for (var i in this._layers) {
        layers.push(this._layers[i]);
      }
      return layers;
    },

    setZIndex: function (zIndex) {
      return this.invoke('setZIndex', zIndex);
    },

    getLayerId: function (layer) {
      return L.stamp(layer);
    }
  });

  L.layerGroup = function (layers) {
    return new L.LayerGroup(layers);
  };


  /*
   * L.FeatureGroup extends L.LayerGroup by introducing mouse events and additional methods
   * shared between a group of interactive layers (like vectors or markers).
   */

  L.FeatureGroup = L.LayerGroup.extend({
    includes: L.Mixin.Events,

    statics: {
      EVENTS: 'click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose'
    },

    addLayer: function (layer) {
      if (this.hasLayer(layer)) {
        return this;
      }

      if ('on' in layer) {
        layer.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
      }

      L.LayerGroup.prototype.addLayer.call(this, layer);

      if (this._popupContent && layer.bindPopup) {
        layer.bindPopup(this._popupContent, this._popupOptions);
      }

      return this.fire('layeradd', { layer: layer });
    },

    removeLayer: function (layer) {
      if (!this.hasLayer(layer)) {
        return this;
      }
      if (layer in this._layers) {
        layer = this._layers[layer];
      }

      layer.off(L.FeatureGroup.EVENTS, this._propagateEvent, this);

      L.LayerGroup.prototype.removeLayer.call(this, layer);

      if (this._popupContent) {
        this.invoke('unbindPopup');
      }

      return this.fire('layerremove', { layer: layer });
    },

    bindPopup: function (content, options) {
      this._popupContent = content;
      this._popupOptions = options;
      return this.invoke('bindPopup', content, options);
    },

    openPopup: function (latlng) {
      // open popup on the first layer
      for (var id in this._layers) {
        this._layers[id].openPopup(latlng);
        break;
      }
      return this;
    },

    setStyle: function (style) {
      return this.invoke('setStyle', style);
    },

    bringToFront: function () {
      return this.invoke('bringToFront');
    },

    bringToBack: function () {
      return this.invoke('bringToBack');
    },

    getBounds: function () {
      var bounds = new L.LatLngBounds();

      this.eachLayer(function (layer) {
        bounds.extend(layer instanceof L.Marker ? layer.getLatLng() : layer.getBounds());
      });

      return bounds;
    },

    _propagateEvent: function (e) {
      e = L.extend({
        layer: e.target,
        target: this
      }, e);
      this.fire(e.type, e);
    }
  });

  L.featureGroup = function (layers) {
    return new L.FeatureGroup(layers);
  };


  /*
   * L.Path is a base class for rendering vector paths on a map. Inherited by Polyline, Circle, etc.
   */

  L.Path = L.Class.extend({
    includes: [L.Mixin.Events],

    statics: {
      // how much to extend the clip area around the map view
      // (relative to its size, e.g. 0.5 is half the screen in each direction)
      // set it so that SVG element doesn't exceed 1280px (vectors flicker on dragend if it is)
      CLIP_PADDING: (function () {
        var max = L.Browser.mobile ? 1280 : 2000,
            target = (max / Math.max(window.outerWidth, window.outerHeight) - 1) / 2;
        return Math.max(0, Math.min(0.5, target));
      })()
    },

    options: {
      stroke: true,
      color: '#0033ff',
      dashArray: null,
      lineCap: null,
      lineJoin: null,
      weight: 5,
      opacity: 0.5,

      fill: false,
      fillColor: null, //same as color by default
      fillOpacity: 0.2,

      clickable: true
    },

    initialize: function (options) {
      L.setOptions(this, options);
    },

    onAdd: function (map) {
      this._map = map;

      if (!this._container) {
        this._initElements();
        this._initEvents();
      }

      this.projectLatlngs();
      this._updatePath();

      if (this._container) {
        this._map._pathRoot.appendChild(this._container);
      }

      this.fire('add');

      map.on({
        'viewreset': this.projectLatlngs,
        'moveend': this._updatePath
      }, this);
    },

    addTo: function (map) {
      map.addLayer(this);
      return this;
    },

    onRemove: function (map) {
      map._pathRoot.removeChild(this._container);

      // Need to fire remove event before we set _map to null as the event hooks might need the object
      this.fire('remove');
      this._map = null;

      if (L.Browser.vml) {
        this._container = null;
        this._stroke = null;
        this._fill = null;
      }

      map.off({
        'viewreset': this.projectLatlngs,
        'moveend': this._updatePath
      }, this);
    },

    projectLatlngs: function () {
      // do all projection stuff here
    },

    setStyle: function (style) {
      L.setOptions(this, style);

      if (this._container) {
        this._updateStyle();
      }

      return this;
    },

    redraw: function () {
      if (this._map) {
        this.projectLatlngs();
        this._updatePath();
      }
      return this;
    }
  });

  L.Map.include({
    _updatePathViewport: function () {
      var p = L.Path.CLIP_PADDING,
          size = this.getSize(),
          panePos = L.DomUtil.getPosition(this._mapPane),
          min = panePos.multiplyBy(-1)._subtract(size.multiplyBy(p)._round()),
          max = min.add(size.multiplyBy(1 + p * 2)._round());

      this._pathViewport = new L.Bounds(min, max);
    }
  });


  /*
   * Extends L.Path with SVG-specific rendering code.
   */

  L.Path.SVG_NS = 'http://www.w3.org/2000/svg';

  L.Browser.svg = !!(document.createElementNS && document.createElementNS(L.Path.SVG_NS, 'svg').createSVGRect);

  L.Path = L.Path.extend({
    statics: {
      SVG: L.Browser.svg
    },

    bringToFront: function () {
      var root = this._map._pathRoot,
          path = this._container;

      if (path && root.lastChild !== path) {
        root.appendChild(path);
      }
      return this;
    },

    bringToBack: function () {
      var root = this._map._pathRoot,
          path = this._container,
          first = root.firstChild;

      if (path && first !== path) {
        root.insertBefore(path, first);
      }
      return this;
    },

    getPathString: function () {
      // form path string here
    },

    _createElement: function (name) {
      return document.createElementNS(L.Path.SVG_NS, name);
    },

    _initElements: function () {
      this._map._initPathRoot();
      this._initPath();
      this._initStyle();
    },

    _initPath: function () {
      this._container = this._createElement('g');

      this._path = this._createElement('path');

      if (this.options.className) {
        L.DomUtil.addClass(this._path, this.options.className);
      }

      this._container.appendChild(this._path);
    },

    _initStyle: function () {
      if (this.options.stroke) {
        this._path.setAttribute('stroke-linejoin', 'round');
        this._path.setAttribute('stroke-linecap', 'round');
      }
      if (this.options.fill) {
        this._path.setAttribute('fill-rule', 'evenodd');
      }
      if (this.options.pointerEvents) {
        this._path.setAttribute('pointer-events', this.options.pointerEvents);
      }
      if (!this.options.clickable && !this.options.pointerEvents) {
        this._path.setAttribute('pointer-events', 'none');
      }
      this._updateStyle();
    },

    _updateStyle: function () {
      if (this.options.stroke) {
        this._path.setAttribute('stroke', this.options.color);
        this._path.setAttribute('stroke-opacity', this.options.opacity);
        this._path.setAttribute('stroke-width', this.options.weight);
        if (this.options.dashArray) {
          this._path.setAttribute('stroke-dasharray', this.options.dashArray);
        } else {
          this._path.removeAttribute('stroke-dasharray');
        }
        if (this.options.lineCap) {
          this._path.setAttribute('stroke-linecap', this.options.lineCap);
        }
        if (this.options.lineJoin) {
          this._path.setAttribute('stroke-linejoin', this.options.lineJoin);
        }
      } else {
        this._path.setAttribute('stroke', 'none');
      }
      if (this.options.fill) {
        this._path.setAttribute('fill', this.options.fillColor || this.options.color);
        this._path.setAttribute('fill-opacity', this.options.fillOpacity);
      } else {
        this._path.setAttribute('fill', 'none');
      }
    },

    _updatePath: function () {
      var str = this.getPathString();
      if (!str) {
        // fix webkit empty string parsing bug
        str = 'M0 0';
      }
      this._path.setAttribute('d', str);
    },

    // TODO remove duplication with L.Map
    _initEvents: function () {
      if (this.options.clickable) {
        if (L.Browser.svg || !L.Browser.vml) {
          L.DomUtil.addClass(this._path, 'leaflet-clickable');
        }

        L.DomEvent.on(this._container, 'click', this._onMouseClick, this);

        var events = ['dblclick', 'mousedown', 'mouseover',
                      'mouseout', 'mousemove', 'contextmenu'];
        for (var i = 0; i < events.length; i++) {
          L.DomEvent.on(this._container, events[i], this._fireMouseEvent, this);
        }
      }
    },

    _onMouseClick: function (e) {
      if (this._map.dragging && this._map.dragging.moved()) { return; }

      this._fireMouseEvent(e);
    },

    _fireMouseEvent: function (e) {
      if (!this.hasEventListeners(e.type)) { return; }

      var map = this._map,
          containerPoint = map.mouseEventToContainerPoint(e),
          layerPoint = map.containerPointToLayerPoint(containerPoint),
          latlng = map.layerPointToLatLng(layerPoint);

      this.fire(e.type, {
        latlng: latlng,
        layerPoint: layerPoint,
        containerPoint: containerPoint,
        originalEvent: e
      });

      if (e.type === 'contextmenu') {
        L.DomEvent.preventDefault(e);
      }
      if (e.type !== 'mousemove') {
        L.DomEvent.stopPropagation(e);
      }
    }
  });

  L.Map.include({
    _initPathRoot: function () {
      if (!this._pathRoot) {
        this._pathRoot = L.Path.prototype._createElement('svg');
        this._panes.overlayPane.appendChild(this._pathRoot);

        if (this.options.zoomAnimation && L.Browser.any3d) {
          L.DomUtil.addClass(this._pathRoot, 'leaflet-zoom-animated');

          this.on({
            'zoomanim': this._animatePathZoom,
            'zoomend': this._endPathZoom
          });
        } else {
          L.DomUtil.addClass(this._pathRoot, 'leaflet-zoom-hide');
        }

        this.on('moveend', this._updateSvgViewport);
        this._updateSvgViewport();
      }
    },

    _animatePathZoom: function (e) {
      var scale = this.getZoomScale(e.zoom),
          offset = this._getCenterOffset(e.center)._multiplyBy(-scale)._add(this._pathViewport.min);

      this._pathRoot.style[L.DomUtil.TRANSFORM] =
              L.DomUtil.getTranslateString(offset) + ' scale(' + scale + ') ';

      this._pathZooming = true;
    },

    _endPathZoom: function () {
      this._pathZooming = false;
    },

    _updateSvgViewport: function () {

      if (this._pathZooming) {
        // Do not update SVGs while a zoom animation is going on otherwise the animation will break.
        // When the zoom animation ends we will be updated again anyway
        // This fixes the case where you do a momentum move and zoom while the move is still ongoing.
        return;
      }

      this._updatePathViewport();

      var vp = this._pathViewport,
          min = vp.min,
          max = vp.max,
          width = max.x - min.x,
          height = max.y - min.y,
          root = this._pathRoot,
          pane = this._panes.overlayPane;

      // Hack to make flicker on drag end on mobile webkit less irritating
      if (L.Browser.mobileWebkit) {
        pane.removeChild(root);
      }

      L.DomUtil.setPosition(root, min);
      root.setAttribute('width', width);
      root.setAttribute('height', height);
      root.setAttribute('viewBox', [min.x, min.y, width, height].join(' '));

      if (L.Browser.mobileWebkit) {
        pane.appendChild(root);
      }
    }
  });


  /*
   * Popup extension to L.Path (polylines, polygons, circles), adding popup-related methods.
   */

  L.Path.include({

    bindPopup: function (content, options) {

      if (content instanceof L.Popup) {
        this._popup = content;
      } else {
        if (!this._popup || options) {
          this._popup = new L.Popup(options, this);
        }
        this._popup.setContent(content);
      }

      if (!this._popupHandlersAdded) {
        this
            .on('click', this._openPopup, this)
            .on('remove', this.closePopup, this);

        this._popupHandlersAdded = true;
      }

      return this;
    },

    unbindPopup: function () {
      if (this._popup) {
        this._popup = null;
        this
            .off('click', this._openPopup)
            .off('remove', this.closePopup);

        this._popupHandlersAdded = false;
      }
      return this;
    },

    openPopup: function (latlng) {

      if (this._popup) {
        // open the popup from one of the path's points if not specified
        latlng = latlng || this._latlng ||
                 this._latlngs[Math.floor(this._latlngs.length / 2)];

        this._openPopup({ latlng: latlng });
      }

      return this;
    },

    closePopup: function () {
      if (this._popup) {
        this._popup._close();
      }
      return this;
    },

    _openPopup: function (e) {
      this._popup.setLatLng(e.latlng);
      this._map.openPopup(this._popup);
    }
  });


  /*
   * Vector rendering for IE6-8 through VML.
   * Thanks to Dmitry Baranovsky and his Raphael library for inspiration!
   */

  L.Browser.vml = !L.Browser.svg && (function () {
    try {
      var div = document.createElement('div');
      div.innerHTML = '<v:shape adj="1"/>';

      var shape = div.firstChild;
      shape.style.behavior = 'url(#default#VML)';

      return shape && (typeof shape.adj === 'object');

    } catch (e) {
      return false;
    }
  }());

  L.Path = L.Browser.svg || !L.Browser.vml ? L.Path : L.Path.extend({
    statics: {
      VML: true,
      CLIP_PADDING: 0.02
    },

    _createElement: (function () {
      try {
        document.namespaces.add('lvml', 'urn:schemas-microsoft-com:vml');
        return function (name) {
          return document.createElement('<lvml:' + name + ' class="lvml">');
        };
      } catch (e) {
        return function (name) {
          return document.createElement(
                  '<' + name + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">');
        };
      }
    }()),

    _initPath: function () {
      var container = this._container = this._createElement('shape');

      L.DomUtil.addClass(container, 'leaflet-vml-shape' +
        (this.options.className ? ' ' + this.options.className : ''));

      if (this.options.clickable) {
        L.DomUtil.addClass(container, 'leaflet-clickable');
      }

      container.coordsize = '1 1';

      this._path = this._createElement('path');
      container.appendChild(this._path);

      this._map._pathRoot.appendChild(container);
    },

    _initStyle: function () {
      this._updateStyle();
    },

    _updateStyle: function () {
      var stroke = this._stroke,
          fill = this._fill,
          options = this.options,
          container = this._container;

      container.stroked = options.stroke;
      container.filled = options.fill;

      if (options.stroke) {
        if (!stroke) {
          stroke = this._stroke = this._createElement('stroke');
          stroke.endcap = 'round';
          container.appendChild(stroke);
        }
        stroke.weight = options.weight + 'px';
        stroke.color = options.color;
        stroke.opacity = options.opacity;

        if (options.dashArray) {
          stroke.dashStyle = L.Util.isArray(options.dashArray) ?
              options.dashArray.join(' ') :
              options.dashArray.replace(/( *, *)/g, ' ');
        } else {
          stroke.dashStyle = '';
        }
        if (options.lineCap) {
          stroke.endcap = options.lineCap.replace('butt', 'flat');
        }
        if (options.lineJoin) {
          stroke.joinstyle = options.lineJoin;
        }

      } else if (stroke) {
        container.removeChild(stroke);
        this._stroke = null;
      }

      if (options.fill) {
        if (!fill) {
          fill = this._fill = this._createElement('fill');
          container.appendChild(fill);
        }
        fill.color = options.fillColor || options.color;
        fill.opacity = options.fillOpacity;

      } else if (fill) {
        container.removeChild(fill);
        this._fill = null;
      }
    },

    _updatePath: function () {
      var style = this._container.style;

      style.display = 'none';
      this._path.v = this.getPathString() + ' '; // the space fixes IE empty path string bug
      style.display = '';
    }
  });

  L.Map.include(L.Browser.svg || !L.Browser.vml ? {} : {
    _initPathRoot: function () {
      if (this._pathRoot) { return; }

      var root = this._pathRoot = document.createElement('div');
      root.className = 'leaflet-vml-container';
      this._panes.overlayPane.appendChild(root);

      this.on('moveend', this._updatePathViewport);
      this._updatePathViewport();
    }
  });


  /*
   * Vector rendering for all browsers that support canvas.
   */

  L.Browser.canvas = (function () {
    return !!document.createElement('canvas').getContext;
  }());

  L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path : L.Path.extend({
    statics: {
      //CLIP_PADDING: 0.02, // not sure if there's a need to set it to a small value
      CANVAS: true,
      SVG: false
    },

    redraw: function () {
      if (this._map) {
        this.projectLatlngs();
        this._requestUpdate();
      }
      return this;
    },

    setStyle: function (style) {
      L.setOptions(this, style);

      if (this._map) {
        this._updateStyle();
        this._requestUpdate();
      }
      return this;
    },

    onRemove: function (map) {
      map
          .off('viewreset', this.projectLatlngs, this)
          .off('moveend', this._updatePath, this);

      if (this.options.clickable) {
        this._map.off('click', this._onClick, this);
        this._map.off('mousemove', this._onMouseMove, this);
      }

      this._requestUpdate();

      this.fire('remove');
      this._map = null;
    },

    _requestUpdate: function () {
      if (this._map && !L.Path._updateRequest) {
        L.Path._updateRequest = L.Util.requestAnimFrame(this._fireMapMoveEnd, this._map);
      }
    },

    _fireMapMoveEnd: function () {
      L.Path._updateRequest = null;
      this.fire('moveend');
    },

    _initElements: function () {
      this._map._initPathRoot();
      this._ctx = this._map._canvasCtx;
    },

    _updateStyle: function () {
      var options = this.options;

      if (options.stroke) {
        this._ctx.lineWidth = options.weight;
        this._ctx.strokeStyle = options.color;
      }
      if (options.fill) {
        this._ctx.fillStyle = options.fillColor || options.color;
      }
    },

    _drawPath: function () {
      var i, j, len, len2, point, drawMethod;

      this._ctx.beginPath();

      for (i = 0, len = this._parts.length; i < len; i++) {
        for (j = 0, len2 = this._parts[i].length; j < len2; j++) {
          point = this._parts[i][j];
          drawMethod = (j === 0 ? 'move' : 'line') + 'To';

          this._ctx[drawMethod](point.x, point.y);
        }
        // TODO refactor ugly hack
        if (this instanceof L.Polygon) {
          this._ctx.closePath();
        }
      }
    },

    _checkIfEmpty: function () {
      return !this._parts.length;
    },

    _updatePath: function () {
      if (this._checkIfEmpty()) { return; }

      var ctx = this._ctx,
          options = this.options;

      this._drawPath();
      ctx.save();
      this._updateStyle();

      if (options.fill) {
        ctx.globalAlpha = options.fillOpacity;
        ctx.fill();
      }

      if (options.stroke) {
        ctx.globalAlpha = options.opacity;
        ctx.stroke();
      }

      ctx.restore();

      // TODO optimization: 1 fill/stroke for all features with equal style instead of 1 for each feature
    },

    _initEvents: function () {
      if (this.options.clickable) {
        // TODO dblclick
        this._map.on('mousemove', this._onMouseMove, this);
        this._map.on('click', this._onClick, this);
      }
    },

    _onClick: function (e) {
      if (this._containsPoint(e.layerPoint)) {
        this.fire('click', e);
      }
    },

    _onMouseMove: function (e) {
      if (!this._map || this._map._animatingZoom) { return; }

      // TODO don't do on each move
      if (this._containsPoint(e.layerPoint)) {
        this._ctx.canvas.style.cursor = 'pointer';
        this._mouseInside = true;
        this.fire('mouseover', e);

      } else if (this._mouseInside) {
        this._ctx.canvas.style.cursor = '';
        this._mouseInside = false;
        this.fire('mouseout', e);
      }
    }
  });

  L.Map.include((L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? {} : {
    _initPathRoot: function () {
      var root = this._pathRoot,
          ctx;

      if (!root) {
        root = this._pathRoot = document.createElement('canvas');
        root.style.position = 'absolute';
        ctx = this._canvasCtx = root.getContext('2d');

        ctx.lineCap = 'round';
        ctx.lineJoin = 'round';

        this._panes.overlayPane.appendChild(root);

        if (this.options.zoomAnimation) {
          this._pathRoot.className = 'leaflet-zoom-animated';
          this.on('zoomanim', this._animatePathZoom);
          this.on('zoomend', this._endPathZoom);
        }
        this.on('moveend', this._updateCanvasViewport);
        this._updateCanvasViewport();
      }
    },

    _updateCanvasViewport: function () {
      // don't redraw while zooming. See _updateSvgViewport for more details
      if (this._pathZooming) { return; }
      this._updatePathViewport();

      var vp = this._pathViewport,
          min = vp.min,
          size = vp.max.subtract(min),
          root = this._pathRoot;

      //TODO check if this works properly on mobile webkit
      L.DomUtil.setPosition(root, min);
      root.width = size.x;
      root.height = size.y;
      root.getContext('2d').translate(-min.x, -min.y);
    }
  });


  /*
   * L.LineUtil contains different utility functions for line segments
   * and polylines (clipping, simplification, distances, etc.)
   */

  /*jshint bitwise:false */ // allow bitwise operations for this file

  L.LineUtil = {

    // Simplify polyline with vertex reduction and Douglas-Peucker simplification.
    // Improves rendering performance dramatically by lessening the number of points to draw.

    simplify: function (/*Point[]*/ points, /*Number*/ tolerance) {
      if (!tolerance || !points.length) {
        return points.slice();
      }

      var sqTolerance = tolerance * tolerance;

      // stage 1: vertex reduction
      points = this._reducePoints(points, sqTolerance);

      // stage 2: Douglas-Peucker simplification
      points = this._simplifyDP(points, sqTolerance);

      return points;
    },

    // distance from a point to a segment between two points
    pointToSegmentDistance: function (/*Point*/ p, /*Point*/ p1, /*Point*/ p2) {
      return Math.sqrt(this._sqClosestPointOnSegment(p, p1, p2, true));
    },

    closestPointOnSegment: function (/*Point*/ p, /*Point*/ p1, /*Point*/ p2) {
      return this._sqClosestPointOnSegment(p, p1, p2);
    },

    // Douglas-Peucker simplification, see http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm
    _simplifyDP: function (points, sqTolerance) {

      var len = points.length,
          ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array,
          markers = new ArrayConstructor(len);

      markers[0] = markers[len - 1] = 1;

      this._simplifyDPStep(points, markers, sqTolerance, 0, len - 1);

      var i,
          newPoints = [];

      for (i = 0; i < len; i++) {
        if (markers[i]) {
          newPoints.push(points[i]);
        }
      }

      return newPoints;
    },

    _simplifyDPStep: function (points, markers, sqTolerance, first, last) {

      var maxSqDist = 0,
          index, i, sqDist;

      for (i = first + 1; i <= last - 1; i++) {
        sqDist = this._sqClosestPointOnSegment(points[i], points[first], points[last], true);

        if (sqDist > maxSqDist) {
          index = i;
          maxSqDist = sqDist;
        }
      }

      if (maxSqDist > sqTolerance) {
        markers[index] = 1;

        this._simplifyDPStep(points, markers, sqTolerance, first, index);
        this._simplifyDPStep(points, markers, sqTolerance, index, last);
      }
    },

    // reduce points that are too close to each other to a single point
    _reducePoints: function (points, sqTolerance) {
      var reducedPoints = [points[0]];

      for (var i = 1, prev = 0, len = points.length; i < len; i++) {
        if (this._sqDist(points[i], points[prev]) > sqTolerance) {
          reducedPoints.push(points[i]);
          prev = i;
        }
      }
      if (prev < len - 1) {
        reducedPoints.push(points[len - 1]);
      }
      return reducedPoints;
    },

    // Cohen-Sutherland line clipping algorithm.
    // Used to avoid rendering parts of a polyline that are not currently visible.

    clipSegment: function (a, b, bounds, useLastCode) {
      var codeA = useLastCode ? this._lastCode : this._getBitCode(a, bounds),
          codeB = this._getBitCode(b, bounds),

          codeOut, p, newCode;

      // save 2nd code to avoid calculating it on the next segment
      this._lastCode = codeB;

      while (true) {
        // if a,b is inside the clip window (trivial accept)
        if (!(codeA | codeB)) {
          return [a, b];
          // if a,b is outside the clip window (trivial reject)
        } else if (codeA & codeB) {
          return false;
          // other cases
        } else {
          codeOut = codeA || codeB;
          p = this._getEdgeIntersection(a, b, codeOut, bounds);
          newCode = this._getBitCode(p, bounds);

          if (codeOut === codeA) {
            a = p;
            codeA = newCode;
          } else {
            b = p;
            codeB = newCode;
          }
        }
      }
    },

    _getEdgeIntersection: function (a, b, code, bounds) {
      var dx = b.x - a.x,
          dy = b.y - a.y,
          min = bounds.min,
          max = bounds.max;

      if (code & 8) { // top
        return new L.Point(a.x + dx * (max.y - a.y) / dy, max.y);
      } else if (code & 4) { // bottom
        return new L.Point(a.x + dx * (min.y - a.y) / dy, min.y);
      } else if (code & 2) { // right
        return new L.Point(max.x, a.y + dy * (max.x - a.x) / dx);
      } else if (code & 1) { // left
        return new L.Point(min.x, a.y + dy * (min.x - a.x) / dx);
      }
    },

    _getBitCode: function (/*Point*/ p, bounds) {
      var code = 0;

      if (p.x < bounds.min.x) { // left
        code |= 1;
      } else if (p.x > bounds.max.x) { // right
        code |= 2;
      }
      if (p.y < bounds.min.y) { // bottom
        code |= 4;
      } else if (p.y > bounds.max.y) { // top
        code |= 8;
      }

      return code;
    },

    // square distance (to avoid unnecessary Math.sqrt calls)
    _sqDist: function (p1, p2) {
      var dx = p2.x - p1.x,
          dy = p2.y - p1.y;
      return dx * dx + dy * dy;
    },

    // return closest point on segment or distance to that point
    _sqClosestPointOnSegment: function (p, p1, p2, sqDist) {
      var x = p1.x,
          y = p1.y,
          dx = p2.x - x,
          dy = p2.y - y,
          dot = dx * dx + dy * dy,
          t;

      if (dot > 0) {
        t = ((p.x - x) * dx + (p.y - y) * dy) / dot;

        if (t > 1) {
          x = p2.x;
          y = p2.y;
        } else if (t > 0) {
          x += dx * t;
          y += dy * t;
        }
      }

      dx = p.x - x;
      dy = p.y - y;

      return sqDist ? dx * dx + dy * dy : new L.Point(x, y);
    }
  };


  /*
   * L.Polyline is used to display polylines on a map.
   */

  L.Polyline = L.Path.extend({
    initialize: function (latlngs, options) {
      L.Path.prototype.initialize.call(this, options);

      this._latlngs = this._convertLatLngs(latlngs);
    },

    options: {
      // how much to simplify the polyline on each zoom level
      // more = better performance and smoother look, less = more accurate
      smoothFactor: 1.0,
      noClip: false
    },

    projectLatlngs: function () {
      this._originalPoints = [];

      for (var i = 0, len = this._latlngs.length; i < len; i++) {
        this._originalPoints[i] = this._map.latLngToLayerPoint(this._latlngs[i]);
      }
    },

    getPathString: function () {
      for (var i = 0, len = this._parts.length, str = ''; i < len; i++) {
        str += this._getPathPartStr(this._parts[i]);
      }
      return str;
    },

    getLatLngs: function () {
      return this._latlngs;
    },

    setLatLngs: function (latlngs) {
      this._latlngs = this._convertLatLngs(latlngs);
      return this.redraw();
    },

    addLatLng: function (latlng) {
      this._latlngs.push(L.latLng(latlng));
      return this.redraw();
    },

    spliceLatLngs: function () { // (Number index, Number howMany)
      var removed = [].splice.apply(this._latlngs, arguments);
      this._convertLatLngs(this._latlngs, true);
      this.redraw();
      return removed;
    },

    closestLayerPoint: function (p) {
      var minDistance = Infinity, parts = this._parts, p1, p2, minPoint = null;

      for (var j = 0, jLen = parts.length; j < jLen; j++) {
        var points = parts[j];
        for (var i = 1, len = points.length; i < len; i++) {
          p1 = points[i - 1];
          p2 = points[i];
          var sqDist = L.LineUtil._sqClosestPointOnSegment(p, p1, p2, true);
          if (sqDist < minDistance) {
            minDistance = sqDist;
            minPoint = L.LineUtil._sqClosestPointOnSegment(p, p1, p2);
          }
        }
      }
      if (minPoint) {
        minPoint.distance = Math.sqrt(minDistance);
      }
      return minPoint;
    },

    getBounds: function () {
      return new L.LatLngBounds(this.getLatLngs());
    },

    _convertLatLngs: function (latlngs, overwrite) {
      var i, len, target = overwrite ? latlngs : [];

      for (i = 0, len = latlngs.length; i < len; i++) {
        if (L.Util.isArray(latlngs[i]) && typeof latlngs[i][0] !== 'number') {
          return;
        }
        target[i] = L.latLng(latlngs[i]);
      }
      return target;
    },

    _initEvents: function () {
      L.Path.prototype._initEvents.call(this);
    },

    _getPathPartStr: function (points) {
      var round = L.Path.VML;

      for (var j = 0, len2 = points.length, str = '', p; j < len2; j++) {
        p = points[j];
        if (round) {
          p._round();
        }
        str += (j ? 'L' : 'M') + p.x + ' ' + p.y;
      }
      return str;
    },

    _clipPoints: function () {
      var points = this._originalPoints,
          len = points.length,
          i, k, segment;

      if (this.options.noClip) {
        this._parts = [points];
        return;
      }

      this._parts = [];

      var parts = this._parts,
          vp = this._map._pathViewport,
          lu = L.LineUtil;

      for (i = 0, k = 0; i < len - 1; i++) {
        segment = lu.clipSegment(points[i], points[i + 1], vp, i);
        if (!segment) {
          continue;
        }

        parts[k] = parts[k] || [];
        parts[k].push(segment[0]);

        // if segment goes out of screen, or it's the last one, it's the end of the line part
        if ((segment[1] !== points[i + 1]) || (i === len - 2)) {
          parts[k].push(segment[1]);
          k++;
        }
      }
    },

    // simplify each clipped part of the polyline
    _simplifyPoints: function () {
      var parts = this._parts,
          lu = L.LineUtil;

      for (var i = 0, len = parts.length; i < len; i++) {
        parts[i] = lu.simplify(parts[i], this.options.smoothFactor);
      }
    },

    _updatePath: function () {
      if (!this._map) { return; }

      this._clipPoints();
      this._simplifyPoints();

      L.Path.prototype._updatePath.call(this);
    }
  });

  L.polyline = function (latlngs, options) {
    return new L.Polyline(latlngs, options);
  };


  /*
   * L.PolyUtil contains utility functions for polygons (clipping, etc.).
   */

  /*jshint bitwise:false */ // allow bitwise operations here

  L.PolyUtil = {};

  /*
   * Sutherland-Hodgeman polygon clipping algorithm.
   * Used to avoid rendering parts of a polygon that are not currently visible.
   */
  L.PolyUtil.clipPolygon = function (points, bounds) {
    var clippedPoints,
        edges = [1, 4, 2, 8],
        i, j, k,
        a, b,
        len, edge, p,
        lu = L.LineUtil;

    for (i = 0, len = points.length; i < len; i++) {
      points[i]._code = lu._getBitCode(points[i], bounds);
    }

    // for each edge (left, bottom, right, top)
    for (k = 0; k < 4; k++) {
      edge = edges[k];
      clippedPoints = [];

      for (i = 0, len = points.length, j = len - 1; i < len; j = i++) {
        a = points[i];
        b = points[j];

        // if a is inside the clip window
        if (!(a._code & edge)) {
          // if b is outside the clip window (a->b goes out of screen)
          if (b._code & edge) {
            p = lu._getEdgeIntersection(b, a, edge, bounds);
            p._code = lu._getBitCode(p, bounds);
            clippedPoints.push(p);
          }
          clippedPoints.push(a);

          // else if b is inside the clip window (a->b enters the screen)
        } else if (!(b._code & edge)) {
          p = lu._getEdgeIntersection(b, a, edge, bounds);
          p._code = lu._getBitCode(p, bounds);
          clippedPoints.push(p);
        }
      }
      points = clippedPoints;
    }

    return points;
  };


  /*
   * L.Polygon is used to display polygons on a map.
   */

  L.Polygon = L.Polyline.extend({
    options: {
      fill: true
    },

    initialize: function (latlngs, options) {
      L.Polyline.prototype.initialize.call(this, latlngs, options);
      this._initWithHoles(latlngs);
    },

    _initWithHoles: function (latlngs) {
      var i, len, hole;
      if (latlngs && L.Util.isArray(latlngs[0]) && (typeof latlngs[0][0] !== 'number')) {
        this._latlngs = this._convertLatLngs(latlngs[0]);
        this._holes = latlngs.slice(1);

        for (i = 0, len = this._holes.length; i < len; i++) {
          hole = this._holes[i] = this._convertLatLngs(this._holes[i]);
          if (hole[0].equals(hole[hole.length - 1])) {
            hole.pop();
          }
        }
      }

      // filter out last point if its equal to the first one
      latlngs = this._latlngs;

      if (latlngs.length >= 2 && latlngs[0].equals(latlngs[latlngs.length - 1])) {
        latlngs.pop();
      }
    },

    projectLatlngs: function () {
      L.Polyline.prototype.projectLatlngs.call(this);

      // project polygon holes points
      // TODO move this logic to Polyline to get rid of duplication
      this._holePoints = [];

      if (!this._holes) { return; }

      var i, j, len, len2;

      for (i = 0, len = this._holes.length; i < len; i++) {
        this._holePoints[i] = [];

        for (j = 0, len2 = this._holes[i].length; j < len2; j++) {
          this._holePoints[i][j] = this._map.latLngToLayerPoint(this._holes[i][j]);
        }
      }
    },

    setLatLngs: function (latlngs) {
      if (latlngs && L.Util.isArray(latlngs[0]) && (typeof latlngs[0][0] !== 'number')) {
        this._initWithHoles(latlngs);
        return this.redraw();
      } else {
        return L.Polyline.prototype.setLatLngs.call(this, latlngs);
      }
    },

    _clipPoints: function () {
      var points = this._originalPoints,
          newParts = [];

      this._parts = [points].concat(this._holePoints);

      if (this.options.noClip) { return; }

      for (var i = 0, len = this._parts.length; i < len; i++) {
        var clipped = L.PolyUtil.clipPolygon(this._parts[i], this._map._pathViewport);
        if (clipped.length) {
          newParts.push(clipped);
        }
      }

      this._parts = newParts;
    },

    _getPathPartStr: function (points) {
      var str = L.Polyline.prototype._getPathPartStr.call(this, points);
      return str + (L.Browser.svg ? 'z' : 'x');
    }
  });

  L.polygon = function (latlngs, options) {
    return new L.Polygon(latlngs, options);
  };


  /*
   * Contains L.MultiPolyline and L.MultiPolygon layers.
   */

  (function () {
    function createMulti(Klass) {

      return L.FeatureGroup.extend({

        initialize: function (latlngs, options) {
          this._layers = {};
          this._options = options;
          this.setLatLngs(latlngs);
        },

        setLatLngs: function (latlngs) {
          var i = 0,
              len = latlngs.length;

          this.eachLayer(function (layer) {
            if (i < len) {
              layer.setLatLngs(latlngs[i++]);
            } else {
              this.removeLayer(layer);
            }
          }, this);

          while (i < len) {
            this.addLayer(new Klass(latlngs[i++], this._options));
          }

          return this;
        },

        getLatLngs: function () {
          var latlngs = [];

          this.eachLayer(function (layer) {
            latlngs.push(layer.getLatLngs());
          });

          return latlngs;
        }
      });
    }

    L.MultiPolyline = createMulti(L.Polyline);
    L.MultiPolygon = createMulti(L.Polygon);

    L.multiPolyline = function (latlngs, options) {
      return new L.MultiPolyline(latlngs, options);
    };

    L.multiPolygon = function (latlngs, options) {
      return new L.MultiPolygon(latlngs, options);
    };
  }());


  /*
   * L.Rectangle extends Polygon and creates a rectangle when passed a LatLngBounds object.
   */

  L.Rectangle = L.Polygon.extend({
    initialize: function (latLngBounds, options) {
      L.Polygon.prototype.initialize.call(this, this._boundsToLatLngs(latLngBounds), options);
    },

    setBounds: function (latLngBounds) {
      this.setLatLngs(this._boundsToLatLngs(latLngBounds));
    },

    _boundsToLatLngs: function (latLngBounds) {
      latLngBounds = L.latLngBounds(latLngBounds);
      return [
        latLngBounds.getSouthWest(),
        latLngBounds.getNorthWest(),
        latLngBounds.getNorthEast(),
        latLngBounds.getSouthEast()
      ];
    }
  });

  L.rectangle = function (latLngBounds, options) {
    return new L.Rectangle(latLngBounds, options);
  };


  /*
   * L.Circle is a circle overlay (with a certain radius in meters).
   */

  L.Circle = L.Path.extend({
    initialize: function (latlng, radius, options) {
      L.Path.prototype.initialize.call(this, options);

      this._latlng = L.latLng(latlng);
      this._mRadius = radius * 1.6; // workaround missing projection calculations #79814
    },

    options: {
      fill: true
    },

    setLatLng: function (latlng) {
      this._latlng = L.latLng(latlng);
      return this.redraw();
    },

    setRadius: function (radius) {
      this._mRadius = radius;
      return this.redraw();
    },

    projectLatlngs: function () {
      var lngRadius = this._getLngRadius(),
          latlng = this._latlng,
          pointLeft = this._map.latLngToLayerPoint([latlng.lat, latlng.lng - lngRadius]);

      this._point = this._map.latLngToLayerPoint(latlng);
      this._radius = Math.max(this._point.x - pointLeft.x, 1);
    },

    getBounds: function () {
      var lngRadius = this._getLngRadius(),
          latRadius = (this._mRadius / 40075017) * 360,
          latlng = this._latlng;

      return new L.LatLngBounds(
              [latlng.lat - latRadius, latlng.lng - lngRadius],
              [latlng.lat + latRadius, latlng.lng + lngRadius]);
    },

    getLatLng: function () {
      return this._latlng;
    },

    getPathString: function () {
      var p = this._point,
          r = this._radius;

      if (this._checkIfEmpty()) {
        return '';
      }

      if (L.Browser.svg) {
        return 'M' + p.x + ',' + (p.y - r) +
               'A' + r + ',' + r + ',0,1,1,' +
               (p.x - 0.1) + ',' + (p.y - r) + ' z';
      } else {
        p._round();
        r = Math.round(r);
        return 'AL ' + p.x + ',' + p.y + ' ' + r + ',' + r + ' 0,' + (65535 * 360);
      }
    },

    getRadius: function () {
      return this._mRadius;
    },

    // TODO Earth hardcoded, move into projection code!

    _getLatRadius: function () {
      //fix hardcoded earth https://stackoverflow.com/questions/31586577/leaflet-circle-radius-doesnt-matter
      return this._mRadius;
    },

    _getLngRadius: function () {
      //fix hardcoded earth https://stackoverflow.com/questions/31586577/leaflet-circle-radius-doesnt-matter
      return this._mRadius;
    },

    _checkIfEmpty: function () {
      if (!this._map) {
        return false;
      }
      var vp = this._map._pathViewport,
          r = this._radius,
          p = this._point;

      return p.x - r > vp.max.x || p.y - r > vp.max.y ||
             p.x + r < vp.min.x || p.y + r < vp.min.y;
    }
  });

  L.circle = function (latlng, radius, options) {
    return new L.Circle(latlng, radius, options);
  };


  /*
   * L.CircleMarker is a circle overlay with a permanent pixel radius.
   */

  L.CircleMarker = L.Circle.extend({
    options: {
      radius: 10,
      weight: 2
    },

    initialize: function (latlng, options) {
      L.Circle.prototype.initialize.call(this, latlng, null, options);
      this._radius = this.options.radius;
    },

    projectLatlngs: function () {
      this._point = this._map.latLngToLayerPoint(this._latlng);
    },

    _updateStyle: function () {
      L.Circle.prototype._updateStyle.call(this);
      this.setRadius(this.options.radius);
    },

    setLatLng: function (latlng) {
      L.Circle.prototype.setLatLng.call(this, latlng);
      if (this._popup && this._popup._isOpen) {
        this._popup.setLatLng(latlng);
      }
      return this;
    },

    setRadius: function (radius) {
      this.options.radius = this._radius = radius;
      return this.redraw();
    },

    getRadius: function () {
      return this._radius;
    }
  });

  L.circleMarker = function (latlng, options) {
    return new L.CircleMarker(latlng, options);
  };


  /*
   * Extends L.Polyline to be able to manually detect clicks on Canvas-rendered polylines.
   */

  L.Polyline.include(!L.Path.CANVAS ? {} : {
    _containsPoint: function (p, closed) {
      var i, j, k, len, len2, dist, part,
          w = this.options.weight / 2;

      if (L.Browser.touch) {
        w += 10; // polyline click tolerance on touch devices
      }

      for (i = 0, len = this._parts.length; i < len; i++) {
        part = this._parts[i];
        for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
          if (!closed && (j === 0)) {
            continue;
          }

          dist = L.LineUtil.pointToSegmentDistance(p, part[k], part[j]);

          if (dist <= w) {
            return true;
          }
        }
      }
      return false;
    }
  });


  /*
   * Extends L.Polygon to be able to manually detect clicks on Canvas-rendered polygons.
   */

  L.Polygon.include(!L.Path.CANVAS ? {} : {
    _containsPoint: function (p) {
      var inside = false,
          part, p1, p2,
          i, j, k,
          len, len2;

      // TODO optimization: check if within bounds first

      if (L.Polyline.prototype._containsPoint.call(this, p, true)) {
        // click on polygon border
        return true;
      }

      // ray casting algorithm for detecting if point is in polygon

      for (i = 0, len = this._parts.length; i < len; i++) {
        part = this._parts[i];

        for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
          p1 = part[j];
          p2 = part[k];

          if (((p1.y > p.y) !== (p2.y > p.y)) &&
              (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) {
            inside = !inside;
          }
        }
      }

      return inside;
    }
  });


  /*
   * Extends L.Circle with Canvas-specific code.
   */

  L.Circle.include(!L.Path.CANVAS ? {} : {
    _drawPath: function () {
      var p = this._point;
      this._ctx.beginPath();
      this._ctx.arc(p.x, p.y, this._radius, 0, Math.PI * 2, false);
    },

    _containsPoint: function (p) {
      var center = this._point,
          w2 = this.options.stroke ? this.options.weight / 2 : 0;

      return (p.distanceTo(center) <= this._radius + w2);
    }
  });


  /*
   * CircleMarker canvas specific drawing parts.
   */

  L.CircleMarker.include(!L.Path.CANVAS ? {} : {
    _updateStyle: function () {
      L.Path.prototype._updateStyle.call(this);
    }
  });


  /*
   * L.GeoJSON turns any GeoJSON data into a Leaflet layer.
   */

  L.GeoJSON = L.FeatureGroup.extend({

    initialize: function (geojson, options) {
      L.setOptions(this, options);

      this._layers = {};

      if (geojson) {
        this.addData(geojson);
      }
    },

    addData: function (geojson) {
      var features = L.Util.isArray(geojson) ? geojson : geojson.features,
          i, len, feature;

      if (features) {
        for (i = 0, len = features.length; i < len; i++) {
          // Only add this if geometry or geometries are set and not null
          feature = features[i];
          if (feature.geometries || feature.geometry || feature.features || feature.coordinates) {
            this.addData(features[i]);
          }
        }
        return this;
      }

      var options = this.options;

      if (options.filter && !options.filter(geojson)) { return; }

      var layer = L.GeoJSON.geometryToLayer(geojson, options.pointToLayer, options.coordsToLatLng, options);
      layer.feature = L.GeoJSON.asFeature(geojson);

      layer.defaultOptions = layer.options;
      this.resetStyle(layer);

      if (options.onEachFeature) {
        options.onEachFeature(geojson, layer);
      }

      return this.addLayer(layer);
    },

    resetStyle: function (layer) {
      var style = this.options.style;
      if (style) {
        // reset any custom styles
        L.Util.extend(layer.options, layer.defaultOptions);

        this._setLayerStyle(layer, style);
      }
    },

    setStyle: function (style) {
      this.eachLayer(function (layer) {
        this._setLayerStyle(layer, style);
      }, this);
    },

    _setLayerStyle: function (layer, style) {
      if (typeof style === 'function') {
        style = style(layer.feature);
      }
      if (layer.setStyle) {
        layer.setStyle(style);
      }
    }
  });

  L.extend(L.GeoJSON, {
    geometryToLayer: function (geojson, pointToLayer, coordsToLatLng, vectorOptions) {
      var geometry = geojson.type === 'Feature' ? geojson.geometry : geojson,
          coords = geometry.coordinates,
          layers = [],
          latlng, latlngs, i, len;

      coordsToLatLng = coordsToLatLng || this.coordsToLatLng;

      switch (geometry.type) {
        case 'Point':
          latlng = coordsToLatLng(coords);
          return pointToLayer ? pointToLayer(geojson, latlng) : new L.Marker(latlng);

        case 'MultiPoint':
          for (i = 0, len = coords.length; i < len; i++) {
            latlng = coordsToLatLng(coords[i]);
            layers.push(pointToLayer ? pointToLayer(geojson, latlng) : new L.Marker(latlng));
          }
          return new L.FeatureGroup(layers);

        case 'LineString':
          latlngs = this.coordsToLatLngs(coords, 0, coordsToLatLng);
          return new L.Polyline(latlngs, vectorOptions);

        case 'Polygon':
          if (coords.length === 2 && !coords[1].length) {
            throw new Error('Invalid GeoJSON object.');
          }
          latlngs = this.coordsToLatLngs(coords, 1, coordsToLatLng);
          return new L.Polygon(latlngs, vectorOptions);

        case 'MultiLineString':
          latlngs = this.coordsToLatLngs(coords, 1, coordsToLatLng);
          return new L.MultiPolyline(latlngs, vectorOptions);

        case 'MultiPolygon':
          latlngs = this.coordsToLatLngs(coords, 2, coordsToLatLng);
          return new L.MultiPolygon(latlngs, vectorOptions);

        case 'GeometryCollection':
          for (i = 0, len = geometry.geometries.length; i < len; i++) {

            layers.push(this.geometryToLayer({
              geometry: geometry.geometries[i],
              type: 'Feature',
              properties: geojson.properties
            }, pointToLayer, coordsToLatLng, vectorOptions));
          }
          return new L.FeatureGroup(layers);

        default:
          throw new Error('Invalid GeoJSON object.');
      }
    },

    coordsToLatLng: function (coords) { // (Array[, Boolean]) -> LatLng
      return new L.LatLng(coords[1], coords[0], coords[2]);
    },

    coordsToLatLngs: function (coords, levelsDeep, coordsToLatLng) { // (Array[, Number, Function]) -> Array
      var latlng, i, len,
          latlngs = [];

      for (i = 0, len = coords.length; i < len; i++) {
        latlng = levelsDeep ?
                this.coordsToLatLngs(coords[i], levelsDeep - 1, coordsToLatLng) :
                (coordsToLatLng || this.coordsToLatLng)(coords[i]);

        latlngs.push(latlng);
      }

      return latlngs;
    },

    latLngToCoords: function (latlng) {
      var coords = [latlng.lng, latlng.lat];

      if (latlng.alt !== undefined) {
        coords.push(latlng.alt);
      }
      return coords;
    },

    latLngsToCoords: function (latLngs) {
      var coords = [];

      for (var i = 0, len = latLngs.length; i < len; i++) {
        coords.push(L.GeoJSON.latLngToCoords(latLngs[i]));
      }

      return coords;
    },

    getFeature: function (layer, newGeometry) {
      return layer.feature ? L.extend({}, layer.feature, { geometry: newGeometry }) : L.GeoJSON.asFeature(newGeometry);
    },

    asFeature: function (geoJSON) {
      if (geoJSON.type === 'Feature') {
        return geoJSON;
      }

      return {
        type: 'Feature',
        properties: {},
        geometry: geoJSON
      };
    }
  });

  var PointToGeoJSON = {
    toGeoJSON: function () {
      return L.GeoJSON.getFeature(this, {
        type: 'Point',
        coordinates: L.GeoJSON.latLngToCoords(this.getLatLng())
      });
    }
  };

  L.Marker.include(PointToGeoJSON);
  L.Circle.include(PointToGeoJSON);
  L.CircleMarker.include(PointToGeoJSON);

  L.Polyline.include({
    toGeoJSON: function () {
      return L.GeoJSON.getFeature(this, {
        type: 'LineString',
        coordinates: L.GeoJSON.latLngsToCoords(this.getLatLngs())
      });
    }
  });

  L.Polygon.include({
    toGeoJSON: function () {
      var coords = [L.GeoJSON.latLngsToCoords(this.getLatLngs())],
          i, len, hole;

      coords[0].push(coords[0][0]);

      if (this._holes) {
        for (i = 0, len = this._holes.length; i < len; i++) {
          hole = L.GeoJSON.latLngsToCoords(this._holes[i]);
          hole.push(hole[0]);
          coords.push(hole);
        }
      }

      return L.GeoJSON.getFeature(this, {
        type: 'Polygon',
        coordinates: coords
      });
    }
  });

  (function () {
    function multiToGeoJSON(type) {
      return function () {
        var coords = [];

        this.eachLayer(function (layer) {
          coords.push(layer.toGeoJSON().geometry.coordinates);
        });

        return L.GeoJSON.getFeature(this, {
          type: type,
          coordinates: coords
        });
      };
    }

    L.MultiPolyline.include({ toGeoJSON: multiToGeoJSON('MultiLineString') });
    L.MultiPolygon.include({ toGeoJSON: multiToGeoJSON('MultiPolygon') });

    L.LayerGroup.include({
      toGeoJSON: function () {

        var geometry = this.feature && this.feature.geometry,
          jsons = [],
          json;

        if (geometry && geometry.type === 'MultiPoint') {
          return multiToGeoJSON('MultiPoint').call(this);
        }

        var isGeometryCollection = geometry && geometry.type === 'GeometryCollection';

        this.eachLayer(function (layer) {
          if (layer.toGeoJSON) {
            json = layer.toGeoJSON();
            jsons.push(isGeometryCollection ? json.geometry : L.GeoJSON.asFeature(json));
          }
        });

        if (isGeometryCollection) {
          return L.GeoJSON.getFeature(this, {
            geometries: jsons,
            type: 'GeometryCollection'
          });
        }

        return {
          type: 'FeatureCollection',
          features: jsons
        };
      }
    });
  }());

  L.geoJson = function (geojson, options) {
    return new L.GeoJSON(geojson, options);
  };


  /*
   * L.DomEvent contains functions for working with DOM events.
   */

  L.DomEvent = {
    /* inspired by John Resig, Dean Edwards and YUI addEvent implementations */
    addListener: function (obj, type, fn, context) { // (HTMLElement, String, Function[, Object])

      var id = L.stamp(fn),
          key = '_leaflet_' + type + id,
          handler, originalHandler, newType;

      if (obj[key]) { return this; }

      handler = function (e) {
        return fn.call(context || obj, e || L.DomEvent._getEvent());
      };

      if (L.Browser.pointer && type.indexOf('touch') === 0) {
        return this.addPointerListener(obj, type, handler, id);
      }
      if (L.Browser.touch && (type === 'dblclick') && this.addDoubleTapListener) {
        this.addDoubleTapListener(obj, handler, id);
      }

      if ('addEventListener' in obj) {

        if (type === 'mousewheel') {
          obj.addEventListener('DOMMouseScroll', handler, false);
          obj.addEventListener(type, handler, false);

        } else if ((type === 'mouseenter') || (type === 'mouseleave')) {

          originalHandler = handler;
          newType = (type === 'mouseenter' ? 'mouseover' : 'mouseout');

          handler = function (e) {
            if (!L.DomEvent._checkMouse(obj, e)) { return; }
            return originalHandler(e);
          };

          obj.addEventListener(newType, handler, false);

        } else if (type === 'click' && L.Browser.android) {
          originalHandler = handler;
          handler = function (e) {
            return L.DomEvent._filterClick(e, originalHandler);
          };

          obj.addEventListener(type, handler, false);
        } else {
          obj.addEventListener(type, handler, false);
        }

      } else if ('attachEvent' in obj) {
        obj.attachEvent('on' + type, handler);
      }

      obj[key] = handler;

      return this;
    },

    removeListener: function (obj, type, fn) {  // (HTMLElement, String, Function)

      var id = L.stamp(fn),
          key = '_leaflet_' + type + id,
          handler = obj[key];

      if (!handler) { return this; }

      if (L.Browser.pointer && type.indexOf('touch') === 0) {
        this.removePointerListener(obj, type, id);
      } else if (L.Browser.touch && (type === 'dblclick') && this.removeDoubleTapListener) {
        this.removeDoubleTapListener(obj, id);

      } else if ('removeEventListener' in obj) {

        if (type === 'mousewheel') {
          obj.removeEventListener('DOMMouseScroll', handler, false);
          obj.removeEventListener(type, handler, false);

        } else if ((type === 'mouseenter') || (type === 'mouseleave')) {
          obj.removeEventListener((type === 'mouseenter' ? 'mouseover' : 'mouseout'), handler, false);
        } else {
          obj.removeEventListener(type, handler, false);
        }
      } else if ('detachEvent' in obj) {
        obj.detachEvent('on' + type, handler);
      }

      obj[key] = null;

      return this;
    },

    stopPropagation: function (e) {

      if (e.stopPropagation) {
        e.stopPropagation();
      } else {
        e.cancelBubble = true;
      }
      L.DomEvent._skipped(e);

      return this;
    },

    disableScrollPropagation: function (el) {
      var stop = L.DomEvent.stopPropagation;

      return L.DomEvent
        .on(el, 'mousewheel', stop)
        .on(el, 'MozMousePixelScroll', stop);
    },

    disableClickPropagation: function (el) {
      var stop = L.DomEvent.stopPropagation;

      for (var i = L.Draggable.START.length - 1; i >= 0; i--) {
        L.DomEvent.on(el, L.Draggable.START[i], stop);
      }

      return L.DomEvent
        .on(el, 'click', L.DomEvent._fakeStop)
        .on(el, 'dblclick', stop);
    },

    preventDefault: function (e) {

      if (e.preventDefault) {
        e.preventDefault();
      } else {
        e.returnValue = false;
      }
      return this;
    },

    stop: function (e) {
      return L.DomEvent
        .preventDefault(e)
        .stopPropagation(e);
    },

    getMousePosition: function (e, container) {
      if (!container) {
        return new L.Point(e.clientX, e.clientY);
      }

      var rect = container.getBoundingClientRect();

      return new L.Point(
        e.clientX - rect.left - container.clientLeft,
        e.clientY - rect.top - container.clientTop);
    },

    getWheelDelta: function (e) {

      var delta = 0;

      if (e.wheelDelta) {
        delta = e.wheelDelta / 120;
      }
      if (e.detail) {
        delta = -e.detail / 3;
      }
      return delta;
    },

    _skipEvents: {},

    _fakeStop: function (e) {
      // fakes stopPropagation by setting a special event flag, checked/reset with L.DomEvent._skipped(e)
      L.DomEvent._skipEvents[e.type] = true;
    },

    _skipped: function (e) {
      var skipped = this._skipEvents[e.type];
      // reset when checking, as it's only used in map container and propagates outside of the map
      this._skipEvents[e.type] = false;
      return skipped;
    },

    // check if element really left/entered the event target (for mouseenter/mouseleave)
    _checkMouse: function (el, e) {

      var related = e.relatedTarget;

      if (!related) { return true; }

      try {
        while (related && (related !== el)) {
          related = related.parentNode;
        }
      } catch (err) {
        return false;
      }
      return (related !== el);
    },

    _getEvent: function () { // evil magic for IE
      /*jshint noarg:false */
      var e = window.event;
      if (!e) {
        var caller = arguments.callee.caller;
        while (caller) {
          e = caller['arguments'][0];
          if (e && window.Event === e.constructor) {
            break;
          }
          caller = caller.caller;
        }
      }
      return e;
    },

    // this is a horrible workaround for a bug in Android where a single touch triggers two click events
    _filterClick: function (e, handler) {
      var timeStamp = (e.timeStamp || e.originalEvent.timeStamp),
        elapsed = L.DomEvent._lastClick && (timeStamp - L.DomEvent._lastClick);

      // are they closer together than 500ms yet more than 100ms?
      // Android typically triggers them ~300ms apart while multiple listeners
      // on the same event should be triggered far faster;
      // or check if click is simulated on the element, and if it is, reject any non-simulated events

      if ((elapsed && elapsed > 100 && elapsed < 500) || (e.target._simulatedClick && !e._simulated)) {
        L.DomEvent.stop(e);
        return;
      }
      L.DomEvent._lastClick = timeStamp;

      return handler(e);
    }
  };

  L.DomEvent.on = L.DomEvent.addListener;
  L.DomEvent.off = L.DomEvent.removeListener;


  /*
   * L.Draggable allows you to add dragging capabilities to any element. Supports mobile devices too.
   */

  L.Draggable = L.Class.extend({
    includes: L.Mixin.Events,

    statics: {
      START: L.Browser.touch ? ['touchstart', 'mousedown'] : ['mousedown'],
      END: {
        mousedown: 'mouseup',
        touchstart: 'touchend',
        pointerdown: 'touchend',
        MSPointerDown: 'touchend'
      },
      MOVE: {
        mousedown: 'mousemove',
        touchstart: 'touchmove',
        pointerdown: 'touchmove',
        MSPointerDown: 'touchmove'
      }
    },

    initialize: function (element, dragStartTarget) {
      this._element = element;
      this._dragStartTarget = dragStartTarget || element;
    },

    enable: function () {
      if (this._enabled) { return; }

      for (var i = L.Draggable.START.length - 1; i >= 0; i--) {
        L.DomEvent.on(this._dragStartTarget, L.Draggable.START[i], this._onDown, this);
      }

      this._enabled = true;
    },

    disable: function () {
      if (!this._enabled) { return; }

      for (var i = L.Draggable.START.length - 1; i >= 0; i--) {
        L.DomEvent.off(this._dragStartTarget, L.Draggable.START[i], this._onDown, this);
      }

      this._enabled = false;
      this._moved = false;
    },

    _onDown: function (e) {
      this._moved = false;

      if (e.shiftKey || ((e.which !== 1) && (e.button !== 1) && !e.touches)) { return; }

      L.DomEvent.stopPropagation(e);

      if (L.Draggable._disabled) { return; }

      L.DomUtil.disableImageDrag();
      L.DomUtil.disableTextSelection();

      if (this._moving) { return; }

      var first = e.touches ? e.touches[0] : e;

      this._startPoint = new L.Point(first.clientX, first.clientY);
      this._startPos = this._newPos = L.DomUtil.getPosition(this._element);

      L.DomEvent
          .on(document, L.Draggable.MOVE[e.type], this._onMove, this)
          .on(document, L.Draggable.END[e.type], this._onUp, this);
    },

    _onMove: function (e) {
      if (e.touches && e.touches.length > 1) {
        this._moved = true;
        return;
      }

      var first = (e.touches && e.touches.length === 1 ? e.touches[0] : e),
          newPoint = new L.Point(first.clientX, first.clientY),
          offset = newPoint.subtract(this._startPoint);

      if (!offset.x && !offset.y) { return; }
      if (L.Browser.touch && Math.abs(offset.x) + Math.abs(offset.y) < 3) { return; }

      L.DomEvent.preventDefault(e);

      if (!this._moved) {
        this.fire('dragstart');

        this._moved = true;
        this._startPos = L.DomUtil.getPosition(this._element).subtract(offset);

        L.DomUtil.addClass(document.body, 'leaflet-dragging');
        this._lastTarget = e.target || e.srcElement;
        L.DomUtil.addClass(this._lastTarget, 'leaflet-drag-target');
      }

      this._newPos = this._startPos.add(offset);
      this._moving = true;

      L.Util.cancelAnimFrame(this._animRequest);
      this._animRequest = L.Util.requestAnimFrame(this._updatePosition, this, true, this._dragStartTarget);
    },

    _updatePosition: function () {
      this.fire('predrag');
      L.DomUtil.setPosition(this._element, this._newPos);
      this.fire('drag');
    },

    _onUp: function () {
      L.DomUtil.removeClass(document.body, 'leaflet-dragging');

      if (this._lastTarget) {
        L.DomUtil.removeClass(this._lastTarget, 'leaflet-drag-target');
        this._lastTarget = null;
      }

      for (var i in L.Draggable.MOVE) {
        L.DomEvent
            .off(document, L.Draggable.MOVE[i], this._onMove)
            .off(document, L.Draggable.END[i], this._onUp);
      }

      L.DomUtil.enableImageDrag();
      L.DomUtil.enableTextSelection();

      if (this._moved && this._moving) {
        // ensure drag is not fired after dragend
        L.Util.cancelAnimFrame(this._animRequest);

        this.fire('dragend', {
          distance: this._newPos.distanceTo(this._startPos)
        });
      }

      this._moving = false;
    }
  });


  /*
    L.Handler is a base class for handler classes that are used internally to inject
    interaction features like dragging to classes like Map and Marker.
  */

  L.Handler = L.Class.extend({
    initialize: function (map) {
      this._map = map;
    },

    enable: function () {
      if (this._enabled) { return; }

      this._enabled = true;
      this.addHooks();
    },

    disable: function () {
      if (!this._enabled) { return; }

      this._enabled = false;
      this.removeHooks();
    },

    enabled: function () {
      return !!this._enabled;
    }
  });


  /*
   * L.Handler.MapDrag is used to make the map draggable (with panning inertia), enabled by default.
   */

  L.Map.mergeOptions({
    dragging: true,

    inertia: !L.Browser.android23,
    inertiaDeceleration: 3400, // px/s^2
    inertiaMaxSpeed: Infinity, // px/s
    inertiaThreshold: L.Browser.touch ? 32 : 18, // ms
    easeLinearity: 0.25,

    // TODO refactor, move to CRS
    worldCopyJump: false
  });

  L.Map.Drag = L.Handler.extend({
    addHooks: function () {
      if (!this._draggable) {
        var map = this._map;

        this._draggable = new L.Draggable(map._mapPane, map._container);

        this._draggable.on({
          'dragstart': this._onDragStart,
          'drag': this._onDrag,
          'dragend': this._onDragEnd
        }, this);

        if (map.options.worldCopyJump) {
          this._draggable.on('predrag', this._onPreDrag, this);
          map.on('viewreset', this._onViewReset, this);

          map.whenReady(this._onViewReset, this);
        }
      }
      this._draggable.enable();
    },

    removeHooks: function () {
      this._draggable.disable();
    },

    moved: function () {
      return this._draggable && this._draggable._moved;
    },

    _onDragStart: function () {
      var map = this._map;

      if (map._panAnim) {
        map._panAnim.stop();
      }

      map
          .fire('movestart')
          .fire('dragstart');

      if (map.options.inertia) {
        this._positions = [];
        this._times = [];
      }
    },

    _onDrag: function () {
      if (this._map.options.inertia) {
        var time = this._lastTime = +new Date(),
            pos = this._lastPos = this._draggable._newPos;

        this._positions.push(pos);
        this._times.push(time);

        if (time - this._times[0] > 200) {
          this._positions.shift();
          this._times.shift();
        }
      }

      this._map
          .fire('move')
          .fire('drag');
    },

    _onViewReset: function () {
      // TODO fix hardcoded Earth values
      var pxCenter = this._map.getSize()._divideBy(2),
          pxWorldCenter = this._map.latLngToLayerPoint([0, 0]);

      this._initialWorldOffset = pxWorldCenter.subtract(pxCenter).x;
      this._worldWidth = this._map.project([0, 180]).x;
    },

    _onPreDrag: function () {
      // TODO refactor to be able to adjust map pane position after zoom
      var worldWidth = this._worldWidth,
          halfWidth = Math.round(worldWidth / 2),
          dx = this._initialWorldOffset,
          x = this._draggable._newPos.x,
          newX1 = (x - halfWidth + dx) % worldWidth + halfWidth - dx,
          newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx,
          newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2;

      this._draggable._newPos.x = newX;
    },

    _onDragEnd: function (e) {
      var map = this._map,
          options = map.options,
          delay = +new Date() - this._lastTime,

          noInertia = !options.inertia || delay > options.inertiaThreshold || !this._positions[0];

      map.fire('dragend', e);

      if (noInertia) {
        map.fire('moveend');

      } else {

        var direction = this._lastPos.subtract(this._positions[0]),
            duration = (this._lastTime + delay - this._times[0]) / 1000,
            ease = options.easeLinearity,

            speedVector = direction.multiplyBy(ease / duration),
            speed = speedVector.distanceTo([0, 0]),

            limitedSpeed = Math.min(options.inertiaMaxSpeed, speed),
            limitedSpeedVector = speedVector.multiplyBy(limitedSpeed / speed),

            decelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease),
            offset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round();

        if (!offset.x || !offset.y) {
          map.fire('moveend');

        } else {
          offset = map._limitOffset(offset, map.options.maxBounds);

          L.Util.requestAnimFrame(function () {
            map.panBy(offset, {
              duration: decelerationDuration,
              easeLinearity: ease,
              noMoveStart: true
            });
          });
        }
      }
    }
  });

  L.Map.addInitHook('addHandler', 'dragging', L.Map.Drag);


  /*
   * L.Handler.DoubleClickZoom is used to handle double-click zoom on the map, enabled by default.
   */

  L.Map.mergeOptions({
    doubleClickZoom: true
  });

  L.Map.DoubleClickZoom = L.Handler.extend({
    addHooks: function () {
      this._map.on('dblclick', this._onDoubleClick, this);
    },

    removeHooks: function () {
      this._map.off('dblclick', this._onDoubleClick, this);
    },

    _onDoubleClick: function (e) {
      var map = this._map,
          zoom = map.getZoom() + (e.originalEvent.shiftKey ? -1 : 1);

      if (map.options.doubleClickZoom === 'center') {
        map.setZoom(zoom);
      } else {
        map.setZoomAround(e.containerPoint, zoom);
      }
    }
  });

  L.Map.addInitHook('addHandler', 'doubleClickZoom', L.Map.DoubleClickZoom);


  /*
   * L.Handler.ScrollWheelZoom is used by L.Map to enable mouse scroll wheel zoom on the map.
   */

  L.Map.mergeOptions({
    scrollWheelZoom: true
  });

  L.Map.ScrollWheelZoom = L.Handler.extend({
    addHooks: function () {
      L.DomEvent.on(this._map._container, 'mousewheel', this._onWheelScroll, this);
      L.DomEvent.on(this._map._container, 'MozMousePixelScroll', L.DomEvent.preventDefault);
      this._delta = 0;
    },

    removeHooks: function () {
      L.DomEvent.off(this._map._container, 'mousewheel', this._onWheelScroll);
      L.DomEvent.off(this._map._container, 'MozMousePixelScroll', L.DomEvent.preventDefault);
    },

    _onWheelScroll: function (e) {
      var delta = L.DomEvent.getWheelDelta(e);

      this._delta += delta;
      this._lastMousePos = this._map.mouseEventToContainerPoint(e);

      if (!this._startTime) {
        this._startTime = +new Date();
      }

      var left = Math.max(40 - (+new Date() - this._startTime), 0);

      clearTimeout(this._timer);
      this._timer = setTimeout(L.bind(this._performZoom, this), left);

      L.DomEvent.preventDefault(e);
      L.DomEvent.stopPropagation(e);
    },

    _performZoom: function () {
      var map = this._map,
          delta = this._delta,
          zoom = map.getZoom();

      delta = delta > 0 ? Math.ceil(delta) : Math.floor(delta);
      delta = Math.max(Math.min(delta, 4), -4);
      delta = map._limitZoom(zoom + delta) - zoom;

      this._delta = 0;
      this._startTime = null;

      if (!delta) { return; }

      if (map.options.scrollWheelZoom === 'center') {
        map.setZoom(zoom + delta);
      } else {
        map.setZoomAround(this._lastMousePos, zoom + delta);
      }
    }
  });

  L.Map.addInitHook('addHandler', 'scrollWheelZoom', L.Map.ScrollWheelZoom);


  /*
   * Extends the event handling code with double tap support for mobile browsers.
   */

  L.extend(L.DomEvent, {

    _touchstart: L.Browser.msPointer ? 'MSPointerDown' : L.Browser.pointer ? 'pointerdown' : 'touchstart',
    _touchend: L.Browser.msPointer ? 'MSPointerUp' : L.Browser.pointer ? 'pointerup' : 'touchend',

    // inspired by Zepto touch code by Thomas Fuchs
    addDoubleTapListener: function (obj, handler, id) {
      var last,
          doubleTap = false,
          delay = 250,
          touch,
          pre = '_leaflet_',
          touchstart = this._touchstart,
          touchend = this._touchend,
          trackedTouches = [];

      function onTouchStart(e) {
        var count;

        if (L.Browser.pointer) {
          trackedTouches.push(e.pointerId);
          count = trackedTouches.length;
        } else {
          count = e.touches.length;
        }
        if (count > 1) {
          return;
        }

        var now = Date.now(),
          delta = now - (last || now);

        touch = e.touches ? e.touches[0] : e;
        doubleTap = (delta > 0 && delta <= delay);
        last = now;
      }

      function onTouchEnd(e) {
        if (L.Browser.pointer) {
          var idx = trackedTouches.indexOf(e.pointerId);
          if (idx === -1) {
            return;
          }
          trackedTouches.splice(idx, 1);
        }

        if (doubleTap) {
          if (L.Browser.pointer) {
            // work around .type being readonly with MSPointer* events
            var newTouch = {},
              prop;

            // jshint forin:false
            for (var i in touch) {
              prop = touch[i];
              if (typeof prop === 'function') {
                newTouch[i] = prop.bind(touch);
              } else {
                newTouch[i] = prop;
              }
            }
            touch = newTouch;
          }
          touch.type = 'dblclick';
          handler(touch);
          last = null;
        }
      }
      obj[pre + touchstart + id] = onTouchStart;
      obj[pre + touchend + id] = onTouchEnd;

      // on pointer we need to listen on the document, otherwise a drag starting on the map and moving off screen
      // will not come through to us, so we will lose track of how many touches are ongoing
      var endElement = L.Browser.pointer ? document.documentElement : obj;

      obj.addEventListener(touchstart, onTouchStart, false);
      endElement.addEventListener(touchend, onTouchEnd, false);

      if (L.Browser.pointer) {
        endElement.addEventListener(L.DomEvent.POINTER_CANCEL, onTouchEnd, false);
      }

      return this;
    },

    removeDoubleTapListener: function (obj, id) {
      var pre = '_leaflet_';

      obj.removeEventListener(this._touchstart, obj[pre + this._touchstart + id], false);
      (L.Browser.pointer ? document.documentElement : obj).removeEventListener(
              this._touchend, obj[pre + this._touchend + id], false);

      if (L.Browser.pointer) {
        document.documentElement.removeEventListener(L.DomEvent.POINTER_CANCEL, obj[pre + this._touchend + id],
          false);
      }

      return this;
    }
  });


  /*
   * Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices.
   */

  L.extend(L.DomEvent, {

    //static
    POINTER_DOWN: L.Browser.msPointer ? 'MSPointerDown' : 'pointerdown',
    POINTER_MOVE: L.Browser.msPointer ? 'MSPointerMove' : 'pointermove',
    POINTER_UP: L.Browser.msPointer ? 'MSPointerUp' : 'pointerup',
    POINTER_CANCEL: L.Browser.msPointer ? 'MSPointerCancel' : 'pointercancel',

    _pointers: [],
    _pointerDocumentListener: false,

    // Provides a touch events wrapper for (ms)pointer events.
    // Based on changes by veproza https://github.com/CloudMade/Leaflet/pull/1019
    //ref http://www.w3.org/TR/pointerevents/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=22890

    addPointerListener: function (obj, type, handler, id) {

      switch (type) {
        case 'touchstart':
          return this.addPointerListenerStart(obj, type, handler, id);
        case 'touchend':
          return this.addPointerListenerEnd(obj, type, handler, id);
        case 'touchmove':
          return this.addPointerListenerMove(obj, type, handler, id);
        default:
          throw 'Unknown touch event type';
      }
    },

    addPointerListenerStart: function (obj, type, handler, id) {
      var pre = '_leaflet_',
          pointers = this._pointers;

      var cb = function (e) {

        L.DomEvent.preventDefault(e);

        var alreadyInArray = false;
        for (var i = 0; i < pointers.length; i++) {
          if (pointers[i].pointerId === e.pointerId) {
            alreadyInArray = true;
            break;
          }
        }
        if (!alreadyInArray) {
          pointers.push(e);
        }

        e.touches = pointers.slice();
        e.changedTouches = [e];

        handler(e);
      };

      obj[pre + 'touchstart' + id] = cb;
      obj.addEventListener(this.POINTER_DOWN, cb, false);

      // need to also listen for end events to keep the _pointers list accurate
      // this needs to be on the body and never go away
      if (!this._pointerDocumentListener) {
        var internalCb = function (e) {
          for (var i = 0; i < pointers.length; i++) {
            if (pointers[i].pointerId === e.pointerId) {
              pointers.splice(i, 1);
              break;
            }
          }
        };
        //We listen on the documentElement as any drags that end by moving the touch off the screen get fired there
        document.documentElement.addEventListener(this.POINTER_UP, internalCb, false);
        document.documentElement.addEventListener(this.POINTER_CANCEL, internalCb, false);

        this._pointerDocumentListener = true;
      }

      return this;
    },

    addPointerListenerMove: function (obj, type, handler, id) {
      var pre = '_leaflet_',
          touches = this._pointers;

      function cb(e) {

        // don't fire touch moves when mouse isn't down
        if ((e.pointerType === e.MSPOINTER_TYPE_MOUSE || e.pointerType === 'mouse') && e.buttons === 0) { return; }

        for (var i = 0; i < touches.length; i++) {
          if (touches[i].pointerId === e.pointerId) {
            touches[i] = e;
            break;
          }
        }

        e.touches = touches.slice();
        e.changedTouches = [e];

        handler(e);
      }

      obj[pre + 'touchmove' + id] = cb;
      obj.addEventListener(this.POINTER_MOVE, cb, false);

      return this;
    },

    addPointerListenerEnd: function (obj, type, handler, id) {
      var pre = '_leaflet_',
          touches = this._pointers;

      var cb = function (e) {
        for (var i = 0; i < touches.length; i++) {
          if (touches[i].pointerId === e.pointerId) {
            touches.splice(i, 1);
            break;
          }
        }

        e.touches = touches.slice();
        e.changedTouches = [e];

        handler(e);
      };

      obj[pre + 'touchend' + id] = cb;
      obj.addEventListener(this.POINTER_UP, cb, false);
      obj.addEventListener(this.POINTER_CANCEL, cb, false);

      return this;
    },

    removePointerListener: function (obj, type, id) {
      var pre = '_leaflet_',
          cb = obj[pre + type + id];

      switch (type) {
        case 'touchstart':
          obj.removeEventListener(this.POINTER_DOWN, cb, false);
          break;
        case 'touchmove':
          obj.removeEventListener(this.POINTER_MOVE, cb, false);
          break;
        case 'touchend':
          obj.removeEventListener(this.POINTER_UP, cb, false);
          obj.removeEventListener(this.POINTER_CANCEL, cb, false);
          break;
      }

      return this;
    }
  });


  /*
   * L.Handler.TouchZoom is used by L.Map to add pinch zoom on supported mobile browsers.
   */

  L.Map.mergeOptions({
    touchZoom: L.Browser.touch && !L.Browser.android23,
    bounceAtZoomLimits: true
  });

  L.Map.TouchZoom = L.Handler.extend({
    addHooks: function () {
      L.DomEvent.on(this._map._container, 'touchstart', this._onTouchStart, this);
    },

    removeHooks: function () {
      L.DomEvent.off(this._map._container, 'touchstart', this._onTouchStart, this);
    },

    _onTouchStart: function (e) {
      var map = this._map;

      if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) { return; }

      var p1 = map.mouseEventToLayerPoint(e.touches[0]),
          p2 = map.mouseEventToLayerPoint(e.touches[1]),
          viewCenter = map._getCenterLayerPoint();

      this._startCenter = p1.add(p2)._divideBy(2);
      this._startDist = p1.distanceTo(p2);

      this._moved = false;
      this._zooming = true;

      this._centerOffset = viewCenter.subtract(this._startCenter);

      if (map._panAnim) {
        map._panAnim.stop();
      }

      L.DomEvent
          .on(document, 'touchmove', this._onTouchMove, this)
          .on(document, 'touchend', this._onTouchEnd, this);

      L.DomEvent.preventDefault(e);
    },

    _onTouchMove: function (e) {
      var map = this._map;

      if (!e.touches || e.touches.length !== 2 || !this._zooming) { return; }

      var p1 = map.mouseEventToLayerPoint(e.touches[0]),
          p2 = map.mouseEventToLayerPoint(e.touches[1]);

      this._scale = p1.distanceTo(p2) / this._startDist;
      this._delta = p1._add(p2)._divideBy(2)._subtract(this._startCenter);

      if (this._scale === 1) { return; }

      if (!map.options.bounceAtZoomLimits) {
        if ((map.getZoom() === map.getMinZoom() && this._scale < 1) ||
            (map.getZoom() === map.getMaxZoom() && this._scale > 1)) { return; }
      }

      if (!this._moved) {
        L.DomUtil.addClass(map._mapPane, 'leaflet-touching');

        map
            .fire('movestart')
            .fire('zoomstart');

        this._moved = true;
      }

      L.Util.cancelAnimFrame(this._animRequest);
      this._animRequest = L.Util.requestAnimFrame(
              this._updateOnMove, this, true, this._map._container);

      L.DomEvent.preventDefault(e);
    },

    _updateOnMove: function () {
      var map = this._map,
          origin = this._getScaleOrigin(),
          center = map.layerPointToLatLng(origin),
          zoom = map.getScaleZoom(this._scale);

      map._animateZoom(center, zoom, this._startCenter, this._scale, this._delta, false, true);
    },

    _onTouchEnd: function () {
      if (!this._moved || !this._zooming) {
        this._zooming = false;
        return;
      }

      var map = this._map;

      this._zooming = false;
      L.DomUtil.removeClass(map._mapPane, 'leaflet-touching');
      L.Util.cancelAnimFrame(this._animRequest);

      L.DomEvent
          .off(document, 'touchmove', this._onTouchMove)
          .off(document, 'touchend', this._onTouchEnd);

      var origin = this._getScaleOrigin(),
          center = map.layerPointToLatLng(origin),

          oldZoom = map.getZoom(),
          floatZoomDelta = map.getScaleZoom(this._scale) - oldZoom,
          roundZoomDelta = (floatZoomDelta > 0 ?
                  Math.ceil(floatZoomDelta) : Math.floor(floatZoomDelta)),

          zoom = map._limitZoom(oldZoom + roundZoomDelta),
          scale = map.getZoomScale(zoom) / this._scale;

      map._animateZoom(center, zoom, origin, scale);
    },

    _getScaleOrigin: function () {
      var centerOffset = this._centerOffset.subtract(this._delta).divideBy(this._scale);
      return this._startCenter.add(centerOffset);
    }
  });

  L.Map.addInitHook('addHandler', 'touchZoom', L.Map.TouchZoom);


  /*
   * L.Map.Tap is used to enable mobile hacks like quick taps and long hold.
   */

  L.Map.mergeOptions({
    tap: true,
    tapTolerance: 15
  });

  L.Map.Tap = L.Handler.extend({
    addHooks: function () {
      L.DomEvent.on(this._map._container, 'touchstart', this._onDown, this);
    },

    removeHooks: function () {
      L.DomEvent.off(this._map._container, 'touchstart', this._onDown, this);
    },

    _onDown: function (e) {
      if (!e.touches) { return; }

      L.DomEvent.preventDefault(e);

      this._fireClick = true;

      // don't simulate click or track longpress if more than 1 touch
      if (e.touches.length > 1) {
        this._fireClick = false;
        clearTimeout(this._holdTimeout);
        return;
      }

      var first = e.touches[0],
          el = first.target;

      this._startPos = this._newPos = new L.Point(first.clientX, first.clientY);

      // if touching a link, highlight it
      if (el.tagName && el.tagName.toLowerCase() === 'a') {
        L.DomUtil.addClass(el, 'leaflet-active');
      }

      // simulate long hold but setting a timeout
      this._holdTimeout = setTimeout(L.bind(function () {
        if (this._isTapValid()) {
          this._fireClick = false;
          this._onUp();
          this._simulateEvent('contextmenu', first);
        }
      }, this), 1000);

      L.DomEvent
        .on(document, 'touchmove', this._onMove, this)
        .on(document, 'touchend', this._onUp, this);
    },

    _onUp: function (e) {
      clearTimeout(this._holdTimeout);

      L.DomEvent
        .off(document, 'touchmove', this._onMove, this)
        .off(document, 'touchend', this._onUp, this);

      if (this._fireClick && e && e.changedTouches) {

        var first = e.changedTouches[0],
            el = first.target;

        if (el && el.tagName && el.tagName.toLowerCase() === 'a') {
          L.DomUtil.removeClass(el, 'leaflet-active');
        }

        // simulate click if the touch didn't move too much
        if (this._isTapValid()) {
          this._simulateEvent('click', first);
        }
      }
    },

    _isTapValid: function () {
      return this._newPos.distanceTo(this._startPos) <= this._map.options.tapTolerance;
    },

    _onMove: function (e) {
      var first = e.touches[0];
      this._newPos = new L.Point(first.clientX, first.clientY);
    },

    _simulateEvent: function (type, e) {
      var simulatedEvent = document.createEvent('MouseEvents');

      simulatedEvent._simulated = true;
      e.target._simulatedClick = true;

      simulatedEvent.initMouseEvent(
              type, true, true, window, 1,
              e.screenX, e.screenY,
              e.clientX, e.clientY,
              false, false, false, false, 0, null);

      e.target.dispatchEvent(simulatedEvent);
    }
  });

  if (L.Browser.touch && !L.Browser.pointer) {
    L.Map.addInitHook('addHandler', 'tap', L.Map.Tap);
  }


  /*
   * L.Handler.ShiftDragZoom is used to add shift-drag zoom interaction to the map
    * (zoom to a selected bounding box), enabled by default.
   */

  L.Map.mergeOptions({
    boxZoom: true
  });

  L.Map.BoxZoom = L.Handler.extend({
    initialize: function (map) {
      this._map = map;
      this._container = map._container;
      this._pane = map._panes.overlayPane;
      this._moved = false;
    },

    addHooks: function () {
      L.DomEvent.on(this._container, 'mousedown', this._onMouseDown, this);
    },

    removeHooks: function () {
      L.DomEvent.off(this._container, 'mousedown', this._onMouseDown);
      this._moved = false;
    },

    moved: function () {
      return this._moved;
    },

    _onMouseDown: function (e) {
      this._moved = false;

      if (!e.shiftKey || ((e.which !== 1) && (e.button !== 1))) { return false; }

      L.DomUtil.disableTextSelection();
      L.DomUtil.disableImageDrag();

      this._startLayerPoint = this._map.mouseEventToLayerPoint(e);

      L.DomEvent
          .on(document, 'mousemove', this._onMouseMove, this)
          .on(document, 'mouseup', this._onMouseUp, this)
          .on(document, 'keydown', this._onKeyDown, this);
    },

    _onMouseMove: function (e) {
      if (!this._moved) {
        this._box = L.DomUtil.create('div', 'leaflet-zoom-box', this._pane);
        L.DomUtil.setPosition(this._box, this._startLayerPoint);

        //TODO refactor: move cursor to styles
        this._container.style.cursor = 'crosshair';
        this._map.fire('boxzoomstart');
      }

      var startPoint = this._startLayerPoint,
          box = this._box,

          layerPoint = this._map.mouseEventToLayerPoint(e),
          offset = layerPoint.subtract(startPoint),

          newPos = new L.Point(
              Math.min(layerPoint.x, startPoint.x),
              Math.min(layerPoint.y, startPoint.y));

      L.DomUtil.setPosition(box, newPos);

      this._moved = true;

      // TODO refactor: remove hardcoded 4 pixels
      box.style.width = (Math.max(0, Math.abs(offset.x) - 4)) + 'px';
      box.style.height = (Math.max(0, Math.abs(offset.y) - 4)) + 'px';
    },

    _finish: function () {
      if (this._moved) {
        this._pane.removeChild(this._box);
        this._container.style.cursor = '';
      }

      L.DomUtil.enableTextSelection();
      L.DomUtil.enableImageDrag();

      L.DomEvent
          .off(document, 'mousemove', this._onMouseMove)
          .off(document, 'mouseup', this._onMouseUp)
          .off(document, 'keydown', this._onKeyDown);
    },

    _onMouseUp: function (e) {

      this._finish();

      var map = this._map,
          layerPoint = map.mouseEventToLayerPoint(e);

      if (this._startLayerPoint.equals(layerPoint)) { return; }

      var bounds = new L.LatLngBounds(
              map.layerPointToLatLng(this._startLayerPoint),
              map.layerPointToLatLng(layerPoint));

      map.fitBounds(bounds);

      map.fire('boxzoomend', {
        boxZoomBounds: bounds
      });
    },

    _onKeyDown: function (e) {
      if (e.keyCode === 27) {
        this._finish();
      }
    }
  });

  L.Map.addInitHook('addHandler', 'boxZoom', L.Map.BoxZoom);


  /*
   * L.Map.Keyboard is handling keyboard interaction with the map, enabled by default.
   */

  L.Map.mergeOptions({
    keyboard: true,
    keyboardPanOffset: 80,
    keyboardZoomOffset: 1
  });

  L.Map.Keyboard = L.Handler.extend({

    keyCodes: {
      left: [37],
      right: [39],
      down: [40],
      up: [38],
      zoomIn: [187, 107, 61, 171],
      zoomOut: [189, 109, 173]
    },

    initialize: function (map) {
      this._map = map;

      this._setPanOffset(map.options.keyboardPanOffset);
      this._setZoomOffset(map.options.keyboardZoomOffset);
    },

    addHooks: function () {
      var container = this._map._container;

      // make the container focusable by tabbing
      if (container.tabIndex === -1) {
        container.tabIndex = '0';
      }

      L.DomEvent
          .on(container, 'focus', this._onFocus, this)
          .on(container, 'blur', this._onBlur, this)
          .on(container, 'mousedown', this._onMouseDown, this);

      this._map
          .on('focus', this._addHooks, this)
          .on('blur', this._removeHooks, this);
    },

    removeHooks: function () {
      this._removeHooks();

      var container = this._map._container;

      L.DomEvent
          .off(container, 'focus', this._onFocus, this)
          .off(container, 'blur', this._onBlur, this)
          .off(container, 'mousedown', this._onMouseDown, this);

      this._map
          .off('focus', this._addHooks, this)
          .off('blur', this._removeHooks, this);
    },

    _onMouseDown: function () {
      if (this._focused) { return; }

      var body = document.body,
          docEl = document.documentElement,
          top = body.scrollTop || docEl.scrollTop,
          left = body.scrollLeft || docEl.scrollLeft;

      this._map._container.focus();

      window.scrollTo(left, top);
    },

    _onFocus: function () {
      this._focused = true;
      this._map.fire('focus');
    },

    _onBlur: function () {
      this._focused = false;
      this._map.fire('blur');
    },

    _setPanOffset: function (pan) {
      var keys = this._panKeys = {},
          codes = this.keyCodes,
          i, len;

      for (i = 0, len = codes.left.length; i < len; i++) {
        keys[codes.left[i]] = [-1 * pan, 0];
      }
      for (i = 0, len = codes.right.length; i < len; i++) {
        keys[codes.right[i]] = [pan, 0];
      }
      for (i = 0, len = codes.down.length; i < len; i++) {
        keys[codes.down[i]] = [0, pan];
      }
      for (i = 0, len = codes.up.length; i < len; i++) {
        keys[codes.up[i]] = [0, -1 * pan];
      }
    },

    _setZoomOffset: function (zoom) {
      var keys = this._zoomKeys = {},
          codes = this.keyCodes,
          i, len;

      for (i = 0, len = codes.zoomIn.length; i < len; i++) {
        keys[codes.zoomIn[i]] = zoom;
      }
      for (i = 0, len = codes.zoomOut.length; i < len; i++) {
        keys[codes.zoomOut[i]] = -zoom;
      }
    },

    _addHooks: function () {
      L.DomEvent.on(document, 'keydown', this._onKeyDown, this);
    },

    _removeHooks: function () {
      L.DomEvent.off(document, 'keydown', this._onKeyDown, this);
    },

    _onKeyDown: function (e) {
      var key = e.keyCode,
          map = this._map;

      if (key in this._panKeys) {

        if (map._panAnim && map._panAnim._inProgress) { return; }

        map.panBy(this._panKeys[key]);

        if (map.options.maxBounds) {
          map.panInsideBounds(map.options.maxBounds);
        }

      } else if (key in this._zoomKeys) {
        map.setZoom(map.getZoom() + this._zoomKeys[key]);

      } else {
        return;
      }

      L.DomEvent.stop(e);
    }
  });

  L.Map.addInitHook('addHandler', 'keyboard', L.Map.Keyboard);


  /*
   * L.Handler.MarkerDrag is used internally by L.Marker to make the markers draggable.
   */

  L.Handler.MarkerDrag = L.Handler.extend({
    initialize: function (marker) {
      this._marker = marker;
    },

    addHooks: function () {
      var icon = this._marker._icon;
      if (!this._draggable) {
        this._draggable = new L.Draggable(icon, icon);
      }

      this._draggable
        .on('dragstart', this._onDragStart, this)
        .on('drag', this._onDrag, this)
        .on('dragend', this._onDragEnd, this);
      this._draggable.enable();
      L.DomUtil.addClass(this._marker._icon, 'leaflet-marker-draggable');
    },

    removeHooks: function () {
      this._draggable
        .off('dragstart', this._onDragStart, this)
        .off('drag', this._onDrag, this)
        .off('dragend', this._onDragEnd, this);

      this._draggable.disable();
      L.DomUtil.removeClass(this._marker._icon, 'leaflet-marker-draggable');
    },

    moved: function () {
      return this._draggable && this._draggable._moved;
    },

    _onDragStart: function () {
      this._marker
          .closePopup()
          .fire('movestart')
          .fire('dragstart');
    },

    _onDrag: function () {
      var marker = this._marker,
          shadow = marker._shadow,
          iconPos = L.DomUtil.getPosition(marker._icon),
          latlng = marker._map.layerPointToLatLng(iconPos);

      // update shadow position
      if (shadow) {
        L.DomUtil.setPosition(shadow, iconPos);
      }

      marker._latlng = latlng;

      marker
          .fire('move', { latlng: latlng })
          .fire('drag');
    },

    _onDragEnd: function (e) {
      this._marker
          .fire('moveend')
          .fire('dragend', e);
    }
  });


  /*
   * L.Control is a base class for implementing map controls. Handles positioning.
   * All other controls extend from this class.
   */

  L.Control = L.Class.extend({
    options: {
      position: 'topright'
    },

    initialize: function (options) {
      L.setOptions(this, options);
    },

    getPosition: function () {
      return this.options.position;
    },

    setPosition: function (position) {
      var map = this._map;

      if (map) {
        map.removeControl(this);
      }

      this.options.position = position;

      if (map) {
        map.addControl(this);
      }

      return this;
    },

    getContainer: function () {
      return this._container;
    },

    addTo: function (map) {
      this._map = map;

      var container = this._container = this.onAdd(map),
          pos = this.getPosition(),
          corner = map._controlCorners[pos];

      L.DomUtil.addClass(container, 'leaflet-control');

      if (pos.indexOf('bottom') !== -1) {
        corner.insertBefore(container, corner.firstChild);
      } else {
        corner.appendChild(container);
      }

      return this;
    },

    removeFrom: function (map) {
      var pos = this.getPosition(),
          corner = map._controlCorners[pos];

      corner.removeChild(this._container);
      this._map = null;

      if (this.onRemove) {
        this.onRemove(map);
      }

      return this;
    },

    _refocusOnMap: function () {
      if (this._map) {
        this._map.getContainer().focus();
      }
    }
  });

  L.control = function (options) {
    return new L.Control(options);
  };


  // adds control-related methods to L.Map

  L.Map.include({
    addControl: function (control) {
      control.addTo(this);
      return this;
    },

    removeControl: function (control) {
      control.removeFrom(this);
      return this;
    },

    _initControlPos: function () {
      var corners = this._controlCorners = {},
          l = 'leaflet-',
          container = this._controlContainer =
                  L.DomUtil.create('div', l + 'control-container', this._container);

      function createCorner(vSide, hSide) {
        var className = l + vSide + ' ' + l + hSide;

        corners[vSide + hSide] = L.DomUtil.create('div', className, container);
      }

      createCorner('top', 'left');
      createCorner('top', 'right');
      createCorner('bottom', 'left');
      createCorner('bottom', 'right');
    },

    _clearControlPos: function () {
      this._container.removeChild(this._controlContainer);
    }
  });


  /*
   * L.Control.Zoom is used for the default zoom buttons on the map.
   */

  L.Control.Zoom = L.Control.extend({
    options: {
      position: 'topleft',
      zoomInText: '+',
      zoomInTitle: 'Zoom in',
      zoomOutText: '-',
      zoomOutTitle: 'Zoom out'
    },

    onAdd: function (map) {
      var zoomName = 'leaflet-control-zoom',
          container = L.DomUtil.create('div', zoomName + ' leaflet-bar');

      this._map = map;

      this._zoomInButton = this._createButton(
              this.options.zoomInText, this.options.zoomInTitle,
              zoomName + '-in', container, this._zoomIn, this);
      this._zoomOutButton = this._createButton(
              this.options.zoomOutText, this.options.zoomOutTitle,
              zoomName + '-out', container, this._zoomOut, this);

      this._updateDisabled();
      map.on('zoomend zoomlevelschange', this._updateDisabled, this);

      return container;
    },

    onRemove: function (map) {
      map.off('zoomend zoomlevelschange', this._updateDisabled, this);
    },

    _zoomIn: function (e) {
      this._map.zoomIn(e.shiftKey ? 3 : 1);
    },

    _zoomOut: function (e) {
      this._map.zoomOut(e.shiftKey ? 3 : 1);
    },

    _createButton: function (html, title, className, container, fn, context) {
      var link = L.DomUtil.create('a', className, container);
      link.innerHTML = html;
      link.href = '#';
      link.title = title;

      var stop = L.DomEvent.stopPropagation;

      L.DomEvent
          .on(link, 'click', stop)
          .on(link, 'mousedown', stop)
          .on(link, 'dblclick', stop)
          .on(link, 'click', L.DomEvent.preventDefault)
          .on(link, 'click', fn, context)
          .on(link, 'click', this._refocusOnMap, context);

      return link;
    },

    _updateDisabled: function () {
      var map = this._map,
        className = 'leaflet-disabled';

      L.DomUtil.removeClass(this._zoomInButton, className);
      L.DomUtil.removeClass(this._zoomOutButton, className);

      if (map._zoom === map.getMinZoom()) {
        L.DomUtil.addClass(this._zoomOutButton, className);
      }
      if (map._zoom === map.getMaxZoom()) {
        L.DomUtil.addClass(this._zoomInButton, className);
      }
    }
  });

  L.Map.mergeOptions({
    zoomControl: true
  });

  L.Map.addInitHook(function () {
    if (this.options.zoomControl) {
      this.zoomControl = new L.Control.Zoom();
      this.addControl(this.zoomControl);
    }
  });

  L.control.zoom = function (options) {
    return new L.Control.Zoom(options);
  };



  /*
   * L.Control.Attribution is used for displaying attribution on the map (added by default).
   */

  L.Control.Attribution = L.Control.extend({
    options: {
      position: 'bottomright',
      prefix: '<a href="http://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'
    },

    initialize: function (options) {
      L.setOptions(this, options);

      this._attributions = {};
    },

    onAdd: function (map) {
      this._container = L.DomUtil.create('div', 'leaflet-control-attribution');
      L.DomEvent.disableClickPropagation(this._container);

      for (var i in map._layers) {
        if (map._layers[i].getAttribution) {
          this.addAttribution(map._layers[i].getAttribution());
        }
      }

      map
          .on('layeradd', this._onLayerAdd, this)
          .on('layerremove', this._onLayerRemove, this);

      this._update();

      return this._container;
    },

    onRemove: function (map) {
      map
          .off('layeradd', this._onLayerAdd)
          .off('layerremove', this._onLayerRemove);

    },

    setPrefix: function (prefix) {
      this.options.prefix = prefix;
      this._update();
      return this;
    },

    addAttribution: function (text) {
      if (!text) { return; }

      if (!this._attributions[text]) {
        this._attributions[text] = 0;
      }
      this._attributions[text]++;

      this._update();

      return this;
    },

    removeAttribution: function (text) {
      if (!text) { return; }

      if (this._attributions[text]) {
        this._attributions[text]--;
        this._update();
      }

      return this;
    },

    _update: function () {
      if (!this._map) { return; }

      var attribs = [];

      for (var i in this._attributions) {
        if (this._attributions[i]) {
          attribs.push(i);
        }
      }

      var prefixAndAttribs = [];

      if (this.options.prefix) {
        prefixAndAttribs.push(this.options.prefix);
      }
      if (attribs.length) {
        prefixAndAttribs.push(attribs.join(', '));
      }

      this._container.innerHTML = prefixAndAttribs.join(' | ');
    },

    _onLayerAdd: function (e) {
      if (e.layer.getAttribution) {
        this.addAttribution(e.layer.getAttribution());
      }
    },

    _onLayerRemove: function (e) {
      if (e.layer.getAttribution) {
        this.removeAttribution(e.layer.getAttribution());
      }
    }
  });

  L.Map.mergeOptions({
    attributionControl: true
  });

  L.Map.addInitHook(function () {
    if (this.options.attributionControl) {
      this.attributionControl = (new L.Control.Attribution()).addTo(this);
    }
  });

  L.control.attribution = function (options) {
    return new L.Control.Attribution(options);
  };


  /*
   * L.Control.Scale is used for displaying metric/imperial scale on the map.
   */

  L.Control.Scale = L.Control.extend({
    options: {
      position: 'bottomleft',
      maxWidth: 100,
      metric: true,
      imperial: true,
      updateWhenIdle: false
    },

    onAdd: function (map) {
      this._map = map;

      var className = 'leaflet-control-scale',
          container = L.DomUtil.create('div', className),
          options = this.options;

      this._addScales(options, className, container);

      map.on(options.updateWhenIdle ? 'moveend' : 'move', this._update, this);
      map.whenReady(this._update, this);

      return container;
    },

    onRemove: function (map) {
      map.off(this.options.updateWhenIdle ? 'moveend' : 'move', this._update, this);
    },

    _addScales: function (options, className, container) {
      if (options.metric) {
        this._mScale = L.DomUtil.create('div', className + '-line', container);
      }
      if (options.imperial) {
        this._iScale = L.DomUtil.create('div', className + '-line', container);
      }
    },

    _update: function () {
      var bounds = this._map.getBounds(),
          centerLat = bounds.getCenter().lat,
          halfWorldMeters = 6378137 * Math.PI * Math.cos(centerLat * Math.PI / 180),
          dist = halfWorldMeters * (bounds.getNorthEast().lng - bounds.getSouthWest().lng) / 180,

          size = this._map.getSize(),
          options = this.options,
          maxMeters = 0;

      if (size.x > 0) {
        maxMeters = dist * (options.maxWidth / size.x);
      }

      this._updateScales(options, maxMeters);
    },

    _updateScales: function (options, maxMeters) {
      if (options.metric && maxMeters) {
        this._updateMetric(maxMeters);
      }

      if (options.imperial && maxMeters) {
        this._updateImperial(maxMeters);
      }
    },

    _updateMetric: function (maxMeters) {
      var meters = this._getRoundNum(maxMeters);

      this._mScale.style.width = this._getScaleWidth(meters / maxMeters) + 'px';
      this._mScale.innerHTML = meters < 1000 ? meters + ' m' : (meters / 1000) + ' km';
    },

    _updateImperial: function (maxMeters) {
      var maxFeet = maxMeters * 3.2808399,
          scale = this._iScale,
          maxMiles, miles, feet;

      if (maxFeet > 5280) {
        maxMiles = maxFeet / 5280;
        miles = this._getRoundNum(maxMiles);

        scale.style.width = this._getScaleWidth(miles / maxMiles) + 'px';
        scale.innerHTML = miles + ' mi';

      } else {
        feet = this._getRoundNum(maxFeet);

        scale.style.width = this._getScaleWidth(feet / maxFeet) + 'px';
        scale.innerHTML = feet + ' ft';
      }
    },

    _getScaleWidth: function (ratio) {
      return Math.round(this.options.maxWidth * ratio) - 10;
    },

    _getRoundNum: function (num) {
      var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1),
          d = num / pow10;

      d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : 1;

      return pow10 * d;
    }
  });

  L.control.scale = function (options) {
    return new L.Control.Scale(options);
  };


  /*
   * L.Control.Layers is a control to allow users to switch between different layers on the map.
   */

  L.Control.Layers = L.Control.extend({
    options: {
      collapsed: true,
      position: 'topright',
      autoZIndex: true
    },

    initialize: function (baseLayers, overlays, options) {
      L.setOptions(this, options);

      this._layers = {};
      this._lastZIndex = 0;
      this._handlingClick = false;

      for (var i in baseLayers) {
        this._addLayer(baseLayers[i], i);
      }

      for (i in overlays) {
        this._addLayer(overlays[i], i, true);
      }
    },

    onAdd: function (map) {
      this._initLayout();
      this._update();

      map
          .on('layeradd', this._onLayerChange, this)
          .on('layerremove', this._onLayerChange, this);

      return this._container;
    },

    onRemove: function (map) {
      map
          .off('layeradd', this._onLayerChange, this)
          .off('layerremove', this._onLayerChange, this);
    },

    addBaseLayer: function (layer, name) {
      this._addLayer(layer, name);
      this._update();
      return this;
    },

    addOverlay: function (layer, name) {
      this._addLayer(layer, name, true);
      this._update();
      return this;
    },

    removeLayer: function (layer) {
      var id = L.stamp(layer);
      delete this._layers[id];
      this._update();
      return this;
    },

    _initLayout: function () {
      var className = 'leaflet-control-layers',
          container = this._container = L.DomUtil.create('div', className);

      //Makes this work on IE10 Touch devices by stopping it from firing a mouseout event when the touch is released
      container.setAttribute('aria-haspopup', true);

      if (!L.Browser.touch) {
        L.DomEvent
          .disableClickPropagation(container)
          .disableScrollPropagation(container);
      } else {
        L.DomEvent.on(container, 'click', L.DomEvent.stopPropagation);
      }

      var form = this._form = L.DomUtil.create('form', className + '-list');

      if (this.options.collapsed) {
        if (!L.Browser.android) {
          L.DomEvent
              .on(container, 'mouseover', this._expand, this)
              .on(container, 'mouseout', this._collapse, this);
        }
        var link = this._layersLink = L.DomUtil.create('a', className + '-toggle', container);
        link.href = '#';
        link.title = 'Layers';

        if (L.Browser.touch) {
          L.DomEvent
              .on(link, 'click', L.DomEvent.stop)
              .on(link, 'click', this._expand, this);
        }
        else {
          L.DomEvent.on(link, 'focus', this._expand, this);
        }
        //Work around for Firefox android issue https://github.com/Leaflet/Leaflet/issues/2033
        L.DomEvent.on(form, 'click', function () {
          setTimeout(L.bind(this._onInputClick, this), 0);
        }, this);

        this._map.on('click', this._collapse, this);
        // TODO keyboard accessibility
      } else {
        this._expand();
      }

      this._baseLayersList = L.DomUtil.create('div', className + '-base', form);
      this._separator = L.DomUtil.create('div', className + '-separator', form);
      this._overlaysList = L.DomUtil.create('div', className + '-overlays', form);

      container.appendChild(form);
    },

    _addLayer: function (layer, name, overlay) {
      var id = L.stamp(layer);

      this._layers[id] = {
        layer: layer,
        name: name,
        overlay: overlay
      };

      if (this.options.autoZIndex && layer.setZIndex) {
        this._lastZIndex++;
        layer.setZIndex(this._lastZIndex);
      }
    },

    _update: function () {
      if (!this._container) {
        return;
      }

      this._baseLayersList.innerHTML = '';
      this._overlaysList.innerHTML = '';

      var baseLayersPresent = false,
          overlaysPresent = false,
          i, obj;

      for (i in this._layers) {
        obj = this._layers[i];
        this._addItem(obj);
        overlaysPresent = overlaysPresent || obj.overlay;
        baseLayersPresent = baseLayersPresent || !obj.overlay;
      }

      this._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none';
    },

    _onLayerChange: function (e) {
      var obj = this._layers[L.stamp(e.layer)];

      if (!obj) { return; }

      if (!this._handlingClick) {
        this._update();
      }

      var type = obj.overlay ?
        (e.type === 'layeradd' ? 'overlayadd' : 'overlayremove') :
        (e.type === 'layeradd' ? 'baselayerchange' : null);

      if (type) {
        this._map.fire(type, obj);
      }
    },

    // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)
    _createRadioElement: function (name, checked) {

      var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' + name + '"';
      if (checked) {
        radioHtml += ' checked="checked"';
      }
      radioHtml += '/>';

      var radioFragment = document.createElement('div');
      radioFragment.innerHTML = radioHtml;

      return radioFragment.firstChild;
    },

    _addItem: function (obj) {
      var label = document.createElement('label'),
          input,
          checked = this._map.hasLayer(obj.layer);

      if (obj.overlay) {
        input = document.createElement('input');
        input.type = 'checkbox';
        input.className = 'leaflet-control-layers-selector';
        input.defaultChecked = checked;
      } else {
        input = this._createRadioElement('leaflet-base-layers', checked);
      }

      input.layerId = L.stamp(obj.layer);

      L.DomEvent.on(input, 'click', this._onInputClick, this);

      var name = document.createElement('span');
      name.innerHTML = ' ' + obj.name;

      label.appendChild(input);
      label.appendChild(name);

      var container = obj.overlay ? this._overlaysList : this._baseLayersList;
      container.appendChild(label);

      return label;
    },

    _onInputClick: function () {
      var i, input, obj,
          inputs = this._form.getElementsByTagName('input'),
          inputsLen = inputs.length;

      this._handlingClick = true;

      for (i = 0; i < inputsLen; i++) {
        input = inputs[i];
        obj = this._layers[input.layerId];

        if (input.checked && !this._map.hasLayer(obj.layer)) {
          this._map.addLayer(obj.layer);

        } else if (!input.checked && this._map.hasLayer(obj.layer)) {
          this._map.removeLayer(obj.layer);
        }
      }

      this._handlingClick = false;

      this._refocusOnMap();
    },

    _expand: function () {
      L.DomUtil.addClass(this._container, 'leaflet-control-layers-expanded');
    },

    _collapse: function () {
      this._container.className = this._container.className.replace(' leaflet-control-layers-expanded', '');
    }
  });

  L.control.layers = function (baseLayers, overlays, options) {
    return new L.Control.Layers(baseLayers, overlays, options);
  };


  /*
   * L.PosAnimation is used by Leaflet internally for pan animations.
   */

  L.PosAnimation = L.Class.extend({
    includes: L.Mixin.Events,

    run: function (el, newPos, duration, easeLinearity) { // (HTMLElement, Point[, Number, Number])
      this.stop();

      this._el = el;
      this._inProgress = true;
      this._newPos = newPos;

      this.fire('start');

      el.style[L.DomUtil.TRANSITION] = 'all ' + (duration || 0.25) +
              's cubic-bezier(0,0,' + (easeLinearity || 0.5) + ',1)';

      L.DomEvent.on(el, L.DomUtil.TRANSITION_END, this._onTransitionEnd, this);
      L.DomUtil.setPosition(el, newPos);

      // toggle reflow, Chrome flickers for some reason if you don't do this
      L.Util.falseFn(el.offsetWidth);

      // there's no native way to track value updates of transitioned properties, so we imitate this
      this._stepTimer = setInterval(L.bind(this._onStep, this), 50);
    },

    stop: function () {
      if (!this._inProgress) { return; }

      // if we just removed the transition property, the element would jump to its final position,
      // so we need to make it stay at the current position

      L.DomUtil.setPosition(this._el, this._getPos());
      this._onTransitionEnd();
      L.Util.falseFn(this._el.offsetWidth); // force reflow in case we are about to start a new animation
    },

    _onStep: function () {
      var stepPos = this._getPos();
      if (!stepPos) {
        this._onTransitionEnd();
        return;
      }
      // jshint camelcase: false
      // make L.DomUtil.getPosition return intermediate position value during animation
      this._el._leaflet_pos = stepPos;

      this.fire('step');
    },

    // you can't easily get intermediate values of properties animated with CSS3 Transitions,
    // we need to parse computed style (in case of transform it returns matrix string)

    _transformRe: /([-+]?(?:\d*\.)?\d+)\D*, ([-+]?(?:\d*\.)?\d+)\D*\)/,

    _getPos: function () {
      var left, top, matches,
          el = this._el,
          style = window.getComputedStyle(el);

      if (L.Browser.any3d) {
        matches = style[L.DomUtil.TRANSFORM].match(this._transformRe);
        if (!matches) { return; }
        left = parseFloat(matches[1]);
        top = parseFloat(matches[2]);
      } else {
        left = parseFloat(style.left);
        top = parseFloat(style.top);
      }

      return new L.Point(left, top, true);
    },

    _onTransitionEnd: function () {
      L.DomEvent.off(this._el, L.DomUtil.TRANSITION_END, this._onTransitionEnd, this);

      if (!this._inProgress) { return; }
      this._inProgress = false;

      this._el.style[L.DomUtil.TRANSITION] = '';

      // jshint camelcase: false
      // make sure L.DomUtil.getPosition returns the final position value after animation
      this._el._leaflet_pos = this._newPos;

      clearInterval(this._stepTimer);

      this.fire('step').fire('end');
    }

  });


  /*
   * Extends L.Map to handle panning animations.
   */

  L.Map.include({

    setView: function (center, zoom, options) {

      zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom);
      center = this._limitCenter(L.latLng(center), zoom, this.options.maxBounds);
      options = options || {};

      if (this._panAnim) {
        this._panAnim.stop();
      }

      if (this._loaded && !options.reset && options !== true) {

        if (options.animate !== undefined) {
          options.zoom = L.extend({ animate: options.animate }, options.zoom);
          options.pan = L.extend({ animate: options.animate }, options.pan);
        }

        // try animating pan or zoom
        var animated = (this._zoom !== zoom) ?
          this._tryAnimatedZoom && this._tryAnimatedZoom(center, zoom, options.zoom) :
          this._tryAnimatedPan(center, options.pan);

        if (animated) {
          // prevent resize handler call, the view will refresh after animation anyway
          clearTimeout(this._sizeTimer);
          return this;
        }
      }

      // animation didn't start, just reset the map view
      this._resetView(center, zoom);

      return this;
    },

    panBy: function (offset, options) {
      offset = L.point(offset).round();
      options = options || {};

      if (!offset.x && !offset.y) {
        return this;
      }

      if (!this._panAnim) {
        this._panAnim = new L.PosAnimation();

        this._panAnim.on({
          'step': this._onPanTransitionStep,
          'end': this._onPanTransitionEnd
        }, this);
      }

      // don't fire movestart if animating inertia
      if (!options.noMoveStart) {
        this.fire('movestart');
      }

      // animate pan unless animate: false specified
      if (options.animate !== false) {
        L.DomUtil.addClass(this._mapPane, 'leaflet-pan-anim');

        var newPos = this._getMapPanePos().subtract(offset);
        this._panAnim.run(this._mapPane, newPos, options.duration || 0.25, options.easeLinearity);
      } else {
        this._rawPanBy(offset);
        this.fire('move').fire('moveend');
      }

      return this;
    },

    _onPanTransitionStep: function () {
      this.fire('move');
    },

    _onPanTransitionEnd: function () {
      L.DomUtil.removeClass(this._mapPane, 'leaflet-pan-anim');
      this.fire('moveend');
    },

    _tryAnimatedPan: function (center, options) {
      // difference between the new and current centers in pixels
      var offset = this._getCenterOffset(center)._floor();

      // don't animate too far unless animate: true specified in options
      if ((options && options.animate) !== true && !this.getSize().contains(offset)) { return false; }

      this.panBy(offset, options);

      return true;
    }
  });


  /*
   * L.PosAnimation fallback implementation that powers Leaflet pan animations
   * in browsers that don't support CSS3 Transitions.
   */

  L.PosAnimation = L.DomUtil.TRANSITION ? L.PosAnimation : L.PosAnimation.extend({

    run: function (el, newPos, duration, easeLinearity) { // (HTMLElement, Point[, Number, Number])
      this.stop();

      this._el = el;
      this._inProgress = true;
      this._duration = duration || 0.25;
      this._easeOutPower = 1 / Math.max(easeLinearity || 0.5, 0.2);

      this._startPos = L.DomUtil.getPosition(el);
      this._offset = newPos.subtract(this._startPos);
      this._startTime = +new Date();

      this.fire('start');

      this._animate();
    },

    stop: function () {
      if (!this._inProgress) { return; }

      this._step();
      this._complete();
    },

    _animate: function () {
      // animation loop
      this._animId = L.Util.requestAnimFrame(this._animate, this);
      this._step();
    },

    _step: function () {
      var elapsed = (+new Date()) - this._startTime,
          duration = this._duration * 1000;

      if (elapsed < duration) {
        this._runFrame(this._easeOut(elapsed / duration));
      } else {
        this._runFrame(1);
        this._complete();
      }
    },

    _runFrame: function (progress) {
      var pos = this._startPos.add(this._offset.multiplyBy(progress));
      L.DomUtil.setPosition(this._el, pos);

      this.fire('step');
    },

    _complete: function () {
      L.Util.cancelAnimFrame(this._animId);

      this._inProgress = false;
      this.fire('end');
    },

    _easeOut: function (t) {
      return 1 - Math.pow(1 - t, this._easeOutPower);
    }
  });


  /*
   * Extends L.Map to handle zoom animations.
   */

  L.Map.mergeOptions({
    zoomAnimation: true,
    zoomAnimationThreshold: 4
  });

  if (L.DomUtil.TRANSITION) {

    L.Map.addInitHook(function () {
      // don't animate on browsers without hardware-accelerated transitions or old Android/Opera
      this._zoomAnimated = this.options.zoomAnimation && L.DomUtil.TRANSITION &&
          L.Browser.any3d && !L.Browser.android23 && !L.Browser.mobileOpera;

      // zoom transitions run with the same duration for all layers, so if one of transitionend events
      // happens after starting zoom animation (propagating to the map pane), we know that it ended globally
      if (this._zoomAnimated) {
        L.DomEvent.on(this._mapPane, L.DomUtil.TRANSITION_END, this._catchTransitionEnd, this);
      }
    });
  }

  L.Map.include(!L.DomUtil.TRANSITION ? {} : {

    _catchTransitionEnd: function (e) {
      if (this._animatingZoom && e.propertyName.indexOf('transform') >= 0) {
        this._onZoomTransitionEnd();
      }
    },

    _nothingToAnimate: function () {
      return !this._container.getElementsByClassName('leaflet-zoom-animated').length;
    },

    _tryAnimatedZoom: function (center, zoom, options) {

      if (this._animatingZoom) { return true; }

      options = options || {};

      // don't animate if disabled, not supported or zoom difference is too large
      if (!this._zoomAnimated || options.animate === false || this._nothingToAnimate() ||
              Math.abs(zoom - this._zoom) > this.options.zoomAnimationThreshold) { return false; }

      // offset is the pixel coords of the zoom origin relative to the current center
      var scale = this.getZoomScale(zoom),
          offset = this._getCenterOffset(center)._divideBy(1 - 1 / scale),
        origin = this._getCenterLayerPoint()._add(offset);

      // don't animate if the zoom origin isn't within one screen from the current center, unless forced
      if (options.animate !== true && !this.getSize().contains(offset)) { return false; }

      this
          .fire('movestart')
          .fire('zoomstart');

      this._animateZoom(center, zoom, origin, scale, null, true);

      return true;
    },

    _animateZoom: function (center, zoom, origin, scale, delta, backwards, forTouchZoom) {

      if (!forTouchZoom) {
        this._animatingZoom = true;
      }

      // put transform transition on all layers with leaflet-zoom-animated class
      L.DomUtil.addClass(this._mapPane, 'leaflet-zoom-anim');

      // remember what center/zoom to set after animation
      this._animateToCenter = center;
      this._animateToZoom = zoom;

      // disable any dragging during animation
      if (L.Draggable) {
        L.Draggable._disabled = true;
      }

      L.Util.requestAnimFrame(function () {
        this.fire('zoomanim', {
          center: center,
          zoom: zoom,
          origin: origin,
          scale: scale,
          delta: delta,
          backwards: backwards
        });
      }, this);
    },

    _onZoomTransitionEnd: function () {

      this._animatingZoom = false;

      L.DomUtil.removeClass(this._mapPane, 'leaflet-zoom-anim');

      this._resetView(this._animateToCenter, this._animateToZoom, true, true);

      if (L.Draggable) {
        L.Draggable._disabled = false;
      }
    }
  });


  /*
    Zoom animation logic for L.TileLayer.
  */

  L.TileLayer.include({
    _animateZoom: function (e) {
      if (!this._animating) {
        this._animating = true;
        this._prepareBgBuffer();
      }

      var bg = this._bgBuffer,
          transform = L.DomUtil.TRANSFORM,
          initialTransform = e.delta ? L.DomUtil.getTranslateString(e.delta) : bg.style[transform],
          scaleStr = L.DomUtil.getScaleString(e.scale, e.origin);

      bg.style[transform] = e.backwards ?
          scaleStr + ' ' + initialTransform :
          initialTransform + ' ' + scaleStr;
    },

    _endZoomAnim: function () {
      var front = this._tileContainer,
          bg = this._bgBuffer;

      front.style.visibility = '';
      front.parentNode.appendChild(front); // Bring to fore

      // force reflow
      L.Util.falseFn(bg.offsetWidth);

      this._animating = false;
    },

    _clearBgBuffer: function () {
      var map = this._map;

      if (map && !map._animatingZoom && !map.touchZoom._zooming) {
        this._bgBuffer.innerHTML = '';
        this._bgBuffer.style[L.DomUtil.TRANSFORM] = '';
      }
    },

    _prepareBgBuffer: function () {

      var front = this._tileContainer,
          bg = this._bgBuffer;

      // if foreground layer doesn't have many tiles but bg layer does,
      // keep the existing bg layer and just zoom it some more

      var bgLoaded = this._getLoadedTilesPercentage(bg),
          frontLoaded = this._getLoadedTilesPercentage(front);

      if (bg && bgLoaded > 0.5 && frontLoaded < 0.5) {

        front.style.visibility = 'hidden';
        this._stopLoadingImages(front);
        return;
      }

      // prepare the buffer to become the front tile pane
      bg.style.visibility = 'hidden';
      bg.style[L.DomUtil.TRANSFORM] = '';

      // switch out the current layer to be the new bg layer (and vice-versa)
      this._tileContainer = bg;
      bg = this._bgBuffer = front;

      this._stopLoadingImages(bg);

      //prevent bg buffer from clearing right after zoom
      clearTimeout(this._clearBgBufferTimer);
    },

    _getLoadedTilesPercentage: function (container) {
      var tiles = container.getElementsByTagName('img'),
          i, len, count = 0;

      for (i = 0, len = tiles.length; i < len; i++) {
        if (tiles[i].complete) {
          count++;
        }
      }
      return count / len;
    },

    // stops loading all tiles in the background layer
    _stopLoadingImages: function (container) {
      var tiles = Array.prototype.slice.call(container.getElementsByTagName('img')),
          i, len, tile;

      for (i = 0, len = tiles.length; i < len; i++) {
        tile = tiles[i];

        if (!tile.complete) {
          tile.onload = L.Util.falseFn;
          tile.onerror = L.Util.falseFn;
          tile.src = L.Util.emptyImageUrl;

          tile.parentNode.removeChild(tile);
        }
      }
    }
  });


  /*
   * Provides L.Map with convenient shortcuts for using browser geolocation features.
   */

  L.Map.include({
    _defaultLocateOptions: {
      watch: false,
      setView: false,
      maxZoom: Infinity,
      timeout: 10000,
      maximumAge: 0,
      enableHighAccuracy: false
    },

    locate: function (/*Object*/ options) {

      options = this._locateOptions = L.extend(this._defaultLocateOptions, options);

      if (!navigator.geolocation) {
        this._handleGeolocationError({
          code: 0,
          message: 'Geolocation not supported.'
        });
        return this;
      }

      var onResponse = L.bind(this._handleGeolocationResponse, this),
        onError = L.bind(this._handleGeolocationError, this);

      if (options.watch) {
        this._locationWatchId =
                navigator.geolocation.watchPosition(onResponse, onError, options);
      } else {
        navigator.geolocation.getCurrentPosition(onResponse, onError, options);
      }
      return this;
    },

    stopLocate: function () {
      if (navigator.geolocation) {
        navigator.geolocation.clearWatch(this._locationWatchId);
      }
      if (this._locateOptions) {
        this._locateOptions.setView = false;
      }
      return this;
    },

    _handleGeolocationError: function (error) {
      var c = error.code,
          message = error.message ||
                  (c === 1 ? 'permission denied' :
                  (c === 2 ? 'position unavailable' : 'timeout'));

      if (this._locateOptions.setView && !this._loaded) {
        this.fitWorld();
      }

      this.fire('locationerror', {
        code: c,
        message: 'Geolocation error: ' + message + '.'
      });
    },

    _handleGeolocationResponse: function (pos) {
      var lat = pos.coords.latitude,
          lng = pos.coords.longitude,
          latlng = new L.LatLng(lat, lng),

          latAccuracy = 180 * pos.coords.accuracy / 40075017,
          lngAccuracy = latAccuracy / Math.cos(L.LatLng.DEG_TO_RAD * lat),

          bounds = L.latLngBounds(
                  [lat - latAccuracy, lng - lngAccuracy],
                  [lat + latAccuracy, lng + lngAccuracy]),

          options = this._locateOptions;

      if (options.setView) {
        var zoom = Math.min(this.getBoundsZoom(bounds), options.maxZoom);
        this.setView(latlng, zoom);
      }

      var data = {
        latlng: latlng,
        bounds: bounds,
        timestamp: pos.timestamp
      };

      for (var i in pos.coords) {
        if (typeof pos.coords[i] === 'number') {
          data[i] = pos.coords[i];
        }
      }

      this.fire('locationfound', data);
    }
  });


}(window, document));
;
/**
 * This file contains modified code for the layers control. HTML is changed and a function to set layer status is added
 */

L.Control.CustomLayersControl = L.Control.extend({
  options: {
    collapsed: true,
    position: 'topright',
    autoZIndex: true
  },

  initialize: function (baseLayers, overlays, options) {
    L.setOptions(this, options);

    this._layers = {};
    this._lastZIndex = 0;
    this._handlingClick = false;

    for (var i in baseLayers) {
      this._addLayer(baseLayers[i], i);
    }

    for (i in overlays) {
      this._addLayer(overlays[i], i, true);
    }
  },

  onAdd: function (map) {
    this._initLayout();
    this._update();

    map
      .on('layeradd', this._onLayerChange, this)
      .on('layerremove', this._onLayerChange, this);

    return this._container;
  },

  onRemove: function (map) {
    map
      .off('layeradd', this._onLayerChange, this)
      .off('layerremove', this._onLayerChange, this);
  },

  //custom code added 
  /**
   * Get currently active overlay layers on the map
   * @return {{layerId: l}} where layerId is <code>L.stamp(l.layer)</code>
   *  and l @see #getActiveBaseLayer jsdoc.
   */
  getActiveOverlayLayers: function () {
    return this._findActiveOverlayLayers();
  },

  _findActiveOverlayLayers: function () {
    var result = {}
    var layers = this._layers;
    for (var layerId in layers) {
      if (this._layers.hasOwnProperty(layerId)) {
        var layer = layers[layerId];
        if (layer.overlay && this._map.hasLayer(layer.layer)) {
          result[layerId] = layer;
        }
      }
    }
    return result;
  },

  /**
   * Get currently checked layers, not necessarily active
   */
  getCheckedOverlayLayers: function () {
    var i, input, 
      inputs = this._container.getElementsByTagName('input'),
      inputsLen = inputs.length;

    var result = {};
    for (i = 0; i < inputsLen; i++) {
      input = inputs[i];

      if (input.checked) {
        result[input.layerId] = this._layers[input.layerId];
      }
    }

    return result;

  },

  getOverlayLayers: function () {
    var result = {}
    var layers = this._layers;
    for (var layerId in layers) {
      if (this._layers.hasOwnProperty(layerId)) {
        var layer = layers[layerId];
        if (layer.overlay) {
          result[layerId] = layer;
        }
      }
    }
    return result;
  },

  addBaseLayer: function (layer, name) {
    this._addLayer(layer, name);
    this._update();
    return this;
  },

  addOverlay: function (layer, name) {
    this._addLayer(layer, name, true);
    this._update();
    return this;
  },

  removeLayer: function (layer) {
    var id = L.stamp(layer);
    delete this._layers[id];
    this._update();
    return this;
  },

  /**
   * set status of layer
   * set whether layer is disabled or/and checked
   * @param {any} layer
   * @param {any} disabled
   * @param {any} checked
   */
  setLayerStatus: function(layer, disabled, checked) {
    var label = document.getElementById("leaflet-id-" + layer._leaflet_id);

    var input = label.getElementsByTagName("input")[0];

    label.title = layer._displayName;

    input.checked = checked;
    input.disabled = disabled;
    label.className = "";
    if (checked) {
      label.className = "leaflet-checked ";
    }
    if (disabled) {
      label.className += "leaflet-disabled";
      label.title += ". Bitte zoomen Sie heran.";
    }
    
    if (!disabled && checked) {
      this._map.addLayer(layer);
    } else {
      this._map.removeLayer(layer);
    }
  },
  
  _initLayout: function () {
    var className = 'leaflet-control-layers',
      container = this._container = L.DomUtil.create('div', className);

    var baseLayersContainer = this._baseLayersContainer = L.DomUtil.create('div', 'leaflet-control-layers-base', container);
    this._baseLayersList = L.DomUtil.create('div', 'leaflet-control-layers-list', baseLayersContainer);

    var overlaysContainer = L.DomUtil.create('div', 'leaflet-control-layers-overlays', container);
    this._overlaysList = L.DomUtil.create('div', 'leaflet-control-layers-list', overlaysContainer);

    if (!L.Browser.touch) {
      L.DomEvent
        .disableClickPropagation(container)
        .disableScrollPropagation(container);
    } else {
      L.DomEvent.on(container, 'click', L.DomEvent.stopPropagation);
    }

    if (this.options.collapsed) {
      var link = this._layersLink = L.DomUtil.create('a', className + '-toggle', baseLayersContainer);
      link.href = '#';
      link.title = 'Layers';

      if (L.Browser.touch) {
        L.DomEvent
          .on(link, 'click', L.DomEvent.stop)
          .on(link, 'click', this._expand, this);
      }
      else {
        L.DomEvent.on(link, 'focus', this._expand, this);
      }

      if (!L.Browser.android) {
        L.DomEvent
          .on(baseLayersContainer, 'mouseover', this._expand, this)
          .on(baseLayersContainer, 'mouseout', this._collapse, this);
      }
      
      this._map.on('click', this._collapse, this);
      // TODO keyboard accessibility
    } else {
      this._expand();
    }
    
  },

  _addLayer: function (layer, name, overlay) {
    var id = L.stamp(layer);

    this._layers[id] = {
      layer: layer,
      name: name,
      overlay: overlay
    };

    if (this.options.autoZIndex && layer.setZIndex) {
      this._lastZIndex++;
      layer.setZIndex(this._lastZIndex);
    }
  },

  _update: function () {
    if (!this._container) {
      return;
    }

    this._baseLayersList.innerHTML = '';
    this._overlaysList.innerHTML = '';
    
    var baseLayersPresent = false,
      overlaysPresent = false,
      i, obj;

    for (i in this._layers) {
      obj = this._layers[i];
      this._addItem(obj);
      overlaysPresent = overlaysPresent || obj.overlay;
      baseLayersPresent = baseLayersPresent || !obj.overlay;
    }

  },


  _onLayerChange: function (e) {
    var obj = this._layers[L.stamp(e.layer)];

    if (!obj) { return; }

    var type = obj.overlay ?
      (e.type === 'layeradd' ? 'overlayadd' : 'overlayremove') :
      (e.type === 'layeradd' ? 'baselayerchange' : null);

    if (type) {
      this._map.fire(type, obj);
    }
  },

  // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)
  _createRadioElement: function (name, checked) {

    var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' + name + '"';
    if (checked) {
      radioHtml += ' checked="checked"';
    }
    radioHtml += '/>';

    var radioFragment = document.createElement('div');
    radioFragment.innerHTML = radioHtml;

    return radioFragment.firstChild;
  },

  _addItem: function (obj) {
    var label = document.createElement('label'),
      input,
      checked = this._map.hasLayer(obj.layer);

    label.title = obj.name;
    label.id = "leaflet-id-"+obj.layer._leaflet_id
       
    if (obj.overlay) {
      input = document.createElement('input');
      input.type = 'checkbox';
      input.className = 'leaflet-control-layers-selector';
      input.defaultChecked = obj.checked;
    } else {
      input = this._createRadioElement('leaflet-base-layers', checked);
    }

    input.layerId = L.stamp(obj.layer);

    L.DomEvent.on(input, 'click', this._onInputClick, this);

    var name = document.createElement('span');
    name.innerHTML = ' ' + obj.name;
    
    label.appendChild(input);

    if (obj.layer._img_src) {
      var img = document.createElement('img');
      img.src = (obj.layer._img_src);
      img.alt = "";

      label.appendChild(img);
    }

    label.appendChild(name);
   

    var container = obj.overlay ? this._overlaysList : this._baseLayersList;
    container.appendChild(label);

    return label;
  },

  _onInputClick: function () {
    //var i, input, obj,
    //  inputs = this._container.getElementsByTagName('input'),
    //  inputsLen = inputs.length;

    //this._handlingClick = true;

    //for (i = 0; i < inputsLen; i++) {
    //  input = inputs[i];
    //  obj = this._layers[input.layerId];
    //  obj.checked = input.checked;
    // }

    //this._handlingClick = false;

    this._refocusOnMap();
  },

  _expand: function () {
    L.DomUtil.addClass(this._baseLayersContainer, 'leaflet-control-layers-expanded');
  },

  _collapse: function () {
    this._baseLayersContainer.className = this._baseLayersContainer.className.replace(' leaflet-control-layers-expanded', '');
  }
});

L.control.customlayerscontrol = function (baseLayers, overlays, options) {
  return new L.Control.CustomLayersControl(baseLayers, overlays, options);
};
;
/*
Copyright (c) 2013 Dominik Moritz

This file is part of the leaflet locate control. It is licensed under the MIT license.
You can find the project at: https://github.com/domoritz/leaflet-locatecontrol
*/
L.Control.Locate = L.Control.extend({
  options: {
    position: 'topleft',
    drawCircle: true,
    follow: false,  // follow with zoom and pan the user's location
    stopFollowingOnDrag: false, // if follow is true, stop following when map is dragged
    // range circle
    circleStyle: {
      color: '#136AEC',
      fillColor: '#136AEC',
      fillOpacity: 0.15,
      weight: 2,
      opacity: 0.5
    },
    // inner marker
    markerStyle: {
      color: '#136AEC',
      fillColor: '#2A93EE',
      fillOpacity: 0.7,
      weight: 2,
      opacity: 0.9,
      radius: 5
    },
    // changes to range circle and inner marker while following
    // it is only necessary to provide the things that should change
    followCircleStyle: {},
    followMarkerStyle: {
      //color: '#FFA500',
      //fillColor: '#FFB000'
    },
    metric: true,
    onLocationError: function (err) {
      // this event is called in case of any location error
      // that is not a time out error.
      alert(err.message);
    },
    onLocationOutsideMapBounds: function (context) {
      // this event is repeatedly called when the location changes
      alert(context.options.strings.outsideMapBoundsMsg);
    },
    setView: true, // automatically sets the map view to the user's location
    strings: {
      title: VVO.I18N.translate('showmewhereiam'),
      popup: "You are within {distance} {unit} from this point",
      outsideMapBoundsMsg: "You seem located outside the boundaries of the map"
    },
    locateOptions: {}
  },

  onAdd: function (map) {
    var container = L.DomUtil.create('div',
        'leaflet-control-locate leaflet-bar leaflet-control');

    var self = this;
    this._layer = new L.LayerGroup();
    this._layer.addTo(map);
    this._event = undefined;

    this._locateOptions = {
      watch: true  // if you overwrite this, visualization cannot be updated
    };
    L.extend(this._locateOptions, this.options.locateOptions);
    L.extend(this._locateOptions, {
      setView: false // have to set this to false because we have to
      // do setView manually
    });

    // extend the follow marker style and circle from the normal style
    var tmp = {};
    L.extend(tmp, this.options.markerStyle, this.options.followMarkerStyle);
    this.options.followMarkerStyle = tmp;
    tmp = {};
    L.extend(tmp, this.options.circleStyle, this.options.followCircleStyle);
    this.options.followCircleStyle = tmp;

    var link = L.DomUtil.create('a', 'leaflet-bar-part leaflet-bar-part-single', container);
    link.href = '#';
    link.title = this.options.strings.title;

    L.DomEvent
        .on(link, 'click', L.DomEvent.stopPropagation)
        .on(link, 'click', L.DomEvent.preventDefault)
        .on(link, 'click', function () {
          if (self._active && (map.getBounds().contains(self._event.latlng) || !self.options.setView ||
              isOutsideMapBounds())) {
            stopLocate();
          } else {
            if (self.options.setView) {
              self._locateOnNextLocationFound = true;
            }
            if (!self._active) {
              map.locate(self._locateOptions);
            }
            self._active = true;
            if (self.options.follow) {
              startFollowing();
            }
            if (!self._event) {
              L.DomUtil.addClass(self._container, "requesting");
              L.DomUtil.removeClass(self._container, "active");
              L.DomUtil.removeClass(self._container, "following");
            } else {
              visualizeLocation();
            }
          }
        })
        .on(link, 'dblclick', L.DomEvent.stopPropagation);

    var onLocationFound = function (e) {
      // no need to do anything if the location has not changed
      if (self._event &&
          (self._event.latlng.lat === e.latlng.lat &&
           self._event.latlng.lng === e.latlng.lng &&
           self._event.accuracy === e.accuracy)) {
        return;
      }

      if (!self._active) {
        return;
      }

      self._event = e;

      if (self.options.follow && self._following) {
        self._locateOnNextLocationFound = true;
      }

      visualizeLocation();
    };

    var startFollowing = function () {
      self._following = true;
      if (self.options.stopFollowingOnDrag) {
        map.on('dragstart', stopFollowing);
      }
    };

    var stopFollowing = function () {
      self._following = false;
      if (self.options.stopFollowingOnDrag) {
        map.off('dragstart', stopFollowing);
      }
      visualizeLocation();
    };

    var isOutsideMapBounds = function () {
      if (self._event === undefined)
        return false;
      return map.options.maxBounds &&
          !map.options.maxBounds.contains(self._event.latlng);
    };

    var visualizeLocation = function () {
      if (self._event.accuracy === undefined)
        self._event.accuracy = 0;

      var radius = self._event.accuracy;
      if (self._locateOnNextLocationFound) {
        if (isOutsideMapBounds()) {
          self.options.onLocationOutsideMapBounds(self);
        } else {
          map.fitBounds(self._event.bounds);
        }
        self._locateOnNextLocationFound = false;
      }

      // circle with the radius of the location's accuracy
      var style;
      if (self.options.drawCircle) {
        if (self._following) {
          style = self.options.followCircleStyle;
        } else {
          style = self.options.circleStyle;
        }

        if (!self._circle) {
          self._circle = L.circle(self._event.latlng, radius, style)
              .addTo(self._layer);
        } else {
          self._circle.setLatLng(self._event.latlng).setRadius(radius);
        }
      }

      var distance, unit;
      if (self.options.metric) {
        distance = radius.toFixed(0);
        unit = "meters";
      } else {
        distance = (radius * 3.2808399).toFixed(0);
        unit = "feet";
      }

      // small inner marker
      var m;
      if (self._following) {
        m = self.options.followMarkerStyle;
      } else {
        m = self.options.markerStyle;
      }

      var t = self.options.strings.popup;
      if (!self._circleMarker) {
        self._circleMarker = L.circleMarker(self._event.latlng, m)
            .bindPopup(L.Util.template(t, { distance: distance, unit: unit }))
            .addTo(self._layer);
      } else {
        self._circleMarker.setLatLng(self._event.latlng)
            .bindPopup(L.Util.template(t, { distance: distance, unit: unit }))
            ._popup.setLatLng(self._event.latlng);
      }

      if (!self._container)
        return;
      if (self._following) {
        L.DomUtil.removeClass(self._container, "requesting");
        L.DomUtil.addClass(self._container, "active");
        L.DomUtil.addClass(self._container, "following");
      } else {
        L.DomUtil.removeClass(self._container, "requesting");
        L.DomUtil.addClass(self._container, "active");
        L.DomUtil.removeClass(self._container, "following");
      }
    };

    var resetVariables = function () {
      self._active = false;
      self._locateOnNextLocationFound = self.options.setView;
      self._following = false;
    };

    resetVariables();

    var stopLocate = function () {
      map.stopLocate();
      map.off('dragstart', stopFollowing);

      L.DomUtil.removeClass(self._container, "requesting");
      L.DomUtil.removeClass(self._container, "active");
      L.DomUtil.removeClass(self._container, "following");
      resetVariables();

      self._layer.clearLayers();
      self._circleMarker = undefined;
      self._circle = undefined;
    };

    var onLocationError = function (err) {
      // ignore time out error if the location is watched
      if (err.code == 3 && this._locateOptions.watch) {
        return;
      }

      stopLocate();
      self.options.onLocationError(err);
    };

    // event hooks
    map.on('locationfound', onLocationFound, self);
    map.on('locationerror', onLocationError, self);

    return container;
  }
});

L.Map.addInitHook(function () {
  if (this.options.locateControl) {
    this.locateControl = L.control.locate();
    this.addControl(this.locateControl);
  }
});

L.control.locate = function (options) {
  return new L.Control.Locate(options);
};
;
/*
 Leaflet.markercluster, Provides Beautiful Animated Marker Clustering functionality for Leaflet, a JS library for interactive maps.
 https://github.com/Leaflet/Leaflet.markercluster
 (c) 2012-2013, Dave Leaver, smartrak
*/
!function (t, e) { L.MarkerClusterGroup = L.FeatureGroup.extend({ options: { maxClusterRadius: 80, iconCreateFunction: null, spiderfyOnMaxZoom: !0, showCoverageOnHover: !0, zoomToBoundsOnClick: !0, singleMarkerMode: !1, disableClusteringAtZoom: null, removeOutsideVisibleBounds: !0, animateAddingMarkers: !1, spiderfyDistanceMultiplier: 1, chunkedLoading: !1, chunkInterval: 200, chunkDelay: 50, chunkProgress: null, polygonOptions: {} }, initialize: function (t) { L.Util.setOptions(this, t), this.options.iconCreateFunction || (this.options.iconCreateFunction = this._defaultIconCreateFunction), this._featureGroup = L.featureGroup(), this._featureGroup.on(L.FeatureGroup.EVENTS, this._propagateEvent, this), this._nonPointGroup = L.featureGroup(), this._nonPointGroup.on(L.FeatureGroup.EVENTS, this._propagateEvent, this), this._inZoomAnimation = 0, this._needsClustering = [], this._needsRemoving = [], this._currentShownBounds = null, this._queue = [] }, addLayer: function (t) { if (t instanceof L.LayerGroup) { var e = []; for (var i in t._layers) e.push(t._layers[i]); return this.addLayers(e) } if (!t.getLatLng) return this._nonPointGroup.addLayer(t), this; if (!this._map) return this._needsClustering.push(t), this; if (this.hasLayer(t)) return this; this._unspiderfy && this._unspiderfy(), this._addLayer(t, this._maxZoom); var n = t, s = this._map.getZoom(); if (t.__parent) for (; n.__parent._zoom >= s;) n = n.__parent; return this._currentShownBounds.contains(n.getLatLng()) && (this.options.animateAddingMarkers ? this._animationAddLayer(t, n) : this._animationAddLayerNonAnimated(t, n)), this }, removeLayer: function (t) { if (t instanceof L.LayerGroup) { var e = []; for (var i in t._layers) e.push(t._layers[i]); return this.removeLayers(e) } return t.getLatLng ? this._map ? t.__parent ? (this._unspiderfy && (this._unspiderfy(), this._unspiderfyLayer(t)), this._removeLayer(t, !0), this._featureGroup.hasLayer(t) && (this._featureGroup.removeLayer(t), t.setOpacity && t.setOpacity(1)), this) : this : (!this._arraySplice(this._needsClustering, t) && this.hasLayer(t) && this._needsRemoving.push(t), this) : (this._nonPointGroup.removeLayer(t), this) }, addLayers: function (t) { var e, i, n, s, r = this._featureGroup, o = this._nonPointGroup, a = this.options.chunkedLoading, h = this.options.chunkInterval, _ = this.options.chunkProgress; if (this._map) { var u = 0, l = (new Date).getTime(), d = L.bind(function () { for (var e = (new Date).getTime() ; u < t.length; u++) { if (a && 0 === u % 200) { var i = (new Date).getTime() - e; if (i > h) break } if (s = t[u], s.getLatLng) { if (!this.hasLayer(s) && (this._addLayer(s, this._maxZoom), s.__parent && 2 === s.__parent.getChildCount())) { var n = s.__parent.getAllChildMarkers(), p = n[0] === s ? n[1] : n[0]; r.removeLayer(p) } } else o.addLayer(s) } _ && _(u, t.length, (new Date).getTime() - l), u === t.length ? (this._featureGroup.eachLayer(function (t) { t instanceof L.MarkerCluster && t._iconNeedsUpdate && t._updateIcon() }), this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds)) : setTimeout(d, this.options.chunkDelay) }, this); d() } else { for (e = [], i = 0, n = t.length; n > i; i++) s = t[i], s.getLatLng ? this.hasLayer(s) || e.push(s) : o.addLayer(s); this._needsClustering = this._needsClustering.concat(e) } return this }, removeLayers: function (t) { var e, i, n, s = this._featureGroup, r = this._nonPointGroup; if (!this._map) { for (e = 0, i = t.length; i > e; e++) n = t[e], this._arraySplice(this._needsClustering, n), r.removeLayer(n); return this } for (e = 0, i = t.length; i > e; e++) n = t[e], n.__parent ? (this._removeLayer(n, !0, !0), s.hasLayer(n) && (s.removeLayer(n), n.setOpacity && n.setOpacity(1))) : r.removeLayer(n); return this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds), s.eachLayer(function (t) { t instanceof L.MarkerCluster && t._updateIcon() }), this }, clearLayers: function () { return this._map || (this._needsClustering = [], delete this._gridClusters, delete this._gridUnclustered), this._noanimationUnspiderfy && this._noanimationUnspiderfy(), this._featureGroup.clearLayers(), this._nonPointGroup.clearLayers(), this.eachLayer(function (t) { delete t.__parent }), this._map && this._generateInitialClusters(), this }, getBounds: function () { var t = new L.LatLngBounds; this._topClusterLevel && t.extend(this._topClusterLevel._bounds); for (var e = this._needsClustering.length - 1; e >= 0; e--) t.extend(this._needsClustering[e].getLatLng()); return t.extend(this._nonPointGroup.getBounds()), t }, eachLayer: function (t, e) { var i, n = this._needsClustering.slice(); for (this._topClusterLevel && this._topClusterLevel.getAllChildMarkers(n), i = n.length - 1; i >= 0; i--) t.call(e, n[i]); this._nonPointGroup.eachLayer(t, e) }, getLayers: function () { var t = []; return this.eachLayer(function (e) { t.push(e) }), t }, getLayer: function (t) { var e = null; return this.eachLayer(function (i) { L.stamp(i) === t && (e = i) }), e }, hasLayer: function (t) { if (!t) return !1; var e, i = this._needsClustering; for (e = i.length - 1; e >= 0; e--) if (i[e] === t) return !0; for (i = this._needsRemoving, e = i.length - 1; e >= 0; e--) if (i[e] === t) return !1; return !(!t.__parent || t.__parent._group !== this) || this._nonPointGroup.hasLayer(t) }, zoomToShowLayer: function (t, e) { var i = function () { if ((t._icon || t.__parent._icon) && !this._inZoomAnimation) if (this._map.off("moveend", i, this), this.off("animationend", i, this), t._icon) e(); else if (t.__parent._icon) { var n = function () { this.off("spiderfied", n, this), e() }; this.on("spiderfied", n, this), t.__parent.spiderfy() } }; t._icon && this._map.getBounds().contains(t.getLatLng()) ? e() : t.__parent._zoom < this._map.getZoom() ? (this._map.on("moveend", i, this), this._map.panTo(t.getLatLng())) : (this._map.on("moveend", i, this), this.on("animationend", i, this), this._map.setView(t.getLatLng(), t.__parent._zoom + 1), t.__parent.zoomToBounds()) }, onAdd: function (t) { this._map = t; var e, i, n; if (!isFinite(this._map.getMaxZoom())) throw "Map has no maxZoom specified"; for (this._featureGroup.onAdd(t), this._nonPointGroup.onAdd(t), this._gridClusters || this._generateInitialClusters(), e = 0, i = this._needsRemoving.length; i > e; e++) n = this._needsRemoving[e], this._removeLayer(n, !0); this._needsRemoving = [], this._zoom = this._map.getZoom(), this._currentShownBounds = this._getExpandedVisibleBounds(), this._map.on("zoomend", this._zoomEnd, this), this._map.on("moveend", this._moveEnd, this), this._spiderfierOnAdd && this._spiderfierOnAdd(), this._bindEvents(), i = this._needsClustering, this._needsClustering = [], this.addLayers(i) }, onRemove: function (t) { t.off("zoomend", this._zoomEnd, this), t.off("moveend", this._moveEnd, this), this._unbindEvents(), this._map._mapPane.className = this._map._mapPane.className.replace(" leaflet-cluster-anim", ""), this._spiderfierOnRemove && this._spiderfierOnRemove(), this._hideCoverage(), this._featureGroup.onRemove(t), this._nonPointGroup.onRemove(t), this._featureGroup.clearLayers(), this._map = null }, getVisibleParent: function (t) { for (var e = t; e && !e._icon;) e = e.__parent; return e || null }, _arraySplice: function (t, e) { for (var i = t.length - 1; i >= 0; i--) if (t[i] === e) return t.splice(i, 1), !0 }, _removeLayer: function (t, e, i) { var n = this._gridClusters, s = this._gridUnclustered, r = this._featureGroup, o = this._map; if (e) for (var a = this._maxZoom; a >= 0 && s[a].removeObject(t, o.project(t.getLatLng(), a)) ; a--); var h, _ = t.__parent, u = _._markers; for (this._arraySplice(u, t) ; _ && (_._childCount--, !(_._zoom < 0)) ;) e && _._childCount <= 1 ? (h = _._markers[0] === t ? _._markers[1] : _._markers[0], n[_._zoom].removeObject(_, o.project(_._cLatLng, _._zoom)), s[_._zoom].addObject(h, o.project(h.getLatLng(), _._zoom)), this._arraySplice(_.__parent._childClusters, _), _.__parent._markers.push(h), h.__parent = _.__parent, _._icon && (r.removeLayer(_), i || r.addLayer(h))) : (_._recalculateBounds(), i && _._icon || _._updateIcon()), _ = _.__parent; delete t.__parent }, _isOrIsParent: function (t, e) { for (; e;) { if (t === e) return !0; e = e.parentNode } return !1 }, _propagateEvent: function (t) { if (t.layer instanceof L.MarkerCluster) { if (t.originalEvent && this._isOrIsParent(t.layer._icon, t.originalEvent.relatedTarget)) return; t.type = "cluster" + t.type } this.fire(t.type, t) }, _defaultIconCreateFunction: function (t) { var e = t.getChildCount(), i = " marker-cluster-"; return i += 10 > e ? "small" : 100 > e ? "medium" : "large", new L.DivIcon({ html: "<div><span>" + e + "</span></div>", className: "marker-cluster" + i, iconSize: new L.Point(40, 40) }) }, _bindEvents: function () { var t = this._map, e = this.options.spiderfyOnMaxZoom, i = this.options.showCoverageOnHover, n = this.options.zoomToBoundsOnClick; (e || n) && this.on("clusterclick", this._zoomOrSpiderfy, this), i && (this.on("clustermouseover", this._showCoverage, this), this.on("clustermouseout", this._hideCoverage, this), t.on("zoomend", this._hideCoverage, this)) }, _zoomOrSpiderfy: function (t) { var e = this._map; e.getMaxZoom() === e.getZoom() ? this.options.spiderfyOnMaxZoom && t.layer.spiderfy() : this.options.zoomToBoundsOnClick && t.layer.zoomToBounds(), t.originalEvent && 13 === t.originalEvent.keyCode && e._container.focus() }, _showCoverage: function (t) { var e = this._map; this._inZoomAnimation || (this._shownPolygon && e.removeLayer(this._shownPolygon), t.layer.getChildCount() > 2 && t.layer !== this._spiderfied && (this._shownPolygon = new L.Polygon(t.layer.getConvexHull(), this.options.polygonOptions), e.addLayer(this._shownPolygon))) }, _hideCoverage: function () { this._shownPolygon && (this._map.removeLayer(this._shownPolygon), this._shownPolygon = null) }, _unbindEvents: function () { var t = this.options.spiderfyOnMaxZoom, e = this.options.showCoverageOnHover, i = this.options.zoomToBoundsOnClick, n = this._map; (t || i) && this.off("clusterclick", this._zoomOrSpiderfy, this), e && (this.off("clustermouseover", this._showCoverage, this), this.off("clustermouseout", this._hideCoverage, this), n.off("zoomend", this._hideCoverage, this)) }, _zoomEnd: function () { this._map && (this._mergeSplitClusters(), this._zoom = this._map._zoom, this._currentShownBounds = this._getExpandedVisibleBounds()) }, _moveEnd: function () { if (!this._inZoomAnimation) { var t = this._getExpandedVisibleBounds(); this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, t), this._topClusterLevel._recursivelyAddChildrenToMap(null, this._map._zoom, t), this._currentShownBounds = t } }, _generateInitialClusters: function () { var t = this._map.getMaxZoom(), e = this.options.maxClusterRadius, i = e; "function" != typeof e && (i = function () { return e }), this.options.disableClusteringAtZoom && (t = this.options.disableClusteringAtZoom - 1), this._maxZoom = t, this._gridClusters = {}, this._gridUnclustered = {}; for (var n = t; n >= 0; n--) this._gridClusters[n] = new L.DistanceGrid(i(n)), this._gridUnclustered[n] = new L.DistanceGrid(i(n)); this._topClusterLevel = new L.MarkerCluster(this, -1) }, _addLayer: function (t, e) { var i, n, s = this._gridClusters, r = this._gridUnclustered; for (this.options.singleMarkerMode && (t.options.icon = this.options.iconCreateFunction({ getChildCount: function () { return 1 }, getAllChildMarkers: function () { return [t] } })) ; e >= 0; e--) { i = this._map.project(t.getLatLng(), e); var o = s[e].getNearObject(i); if (o) return o._addChild(t), t.__parent = o, void 0; if (o = r[e].getNearObject(i)) { var a = o.__parent; a && this._removeLayer(o, !1); var h = new L.MarkerCluster(this, e, o, t); s[e].addObject(h, this._map.project(h._cLatLng, e)), o.__parent = h, t.__parent = h; var _ = h; for (n = e - 1; n > a._zoom; n--) _ = new L.MarkerCluster(this, n, _), s[n].addObject(_, this._map.project(o.getLatLng(), n)); for (a._addChild(_), n = e; n >= 0 && r[n].removeObject(o, this._map.project(o.getLatLng(), n)) ; n--); return } r[e].addObject(t, i) } this._topClusterLevel._addChild(t), t.__parent = this._topClusterLevel }, _enqueue: function (t) { this._queue.push(t), this._queueTimeout || (this._queueTimeout = setTimeout(L.bind(this._processQueue, this), 300)) }, _processQueue: function () { for (var t = 0; t < this._queue.length; t++) this._queue[t].call(this); this._queue.length = 0, clearTimeout(this._queueTimeout), this._queueTimeout = null }, _mergeSplitClusters: function () { this._processQueue(), this._zoom < this._map._zoom && this._currentShownBounds.contains(this._getExpandedVisibleBounds()) ? (this._animationStart(), this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, this._getExpandedVisibleBounds()), this._animationZoomIn(this._zoom, this._map._zoom)) : this._zoom > this._map._zoom ? (this._animationStart(), this._animationZoomOut(this._zoom, this._map._zoom)) : this._moveEnd() }, _getExpandedVisibleBounds: function () { if (!this.options.removeOutsideVisibleBounds) return this.getBounds(); var t = this._map, e = t.getBounds(), i = e._southWest, n = e._northEast, s = L.Browser.mobile ? 0 : Math.abs(i.lat - n.lat), r = L.Browser.mobile ? 0 : Math.abs(i.lng - n.lng); return new L.LatLngBounds(new L.LatLng(i.lat - s, i.lng - r, !0), new L.LatLng(n.lat + s, n.lng + r, !0)) }, _animationAddLayerNonAnimated: function (t, e) { if (e === t) this._featureGroup.addLayer(t); else if (2 === e._childCount) { e._addToMap(); var i = e.getAllChildMarkers(); this._featureGroup.removeLayer(i[0]), this._featureGroup.removeLayer(i[1]) } else e._updateIcon() } }), L.MarkerClusterGroup.include(L.DomUtil.TRANSITION ? { _animationStart: function () { this._map._mapPane.className += " leaflet-cluster-anim", this._inZoomAnimation++ }, _animationEnd: function () { this._map && (this._map._mapPane.className = this._map._mapPane.className.replace(" leaflet-cluster-anim", "")), this._inZoomAnimation--, this.fire("animationend") }, _animationZoomIn: function (t, e) { var i, n = this._getExpandedVisibleBounds(), s = this._featureGroup; this._topClusterLevel._recursively(n, t, 0, function (r) { var o, a = r._latlng, h = r._markers; for (n.contains(a) || (a = null), r._isSingleParent() && t + 1 === e ? (s.removeLayer(r), r._recursivelyAddChildrenToMap(null, e, n)) : (r.setOpacity(0), r._recursivelyAddChildrenToMap(a, e, n)), i = h.length - 1; i >= 0; i--) o = h[i], n.contains(o._latlng) || s.removeLayer(o) }), this._forceLayout(), this._topClusterLevel._recursivelyBecomeVisible(n, e), s.eachLayer(function (t) { t instanceof L.MarkerCluster || !t._icon || t.setOpacity(1) }), this._topClusterLevel._recursively(n, t, e, function (t) { t._recursivelyRestoreChildPositions(e) }), this._enqueue(function () { this._topClusterLevel._recursively(n, t, 0, function (t) { s.removeLayer(t), t.setOpacity(1) }), this._animationEnd() }) }, _animationZoomOut: function (t, e) { this._animationZoomOutSingle(this._topClusterLevel, t - 1, e), this._topClusterLevel._recursivelyAddChildrenToMap(null, e, this._getExpandedVisibleBounds()), this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, t, this._getExpandedVisibleBounds()) }, _animationZoomOutSingle: function (t, e, i) { var n = this._getExpandedVisibleBounds(); t._recursivelyAnimateChildrenInAndAddSelfToMap(n, e + 1, i); var s = this; this._forceLayout(), t._recursivelyBecomeVisible(n, i), this._enqueue(function () { if (1 === t._childCount) { var r = t._markers[0]; r.setLatLng(r.getLatLng()), r.setOpacity && r.setOpacity(1) } else t._recursively(n, i, 0, function (t) { t._recursivelyRemoveChildrenFromMap(n, e + 1) }); s._animationEnd() }) }, _animationAddLayer: function (t, e) { var i = this, n = this._featureGroup; n.addLayer(t), e !== t && (e._childCount > 2 ? (e._updateIcon(), this._forceLayout(), this._animationStart(), t._setPos(this._map.latLngToLayerPoint(e.getLatLng())), t.setOpacity(0), this._enqueue(function () { n.removeLayer(t), t.setOpacity(1), i._animationEnd() })) : (this._forceLayout(), i._animationStart(), i._animationZoomOutSingle(e, this._map.getMaxZoom(), this._map.getZoom()))) }, _forceLayout: function () { L.Util.falseFn(e.body.offsetWidth) } } : { _animationStart: function () { }, _animationZoomIn: function (t, e) { this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, t), this._topClusterLevel._recursivelyAddChildrenToMap(null, e, this._getExpandedVisibleBounds()), this.fire("animationend") }, _animationZoomOut: function (t, e) { this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, t), this._topClusterLevel._recursivelyAddChildrenToMap(null, e, this._getExpandedVisibleBounds()), this.fire("animationend") }, _animationAddLayer: function (t, e) { this._animationAddLayerNonAnimated(t, e) } }), L.markerClusterGroup = function (t) { return new L.MarkerClusterGroup(t) }, L.MarkerCluster = L.Marker.extend({ initialize: function (t, e, i, n) { L.Marker.prototype.initialize.call(this, i ? i._cLatLng || i.getLatLng() : new L.LatLng(0, 0), { icon: this }), this._group = t, this._zoom = e, this._markers = [], this._childClusters = [], this._childCount = 0, this._iconNeedsUpdate = !0, this._bounds = new L.LatLngBounds, i && this._addChild(i), n && this._addChild(n) }, getAllChildMarkers: function (t) { t = t || []; for (var e = this._childClusters.length - 1; e >= 0; e--) this._childClusters[e].getAllChildMarkers(t); for (var i = this._markers.length - 1; i >= 0; i--) t.push(this._markers[i]); return t }, getChildCount: function () { return this._childCount }, zoomToBounds: function () { for (var t, e = this._childClusters.slice(), i = this._group._map, n = i.getBoundsZoom(this._bounds), s = this._zoom + 1, r = i.getZoom() ; e.length > 0 && n > s;) { s++; var o = []; for (t = 0; t < e.length; t++) o = o.concat(e[t]._childClusters); e = o } n > s ? this._group._map.setView(this._latlng, s) : r >= n ? this._group._map.setView(this._latlng, r + 1) : this._group._map.fitBounds(this._bounds) }, getBounds: function () { var t = new L.LatLngBounds; return t.extend(this._bounds), t }, _updateIcon: function () { this._iconNeedsUpdate = !0, this._icon && this.setIcon(this) }, createIcon: function () { return this._iconNeedsUpdate && (this._iconObj = this._group.options.iconCreateFunction(this), this._iconNeedsUpdate = !1), this._iconObj.createIcon() }, createShadow: function () { return this._iconObj.createShadow() }, _addChild: function (t, e) { this._iconNeedsUpdate = !0, this._expandBounds(t), t instanceof L.MarkerCluster ? (e || (this._childClusters.push(t), t.__parent = this), this._childCount += t._childCount) : (e || this._markers.push(t), this._childCount++), this.__parent && this.__parent._addChild(t, !0) }, _expandBounds: function (t) { var e, i = t._wLatLng || t._latlng; t instanceof L.MarkerCluster ? (this._bounds.extend(t._bounds), e = t._childCount) : (this._bounds.extend(i), e = 1), this._cLatLng || (this._cLatLng = t._cLatLng || i); var n = this._childCount + e; this._wLatLng ? (this._wLatLng.lat = (i.lat * e + this._wLatLng.lat * this._childCount) / n, this._wLatLng.lng = (i.lng * e + this._wLatLng.lng * this._childCount) / n) : this._latlng = this._wLatLng = new L.LatLng(i.lat, i.lng) }, _addToMap: function (t) { t && (this._backupLatlng = this._latlng, this.setLatLng(t)), this._group._featureGroup.addLayer(this) }, _recursivelyAnimateChildrenIn: function (t, e, i) { this._recursively(t, 0, i - 1, function (t) { var i, n, s = t._markers; for (i = s.length - 1; i >= 0; i--) n = s[i], n._icon && (n._setPos(e), n.setOpacity(0)) }, function (t) { var i, n, s = t._childClusters; for (i = s.length - 1; i >= 0; i--) n = s[i], n._icon && (n._setPos(e), n.setOpacity(0)) }) }, _recursivelyAnimateChildrenInAndAddSelfToMap: function (t, e, i) { this._recursively(t, i, 0, function (n) { n._recursivelyAnimateChildrenIn(t, n._group._map.latLngToLayerPoint(n.getLatLng()).round(), e), n._isSingleParent() && e - 1 === i ? (n.setOpacity(1), n._recursivelyRemoveChildrenFromMap(t, e)) : n.setOpacity(0), n._addToMap() }) }, _recursivelyBecomeVisible: function (t, e) { this._recursively(t, 0, e, null, function (t) { t.setOpacity(1) }) }, _recursivelyAddChildrenToMap: function (t, e, i) { this._recursively(i, -1, e, function (n) { if (e !== n._zoom) for (var s = n._markers.length - 1; s >= 0; s--) { var r = n._markers[s]; i.contains(r._latlng) && (t && (r._backupLatlng = r.getLatLng(), r.setLatLng(t), r.setOpacity && r.setOpacity(0)), n._group._featureGroup.addLayer(r)) } }, function (e) { e._addToMap(t) }) }, _recursivelyRestoreChildPositions: function (t) { for (var e = this._markers.length - 1; e >= 0; e--) { var i = this._markers[e]; i._backupLatlng && (i.setLatLng(i._backupLatlng), delete i._backupLatlng) } if (t - 1 === this._zoom) for (var n = this._childClusters.length - 1; n >= 0; n--) this._childClusters[n]._restorePosition(); else for (var s = this._childClusters.length - 1; s >= 0; s--) this._childClusters[s]._recursivelyRestoreChildPositions(t) }, _restorePosition: function () { this._backupLatlng && (this.setLatLng(this._backupLatlng), delete this._backupLatlng) }, _recursivelyRemoveChildrenFromMap: function (t, e, i) { var n, s; this._recursively(t, -1, e - 1, function (t) { for (s = t._markers.length - 1; s >= 0; s--) n = t._markers[s], i && i.contains(n._latlng) || (t._group._featureGroup.removeLayer(n), n.setOpacity && n.setOpacity(1)) }, function (t) { for (s = t._childClusters.length - 1; s >= 0; s--) n = t._childClusters[s], i && i.contains(n._latlng) || (t._group._featureGroup.removeLayer(n), n.setOpacity && n.setOpacity(1)) }) }, _recursively: function (t, e, i, n, s) { var r, o, a = this._childClusters, h = this._zoom; if (e > h) for (r = a.length - 1; r >= 0; r--) o = a[r], t.intersects(o._bounds) && o._recursively(t, e, i, n, s); else if (n && n(this), s && this._zoom === i && s(this), i > h) for (r = a.length - 1; r >= 0; r--) o = a[r], t.intersects(o._bounds) && o._recursively(t, e, i, n, s) }, _recalculateBounds: function () { var t, e = this._markers, i = this._childClusters; for (this._bounds = new L.LatLngBounds, delete this._wLatLng, t = e.length - 1; t >= 0; t--) this._expandBounds(e[t]); for (t = i.length - 1; t >= 0; t--) this._expandBounds(i[t]) }, _isSingleParent: function () { return this._childClusters.length > 0 && this._childClusters[0]._childCount === this._childCount } }), L.DistanceGrid = function (t) { this._cellSize = t, this._sqCellSize = t * t, this._grid = {}, this._objectPoint = {} }, L.DistanceGrid.prototype = { addObject: function (t, e) { var i = this._getCoord(e.x), n = this._getCoord(e.y), s = this._grid, r = s[n] = s[n] || {}, o = r[i] = r[i] || [], a = L.Util.stamp(t); this._objectPoint[a] = e, o.push(t) }, updateObject: function (t, e) { this.removeObject(t), this.addObject(t, e) }, removeObject: function (t, e) { var i, n, s = this._getCoord(e.x), r = this._getCoord(e.y), o = this._grid, a = o[r] = o[r] || {}, h = a[s] = a[s] || []; for (delete this._objectPoint[L.Util.stamp(t)], i = 0, n = h.length; n > i; i++) if (h[i] === t) return h.splice(i, 1), 1 === n && delete a[s], !0 }, eachObject: function (t, e) { var i, n, s, r, o, a, h, _ = this._grid; for (i in _) { o = _[i]; for (n in o) for (a = o[n], s = 0, r = a.length; r > s; s++) h = t.call(e, a[s]), h && (s--, r--) } }, getNearObject: function (t) { var e, i, n, s, r, o, a, h, _ = this._getCoord(t.x), u = this._getCoord(t.y), l = this._objectPoint, d = this._sqCellSize, p = null; for (e = u - 1; u + 1 >= e; e++) if (s = this._grid[e]) for (i = _ - 1; _ + 1 >= i; i++) if (r = s[i]) for (n = 0, o = r.length; o > n; n++) a = r[n], h = this._sqDist(l[L.Util.stamp(a)], t), d > h && (d = h, p = a); return p }, _getCoord: function (t) { return Math.floor(t / this._cellSize) }, _sqDist: function (t, e) { var i = e.x - t.x, n = e.y - t.y; return i * i + n * n } }, function () { L.QuickHull = { getDistant: function (t, e) { var i = e[1].lat - e[0].lat, n = e[0].lng - e[1].lng; return n * (t.lat - e[0].lat) + i * (t.lng - e[0].lng) }, findMostDistantPointFromBaseLine: function (t, e) { var i, n, s, r = 0, o = null, a = []; for (i = e.length - 1; i >= 0; i--) n = e[i], s = this.getDistant(n, t), s > 0 && (a.push(n), s > r && (r = s, o = n)); return { maxPoint: o, newPoints: a } }, buildConvexHull: function (t, e) { var i = [], n = this.findMostDistantPointFromBaseLine(t, e); return n.maxPoint ? (i = i.concat(this.buildConvexHull([t[0], n.maxPoint], n.newPoints)), i = i.concat(this.buildConvexHull([n.maxPoint, t[1]], n.newPoints))) : [t[0]] }, getConvexHull: function (t) { var e, i = !1, n = !1, s = null, r = null; for (e = t.length - 1; e >= 0; e--) { var o = t[e]; (i === !1 || o.lat > i) && (s = o, i = o.lat), (n === !1 || o.lat < n) && (r = o, n = o.lat) } var a = [].concat(this.buildConvexHull([r, s], t), this.buildConvexHull([s, r], t)); return a } } }(), L.MarkerCluster.include({ getConvexHull: function () { var t, e, i = this.getAllChildMarkers(), n = []; for (e = i.length - 1; e >= 0; e--) t = i[e].getLatLng(), n.push(t); return L.QuickHull.getConvexHull(n) } }), L.MarkerCluster.include({ _2PI: 2 * Math.PI, _circleFootSeparation: 25, _circleStartAngle: Math.PI / 6, _spiralFootSeparation: 28, _spiralLengthStart: 11, _spiralLengthFactor: 5, _circleSpiralSwitchover: 9, spiderfy: function () { if (this._group._spiderfied !== this && !this._group._inZoomAnimation) { var t, e = this.getAllChildMarkers(), i = this._group, n = i._map, s = n.latLngToLayerPoint(this._latlng); this._group._unspiderfy(), this._group._spiderfied = this, e.length >= this._circleSpiralSwitchover ? t = this._generatePointsSpiral(e.length, s) : (s.y += 10, t = this._generatePointsCircle(e.length, s)), this._animationSpiderfy(e, t) } }, unspiderfy: function (t) { this._group._inZoomAnimation || (this._animationUnspiderfy(t), this._group._spiderfied = null) }, _generatePointsCircle: function (t, e) { var i, n, s = this._group.options.spiderfyDistanceMultiplier * this._circleFootSeparation * (2 + t), r = s / this._2PI, o = this._2PI / t, a = []; for (a.length = t, i = t - 1; i >= 0; i--) n = this._circleStartAngle + i * o, a[i] = new L.Point(e.x + r * Math.cos(n), e.y + r * Math.sin(n))._round(); return a }, _generatePointsSpiral: function (t, e) { var i, n = this._group.options.spiderfyDistanceMultiplier * this._spiralLengthStart, s = this._group.options.spiderfyDistanceMultiplier * this._spiralFootSeparation, r = this._group.options.spiderfyDistanceMultiplier * this._spiralLengthFactor, o = 0, a = []; for (a.length = t, i = t - 1; i >= 0; i--) o += s / n + 5e-4 * i, a[i] = new L.Point(e.x + n * Math.cos(o), e.y + n * Math.sin(o))._round(), n += this._2PI * r / o; return a }, _noanimationUnspiderfy: function () { var t, e, i = this._group, n = i._map, s = i._featureGroup, r = this.getAllChildMarkers(); for (this.setOpacity(1), e = r.length - 1; e >= 0; e--) t = r[e], s.removeLayer(t), t._preSpiderfyLatlng && (t.setLatLng(t._preSpiderfyLatlng), delete t._preSpiderfyLatlng), t.setZIndexOffset && t.setZIndexOffset(0), t._spiderLeg && (n.removeLayer(t._spiderLeg), delete t._spiderLeg); i._spiderfied = null } }), L.MarkerCluster.include(L.DomUtil.TRANSITION ? { SVG_ANIMATION: function () { return e.createElementNS("http://www.w3.org/2000/svg", "animate").toString().indexOf("SVGAnimate") > -1 }(), _animationSpiderfy: function (t, i) { var n, s, r, o, a = this, h = this._group, _ = h._map, u = h._featureGroup, l = _.latLngToLayerPoint(this._latlng); for (n = t.length - 1; n >= 0; n--) s = t[n], s.setOpacity ? (s.setZIndexOffset(1e6), s.setOpacity(0), u.addLayer(s), s._setPos(l)) : u.addLayer(s); h._forceLayout(), h._animationStart(); var d = L.Path.SVG ? 0 : .3, p = L.Path.SVG_NS; for (n = t.length - 1; n >= 0; n--) if (o = _.layerPointToLatLng(i[n]), s = t[n], s._preSpiderfyLatlng = s._latlng, s.setLatLng(o), s.setOpacity && s.setOpacity(1), r = new L.Polyline([a._latlng, o], { weight: 1.5, color: "#222", opacity: d }), _.addLayer(r), s._spiderLeg = r, L.Path.SVG && this.SVG_ANIMATION) { var c = r._path.getTotalLength(); r._path.setAttribute("stroke-dasharray", c + "," + c); var m = e.createElementNS(p, "animate"); m.setAttribute("attributeName", "stroke-dashoffset"), m.setAttribute("begin", "indefinite"), m.setAttribute("from", c), m.setAttribute("to", 0), m.setAttribute("dur", .25), r._path.appendChild(m), m.beginElement(), m = e.createElementNS(p, "animate"), m.setAttribute("attributeName", "stroke-opacity"), m.setAttribute("attributeName", "stroke-opacity"), m.setAttribute("begin", "indefinite"), m.setAttribute("from", 0), m.setAttribute("to", .5), m.setAttribute("dur", .25), r._path.appendChild(m), m.beginElement() } if (a.setOpacity(.3), L.Path.SVG) for (this._group._forceLayout(), n = t.length - 1; n >= 0; n--) s = t[n]._spiderLeg, s.options.opacity = .5, s._path.setAttribute("stroke-opacity", .5); setTimeout(function () { h._animationEnd(), h.fire("spiderfied") }, 200) }, _animationUnspiderfy: function (t) { var e, i, n, s = this._group, r = s._map, o = s._featureGroup, a = t ? r._latLngToNewLayerPoint(this._latlng, t.zoom, t.center) : r.latLngToLayerPoint(this._latlng), h = this.getAllChildMarkers(), _ = L.Path.SVG && this.SVG_ANIMATION; for (s._animationStart(), this.setOpacity(1), i = h.length - 1; i >= 0; i--) e = h[i], e._preSpiderfyLatlng && (e.setLatLng(e._preSpiderfyLatlng), delete e._preSpiderfyLatlng, e.setOpacity ? (e._setPos(a), e.setOpacity(0)) : o.removeLayer(e), _ && (n = e._spiderLeg._path.childNodes[0], n.setAttribute("to", n.getAttribute("from")), n.setAttribute("from", 0), n.beginElement(), n = e._spiderLeg._path.childNodes[1], n.setAttribute("from", .5), n.setAttribute("to", 0), n.setAttribute("stroke-opacity", 0), n.beginElement(), e._spiderLeg._path.setAttribute("stroke-opacity", 0))); setTimeout(function () { var t = 0; for (i = h.length - 1; i >= 0; i--) e = h[i], e._spiderLeg && t++; for (i = h.length - 1; i >= 0; i--) e = h[i], e._spiderLeg && (e.setOpacity && (e.setOpacity(1), e.setZIndexOffset(0)), t > 1 && o.removeLayer(e), r.removeLayer(e._spiderLeg), delete e._spiderLeg); s._animationEnd() }, 200) } } : { _animationSpiderfy: function (t, e) { var i, n, s, r, o = this._group, a = o._map, h = o._featureGroup; for (i = t.length - 1; i >= 0; i--) r = a.layerPointToLatLng(e[i]), n = t[i], n._preSpiderfyLatlng = n._latlng, n.setLatLng(r), n.setZIndexOffset && n.setZIndexOffset(1e6), h.addLayer(n), s = new L.Polyline([this._latlng, r], { weight: 1.5, color: "#222" }), a.addLayer(s), n._spiderLeg = s; this.setOpacity(.3), o.fire("spiderfied") }, _animationUnspiderfy: function () { this._noanimationUnspiderfy() } }), L.MarkerClusterGroup.include({ _spiderfied: null, _spiderfierOnAdd: function () { this._map.on("click", this._unspiderfyWrapper, this), this._map.options.zoomAnimation && this._map.on("zoomstart", this._unspiderfyZoomStart, this), this._map.on("zoomend", this._noanimationUnspiderfy, this), L.Path.SVG && !L.Browser.touch && this._map._initPathRoot() }, _spiderfierOnRemove: function () { this._map.off("click", this._unspiderfyWrapper, this), this._map.off("zoomstart", this._unspiderfyZoomStart, this), this._map.off("zoomanim", this._unspiderfyZoomAnim, this), this._unspiderfy() }, _unspiderfyZoomStart: function () { this._map && this._map.on("zoomanim", this._unspiderfyZoomAnim, this) }, _unspiderfyZoomAnim: function (t) { L.DomUtil.hasClass(this._map._mapPane, "leaflet-touching") || (this._map.off("zoomanim", this._unspiderfyZoomAnim, this), this._unspiderfy(t)) }, _unspiderfyWrapper: function () { this._unspiderfy() }, _unspiderfy: function (t) { this._spiderfied && this._spiderfied.unspiderfy(t) }, _noanimationUnspiderfy: function () { this._spiderfied && this._spiderfied._noanimationUnspiderfy() }, _unspiderfyLayer: function (t) { t._spiderLeg && (this._featureGroup.removeLayer(t), t.setOpacity(1), t.setZIndexOffset(0), this._map.removeLayer(t._spiderLeg), delete t._spiderLeg) } }) }(window, document);;
L.Control.MousePosition = L.Control.extend({
  options: {
    position: 'bottomleft',
    separator: ' : ',
    emptyString: 'Unavailable',
    lngFirst: false,
    numDigits: 5,
    lngFormatter: undefined,
    latFormatter: undefined,
    prefix: ""
  },

  onAdd: function (map) {
    this._container = L.DomUtil.create('div', 'leaflet-control-mouseposition');
    L.DomEvent.disableClickPropagation(this._container);
    map.on('mousemove', this._onMouseMove, this);
    this._container.innerHTML=this.options.emptyString;
    return this._container;
  },

  onRemove: function (map) {
    map.off('mousemove', this._onMouseMove)
  },

  _onMouseMove: function (e) {
    var lng = this.options.lngFormatter ? this.options.lngFormatter(e.latlng.lng) : L.Util.formatNum(e.latlng.lng, this.options.numDigits);
    var lat = this.options.latFormatter ? this.options.latFormatter(e.latlng.lat) : L.Util.formatNum(e.latlng.lat, this.options.numDigits);
    var value = this.options.lngFirst ? lng + this.options.separator + lat : lat + this.options.separator + lng;
    var prefixAndValue = this.options.prefix + ' ' + value;
    this._container.innerHTML = prefixAndValue;
  }

});

L.Map.mergeOptions({
    positionControl: false
});

L.Map.addInitHook(function () {
    if (this.options.positionControl) {
        this.positionControl = new L.Control.MousePosition();
        this.addControl(this.positionControl);
    }
});

L.control.mousePosition = function (options) {
    return new L.Control.MousePosition(options);
};
;
/*
Copyright (c) 2013 Ronny Dobra

This file is part of the leaflet magnify control.
*/
L.Control.Magnify = L.Control.extend({
  
    options: {
      position: 'topright',
      magnifiedMapId: '#',				// href attribute
      cssClass: ''			          // class attribute
    },

    onAdd: function (map) {  
    
      // create the control container with a particular class name
      var container = L.DomUtil.create('div', 'leaflet-control-magnify leaflet-bar leaflet-control');

      var i18n = VVO.I18N.translate;
      var link = L.DomUtil.create('a', 'leaflet-bar-part leaflet-bar-part-single ' + (this.options.cssClass == '' ? '': this.options.cssClass), container);
      link.href = this.options.magnifiedMapId;
      link.title = i18n('magnify_open');
  
      return container;
    }
});

L.Map.addInitHook(function () {
    if (this.options.magnifyControl) {
        this.magnifyControl = new L.Control.Magnify();
        this.addControl(this.magnifyControl);
    }
});

L.control.magnify = function (options) {
    return new L.Control.Magnify(options);
};;
/*
	Leaflet.label, a plugin that adds labels to markers and vectors for Leaflet powered maps.
	(c) 2012-2013, Jacob Toye, Smartrak
	https://github.com/Leaflet/Leaflet.label
	http://leafletjs.com
	https://github.com/jacobtoye
*/
(function(){L.labelVersion="0.2.1",L.Label=L.Class.extend({includes:L.Mixin.Events,options:{className:"",clickable:!1,direction:"right",noHide:!1,offset:[12,-15],opacity:1,zoomAnimation:!0},initialize:function(t,e){L.setOptions(this,t),this._source=e,this._animated=L.Browser.any3d&&this.options.zoomAnimation,this._isOpen=!1},onAdd:function(t){this._map=t,this._pane=this._source instanceof L.Marker?t._panes.markerPane:t._panes.popupPane,this._container||this._initLayout(),this._pane.appendChild(this._container),this._initInteraction(),this._update(),this.setOpacity(this.options.opacity),t.on("moveend",this._onMoveEnd,this).on("viewreset",this._onViewReset,this),this._animated&&t.on("zoomanim",this._zoomAnimation,this),L.Browser.touch&&!this.options.noHide&&L.DomEvent.on(this._container,"click",this.close,this)},onRemove:function(t){this._pane.removeChild(this._container),t.off({zoomanim:this._zoomAnimation,moveend:this._onMoveEnd,viewreset:this._onViewReset},this),this._removeInteraction(),this._map=null},setLatLng:function(t){return this._latlng=L.latLng(t),this._map&&this._updatePosition(),this},setContent:function(t){return this._previousContent=this._content,this._content=t,this._updateContent(),this},close:function(){var t=this._map;t&&(L.Browser.touch&&!this.options.noHide&&L.DomEvent.off(this._container,"click",this.close),t.removeLayer(this))},updateZIndex:function(t){this._zIndex=t,this._container&&this._zIndex&&(this._container.style.zIndex=t)},setOpacity:function(t){this.options.opacity=t,this._container&&L.DomUtil.setOpacity(this._container,t)},_initLayout:function(){this._container=L.DomUtil.create("div","leaflet-label "+this.options.className+" leaflet-zoom-animated"),this.updateZIndex(this._zIndex)},_update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updatePosition(),this._container.style.visibility="")},_updateContent:function(){this._content&&this._map&&this._prevContent!==this._content&&"string"==typeof this._content&&(this._container.innerHTML=this._content,this._prevContent=this._content,this._labelWidth=this._container.offsetWidth)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},_setPosition:function(t){var e=this._map,i=this._container,n=e.latLngToContainerPoint(e.getCenter()),o=e.layerPointToContainerPoint(t),s=this.options.direction,a=this._labelWidth,l=L.point(this.options.offset);"right"===s||"auto"===s&&o.x<n.x?(L.DomUtil.addClass(i,"leaflet-label-right"),L.DomUtil.removeClass(i,"leaflet-label-left"),t=t.add(l)):(L.DomUtil.addClass(i,"leaflet-label-left"),L.DomUtil.removeClass(i,"leaflet-label-right"),t=t.add(L.point(-l.x-a,l.y))),L.DomUtil.setPosition(i,t)},_zoomAnimation:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPosition(e)},_onMoveEnd:function(){this._animated&&"auto"!==this.options.direction||this._updatePosition()},_onViewReset:function(t){t&&t.hard&&this._update()},_initInteraction:function(){if(this.options.clickable){var t=this._container,e=["dblclick","mousedown","mouseover","mouseout","contextmenu"];L.DomUtil.addClass(t,"leaflet-clickable"),L.DomEvent.on(t,"click",this._onMouseClick,this);for(var i=0;e.length>i;i++)L.DomEvent.on(t,e[i],this._fireMouseEvent,this)}},_removeInteraction:function(){if(this.options.clickable){var t=this._container,e=["dblclick","mousedown","mouseover","mouseout","contextmenu"];L.DomUtil.removeClass(t,"leaflet-clickable"),L.DomEvent.off(t,"click",this._onMouseClick,this);for(var i=0;e.length>i;i++)L.DomEvent.off(t,e[i],this._fireMouseEvent,this)}},_onMouseClick:function(t){this.hasEventListeners(t.type)&&L.DomEvent.stopPropagation(t),this.fire(t.type,{originalEvent:t})},_fireMouseEvent:function(t){this.fire(t.type,{originalEvent:t}),"contextmenu"===t.type&&this.hasEventListeners(t.type)&&L.DomEvent.preventDefault(t),"mousedown"!==t.type?L.DomEvent.stopPropagation(t):L.DomEvent.preventDefault(t)}}),L.BaseMarkerMethods={showLabel:function(){return this.label&&this._map&&(this.label.setLatLng(this._latlng),this._map.showLabel(this.label)),this},hideLabel:function(){return this.label&&this.label.close(),this},setLabelNoHide:function(t){this._labelNoHide!==t&&(this._labelNoHide=t,t?(this._removeLabelRevealHandlers(),this.showLabel()):(this._addLabelRevealHandlers(),this.hideLabel()))},bindLabel:function(t,e){var i=this.options.icon?this.options.icon.options.labelAnchor:this.options.labelAnchor,n=L.point(i)||L.point(0,0);return n=n.add(L.Label.prototype.options.offset),e&&e.offset&&(n=n.add(e.offset)),e=L.Util.extend({offset:n},e),this._labelNoHide=e.noHide,this.label||(this._labelNoHide||this._addLabelRevealHandlers(),this.on("remove",this.hideLabel,this).on("move",this._moveLabel,this).on("add",this._onMarkerAdd,this),this._hasLabelHandlers=!0),this.label=new L.Label(e,this).setContent(t),this},unbindLabel:function(){return this.label&&(this.hideLabel(),this.label=null,this._hasLabelHandlers&&(this._labelNoHide||this._removeLabelRevealHandlers(),this.off("remove",this.hideLabel,this).off("move",this._moveLabel,this).off("add",this._onMarkerAdd,this)),this._hasLabelHandlers=!1),this},updateLabelContent:function(t){this.label&&this.label.setContent(t)},getLabel:function(){return this.label},_onMarkerAdd:function(){this._labelNoHide&&this.showLabel()},_addLabelRevealHandlers:function(){this.on("mouseover",this.showLabel,this).on("mouseout",this.hideLabel,this),L.Browser.touch&&this.on("click",this.showLabel,this)},_removeLabelRevealHandlers:function(){this.off("mouseover",this.showLabel,this).off("mouseout",this.hideLabel,this),L.Browser.touch&&this.off("click",this.showLabel,this)},_moveLabel:function(t){this.label.setLatLng(t.latlng)}},L.Icon.Default.mergeOptions({labelAnchor:new L.Point(9,-20)}),L.Marker.mergeOptions({icon:new L.Icon.Default}),L.Marker.include(L.BaseMarkerMethods),L.Marker.include({_originalUpdateZIndex:L.Marker.prototype._updateZIndex,_updateZIndex:function(t){var e=this._zIndex+t;this._originalUpdateZIndex(t),this.label&&this.label.updateZIndex(e)},_originalSetOpacity:L.Marker.prototype.setOpacity,setOpacity:function(t,e){this.options.labelHasSemiTransparency=e,this._originalSetOpacity(t)},_originalUpdateOpacity:L.Marker.prototype._updateOpacity,_updateOpacity:function(){var t=0===this.options.opacity?0:1;this._originalUpdateOpacity(),this.label&&this.label.setOpacity(this.options.labelHasSemiTransparency?this.options.opacity:t)},_originalSetLatLng:L.Marker.prototype.setLatLng,setLatLng:function(t){return this.label&&!this._labelNoHide&&this.hideLabel(),this._originalSetLatLng(t)}}),L.CircleMarker.mergeOptions({labelAnchor:new L.Point(0,0)}),L.CircleMarker.include(L.BaseMarkerMethods),L.Path.include({bindLabel:function(t,e){return this.label&&this.label.options===e||(this.label=new L.Label(e,this)),this.label.setContent(t),this._showLabelAdded||(this.on("mouseover",this._showLabel,this).on("mousemove",this._moveLabel,this).on("mouseout remove",this._hideLabel,this),L.Browser.touch&&this.on("click",this._showLabel,this),this._showLabelAdded=!0),this},unbindLabel:function(){return this.label&&(this._hideLabel(),this.label=null,this._showLabelAdded=!1,this.off("mouseover",this._showLabel,this).off("mousemove",this._moveLabel,this).off("mouseout remove",this._hideLabel,this)),this},updateLabelContent:function(t){this.label&&this.label.setContent(t)},_showLabel:function(t){this.label.setLatLng(t.latlng),this._map.showLabel(this.label)},_moveLabel:function(t){this.label.setLatLng(t.latlng)},_hideLabel:function(){this.label.close()}}),L.Map.include({showLabel:function(t){return this.addLayer(t)}}),L.FeatureGroup.include({clearLayers:function(){return this.unbindLabel(),this.eachLayer(this.removeLayer,this),this},bindLabel:function(t,e){return this.invoke("bindLabel",t,e)},unbindLabel:function(){return this.invoke("unbindLabel")},updateLabelContent:function(t){this.invoke("updateLabelContent",t)}})})(this,document);
;
/***
 * contains zoom config for osm map and options for projection
 * @returns {any} following functions/ properties: Options, MapOptions, Map, getTileLayer
 ***/
VVO.OsmMapConfig = function () {

  var
    config = [{
      efaZoomLevel: '8',              // zoom level for efa url
      numTilesX: 256,                 // number of tiles in a row
      numTilesY: 256,                 // number of tiles in a column
      lngMin: -20037508.34,           // top left corner tile longitude (half extend of earth)
      latMin: 12000000 + 8037508.34,  // top left corner tile latitude
      latMax: 12000000 - 32037508.34, // bottom right corner tile latitude
      lngMax: 20037508.34             // bottom right corner tile longitude (half extend of earth)
    }, {
      efaZoomLevel: '9',
      numTilesX: 512,
      numTilesY: 512,
      lngMin: -20037508.34,
      latMin: 12000000 + 8037508.34,
      latMax: 12000000 - 32037508.34,
      lngMax: 20037508.34
    }, {
      efaZoomLevel: '10',
      numTilesX: 1024,
      numTilesY: 1024,
      lngMin: -20037508.34,
      latMin: 12000000 + 8037508.34,
      latMax: 12000000 - 32037508.34,
      lngMax: 20037508.34
    }, {
      efaZoomLevel: '11',
      numTilesX: 2048,
      numTilesY: 2048,
      lngMin: -20037508.34,
      latMin: 12000000 + 8037508.34,
      latMax: 12000000 - 32037508.34,
      lngMax: 20037508.34
    }, {
      efaZoomLevel: '12',
      numTilesX: 4096,
      numTilesY: 4096,
      lngMin: -20037508.34,
      latMin: 12000000 + 8037508.34,
      latMax: 12000000 - 32037508.34,
      lngMax: 20037508.34
    }, {
      efaZoomLevel: '13',
      numTilesX: 8192,
      numTilesY: 8192,
      lngMin: -20037508.34,
      latMin: 12000000 + 8037508.34,
      latMax: 12000000 - 32037508.34,
      lngMax: 20037508.34
    }, {
      efaZoomLevel: '14',
      numTilesX: 16384,
      numTilesY: 16384,
      lngMin: -20037508.34,
      latMin: 12000000 + 8037508.34,
      latMax: 12000000 - 32037508.34,
      lngMax: 20037508.34
    }, {
      efaZoomLevel: '15',
      numTilesX: 32768,
      numTilesY: 32768,
      lngMin: -20037508.34,
      latMin: 12000000 + 8037508.34,
      latMax: 12000000 - 32037508.34,
      lngMax: 20037508.34
    }, {
      efaZoomLevel: '16',
      numTilesX: 65536,
      numTilesY: 65536,
      lngMin: -20037508.34,
      latMin: 12000000 + 8037508.34,
      latMax: 12000000 - 32037508.34,
      lngMax: 20037508.34
    }, {
      efaZoomLevel: '17',
      numTilesX: 131072,
      numTilesY: 131072,
      lngMin: -20037508.34,
      latMin: 12000000 + 8037508.34,
      latMax: 12000000 - 32037508.34,
      lngMax: 20037508.34
    }, {
      efaZoomLevel: '18',
      numTilesX: 262144,
      numTilesY: 262144,
      lngMin: -20037508.34,
      latMin: 12000000 + 8037508.34,
      latMax: 12000000 - 32037508.34,
      lngMax: 20037508.34
    }, {
      efaZoomLevel: '19',
      numTilesX: 524288,
      numTilesY: 524288,
      lngMin: -20037508.34,
      latMin: 12000000 + 8037508.34,
      latMax: 12000000 - 32037508.34,
      lngMax: 20037508.34
    }],

    // custom options
    customOptions = {
      visiblePinTypes: [                  // pin types that are visible for selection on default
        'farezones',
        'stop',
        'platform',
        'servicepoint',
        'ticketmachine',
        'parkandride',
        'carsharing',
        'rentabike',
        'webcam',
        'poi'
      ],
      activePinTypes: [                   // types of pins that are activated on default
        'stop',
        'platform'
      ],
      visibleLayers: [                    // types of layers that are activated on default
        'citymap',
        'route',
        'dresden'
      ],
      activeLayer: 'citymap',             // layer that is activated on default
      showMouseCoordinates: false,        // show current mouse coordinates in map            
      showGeolocation: true,              // show locate button in map
      enableUserMarker: true,             // open tooltip on click in map
      enableAutomaticStopTooltips: true,  // enable showing tooltips on stops in lower zoom level
      zoomToId: null,                     // zoom to point of input field with specific id
      initialZoomOut: false,              // initially zoom out one level (f.ex. to fully show polylines)
      enableFullscreen: true,             // add control for viewing map in fullscreen
      showRadius: true,                   // show radius control
      extendLegend: false                 // show legend in extended state
    },

    baseLayerIconUrl =
    {
      citymap: '/assets/img/marker/icon-map.svg',
      route: '/assets/img/marker/icon-map-vvo.svg',
      dresden :'/assets/img/marker/icon-map-dvb.svg' 
    },

    // leaflet specific options
    mapOptions = {
      attributionControl: false,              // show copyright notice
      zoom: 2,                                // initial zoom
      minZoom: 0,                             // minimum zoom level
      maxZoom: config.length - 1,             // maximum zoom level
      tileSize: 256,                          // length/ width of a tile
      zoomControl: true,                      // show zoom control
      center: new L.LatLng(6631582, 1526197), // initial center point
      scrollWheelZoom: true                   // scroll with mousewheel
    },

    /**
     * get map class with overwritten functions for projection and options
     * @returns {any} options object
     */
    map = L.Map.extend({
      userMarker: null,               // user marker object
      layerGroups: {},                // layerGroups which contain all markers except the user-marker
      markerBounds: null,             // bound of markers
      markerHashmap: {},              // hashmap to check instantly if a marker is on the map or not
      changedLayersCalled: false,     // flag that is set true if changed layers is called
      pinTypes: [                     // configuration for all pin types 
        { Type: 'farezones', Zoom: 1, Clustered: false },
        { Type: 'stop', Zoom: 4, Clustered: true },
        { Type: 'platform', Zoom: 7, Clustered: false },
        { Type: 'servicepoint', Zoom: 2, Clustered: false },
        { Type: 'ticketmachine', Zoom: 5, Clustered: false },
        { Type: 'parkandride', Zoom: 2, Clustered: false },
        { Type: 'carsharing', Zoom: 5, Clustered: false },
        { Type: 'rentabike', Zoom: 5, Clustered: false },
        { Type: 'webcam', Zoom: 5, Clustered: false },
        { Type: 'poi', Zoom: 5, Clustered: true }
      ],

      options: {                                
        crs: L.extend({}, L.CRS, { 
          code: 'Efa-Nav4',

          /**
           * translate a L.LatLng object to L.Point
           * @param {any} latLng latlng object
           * @param {any} zoom zoom level
           * @returns {any} point
           */
          latLngToPoint: function(latLng, zoom) {
            
            var
              cfg = config[zoom > config.length - 1 ? config.length - 1 : zoom],  // get config for current zoomlevel
              maxPixelX = 256 * cfg.numTilesX,                                    // maximum x coordinate on bottom right corner
              maxPixelY = 256 * cfg.numTilesY,                                    // maximum y coordinate on bottom right corner
              degPerPixelX = (cfg.lngMax - cfg.lngMin) / maxPixelX,               // degrees per pixel in x direction
              degPerPixelY = (cfg.latMax - cfg.latMin) / maxPixelY,               // degrees per pixel in y direction
              x = (latLng.lng - cfg.lngMin) / degPerPixelX,                       // calculate x
              y = (latLng.lat - cfg.latMin) / degPerPixelY;                       // calculate y

            return new L.Point(x, y);
          },


          /**
           * translate a L.Point to L.LatLng
           * @param {any} point point 
           * @param {any} zoom zoom level
           * @returns {any} latlng
           */
          pointToLatLng: function (point, zoom) {

            var
              cfg = config[zoom],                                   // get config for current zoomlevel
              maxPixelX = 256 * cfg.numTilesX,                      // maximum x value on bottom right corner
              maxPixelY = 256 * cfg.numTilesY,                      // maximum y value on bottom right corner
              degPerPixelX = (cfg.lngMax - cfg.lngMin) / maxPixelX, // degrees per pixel in x direction
              degPerPixelY = (cfg.latMax - cfg.latMin) / maxPixelY, // degrees per pixel in y direction
              x = Math.round(point.y * degPerPixelY + cfg.latMin),  // calculate x
              y = Math.round(point.x * degPerPixelX + cfg.lngMin);  // calculate y

            return new L.LatLng(x, y);
          }
        })
      }
    }),


    /**
     * get tile layer (overwrite leaflet function)
     * @returns {any} url
     */
    getTileLayer = function () {
      var TileLayer = L.TileLayer.extend({
        options: {
          continuousWorld: true, // prevent to repeat map indefinitely - must be set to keep it work
          noWrap: false          // must be set to keep it work
        },

        /***
         * building tile url from hardcoded url-template
         * @param  {any} tilePoint tile point
         * @returns {any} url
         **/
        getTileUrl: function (tilePoint) { 
          var zoom = tilePoint.z;

          // return 0 if tile is not available
          if (tilePoint.x < 0 || tilePoint.x >= config[zoom].numTilesX || tilePoint.y < 0 || tilePoint.y >= config[zoom].numTilesY) {
            return '';
          }

          var minBoundX = Math.floor(tilePoint.x / 100) * 100;
          var minBoundY = Math.floor(tilePoint.y / 100) * 100;

          return 'https://maps.vvo-online.de/maps_osm/zoomlevel' + config[zoom].efaZoomLevel + '/columns' + minBoundX + '-' + (minBoundX + 100 - 1) + '/column' +
            tilePoint.x + '/rows' + minBoundY + '-' + (minBoundY + 100 - 1) + '/' + tilePoint.y + '_' + tilePoint.x + '_' + config[zoom].efaZoomLevel + '.png';
        }
      });

      return new TileLayer();
    };

  return {
    Config: config,
    Options: customOptions,
    BaseLayerIconUrl: baseLayerIconUrl,
    MapOptions: mapOptions,
    Map: map,
    getTileLayer: getTileLayer
  };
};
;
/**
 * display route polylines and stops of line in map
 * @param {any} map map
 * @param {any} routeData route data
 * @param {any} stopData stop data
 * @returns {any} route object
 */
VVO.Route = function (map, routeData, stopData) {

  // images and colors for partial routes
  var
    tripRequestSettings = {
      Tram: {
        icon: 'icon-tram.png',
        strokeColor: '#EF001A',
        lightStrokeColor: '#FF7988'
      },
      Bus: {
        icon: 'icon-bus.png',
        strokeColor: '#123C4D',
        lightStrokeColor: '#9DD3E8'
      },
      LowFloorBus: {
        icon: 'icon-bus.png',
        strokeColor: '#FBB900',
        lightStrokeColor: '#FFDF85'
      },
      PlusBus: {
        icon: 'ico-plus-bus.svg',
        strokeColor: '#A71680',
        lightStrokeColor: '#F091D7'
      },
      BusOnRequest: {
        icon: 'icon-low-floor-bus.png',
        strokeColor: '#FBB900',
        lightStrokeColor: '#FFDF85'
      },
      CitizenBus: {
        icon: 'icon-bus.png',
        strokeColor: '#123C4D',
        lightStrokeColor: '#9DD3E8'
      },
      SchoolBus: {
        icon: 'icon-bus.png',
        strokeColor: '#123C4D',
        lightStrokeColor: '#9DD3E8'
      },
      VvvCityBus: {
        icon: 'icon-bus.png',
        strokeColor: '#123C4D',
        lightStrokeColor: '#9DD3E8'
      },
      ClockBus: {
        icon: 'icon-bus.png',
        strokeColor: '#123C4D',
        lightStrokeColor: '#9DD3E8'
      },
      Train: {
        icon: 'icon-train.png',
        strokeColor: '#3B7F3F',
        lightStrokeColor: '#A8D6AA'
      },
      RapidTransit: {
        icon: 'icon-rapidtransit.png',
        strokeColor: '#3B7F3F',
        lightStrokeColor: '#A8D6AA'
      },
      Taxi: {
        icon: 'icon-taxi.png',
        strokeColor: '#FBB900',
        lightStrokeColor: '#FFDF85'
      },
      Ferry: {
        icon: 'icon-ferry.png',
        strokeColor: '#2194CC',
        lightStrokeColor: ' #8ACCEC'
      },
      OverheadRailway: {
        icon: 'icon-overhead-railway.png',
        strokeColor: '#089BD5',
        lightStrokeColor: ' #80D8FA'
      },
      Cablecar: {
        icon: 'icon-cablecar.png',
        strokeColor: '#1492C6',
        lightStrokeColor: '#84D2F3'
      },
      Footpath: {
        icon: 'icon-footpath.png',
        strokeColor: '#0068B4',
        lightStrokeColor: '#79C6FF'
      },
      Undefined: {
        strokeColor: '#B4B4B4'
      }
    },
    departureMonitorSettings = {
      Tram: {
        icon: 'icon-tram-red.svg',
        lightIcon:'icon-tram-red-light.svg'
      },
      CityBus: {
        icon: 'icon-bus-blue.svg',
        lightIcon:'icon-bus-blue-light.svg'
      },
      IntercityBus: {
        icon: 'icon-bus-blue.svg',
        lightIcon:'icon-bus-blue-light.svg'
      },
      Train: {
        icon: 'icon-train-green.svg',
        lightIcon:'icon-train-green-light.svg'
      },
      SuburbanRailway: {
        icon: 'icon-train-green.svg',
        lightIcon:'icon-train-green-light.svg'
      },
      HailedSharedTaxi: {
        icon: 'icon-taxi-yellow.svg',
        lightIcon:'icon-taxi-yellow-light.svg'
      },
      Ferry: {
        icon: 'icon-ferry-blue.svg',
        lightIcon:'icon-ferry-blue-light.svg'
      },
      Cableway: {
        icon: 'icon-ferry-blue.svg',
        lightIcon:'icon-ferry-blue-light.svg'
      },
      BusOnRequest: {
        icon: 'icon-taxi-yellow.svg',
        lightIcon:'icon-taxi-yellow-light.svg'
      },
      PlusBus: {
        icon: 'icon-plus-bus-purpur.svg',
        lightIcon:'icon-plus-bus-purpur-light.svg'
      },
      Undefined: {
        icon: 'icon-grey.svg'
      }
    };

  // ReSharper disable once InconsistentNaming
  var Route = {

    map: {}, 
    route: {},

    /**
     * initialize route
     * @param {any} mapInstance instance of map
     * @param {any} mapRouteData route data
     * @param {any} mapStopData stop data
     */
    init: function (mapInstance, mapRouteData, mapStopData) {
      Route.map = mapInstance;

      if (!mapRouteData && !mapStopData) {
        return;
      }

      Route._addStops(mapInstance, mapStopData);
      Route._addRoute(mapInstance, mapRouteData);
    },


    /**
     * add route to map
     * @param {any} mapInstance map
     * @param {any} mapRouteData route data as compressed json
     * @returns {bool} success or fail
     */
    _addRoute: function (mapInstance, mapRouteData) {

      // got response, but no data
      if (!mapRouteData || mapRouteData.length < 1) {
        return false;
      }

      // container for all coordinates, used to fit map to route
      var coordContainer = [];
      var decompressRouteData = eval(mapRouteData);

      // decompress data and draw subroutes
      $.each(decompressRouteData, function (index, compressedRoute) {
        var
          subroute = compressedRoute.split('|'),
          mot = subroute[0],
          color = tripRequestSettings[mot].strokeColor,
          routeCoords = [];

        // remove last empty element
        subroute = subroute.slice(0, subroute.length - 1);
        for (var i = 1; i < subroute.length; i += 2) {

          // add coordinates to polyline array
          routeCoords.push(new L.LatLng(parseFloat(subroute[i]), parseFloat(subroute[i + 1])));
        }

        // add marker to first coordinate of route
        if (mot !== 'Undefined') {
          var width = mot === 'PlusBus' ? 38 : 24;
          var center = mot === 'PlusBus' ? 19 : 12;

          new L.Marker(routeCoords[0], {
              icon: L.icon({
                iconUrl: '/assets/img/icons/' + tripRequestSettings[mot].icon,
                iconSize: [width, width],
                iconAnchor: [center, center]
              })
            }).
            addTo(mapInstance);
        }

        if (mot === 'Undefined' && decompressRouteData.length > 1) {
          var
            mainSubroute = decompressRouteData[1].split('|'),
            mainMot = mainSubroute[0];

          color = tripRequestSettings[mainMot].lightStrokeColor;
        }

        // add polyline to map
        new L.Polyline(routeCoords, {
          color: color,
          opacity: 1,
          weight: 5
        })
          .addTo(mapInstance);

        // add all coordinates to coordContainer
        coordContainer = coordContainer.concat(routeCoords);
      });

      // fit polyline in map
      mapInstance.fitBounds(coordContainer);
      mapInstance.invalidateSize();

      return true;
    },

    /**
     * add multiple stops to map
     * @param {any} mapInstance map
     * @param {any} mapStopData stop data as compressed json
     * @returns {bool} success or fail
     */
    _addStops: function (mapInstance, mapStopData) {

      // got response, but no data
      if (!mapStopData || mapStopData.length < 1) {
        return false;
      }

      var decompressedStopData = eval(mapStopData);

      // decompress data
      $.each(decompressedStopData, function (index, compressedCoords) {
        var coordStrings = compressedCoords.split('|');
        var icon = departureMonitorSettings[coordStrings[0]].icon;

        if (coordStrings.length < 3) {
          return true; // == continue
        }

        if (coordStrings[0] === 'Undefined' && decompressedStopData.length > 1) {
          var mainCoordStrings = decompressedStopData[1].split('|');
          icon = departureMonitorSettings[mainCoordStrings[0]].lightIcon;
        }

        for (var i = 1; i < coordStrings.length; i += 2) {

          var point = new L.LatLng(parseFloat(coordStrings[i]), parseFloat(coordStrings[i + 1]));
          new L.Marker(point,
            {
              icon: L.icon({
                iconUrl: '/assets/img/marker/' + icon,
                iconSize: [10, 10],
                iconAnchor: [5, 5]
              })
            }).addTo(mapInstance);
        }

        return true;
      });

      return true;
    }
  };

  return Route.init(map, routeData, stopData);
};
;
// ReSharper disable UseOfImplicitGlobalInFunctionScope, PossiblyUnassignedProperty
var
  googleApiLoaded = false, // indicates if google API was loaded
  callBackVars = {};       // contains vars needed for sending to googleAPI

/***
 * functions for showing google streetview
 * @returns {any} streetview object
 ***/
VVO.Streetview = function () {

  /***
   * callback for check if streetview is available at specific point
   ***/
  window._googleCallbackToIsAvailableAt = function () {
    
    googleApiLoaded = true;   // api was loaded successfully
    
    callBackVars.object.isAvailableAt(callBackVars.pin);
    callBackVars = {};
  };

  /***
   * callback for showing streetview
   ***/
  window._googleCallbackToShow = function () {
    
    googleApiLoaded = true;   // api was loaded successfully
    
    callBackVars.show(callBackVars.pin);
    callBackVars = {};
  };

  // ReSharper disable once InconsistentNaming
  var StreetView = {
    googleAPIUrl: 'https://maps.googleapis.com/maps/api/js?key=AIzaSyC6UByKAqgMfNNRxx_Dv3NUyd40IrDrSKc&sensor=false&language=de',
    streetviewMap: {},  // instance of google streetview map

    /**
     * load function in google api as JSONP
     * @param {any} callback function
     */
    loadGoogleAPI : function(callback) {
      var script = document.createElement('script');
      script.src = StreetView.googleAPIUrl + '&callback=' + callback;
      script.type = 'text/javascript';
      document.getElementsByTagName('head')[0].appendChild(script);
    },

    cleanup : function()
    {
      StreetView.streetviewMap = {};
    },

    /**
     * check if streetview is available at specific location
     * @param {any} pin pin
     */
    isAvailableAt: function (pin) {

      // check if google api was already loaded
      if (googleApiLoaded === false) {

        // save parameters for callback
        callBackVars = {
          'object': this,
          'pin': pin
        };

        // load google Api and jump back to this function
        StreetView.loadGoogleAPI('_googleCallbackToIsAvailableAt');
        return;
      }

      googleApiLoaded = true;  // api was loaded successfully
      
      var service = new google.maps.StreetViewService();

      // convert pin from Epsg3857 to google Wgs84 format
      var coord = VVO.Conversions.Epsg3857ToWgs84(new L.LatLng(pin.Lat, pin.Lng));

      // request streetview at point
      service.getPanoramaByLocation(new google.maps.LatLng(coord.lat, coord.lng), 50, function (data, status) {
        if (status === google.maps.StreetViewStatus.OK) {

          // if streetview is available - trigger event
          $('body').trigger({ type: 'streetview:isavailable', position: pin });
        }
      });
    },


    /**
     * show streetview
     * @param {any} $streetView container
     * @param {any} pin pin 
     */
    show: function ($streetView, pin) {

      // check if google api was already loaded
      if (googleApiLoaded === false) {

        // save parameters for callback
        callBackVars = {
          'show': $.proxy(this,this),
          'pin': pin
        };

        // load google Api and jump back to this function
        StreetView.loadGoogleAPI('_googleCallbackToShow');
        return;
      }

      // convert pin from Epsg3857 to google Wgs84 format
      var coord = VVO.Conversions.Epsg3857ToWgs84(new L.LatLng(pin.Lat, pin.Lng));
      var center = new google.maps.LatLng(coord.lat, coord.lng);

      // google maps streetview options
      var options = {
        position: center,
        clickToGo: true,
        linksControl: false,
        pov: {
          heading: 34, // rotation angle around the camera locus in degrees relative from true north
          pitch: 0     // angle variance "up" or "down" from the camera's initial default pitch (90 degrees directly upwards to -90 degrees directly downwards)
        }
      };

      // init streetview map or use old
      var tmpStreetviewMap = StreetView.streetviewMap;
      if ($.isEmptyObject(tmpStreetviewMap)) {
        tmpStreetviewMap = new google.maps.StreetViewPanorama($streetView[0], options);
        google.maps.event.addListener(tmpStreetviewMap, 'position_changed', function () {
          $('body').trigger({ type: 'streetview:position_changed', position: tmpStreetviewMap.getPosition() });
        });
        StreetView.streetviewMap = tmpStreetviewMap;
      } else {
        tmpStreetviewMap.setPosition(center);
      }
    }
 };

  return  StreetView;
};
;
// ReSharper disable UseOfImplicitGlobalInFunctionScope, PossiblyUnassignedProperty

/**
 * initialize an osm map with options
 *
 * @param {string} mapId id of map container
 * @param {object} options options for custom logic. the following options are supported:
 *   activePinTypes              - preselected pin types (for none, set empty list [])
 *   ignoreCookiePinTypes        - do not set pin types from cookie
 *   visiblePinTypes             - pin types that are available for select (for none, set empty list [])
 *   activeLayer                 - layer that should be active on init
 *   visibleLayers               - layers that are available for select
 *   showMouseCoordinates        - show current mouse coordinates in map
 *   showGeolocation             - show locate button in map
 *   enableUserMarker            - open tooltip on click in map
 *   enableAutomaticStopTooltips - enable showing tooltips on stops in lower zoom level
 *   zoomToId                    - zoom to point of input field with specific id
 *   enableFullscreen            - add control for viewing map in fullscreen
 * @param {object} mapOptions overwrite existing map options from config.js
 *   zoom                        - initial zoom level beginning with zero
 *   zoomControl                 - enable/ disable zoom control
 *   center                      - latlng center point
 *   scrollWheelZoom             - scroll with mousewheel
 * @returns {any} map instance
 */
VVO.OsmMap = function (mapId, options, mapOptions) {

  var
    // ReSharper disable InconsistentNaming
    I18n = VVO.I18N.translate,
    I18nBack = VVO.I18N.translateBack,
    OsmMapConfig = VVO.OsmMapConfig(),
    FarezoneMapConfig = VVO.FarezoneMapConfig(),
    FarezoneMap = VVO.FarezoneMap(),
    StreetView = new VVO.Streetview(),
    tooltipCircle = null,
    tooltipCircleLabel = null,
    mapCircle = null,
    mapCircleMarker = null,
    mapCircleLabel = null,
    radius = 0, // mapcircle radius in meter
    tooltipRadius = 0, // tooltipcircle radius in meter

    OsmMap = {

      // ReSharper restore InconsistentNaming
      map: {},                                            // map instance
      layersControl: {},                                  // control which contains all layers
      isStreetview: false,                                // streetview is currently visible
      streetViewMarker: {},                               // marker for current position in minimap when streetview is active
      mapContainer: null,                                 // map container
      osmMapContainer: null,                              // container for osm map
      streetViewMapContainer: null,                       // container for streetview
      routeMapContainer: null,                            // container for route/ vvo map
      dresdenMapContainer: null,                          // container for route/ dvb map
      markerHashmap: {},                                  // contains all marker types with its markers
      ajaxPoolPins: [],                                   // ajax pool for pin request
      requestParams: {},                                  // initial request params (necessary for reinitialization)
      // ReSharper disable once PossiblyUnassignedProperty
      lastFullScreenElement: document.fullscreenElement,  // current container that is opened in fullscreen
      stopMarkers: [],                                     // contains stop markers that are created when zooming to stop


      /**
       * initialize an osm map with options
       *
       * @param {string} _mapId id of map container
       * @param {object} _options options for custom logic. the following options are supported:
       * @param {object} _mapOptions overwrite existing map options from config.js
       * @returns {any} map instance
       */
      // ReSharper disable InconsistentNaming
      init: function (_mapId, _options, _mapOptions) {

        // ReSharper restore InconsistentNaming
        // set class properties
        OsmMap.requestParams = {
          mapId: _mapId,
          mapOptions: _mapOptions || {},
          options: _options || {}
        };
        OsmMap.mapContainer =           $('#' + _mapId);
        OsmMap.osmMapContainer =        $('#' + _mapId + '-geographic');
        OsmMap.streetViewMapContainer = $('#' + _mapId + '-streetview');
        OsmMap.routeMapContainer =      $('#' + _mapId + '-route');
        OsmMap.dresdenMapContainer =    $('#' + _mapId + '-dresden');

        // check if container exists
        if (!OsmMap.mapContainer.length) {
          console.log('Map cannot be initialized on div ' + _mapId + ' - object not found');
          return null;
        }

        // remove map if already initialized
        if (OsmMap.mapContainer.data('map')) {
          OsmMap.mapContainer.data('map').remove(); // remove map
          OsmMap.mapContainer.removeData('map'); // remove data map
        }

        // initialize map
        var map = OsmMap._initMap(_mapOptions, _options);

        // set instance on map container
        OsmMap.mapContainer.data('map', map);

        // bind map events
        OsmMap._bindMapEvents();

        if (OsmMapConfig.Options.activeLayer !== 'citymap') {
          FarezoneMap.AddPins(map, OsmMapConfig.Options.activeLayer);
          FarezoneMap.BindEvents(map, OsmMapConfig.Options.activeLayer);

          // track farezonemap in piwik
          // ReSharper disable UseOfImplicitGlobalInFunctionScope
          if (typeof _paq !== 'undefined' && _paq) {
            var mapType = OsmMapConfig.Options.activeLayer === 'dresden' ? 'Dresden' : 'VVO';
            _paq.push(['trackEvent', 'Liniennetzplan', 'Initialisierung Liniennetzplan ' + mapType]);
          }
          // ReSharper restore UseOfImplicitGlobalInFunctionScope
        }

        // add route if exists
        VVO.Route(OsmMap.map, OsmMap.mapContainer.data('routedata'), OsmMap.mapContainer.data('stops'));

        // show radius stops if set
        if (OsmMap.mapContainer.data('stops') && OsmMapConfig.Options.zoomToId) {
          OsmMap.showRadiusStops($('#' + OsmMapConfig.Options.zoomToId).data('pointstring'), $('#' + _mapId).data('stops'));
        }

        // zoom to id of input field
        if (OsmMapConfig.Options.zoomToId && OsmMapConfig.Options.activeLayer === 'citymap' && !OsmMap.mapContainer.data('stops')) {
          OsmMap.zoomTo(OsmMapConfig.Options.zoomToId);
        }

        // zoom out to fully show polyline
        if (OsmMapConfig.Options.initialZoomOut) {
          map.setZoom(map.getZoom() - 1);
        }

        // set zoom if data attribut is set on map container
        if (OsmMap.mapContainer.data('zoomlevel')) {
          map.setZoom(OsmMap.mapContainer.data('zoomlevel'));
        }

        // add flap functionality to legend
        OsmMap._addLegendFlap();

        return map;
      },


      /**
       * initialize map with controls
       * @param {object} _mapOptions overwrite existing map options from config.js
       * @param {object} _options options for custom logic. the following options are supported:
       * @returns {any} map instance
       */
      // ReSharper disable InconsistentNaming
      _initMap: function (_mapOptions, _options) {

        // ReSharper restore InconsistentNaming
        // overwrite default options with given options
        $.extend(OsmMapConfig.MapOptions, _mapOptions || {});
        $.extend(OsmMapConfig.Options, _options || {});

        // check if activelayer exists in visible layers, otherwise take first
        var found = false;
        for (var o = 0; o < OsmMapConfig.Options.visibleLayers.length; o++) {
          if (OsmMapConfig.Options.visibleLayers[o] === OsmMapConfig.Options.activeLayer) {
            found = true;
            break;
          }
        }

        if (!found) {
          OsmMapConfig.Options.activeLayer = OsmMapConfig.Options.visibleLayers[0];
        }

        var activeLayer = OsmMapConfig.Options.activeLayer;

        // show map container of specified type
        OsmMap._showMapContainer(activeLayer);

        // set active layer to show on init
        OsmMapConfig.MapOptions.layers = activeLayer === 'citymap' ?
          OsmMapConfig.getTileLayer() :
          FarezoneMapConfig.getTileLayer(activeLayer);

        // create layerControl with layers if more than one layer is set
        if (OsmMapConfig.Options.visibleLayers.length > 1) {
          OsmMap.layersControl = L.control.customlayerscontrol(null, null);

          for (var n = 0; n < OsmMapConfig.Options.visibleLayers.length; n++) {
            var currentLayer = OsmMapConfig.Options.visibleLayers[n];

            var layerToAdd;
            if (activeLayer === currentLayer) {
              layerToAdd = OsmMapConfig.MapOptions.layers;
            } else {
              layerToAdd = L.tileLayer('#');
            }
            //set image source for displaying img in layersControl
            layerToAdd._img_src = OsmMapConfig.BaseLayerIconUrl[currentLayer];

            OsmMap.layersControl.addBaseLayer(layerToAdd, I18n(currentLayer));
          }
        }

        //create radius layer group
        var radiusLayerGroup;
        if (OsmMapConfig.Options.showRadius) {
          radiusLayerGroup = L.control.customlayerscontrol(null, null);

          radiusLayerGroup.addBaseLayer(L.tileLayer('#'), I18n('hideradius'));
          radiusLayerGroup.addBaseLayer(L.tileLayer('#'), I18n('radius500m'));
          radiusLayerGroup.addBaseLayer(L.tileLayer('#'), I18n('radius1000m'));
          radiusLayerGroup.addBaseLayer(L.tileLayer('#'), I18n('radius5000m'));
          radiusLayerGroup.addBaseLayer(L.tileLayer('#'), I18n('radius15000m'));
        }

        // init map with options
        var
          isRouteMap = activeLayer === 'route' || activeLayer === 'dresden',
          mapContainer =
            activeLayer === 'route' ? OsmMap.routeMapContainer :
              activeLayer === 'dresden' ? OsmMap.dresdenMapContainer :
                OsmMap.osmMapContainer,
          map = OsmMap.map = isRouteMap ?
            new new FarezoneMapConfig.Map(activeLayer)(mapContainer.attr('id'), $.extend({}, OsmMapConfig.MapOptions, FarezoneMapConfig.MapOptions(activeLayer))) :
            new OsmMapConfig.Map(mapContainer.attr('id'), OsmMapConfig.MapOptions);

        // reinit size of map
        map.invalidateSize(false);

        // init magnify/ fullscreen control
        if (OsmMapConfig.Options.enableFullscreen) {
          L.control.magnify({
            'magnifiedMapId': '#' + mapId + '-magnified-wrapper',
            'cssClass': 'magnified-control'
          })
            .addTo(map);
        }

        // align zoom controls
        map.zoomControl.setPosition('topright');

        // add radius layer control to map
        if (!isRouteMap && OsmMapConfig.Options.showRadius) {
          radiusLayerGroup.addTo(map);
        }

        // change icon
        $('#' + this.mapContainer.attr('id') + ' .leaflet-control-layers-toggle:first').addClass('leaflet-control-layers-toggle--radius');

        // add layercontrol to map
        if (OsmMapConfig.Options.visibleLayers.length > 1) {
          OsmMap.layersControl.addTo(map);
        }

        // show mouse position for debug purpose
        if (OsmMapConfig.Options.showMouseCoordinates) {
          L.control.mousePosition().addTo(map);
        }

        // exit for route map here; further settings are osm map only
        if (isRouteMap) {
          return map;
        }

        // add copyright notice
        // ReSharper disable once InconsistentNaming
        new L.control.attribution()
          .addAttribution('&copy; <a href="' + OsmMap.mapContainer.data('legalnotesurl') + '" target="_blank">OpenStreetMap</a> contributors')
          .setPrefix('')
          .addTo(map);


        // init geolocation plugin, if browser supports it
        if (OsmMapConfig.Options.showGeolocation && window.Modernizr.geolocation) {
          L.control.locate({ position: 'topright', setView: false }).addTo(map);

          map.on('locationfound',
            function (data) {

              // convert wgs84 point to epsg3857 and show in map
              var latlng = VVO.Conversions.Wgs84ToEpsg3857(data.latlng);
              OsmMap._addPoint(latlng);

              // set zoom level
              map.setView(latlng, 9);
            });
        }


        // create pin layer groups
        // for each pin type add pin layer group to pin layers control
        $.each(map.pinTypes, function (index, pinType) {

          // create marker hashmap for pin type
          OsmMap.markerHashmap[pinType.Type] = {};

          // if pins should be clustered, create clustered layer group, else do not cluster
          // ReSharper disable once InconsistentNaming
          map.layerGroups[pinType.Type] = pinType.Clustered === false ?
            new L.layerGroup() :
            new L.MarkerClusterGroup({
              iconCreateFunction: function (cluster) {
                // settings for group icon
                return new L.DivIcon({
                  iconSize: L.point(36, 63),
                  iconAnchor: L.point(18, 61),
                  className: 'marker-cluster cluster-icon-' + pinType.Type,
                  html: '<span>' + cluster.getChildCount() + '</span>'
                });
              }
            });
        });

        // add pin types to layer control
        for (var i = 0; i < OsmMapConfig.Options.visiblePinTypes.length; i++) {

          // get pinType
          var pinType = map.pinTypes[0];
          for (var k = 0; k < map.pinTypes.length; k++) {
            if (map.pinTypes[k].Type === OsmMapConfig.Options.visiblePinTypes[i]) {
              pinType = map.pinTypes[k];
              break;
            }
          }

          // add leaflet id for sorting
          var layer = map.layerGroups[pinType.Type];
          layer._leaflet_id = i + 10;
          layer._img_src = '/assets/img/marker/icon-' + pinType.Type + '.svg';
          layer._displayName = I18n(pinType.Type.toLowerCase());
          OsmMap.layersControl.addOverlay(layer, I18n(pinType.Type.toLowerCase()));
        }

        // activate layers (load selection from cookie if set)
        if (OsmMapConfig.Options.visibleLayers.length > 1) {
          var activeLayers = OsmMapConfig.Options.activePinTypes;
          var ignoreCookiePinTypes = OsmMapConfig.Options.ignoreCookiePinTypes || false;
          var cookieValue = $.cookie('maplayers') || '';
          var layersFromContainer = OsmMap.mapContainer.data('activelayers') || '';

          // set layers from cookie
          if (!ignoreCookiePinTypes && cookieValue !== '' && cookieValue !== ' ') {
            activeLayers = cookieValue.split(',');
          }

          //set layers from map container
          if (layersFromContainer !== '' && layersFromContainer !== ' ') {
            activeLayers = layersFromContainer.split(',');
          }

          //merge layers from cookie and map container
          if (!ignoreCookiePinTypes && cookieValue !== '' && cookieValue !== ' ' && layersFromContainer !== '' && layersFromContainer !== ' ') {
            var cookieArray = cookieValue.split(',');
            var containerArray = layersFromContainer.split(',');
            activeLayers = cookieArray.concat(containerArray).filter(function (value, index, self) {
              return self.indexOf(value) === index;
            });
          }

          for (var j = 0; j < activeLayers.length; j++) {
            OsmMap.layersControl.setLayerStatus(map.layerGroups[activeLayers[j]], false, true);
          }
        }

        // add radius to center of map
        OsmMap._updateMapCircle();

        return map;
      },


      /***
       * bind events for osm map
       */
      _bindMapEvents: function () {

        // click event for changing layers
        if (OsmMapConfig.Options.visibleLayers.length > 1) {
          $('body').off('click', '.leaflet-control-layers-base input:radio').on('click', '.leaflet-control-layers-base input:radio', function (event) {

            // get clicked radion button text
            var type = $.trim($(event.target).siblings('span').html());
            type = VVO.I18N.translateBack(type);

            switch (type) {
              case 'hideradius':
                radius = 0;
                OsmMap._updateMapCircle();
                return;
              case 'radius500m':
                radius = 500;
                OsmMap._updateMapCircle();
                return;
              case 'radius1000m':
                radius = 1000;
                OsmMap._updateMapCircle();
                return;
              case 'radius5000m':
                radius = 5000;
                OsmMap._updateMapCircle();
                return;
              case 'radius15000m':
                radius = 15000;
                OsmMap._updateMapCircle();
                return;
              default:
                // show map container of specified type
                OsmMap._showMapContainer(type);

                // set active layer
                OsmMap.requestParams.options.activeLayer = type;

                // reload map
                OsmMap.init(OsmMap.requestParams.mapId, OsmMap.requestParams.options, OsmMap.requestParams.mapOptions);

                // remove position relative in fullscreen from all maps
                if (document.fullscreenElement) {
                  OsmMap.osmMapContainer.css('position', 'static');
                  OsmMap.streetViewMapContainer.css('position', 'static');
                  OsmMap.routeMapContainer.css('position', 'static');
                  OsmMap.dresdenMapContainer.css('position', 'static');
                }
                break;
            }
          });
        }

        // enable full screen
        if (OsmMapConfig.Options.enableFullscreen) {

          // ReSharper disable PossiblyUnassignedProperty
          $('.magnified-control').on('click', function (event) {
            event.stopPropagation();
            event.preventDefault();

            var element = $(this).closest('.fullscreen-container')[0];
            OsmMap.lastFullScreenElement = element;

            // close fullscreen
            if (document.fullscreenElement) {
              $('#cboxOverlay').appendTo('body');
              $('#colorbox').appendTo('body');

              if (document.exitFullscreen) {
                document.exitFullscreen();
              } else if (document.mozCancelFullScreen) {
                document.mozCancelFullScreen();
              } else if (document.webkitExitFullscreen) {
                document.webkitExitFullscreen();
              }
            }
            // open full screen
            else {
              var wrapper = $(element).closest('.active-trip')[0];
              if(wrapper){
                var wrapperRouteId = wrapper.getAttribute('data-routeid');

                $('#cboxOverlay').appendTo('[data-routeid="' + wrapperRouteId + '"] .fullscreen-container');
                $('#colorbox').appendTo('[data-routeid="' + wrapperRouteId + '"] .fullscreen-container');
              }

              if (element.requestFullscreen) {
                element.requestFullscreen();
              } else if (element.mozRequestFullScreen) {
                element.mozRequestFullScreen();
              } else if (element.msRequestFullscreen) {
                element.msRequestFullscreen();
              } else if (element.webkitRequestFullscreen) {
                element.webkitRequestFullscreen();
              }
            }
          });

          // handle fullscreen open or close
          $('body').on('fullscreenchange', function () {
            var
              isFullScreen = !!document.fullscreenElement,
              element = $(OsmMap.lastFullScreenElement).closest('.fullscreen-container')[0],
              magnifyControl = $(OsmMap.lastFullScreenElement).find('.magnified-control').parent();

            $(element).toggleClass('fullscreen-active', isFullScreen);

            $('body').toggleClass('fullscreen', isFullScreen);

            // toggle columns (used in splitview of dm and tr)
            var cols = $(element).find('> .cols4:first').children();
            cols.first().toggleClass('c2of4', !isFullScreen).toggleClass('c1of4', isFullScreen);
            cols.last().toggleClass('c2of4', !isFullScreen).toggleClass('c3of4', isFullScreen);

            magnifyControl
              .toggleClass('leaflet-control-magnify', !isFullScreen)
              .toggleClass('leaflet-control-close', isFullScreen);

            magnifyControl.find('a').attr('title', I18n('magnify_' + (isFullScreen ? 'close' : 'open')));

            // re-set height of map after initialization of fullscreen
            setTimeout(function () {
              var
                id = $(element).find('.map-output, .map-input').attr('id'),
                height = $('#' + id).parent().height(),
                type = $('#' + id).data('type');

              if (isFullScreen) {

                if (type === 'PROutput' || type === 'WCOutput' || type === 'FZOutput') {
                  $('#' + id).removeAttr('style');
                }

                $('#' + id + '-geographic').css('height', height);
                $('#' + id + '-streetview').css('height', height);
                $('#' + id + '-route')     .css('height', height);
                $('#' + id + '-dresden')   .css('height', height);

                // open extended legend in fullscreen
                if (!$('#' + id + ' .leaflet-control-container').hasClass('expanded-legend')) {
                  $('#' + id + ' .flap').click();
                }
              } else {
                if (type === 'PROutput' || type === 'WCOutput' || type === 'FZOutput') {
                  $('#' + id).attr('style', 'height: 600px;');
                }

                $('#' + id + '-geographic').css('position', 'relative').css('height', '');
                $('#' + id + '-streetview').css('position', 'relative').css('height', '');
                $('#' + id + '-route')     .css('position', 'relative').css('height', '');
                $('#' + id + '-dresden')   .css('position', 'relative').css('height', '');
              }

              OsmMap.map.invalidateSize();

            }, 10);
          });
          // ReSharper restore PossiblyUnassignedProperty
        }

        // exit for route map here; further bindings are osm map only
        if (OsmMapConfig.Options.activeLayer !== 'citymap') {
          return;
        }

        // place a marker on an unknown map point on click
        if (OsmMapConfig.Options.enableUserMarker) {
          OsmMap.map.on('click', function (event) {
            // don't show tooltip in streetview
            if (OsmMap.isStreetView) {
              return;
            }

            OsmMap._addPoint(event.latlng);
          });
        }

        // reload pins after zooming
        OsmMap.map.on('moveend zoomend', function () {
          // reload pins
          OsmMap._reloadPins();

          // update radius
          OsmMap._updateMapCircle();
        });

        // reload pins when selection of pin types changed
        $('body').off('click', '.leaflet-control-layers-overlays :checkbox').on('click', '.leaflet-control-layers-overlays :checkbox', OsmMap._reloadPins);

        // move marker in minimap when streetview position changes
        $('body').off('streetview:position_changed').on('streetview:position_changed', function (event) {

          // get and convert point to epsg3857
          var point = VVO.Conversions.Wgs84ToEpsg3857(new L.LatLng(event.position.lat(), event.position.lng()));

          // remove old marker
          OsmMap.map.removeLayer(OsmMap.streetViewMarker);

          var pin = {
            Type: 'UserMarker',
            Lat: point.lat,
            Lng: point.lng,
            Id: 'coord:' + point.lng + ':' + point.lat
          };

          // create marker
          // ReSharper disable once InconsistentNaming
          OsmMap.streetViewMarker = new L.Marker.Interactive([pin.Lat, pin.Lng], { icon: L.Icon.get('usermarker') })
            .addTo(OsmMap.map);

          // pan to point
          OsmMap.map.panTo(point);

          // redraw map
          OsmMap.map.invalidateSize();
        });

        // prevent default on click for streetview link
        $('body').off('click', '#infobox_streetview a').on('click', '#infobox_streetview a', function (event) {
          event.preventDefault();
        });

        // prevent default on click for radius link
        $('body').off('click', '#infobox_radius a').on('click', '#infobox_radius a', function (event) {
          event.preventDefault();
          // create point object
          var point = VVO.PointHelper.toPoint($(this).closest('.infobox-container').data('pointstring'));
          if (tooltipCircle === null) {
            $(this).html(I18n('hideradius'));
            VVO.Markertooltip().addRadiusButtons();
            OsmMap._bindRadiusButtons(point.Lat, point.Lng);
          } else {
            $(this).html(I18n('showradius'));
            OsmMap._removeTooltipCircle();
          }
        });

        // if available add on click functionality in tooltip and open streetview
        $('body').off('streetview:isavailable').on('streetview:isavailable', function (event) {
          // cannot show street view in fullscreen when already have fullscreen mode
          if (document.fullscreenElement) {
            return;
          }

          var position = event.position;

          // set style
          $('#infobox_streetview').find('a').attr('class', 'btn icon-btn-left gray-blue-btn');

          // set on click action
          OsmMap.mapContainer.find('#infobox_streetview').show().off('click').on('click', function (evt) {
            evt.preventDefault();

            // cannot show street view in fullscreen when already have fullscreen mode
            if (document.fullscreenElement) {
              return;
            }

            // show container and minimize map
            OsmMap._showStreetViewContainer(position);

            // show streetviewMap at postion
            StreetView.show(OsmMap.streetViewMapContainer, position);
          });
        });

        // event to handle opening specific marker on map
        $('body').off('map:openmarker').on('map:openmarker', function (event) {
          if (event.markerType && event.markerId) {
            var marker = OsmMap.markerHashmap[event.markerType][event.markerId];
            if (marker) {
              // center to marker in clustered layer
              if (event.centerAndZoom && OsmMap.map.layerGroups[event.markerType] instanceof L.MarkerClusterGroup) {
                  OsmMap.map.layerGroups[event.markerType].zoomToShowLayer(marker, function() { marker.fire('click'); });
              } else {
                // center map
                OsmMap.map.panTo(marker.getLatLng());
                marker.fire('click');
              }
            }
          }
        });

        // show automatic tooltip on stop marker again when manual marker was closed
        if (OsmMapConfig.Options.enableAutomaticStopTooltips) {
          OsmMap.map.on('popupclose', function (e) {
            OsmMap._updateMapCircle();
            if (OsmMap.map.getZoom() > 7) {
              $(e.popup._source._icon).find('.marker-tooltip').show();
            }
          });
        }

        // auto save layer settings in cookie
        OsmMap.map.off('overlayadd overlayremove').on('overlayadd overlayremove', function () {
          var
            // ReSharper disable once CssBrowserCompatibility
            labels = $(OsmMap.map._container).find('.leaflet-control-layers-overlays .leaflet-checked'),
            types = [];

          labels.each(function () {
            if ($(this).text().trim() !== '') {
              types.push(I18nBack($(this).text().trim()));
            }
          });

          // save value to cookie (no expiration)
          $.cookie('maplayers', types, { expires: 999 });
        });

        // zoom to partial route
        $('.zoomto-' + OsmMap.requestParams.mapId).off('click keypress').on('click keypress', function (event) {
          // only on click or enter
          if (event.keyCode !== 13 && event.type !== 'click') {
            return;
          }

          var
            routedata = OsmMap.mapContainer.data('routedata'),
            partialRouteId = $(this).data('partialrouteid'),
            partialRoute = eval(routedata)[partialRouteId];

          if (!partialRoute) {
            return;
          }

          partialRoute = partialRoute.split('|');

          // container for all coordinates, used to fit map to route
          var coords = [];

          for (var i = 1; i < partialRoute.length - 1; i += 2) {
            coords.push(new L.LatLng(parseFloat(partialRoute[i]), parseFloat(partialRoute[i + 1])));
          }

          OsmMap.map.fitBounds(coords);
          // remove stop markers if needed
          if (OsmMap.stopMarkers.length > 0) {
            $.each(OsmMap.stopMarkers, function (index, marker) {
              OsmMap.map.removeLayer(marker);
            });
          }
        });

        // zoom to stop
        $('.zoomtostop-' + OsmMap.requestParams.mapId).off('click keypress').on('click keypress', function (event) {
          // only on click or enter
          if (event.keyCode !== 13 && event.type !== 'click') {
            return;
          }

          var dataLatLng = $(this).data('latlng').split('|');

          // zoom to stop and add pin there
          OsmMap.stopMarkers.push(new L.Marker.Interactive(dataLatLng, { icon: L.Icon.get('usermarker'), zIndexOffset: 1000 })
            .addTo(OsmMap.map));

          // set map to high zoom level, set center of map to lat/lng
          OsmMap.map.setView(dataLatLng, OsmMap.map.getMaxZoom() - 1);
        });

        // click on link in hover menu
        $('#dm .connection-detail .poi-link, #tr .connection-detail .poi-link').on('click', function (event) {
          event.preventDefault();
          $(this).closest('.zoomto-' + OsmMap.requestParams.mapId + ',.zoomtostop-' + OsmMap.requestParams.mapId).trigger('click');
        });

        // reload pins on init
        OsmMap._reloadPins();
      },

      /**
       * update map circle
       */
      _updateMapCircle: function () {
        if (mapCircle === null) {
          // don't show radius on initial load
          if (radius > 0)
            OsmMap._createMapCircle();
        } else {
          OsmMap._removeMapCircle();
          if (radius !== 0) {
            OsmMap._createMapCircle();
          }
        }
      },

      /**
      * update map circle
      * @param {float} lat latitude
      * @param {float} lng longitude
      * @param {string} text label of circle
      */
      _updateTooltipCircle: function (lat, lng, text) {
        if (tooltipCircle === null) {
          // don't show radius on initial load
          if (tooltipRadius > 0) {
            OsmMap._createTooltipCircle(lat, lng, text);
          }
        } else {
          OsmMap._removeTooltipCircle();
          if (tooltipRadius !== 0) {
            OsmMap._createTooltipCircle(lat, lng, text);
          }
        }
      },


      /**
       * show map container for specified type
       * @param {any} type type of map
       */
      _showMapContainer: function (type) {
        switch (type) {
          case 'citymap':
            OsmMap.osmMapContainer.show();
            OsmMap.routeMapContainer.hide();
            OsmMap.dresdenMapContainer.hide();
            break;

          case 'route':
            OsmMap.osmMapContainer.hide();
            OsmMap.routeMapContainer.show();
            OsmMap.dresdenMapContainer.hide();
            break;

          case 'dresden':
            OsmMap.osmMapContainer.hide();
            OsmMap.routeMapContainer.hide();
            OsmMap.dresdenMapContainer.show();
            break;
        }
      },


      /***
       * reload pins after paning
       */
      _reloadPins: function () {
        // return if in streetview mode or no pin types activated
        if (OsmMap.isStreetView || jQuery.isEmptyObject(OsmMap.layersControl)) {
          return;
        }

        // add pins to map
        OsmMap._addPins();
      },


      /**
       * gets the data-point from element with specified id and opens a tooltip in map
       * @param {any} id id of
       */
      zoomTo: function (id) {

        // get point data
        var pointstring = $('#' + id).data('pointstring');

        // return if no data or if data is default/init data in map
        if (!pointstring || pointstring === VVO.PointHelper.getEmptyString()) {
          return;
        }

        var point = $('#' + id).data('point');
        if (!point) {
          point = VVO.PointHelper.toPoint($('#' + id).data('pointstring'));
          $('#' + id).data('point', point);
        }

        // if lat and lng are 0 (when comming from DM) -> request coordinates
        if (point.Lat === 0 && point.Lng === 0) {
          var coord = {};

          // request for getting coordinates as latLng of id
          $.ajax({
            url: '/map/coordinates',
            dataType: 'json',
            async: false,
            data: { id: point.Id },
            success: function (data) {
              if (!data || data.length < 1) {
                return false;
              }

              // split request data into lat and lng value
              var split = data.split('|');
              coord.lat = split[0];
              coord.lng = split[1];

              return true;
            }
          });

          if ($.isEmptyObject(coord)) {
            return;
          }

          point.Lat = coord.lat;
          point.Lng = coord.lng;
        }

        // pan point to center and set highest zoom level
        OsmMap.map.setView(new L.LatLng(point.Lat, point.Lng), 8);

        // trigger marker on click, after pins are loaded
        var showRadiusStops = $(OsmMap.map._container).parent().data('stops');
        $('body').one('osmmap:pinsloaded', function () {
          var marker = OsmMap.markerHashmap[point.Type] ? OsmMap.markerHashmap[point.Type][point.Id] : null;
          if (OsmMap.mapContainer.data('lat') && OsmMap.mapContainer.data('lng')) {
            OsmMap.map.panTo(new L.LatLng(OsmMap.mapContainer.data('lat'), OsmMap.mapContainer.data('lng')));
          }
          else {
            if (marker) {
              // only open popup when not showing radius stops
              if (!showRadiusStops) {
                marker.fire('click');
              }
            } else {
              // add point
              OsmMap._addPoint(new L.LatLng(point.Lat, point.Lng), showRadiusStops);
            }
          }
        });
      },


      /**
       * show stops around selected point and draw a line
       * @param {any} pointString string with point data
       * @param {any} stopsString string with stop data
       */
      showRadiusStops: function (pointString, stopsString) {

        // return if no data or if data is init data in map
        if (!pointString || pointString === VVO.PointHelper.getEmptyString()) {
          return;
        }

        var
          point = VVO.PointHelper.toPoint(pointString),
          coordinates = [[point.Lat, point.Lng]],
          stopCoords = stopsString.split(',');

        for (var i = 0; i < stopCoords.length; i++) {
          var tmpCoords = stopCoords[i].split('|');

          coordinates.push([+tmpCoords[1], +tmpCoords[0]]);
          coordinates.push([point.Lat, point.Lng]);
        }

        // create polygon
        // ReSharper disable once InconsistentNaming
        var mapPolygon = new L.polygon(coordinates, { color: '#118CC5', weight: 5, opacity: 1, fillColor: '#118CC5', fillOpacity: 1, interactive: false });

        // add polygon to layer
        OsmMap.map.addLayer(mapPolygon);

        OsmMap.map.fitBounds(coordinates);

        // change stop icons
        var iconChangeHandler = function() {
          $.each(OsmMap.markerHashmap['stop'], function (index, marker) {
            for (var i = 0; i < coordinates.length; i++) {
              if (Math.abs(marker.Pin.Lat - coordinates[i][0]) < 200 && Math.abs(marker.Pin.Lng - coordinates[i][1]) < 200 && marker._icon) {
                $(marker._icon).find('.marker-icon')
                  .removeClass('icon-marker-stop')
                  .addClass('icon-marker-stop-highlighted');
              }
            }
          });
        };

        OsmMap.map.on('moveend zoomend', iconChangeHandler);
        $('body').on('osmmap:pinsloaded', iconChangeHandler);
      },


      /**
       * adds a user marker at specific point and resolves point information
       * @param {any} latLng latlng object
       * @param {any} hidePopup dont't show popup
       */
      _addPoint: function (latLng, hidePopup) {
        // remove old marker
        if (OsmMap.userMarker) {
          OsmMap.map.removeLayer(OsmMap.userMarker);
        }

        var pin = {
          Type: 'userMarker',
          Lat: latLng.lat,
          Lng: latLng.lng,
          Id: 'coord:' + latLng.lng + ':' + latLng.lat + ':MR_EPSG3857:'
        };

        // get pin information
        $.getJSON('/map/address', { lng: pin.Lng, lat: pin.Lat }, function (data) {
          if (!data || data.length < 1) {
            pin.Name = I18n('unidentifiedmappoint');
            pin.Id += I18n('unidentifiedmappoint');
          } else {
            var split = data.split('|');
            pin.Place = split[0];
            pin.Name = split[1];
            pin.Id += pin.Name;
          }

          // create marker
          // ReSharper disable once InconsistentNaming
          OsmMap.userMarker = new L.Marker.Interactive([pin.Lat, pin.Lng], { icon: L.Icon.get('usermarker') })
            .bindPopup(VVO.Markertooltip().getContent(OsmMap.map, pin))
            .addTo(OsmMap.map);

          if (!hidePopup) {
            OsmMap.userMarker.openPopup();
          }

          // async check if streetview is available, triggers streetview:isavailable event if yes
          StreetView.isAvailableAt(pin);
        });
      },


      /**
       * request and show pins selected by layers control
       * @param {any} activeLayers list of active pin layers
       */
      _addPins: function () {

        //get active layers
        var
          overlayLayers = OsmMap.layersControl.getOverlayLayers(),
          overlayLayersAsArray = [],
          activeOverlayLayers = OsmMap.layersControl.getCheckedOverlayLayers(),
          activeOverlayLayersAsArray = [],
          bounds = this.map.getBounds(),
          sw = bounds.getSouthWest(),
          ne = bounds.getNorthEast(),
          polygonIndex = -1,
          newActiveLayers = [],
          id;

        for (id in overlayLayers) {
          // set translation of names in active layers
          if (overlayLayers.hasOwnProperty(id)) {
            overlayLayersAsArray.push(I18nBack(overlayLayers[id].name));
          }
        }

        for (id in activeOverlayLayers) {
          // set translation of names in active layers
          if (activeOverlayLayers.hasOwnProperty(id)) {
            activeOverlayLayersAsArray.push(I18nBack(activeOverlayLayers[id].name));
          }
        }
        polygonIndex = $.inArray('farezones', activeOverlayLayersAsArray);

        //display settings according to zoomlevel and activation status
        for (var i = 0; i < overlayLayersAsArray.length; i++) {
          // get zoom level by layer name from defaults.pintypes
          // ReSharper disable once ClosureOnModifiedVariable
          var zoom = OsmMap.map.pinTypes.filter(function (obj) { return obj.Type === overlayLayersAsArray[i]; })[0].Zoom;
          var layer = OsmMap.map.layerGroups[overlayLayersAsArray[i]];


          //display settings according to zoomlevel and activation status
          //layer depictable
          if (OsmMap.map.getZoom() >= zoom) {
            //layer active
            if (activeOverlayLayersAsArray.indexOf(overlayLayersAsArray[i]) > -1) {
              OsmMap.layersControl.setLayerStatus(layer, false, true);
              newActiveLayers.push(overlayLayersAsArray[i]);
            } else
            //layer inactive
            {
              OsmMap.layersControl.setLayerStatus(layer, false, false);
              OsmMap._removePins(overlayLayersAsArray[i]);
            }
          } else {
            //layer not depictable
            //layer active
            if (activeOverlayLayersAsArray.indexOf(overlayLayersAsArray[i]) > -1) {
              OsmMap.layersControl.setLayerStatus(layer, true, true);
            } else
            //layer inactive
            {
              OsmMap.layersControl.setLayerStatus(layer, true, false);
            }
            OsmMap._removePins(overlayLayersAsArray[i]);
          }
        }



        activeOverlayLayersAsArray = newActiveLayers;
        var activeLayersWithoutPolygons = JSON.parse(JSON.stringify(activeOverlayLayersAsArray)); // clone array

        // add polygones for farezones
        if (polygonIndex > -1) {
          activeLayersWithoutPolygons.splice(polygonIndex, 1);

          OsmMap._addPolygons();
        }

        // abort all pending map pin requests
        $(OsmMap.ajaxPoolPins).each(function (idx, req) {
          req.abort();
        });

        if (activeOverlayLayersAsArray.length <= 0) {
          return;
        }

        // if only have polygon layers, return
        if (activeLayersWithoutPolygons.length <= 0) {
          return;
        }

        // needs to be set to send pintypes=xyz instead of pintypes=[xyz]
        $.ajaxSettings.traditional = true;

        // get markers from service
        var request = $.getJSON('/map/pins', {
          swlat: sw.lat,
          swlng: sw.lng,
          nelat: ne.lat,
          nelng: ne.lng,
          pintypes: activeLayersWithoutPolygons,
          showlines: true,
          coordinatesystem: 'epsg3857'
        },
          function (data) {
            // got response, but no data
            if (!data || data.length < 1) {
              return false;
            }

            // decompress data
            var pins = [];
            var motMap = [];
            motMap[1] = '/assets/img/trans-icon/ico-tram.svg';                 // Strassenbahn
            motMap[2] = '/assets/img/trans-icon/ico-bus.svg';                  // Stadtbus
            motMap[3] = '/assets/img/trans-icon/ico-bus.svg';                  // Regionalbus
            motMap[4] = '/assets/img/trans-icon/ico-train.svg';                // Zug
            motMap[5] = '/assets/img/trans-icon/ico-metropolitan-railway.svg'; // S-Bahn
            motMap[6] = '/assets/img/trans-icon/ico-taxi.svg';                 // AST/ Rufbus
            motMap[7] = '/assets/img/trans-icon/ico-ferry.svg';                // Faehre
            motMap[8] = '/assets/img/trans-icon/ico-overhead-railway.svg';     // Seil-/Schwebebahn
            motMap[9] = '/assets/img/trans-icon/ico-low-floor-bus.svg';        // Rufbus
            motMap[10] = '/assets/img/trans-icon/ico-plus-bus.svg';            // Plusbus
            motMap[11] = '/assets/img/trans-icon/ico-bus.svg';                 // Bürgerbus
            motMap[12] = '/assets/img/trans-icon/ico-bus.svg';                 // Schulbus
            motMap[13] = '/assets/img/trans-icon/ico-bus.svg';                 // Stadtbus (VVV)
            motMap[14] = '/assets/img/trans-icon/ico-bus.svg';                 // Taktbus
            motMap[15] = '/assets/img/trans-icon/ico-subway.svg';              // U-Bahn

            $.each(data, function (index, compressedPin) {
              var
                cPin = compressedPin.split('|'),
                stopLines = [],
                lines = cPin[7].split('#'); // // 1:1~10#2:94~EV 1~EV 12

              // parse lines of stop
              if (lines[0] !== '') {
                $.each(lines, function (idx, line) {
                  var props = line.split(':');
                  stopLines.push({
                    mot: motMap[+props[0]],
                    line: props[1].replace(/~/g, ', ')
                  });
                });
              }

              var pinTypes = {
                p: 'poi',
                pf: 'platform',
                r: 'rentabike',
                t: 'ticketmachine',
                sp: 'servicepoint',
                pr: 'parkandride',
                c: 'carsharing',
                w: 'webcam'
              };

              pins.push({
                Id: cPin[0],
                Type: pinTypes[cPin[1]] || 'stop',
                Place: !cPin[2] ? 'Dresden' : cPin[2],
                Name: cPin[3],
                Lat: parseFloat(cPin[4]),
                Lng: parseFloat(cPin[5]),
                Desc: cPin[6],
                Lines: stopLines
              });
            });

            // show or hide automatic tooltips on stops
            if (OsmMapConfig.Options.enableAutomaticStopTooltips) {
              $('.marker-tooltip').toggle(OsmMap.map.getZoom() > 7);
            }

            // add pins that are new
            $.each(pins, function (index, pin) {

              // check if marker is already on the map
              var marker = null;
              if (OsmMap.markerHashmap[pin.Type][pin.Id] !== undefined) {
                marker = OsmMap.markerHashmap[pin.Type][pin.Id];

                if (marker.getPopup()._isOpen && OsmMapConfig.Options.enableAutomaticStopTooltips) {
                  $(marker._icon).find('.marker-tooltip').hide();
                }

                return;
              }

              var icon = L.Icon.get(pin.Type);

              // try to find current parking lots and customize icon
              if (pin.Type === 'parkandride') {
                //"60 Stellplätze, kostenfrei, 24h, Aktuell verfügbar: 8"
                var
                  all = pin.Desc.match(/(\d+) Stellplätze/i),
                  current = pin.Desc.match(/Aktuell verfügbar: (\d+)/i);

                if (all && current) {
                  var percentage = +current[1] / +all[1];
                  var iconType = percentage <= .10 ? 'occupied' : percentage <= .40 ? 'many' : percentage <= .90 ? 'low' : 'free';

                  icon = L.Icon.get('parkandride-' + iconType);
                }
              }

              marker = new L.Marker.Interactive(new L.LatLng(pin.Lat, pin.Lng), {
                title: pin.Name,
                revealing: true,
                icon: icon
              });

              // set click event to show parking lots when clicking on p&r
              if (pin.Type === 'parkandride') {
                marker.on('click', function() {
                  $.ajax({
                    url: '/map/parkinglots',
                    dataType: 'json',
                    async: false,
                    data: { lat: pin.Lat, lng: pin.Lng },
                    success: function (result) {
                      if (!result || result.length < 1) {
                        return false;
                      }

                      var coords = [];
                      $.each(result, function(_, parkingLot) {
                        var parkingLotMarker = new L.Marker.Interactive(
                          new L.LatLng(parkingLot.Coordinates.Lat, parkingLot.Coordinates.Lng),
                          {
                            title: I18n('parking_lot_' + (parkingLot.Occupied ? '' : 'not_') + 'occupied_' +
                              (parkingLot.DisabledPersonsOnly ? '' : 'not_') + 'disabled'),
                            revealing: true,
                            icon: icon = L.Icon.get('parkandride-lot-' + (parkingLot.Occupied ? '' : 'not-') + 'occupied-' +
                              (parkingLot.DisabledPersonsOnly ? '' : 'not-') + 'disabled')
                          });

                        // add marker to hashmap
                        OsmMap.markerHashmap[pin.Type][parkingLot.Coordinates.Lat, parkingLot.Coordinates.Lng] = parkingLotMarker;

                        // add marker to its layer group
                        OsmMap.map.layerGroups[pin.Type].addLayer(parkingLotMarker);

                        coords.push(new L.LatLng(parkingLot.Coordinates.Lat, parkingLot.Coordinates.Lng));
                      });

                      // zoom to detail markers
                      OsmMap.map.fitBounds(coords);

                      return true;
                    }
                  });
                });
              }

              // set z-index for stops
              if (pin.Type === 'stop') {
                marker.options.zIndexOffset = 1000;
              }

              // add pin information
              marker.Pin = pin;

              // add marker to hashmap
              OsmMap.markerHashmap[pin.Type][pin.Type === 'platform' ? pin.Lat + pin.Lng : pin.Id] = marker;

              // if marker is platform set html
              if (pin.Type === 'platform') {
                marker.options.icon.options.html = '<span>' + pin.Desc + '<span>';
                marker.options.title = pin.Name + ', ' + I18n('platform_sing') + ' ' + pin.Desc;
              }

              // if marker is stop set html
              if (pin.Type === 'stop') {
                var html = $(marker.options.icon.options.html);
                $(html).find('h3').html('<span>' + pin.Name + '</span>');

                // add lines of stop
                if (pin.Lines !== null && pin.Lines.length !== 0) {
                  $.each(pin.Lines, function (idx, line) {
                    $(html).find('.transportation-list').append('<li><img src="' + line.mot + '" width="15px" height="15px" alt=""><p><strong>' + line.line + '</strong></p></li>');
                  });
                }
                else {
                  $(html).find('.marker-tooltip').remove();
                }

                marker.options.icon.options.html = $(html).prop('outerHTML');

                if (OsmMapConfig.Options.enableAutomaticStopTooltips) {
                  marker.on('mouseover', function () {
                    if (!this._popup._isOpen) {
                      $(this._icon).find('.marker-tooltip').show();
                    }
                  });

                  marker.on('mouseout', function () {
                    if (OsmMap.map.getZoom() <= 7) {
                      $(this._icon).find('.marker-tooltip').hide();
                    }
                  });
                }
              }

              // add marker to its layer group
              OsmMap.map.layerGroups[pin.Type].addLayer(marker);

              // create popup for non-p&r pins
              var tooltip = new VVO.Markertooltip();
              marker.bindPopup(tooltip.getContent(OsmMap.map, marker.Pin), { maxWidth: 600 });

              // check zoom level and show or hide tooltip for stops
              if (OsmMapConfig.Options.enableAutomaticStopTooltips) {
                $(marker._icon).find('.marker-tooltip').toggle(OsmMap.map.getZoom() > 7 && !marker._popup._isOpen);
              }

              // add tooltip event
              marker.on('click', function () {

                // set active icon (:active doesn't work in firefox)
                var icon = $(this._icon)
                  .toggleClass('active', this._popup._isOpen);

                icon
                  .find('.marker-icon')
                  .toggleClass('active', this._popup._isOpen);

                // async check if streetview is available, triggers streetview:isavailable event if yes
                StreetView.isAvailableAt(pin);

                // if tooltip is visible hide small tooltip, else show
                $(this._icon).find('.marker-tooltip').toggle(!this._popup._isOpen && OsmMapConfig.Options.enableAutomaticStopTooltips);
              });

              // remove active icon (:active doesn't work in firefox)
              OsmMap.map.on('popupclose', function (e) {
                $('.marker-icon').removeClass('active');
                $('.leaflet-marker-icon').removeClass('active');
              });
            });

            $('body').trigger({ type: 'osmmap:pinsloaded' });

            return true;
          })

          // remove current ajax request from request pool
          .always(function () {
            OsmMap.ajaxPoolPins.pop();
          });

        // add ajax request to request pool
        OsmMap.ajaxPoolPins.push(request);
      },


      /**
       * clear all pins (and their layers) on the map
       * @param {any} pinType pin type to clear
       */
      _removePins: function (pinType) {

        // if pin type is not empty just remove layer of this type
        if (pinType) {
          if (typeof OsmMap.map._layers[OsmMap.map.layerGroups[pinType]._leaflet_id] !== 'undefined') {
            OsmMap.map.removeLayer(OsmMap.map._layers[OsmMap.map.layerGroups[pinType]._leaflet_id]);
          }
          OsmMap.map.layerGroups[pinType].clearLayers();
          OsmMap.markerHashmap[pinType] = {};

          return;
        }

        // if pintype is empty remove everything
        if (OsmMap.userMarker) {
          OsmMap.map.removeLayer(OsmMap.userMarker);
        }

        $.each(OsmMap.map.layerGroups, function (index, layerGroup) {
          layerGroup.clearLayers();
        });

        // clear markersHashmap for each pinType
        for (var pintype in OsmMap.markerHashmap) {
          if (OsmMap.markerHashmap.hasOwnProperty(pintype)) {
            OsmMap.markerHashmap[pintype] = {};
          }
        }
      },


      /***
       * set polygons for farezones
       * @returns {boolean}  success state
       */
      _addPolygons: function () {

        // return if already have polygons
        if (OsmMap.map.layerGroups['farezones'] !== undefined &&
          OsmMap.map.layerGroups['farezones'].getLayers().length) {
          return true;
        }

        // get polygons from service
        $.getJSON('/map/polygons', function (data) {
          // got response, but no data or polygons already drawn
          if (!data || data.length < 1) {
            return false;
          }

          // decompress data
          var polygons = [];
          $.each(data, function (index, compressedPolygon) {

            var
              split = compressedPolygon.split('|'),
              coordinates = [];

            for (var i = 5; i < split.length; i += 2) {
              coordinates.push([+split[i], +split[i + 1]]);
            }

            polygons.push({
              Number: split[0],
              Place: split[1],
              Color: split[2] || '6aabd3',
              LabelPosition: +split[3] && +split[4] ? [+split[3], +split[4]] : null,
              Coordinates: coordinates
            });
          });

          // add polygons to map
          $.each(polygons, function (index, polygon) {

            // create polygon
            // ReSharper disable once InconsistentNaming
            var mapPolygon = new L.polygon(polygon.Coordinates, { color: '#000', weight: 2, opacity: 0.5, fillColor: '#' + polygon.Color, fillOpacity: .7, interactive: false });

            // add polygon to layer
            OsmMap.map.layerGroups['farezones'].addLayer(mapPolygon);

            // add label
            var label = new L.Label({ offset: [-20, -20] });
            label.setContent('<span>' + polygon.Number + '</span>' + polygon.Place);
            label.setLatLng(polygon.LabelPosition || mapPolygon.getBounds().getCenter());

            OsmMap.map.layerGroups['farezones'].addLayer(label);
          });

          return true;
        });

        return true;
      },


      /***
       * show streetview and minimize osm map
       * @param {any} position position of streetview
       */
      _showStreetViewContainer: function (position) {

        // show streetview container
        OsmMap.streetViewMapContainer.show();

        // remove Pins
        OsmMap._removePins();

        // resize map to fit as minimap
        OsmMap.osmMapContainer.children('.leaflet-control-container').children().not('.leaflet-bottom.leaflet-right').hide();

        // store original style
        OsmMap.osmMapContainer.data('origigStyle', OsmMap.osmMapContainer.attr('style'));

        // reset css
        OsmMap.osmMapContainer.css({
          'z-index': '2',
          position: 'absolute',
          width: '210px',
          right: '0',
          bottom: '15px',
          'border-top': '2px solid #FFFFFF',
          'border-left': '2px solid #FFFFFF',
          'border-bottom': '2px solid #FFFFFF'
        });

        OsmMap.osmMapContainer[0].style.setProperty('height', '158px', 'important');


        OsmMap.map.panTo(new L.LatLng(position.Lat, position.Lng));

        // add closeButton
        OsmMap.osmMapContainer.append('<div id="streetViewCloseButton" class="icon-font ico-maximize" style="width: 18px; height: 18px; background-color:white; position: relative; cursor: pointer;"></div>');

        $('body').off('click', '#streetViewCloseButton').on('click', '#streetViewCloseButton', function () {
          OsmMap._hideStreetViewContainer();
        });

        // disable drag and zoom handlers
        OsmMap.map.dragging.disable();
        OsmMap.map.touchZoom.disable();
        OsmMap.map.doubleClickZoom.disable();
        OsmMap.map.scrollWheelZoom.disable();

        OsmMap.isStreetView = true;
      },


      /***
      * hides the streetview container and maximizes osm map
      ***/
      _hideStreetViewContainer: function () {

        // remove old marker
        OsmMap.map.removeLayer(OsmMap.streetViewMarker);

        // hide streetview containter
        OsmMap.streetViewMapContainer.hide();

        // transform minimap to normal size
        OsmMap.osmMapContainer.children('.leaflet-control-container').children().show();
        OsmMap.osmMapContainer.attr({ 'style': OsmMap.osmMapContainer.data('origigStyle') });

        // enable drag and zoom handlers
        OsmMap.map.dragging.enable();
        OsmMap.map.touchZoom.enable();
        OsmMap.map.doubleClickZoom.enable();
        OsmMap.map.scrollWheelZoom.enable();
        OsmMap.isStreetview = false;

        // center map to marker
        OsmMap.map.invalidateSize();

        OsmMap._addPins();

        // remove close button
        $('#streetViewCloseButton').remove();

        OsmMap.isStreetView = false;
      },


      /**
       * bind radius button event
       * @param {float} lat latitude
       * @param {float} lng longitude
       */
      _bindRadiusButtons: function (lat, lng) {
        // prevent default on click for radius size link
        $('body').off('click', '.infobox_radius_button').on('click', '.infobox_radius_button', function (event) {
          event.preventDefault();
          // get clicked radio button text
          var text = $(event.target).html();
          var type = $.trim(text);
          type = VVO.I18N.translateBack(type);

          switch (type) {
            case 'radius500m':
              tooltipRadius = 500;
              OsmMap._updateTooltipCircle(lat, lng, '500 m');
              break;
            case 'radius1000m':
              tooltipRadius = 1000;
              OsmMap._updateTooltipCircle(lat, lng, '1 km');
              break;
            case 'radius5000m':
              tooltipRadius = 5000;
              OsmMap._updateTooltipCircle(lat, lng, '5 km');
              break;
            case 'radius15000m':
              tooltipRadius = 15000;
              OsmMap._updateTooltipCircle(lat, lng, '15 km');
              break;
          }
          VVO.Markertooltip().removeRadiusButtons();
        });
      },


      /**
       * creates tooltip circle
       * @param {float} lat  latitude
       * @param {float} lng longitude
       * @param {string} label label of circle
       */
      _createTooltipCircle: function (lat, lng, label) {
        tooltipCircle = L.circle(new L.LatLng(lat, lng), tooltipRadius || 500).addTo(OsmMap.map);
        tooltipCircleLabel = new L.Label({
          noHide: true,
          offset: [6, -15]
        }).setContent(label).setLatLng([
          lat,
          lng + tooltipCircle._getLngRadius()
        ]);
        OsmMap.map.addLayer(tooltipCircleLabel);
      },


      /**
       * removes tooltip circle
       */
      _removeTooltipCircle: function () {
        OsmMap.map.removeLayer(tooltipCircle);
        OsmMap.map.removeLayer(tooltipCircleLabel);
        tooltipCircle = null;
        tooltipCircleLabel = null;
      },

      /**
      * creates map circle
      */
      _createMapCircle: function () {
        var lat = OsmMap.map.getCenter().lat;
        var lng = OsmMap.map.getCenter().lng;
        radius = radius || 500;
        var text = radius === 500 ? '500 m' : radius === 1000 ? '1 km' : radius === 5000 ? '5 km' : '15 km';
        mapCircle = L.circle(new L.LatLng(lat, lng), radius || 500).addTo(OsmMap.map);

        // ReSharper disable once InconsistentNaming
        mapCircleMarker = new L.Marker.Interactive([lat, lng], { icon: L.Icon.get('usermarker') })
          .addTo(OsmMap.map);
        mapCircleLabel = new L.Label({
          noHide: true,
          offset: [6, -15]
        }).setContent(text).setLatLng([
          lat,
          lng + mapCircle._getLngRadius()
        ]);
        OsmMap.map.addLayer(mapCircleLabel);
      },


      /**
      * removes map circle
      */
      _removeMapCircle: function () {
        OsmMap.map.removeLayer(mapCircle);
        OsmMap.map.removeLayer(mapCircleMarker);
        OsmMap.map.removeLayer(mapCircleLabel);
        mapCircle = null;
        mapCircleMarker = null;
        mapCircleLabel = null;
      },


      /**
       * add flap to legend for switching between small and extended legend
       */
      _addLegendFlap: function () {
        var mapId = '#' + this.mapContainer.attr('id');
        $(mapId + ' .leaflet-control-layers-overlays .leaflet-control-layers-list').last()
          .prepend('<div class="flap"><a class="icon-font ico-arrow-left size-large leaflet-flap"></a></div>');

        // always add span to zoom control
        $(mapId + " .leaflet-control-zoom-in").html("<span>+</span>");
        $(mapId + " .leaflet-control-zoom-out").html("<span>-</span>");

        $('body').off('click', mapId + ' .flap').on('click', mapId + ' .flap', function() {
          var baseContainer = $(mapId + ' .leaflet-control-container');
          if(!baseContainer.hasClass('expanded-legend')) {
            $(mapId + ' .leaflet-control-layers-base .leaflet-control-layers-toggle:first')
              .html('<label title="Radius anzeigen" class="show-radius"><img src="/assets/css/images/radius.svg" alt=""/> <span>' + I18n('showradius') + '</span></label>')
              .removeAttr("style");

            $(mapId + ' .leaflet-control-layers-base .leaflet-control-layers-toggle:last').html('<label title="' + I18n('further_maps') + '" class="further-maps"><img src="/assets/css/images/layers.svg" alt=""/> <span>' + I18n('further_maps') + '</span></label>');
            $(mapId + ' .leaflet-control-zoom-in').html('<span>+</span><span>' + I18n('zoom_in') + '</span>');
            $(mapId + ' .leaflet-control-zoom-out').html('<span>-</span><span>' + I18n('zoom_out') + '</span>');
            $(mapId + ' .magnified-control').html('<img src="/assets/css/images/magnifier.svg" alt=""/> <span>' + I18n('full_screen') + '</span>');
            $(mapId + ' .leaflet-control-locate a').html('<label title="' + I18n('my_location') + '">' + I18n('my_location') + '</label>')
          }
          else
          {
            $(mapId + ' .show-radius').remove();
            $(mapId + ' .further-maps').remove();
            $(mapId + " .leaflet-control-zoom-in").html("<span>+</span>");
            $(mapId + " .leaflet-control-zoom-out").html("<span>-</span>");
            $(mapId + ' .magnified-control').html('');
            $(mapId + ' .geolocation-label').remove();
            $(mapId + ' .leaflet-control-locate a').html('');
          }

          baseContainer.toggleClass('expanded-legend');
          $(this).find('a')
            .toggleClass('ico-arrow-right')
            .toggleClass('ico-arrow-left');

        });

        // open extended legend if set by options
        if (OsmMapConfig.Options.extendLegend && !$(mapId + ' .leaflet-control-container').hasClass('expanded-legend')) {
          $(mapId + ' .flap').click();
        }
      }
    };

  return OsmMap.init(mapId, options, mapOptions);
};
;
/***
 * contains zoom config for vvo/dresden route map and options for projection
 * 
 * to get numtiles, get number of bottom right tile of visible area, f.ex. 4-6.png
 *  -> numTilesX = 6+1
 *  -> numTilesY = 4+1
 * 
 * @returns {any} following functions: Config, MapOptions, Map, getTileLayer
 ***/
VVO.FarezoneMapConfig = function() {
  
  var
    config =
    {
      // vvo route map
      route: [{
        numTilesX: 7,    // number of tiles in a column / lng
        numTilesY: 5     // number of tiles in a row /lat
      }, {
        numTilesX: 12,
        numTilesY: 9
      }, {
        numTilesX: 19,
        numTilesY: 13
      }, {
        numTilesX: 29,
        numTilesY: 22
      }],

      // dvb/ dresden route map
      dresden: [{
        numTilesX: 6,
        numTilesY: 4
      }, {
        numTilesX: 16,
        numTilesY: 11
      }, {
        numTilesX: 23,
        numTilesY: 17
      }]
    },

    /**
     * get leaflet specific default options
     * @param {any} type of map ("route" or "dresden")
     * @returns {any} options object
     */
    getMapOptions = function (type) {
      var cfg = config[type];

      return {
        attributionControl: false,                                                      // show copyright notice
        zoom: 0,                                                                        // initial zoom
        minZoom: 0,                                                                     // minimum zoom level
        maxZoom: cfg.length - 1,                                                        // maximum zoom level
        tileSize: 256,                                                                  // length/ width of a tile
        zoomControl: true,                                                              // show zoom control
        center: type === 'route' ? new L.LatLng(2300, 3656) : new L.LatLng(2500, 2500), // initial center point
        markerZoomLevel: type === 'route' ? 3 : 2                                       // zoom level which contains stop markers
      };
    },


    /**
     * get map class with overwritten functions for projection and options
     * @param {any} type of map ("route" or "dresden")
     * @returns {any} options object
     */
    getMap = function (type) {
      var cfg = config[type];

      return L.Map.extend({
        options: {
          crs: L.extend({}, L.CRS, {
            code: 'route',

            /**
             * translate a L.LatLng object to L.Point
             * @param {any} latLng latlng object
             * @param {any} zoom zoom level
             * @returns {any} point
             */
            latLngToPoint: function (latLng, zoom) {

              var
                idx = zoom > cfg.length - 1 ? cfg.length - 1 : zoom,
                configAct = cfg[idx],                   // get config for current zoomlevel
                pixelX = 256 * configAct.numTilesX,     // maximum x dimension in px
                pixelY = 256 * configAct.numTilesY,     // maximum y dimension in px
                configMax = cfg[cfg.length - 1],        // get config for max zoomlevel
                maxPixelX = 256 * configMax.numTilesX,  // maximum x coordinate on bottom right corner
                maxPixelY = 256 * configMax.numTilesY,  // maximum y coordinate on bottom right corner
                x = pixelX / maxPixelX * latLng.lng,    // calculate x (pixelX / maxPixelX = x/latlng.lng)
                y = pixelY / maxPixelY * latLng.lat;    // calculate y

              return new L.Point(x, y);
            },


            /**
             * translate a L.Point to L.LatLng
             * @param {any} point point 
             * @param {any} zoom zoom level
             * @returns {any} latlng
             */
            pointToLatLng: function (point, zoom) {

              var
                configMax = cfg[cfg.length - 1],        // get config for max zoomlevel
                maxPixelX = 256 * configMax.numTilesX,  // maximum x value on bottom right corner
                maxPixelY = 256 * configMax.numTilesY,  // maximum y value on bottom right corner
                configAct = cfg[zoom],                  // config for current zoomlevel
                pixelX = 256 * configAct.numTilesX,     // maximum x dimension in px
                pixelY = 256 * configAct.numTilesY,     // maximum y dimension in px
                newX = maxPixelX / pixelX * point.x,    // calculate new x according to biggest zoomlevel (maxPixelX / pixelX = x / point.x)
                newY = maxPixelY / pixelY * point.y;    // calculate new y according to biggest zoomlevel

              return new L.LatLng(newY, newX);
            }
          })
        }
      });
    },

    /**
     * get tile layer (overwrite leaflet function)
     * @param  {any} type type of map (route or dresden)
     * @returns {any} url
     */
    getTileLayer = function (type) {
      var TileLayer = L.TileLayer.extend({
        options: {
          continuousWorld: true,  // prevent to repeat map indefinitely - must be set to keep it work
          noWrap: false           // must be set to keep it work
        },

        /***
        * building tile url from hardcoded url-template
        * @param  {any} tilePoint tile point
        * @returns {any} url
        **/
        getTileUrl: function (tilePoint) {
          if (type !== 'dresden') {
            if(tilePoint.x < 0 || tilePoint.x > config.route[tilePoint.z].numTilesX - 1 ||
              tilePoint.y < 0 || tilePoint.y > config.route[tilePoint.z].numTilesY -1)
            {
              return '';
            }

            return 'https://maps.vvo-online.de/netzplan/vvo/Level' + tilePoint.z + '/' + tilePoint.y + '-' + tilePoint.x + '.png';
          }

          if(tilePoint.x < 0 || tilePoint.x > config.dresden[tilePoint.z].numTilesX - 1 ||
             tilePoint.y < 0 || tilePoint.y > config.dresden[tilePoint.z].numTilesY -1)
          {
            return '';
          }

          return 'https://maps.vvo-online.de/netzplan/dresden/Level' + tilePoint.z + '/Tile_' +
            ('000' + tilePoint.y).substr(-3) + '-' +
            ('000' + tilePoint.x).substr(-3) + '.png';
        }
      });

      return new TileLayer();
    };

  return {
    Config: config,
    MapOptions: getMapOptions,
    Map: getMap,
    getTileLayer: getTileLayer
  };
};
;
/***
 * contains logic for initializing route map layers for vvo and dresden
 * @returns {any} following functions: AddPins, BindEvents
 ***/
VVO.FarezoneMap = function () {

  // ReSharper disable InconsistentNaming
  var 
    FarezoneMapConfig = VVO.FarezoneMapConfig(), 

    Map = {

      // ReSharper restore once InconsistentNaming
      pinCache: [],
      routeMarkers: [],

      /***
       * @param {object} map map instance
       * @param {any} type of map ("route" or "dresden")
       * add pins to map
       ***/
      addPins: function(map, type) {

        // only show pins in defined zoom level, remove otherwise
        if (map.getZoom() < map.options.markerZoomLevel) {

          for (var i in Map.routeMarkers) {
            if (Map.routeMarkers.hasOwnProperty(i)) {
              map.removeLayer(Map.routeMarkers[i]);
            }
          }

          Map.routeMarkers = [];
          return;
        }

        // get pins and add to map
        $.each(Map._getPins(type), function(idx, pin) {

          // pin already exists, ignore
          if (Map.routeMarkers[pin.Id]) {
            return;
          }

          // create marker and add to map
          // ReSharper disable once InconsistentNaming
          var icon = L.Icon.get('stop');
          icon.options.iconAnchor = type === 'route' ? [-12,-32] : [-22,-26];
          
          var marker = new L.Marker.Interactive([pin.Lat, pin.Lng], { icon: icon }).addTo(map);

          // save pin object on marker
          marker.Pin = pin;

          // save marker in array
          Map.routeMarkers[pin.Id] = marker;

          // add tooltip event
          marker.once('click', function() {
            marker.bindPopup(VVO.Markertooltip().getContent(map, marker.Pin), { maxWidth: 500 });
            marker.openPopup();
          });
        });
      },


      /***
       * get pins with caching
       * @param {any} type of map ("route" or "dresden")
       * @returns {any} list of pins
       ***/
      _getPins: function(type) {
        if (Map.pinCache[type]) {
          return Map.pinCache[type];
        }

        var pins = [];
        $.ajax({
          type: 'GET',
          url: '/map/pins?coordinatesystem=epsg3857&type=' + type,
          dataType: 'json',
          data: {},
          async: false,
          success: function(data) {
            // got response, but no data
            if (!data || data.length < 1) {
              return false;
            }

            // decompress data
            $.each(data,
              function(index, compressedPin) {
                var pin = compressedPin.split('|');
                pins.push({
                  Id: pin[0],
                  Type: 'farezoneMarker',
                  Place: !pin[2] ? 'Dresden' : pin[2],
                  Name: pin[3],
                  Lat: parseFloat(pin[4]),
                  Lng: parseFloat(pin[5]),
                  Desc: pin[6]
                });
              });

            return true;
          }
        });

        return Map.pinCache[type] = pins;
      },


      /***
       * bind events to map (prevent panning out of scope, add/remove markers on zoom)
       * @param {object} map map instance
       * @param {any} type of map ("route" or "dresden")
       */
      bindEvents: function(map, type) {
        map.on('zoomend', function() {
          Map._setBounds(map, type); // check bounds
          Map.addPins(map, type);      // get pins after zooming
        });

        map.on('moveend', function() {
          Map._setBounds(map, type); // check bounds
        });
      },


      /***
       * pan back if crossed bounds of map
       * @param {object} map map instance
       * @param {any} type of map ("route" or "dresden")
       ***/
      _setBounds: function (map, type) {
        var
          cfg = FarezoneMapConfig.Config[type][map.getZoom()],
          viewBounds = map.getPixelBounds(),
          viewSw = viewBounds.getBottomLeft(),
          viewNe = viewBounds.getTopRight(),
          maxMapHeight = cfg.numTilesY * map.options.tileSize,
          maxMapWidth = cfg.numTilesX * map.options.tileSize,
          viewHeight = $(map._container).height(),
          viewWidth = $(map._container).width(),
          sw = new L.Point(0, maxMapHeight),
          ne = new L.Point(maxMapWidth, 0),
          dx = 0,
          dy = 0;

        // north
        if (viewNe.y < ne.y) {
          dy = Math.ceil(ne.y - viewNe.y);

          // if map is smaller than viewport, pan to center
          if (maxMapHeight < viewHeight) {
            dy = Math.ceil(ne.y - viewNe.y - (viewHeight - maxMapHeight) / 2);
          }
        }

        // east
        if (viewNe.x > ne.x) {
          dx = Math.floor(ne.x - viewNe.x);

          // if map is smaller than viewport, pan to center
          if (maxMapWidth < viewWidth) {
            dx = Math.floor(ne.x - (viewNe.x + (viewWidth - maxMapWidth) / 2));
          }
        }

        // south
        if (viewSw.y > sw.y) {
          dy = Math.floor(sw.y - viewSw.y);

          // if map is smaller than viewport, pan to center
          if (maxMapHeight < viewHeight) {
            dy = Math.floor(sw.y - viewSw.y + (viewHeight - maxMapHeight) / 2);
          }
        }

        // west 
        if (viewSw.x < sw.x) {
          dx = Math.ceil(sw.x - viewSw.x);

          // if map is smaller than viewport, pan to center
          if (maxMapWidth < viewWidth) {
            dx = Math.ceil(sw.x - (viewSw.x + (viewWidth - maxMapWidth) / 2));
          }
        }

        // pan if we are out of scope
        if (dx || dy) {
          map.panBy([dx, dy]);
        }
      }
    };

  return {
    AddPins: Map.addPins,
    BindEvents: Map.bindEvents
  };
};

;
/**
* returns an icon for a specific requested type that is displayed as marker
**/
L.Icon.get = function (type)
{
  // show platforms as number within circle
  if(type === 'platform'){
    return new L.DivIcon({
      iconSize: null,
      popupAnchor: [0, -20],
      className: 'platform-marker',
      html: '<span>12</span>',
    });
  }

  // render special markup for stops to show serving lines
  if(type === 'stop')
  {
    return new L.DivIcon({
      iconSize: [0, 0],
      iconAnchor: [0, -20],
      popupAnchor: [0, -40],
      html:
        '<div class="marker-container zoom-high" style="bottom:30px; right:0;" href="#" >' +
        '  <div class="marker-tooltip" style="display:none;">' +
        '    <h3 class="marker-tooltip-header heading level7"></h3>' +
        '    <div class="context-box">' +
        '      <ul class="transportation-list"></ul>' +
        '    </div>' +
        '  </div>' +
        '  <div class="marker-icon icon-marker-stop"></div>' +
        '</div>',
    });
  }

  // standard output for all other icons
  return new L.DivIcon({
    iconSize: [26, 40],
    iconAnchor: [13, 38],
    popupAnchor: [0, -40],
    html: '<div class="marker-icon"></div>',
    className: 'icon-marker-' + type
  });
}
;
/***
 * overwrites the leaflet L.Popup _initLayout function for custom vvo html
 */
L.Popup.Ext = L.Popup.extend({

  /***
   * render tooltip container
   */
  _initLayout: function () {
    var
      prefix = 'popup',
      containerClass = 'leaflet-' + prefix + ' ' + this.options.className + ' leaflet-zoom-' + (this._animated ? 'animated' : 'hide'),
      container = this._container = L.DomUtil.create('div', containerClass),
      closeButton;

    if (this.options.closeButton) {
      closeButton = this._closeButton = L.DomUtil.create('a', prefix + '-close-button', container);
      closeButton.href = '#close';
      closeButton.innerHTML = '<span class="icon-font ico-close"></span>';
      L.DomEvent.disableClickPropagation(closeButton);
      L.DomEvent.on(closeButton, 'click', this._onCloseButtonClick, this);
    }

    var wrapper = this._wrapper = L.DomUtil.create('div', prefix + '-content-wrapper', container);
    L.DomEvent.disableClickPropagation(wrapper);

    this._contentNode = L.DomUtil.create('div', prefix + '-content', wrapper);

    L.DomEvent.disableScrollPropagation(this._contentNode);
    L.DomEvent.on(wrapper, 'contextmenu', L.DomEvent.stopPropagation);

    this._tipContainer = L.DomUtil.create('div', prefix + '-tip-container', container);
    this._tip = L.DomUtil.create('div', prefix + '-tip', this._tipContainer);
  }
});


/***
 *  overwrites the leaflet L.Marker.Interactive bindPopup function for custom vvo html
 */
L.Marker.Interactive = L.Marker.extend({

  /**
   * bind popup to marker, initialize custom vvo tooltip
   * @param {any} content tooltip content
   * @param {any} options tooltip options
   * @returns {any} the current object
   */
  bindPopup: function (content, options) {
    var anchor = L.point(this.options.icon.options.popupAnchor || [0, 0]);

    anchor = anchor.add(L.Popup.Ext.prototype.options.offset);

    if (options && options.offset) {
      anchor = anchor.add(options.offset);
    }

    options = L.extend({ offset: anchor }, options);

    if (!this._popupHandlersAdded) {
      this
        .on('click', this.togglePopup, this)
        .on('remove', this.closePopup, this)
        .on('move', this._movePopup, this);
      this._popupHandlersAdded = true;
    }

    if (content instanceof L.Popup.Ext) {
      L.setOptions(content, options);
      this._popup = content;
    } else {
      this._popup = new L.Popup.Ext(options, this)
        .setContent(content);
    }

    return this;
  }
});
;
// ReSharper disable UseOfImplicitGlobalInFunctionScope, PossiblyUnassignedProperty

/**
* @returns {any} HTML marker tooltip content depending on the marker and map type
*/
VVO.Markertooltip = function () {

  var
    // ReSharper disable once InconsistentNaming
    i18n = VVO.I18N.translate,

    // ReSharper disable once InconsistentNaming
    MarkerTooltip = {
      getContent: function (that, pin) {
        var
          actualId = '#' + that._container.id,
          mapContainer = $(actualId).parent(),
          mapType = mapContainer.data('type'),
          template = MarkerTooltip._createTooltipTemplate(pin, mapContainer, mapType);

        // overwrite click events
        switch (mapType) {

          // trip request input map
          case 'TRInput':
            MarkerTooltip._bindClickToApplyLink(that, '#ttfrom', '#originid');
            MarkerTooltip._bindClickToApplyLink(that, '#ttvia', '#viaid');
            MarkerTooltip._bindClickToApplyLink(that, '#ttto', '#destinationid');
            break;

          // departure monitor input map
          case 'DMInput':
            MarkerTooltip._bindClickToApplyLink(that, '#ttdeps', '#stopid');
            break;

          case 'STTInput':       // stop time table map
          case 'TTBInput':       // and timetable book map
          case 'ADefaultsInput': // admin interface input map 
          case 'HLInput':        // homepagelink input map
            var id =
              mapType === 'ADefaultsInput' ? '#addefaultsid' :
              mapType === 'HLInput' ? '#hlchosen' : '#stopid';

            MarkerTooltip._bindClickToApplyLink(that, '#ttstops', id);
            break;
        }

        var container = document.createElement('div');
        $(container).append(template);
        return $(container).html();
      },


      /**
       * get title of pin
       * @param {any} pin Pin
       * @returns {string} title of pin
       */
      _getPinTitle: function (pin) {
        return pin.Name && pin.Place ? pin.Name + ', ' + pin.Place :
          !pin.Place && pin.Name ? pin.Name :
          pin.Place && !pin.Name ? pin.Place : 
          i18n('unidentifiedmappoint');
      },


      /**
       * create tooltip template
       * @param {any} pin Pin
       * @param {any} mapContainer jquery object of map div
       * @param {string} mapType type of map
       * @returns {string} html template
       */
      _createTooltipTemplate: function (pin, mapContainer, mapType) {

        var
          html =
            '<div class="infobox-container teaser tab-teaser" data-pointstring="' + VVO.PointHelper.pinToPointString(pin) + '">' +
              '<h3 class="heading level7">' +
              '<div>' + MarkerTooltip._getPinTitle(pin) + '</div>' +
              '<div class="logo-list right"></div>' +
            '</h3>';

        if (pin.Type === 'webcam') {
          html +=
            '<div class="context-box infobox-content" style="width:535px;height:423px;">' +
              '<img src="/img' + pin.Desc + '?_=' + new Date().getTime() + '" style = "width: 535px" />' +
            '</div>';
        }
        else {
          html += '<div class="context-box infobox-content">';

          if (pin.Type === 'platform' || pin.Type === 'servicepoint' || pin.Type === 'parkandride') {
            html +=
              '<div class="infotext">' +
                '<p>' +
                  (pin.Type === 'parkandride' ? '<span class="icon-font ico-info icon-infotext icon-reset"></span>' : '') +
                  (pin.Type === 'platform' ? i18n('platform_sing') + ' ' : '') +
                  pin.Desc.replace(/\n/g, '<br/>') +
                '</p>' +
              '</div>';
          }

          html += '<ul>';

          if (pin.Type !== 'platform') {
            if (mapType === 'ADefaultsInput' || mapType === 'HLInput' ||
              ((mapType === 'TTBInput' || mapType === 'STTInput') && pin.Type === 'stop')) {
              html +=
                '<li>' +
                  '<a id="ttstops" class="btn icon-btn-left gray-blue-btn" href="#">' +
                    '<span class="icon-font ico-clock"></span>' +
                    '<div>' + i18n('useasstop') + '</div>' +
                  '</a>' +
                '</li>';
            }

            if (mapType !== 'TRInput') {
              html +=
                '<li>' +
                  '<a id="ttdeps" class="btn icon-btn-left gray-blue-btn" href="' + mapContainer.data('departuresurl') + '?stopid=' + pin.Id + '"' + (mapType !== 'DMInput' ? ' target="_blank"' : '') +'>' +
                    '<span class="icon-font ico-clock"></span>' +
                    '<div>' + i18n(mapType === 'DMInput' ? 'useasstop' : 'nextdepartures') + '</div>' +
                  '</a>' +
                '</li>';
            }

            html +=
              '<li>' +
                '<a id="ttfrom" class="btn icon-btn-left gray-blue-btn" href="' + mapContainer.data('tripurl') + '?originid=' + pin.Id + '"' + (mapType !== 'TRInput' ? ' target="_blank"' : '') +'>' +
                  '<span class="icon-font ico-connect-from"></span>' +
                  '<div>' + i18n(mapType === 'TRInput' ? 'useasorigin' : 'connectionsfrom') + '</div>' +
                '</a>' +
              '</li>';

            if (mapType === 'TRInput') {
              html +=
                '<li>' +
                  '<a id="ttvia" class="btn icon-btn-left gray-blue-btn" href="#">' +
                    '<span class="icon-font ico-connect-to"></span>' +
                    '<div>' + i18n('useasvia') + '</div>' +
                  '</a>' +
                '</li>';
            }

            html +=
              '<li>' +
                '<a id="ttto" class="btn icon-btn-left gray-blue-btn" href="' + mapContainer.data('tripurl') + '?destinationid=' + pin.Id + '"' +
                  (mapType !== 'TRInput' && mapType !== 'HLInput' && mapType !== 'TRDefaultsInput' ? ' target="_blank"' : '') + '>' +
                  '<span class="icon-font ico-connect-to"></span>' +
                  '<div>' + i18n(mapType === 'TRInput' ? 'useasdestination' : mapType === 'HLInput' || mapType === 'TRDefaultsInput' ? 'useasstop' : 'connectionsto') + '</div>' +
                '</a>' +
              '</li>';
          }

          // hide streetview link in farezone maps
          if (pin.Type !== 'farezoneMarker') {
            html +=
              '<li id="infobox_streetview" >' +
                '<a class="btn icon-btn-left gray-blue-btn disabled" data-no-turbolink href="#">' +
                  '<span class="icon-font ico-eye"></span>' + i18n('showstreetview') +
                '</a>' +
              '</li>';
          }

          html +=
            '<li id="infobox_radius" >' +
            '<a class="btn icon-btn-left gray-blue-btn" data-no-turbolink href="#">' +
            i18n('showradius') +
            '</a>' +
            '</li>';

          html +=
            '</ul>' +
            '</div>' +
            '<span class="context-tooltip ico-tooltip-top"></span>' +
            '</div>';
        }

        return $(html);
      },


      /**
       * bind click event
       * @param {any} efaMap map instance
       * @param {any} id ID of link as query selector
       * @param {any} select ID of chosen select as jquery selector
       */
      _bindClickToApplyLink: function (efaMap, id, select) {

        $('body').off('click', id).on('click', id, function (event) {
          event.preventDefault();
          event.stopPropagation();

          // create point object
          var point = VVO.PointHelper.toPoint($(this).closest('.infobox-container').data('pointstring'));

          // set data-point, pointstring and option value of select
          $(select).data('point', point);
          $(select).data('pointstring', VVO.PointHelper.pinToPointString(point));
          $(select).html('<option value="' + point.Id + '">' + MarkerTooltip._getPinTitle(point) + ' </option>');
          $(select).data().chosen.results_update_field();
          $(select).change();


          VVO.Autocompleter($(select), true);

          // hide tooltip
          efaMap.closePopup();

          // open options accordion in trip request for via if not already opened
          if (id === '#ttvia') {
            $('.accordion-options .accordion-header').trigger({ type: 'click', onlyOpen: true });
          }

          // trigger change event
          $('body').trigger('selectChanged');
        });
      },

      /**
       * add radius buttons to tooltip
       */
      _addRadiusButtons: function () {
        var tooltipRadiusButton = $('#infobox_radius');
        tooltipRadiusButton.after(
          '<li>' +
            '<a class="btn gray-blue-btn infobox_radius_button" data-no-turbolink href="#">' +
              i18n('radius15000m') +
            '</a>' +
          '</li>');
        tooltipRadiusButton.after(
          '<li>' +
            '<a class="btn gray-blue-btn infobox_radius_button" data-no-turbolink href="#">' +
              i18n('radius5000m') +
            '</a>' +
          '</li>');
        tooltipRadiusButton.after(
          '<li>' +
            '<a class="btn gray-blue-btn infobox_radius_button" data-no-turbolink href="#">' +
              i18n('radius1000m') +
            '</a>' +
          '</li>');
        tooltipRadiusButton.after(
          '<li>' +
            '<a class="btn gray-blue-btn infobox_radius_button" data-no-turbolink href="#">' +
              i18n('radius500m') +
            '</a>' +
          '</li>');
      },

      /**
       * remove radius buttons from tooltip
       */
      _removeRadiusButtons: function () {
        $('.infobox_radius_button').remove();
      }
    };

  return {
    getContent: MarkerTooltip.getContent,
    addRadiusButtons: MarkerTooltip._addRadiusButtons,
    removeRadiusButtons: MarkerTooltip._removeRadiusButtons
  };
};
;
/***
 * Helper for converting coordinates
 ***/
VVO.Conversions = {
  /**
   * Convert EPSG 4326 (WGS84) coordinates to EPSG 3857 (Spherical Mercator / Web Mercator / Google Web Mercator / Spherical Mercator / WGS 84 Web Mercator / WGS 84/Pseudo-Mercator)
   * https://www.masinamichele.it/2018/05/04/gis-the-math-to-convert-from-epsg3857-to-wgs-84/
   * @param {any} latLng latitude longitude object
   * @returns {any} latitude longitude object
   */
  Wgs84ToEpsg3857: function(latLng) {
    var x = latLng.lng * 20037508.342789244 / 180;
    var y = Math.log(Math.tan((90 + latLng.lat) * Math.PI / 360)) * 20037508.342789244 / Math.PI;
    return new L.LatLng(y, x);

    // alternative with leaflet built-in (https://leafletjs.com/reference-1.3.0.html#crs):
    // var point = L.CRS.EPSG3857.project(data.latlng);
    // return new L.LatLng(point.x, point.y);
  },


  /**
   * Convert EPSG 3857 (Spherical Mercator / Web Mercator / Google Web Mercator / Spherical Mercator / WGS 84 Web Mercator / WGS 84/Pseudo-Mercator) coordinates to EPSG 4326 (WGS84)
   * https://www.masinamichele.it/2018/05/04/gis-the-math-to-convert-from-epsg3857-to-wgs-84/
   * @param {any} latLng latitude longitude object
   * @returns {any} latitude longitude object
   */
  Epsg3857ToWgs84: function(latLng) {
    var x = latLng.lng * 180 / 20037508.342789244;
    var y = Math.atan(Math.exp(latLng.lat * Math.PI / 20037508.342789244)) * 360 / Math.PI - 90;
    return new L.LatLng(y, x);

    // alternative with leaflet built-in (https://leafletjs.com/reference-1.3.0.html#crs):
    // var point = L.CRS.EPSG4326.project(data.latlng);
    // return new L.LatLng(point.x, point.y);
  }
};

;
/**
 * Displays a widget to customize a departure monitor for a customer's webpage.
 * @module DepartureMonitorWidget
 * @author Martin Hubrich
 */

VVO.DepartureMonitorWidget = function() {
  var Chrome = VueColor.Chrome;
  var prevBoilerplate = 'logoVvo';

  Vue.component('colorpicker', {
    components: {
      'chrome-picker': Chrome
    },
    template: '<div class="color-picker" ref="colorpicker"><input type="text" class="input" :id="colorPickerId" v-model="colorValue" @focus="showPicker()" @input="updateFromInput" /><span class="current-color" :style="\'background-color: \' + colorValue" @click="togglePicker()"></span><div class="color-picker-container"><chrome-picker :value="colors" @input="updateFromPicker" v-if="displayPicker" /></div></div>',
    props: ['color', 'colorPickerId'],
    data: function() {
      return {
        colors: {
          hex: '#000000'
        },
        colorValue: '',
        displayPicker: false
      };
    },
    mounted: function() {
      this.setColor(this.color || '#000000');
    },
    methods: {
      setColor: function(color) {
        this.updateColors(color);
        this.colorValue = color;
      },
      updateColors: function(color) {
        if(color.slice(0, 1) === '#') {
          this.colors = {
            hex: color
          };
        }
        else if(color.slice(0, 4) === 'rgba') {
          var rgba = color.replace(/^rgba?\(|\s+|\)$/g,'').split(','),
            hex = '#' + ((1 << 24) + (parseInt(rgba[0]) << 16) + (parseInt(rgba[1]) << 8) + parseInt(rgba[2])).toString(16).slice(1);
          this.colors = {
            hex: hex,
            a: rgba[3]
          };
        }
      },
      showPicker: function() {
        document.addEventListener('click', this.documentClick);
        this.displayPicker = true;
      },
      hidePicker: function() {
        document.removeEventListener('click', this.documentClick);
        this.displayPicker = false;
      },
      togglePicker: function() {
        this.displayPicker ? this.hidePicker() : this.showPicker();
      },
      updateFromInput: function() {
        this.updateColors(this.colorValue);
      },
      updateFromPicker: function(color) {
        this.colors = color;
        if(color.rgba.a === 1) {
          this.colorValue = color.hex;
        }
        else {
          this.colorValue = 'rgba(' + color.rgba.r + ', ' + color.rgba.g + ', ' + color.rgba.b + ', ' + color.rgba.a + ')';
        }
      },
      documentClick: function(e) {
        var el = this.$refs.colorpicker,
          target = e.target;
        if(el !== target && !el.contains(target)) {
          this.hidePicker();
        }
      }
    },
    watch: {
      colorValue: function(val) {
        if(val) {
          this.updateColors(val);
          this.$emit('input', val);
          //document.body.style.background = val;
        }
      }
    }
  });

  window.vm = new Vue({
    el: '#departuremonitor-widget',
    data: {
      stopId: '33000028',
      stopAlias: '',
      backgroundColor: '#0075bf',
      foregroundColor: '#fff',
      boilerplate: '0',
      iFrameUrl: document.querySelector('#departuremonitor-widget').getAttribute('data-iframe-url') + '/',
      iFrameHeight: 473,
      iFrameWidth: 640,
      leadTime: 0,
      limit: 5
    },
    computed: {
      iFrameUrlCustomized: function () {

        return this.iFrameUrl.concat(
          this.boilerplate + '/' +
          this.backgroundColor.substring(1) + '/' +
          this.foregroundColor.substring(1) + '/' +
          this.leadTime + '/' +
          this.limit + '/' +
          this.stopId +
          '?a=' + encodeURIComponent(this.stopAlias)
        );
      },
      iFrameCode: function () {
        return '<iframe src="' + this.iFrameUrlCustomized + '" frameborder="0" style="width: 100%; height: ' + this.iFrameHeight + 'px;"></iframe>';
      },
      iFrameWidthComputed: function () {
        return parseInt(this.iFrameWidth) + 40;
      },
      updateIFrameHeightForBoilerplate: function() {
        var currentBoilerplate = this.boilerplate;

        if (prevBoilerplate === 'logoVvo' && currentBoilerplate === 'rowOfPictograms') this.iFrameHeight += 12;
        // if (prevBoilerplate === 'logoVvo' && currentBoilerplate === 'letteringVvo') this.iFrameHeight -= 4;
        if (prevBoilerplate === 'rowOfPictograms' && currentBoilerplate === 'logoVvo') this.iFrameHeight -= 12;
        if (prevBoilerplate === 'rowOfPictograms' && currentBoilerplate === 'letteringVvo') this.iFrameHeight -= 12;
        // if (prevBoilerplate === 'letteringVvo' && currentBoilerplate === 'logoVvo') this.iFrameHeight += 4;
        if (prevBoilerplate === 'letteringVvo' && currentBoilerplate === 'rowOfPictograms') this.iFrameHeight += 12;

        prevBoilerplate = currentBoilerplate;
      },

    },
    watch: {
      iFrameHeight: function(val) {
        this.iFrameHeight = parseInt(val);
      }
    }
  });
};


;
/**
 * Displays a widget to customize a timetable information for a customer's webpage.
 * @module CustomizableTimetableWidget
 * @author Martin Hubrich
 */

VVO.CustomizableTimetableWidget = function() {
  var Chrome = VueColor.Chrome;
  var prevBoilerplate = 'logoVvo';

  Vue.component('colorpicker', {
    components: {
      'chrome-picker': Chrome
    },
    template: '<div class="color-picker" ref="colorpicker"><input type="text" class="input" :id="colorPickerId" v-model="colorValue" @focus="showPicker()" @input="updateFromInput" /><span class="current-color" :style="\'background-color: \' + colorValue" @click="togglePicker()"></span><div class="color-picker-container"><chrome-picker :value="colors" @input="updateFromPicker" v-if="displayPicker" /></div></div>',
    props: ['color', 'colorPickerId'],
    data: function() {
      return {
        colors: {
          hex: '#000000'
        },
        colorValue: '',
        displayPicker: false
      };
    },
    mounted: function() {
      this.setColor(this.color || '#000000');
    },
    methods: {
      setColor: function(color) {
        this.updateColors(color);
        this.colorValue = color;
      },
      updateColors: function(color) {
        if(color.slice(0, 1) === '#') {
          this.colors = {
            hex: color
          };
        }
        else if(color.slice(0, 4) === 'rgba') {
          var rgba = color.replace(/^rgba?\(|\s+|\)$/g,'').split(','),
            hex = '#' + ((1 << 24) + (parseInt(rgba[0]) << 16) + (parseInt(rgba[1]) << 8) + parseInt(rgba[2])).toString(16).slice(1);
          this.colors = {
            hex: hex,
            a: rgba[3]
          };
        }
      },
      showPicker: function() {
        document.addEventListener('click', this.documentClick);
        this.displayPicker = true;
      },
      hidePicker: function() {
        document.removeEventListener('click', this.documentClick);
        this.displayPicker = false;
      },
      togglePicker: function() {
        this.displayPicker ? this.hidePicker() : this.showPicker();
      },
      updateFromInput: function() {
        this.updateColors(this.colorValue);
      },
      updateFromPicker: function(color) {
        this.colors = color;
        if(color.rgba.a === 1) {
          this.colorValue = color.hex;
        }
        else {
          this.colorValue = 'rgba(' + color.rgba.r + ', ' + color.rgba.g + ', ' + color.rgba.b + ', ' + color.rgba.a + ')';
        }
      },
      documentClick: function(e) {
        var el = this.$refs.colorpicker,
          target = e.target;
        if(el !== target && !el.contains(target)) {
          this.hidePicker();
        }
      }
    },
    watch: {
      colorValue: function(val) {
        if(val) {
          this.updateColors(val);
          this.$emit('input', val);
          //document.body.style.background = val;
        }
      }
    }
  });

  window.vm = new Vue({
    el: '#customizable-timetable-widget',
    data: {
      fontColorWidget: '#fff',
      backgroundColorWidget: '#0075bf',
      fontColorButton: '#00305e',
      backgroundColorButton: '#f0f0f0',
      textHeader: 'So kommen Sie zu uns mit Bahn und Bus',
      boilerplate: '0',
      iFrameUrl: document.querySelector('#customizable-timetable-widget').getAttribute('data-iframe-url') + '/',
      iFrameHeight: 375,
      iFrameWidth: 550,
      stationStart: '',
      stationEnd: '',
      enableCookies: false
    },
    computed: {
      iFrameUrlCustomized: function () {
        return this.iFrameUrl.concat(
          this.boilerplate + '/' +
          this.fontColorWidget.substring(1) + '/' +
          this.backgroundColorWidget.substring(1) + '/' +
          this.fontColorButton.substring(1) + '/' +
          this.backgroundColorButton.substring(1) + '?' +
          'o=' + encodeURIComponent(this.stationStart) + '&' +
          'd=' + encodeURIComponent(this.stationEnd) + '&' +
          't=' + encodeURIComponent(this.textHeader) + '&' +
          'c=' + (this.enableCookies ? 'true' : 'false')
        );
      },
      iFrameCode: function () {
        return '<iframe src="' + this.iFrameUrlCustomized + '" frameborder="0" style="width: 100%; height: ' + this.iFrameHeight + 'px;"></iframe>';
      },
      iFrameWidthComputed: function () {
        return parseInt(this.iFrameWidth) + 40;
      }
    },
    methods: {
      updateIFrameHeightForBoilerplate: function() {
        var currentBoilerplate = this.boilerplate;

        if (prevBoilerplate === 'logoVvo' && currentBoilerplate === 'rowOfPictograms') this.iFrameHeight += 12;
        if (prevBoilerplate === 'logoVvo' && currentBoilerplate === 'letteringVvo') this.iFrameHeight -= 4;
        if (prevBoilerplate === 'rowOfPictograms' && currentBoilerplate === 'logoVvo') this.iFrameHeight -= 12;
        if (prevBoilerplate === 'rowOfPictograms' && currentBoilerplate === 'letteringVvo') this.iFrameHeight -= 16;
        if (prevBoilerplate === 'letteringVvo' && currentBoilerplate === 'logoVvo') this.iFrameHeight += 4;
        if (prevBoilerplate === 'letteringVvo' && currentBoilerplate === 'rowOfPictograms') this.iFrameHeight += 16;

        prevBoilerplate = currentBoilerplate;
      }
    },
    watch: {
      iFrameHeight: function(val) {
        this.iFrameHeight = parseInt(val);
      }
    }
  });
};


;
/***
 * common initializations for blog and website
 ***/

/***
 * initializations that should be executed after an ajax request
 * don't insert logic here, preferably calls to functions that need to be executed after ajax calls only
 ***/
VVO.CommonInitAjax = function() {
  VVO.SyncHeight();
};

/***
 * generic class construction that supplies frontend with equally high containers.
 * simply wrap all .syncheight-element with .syncheight-group and all elements within that group
 * get the same calculated height based on the highest element within that group
 ***/
VVO.SyncHeight = function (onload) {

  var fixHeight = function() {
    // check for syncheight out of accordions
    $('.syncheight-group').each(function() {
      if(!$(this).closest('.accordion-content').length) {
        $(this).find('.syncheight-element').mf_EqualHeight();
      }
    });
  };

  if(onload) {
    // generic element for sizing (call when page is fully loaded, f.ex. images, objects, frames)
    $(window).load(fixHeight);
  }else{
    // setting height after ajax calles
    fixHeight();
  }
};

/***
 * init social links
 ***/
VVO.CommonInitSocialLinks = function() {

  var

  // default values
  data = {
    href: window.location.href,
    title: document.title
  };

  // check if VVOSocialData exists
  if(typeof VVOSocialData != "undefined") {
    // overwrite defaults with custom values from inline JS
    $.extend(data, VVOSocialData);
  }

  // init facebook link
  if($('.lnk-like').not('.journey-detail .lnk-like').length) {
    $('.lnk-like').not('.journey-detail .lnk-like').attr({
      'href': 'https://www.facebook.com/sharer/sharer.php?t=' + encodeURIComponent(data.title) + '&u=' + encodeURIComponent(data.href),
      'target': '_blank'
    });
  }

  // init twitter link
  if($('.lnk-x').not('.journey-detail .lnk-x').length) {
    $('.lnk-x').not('.journey-detail .lnk-x').attr({
      'href': 'https://twitter.com/intent/tweet?status=' + encodeURIComponent(data.title + ': ' + data.href),
      'target': '_blank'
    });
  }

  // init whatsapp link
  if($('.lnk-whatsapp').not('.journey-detail .lnk-whatsapp').length) {
    $('.lnk-whatsapp').not('.journey-detail .lnk-whatsapp').attr({
      'href': 'https://api.whatsapp.com/send?text=' + encodeURIComponent(data.title + ': ' + data.href),
      'target': '_blank'
    });
  }

};

/***
 * Hide and Show Regions on a Map using image-map
**/
VVO.InteractiveMap = function() {
  var region = '';
  $('.tarifmap-image-map area').on('mouseenter', function() {
    $('.tarif-region').removeClass('active');

    region = $(this).attr('data-region');

    $('.tarif-region.'+ region).addClass('active');
  });

  $('.tarifmap-image-map area').on('mouseleave', function() {
    region = $(this).attr('data-region');

    $('.tarif-region.'+ region).removeClass('active');
  });
};

/***
 * Hide and Show Abo Regions on a Map using image-map
 **/
 VVO.InteractiveAboMap = function () {
  var abo = "";
  $(".abomap-image-map area").on("mouseenter", function () {
    $(".abo-region").removeClass("active");

    abo = $(this).attr("data-abo");

    $(".abo-region." + abo).addClass("active");
  });

  $(".abomap-image-map area").on("mouseleave", function () {
    abo = $(this).attr("data-abo");

    $(".abo-region." + abo).removeClass("active");
  });
};

/***
 * initializations that should be executed one time after start
 ***/
VVO.CommonInit = function() {

  VVO.SyncHeight(true);
  VVO.CommonInitSocialLinks();

  if($('.tarifmap').length) {
    VVO.InteractiveMap();
  }

  if ($(".abomap").length) {
    VVO.InteractiveAboMap();
  }

  // init horizontal/vertical radioswitches and checkboxes
  if($('.switch-v, .switch-h, .switch-checks').length) {
    $('.switch-v, .switch-h, .switch-checks').each(function() {
      // exclude app radios/checkboxes (already done in app init)
      if(!$(this).parents('.apparea').length) {
        VVO.RadioSwitcher.init($(this));
      }
    });
  }

  $('body').on('focus touchend', '.connection-detail > li, #stt .item-list li, #ttb .item-list li, #rc .item-list li, #stt .list-entry, #rc .list-entry', function (event) {
    var that = $(this);

    if (that.hasClass('nofocus')) {
      return;
    }

    // remove all focus classes
    $('.list-focus').removeClass('list-focus');

    // make li blue
    that.addClass('list-focus');
  });
};

/***
 * initialize common functions
 ***/
VVO.CommonInit();
;
/***
 * main initializations for elements and apps
 ***/

//write backurl into sessionstorage for preventing pushstate on pagereload because of backbutton press
$('body').on('mousedown', 'a', function (event) {
  if (this.href !== "") {
    //same page link -> delete url
    if (this.href == '#') {
      delete sessionStorage['backUrl'];
    } else {
      //page to different link ->  store url
      sessionStorage['backUrl'] = this.href;
    }
  }
});

// track ajax links
$(document).ajaxComplete(function (xhr, html, options) {
  if (typeof (_paq) === 'undefined') {
    return;
  }

  // exclude json requests
  try {
    jQuery.parseJSON(html.responseText);
    return;
  } catch (e) {}

  var title = $(html.responseText).find('title,h1,h2,h3,h4,h5').first().text();

  var url = options.url;

  if ($('.apparea').data('use-url-without-parameters-for-piwik')){
    url = url.split('?')[0];
  }

  if(options.url.indexOf('http') !== 0) {
   url = window.location.protocol + '//' + window.location.host + window.location.port + url;
  }

  try {
    _paq.push(["setCustomUrl", url]);
    _paq.push(["setDocumentTitle", title]);
    _paq.push(["trackPageView"]);
    _paq.push(["enableLinkTracking"]);
  } catch (c) { }
});

/***
 * initializations for traffic webcams
 ***/
VVO.TrafficWebcamInit = function () {
  VVO.OsmMap('webcammap', { activePinTypes: ['webcam'] }, {
    center: new L.LatLng(6630941, 1530173),
    zoom: 6
  });
};

/***
 * initializations for farezon maps
 ***/
VVO.FarezoneMapInit = function () {
  VVO.OsmMap('farezonemap', { visibleLayers: ['route'] });
};

/***
 *init park and ride page
 ***/
VVO.ParkAndRideInit = function () {
  VVO.ParkAndRide();
}

/***
 * initializations for departuremonitor
 ***/
VVO.DepartureMonitorInit = function() {
  VVO.CommonInitAjax();
  VVO.WebsiteInitAjax();
  VVO.DepartureMonitor();

  // init horizontal/vertical radioswitches and checkboxes
  $('.switch-v, .switch-h, .switch-checks').each(function() {
    VVO.RadioSwitcher.init($(this));
  });

  // init autocompletion
  VVO.Autocompleter($('#stopid'));

  if ($('#stopid').val() === "" || isNaN($('#stopid').val())) {
    $('#lineid').prop( "disabled", true );
  }

  // init lineautocompletion
  VVO.Lineautocompleter($('#lineid'));

  // map accordion
  VVO.Accordion($('.accordion-map'));

  // init drop down box for map
  $('#departureform .ico-poi').on('click keydown', function (e) {
    e.preventDefault();
    $('.accordion-map .accordion-header').trigger({ type: "click", onlyOpen: true });
  });

  $('body').off('accordion-open').on('accordion-open', function () {
    // only initialize map if accordion was opened
    if ($('.accordion-map .accordion-header').attr('aria-selected') === 'true') {
      VVO.OsmMap('inputmap', { zoomToId: 'stopid', extendLegend: true });
    }
  });

  if ($('#stopid').val() !== "" && isNaN($('#stopid').val()) || $('#inputmap').hasClass('visible')) {
    $('.accordion-map .accordion-header').trigger({ type: "click", onlyOpen: true });
  }

  // init datepicker
  $('#dm .datepicker').each(function() {
    VVO.DatePicker($(this));
  });

  // init timepicker
  $('#dm .timepicker').each(function() {
    VVO.TimePicker($(this)).initTime();
  });

  // init ajax form
  VVO.AjaxForm($('#departureform'), true, 'filter', VVO.DepartureMonitorInit, function() {
    $('.monitor-header').remove();
    $('.option-a').remove();
    $('.option-b').remove();

    VVO.Helper.showMessage($('#message'), 'error', VVO.I18N.translate('ajax_error'));
  });
};

/***
 * initializations for triprequest
 ***/
VVO.TripRequestInit = function() {
  VVO.CommonInitAjax();
  VVO.WebsiteInitAjax();
  VVO.TripRequest.Init();

  // options accordion
  VVO.Accordion($('.accordion-options'));

  // map accordion
  VVO.Accordion($('.accordion-map'));

  // init drop down box for map
  $('#triprequestform .ico-poi').on('click keydown', function (e) {
    e.preventDefault();
    $('.accordion-map .accordion-header').trigger({ type: "click", onlyOpen: true, sourceId: $(this).data('sourceid') });
  });

  $('body').off('accordion-open').on('accordion-open', function (e) {
    if (!e.accordion.parent().hasClass('accordion-map')) {
      return;
    }

    // only initialize map if accordion was opened
    var isOpen = $('.accordion-map .accordion-header').attr('aria-selected') === 'true'
    if (isOpen) {
      VVO.TripRequest.ShowPinsAndConnection(VVO.OsmMap('inputmap', { zoomToId: e.sourceId, extendLegend: true }));
    }

    // only set cookie if we are not on detail page
    if(!$('#tr_overview').length)
    {
      $.cookie('trmapvisible', isOpen ? '1' : '0');
    }
  });

  // init horizontal/vertical radioswitches and checkboxes
  $('.switch-v, .switch-h, .switch-checks').each(function() {
    VVO.RadioSwitcher.init($(this));
  });

  // init autocompletion
  VVO.Autocompleter($('#originid'));
  VVO.Autocompleter($('#viaid'));
  VVO.Autocompleter($('#destinationid'));

  // init datepicker
  $('#tr .datepicker').each(function() {
    VVO.DatePicker($(this));
  });

  // init timepicker
  $('#tr .timepicker').each(function() {
    VVO.TimePicker($(this)).initTime();
  });

  // init ajax form
  VVO.AjaxForm($('#triprequestform'), true,'earliertrips', VVO.TripRequestInit, function() {
    $('#earliertrips').remove();
    $('#latertrips').remove();
    $('.journey-planner').remove();

    VVO.Helper.showMessage($('#message'), 'error', VVO.I18N.translate('ajax_error'));
  });
};

/***
 * initializations for stop timetable
 ***/
VVO.StopTimetableInit = function() {
  VVO.CommonInitAjax();
  VVO.WebsiteInitAjax();
  VVO.StopTimetable();

  // init autocompletion
  VVO.Autocompleter($('#stopid'));

  // map accordion
  VVO.Accordion($('.accordion-map'));

  // init drop down box for map
  $('#sttform .ico-poi').on('click keydown', function (e) {
    e.preventDefault();
    $('.accordion-map .accordion-header').trigger({ type: "click", onlyOpen: true });
  });

  $('body').off('accordion-open').on('accordion-open', function () {
    // only initialize map if accordion was opened
    if ($('.accordion-map .accordion-header').attr('aria-selected') === 'true') {
      VVO.OsmMap('inputmap', { zoomToId: 'stopid', extendLegend: true });
    }
  });

  // init ajax form
  var spinnerLeft = $('#stopid_chosen').offset().left + $('#stopid_chosen').width() + 20;
  var spinnerTop = $('#stopid_chosen').offset().top + $('#stopid_chosen').height()/2;

  VVO.AjaxForm($('#sttform'), true, 'filter', VVO.StopTimetableInit, function() {
    $('.monitor-header').remove();
    $('.departures-arrivals .small-box').remove();

    VVO.Helper.showMessage($('#message'), 'error', VVO.I18N.translate('ajax_error'));
  }, spinnerLeft, spinnerTop);

  $('.accordion').each(function() {
    VVO.Accordion($(this));
  });
};

/***
 * initializations for timetable book
 ***/
VVO.TimetableBookInit = function() {
  VVO.CommonInitAjax();
  VVO.WebsiteInitAjax();
  VVO.TimetableBook();

  // init horizontal/vertical radioswitches and checkboxes
  $('.switch-v, .switch-h, .switch-checks').each(function() {
    VVO.RadioSwitcher.init($(this));
  });

  // init autocompletion
  VVO.Autocompleter($('#stopid'));

  // map accordion
  VVO.Accordion($('.accordion-map'));

  // more options accordion
  VVO.Accordion($(".accordion-options"));

  // init drop down box for map
  $('#ttbform .ico-poi').on('click keydown', function (e) {
    e.preventDefault();
    $('.accordion-map .accordion-header').trigger({ type: "click", onlyOpen: true });
  });

  $('body').off('accordion-open').on('accordion-open', function () {
    // only initialize map if accordion was opened
    if ($('.accordion-map .accordion-header').attr('aria-selected') === 'true') {
      VVO.OsmMap('inputmap', { zoomToId: 'stopid', extendLegend: true });
    }
  });

  // init ajax form
  VVO.AjaxForm($('#ttbform'), true, 'filter',  VVO.TimetableBookInit, function() {
    $('.departures-arrivals').next().remove();
    $('.departures-arrivals').remove();
    VVO.Helper.showMessage($('#message'), 'error', VVO.I18N.translate('ajax_error'));
  });

  $('.accordion').each(function() {
    VVO.Accordion($(this));
  });
};

/***
 * initializations for trips/departures tabs (todo refactor)
 ***/
VVO.TripsDeparturesTeaserInit = function() {
  // init autocompletion
  VVO.Autocompleter($('#originid'));
  VVO.Autocompleter($('#destinationid'));
  VVO.Autocompleter($('#stopid_teaser'));

  // init datepicker
  $('#trdmteaser .datepicker').each(function() {
    VVO.DatePicker($(this));
  });

  // init timepicker
  $('#trdmteaser .timepicker').each(function() {
    VVO.TimePicker($(this)).initTime();
  });

  // update widget form action dependend if a selection was done or not
  $('#triprequestform').on('submit', function () {
    var submit = !!($('#destinationid').val() || $('#originid').val());
    $(this).attr('action', $(this).data('action-submit-' + submit));
  });
};

/***
 * website initializations that should be executed after an ajax request
 ***/
VVO.WebsiteInitAjax = function() {
  // hide event for error messages
  $('body').off('click', '.msg .msg-close').on('click', '.msg .msg-close', function(event) {
    event.preventDefault();
    $(this).parent().hide();
  });

  // init click handler for hover icon links
  $('.print-menu-container,.icon-list:not(.js-no-obsolete-events)').find('a').on('click keydown', function(event) {
     if(!$(this).children().first().hasClass('ico-poi') || $(this).hasClass('ico-poi' || 'ico-stationplan')){
      event.stopPropagation();
     }
  });
};

/***
 * website initializations that should be executed one time after start
 * (extends common init, should be included after VVO.CommonInit(); call)
 ***/
VVO.WebsiteInit = function() {
  //init backbutton listener
  VVO.BackButton().attachListener();

  var i18n = VVO.I18N.translate;

  VVO.WebsiteInitAjax();

  // bind events only on none touch devices
  if($('.no-touch').length) {
    // patch keyboard usage for level2 navigation
    // hover over another layer0, close subnav (layer1) that was before opened and open subnav (layer1) where current mouseenter
    $('.layer0 > li > a, .layer0 > li > strong, .layer0 > li > strong > a').on('mouseenter focus', function () {

      // toggle body classes to show if submenu or search is opened
      if($(this).closest('li').hasClass('search')){
        $('body').addClass('body--search-opened');
        $('body').removeClass('body--nav-opened');
      } else {
        $('body').addClass('body--nav-opened');
        $('body').removeClass('body--search-opened');
      }

      $('.layer1').hide();
      $(this).closest('li').find('ul').show();
    });

    // close navigation when nav-main or search (within main-nav) is open and ESC is clicked
    $('body').on('keyup', function (event) {
      if(event.key === 'Escape' && ($('body').hasClass('body--nav-opened') || $('body').hasClass('body--search-opened'))) {
        $('.layer1').hide();
      }
    });

    // hide subnavi upon blurring the very last link in the main nav
    $('.main-nav li:last').find('a, strong').on('blur', function() {
      $('.layer1').hide();
    });

    // hide subnavi
    $('.main-nav').on('mouseleave', function () {
      $('body').removeClass('body--nav-opened');
      $('body').removeClass('body--search-opened');
      $('.layer1').hide();
    });
  }

  // set focus to input when opening search or login field
  $('body').on('click', '.search .switch_btn, .login .switch_btn', function () {
      $(this).parent().find('input').first().focus();
  });

  // delete margin float container (IE8)
  $('.lt-ie9 .pictures .left:nth-child(2n+1)').each(function(){
      $(this).css('margin-left','0');
  });

  // center blockquote vertical
  if($('.blockquote-center').length) {
    $('.blockquote-center').each(function() {
      var that = $(this);
      that.css('margin-top', -that.height()/2);
    });
  }

  // init datepickers, exclude app datepicker (already done in app init)
  if($('.datepicker:not(.apparea .datepicker,.rcb)').length) {
    $('.datepicker:not(.apparea .datepicker)').each(function() {
      VVO.DatePicker($(this));
    });
  }

  // init timepickers, exclude app timepicker (already done in app init)
  if($('.timepicker:not(.apparea .timepicker,.rcb)').length) {
    $('.timepicker').not('.apparea').each(function() {
      VVO.TimePicker($(this)).initTime();
    });
  }

  // init accordions, exclude app accordions
  if($('.accordion:not(.apparea .accordion)').length) {
    $('.accordion:not(.apparea .accordion)').each(function() {
      VVO.Accordion($(this));
    });
  }

  // init slider (in header)
  if($('.large-slider').length) {
    // http://jsfiddle.net/Mottie/ycUB6/49/
    var setupSwipe = function(slider) {
      var time = 1000,
        // allow movement if < 1000 ms (1 sec)
        range = 50,
        // swipe movement of 50 pixels triggers the slider
        x = 0,
        t = 0,
        touch = "ontouchend" in document,
        st = (touch) ? 'touchstart' : 'mousedown',
        mv = (touch) ? 'touchmove' : 'mousemove',
        en = (touch) ? 'touchend' : 'mouseup';

        slider.$window
            .bind(st, function(e) {
                // prevent image drag (Firefox)
                // e.preventDefault();
                t = (new Date()).getTime();
                x = e.originalEvent.touches ? e.originalEvent.touches[0].pageX : e.pageX;
            })
            .bind(en, function(e) {
                t = 0;
                x = 0;
            })
            .bind(mv, function(e) {
                // e.preventDefault();
                var newx = e.originalEvent.touches ? e.originalEvent.touches[0].pageX : e.pageX,
                    r = (x === 0) ? 0 : Math.abs(newx - x),
                    // allow if movement < 1 sec
                    ct = (new Date()).getTime();
                if (t !== 0 && ct - t < time && r > range) {
                    if (newx < x) {
                        slider.goForward();
                    }
                    if (newx > x) {
                        slider.goBack();
                    }
                    t = 0;
                    x = 0;
                }
            });
    };

    $('#slider').find('ul').anythingSlider({
      expand : true, // If true, the entire slider will expand to fit the parent element
      hashTags : false, // Should links change the hashtag in the URL?
      appendNavigationTo : $('.slider-controls'),
      appendForwardTo : $('.slider-controls-direction'),
      appendBackTo : $('.slider-controls-direction'),
      forwardText: "nächstes Bild",
      backText: "vorheriges Bild",
      autoPlay: true,
      delay: 7000,

      navigationFormatter : function(index, panel){
        return i18n('panel') + ' ' + index; // This would have each tab with the text 'Panel #X' where X = index
      },

      // Callback when the plugin finished initializing
      onInitialized: function(e, slider) {
        setupSwipe(slider);

        // add pause/play buttons to pager
        $('.slider-controls ul').append('<li class="slider-pause-play"><a href="#" class="slider-pause icon-font icon-reset ico-pause"><span>' + i18n('pause') + '</span></a><a href="#" class="slider-play icon-font icon-reset ico-arrow-small" style="display: none;"><span>' + i18n('play') + '</span></a></li>');

        // add spans for icon-font
        // $('.large-slider').find('.back a').append('<span class="icon-font ico-arrow-slider-left"/>');
        // $('.large-slider').find('.forward a').append('<span class="icon-font ico-arrow-slider-right"/>');
        $('.large-slider').find('.back').toggleClass('back').addClass('back-arrow').find('a').addClass('icon-font ico-arrow-slider-left');
        $('.large-slider').find('.forward').toggleClass('forward').addClass('forward-arrow').find('a').addClass('icon-font ico-arrow-slider-right');
        $('.large-slider').find('.activePage').each(function(){
          if($('.activePage > a').hasClass('tourism')){
            $('.slider-controls-direction .icon-font, .slider-controls').addClass('tourism');
          }
        });

        // center pagination of slider dependent from width
        $('.slider-controls').each(function() {
          // move half width to left
          $(this).css('margin-left', -($(this).outerWidth()/2));
        });
      },

      onSlideComplete: function(e, slider) {
        $('.slider-controls-direction .icon-font, .slider-controls').removeClass('tourism');
        $('.large-slider').find('.activePage').each(function(){
          if($('.activePage> a').hasClass('tourism')){
            $('.slider-controls-direction .icon-font, .slider-controls').addClass('tourism');
          }
        });
      }
    });

    // Start Stop Buttons
    $('.large-slider').on('click keypress', '.slider-pause', function (event) {
      var code = event.keyCode|| event.which;

      if (code === 13 || event.type === 'click') {
        event.preventDefault();
        $('.start-stop').trigger('click');
        $('.slider-pause').toggle();
        $('.slider-play').toggle();
      }
    });

    $('.large-slider').on('click keypress', '.slider-play', function (event) {
      var code = event.keyCode || event.which;

      if (code === 13 || event.type === 'click') {
        event.preventDefault();
        $('.start-stop').trigger('click');
        $('.slider-pause').toggle();
        $('.slider-play').toggle();
      }
    });
  }

  // init overlay
  VVO.Colorbox.init();

  //init leaflet
  VVO.Leaflet();

  // init drop down box for search, meinvvo (within meta nav)
  $('.meta-nav').find('.switch_btn').each(function() {
    VVO.DropDownBox.init($(this));
  });

  // guestbook
  VVO.DropDownBox.init($('#gb .ico-computer-info').parent());

  // search form, block bot witha.name when this parameter is missing
  $('#search-menu form').append('<input type="hidden" name="bsd" value="1"/>');
  $('.last.search a').attr('href', $('.last.search a').attr('href') + '?bsd=1');

  //init subportal logic
  if($('#sp').length){
    VVO.Subportal();
  }

  //init shopping cart logic
  if($('#sf').length){
    VVO.ShoppingCart();
  }

  //init newsletter logic
  if($('#nf').length){
    VVO.Newsletter();
  }

  //init webcam map logic
  if($('#wc').length){
    VVO.TrafficWebcamInit();
  }

  //init farezone map logic
  if($('#farezonemap').length){
    VVO.FarezoneMapInit();
  }

  if ($('#sd').length)
  {
    VVO.ShortDistanceStops.Init();
  }

  // init departure monitor logic
  if ($('#dm').length) {
    //when from direct link -> push
    if (sessionStorage['backUrl']== document.URL) {
      $form = $('#departureform');
      var pointdata = {};
      //get displayed text of select
      $.each($form.find('select'), function (index, select) {
        pointdata[select.name] = $('#' + select.id + ' option:selected').text();
      });
      var state = { type: "form", data: $form.serialize(), selectdata: JSON.stringify(pointdata), id: $form.attr('id') };

      //push state to history
      history.replaceState ? history.replaceState(state, null) :"";
    } else {
      //yepp... very stupid solution but the only which worked here... :-/
      $(document).ready(function () {   //Check if browser is Chrome or not
        if (navigator.userAgent.search("Chrome") < 0) {
          //if not chrome - do popstate action
          VVO.BackButton().popstate();
        }
      });
    }
    VVO.DepartureMonitorInit();
  }

  // init triprequest logic
  if ($('#tr').length) {
    //when from direct link ->push
    if (sessionStorage['backUrl'] == document.URL) {
      $form = $('#triprequestform');
      var pointdata = {};
      //get displayed text of select
      $.each($form.find('select'), function (index, select) {
        pointdata[select.name] = $('#' + select.id + ' option:selected').text();
      });
      var state = { type: "form", data: $form.serialize(), selectdata: JSON.stringify(pointdata), id: $form.attr('id') };

      //push state to history
      history.replaceState ? history.replaceState(state, null) : "";
    } else {
      $(document).ready(function () {   //Check if browser is Chrome or not
        if (navigator.userAgent.search("Chrome") < 0) {
          VVO.BackButton().popstate();
        }
      });
    }

    VVO.TripRequestInit();
  }

  // init routechanges logic
  if ($('#rc').length) {
    VVO.RouteChanges();
  }

  // init stop timetable logic
  if ($('#stt').length) {
    //when from direct link ->push
    if (sessionStorage['backUrl'] == document.URL) {
      $form = $('#sttform');
      var pointdata = {};
      //get displayed text of select
      $.each($form.find('select'), function (index, select) {
        pointdata[select.name] = $('#' + select.id + ' option:selected').text();
      });
      var state = { type: "form", data: $form.serialize(), selectdata: JSON.stringify(pointdata), id: $form.attr('id') };

      //push state to history
      history.replaceState ? history.replaceState(state, null) : "";
    } else {
      $(document).ready(function () {   //Check if browser is Chrome or not
        if (navigator.userAgent.search("Chrome") < 0) {
          VVO.BackButton().popstate();
        }
      });
    }
    VVO.StopTimetableInit();
  }

  // init timetable book logic
  if ($('#ttb').length) {
    //when from direct link ->push
    if (sessionStorage['backUrl'] == document.URL) {
      $form = $('#ttbform');
      var pointdata = {};
      //get displayed text of select
      $.each($form.find('select'), function (index, select) {
        pointdata[select.name] = $('#' + select.id + ' option:selected').text();
      });
      var state = { type: "form", data: $form.serialize(), selectdata: JSON.stringify(pointdata), id: $form.attr('id') };

      //push state to history
      history.replaceState ? history.replaceState(state, null) : "";
    } else {
      $(document).ready(function () {   //Check if browser is Chrome or not
        if (navigator.userAgent.search("Chrome") < 0) {
          VVO.BackButton().popstate();
        }
      });
    }
    VVO.TimetableBookInit();
  }

  // init guestbook logic
  if ($('#gb').length) {

    VVO.Guestbook.init();
  }

  // init admin guestbook logic
  if ($('#ag').length) {

    VVO.Guestbook.init();
    VVO.Guestbook.adminInit();
  }

  if ($('#pr').length) {
    VVO.ParkAndRideInit();
  }


  //init searchstatistic logic
  if($('#se').length){
    VVO.SearchStatistic();
  }

  //init autocompleter for admin defaults
  if($('#addefaults').length){
    VVO.Homepagedefaults.init();
  }

  //init autocompleter for admin route change banners
  if($('#rcbadmin').length){
    VVO.AdminBanners();
  }

  // init tabs
  if($('.tabs').length) {
    VVO.Tabs.init($('.tabs'));

    // customize height
    $('.tab').mf_EqualHeight();
    $('.tabs').height($('.tab'));
  }

  // init trip/departures tabs
  if($('#trdmteaser').length) {
    VVO.TripsDeparturesTeaserInit();
  }

  //init account login/register logic
  VVO.Account();

  //init favourites logic
  if($('#acfav').length){
    VVO.Favourites.init();
  }

  //init routechangesubscription logic
  if($('#rcsub').length){
    VVO.RouteChangesSubscription.initFavouritesOverview();
  }

  if($('#pd').length){
    VVO.Personaldata.init();
  }

  // initialize homepagelink widget form
  if($('#customizable-timetable-widget').length)
  {
    VVO.CustomizableTimetableWidget();

    VVO.Autocompleter($('#hloriginid'));
    VVO.Autocompleter($('#hldestinationid'));

    //listen change data event (triggered in autocompleter) and update widget url
    $('#hloriginid').on('chosen:elementselected', function () {
      vm.$data.stationStart = $('#hloriginid').val()
    });
    $('#hldestinationid').on('chosen:elementselected', function () {
      vm.$data.stationEnd = $('#hldestinationid').val()
    });
  }

  // initialize homepagelink widget
  if($('#homepagelinkwidget').length)
  {
    VVO.Autocompleter($('#originid'));
    VVO.Autocompleter($('#destinationid'));
  }

  if ($('#departuremonitor-widget').length) {
    VVO.DepartureMonitorWidget();

    VVO.Autocompleter($('#stopid'));

    //listen change data event (triggered in autocompleter) and update widget url
    $('#stopid').on('chosen:elementselected', function () {
      vm.$data.stopId = $('#stopid').val()
    });
  }

  // init Issuu
  // VVO.Issuu();

  // initialize tourmap widget
  if($('.tourmap').length)
  {
    VVO.Tourmap();
  }

  // init CookieContent
  VVO.CookieContent.init();
};

/***
 * initialize website functions
 *  * load is required for executing initializations only if other js is fully loaded
 *    (otherwise pickadate is sometimes not defined)
 ***/
// page load event for first page
VVO.WebsiteInit();

// page load event for following ajax-loaded pages by turbolinks
$(document).on('page:load', VVO.WebsiteInit);


// admin area
if ($('#arcb').length || $('#gbform').length) {

  // init admin area route change banner date and timepicker
  $('#arcb .datepicker').each(function () {
    VVO.DatePicker($(this), true);
  });

  // init timepicker
  $('#arcb .timepicker').each(function () {
    VVO.TimePicker($(this)).initTime(true);
  });

  // set basepath
  window.CKEDITOR_BASEPATH = '/assets/js/base/ckeditor/';

  // get ckeditor scripts
  $.getScript(window.CKEDITOR_BASEPATH + 'ckeditor.js', function () {

    $.getScript(window.CKEDITOR_BASEPATH + 'adapters/jquery.js', function () {
      $("textarea:not('.no-ckeditor')").ckeditor({
        language: 'de'
      });
    });
  });
}
;
//************************************************************
//  @description helper to convert points to pointstrings and the other way around
//************************************************************
VVO.Print = function() {
  /**
     * Caches all jQuery Objects for later use.
     * @function _cacheElements
     * @private
     */
  var
  _cacheElements = function() {
    $body = $('body'),
    $trip_container = $body.find('.trip-container'),
    $btn_close = $body.find('.btn-close'),
    $btn_print = $body.find('.print-all-trips'),
    $accordion_header = $body.find('.accordion-header'),
    $trigger_accordion = $body.find('.trigger-accordion'),
    $toggle_stopover = $body.find('.toggle-stopover'),
    $connection_detail = $body.find('.connection-detail'),
    $stopover = $body.find('.stopover'),
    $select_details_container = $('#fieldset-select-trips'),
    $select_trips_container = $('#fieldset-select-details'),
    $additional_infos_container = $('#fieldset-additional-infos');
  },

  /**
   * Initiates the module.
   * @function init
   * @public
   */
  init = function() {
    _cacheElements();
    _bindEvents();
    _findSelected($select_details_container.find('.switch-active'));
    _toggleAccordionContent($trigger_accordion.filter('.switch-active').prev().val());

    // initially hide maps
    $body.find('.hide-container.google-map, .hide-container.map-popover').addClass('hidden');

    if ($toggle_stopover.hasClass('switch-active')) {
      _toggleIntermediateStops();
    }
  },

  /**
   * Binds all events to jQuery DOM objects.
   * @function _bindEvents
   * @private
   */
  _bindEvents = function() {
    $select_details_container.find('label').on('click', function() {
      _findSelected($(this));
    });

    $trigger_accordion.on('click', function() {
      _toggleAccordionContent($(this).prev().val());
    });

    $additional_infos_container.find('label').on('click', function() {
      _toggleAdditionalInfos($(this));
    });

    $toggle_stopover.on('click', function() {
      _toggleIntermediateStops();
    });

    $btn_close.on('click', function(event) {
      event.preventDefault();
      event.stopPropagation();
      _toggleVisibility($(this).closest('.hide-container'));
    });

    $btn_print.on('click', function() {
      window.print();
    });

    $body.on('accordion-open', function(event) {
      _getAvailableMapHeight();
      if (event.accordion.attr('aria-selected') === 'true') {
        _initAccordionMaps(event.accordion.parent());
      }
    });

    $('#range-font-size').rangeslider({
      polyfill: false,
      onSlide: function(position, value) {
        if (value < 2) {
          if ($body.hasClass('body-large-font')){
            $body.removeClass('body-large-font')
          }
          $body.addClass('body-small-font');
        } else if (value > 2) {
          if ($body.hasClass('body-small-font')){
            $body.removeClass('body-small-font')
          }
          $body.addClass('body-large-font');
        } else if (value === 2) {
          $body.removeClass('body-small-font');
          $body.removeClass('body-large-font');
        }
      }
    });
  },

  /**
   * Find selected input and get Value.
   * @function _findSelected
   * @private
   * @param {object} element - clicked label
   */
  _findSelected = function(element) {
    var value = element.prev('input').val();

    if (value !== '*') {
      _toggleVisibility($trip_container.filter('[data-' + value + '="false"]'));
    } else {
      _toggleVisibility($trip_container.filter('.hidden'));
    }
  },

  /**
   * Show/ Hide element.
   * @function _toggleVisibility
   * @private
   * @param {object} element - clicked label
   */
  _toggleVisibility = function(element) {
    element.toggleClass('hidden');
    $("#departure_time").html($('.trip-container:visible:first').data('departure-time'))
  },

  /**
   * Show/ Hide Accordion-Content when trip details are wanted.
   * @function _toggleAccordionContent
   * @private
   * @param {string} selector - input value as selector
   */
  _toggleAccordionContent = function(selector) {
    $stopover.hide();
    $body.find('' + selector + '').trigger('click');
  },

  /**
   * Show/ Hide Accordion-Content when additional infos are wanted.
   * @function _toggleAdditionalInfos
   * @private
   * @param {object} element - clicked label
   */
  _toggleAdditionalInfos = function(element) {
    if (element.find('#maps').length) {
      $('label[for="get-details"]').trigger('click');
      setTimeout(function() {
        if (element.find('#maps').is(':checked')) {
          $body.find('.hide-container.google-map, .hide-container.map-popover').removeClass('hidden');

          $.each($body.find('.hide-container.google-map, .hide-container.map-popover'), function(idx, val) {
            _initAccordionMaps($(val).parents('li'));
          });
        } else {
          $body.find('.hide-container.google-map, .hide-container.map-popover').addClass('hidden');
          }
      }, 300);
    } else if (element.find('#infos').length) {
      $('label[for="get-details"]').trigger('click');
      if (element.find('#infos').is(':checked')) {
        $body.find('.redirection').removeClass('hidden');
      } else {
        $body.find('.redirection').addClass('hidden');
      }
    } else if (element.find('#pricing').length) {
      if (element.find('#pricing').is(':checked')) {
        $('.print-pricing-info').removeClass('hidden');
      } else {
        $('.print-pricing-info').addClass('hidden');
      }
    } else if (element.find('#qrcode').length) {
      if (element.find('#qrcode').is(':checked')) {
        $('.qrcode-image').removeClass('hidden');
      } else {
        $('.qrcode-image').addClass('hidden');
      }
    }
  },

  /**
   * Show/ Hide Intermediate Stops.
   * @function _toggleIntermediateStops
   * @private
   */
  _toggleIntermediateStops = function() {
    $body.find('.accordion-header[aria-selected="false"]').trigger('click');
    $stopover.show();
  },

  /**
   * init maps in accordion
   * @function _initAccordionMaps
   * @private
   * @param {any} element accordion
   */
  _initAccordionMaps = function(element) {
    if (element.find('.accordion-header').attr('aria-selected') === 'true') {

      // init route map
      var largeMap = element.find('.large-map');
      if (!largeMap.parent().hasClass('hidden')) {

        // init map 
        VVO.OsmMap(largeMap.attr('id'),
          {
            initialZoomOut: false,
            visibleLayers: ['citymap'],
            activePinTypes: [],
            visiblePinTypes: [],
            enableFullscreen: false,
            showGeolocation: false,
            enableUserMarker: false,
            showRadius: false
          },
          {
            scrollWheelZoom: false
          });
      }

      // init partial route maps
      $.each(element.find('.small-map'), function(idx, val) {
        if (!$(this).parents('.hide-container').hasClass('hidden')) {
          VVO.OsmMap($(val).attr('id'),
            {
              initialZoomOut: false,
              visibleLayers: ['citymap'],
              activePinTypes: [],
              visiblePinTypes: [],
              enableFullscreen: false,
              showGeolocation: false,
              enableUserMarker: false,
              showRadius: false
            },
            {
              scrollWheelZoom: false
            });
        }
      });
    }
  },
  
  /**
   * get height between list-items to set heigt for small-map
   * @function _getAvailableMapHeight
   * @private
   * @param {string} id - map id
   */
  _getAvailableMapHeight = function() {
    $connection_detail.each(function() {
      var
      $small_maps = $(this).find('.map-popover'),
      count_smallmaps = $small_maps.length,
      index = [],
      li_height = 0;

      if (count_smallmaps > 1) {
        $(this).find('li').filter(':visible').each(function() {
          if (!$(this).find('.map-popover').length && !$(this).next().find('.map-popover').length) {
            li_height += $(this).height();
          }
        });

        if (((li_height / 2) + $small_maps.closest('li').height()) > 0 && ((li_height / 2) + $small_maps.closest('li').height()) < 150) {
          li_height = ((li_height / 2) + $small_maps.closest('li').height()) - 5;

          $small_maps.css('height', li_height);
          $small_maps.find('.small-map, .leaflet-container').css('height', li_height);
        }
      }
    });
  };

  if ($('#trprint').length) {
    init();
  }
}();
;
