PageSourceSearch

https://www.tiima.com/lib-scripts/js?v=tYobXEzrTYUGPG44-9nrZ41TRROGYyiHn7Sn_azBSIE1

js tiima.com collected 2026-10-05 20:13:10 UTC 1,643,392 bytes, 17,766 lines download raw bytes

1/* Minification failed. Returning unminified contents.
2(974,501-508): run-time error JS1019: Can't have 'break' outside of loop: break a
3 */
4/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */�
vendor: 22,793 bytes, lines 4-5
4
5!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}function fe(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}ce.fn=ce.prototype={jquery:t,constructor:ce,length:0,toArray:function(){return ae.call(this)},get:function(e){return null==e?ae.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=ce.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return ce.each(this,e)},map:function(n){return this.pushStack(ce.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(ae.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(ce.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(ce.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:oe.sort,splice:oe.splice},ce.extend=ce.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||v(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(ce.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||ce.isPlainObject(n)?n:{},i=!1,a[t]=ce.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},ce.extend({expando:"jQuery"+(t+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==i.call(e))&&(!(t=r(e))||"function"==typeof(n=ue.call(t,"constructor")&&t.constructor)&&o.call(n)===a)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){m(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(c(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},text:function(e){var t,n="",r=0,i=e.nodeType;if(!i)while(t=e[r++])n+=ce.text(t);return 1===i||11===i?e.textContent:9===i?e.documentElement.textContent:3===i||4===i?e.nodeValue:n},makeArray:function(e,t){var n=t||[];return null!=e&&(c(Object(e))?ce.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:se.call(t,e,n)},isXMLDoc:function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!l.test(t||n&&n.nodeName||"HTML")},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(c(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:le}),"function"==typeof Symbol&&(ce.fn[Symbol.iterator]=oe[Symbol.iterator]),ce.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var pe=oe.pop,de=oe.sort,he=oe.splice,ge="[\\x20\\t\\r\\n\\f]",ve=new RegExp("^"+ge+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ge+"+$","g");ce.contains=function(e,t){var n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(e.contains?e.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))};var f=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function p(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}ce.escapeSelector=function(e){return(e+"").replace(f,p)};var ye=C,me=s;!function(){var e,b,w,o,a,T,r,C,d,i,k=me,S=ce.expando,E=0,n=0,s=W(),c=W(),u=W(),h=W(),l=function(e,t){return e===t&&(a=!0),0},f="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",t="(?:\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",p="\\["+ge+"*("+t+")(?:"+ge+"*([*^$|!~]?=)"+ge+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+t+"))|)"+ge+"*\\]",g=":("+t+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+p+")*)|.*)\\)|)",v=new RegExp(ge+"+","g"),y=new RegExp("^"+ge+"*,"+ge+"*"),m=new RegExp("^"+ge+"*([>+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="<a id='"+S+"' href='' disabled='disabled'></a><select id='"+S+"-\r\\' disabled='disabled'><option selected=''></option></select>",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0<I(t,T,null,[e]).length},I.contains=function(e,t){return(e.ownerDocument||e)!=T&&V(e),ce.contains(e,t)},I.attr=function(e,t){(e.ownerDocument||e)!=T&&V(e);var n=b.attrHandle[t.toLowerCase()],r=n&&ue.call(b.attrHandle,t.toLowerCase())?n(e,t,!C):void 0;return void 0!==r?r:e.getAttribute(t)},I.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ce.uniqueSort=function(e){var t,n=[],r=0,i=0;if(a=!le.sortStable,o=!le.sortStable&&ae.call(e,0),de.call(e,l),a){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)he.call(e,n[r],1)}return o=null,e},ce.fn.uniqueSort=function(){return this.pushStack(ce.uniqueSort(ae.apply(this)))},(b=ce.expr={cacheLength:50,createPseudo:F,match:D,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(v," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(d,e,t,h,g){var v="nth"!==d.slice(0,3),y="last"!==d.slice(-4),m="of-type"===e;return 1===h&&0===g?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u=v!==y?"nextSibling":"previousSibling",l=e.parentNode,c=m&&e.nodeName.toLowerCase(),f=!n&&!m,p=!1;if(l){if(v){while(u){o=e;while(o=o[u])if(m?fe(o,c):1===o.nodeType)return!1;s=u="only"===d&&!s&&"nextSibling"}return!0}if(s=[y?l.firstChild:l.lastChild],y&&f){p=(a=(r=(i=l[S]||(l[S]={}))[d]||[])[0]===E&&r[1])&&r[2],o=a&&l.childNodes[a];while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if(1===o.nodeType&&++p&&o===e){i[d]=[E,a,p];break}}else if(f&&(p=a=(r=(i=e[S]||(e[S]={}))[d]||[])[0]===E&&r[1]),!1===p)while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if((m?fe(o,c):1===o.nodeType)&&++p&&(f&&((i=o[S]||(o[S]={}))[d]=[E,p]),o===e))break;return(p-=g)===h||p%h==0&&0<=p/h}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||I.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?F(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=se.call(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:F(function(e){var r=[],i=[],s=ne(e.replace(ve,"$1"));return s[S]?F(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:F(function(t){return function(e){return 0<I(t,e).length}}),contains:F(function(t){return t=t.replace(O,P),function(e){return-1<(e.textContent||ce.text(e)).indexOf(t)}}),lang:F(function(n){return A.test(n||"")||I.error("unsupported lang: "+n),n=n.replace(O,P).toLowerCase(),function(e){var t;do{if(t=C?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=ie.location&&ie.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===r},focus:function(e){return e===function(){try{return T.activeElement}catch(e){}}()&&T.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:z(!1),disabled:z(!0),checked:function(e){return fe(e,"input")&&!!e.checked||fe(e,"option")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return q.test(e.nodeName)},input:function(e){return N.test(e.nodeName)},button:function(e){return fe(e,"input")&&"button"===e.type||fe(e,"button")},text:function(e){var t;return fe(e,"input")&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:X(function(){return[0]}),last:X(function(e,t){return[t-1]}),eq:X(function(e,t,n){return[n<0?n+t:n]}),even:X(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:X(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:X(function(e,t,n){var r;for(r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:X(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=B(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=_(e);function G(){}function Y(e,t){var n,r,i,o,a,s,u,l=c[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=y.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=m.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(ve," ")}),a=a.slice(n.length)),b.filter)!(r=D[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?I.error(e):c(e,s).slice(0)}function Q(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function J(a,e,t){var s=e.dir,u=e.next,l=u||s,c=t&&"parentNode"===l,f=n++;return e.first?function(e,t,n){while(e=e[s])if(1===e.nodeType||c)return a(e,t,n);return!1}:function(e,t,n){var r,i,o=[E,f];if(n){while(e=e[s])if((1===e.nodeType||c)&&a(e,t,n))return!0}else while(e=e[s])if(1===e.nodeType||c)if(i=e[S]||(e[S]={}),u&&fe(e,u))e=e[s]||e;else{if((r=i[l])&&r[0]===E&&r[1]===f)return o[2]=r[2];if((i[l]=o)[2]=a(e,t,n))return!0}return!1}}function K(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Z(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function ee(d,h,g,v,y,e){return v&&!v[S]&&(v=ee(v)),y&&!y[S]&&(y=ee(y,e)),F(function(e,t,n,r){var i,o,a,s,u=[],l=[],c=t.length,f=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)I(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),p=!d||!e&&h?f:Z(f,u,d,n,r);if(g?g(p,s=y||(e?d:c||v)?[]:t,n,r):s=p,v){i=Z(s,l),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(s[l[o]]=!(p[l[o]]=a))}if(e){if(y||d){if(y){i=[],o=s.length;while(o--)(a=s[o])&&i.push(p[o]=a);y(null,s=[],i,r)}o=s.length;while(o--)(a=s[o])&&-1<(i=y?se.call(e,a):u[o])&&(e[i]=!(t[i]=a))}}else s=Z(s===t?s.splice(c,s.length):s),y?y(null,t,s,r):k.apply(t,s)})}function te(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=J(function(e){return e===i},a,!0),l=J(function(e){return-1<se.call(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!=w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[J(K(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return ee(1<s&&K(c),1<s&&Q(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(ve,"$1"),t,s<n&&te(e.slice(s,n)),n<r&&te(e=e.slice(n)),n<r&&Q(e))}c.push(t)}return K(c)}function ne(e,t){var n,v,y,m,x,r,i=[],o=[],a=u[e+" "];if(!a){t||(t=Y(e)),n=t.length;while(n--)(a=te(t[n]))[S]?i.push(a):o.push(a);(a=u(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=E+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==T||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==T||(V(o),n=!C);while(s=v[a++])if(s(o,t||T,n)){k.call(r,o);break}i&&(E=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=pe.call(r));f=Z(f)}k.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&ce.uniqueSort(r)}return i&&(E=h,w=p),c},m?F(r):r))).selector=e}return a}function re(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&Y(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&C&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(O,P),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=D.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(O,P),H.test(o[0].type)&&U(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&Q(o)))return k.apply(n,r),n;break}}}return(l||ne(e,c))(r,t,!C,n,!t||H.test(e)&&U(t.parentNode)||t),n}G.prototype=b.filters=b.pseudos,b.setFilters=new G,le.sortStable=S.split("").sort(l).join("")===S,V(),le.sortDetached=$(function(e){return 1&e.compareDocumentPosition(T.createElement("fieldset"))}),ce.find=I,ce.expr[":"]=ce.expr.pseudos,ce.unique=ce.uniqueSort,I.compile=ne,I.select=re,I.setDocument=V,I.tokenize=Y,I.escape=ce.escapeSelector,I.getText=ce.text,I.isXML=ce.isXMLDoc,I.selectors=ce.expr,I.support=ce.support,I.uniqueSort=ce.uniqueSort}();var d=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&ce(e).is(n))break;r.push(e)}return r},h=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},b=ce.expr.match.needsContext,w=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1<se.call(n,e)!==r}):ce.filter(n,e,r)}ce.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?ce.find.matchesSelector(r,e)?[r]:[]:ce.find.matches(e,ce.grep(t,function(e){return 1===e.nodeType}))},ce.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(ce(e).filter(function(){for(t=0;t<r;t++)if(ce.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)ce.find(e,i[t],n);return 1<r?ce.uniqueSort(n):n},filter:function(e){return this.pushStack(T(this,e||[],!1))},not:function(e){return this.pushStack(T(this,e||[],!0))},is:function(e){return!!T(this,"string"==typeof e&&b.test(e)?ce(e):e||[],!1).length}});var k,S=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}
vendor: 1,967 bytes, line 5
5return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(ce.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&ce(e);if(!b.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&ce.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?ce.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?se.call(ce(e),this[0]):se.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ce.uniqueSort(ce.merge(this.get(),ce(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ce.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return d(e,"parentNode")},parentsUntil:function(e,t,n){return d(e,"parentNode",n)},next:function(e){return A(e,"nextSibling")},prev:function(e){return A(e,"previousSibling")},nextAll:function(e){return d(e,"nextSibling")},prevAll:function(e){return d(e,"previousSibling")},nextUntil:function(e,t,n){return d(e,"nextSibling",n)},prevUntil:function(e,t,n){return d(e,"previousSibling",n)},siblings:function(e){return h((e.parentNode||{}).firstChild,e)},children:function(e){return h(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(fe(e,"template")&&(e=e.content||e),ce.merge([],e.childNodes))}},function(r,i){ce.fn[r]=function(e,t){var n=ce.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=ce.filter(t,n)),1<this.length&&(j[r]||
vendor: 9,546 bytes, line 5
5ce.uniqueSort(n),E.test(r)&&n.reverse()),this.pushStack(n)}});var D=/[^\x20\t\r\n\f]+/g;function N(e){return e}function q(e){throw e}function L(e,t,n,r){var i;try{e&&v(i=e.promise)?i.call(e).done(t).fail(n):e&&v(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}ce.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},ce.each(e.match(D)||[],function(e,t){n[t]=!0}),n):ce.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){ce.each(e,function(e,t){v(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==x(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return ce.each(arguments,function(e,t){var n;while(-1<(n=ce.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<ce.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},ce.extend({Deferred:function(e){var o=[["notify","progress",ce.Callbacks("memory"),ce.Callbacks("memory"),2],["resolve","done",ce.Callbacks("once memory"),ce.Callbacks("once memory"),0,"resolved"],["reject","fail",ce.Callbacks("once memory"),ce.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return ce.Deferred(function(r){ce.each(o,function(e,t){var n=v(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&v(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,v(t)?s?t.call(e,l(u,o,N,s),l(u,o,q,s)):(u++,t.call(e,l(u,o,N,s),l(u,o,q,s),l(u,o,N,o.notifyWith))):(a!==N&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){ce.Deferred.exceptionHook&&ce.Deferred.exceptionHook(e,t.error),u<=i+1&&(a!==q&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(ce.Deferred.getErrorHook?t.error=ce.Deferred.getErrorHook():ce.Deferred.getStackHook&&(t.error=ce.Deferred.getStackHook()),ie.setTimeout(t))}}return ce.Deferred(function(e){o[0][3].add(l(0,e,v(r)?r:N,e.notifyWith)),o[1][3].add(l(0,e,v(t)?t:N)),o[2][3].add(l(0,e,v(n)?n:q))}).promise()},promise:function(e){return null!=e?ce.extend(e,a):a}},s={};return ce.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=ae.call(arguments),o=ce.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?ae.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(L(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||v(i[t]&&i[t].then)))return o.then();while(t--)L(i[t],a(t),o.reject);return o.promise()}});var H=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ce.Deferred.exceptionHook=function(e,t){ie.console&&ie.console.warn&&e&&H.test(e.name)&&ie.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},ce.readyException=function(e){ie.setTimeout(function(){throw e})};var O=ce.Deferred();function P(){C.removeEventListener("DOMContentLoaded",P),ie.removeEventListener("load",P),ce.ready()}ce.fn.ready=function(e){return O.then(e)["catch"](function(e){ce.readyException(e)}),this},ce.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--ce.readyWait:ce.isReady)||(ce.isReady=!0)!==e&&0<--ce.readyWait||O.resolveWith(C,[ce])}}),ce.ready.then=O.then,"complete"===C.readyState||"loading"!==C.readyState&&!C.documentElement.doScroll?ie.setTimeout(ce.ready):(C.addEventListener("DOMContentLoaded",P),ie.addEventListener("load",P));var M=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n))for(s in i=!0,n)M(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,v(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(ce(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},R=/^-ms-/,I=/-([a-z])/g;function W(e,t){return t.toUpperCase()}function F(e){return e.replace(R,"ms-").replace(I,W)}var $=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function B(){this.expando=ce.expando+B.uid++}B.uid=1,B.prototype={cache:function(e){var t=e[this.expando];return t||(t={},$(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[F(t)]=n;else for(r in t)i[F(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][F(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(F):(t=F(t))in r?[t]:t.match(D)||[]).length;while(n--)delete r[t[n]]}(void 0===t||ce.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!ce.isEmptyObject(t)}};var _=new B,z=new B,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,U=/[A-Z]/g;function V(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(U,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:X.test(i)?JSON.parse(i):i)}catch(e){}z.set(e,t,n)}else n=void 0;return n}ce.extend({hasData:function(e){return z.hasData(e)||_.hasData(e)},data:function(e,t,n){return z.access(e,t,n)},removeData:function(e,t){z.remove(e,t)},_data:function(e,t,n){return _.access(e,t,n)},_removeData:function(e,t){_.remove(e,t)}}),ce.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=z.get(o),1===o.nodeType&&!_.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=F(r.slice(5)),V(o,r,i[r]));_.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){z.set(this,n)}):M(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=z.get(o,n))?t:void 0!==(t=V(o,n))?t:void 0;this.each(function(){z.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){z.remove(this,e)})}}),ce.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=_.get(e,t),n&&(!r||Array.isArray(n)?r=_.access(e,t,ce.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=ce.queue(e,t),r=n.length,i=n.shift(),o=ce._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){ce.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return _.get(e,n)||_.access(e,n,{empty:ce.Callbacks("once memory").add(function(){_.remove(e,[t+"queue",n])})})}}),ce.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?ce.queue(this[0],t):void 0===n?this:this.each(function(){var e=ce.queue(this,t,n);ce._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&ce.dequeue(this,t)})},dequeue:function(e){return this.each(function(){ce.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=ce.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=_.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var G=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Y=new RegExp("^(?:([+-])=|)("+G+")([a-z%]*)$","i"),Q=["Top","Right","Bottom","Left"],J=C.documentElement,K=function(e){return ce.contains(e.ownerDocument,e)},Z={composed:!0};J.getRootNode&&(K=function(e){return ce.contains(e.ownerDocument,e)||e.getRootNode(Z)===e.ownerDocument});var ee=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&K(e)&&"none"===ce.css(e,"display")};function te(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return ce.css(e,t,"")},u=s(),l=n&&n[3]||(ce.cssNumber[t]?"":"px"),c=e.nodeType&&(ce.cssNumber[t]||"px"!==l&&+u)&&Y.exec(ce.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)ce.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,ce.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ne={};function re(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=_.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ee(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ne[s])||
vendor: 8,814 bytes, line 5
5(o=a.body.appendChild(a.createElement(s)),u=ce.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ne[s]=u)))):"none"!==n&&(l[c]="none",_.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}ce.fn.extend({show:function(){return re(this,!0)},hide:function(){return re(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ee(this)?ce(this).show():ce(this).hide()})}});var xe,be,we=/^(?:checkbox|radio)$/i,Te=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="<textarea>x</textarea>",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="<option></option>",le.option=!!xe.lastChild;var ke={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n<r;n++)_.set(e[n],"globalEval",!t||_.get(t[n],"globalEval"))}ke.tbody=ke.tfoot=ke.colgroup=ke.caption=ke.thead,ke.th=ke.td,le.option||(ke.optgroup=ke.option=[1,"<select multiple='multiple'>","</select>"]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))ce.merge(p,o.nodeType?[o]:o);else if(je.test(o)){a=a||f.appendChild(t.createElement("div")),s=(Te.exec(o)||["",""])[1].toLowerCase(),u=ke[s]||ke._default,a.innerHTML=u[1]+ce.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;ce.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<ce.inArray(o,r))i&&i.push(o);else if(l=K(o),a=Se(f.appendChild(o),"script"),l&&Ee(a),n){c=0;while(o=a[c++])Ce.test(o.type||"")&&n.push(o)}return f}var De=/^([^.]*)(?:\.(.+)|)/;function Ne(){return!0}function qe(){return!1}function Le(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Le(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=qe;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return ce().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=ce.guid++)),e.each(function(){ce.event.add(this,t,i,r,n)})}function He(e,r,t){t?(_.set(e,r,!1),ce.event.add(e,r,{namespace:!1,handler:function(e){var t,n=_.get(this,r);if(1&e.isTrigger&&this[r]){if(n)(ce.event.special[r]||{}).delegateType&&e.stopPropagation();else if(n=ae.call(arguments),_.set(this,r,n),this[r](),t=_.get(this,r),_.set(this,r,!1),n!==t)return e.stopImmediatePropagation(),e.preventDefault(),t}else n&&(_.set(this,r,ce.event.trigger(n[0],n.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Ne)}})):void 0===_.get(e,r)&&ce.event.add(e,r,Ne)}ce.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.get(t);if($(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&ce.find.matchesSelector(J,i),n.guid||(n.guid=ce.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof ce&&ce.event.triggered!==e.type?ce.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(D)||[""]).length;while(l--)d=g=(s=De.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=ce.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=ce.event.special[d]||{},c=ce.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&ce.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),ce.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.hasData(e)&&_.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(D)||[""]).length;while(l--)if(d=g=(s=De.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=ce.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||ce.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)ce.event.remove(e,d+t[l],n,r,!0);ce.isEmptyObject(u)&&_.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=ce.event.fix(e),l=(_.get(this,"events")||Object.create(null))[u.type]||[],c=ce.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=ce.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((ce.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<ce(i,this).index(l):ce.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(ce.Event.prototype,t,{enumerable:!0,configurable:!0,get:v(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[ce.expando]?e:new ce.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,"input")&&He(t,"click",!0),!1},trigger:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,"input")&&He(t,"click"),!0},_default:function(e){var t=e.target;return we.test(t.type)&&t.click&&fe(t,"input")&&_.get(t,"click")||fe(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},ce.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},ce.Event=function(e,t){if(!(this instanceof ce.Event))return new ce.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ne:qe,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&ce.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[ce.expando]=!0},ce.Event.prototype={constructor:ce.Event,isDefaultPrevented:qe,isPropagationStopped:qe,isImmediatePropagationStopped:qe,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ne,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ne,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ne,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},ce.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},ce.event.addProp),ce.each({focus:"focusin",blur:"focusout"},function(r,i){function o(e){if(C.documentMode){var t=_.get(this,"handle"),n=ce.event.fix(e);
vendor: 14,182 bytes, line 5
5n.type="focusin"===e.type?"focus":"blur",n.isSimulated=!0,t(e),n.target===n.currentTarget&&t(n)}else ce.event.simulate(i,e.target,ce.event.fix(e))}ce.event.special[r]={setup:function(){var e;if(He(this,r,!0),!C.documentMode)return!1;(e=_.get(this,i))||this.addEventListener(i,o),_.set(this,i,(e||0)+1)},trigger:function(){return He(this,r),!0},teardown:function(){var e;if(!C.documentMode)return!1;(e=_.get(this,i)-1)?_.set(this,i,e):(this.removeEventListener(i,o),_.remove(this,i))},_default:function(e){return _.get(e.target,r)},delegateType:i},ce.event.special[i]={setup:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i);n||(C.documentMode?this.addEventListener(i,o):e.addEventListener(r,o,!0)),_.set(t,i,(n||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i)-1;n?_.set(t,i,n):(C.documentMode?this.removeEventListener(i,o):e.removeEventListener(r,o,!0),_.remove(t,i))}}}),ce.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){ce.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||ce.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),ce.fn.extend({on:function(e,t,n,r){return Le(this,e,t,n,r)},one:function(e,t,n,r){return Le(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,ce(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=qe),this.each(function(){ce.event.remove(this,e,n,t)})}});var Oe=/<script|<style|<link/i,Pe=/checked\s*(?:[^=]|=\s*.checked.)/i,Me=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)ce.event.add(t,i,s[i][n]);z.hasData(e)&&(o=z.access(e),a=ce.extend({},o),z.set(t,a))}}function $e(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=v(d);if(h||1<f&&"string"==typeof d&&!le.checkClone&&Pe.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),$e(t,r,i,o)});if(f&&(t=(e=Ae(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=ce.map(Se(e,"script"),Ie)).length;c<f;c++)u=e,c!==p&&(u=ce.clone(u,!0,!0),s&&ce.merge(a,Se(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,ce.map(a,We),c=0;c<s;c++)u=a[c],Ce.test(u.type||"")&&!_.access(u,"globalEval")&&ce.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?ce._evalUrl&&!u.noModule&&ce._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):m(u.textContent.replace(Me,""),u,l))}return n}function Be(e,t,n){for(var r,i=t?ce.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||ce.cleanData(Se(r)),r.parentNode&&(n&&K(r)&&Ee(Se(r,"script")),r.parentNode.removeChild(r));return e}ce.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=K(e);if(!(le.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ce.isXMLDoc(e)))for(a=Se(c),r=0,i=(o=Se(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&we.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||Se(e),a=a||Se(c),r=0,i=o.length;r<i;r++)Fe(o[r],a[r]);else Fe(e,c);return 0<(a=Se(c,"script")).length&&Ee(a,!f&&Se(e,"script")),c},cleanData:function(e){for(var t,n,r,i=ce.event.special,o=0;void 0!==(n=e[o]);o++)if($(n)){if(t=n[_.expando]){if(t.events)for(r in t.events)i[r]?ce.event.remove(n,r):ce.removeEvent(n,r,t.handle);n[_.expando]=void 0}n[z.expando]&&(n[z.expando]=void 0)}}}),ce.fn.extend({detach:function(e){return Be(this,e,!0)},remove:function(e){return Be(this,e)},text:function(e){return M(this,function(e){return void 0===e?ce.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return $e(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Re(this,e).appendChild(e)})},prepend:function(){return $e(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Re(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(ce.cleanData(Se(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return ce.clone(this,e,t)})},html:function(e){return M(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Oe.test(e)&&!ke[(Te.exec(e)||["",""])[1].toLowerCase()]){e=ce.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(ce.cleanData(Se(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return $e(this,arguments,function(e){var t=this.parentNode;ce.inArray(this,n)<0&&(ce.cleanData(Se(this)),t&&t.replaceChild(e,this))},n)}}),ce.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){ce.fn[e]=function(e){for(var t,n=[],r=ce(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),ce(r[o])[a](t),s.apply(n,t.get());return this.pushStack(n)}});var _e=new RegExp("^("+G+")(?!px)[a-z%]+$","i"),ze=/^--/,Xe=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=ie),t.getComputedStyle(e)},Ue=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Ve=new RegExp(Q.join("|"),"i");function Ge(e,t,n){var r,i,o,a,s=ze.test(t),u=e.style;return(n=n||Xe(e))&&(a=n.getPropertyValue(t)||n[t],s&&a&&(a=a.replace(ve,"$1")||void 0),""!==a||K(e)||(a=ce.style(e,t)),!le.pixelBoxStyles()&&_e.test(a)&&Ve.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=n.width,u.width=r,u.minWidth=i,u.maxWidth=o)),void 0!==a?a+"":a}function Ye(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",J.appendChild(u).appendChild(l);var e=ie.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),J.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=C.createElement("div"),l=C.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",le.clearCloneStyle="content-box"===l.style.backgroundClip,ce.extend(le,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=C.createElement("table"),t=C.createElement("tr"),n=C.createElement("div"),e.style.cssText="position:absolute;left:-11111px;border-collapse:separate",t.style.cssText="box-sizing:content-box;border:1px solid",t.style.height="1px",n.style.height="9px",n.style.display="block",J.appendChild(e).appendChild(t).appendChild(n),r=ie.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,J.removeChild(e)),a}}))}();var Qe=["Webkit","Moz","ms"],Je=C.createElement("div").style,Ke={};function Ze(e){var t=ce.cssProps[e]||Ke[e];return t||(e in Je?e:Ke[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Qe.length;while(n--)if((e=Qe[n]+t)in Je)return e}(e)||e)}var et=/^(none|table(?!-c[ea]).+)/,tt={position:"absolute",visibility:"hidden",display:"block"},nt={letterSpacing:"0",fontWeight:"400"};function rt(e,t,n){var r=Y.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function it(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0,l=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(l+=ce.css(e,n+Q[a],!0,i)),r?("content"===n&&(u-=ce.css(e,"padding"+Q[a],!0,i)),"margin"!==n&&(u-=ce.css(e,"border"+Q[a]+"Width",!0,i))):(u+=ce.css(e,"padding"+Q[a],!0,i),"padding"!==n?u+=ce.css(e,"border"+Q[a]+"Width",!0,i):s+=ce.css(e,"border"+Q[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u+l}function ot(e,t,n){var r=Xe(e),i=(!le.boxSizingReliable()||n)&&"border-box"===ce.css(e,"boxSizing",!1,r),o=i,a=Ge(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(_e.test(a)){if(!n)return a;a="auto"}return(!le.boxSizingReliable()&&i||!le.reliableTrDimensions()&&fe(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===ce.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===ce.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+it(e,t,n||(i?"border":"content"),o,r,a)+"px"}function at(e,t,n,r,i){return new at.prototype.init(e,t,n,r,i)}ce.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ge(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=F(t),u=ze.test(t),l=e.style;if(u||(t=Ze(s)),a=ce.cssHooks[t]||ce.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=Y.exec(n))&&i[1]&&(n=te(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(ce.cssNumber[s]?"":"px")),le.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=F(t);return ze.test(t)||(t=Ze(s)),(a=ce.cssHooks[t]||ce.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Ge(e,t,r)),"normal"===i&&t in nt&&(i=nt[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),ce.each(["height","width"],function(e,u){ce.cssHooks[u]={get:function(e,t,n){if(t)return!et.test(ce.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?ot(e,u,n):Ue(e,tt,function(){return ot(e,u,n)})},set:function(e,t,n){var r,i=Xe(e),o=!le.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===ce.css(e,"boxSizing",!1,i),s=n?it(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-it(e,u,"border",!1,i)-.5)),s&&(r=Y.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=ce.css(e,u)),rt(0,t,s)}}}),ce.cssHooks.marginLeft=Ye(le.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Ge(e,"marginLeft"))||e.getBoundingClientRect().left-Ue(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),ce.each({margin:"",padding:"",border:"Width"},function(i,o){ce.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+Q[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(ce.cssHooks[i+o].set=rt)}),ce.fn.extend({css:function(e,t){return M(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Xe(e),i=t.length;a<i;a++)o[t[a]]=ce.css(e,t[a],!1,r);return o}return void 0!==n?ce.style(e,t,n):ce.css(e,t)},e,t,1<arguments.length)}}),((ce.Tween=at).prototype={constructor:at,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||ce.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(ce.cssNumber[n]?"":"px")},cur:function(){var e=at.propHooks[this.prop];return e&&e.get?e.get(this):at.propHooks._default.get(this)},run:function(e){var t,n=at.propHooks[this.prop];return this.options.duration?this.pos=t=ce.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):at.propHooks._default.set(this),this}}).init.prototype=at.prototype,(at.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ce.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){ce.fx.step[e.prop]?ce.fx.step[e.prop](e):1!==e.elem.nodeType||!ce.cssHooks[e.prop]&&null==e.elem.style[Ze(e.prop)]?e.elem[e.prop]=e.now:ce.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=at.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ce.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},ce.fx=at.prototype.init,ce.fx.step={};var st,ut,lt,ct,ft=/^(?:toggle|show|hide)$/,pt=/queueHooks$/;function dt(){ut&&(!1===C.hidden&&ie.requestAnimationFrame?ie.requestAnimationFrame(dt):ie.setTimeout(dt,ce.fx.interval),ce.fx.tick())}function ht(){return ie.setTimeout(function(){st=void 0}),st=Date.now()}function gt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=Q[r])]=i["padding"+n]=e;
vendor: 4,590 bytes, line 5
5return t&&(i.opacity=i.width=e),i}function vt(e,t,n){for(var r,i=(yt.tweeners[t]||[]).concat(yt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function yt(o,e,t){var n,a,r=0,i=yt.prefilters.length,s=ce.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=st||ht(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:ce.extend({},e),opts:ce.extend(!0,{specialEasing:{},easing:ce.easing._default},t),originalProperties:e,originalOptions:t,startTime:st||ht(),duration:t.duration,tweens:[],createTween:function(e,t){var n=ce.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=F(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=ce.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=yt.prefilters[r].call(l,o,c,l.opts))return v(n.stop)&&(ce._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return ce.map(c,vt,l),v(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),ce.fx.timer(ce.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}ce.Animation=ce.extend(yt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return te(n.elem,e,Y.exec(t),n),n}]},tweener:function(e,t){v(e)?(t=e,e=["*"]):e=e.match(D);for(var n,r=0,i=e.length;r<i;r++)n=e[r],yt.tweeners[n]=yt.tweeners[n]||[],yt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ee(e),v=_.get(e,"fxshow");for(r in n.queue||(null==(a=ce._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,ce.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],ft.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||ce.style(e,r)}if((u=!ce.isEmptyObject(t))||!ce.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=_.get(e,"display")),"none"===(c=ce.css(e,"display"))&&(l?c=l:(re([e],!0),l=e.style.display||l,c=ce.css(e,"display"),re([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===ce.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=_.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&re([e],!0),p.done(function(){for(r in g||re([e]),_.remove(e,"fxshow"),d)ce.style(e,r,d[r])})),u=vt(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?yt.prefilters.unshift(e):yt.prefilters.push(e)}}),ce.speed=function(e,t,n){var r=e&&"object"==typeof e?ce.extend({},e):{complete:n||!n&&t||v(e)&&e,duration:e,easing:n&&t||t&&!v(t)&&t};return ce.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in ce.fx.speeds?r.duration=ce.fx.speeds[r.duration]:r.duration=ce.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){v(r.old)&&r.old.call(this),r.queue&&ce.dequeue(this,r.queue)},r},ce.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ee).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=ce.isEmptyObject(t),o=ce.speed(e,n,r),a=function(){var e=yt(this,ce.extend({},t),o);(i||_.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=ce.timers,r=_.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&pt.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1)
vendor: 13,972 bytes, line 5
5);!e&&o||ce.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=_.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=ce.timers,o=n?n.length:0;for(t.finish=!0,ce.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),ce.each(["toggle","show","hide"],function(e,r){var i=ce.fn[r];ce.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(gt(r,!0),e,t,n)}}),ce.each({slideDown:gt("show"),slideUp:gt("hide"),slideToggle:gt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){ce.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),ce.timers=[],ce.fx.tick=function(){var e,t=0,n=ce.timers;for(st=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||ce.fx.stop(),st=void 0},ce.fx.timer=function(e){ce.timers.push(e),ce.fx.start()},ce.fx.interval=13,ce.fx.start=function(){ut||(ut=!0,dt())},ce.fx.stop=function(){ut=null},ce.fx.speeds={slow:600,fast:200,_default:400},ce.fn.delay=function(r,e){return r=ce.fx&&ce.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=ie.setTimeout(e,r);t.stop=function(){ie.clearTimeout(n)}})},lt=C.createElement("input"),ct=C.createElement("select").appendChild(C.createElement("option")),lt.type="checkbox",le.checkOn=""!==lt.value,le.optSelected=ct.selected,(lt=C.createElement("input")).value="t",lt.type="radio",le.radioValue="t"===lt.value;var mt,xt=ce.expr.attrHandle;ce.fn.extend({attr:function(e,t){return M(this,ce.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){ce.removeAttr(this,e)})}}),ce.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?ce.prop(e,t,n):(1===o&&ce.isXMLDoc(e)||(i=ce.attrHooks[t.toLowerCase()]||(ce.expr.match.bool.test(t)?mt:void 0)),void 0!==n?null===n?void ce.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=ce.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!le.radioValue&&"radio"===t&&fe(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(D);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),mt={set:function(e,t,n){return!1===t?ce.removeAttr(e,n):e.setAttribute(n,n),n}},ce.each(ce.expr.match.bool.source.match(/\w+/g),function(e,t){var a=xt[t]||ce.find.attr;xt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=xt[o],xt[o]=r,r=null!=a(e,t,n)?o:null,xt[o]=i),r}});var bt=/^(?:input|select|textarea|button)$/i,wt=/^(?:a|area)$/i;function Tt(e){return(e.match(D)||[]).join(" ")}function Ct(e){return e.getAttribute&&e.getAttribute("class")||""}function kt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(D)||[]}ce.fn.extend({prop:function(e,t){return M(this,ce.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[ce.propFix[e]||e]})}}),ce.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&ce.isXMLDoc(e)||(t=ce.propFix[t]||t,i=ce.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=ce.find.attr(e,"tabindex");return t?parseInt(t,10):bt.test(e.nodeName)||wt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),le.optSelected||(ce.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),ce.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ce.propFix[this.toLowerCase()]=this}),ce.fn.extend({addClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).addClass(t.call(this,e,Ct(this)))}):(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&" "+Tt(r)+" "){for(o=0;o<e.length;o++)i=e[o],n.indexOf(" "+i+" ")<0&&(n+=i+" ");a=Tt(n),r!==a&&this.setAttribute("class",a)}}):this},removeClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).removeClass(t.call(this,e,Ct(this)))}):arguments.length?(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&" "+Tt(r)+" "){for(o=0;o<e.length;o++){i=e[o];while(-1<n.indexOf(" "+i+" "))n=n.replace(" "+i+" "," ")}a=Tt(n),r!==a&&this.setAttribute("class",a)}}):this:this.attr("class","")},toggleClass:function(t,n){var e,r,i,o,a=typeof t,s="string"===a||Array.isArray(t);return v(t)?this.each(function(e){ce(this).toggleClass(t.call(this,e,Ct(this),n),n)}):"boolean"==typeof n&&s?n?this.addClass(t):this.removeClass(t):(e=kt(t),this.each(function(){if(s)for(o=ce(this),i=0;i<e.length;i++)r=e[i],o.hasClass(r)?o.removeClass(r):o.addClass(r);else void 0!==t&&"boolean"!==a||((r=Ct(this))&&_.set(this,"__className__",r),this.setAttribute&&this.setAttribute("class",r||!1===t?"":_.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+Tt(Ct(n))+" ").indexOf(t))return!0;return!1}});var St=/\r/g;ce.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=v(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,ce(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=ce.map(t,function(e){return null==e?"":e+""})),(r=ce.valHooks[this.type]||ce.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=ce.valHooks[t.type]||ce.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(St,""):null==e?"":e:void 0}}),ce.extend({valHooks:{option:{get:function(e){var t=ce.find.attr(e,"value");return null!=t?t:Tt(ce.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!fe(n.parentNode,"optgroup"))){if(t=ce(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=ce.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<ce.inArray(ce.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),ce.each(["radio","checkbox"],function(){ce.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<ce.inArray(ce(e).val(),t)}},le.checkOn||(ce.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Et=ie.location,jt={guid:Date.now()},At=/\?/;ce.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new ie.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||ce.error("Invalid XML: "+(n?ce.map(n.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var Dt=/^(?:focusinfocus|focusoutblur)$/,Nt=function(e){e.stopPropagation()};ce.extend(ce.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||C],d=ue.call(e,"type")?e.type:e,h=ue.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||C,3!==n.nodeType&&8!==n.nodeType&&!Dt.test(d+ce.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[ce.expando]?e:new ce.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:ce.makeArray(t,[e]),c=ce.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!y(n)){for(s=c.delegateType||d,Dt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||C)&&p.push(a.defaultView||a.parentWindow||ie)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(_.get(o,"events")||Object.create(null))[e.type]&&_.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&$(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!$(n)||u&&v(n[d])&&!y(n)&&((a=n[u])&&(n[u]=null),ce.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,Nt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,Nt),ce.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=ce.extend(new ce.Event,n,{type:e,isSimulated:!0});ce.event.trigger(r,null,t)}}),ce.fn.extend({trigger:function(e,t){return this.each(function(){ce.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return ce.event.trigger(e,t,n,!0)}});var qt=/\[\]$/,Lt=/\r?\n/g,Ht=/^(?:submit|button|image|reset|file)$/i,Ot=/^(?:input|select|textarea|keygen)/i;function Pt(n,e,r,i){var t;if(Array.isArray(e))ce.each(e,function(e,t){r||qt.test(n)?i(n,t):Pt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==x(e))i(n,e);else for(t in e)Pt(n+"["+t+"]",e[t],r,i)}ce.param=function(e,t){var n,r=[],i=function(e,t){var n=v(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!ce.isPlainObject(e))ce.each(e,function(){i(this.name,this.value)});else for(n in e)Pt(n,e[n],t,i);return r.join("&")},ce.fn.extend({serialize:function(){return ce.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ce.prop(this,"elements");return e?ce.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ce(this).is(":disabled")&&Ot.test(this.nodeName)&&!Ht.test(e)&&(this.checked||!we.test(e))}).map(function(e,t){var n=ce(this).val();return null==n?null:Array.isArray(n)?ce.map(n,function(e){return{name:t.name,value:e.replace(Lt,"\r\n")}}):{name:t.name,value:n.replace(Lt,"\r\n")}}).get()}});var Mt=/%20/g,Rt=/#.*$/,It=/([?&])_=[^&]*/,Wt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ft=/^(?:GET|HEAD)$/,$t=/^\/\//,Bt={},_t={},zt="*/".concat("*"),Xt=C.createElement("a");function Ut(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(D)||[];if(v(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Vt(t,i,o,a){var s={},u=t===_t;function l(e){var r;return s[e]=!0,ce.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function Gt(e,t){var n,r,i=ce.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&ce.extend(!0,e,r),e}Xt.href=Et.href,ce.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Et.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Et.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":ce.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Gt(Gt(e,ce.ajaxSettings),t):Gt(ce.ajaxSettings,e)},ajaxPrefilter:Ut(Bt),ajaxTransport:Ut(_t),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=ce.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?ce(y):ce.event,x=ce.Deferred(),b=ce.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Wt.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Et.href)+"").replace($t,Et.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(D)||[""],null==v.crossDomain){r=C.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Xt.protocol+"//"+Xt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=ce.param(v.data,v.traditional)),Vt(Bt,v,t,T),h)return T;for(i in(g=ce.event&&v.global)&&0==ce.active++&&ce.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Ft.test(v.type),f=v.url.replace(Rt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(Mt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(At.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(It,"$1"),o=(At.test(f)?"&":"?")+"_="+jt.guid+++o),v.url=f+o),v.ifModified&&(ce.lastModified[f]&&T.setRequestHeader("If-Modified-Since",ce.lastModified[f]),ce.etag[f]&&T.setRequestHeader("If-None-Match",ce.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+zt+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);
vendor: 9,033 bytes, line 5
5if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Vt(_t,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=ie.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&ie.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<ce.inArray("script",v.dataTypes)&&ce.inArray("json",v.dataTypes)<0&&(v.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(ce.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(ce.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--ce.active||ce.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return ce.get(e,t,n,"json")},getScript:function(e,t){return ce.get(e,void 0,t,"script")}}),ce.each(["get","post"],function(e,i){ce[i]=function(e,t,n,r){return v(t)&&(r=r||n,n=t,t=void 0),ce.ajax(ce.extend({url:e,type:i,dataType:r,data:t,success:n},ce.isPlainObject(e)&&e))}}),ce.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),ce._evalUrl=function(e,t,n){return ce.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){ce.globalEval(e,t,n)}})},ce.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=ce(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return v(n)?this.each(function(e){ce(this).wrapInner(n.call(this,e))}):this.each(function(){var e=ce(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=v(t);return this.each(function(e){ce(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){ce(this).replaceWith(this.childNodes)}),this}}),ce.expr.pseudos.hidden=function(e){return!ce.expr.pseudos.visible(e)},ce.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},ce.ajaxSettings.xhr=function(){try{return new ie.XMLHttpRequest}catch(e){}};var Yt={0:200,1223:204},Qt=ce.ajaxSettings.xhr();le.cors=!!Qt&&"withCredentials"in Qt,le.ajax=Qt=!!Qt,ce.ajaxTransport(function(i){var o,a;if(le.cors||Qt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(Yt[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&ie.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),ce.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ce.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return ce.globalEval(e),e}}}),ce.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),ce.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=ce("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=Tt(e.slice(s)),e=e.slice(0,s)),v(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&ce.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?ce("<div>").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return 
vendor: 2,613 bytes, lines 5-8
5M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var en=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;ce.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),v(e))return r=ae.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(ae.call(arguments)))}).guid=e.guid=e.guid||ce.guid++,i},ce.holdReady=function(e){e?ce.readyWait++:ce.ready(!0)},ce.isArray=Array.isArray,ce.parseJSON=JSON.parse,ce.nodeName=fe,ce.isFunction=v,ce.isWindow=y,ce.camelCase=F,ce.type=x,ce.now=Date.now,ce.isNumeric=function(e){var t=ce.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},ce.trim=function(e){return null==e?"":(e+"").replace(en,"$1")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return ce});var tn=ie.jQuery,nn=ie.$;return ce.noConflict=function(e){return ie.$===ce&&(ie.$=nn),e&&ie.jQuery===ce&&(ie.jQuery=tn),ce},"undefined"==typeof e&&(ie.jQuery=ie.$=ce),ce});
6;
7/*! jQuery UI - v1.13.2 - 2022-07-14
8* http://jqueryui.com
vendor: 8,631 bytes, lines 9-12
9* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
10* Copyright jQuery Foundation and other contributors; Licensed MIT */
11
12!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(V){"use strict";V.ui=V.ui||{};V.ui.version="1.13.2";var n,i=0,a=Array.prototype.hasOwnProperty,r=Array.prototype.slice;V.cleanData=(n=V.cleanData,function(t){for(var e,i,s=0;null!=(i=t[s]);s++)(e=V._data(i,"events"))&&e.remove&&V(i).triggerHandler("remove");n(t)}),V.widget=function(t,i,e){var s,n,o,a={},r=t.split(".")[0],l=r+"-"+(t=t.split(".")[1]);return e||(e=i,i=V.Widget),Array.isArray(e)&&(e=V.extend.apply(null,[{}].concat(e))),V.expr.pseudos[l.toLowerCase()]=function(t){return!!V.data(t,l)},V[r]=V[r]||{},s=V[r][t],n=V[r][t]=function(t,e){if(!this||!this._createWidget)return new n(t,e);arguments.length&&this._createWidget(t,e)},V.extend(n,s,{version:e.version,_proto:V.extend({},e),_childConstructors:[]}),(o=new i).options=V.widget.extend({},o.options),V.each(e,function(e,s){function n(){return i.prototype[e].apply(this,arguments)}function o(t){return i.prototype[e].apply(this,t)}a[e]="function"==typeof s?function(){var t,e=this._super,i=this._superApply;return this._super=n,this._superApply=o,t=s.apply(this,arguments),this._super=e,this._superApply=i,t}:s}),n.prototype=V.widget.extend(o,{widgetEventPrefix:s&&o.widgetEventPrefix||t},a,{constructor:n,namespace:r,widgetName:t,widgetFullName:l}),s?(V.each(s._childConstructors,function(t,e){var i=e.prototype;V.widget(i.namespace+"."+i.widgetName,n,e._proto)}),delete s._childConstructors):i._childConstructors.push(n),V.widget.bridge(t,n),n},V.widget.extend=function(t){for(var e,i,s=r.call(arguments,1),n=0,o=s.length;n<o;n++)for(e in s[n])i=s[n][e],a.call(s[n],e)&&void 0!==i&&(V.isPlainObject(i)?t[e]=V.isPlainObject(t[e])?V.widget.extend({},t[e],i):V.widget.extend({},i):t[e]=i);return t},V.widget.bridge=function(o,e){var a=e.prototype.widgetFullName||o;V.fn[o]=function(i){var t="string"==typeof i,s=r.call(arguments,1),n=this;return t?this.length||"instance"!==i?this.each(function(){var t,e=V.data(this,a);return"instance"===i?(n=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?V.error("no such method '"+i+"' for "+o+" widget instance"):(t=e[i].apply(e,s))!==e&&void 0!==t?(n=t&&t.jquery?n.pushStack(t.get()):t,!1):void 0:V.error("cannot call methods on "+o+" prior to initialization; attempted to call method '"+i+"'")}):n=void 0:(s.length&&(i=V.widget.extend.apply(null,[i].concat(s))),this.each(function(){var t=V.data(this,a);t?(t.option(i||{}),t._init&&t._init()):V.data(this,a,new e(i,this))})),n}},V.Widget=function(){},V.Widget._childConstructors=[],V.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=V(e||this.defaultElement||this)[0],this.element=V(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=V(),this.hoverable=V(),this.focusable=V(),this.classesElementLookup={},e!==this&&(V.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=V(e.style?e.ownerDocument:e.document||e),this.window=V(this.document[0].defaultView||this.document[0].parentWindow)),this.options=V.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:V.noop,_create:V.noop,_init:V.noop,destroy:function(){var i=this;this._destroy(),V.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:V.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return V.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=V.widget.extend({},this.options[t]),n=0;n<i.length-1;n++)s[i[n]]=s[i[n]]||{},s=s[i[n]];if(t=i.pop(),1===arguments.length)return void 0===s[t]?null:s[t];s[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=e}return this._setOptions(o),this},_setOptions:function(t){for(var e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(t){var e,i,s;for(e in t)s=this.classesElementLookup[e],t[e]!==this.options.classes[e]&&s&&s.length&&(i=V(s.get()),this._removeClass(s,e),i.addClass(this._classes({element:i,keys:e,classes:t,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(n){var o=[],a=this;function t(t,e){for(var i,s=0;s<t.length;s++)i=a.classesElementLookup[t[s]]||V(),i=n.add?(function(){var i=[];n.element.each(function(t,e){V.map(a.classesElementLookup,function(t){return t}).some(function(t){return t.is(e)})||i.push(e)}),a._on(V(i),{remove:"_untrackClassesElement"})}(),V(V.uniqueSort(i.get().concat(n.element.get())))):V(i.not(n.element).get()),a.classesElementLookup[t[s]]=i,o.push(t[s]),e&&n.classes[t[s]]&&o.push(n.classes[t[s]])}return(n=V.extend({element:this.element,classes:this.options.classes||{}},n)).keys&&t(n.keys.match(/\S+/g)||[],!0),n.extra&&t(n.extra.match(/\S+/g)||[]),o.join(" ")},_untrackClassesElement:function(i){var s=this;V.each(s.classesElementLookup,function(t,e){-1!==V.inArray(i.target,e)&&(s.classesElementLookup[t]=V(e.not(i.target).get()))}),this._off(V(i.target))},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){var n="string"==typeof t||null===t,i={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s="boolean"==typeof s?s:i};return i.element.toggleClass(this._classes(i),s),this},_on:function(n,o,t){var a,r=this;"boolean"!=typeof n&&(t=o,o=n,n=!1),t?(o=a=V(o),this.bindings=this.bindings.add(o)):(t=o,o=this.element,a=this.widget()),V.each(t,function(t,e){function i(){if(n||!0!==r.options.disabled&&!V(this).hasClass("ui-state-disabled"))return("string"==typeof e?r[e]:e).apply(r,arguments)}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||V.guid++);var s=t.match(/^([\w:-]*)\s*(.*)$/),t=s[1]+r.eventNamespace,s=s[2];s?a.on(t,s,i):o.on(t,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(e),this.bindings=V(this.bindings.not(t).get()),this.focusable=V(this.focusable.not(t).get()),this.hoverable=V(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(V(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(V(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(V(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(V(t.currentTarget),null,"ui-state-focus")}})}
vendor: 15,402 bytes, line 12
12,_trigger:function(t,e,i){var s,n,o=this.options[t];if(i=i||{},(e=V.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],n=e.originalEvent)for(s in n)s in e||(e[s]=n[s]);return this.element.trigger(e,i),!("function"==typeof o&&!1===o.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},V.each({show:"fadeIn",hide:"fadeOut"},function(o,a){V.Widget.prototype["_"+o]=function(e,t,i){var s,n=(t="string"==typeof t?{effect:t}:t)?!0!==t&&"number"!=typeof t&&t.effect||a:o;"number"==typeof(t=t||{})?t={duration:t}:!0===t&&(t={}),s=!V.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),s&&V.effects&&V.effects.effect[n]?e[o](t):n!==o&&e[n]?e[n](t.duration,t.easing,i):e.queue(function(t){V(this)[o](),i&&i.call(e[0]),t()})}});var s,x,k,o,l,h,c,u,C;V.widget;function D(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function I(t,e){return parseInt(V.css(t,e),10)||0}function T(t){return null!=t&&t===t.window}x=Math.max,k=Math.abs,o=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,C=V.fn.position,V.position={scrollbarWidth:function(){if(void 0!==s)return s;var t,e=V("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>"),i=e.children()[0];return V("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?V.position.scrollbarWidth():0,height:e?V.position.scrollbarWidth():0}},getWithinInfo:function(t){var e=V(t||window),i=T(e[0]),s=!!e[0]&&9===e[0].nodeType;return{element:e,isWindow:i,isDocument:s,offset:!i&&!s?V(t).offset():{left:0,top:0},scrollLeft:e.scrollLeft(),scrollTop:e.scrollTop(),width:e.outerWidth(),height:e.outerHeight()}}},V.fn.position=function(u){if(!u||!u.of)return C.apply(this,arguments);var d,p,f,g,m,t,_="string"==typeof(u=V.extend({},u)).of?V(document).find(u.of):V(u.of),v=V.position.getWithinInfo(u.within),b=V.position.getScrollInfo(v),y=(u.collision||"flip").split(" "),w={},e=9===(t=(e=_)[0]).nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:T(t)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:t.preventDefault?{width:0,height:0,offset:{top:t.pageY,left:t.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()};return _[0].preventDefault&&(u.at="left top"),p=e.width,f=e.height,m=V.extend({},g=e.offset),V.each(["my","at"],function(){var t,e,i=(u[this]||"").split(" ");(i=1===i.length?o.test(i[0])?i.concat(["center"]):l.test(i[0])?["center"].concat(i):["center","center"]:i)[0]=o.test(i[0])?i[0]:"center",i[1]=l.test(i[1])?i[1]:"center",t=h.exec(i[0]),e=h.exec(i[1]),w[this]=[t?t[0]:0,e?e[0]:0],u[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===y.length&&(y[1]=y[0]),"right"===u.at[0]?m.left+=p:"center"===u.at[0]&&(m.left+=p/2),"bottom"===u.at[1]?m.top+=f:"center"===u.at[1]&&(m.top+=f/2),d=D(w.at,p,f),m.left+=d[0],m.top+=d[1],this.each(function(){var i,t,a=V(this),r=a.outerWidth(),l=a.outerHeight(),e=I(this,"marginLeft"),s=I(this,"marginTop"),n=r+e+I(this,"marginRight")+b.width,o=l+s+I(this,"marginBottom")+b.height,h=V.extend({},m),c=D(w.my,a.outerWidth(),a.outerHeight());"right"===u.my[0]?h.left-=r:"center"===u.my[0]&&(h.left-=r/2),"bottom"===u.my[1]?h.top-=l:"center"===u.my[1]&&(h.top-=l/2),h.left+=c[0],h.top+=c[1],i={marginLeft:e,marginTop:s},V.each(["left","top"],function(t,e){V.ui.position[y[t]]&&V.ui.position[y[t]][e](h,{targetWidth:p,targetHeight:f,elemWidth:r,elemHeight:l,collisionPosition:i,collisionWidth:n,collisionHeight:o,offset:[d[0]+c[0],d[1]+c[1]],my:u.my,at:u.at,within:v,elem:a})}),u.using&&(t=function(t){var e=g.left-h.left,i=e+p-r,s=g.top-h.top,n=s+f-l,o={target:{element:_,left:g.left,top:g.top,width:p,height:f},element:{element:a,left:h.left,top:h.top,width:r,height:l},horizontal:i<0?"left":0<e?"right":"center",vertical:n<0?"top":0<s?"bottom":"middle"};p<r&&k(e+i)<p&&(o.horizontal="center"),f<l&&k(s+n)<f&&(o.vertical="middle"),x(k(e),k(i))>x(k(s),k(n))?o.important="horizontal":o.important="vertical",u.using.call(this,t,o)}),a.offset(V.extend(h,{using:t}))})},V.ui.position={fit:{left:function(t,e){var i=e.within,s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,a=s-o,r=o+e.collisionWidth-n-s;e.collisionWidth>n?0<a&&r<=0?(i=t.left+a+e.collisionWidth-n-s,t.left+=a-i):t.left=!(0<r&&a<=0)&&r<a?s+n-e.collisionWidth:s:0<a?t.left+=a:0<r?t.left-=r:t.left=x(t.left-o,t.left)},top:function(t,e){var i=e.within,s=i.isWindow?i.scrollTop:i.offset.top,n=e.within.height,o=t.top-e.collisionPosition.marginTop,a=s-o,r=o+e.collisionHeight-n-s;e.collisionHeight>n?0<a&&r<=0?(i=t.top+a+e.collisionHeight-n-s,t.top+=a-i):t.top=!(0<r&&a<=0)&&r<a?s+n-e.collisionHeight:s:0<a?t.top+=a:0<r?t.top-=r:t.top=x(t.top-o,t.top)}},flip:{left:function(t,e){var i=e.within,s=i.offset.left+i.scrollLeft,n=i.width,o=i.isWindow?i.scrollLeft:i.offset.left,a=t.left-e.collisionPosition.marginLeft,r=a-o,l=a+e.collisionWidth-n-o,h="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,i="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,a=-2*e.offset[0];r<0?((s=t.left+h+i+a+e.collisionWidth-n-s)<0||s<k(r))&&(t.left+=h+i+a):0<l&&(0<(o=t.left-e.collisionPosition.marginLeft+h+i+a-o)||k(o)<l)&&(t.left+=h+i+a)},top:function(t,e){var i=e.within,s=i.offset.top+i.scrollTop,n=i.height,o=i.isWindow?i.scrollTop:i.offset.top,a=t.top-e.collisionPosition.marginTop,r=a-o,l=a+e.collisionHeight-n-o,h="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,i="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,a=-2*e.offset[1];r<0?((s=t.top+h+i+a+e.collisionHeight-n-s)<0||s<k(r))&&(t.top+=h+i+a):0<l&&(0<(o=t.top-e.collisionPosition.marginTop+h+i+a-o)||k(o)<l)&&(t.top+=h+i+a)}},flipfit:{left:function(){V.ui.position.flip.left.apply(this,arguments),V.ui.position.fit.left.apply(this,arguments)},top:function(){V.ui.position.flip.top.apply(this,arguments),V.ui.position.fit.top.apply(this,arguments)}}};V.ui.position,V.extend(V.expr.pseudos,{data:V.expr.createPseudo?V.expr.createPseudo(function(e){return function(t){return!!V.data(t,e)}}):function(t,e,i){return!!V.data(t,i[3])}}),V.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}});var t,d=V,p={},e=p.toString,f=/^([\-+])=\s*(\d+\.?\d*)/,g=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),t[4]?(parseInt(t[4],16)/255).toFixed(2):1]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),t[4]?(parseInt(t[4]+t[4],16)/255).toFixed(2):1]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],m=d.Color=function(t,e,i,s){return new d.Color.fn.parse(t,e,i,s)},_={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"}}}},v={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},b=m.support={},y=d("<p>")[0],w=d.each;function P(t){return null==t?t+"":"object"==typeof t?p[e.call(t)]||"object":typeof t}function M(t,e,i){var s=v[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:Math.min(s.max,Math.max(0,t)))}function S(s){var n=m(),o=n._rgba=[];return s=s.toLowerCase(),w(g,function(t,e){var i=e.re.exec(s),i=i&&e.parse(i),e=e.space||"rgba";if(i)return i=n[e](i),n[_[e].cache]=i[_[e].cache],o=n._rgba=i._rgba,!1}),o.length?("0,0,0,0"===o.join()&&d.extend(o,B.transparent),n):B[s]}function H(t,e,i){return 6*(i=(i+1)%1)<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}y.style.cssText="background-color:rgba(1,1,1,.5)",b.rgba=-1<y.style.backgroundColor.indexOf("rgba"),w(_,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),d.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){p["[object "+e+"]"]=e.toLowerCase()}),(m.fn=d.extend(m.prototype,{parse:function(n,t,e,i){if(void 0===n)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=d(n).css(t),t=void 0);var o=this,s=P(n),a=this._rgba=[];return void 0!==t&&(n=[n,t,e,i],s="array"),"string"===s?this.parse(S(n)||B._default):"array"===s?(w(_.rgba.props,function(t,e){a[e.idx]=M(n[e.idx],e)}),this):"object"===s?(w(_,n instanceof m?function(t,e){n[e.cache]&&(o[e.cache]=n[e.cache].slice())}:function(t,i){var s=i.cache;w(i.props,function(t,e){if(!o[s]&&i.to){if("alpha"===t||null==n[t])return;o[s]=i.to(o._rgba)}o[s][e.idx]=M(n[t],e,!0)}),o[s]&&d.inArray(null,o[s].slice(0,3))<0&&(null==o[s][3]&&(o[s][3]=1),i.from&&(o._rgba=i.from(o[s])))}),this):void 0},is:function(t){var n=m(t),o=!0,a=this;return w(_,function(t,e){var i,s=n[e.cache];return s&&(i=a[e.cache]||e.to&&e.to(a._rgba)||[],w(e.props,function(t,e){if(null!=s[e.idx])return o=s[e.idx]===i[e.idx]})),o}),o},_space:function(){var i=[],s=this;return w(_,function(t,e){s[e.cache]&&i.push(t)}),i.pop()},transition:function(t,a){var e=(h=m(t))._space(),i=_[e],t=0===this.alpha()?m("transparent"):this,r=t[i.cache]||i.to(t._rgba),l=r.slice(),h=h[i.cache];return w(i.props,function(t,e){var i=e.idx,s=r[i],n=h[i],o=v[e.type]||{};null!==n&&(null===s?l[i]=n:(o.mod&&(n-s>o.mod/2?s+=o.mod:s-n>o.mod/2&&(s-=o.mod)),l[i]=M((n-s)*a+s,e)))}),this[e](l)},blend:function(t){if(1===this._rgba[3])return this;var e=this._rgba.slice(),i=e.pop(),s=m(t)._rgba;return m(d.map(e,function(t,e){return(1-i)*s[e]+i*t}))},toRgbaString:function(){var t="rgba(",e=d.map(this._rgba,function(t,e){return null!=t?t:2<e?1:0});return 1===e[3]&&(e.pop(),t="rgb("),t+e.join()+")"},toHslaString:function(){var t="hsla(",e=d.map(this.hsla(),function(t,e){return null==t&&(t=2<e?1:0),t=e&&e<3?Math.round(100*t)+"%":t});return 1===e[3]&&(e.pop(),t="hsl("),t+e.join()+")"},toHexString:function(t){var e=this._rgba.slice(),i=e.pop();return t&&e.push(~~(255*i)),"#"+d.map(e,function(t){return 1===(t=(t||0).toString(16)).length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}})).parse.prototype=m.fn,_.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/255,i=t[1]/255,s=t[2]/255,n=t[3],o=Math.max(e,i,s),a=Math.min(e,i,s),r=o-a,l=o+a,t=.5*l,i=a===o?0:e===o?60*(i-s)/r+360:i===o?60*(s-e)/r+120:60*(e-i)/r+240,l=0==r?0:t<=.5?r/l:r/(2-l);return[Math.round(i)%360,l,t,null==n?1:n]},_.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],t=t[3],i=s<=.5?s*(1+i):s+i-s*i,s=2*s-i;return[Math.round(255*H(s,i,e+1/3)),Math.round(255*H(s,i,e)),Math.round(255*H(s,i,e-1/3)),t]},w(_,function(l,t){var e=t.props,o=t.cache,a=t.to,r=t.from;m.fn[l]=function(t){if(a&&!this[o]&&(this[o]=a(this._rgba)),void 0===t)return this[o].slice();var i=P(t),s="array"===i||"object"===i?t:arguments,n=this[o].slice();return w(e,function(t,e){t=s["object"===i?t:e.idx];null==t&&(t=n[e.idx]),n[e.idx]=M(t,e)}),r?((t=m(r(n)))[o]=n,t):m(n)},w(e,function(a,r){m.fn[a]||(m.fn[a]=function(t){var e,i=P(t),s="alpha"===a?this._hsla?"hsla":"rgba":l,n=this[s](),o=n[r.idx];return"undefined"===i?o:("function"===i&&(i=P(t=t.call(this,o))),null==t&&r.empty?this:("string"===i&&(e=f.exec(t))&&(t=o+parseFloat(e[2])*("+"===e[1]?1:-1)),n[r.idx]=t,this[s](n)))})})}),(m.hook=function(t){t=t.split(" ");w(t,function(t,o){d.cssHooks[o]={set:function(t,e){var i,s,n="";if("transparent"!==e&&("string"!==P(e)||(i=S(e)))){if(e=m(i||e),!b.rgba&&1!==e._rgba[3]){for(s="backgroundColor"===o?t.parentNode:t;(""===n||"transparent"===n)&&s&&s.style;)try{n=d.css(s,"backgroundColor"),s=s.parentNode}catch(t){}e=e.blend(n&&"transparent"!==n?n:"_default")}e=e.toRgbaString()}try{t.style[o]=e}catch(t){}}},d.fx.step[o]=function(t){t.colorInit||(t.start=m(t.elem,o),t.end=m(t.end),t.colorInit=!0),d.cssHooks[o].set(t.elem,t.start.transition(t.end,t.pos))}})})("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),d.cssHooks.borderColor={expand:function(i){var s={};return w(["Top","Right","Bottom","Left"],function(t,e){s["border"+e+"Color"]=i}),s}};var z,A,O,N,E,W,F,L,R,Y,B=d.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"},j="ui-effects-",q="ui-effects-style",K="ui-effects-animated";function U(t){var e,i,s=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,n={};if(s&&s.length&&s[0]&&s[s[0]])for(i=s.length;i--;)"string"==typeof s[e=s[i]]&&(n[e.replace(/-([\da-z])/gi,function(t,e){return e.toUpperCase()})]=s[e]);else for(e in s)"string"==typeof s[e]&&(n[e]=s[e]);return n}function X(t,e,i,s){return t={effect:t=V.isPlainObject(t)?(e=t).effect:t},"function"==typeof(e=null==e?{}:e)&&(s=e,i=null,e={}),"number"!=typeof e&&!V.fx.speeds[e]||(s=i,i=e,e={}),"function"==typeof i&&(s=i,i=null),e&&V.extend(t,e),i=i||e.duration,t.duration=V.fx.off?0:"number"==typeof i?i:i in V.fx.speeds?V.fx.speeds[i]:V.fx.speeds._default,t.complete=s||e.complete,t}function $(t){return!t||"number"==typeof t||V.fx.speeds[t]||("string"==typeof t&&!V.effects.effect[t]||("function"==typeof t||"object"==typeof t&&!t.effect))}function G(t,e){var i=e.outerWidth(),e=e.outerHeight(),t=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/.exec(t)||["",0,i,e,0];return{top:parseFloat(t[1])||0,right:"auto"===t[2]?i:parseFloat(t[2]),bottom:"auto"===t[3]?e:parseFloat(t[3]),left:parseFloat(t[4])||0}}V.effects={effect:{}},N=["add","remove","toggle"],E={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1},V.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,e){V.fx.step[e]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(d.style(t.elem,e,t.end),t.setAttr=!0)}}),V.fn.addBack||(V.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}
vendor: 27,112 bytes, line 12
12),V.effects.animateClass=function(n,t,e,i){var o=V.speed(t,e,i);return this.queue(function(){var i=V(this),t=i.attr("class")||"",e=(e=o.children?i.find("*").addBack():i).map(function(){return{el:V(this),start:U(this)}}),s=function(){V.each(N,function(t,e){n[e]&&i[e+"Class"](n[e])})};s(),e=e.map(function(){return this.end=U(this.el[0]),this.diff=function(t,e){var i,s,n={};for(i in e)s=e[i],t[i]!==s&&(E[i]||!V.fx.step[i]&&isNaN(parseFloat(s))||(n[i]=s));return n}(this.start,this.end),this}),i.attr("class",t),e=e.map(function(){var t=this,e=V.Deferred(),i=V.extend({},o,{queue:!1,complete:function(){e.resolve(t)}});return this.el.animate(this.diff,i),e.promise()}),V.when.apply(V,e.get()).done(function(){s(),V.each(arguments,function(){var e=this.el;V.each(this.diff,function(t){e.css(t,"")})}),o.complete.call(i[0])})})},V.fn.extend({addClass:(O=V.fn.addClass,function(t,e,i,s){return e?V.effects.animateClass.call(this,{add:t},e,i,s):O.apply(this,arguments)}),removeClass:(A=V.fn.removeClass,function(t,e,i,s){return 1<arguments.length?V.effects.animateClass.call(this,{remove:t},e,i,s):A.apply(this,arguments)}),toggleClass:(z=V.fn.toggleClass,function(t,e,i,s,n){return"boolean"==typeof e||void 0===e?i?V.effects.animateClass.call(this,e?{add:t}:{remove:t},i,s,n):z.apply(this,arguments):V.effects.animateClass.call(this,{toggle:t},e,i,s)}),switchClass:function(t,e,i,s,n){return V.effects.animateClass.call(this,{add:e,remove:t},i,s,n)}}),V.expr&&V.expr.pseudos&&V.expr.pseudos.animated&&(V.expr.pseudos.animated=(W=V.expr.pseudos.animated,function(t){return!!V(t).data(K)||W(t)})),!1!==V.uiBackCompat&&V.extend(V.effects,{save:function(t,e){for(var i=0,s=e.length;i<s;i++)null!==e[i]&&t.data(j+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;s<n;s++)null!==e[s]&&(i=t.data(j+e[s]),t.css(e[s],i))},setMode:function(t,e){return e="toggle"===e?t.is(":hidden")?"show":"hide":e},createWrapper:function(i){if(i.parent().is(".ui-effects-wrapper"))return i.parent();var s={width:i.outerWidth(!0),height:i.outerHeight(!0),float:i.css("float")},t=V("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:i.width(),height:i.height()},n=document.activeElement;try{n.id}catch(t){n=document.body}return i.wrap(t),i[0]!==n&&!V.contains(i[0],n)||V(n).trigger("focus"),t=i.parent(),"static"===i.css("position")?(t.css({position:"relative"}),i.css({position:"relative"})):(V.extend(s,{position:i.css("position"),zIndex:i.css("z-index")}),V.each(["top","left","bottom","right"],function(t,e){s[e]=i.css(e),isNaN(parseInt(s[e],10))&&(s[e]="auto")}),i.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),i.css(e),t.css(s).show()},removeWrapper:function(t){var e=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),t[0]!==e&&!V.contains(t[0],e)||V(e).trigger("focus")),t}}),V.extend(V.effects,{version:"1.13.2",define:function(t,e,i){return i||(i=e,e="effect"),V.effects.effect[t]=i,V.effects.effect[t].mode=e,i},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,e="vertical"!==i?(e||100)/100:1;return{height:t.height()*e,width:t.width()*s,outerHeight:t.outerHeight()*e,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();1<e&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(q,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(q)||"",t.removeData(q)},mode:function(t,e){t=t.is(":hidden");return"toggle"===e&&(e=t?"show":"hide"),e=(t?"hide"===e:"show"===e)?"none":e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(t){var e,i=t.css("position"),s=t.position();return t.css({marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()),/^(static|relative)/.test(i)&&(i="absolute",e=V("<"+t[0].nodeName+">").insertAfter(t).css({display:/^(inline|ruby)/.test(t.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight"),float:t.css("float")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).addClass("ui-effects-placeholder"),t.data(j+"placeholder",e)),t.css({position:i,left:s.left,top:s.top}),e},removePlaceholder:function(t){var e=j+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(t){V.effects.restoreStyle(t),V.effects.removePlaceholder(t)},setTransition:function(s,t,n,o){return o=o||{},V.each(t,function(t,e){var i=s.cssUnit(e);0<i[0]&&(o[e]=i[0]*n+i[1])}),o}}),V.fn.extend({effect:function(){function t(t){var e=V(this),i=V.effects.mode(e,r)||o;e.data(K,!0),l.push(i),o&&("show"===i||i===o&&"hide"===i)&&e.show(),o&&"none"===i||V.effects.saveStyle(e),"function"==typeof t&&t()}var s=X.apply(this,arguments),n=V.effects.effect[s.effect],o=n.mode,e=s.queue,i=e||"fx",a=s.complete,r=s.mode,l=[];return V.fx.off||!n?r?this[r](s.duration,a):this.each(function(){a&&a.call(this)}):!1===e?this.each(t).each(h):this.queue(i,t).queue(i,h);function h(t){var e=V(this);function i(){"function"==typeof a&&a.call(e[0]),"function"==typeof t&&t()}s.mode=l.shift(),!1===V.uiBackCompat||o?"none"===s.mode?(e[r](),i()):n.call(e[0],s,function(){e.removeData(K),V.effects.cleanUp(e),"hide"===s.mode&&e.hide(),i()}):(e.is(":hidden")?"hide"===r:"show"===r)?(e[r](),i()):n.call(e[0],s,i)}},show:(R=V.fn.show,function(t){if($(t))return R.apply(this,arguments);t=X.apply(this,arguments);return t.mode="show",this.effect.call(this,t)}),hide:(L=V.fn.hide,function(t){if($(t))return L.apply(this,arguments);t=X.apply(this,arguments);return t.mode="hide",this.effect.call(this,t)}),toggle:(F=V.fn.toggle,function(t){if($(t)||"boolean"==typeof t)return F.apply(this,arguments);t=X.apply(this,arguments);return t.mode="toggle",this.effect.call(this,t)}),cssUnit:function(t){var i=this.css(t),s=[];return V.each(["em","px","%","pt"],function(t,e){0<i.indexOf(e)&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):G(this.css("clip"),this)},transfer:function(t,e){var i=V(this),s=V(t.to),n="fixed"===s.css("position"),o=V("body"),a=n?o.scrollTop():0,r=n?o.scrollLeft():0,o=s.offset(),o={top:o.top-a,left:o.left-r,height:s.innerHeight(),width:s.innerWidth()},s=i.offset(),l=V("<div class='ui-effects-transfer'></div>");l.appendTo("body").addClass(t.className).css({top:s.top-a,left:s.left-r,height:i.innerHeight(),width:i.innerWidth(),position:n?"fixed":"absolute"}).animate(o,t.duration,t.easing,function(){l.remove(),"function"==typeof e&&e()})}}),V.fx.step.clip=function(t){t.clipInit||(t.start=V(t.elem).cssClip(),"string"==typeof t.end&&(t.end=G(t.end,t.elem)),t.clipInit=!0),V(t.elem).cssClip({top:t.pos*(t.end.top-t.start.top)+t.start.top,right:t.pos*(t.end.right-t.start.right)+t.start.right,bottom:t.pos*(t.end.bottom-t.start.bottom)+t.start.bottom,left:t.pos*(t.end.left-t.start.left)+t.start.left})},Y={},V.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,t){Y[t]=function(t){return Math.pow(t,e+2)}}),V.extend(Y,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),V.each(Y,function(t,e){V.easing["easeIn"+t]=e,V.easing["easeOut"+t]=function(t){return 1-e(1-t)},V.easing["easeInOut"+t]=function(t){return t<.5?e(2*t)/2:1-e(-2*t+2)/2}});y=V.effects,V.effects.define("blind","hide",function(t,e){var i={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},s=V(this),n=t.direction||"up",o=s.cssClip(),a={clip:V.extend({},o)},r=V.effects.createPlaceholder(s);a.clip[i[n][0]]=a.clip[i[n][1]],"show"===t.mode&&(s.cssClip(a.clip),r&&r.css(V.effects.clipToBox(a)),a.clip=o),r&&r.animate(V.effects.clipToBox(a),t.duration,t.easing),s.animate(a,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("bounce",function(t,e){var i,s,n=V(this),o=t.mode,a="hide"===o,r="show"===o,l=t.direction||"up",h=t.distance,c=t.times||5,o=2*c+(r||a?1:0),u=t.duration/o,d=t.easing,p="up"===l||"down"===l?"top":"left",f="up"===l||"left"===l,g=0,t=n.queue().length;for(V.effects.createPlaceholder(n),l=n.css(p),h=h||n["top"==p?"outerHeight":"outerWidth"]()/3,r&&((s={opacity:1})[p]=l,n.css("opacity",0).css(p,f?2*-h:2*h).animate(s,u,d)),a&&(h/=Math.pow(2,c-1)),(s={})[p]=l;g<c;g++)(i={})[p]=(f?"-=":"+=")+h,n.animate(i,u,d).animate(s,u,d),h=a?2*h:h/2;a&&((i={opacity:0})[p]=(f?"-=":"+=")+h,n.animate(i,u,d)),n.queue(e),V.effects.unshift(n,t,1+o)}),V.effects.define("clip","hide",function(t,e){var i={},s=V(this),n=t.direction||"vertical",o="both"===n,a=o||"horizontal"===n,o=o||"vertical"===n,n=s.cssClip();i.clip={top:o?(n.bottom-n.top)/2:n.top,right:a?(n.right-n.left)/2:n.right,bottom:o?(n.bottom-n.top)/2:n.bottom,left:a?(n.right-n.left)/2:n.left},V.effects.createPlaceholder(s),"show"===t.mode&&(s.cssClip(i.clip),i.clip=n),s.animate(i,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("drop","hide",function(t,e){var i=V(this),s="show"===t.mode,n=t.direction||"left",o="up"===n||"down"===n?"top":"left",a="up"===n||"left"===n?"-=":"+=",r="+="==a?"-=":"+=",l={opacity:0};V.effects.createPlaceholder(i),n=t.distance||i["top"==o?"outerHeight":"outerWidth"](!0)/2,l[o]=a+n,s&&(i.css(l),l[o]=r+n,l.opacity=1),i.animate(l,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("explode","hide",function(t,e){var i,s,n,o,a,r,l=t.pieces?Math.round(Math.sqrt(t.pieces)):3,h=l,c=V(this),u="show"===t.mode,d=c.show().css("visibility","hidden").offset(),p=Math.ceil(c.outerWidth()/h),f=Math.ceil(c.outerHeight()/l),g=[];function m(){g.push(this),g.length===l*h&&(c.css({visibility:"visible"}),V(g).remove(),e())}for(i=0;i<l;i++)for(o=d.top+i*f,r=i-(l-1)/2,s=0;s<h;s++)n=d.left+s*p,a=s-(h-1)/2,c.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-s*p,top:-i*f}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:p,height:f,left:n+(u?a*p:0),top:o+(u?r*f:0),opacity:u?0:1}).animate({left:n+(u?0:a*p),top:o+(u?0:r*f),opacity:u?1:0},t.duration||500,t.easing,m)}),V.effects.define("fade","toggle",function(t,e){var i="show"===t.mode;V(this).css("opacity",i?0:1).animate({opacity:i?1:0},{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("fold","hide",function(e,t){var i=V(this),s=e.mode,n="show"===s,o="hide"===s,a=e.size||15,r=/([0-9]+)%/.exec(a),l=!!e.horizFirst?["right","bottom"]:["bottom","right"],h=e.duration/2,c=V.effects.createPlaceholder(i),u=i.cssClip(),d={clip:V.extend({},u)},p={clip:V.extend({},u)},f=[u[l[0]],u[l[1]]],s=i.queue().length;r&&(a=parseInt(r[1],10)/100*f[o?0:1]),d.clip[l[0]]=a,p.clip[l[0]]=a,p.clip[l[1]]=0,n&&(i.cssClip(p.clip),c&&c.css(V.effects.clipToBox(p)),p.clip=u),i.queue(function(t){c&&c.animate(V.effects.clipToBox(d),h,e.easing).animate(V.effects.clipToBox(p),h,e.easing),t()}).animate(d,h,e.easing).animate(p,h,e.easing).queue(t),V.effects.unshift(i,s,4)}),V.effects.define("highlight","show",function(t,e){var i=V(this),s={backgroundColor:i.css("backgroundColor")};"hide"===t.mode&&(s.opacity=0),V.effects.saveStyle(i),i.css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(s,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("size",function(s,e){var n,i=V(this),t=["fontSize"],o=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],a=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],r=s.mode,l="effect"!==r,h=s.scale||"both",c=s.origin||["middle","center"],u=i.css("position"),d=i.position(),p=V.effects.scaledDimensions(i),f=s.from||p,g=s.to||V.effects.scaledDimensions(i,0);V.effects.createPlaceholder(i),"show"===r&&(r=f,f=g,g=r),n={from:{y:f.height/p.height,x:f.width/p.width},to:{y:g.height/p.height,x:g.width/p.width}},"box"!==h&&"both"!==h||(n.from.y!==n.to.y&&(f=V.effects.setTransition(i,o,n.from.y,f),g=V.effects.setTransition(i,o,n.to.y,g)),n.from.x!==n.to.x&&(f=V.effects.setTransition(i,a,n.from.x,f),g=V.effects.setTransition(i,a,n.to.x,g))),"content"!==h&&"both"!==h||n.from.y!==n.to.y&&(f=V.effects.setTransition(i,t,n.from.y,f),g=V.effects.setTransition(i,t,n.to.y,g)),c&&(c=V.effects.getBaseline(c,p),f.top=(p.outerHeight-f.outerHeight)*c.y+d.top,f.left=(p.outerWidth-f.outerWidth)*c.x+d.left,g.top=(p.outerHeight-g.outerHeight)*c.y+d.top,g.left=(p.outerWidth-g.outerWidth)*c.x+d.left),delete f.outerHeight,delete f.outerWidth,i.css(f),"content"!==h&&"both"!==h||(o=o.concat(["marginTop","marginBottom"]).concat(t),a=a.concat(["marginLeft","marginRight"]),i.find("*[width]").each(function(){var t=V(this),e=V.effects.scaledDimensions(t),i={height:e.height*n.from.y,width:e.width*n.from.x,outerHeight:e.outerHeight*n.from.y,outerWidth:e.outerWidth*n.from.x},e={height:e.height*n.to.y,width:e.width*n.to.x,outerHeight:e.height*n.to.y,outerWidth:e.width*n.to.x};n.from.y!==n.to.y&&(i=V.effects.setTransition(t,o,n.from.y,i),e=V.effects.setTransition(t,o,n.to.y,e)),n.from.x!==n.to.x&&(i=V.effects.setTransition(t,a,n.from.x,i),e=V.effects.setTransition(t,a,n.to.x,e)),l&&V.effects.saveStyle(t),t.css(i),t.animate(e,s.duration,s.easing,function(){l&&V.effects.restoreStyle(t)})})),i.animate(g,{queue:!1,duration:s.duration,easing:s.easing,complete:function(){var t=i.offset();0===g.opacity&&i.css("opacity",f.opacity),l||(i.css("position","static"===u?"relative":u).offset(t),V.effects.saveStyle(i)),e()}})}),V.effects.define("scale",function(t,e){var i=V(this),s=t.mode,s=parseInt(t.percent,10)||(0===parseInt(t.percent,10)||"effect"!==s?0:100),s=V.extend(!0,{from:V.effects.scaledDimensions(i),to:V.effects.scaledDimensions(i,s,t.direction||"both"),origin:t.origin||["middle","center"]},t);t.fade&&(s.from.opacity=1,s.to.opacity=0),V.effects.effect.size.call(this,s,e)}),V.effects.define("puff","hide",function(t,e){t=V.extend(!0,{},t,{fade:!0,percent:parseInt(t.percent,10)||150});V.effects.effect.scale.call(this,t,e)}),V.effects.define("pulsate","show",function(t,e){var i=V(this),s=t.mode,n="show"===s,o=2*(t.times||5)+(n||"hide"===s?1:0),a=t.duration/o,r=0,l=1,s=i.queue().length;for(!n&&i.is(":visible")||(i.css("opacity",0).show(),r=1);l<o;l++)i.animate({opacity:r},a,t.easing),r=1-r;i.animate({opacity:r},a,t.easing),i.queue(e),V.effects.unshift(i,s,1+o)}),V.effects.define("shake",function(t,e){var i=1,s=V(this),n=t.direction||"left",o=t.distance||20,a=t.times||3,r=2*a+1,l=Math.round(t.duration/r),h="up"===n||"down"===n?"top":"left",c="up"===n||"left"===n,u={},d={},p={},n=s.queue().length;for(V.effects.createPlaceholder(s),u[h]=(c?"-=":"+=")+o,d[h]=(c?"+=":"-=")+2*o,p[h]=(c?"-=":"+=")+2*o,s.animate(u,l,t.easing);i<a;i++)s.animate(d,l,t.easing).animate(p,l,t.easing);s.animate(d,l,t.easing).animate(u,l/2,t.easing).queue(e),V.effects.unshift(s,n,1+r)}),V.effects.define("slide","show",function(t,e){var i,s,n=V(this),o={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},a=t.mode,r=t.direction||"left",l="up"===r||"down"===r?"top":"left",h="up"===r||"left"===r,c=t.distance||n["top"==l?"outerHeight":"outerWidth"](!0),u={};V.effects.createPlaceholder(n),i=n.cssClip(),s=n.position()[l],u[l]=(h?-1:1)*c+s,u.clip=n.cssClip(),u.clip[o[r][1]]=u.clip[o[r][0]],"show"===a&&(n.cssClip(u.clip),n.css(l,u[l]),u.clip=i,u[l]=s),n.animate(u,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),y=!1!==V.uiBackCompat?V.effects.define("transfer",function(t,e){V(this).transfer(t,e)}):y;V.ui.focusable=function(t,e){var i,s,n,o,a=t.nodeName.toLowerCase();return"area"===a?(s=(i=t.parentNode).name,!(!t.href||!s||"map"!==i.nodeName.toLowerCase())&&(0<(s=V("img[usemap='#"+s+"']")).length&&s.is(":visible"))):(/^(input|select|textarea|button|object)$/.test(a)?(n=!t.disabled)&&(o=V(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===a&&t.href||e,n&&V(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"visible"===e}(V(t)))},V.extend(V.expr.pseudos,{focusable:function(t){return V.ui.focusable(t,null!=V.attr(t,"tabindex"))}});var Q,J;V.ui.focusable,V.fn._form=function(){return"string"==typeof this[0].form?this.closest("form"):V(this[0].form)},V.ui.formResetMixin={_formResetHandler:function(){var e=V(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");V.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element._form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(V.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}};V.expr.pseudos||(V.expr.pseudos=V.expr[":"]),V.uniqueSort||(V.uniqueSort=V.unique),V.escapeSelector||(Q=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,J=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},V.escapeSelector=function(t){return(t+"").replace(Q,J)}),V.fn.even&&V.fn.odd||V.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}});var Z;V.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},V.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+V.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},V.fn.scrollParent=function(t){var e=this.css("position"),i="absolute"===e,s=t?/(auto|scroll|hidden)/:/(auto|scroll)/,t=this.parents().filter(function(){var t=V(this);return(!i||"static"!==t.css("position"))&&s.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&t.length?t:V(this[0].ownerDocument||document)},V.extend(V.expr.pseudos,{tabbable:function(t){var e=V.attr(t,"tabindex"),i=null!=e;return(!i||0<=e)&&V.ui.focusable(t,i)}}),V.fn.extend({uniqueId:(Z=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++Z)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&V(this).removeAttr("id")})}}),V.widget("ui.accordion",{version:"1.13.2",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:function(t){return t.find("> li > :first-child").add(t.find("> :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=V(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),t.collapsible||!1!==t.active&&null!=t.active||(t.active=0),this._processPanels(),t.active<0&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():V()}},_createIcons:function(){var t,e=this.options.icons;e&&(t=V("<span>"),this._addClass(t,"ui-accordion-header-icon","ui-icon "+e.header),t.prependTo(this.headers),t=this.active.children(".ui-accordion-header-icon"),this._removeClass(t,e.header)._addClass(t,null,e.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){"active"!==t?("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||!1!==this.options.active||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons())):this._activate(e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var e=V.ui.keyCode,i=this.headers.length,s=this.headers.index(t.target),n=!1;switch(t.keyCode){case e.RIGHT:case e.DOWN:n=this.headers[(s+1)%i];break;case e.LEFT:case e.UP:n=this.headers[(s-1+i)%i];break;case e.SPACE:case e.ENTER:this._eventHandler(t);break;case e.HOME:n=this.headers[0];break;case e.END:n=this.headers[i-1]}n&&(V(t.target).attr("tabIndex",-1),V(n).attr("tabIndex",0),V(n).trigger("focus"),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===V.ui.keyCode.UP&&t.ctrlKey&&V(t.currentTarget).prev().trigger("focus")},refresh:function(){var t=this.options;this._processPanels(),!1===t.active&&!0===t.collapsible||!this.headers.length?(t.active=!1,this.active=V()):!1===t.active?this._activate(0):this.active.length&&!V.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=V()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;"function"==typeof this.options.header?this.headers=this.options.header(this.element):this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var i,t=this.options,e=t.heightStyle,s=this.element.parent();this.active=this._findActive(t.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var t=V(this),e=t.uniqueId().attr("id"),i=t.next(),s=i.uniqueId().attr("id");t.attr("aria-controls",s),i.attr("aria-labelledby",e)}).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(t.event),"fill"===e?(i=s.height(),this.element.siblings(":visible").each(function(){var t=V(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=V(this).outerHeight(!0)}),this.headers.next().each(function(){V(this).height(Math.max(0,i-V(this).innerHeight()+V(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.headers.next().each(function(){var t=V(this).is(":visible");t||V(this).show(),i=Math.max(i,V(this).css("height","").height()),t||V(this).hide()}).height(i))},_activate:function(t){t=this._findActive(t)[0];t!==this.active[0]&&(t=t||this.active[0],this._eventHandler({target:t,currentTarget:t,preventDefault:V.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):V()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&V.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var e=this.options,i=this.active,s=V(t.currentTarget),n=s[0]===i[0],o=n&&e.collapsible,a=o?V():s.next(),r=i.next(),a={oldHeader:i,oldPanel:r,newHeader:o?V():s,newPanel:a};t.preventDefault(),n&&!e.collapsible||!1===this._trigger("beforeActivate",t,a)||(e.active=!o&&this.headers.index(s),this.active=n?V():s,this._toggle(a),this._removeClass(i,"ui-accordion-header-active","ui-state-active"),e.icons&&(i=i.children(".ui-accordion-header-icon"),this._removeClass(i,null,e.icons.activeHeader)._addClass(i,null,e.icons.header)),n||(this._removeClass(s,"ui-accordion-header-collapsed")._addClass(s,"ui-accordion-header-active","ui-state-active"),e.icons&&(n=s.children(".ui-accordion-header-icon"),this._removeClass(n,null,e.icons.header)._addClass(n,null,e.icons.activeHeader)),this._addClass(s.next(),"ui-accordion-content-active")))},_toggle:function(t){var e=t.newPanel,i=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=e,this.prevHide=i,this.options.animate?this._animate(e,i,t):(i.hide(),e.show(),this._toggleComplete(t)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),e.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):e.length&&this.headers.filter(function(){return 0===parseInt(V(this).attr("tabIndex"),10)}).attr("tabIndex",-1),e.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,i,e){var s,n,o,a=this,r=0,l=t.css("box-sizing"),h=t.length&&(!i.length||t.index()<i.index()),c=this.options.animate||{},u=h&&c.down||c,h=function(){a._toggleComplete(e)};
vendor: 8,223 bytes, line 12
12return n=(n="string"==typeof u?u:n)||u.easing||c.easing,o=(o="number"==typeof u?u:o)||u.duration||c.duration,i.length?t.length?(s=t.show().outerHeight(),i.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),void t.hide().animate(this.showProps,{duration:o,easing:n,complete:h,step:function(t,e){e.now=Math.round(t),"height"!==e.prop?"content-box"===l&&(r+=e.now):"content"!==a.options.heightStyle&&(e.now=Math.round(s-i.outerHeight()-r),r=0)}})):i.animate(this.hideProps,o,n,h):t.animate(this.showProps,o,n,h)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),V.ui.safeActiveElement=function(e){var i;try{i=e.activeElement}catch(t){i=e.body}return i=!(i=i||e.body).nodeName?e.body:i},V.widget("ui.menu",{version:"1.13.2",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault(),this._activateItem(t)},"click .ui-menu-item":function(t){var e=V(t.target),i=V(V.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&i.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":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this._menuItems().first();e||this.focus(t,i)},blur:function(t){this._delay(function(){V.contains(this.element[0],V.ui.safeActiveElement(this.document[0]))||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t,!0),this.mouseHandled=!1}})},_activateItem:function(t){var e,i;this.previousFilter||t.clientX===this.lastMousePosition.x&&t.clientY===this.lastMousePosition.y||(this.lastMousePosition={x:t.clientX,y:t.clientY},e=V(t.target).closest(".ui-menu-item"),i=V(t.currentTarget),e[0]===i[0]&&(i.is(".ui-state-active")||(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(t,i))))},_destroy:function(){var t=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),t.children().each(function(){var t=V(this);t.data("ui-menu-submenu-caret")&&t.remove()})},_keydown:function(t){var e,i,s,n=!0;switch(t.keyCode){case V.ui.keyCode.PAGE_UP:this.previousPage(t);break;case V.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case V.ui.keyCode.HOME:this._move("first","first",t);break;case V.ui.keyCode.END:this._move("last","last",t);break;case V.ui.keyCode.UP:this.previous(t);break;case V.ui.keyCode.DOWN:this.next(t);break;case V.ui.keyCode.LEFT:this.collapse(t);break;case V.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case V.ui.keyCode.ENTER:case V.ui.keyCode.SPACE:this._activate(t);break;case V.ui.keyCode.ESCAPE:this.collapse(t);break;default:e=this.previousFilter||"",s=n=!1,i=96<=t.keyCode&&t.keyCode<=105?(t.keyCode-96).toString():String.fromCharCode(t.keyCode),clearTimeout(this.filterTimer),i===e?s=!0:i=e+i,e=this._filterMenuItems(i),(e=s&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(i=String.fromCharCode(t.keyCode),e=this._filterMenuItems(i)),e.length?(this.focus(t,e),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&t.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var t,e,s=this,n=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),e=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=V(this),e=t.prev(),i=V("<span>").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+n),e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),this._addClass(e,"ui-menu","ui-widget ui-widget-content ui-front"),(t=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=V(this);s._isDivider(t)&&s._addClass(t,"ui-menu-divider","ui-widget-content")}),i=(e=t.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(e,"ui-menu-item")._addClass(i,"ui-menu-item-wrapper"),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!V.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){var i;"icons"===t&&(i=this.element.find(".ui-menu-icon"),this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),i=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,s;this._hasScroll()&&(i=parseFloat(V.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(V.css(this.activeMenu[0],"paddingTop"))||0,e=t.offset().top-this.activeMenu.offset().top-i-s,i=this.activeMenu.scrollTop(),s=this.activeMenu.height(),t=t.outerHeight(),e<0?this.activeMenu.scrollTop(i+e):s<e+t&&this.activeMenu.scrollTop(i+e-s+t))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(t){var e=V.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(e)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var t=i?this.element:V(e&&e.target).closest(this.element.find(".ui-menu"));t.length||(t=this.element),this._close(t),this.blur(e),this._removeClass(t.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=t},i?0:this.delay)},_close:function(t){(t=t||(this.active?this.active.parent():this.element)).find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","fal
12se")},_closeOnDocumentClick:function(t){return!V(t.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this._menuItems(this.active.children(".ui-menu")).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_menuItems:function(t){return(t||this.element).find(this.options.items).filter(".ui-menu-item")},_move:function(t,e,i){var s;(s=this.active?"first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").last():this.active[t+"All"](".ui-menu-item").first():s)&&s.length&&this.active||(s=this._menuItems(this.activeMenu)[e]()),this.focus(i,s)},nextPage:function(t){var e,i,s;this.active?this.isLastItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.innerHeight(),0===V.fn.jquery.indexOf("3.2.")&&(s+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.nextAll(".ui-menu-item").each(function(){return(e=V(this)).offset().top-i-s<0}),this.focus(t,e)):this.focus(t,this._menuItems(this.activeMenu)[this.active?"last":"first"]())):this.next(t)},previousPage:function(t){var e,i,s;this.active?this.isFirstItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.innerHeight(),0===V.fn.jquery.indexOf("3.2.")&&(s+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.prevAll(".ui-menu-item").each(function(){return 0<(e=V(this)).offset().top-i+s}),this.focus(t,e)):this.focus(t,this._menuItems(this.activeMenu).first())):this.next(t)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||V(t.target).closest(".ui-menu-item");var e={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,e)},_filterMenuItems:function(t){var t=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),e=new RegExp("^"+t,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return e.test(String.prototype.trim.call(V(this).children(".ui-menu-item-wrapper").text()))})}});V.widget("ui.autocomplete",{version:"1.13.2",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,liveRegionTimer:null,_create:function(){var i,s,n,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,t="input"===t;this.isMultiLine=e||!t&&this._isContentEditable(this.element),this.valueMethod=this.element[e||t?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:s=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)return i=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||t.preventDefault());if(!s){var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){if(n)return n=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value(
vendor: 13,513 bytes, line 12
12)},blur:function(t){clearTimeout(this.searching),this.close(t),this._change(t)}}),this._initSource(),this.menu=V("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().attr({unselectable:"on"}).menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault()},menufocus:function(t,e){var i,s;if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",function(){V(t.target).trigger(t.originalEvent)});s=e.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:s})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(s.value),(i=e.item.attr("aria-label")||s.value)&&String.prototype.trim.call(i).length&&(clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(V("<div>").text(i))},100))},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==V.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=V("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(t){var e=this.menu.element[0];return t.target===this.element[0]||t.target===e||V.contains(e,t.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var t=this.options.appendTo;return t=!(t=!(t=t&&(t.jquery||t.nodeType?V(t):this.document.find(t).eq(0)))||!t[0]?this.element.closest(".ui-front, dialog"):t).length?this.document[0].body:t},_initSource:function(){var i,s,n=this;Array.isArray(this.options.source)?(i=this.options.source,this.source=function(t,e){e(V.ui.autocomplete.filter(i,t.term))}):"string"==typeof this.options.source?(s=this.options.source,this.source=function(t,e){n.xhr&&n.xhr.abort(),n.xhr=V.ajax({url:s,data:t,dataType:"json",success:function(t){e(t)},error:function(){e([])}})}):this.source=this.options.source},_searchTimeout:function(s){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),e=this.menu.element.is(":visible"),i=s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;t&&(e||i)||(this.selectedItem=null,this.search(null,s))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):!1!==this._trigger("search",e)?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")}.bind(this)},__response:function(t){t=t&&this._normalize(t),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:V.map(t,function(t){return"string"==typeof t?{label:t,value:t}:V.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var e=this.menu.element.empty();this._renderMenu(e,t),this.isNewMenu=!0,this.menu.refresh(),e.show(),this._resizeMenu(),e.position(V.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(i,t){var s=this;V.each(t,function(t,e){s._renderItemData(i,e)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(t,e){return V("<li>").append(V("<div>").text(e.label)).appendTo(t)},_move:function(t,e){if(this.menu.element.is(":visible"))return this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),void this.menu.blur()):void this.menu[t](e);this.search(null,e)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){this.isMultiLine&&!this.menu.element.is(":visible")||(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),V.extend(V.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,e){var i=new RegExp(V.ui.autocomplete.escapeRegex(e),"i");return V.grep(t,function(t){return i.test(t.label||t.value||t)})}}),V.widget("ui.autocomplete",V.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(1<t?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var e;this._superApply(arguments),this.options.disabled||this.cancelSearch||(e=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(V("<div>").text(e))},100))}});V.ui.autocomplete;var tt=/ui-corner-([a-z]){2,6}/g;V.widget("ui.controlgroup",{version:"1.13.2",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var o=this,a=[];V.each(this.options.items,function(s,t){var e,n={};if(t)return"controlgroupLabel"===s?((e=o.element.find(t)).each(function(){var t=V(this);t.children(".ui-controlgroup-label-contents").length||t.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),o._addClass(e,null,"ui-widget ui-widget-content ui-state-default"),void(a=a.concat(e.get()))):void(V.fn[s]&&(n=o["_"+s+"Options"]?o["_"+s+"Options"]("middle"):{classes:{}},o.element.find(t).each(function(){var t=V(this),e=t[s]("instance"),i=V.widget.extend({},n);"button"===s&&t.parent(".ui-spinner").length||((e=e||t[s]()[s]("instance"))&&(i.classes=o._resolveClassesValues(i.classes,e)),t[s](i),i=t[s]("widget"),V.data(i[0],"ui-controlgroup-data",e||t[s]("instance")),a.push(i[0]))})))}),this.childWidgets=V(V.uniqueSort(a)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var t=V(this).data("ui-controlgroup-data");t&&t[e]&&t[e]()})},_updateCornerClass:function(t,e){e=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,"ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"),this._addClass(t,null,e)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){t=this._buildSimpleOptions(t,"ui-spinner");return t.classes["ui-spinner-up"]="",t.classes["ui-spinner-down"]="",t},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e&&"auto",classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(i,s){var n={};return V.each(i,function(t){var e=s.options.classes[t]||"",e=String.prototype.trim.call(e.replace(tt,""));n[t]=(e+" "+i[t]).replace(/\s+/g," ")}),n},_setOption:function(t,e){"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"!==t?this.refresh():this._callChildMethod(e?"disable":"enable")},refresh:function(){var n,o=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),n=this.childWidgets,(n=this.options.onlyVisible?n.filter(":visible"):n).length&&(V.each(["first","last"],function(t,e){var i,s=n[e]().data("ui-controlgroup-data");s&&o["_"+s.widgetName+"Options"]?((i=o["_"+s.widgetName+"Options"](1===n.length?"only":e)).classes=o._resolveClassesValues(i.classes,s),s.element[s.widgetName](i)):o._updateCornerClass(n[e](),e)}),this._callChildMethod("refresh"))}});V.widget("ui.checkboxradio",[V.ui.formResetMixin,{version:"1.13.2",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var t,e=this._super()||{};return this._readType(),t=this.element.labels(),this.label=V(t[t.length-1]),this.label.length||V.error("No label found for checkboxradio widget"),this.originalLabel="",(t=this.label.contents().not(this.element[0])).length&&(this.originalLabel+=t.clone().wrapAll("<div></div>").parent().html()),this.originalLabel&&(e.label=this.originalLabel),null!=(t=this.element[0].disabled)&&(e.disabled=t),e},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var t=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===t&&/radio|checkbox/.test(this.type)||V.error("Can't create checkboxradio on element.nodeName="+t+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var t=this.element[0].name,e="input[name='"+V.escapeSelector(t)+"']";return t?(this.form.length?V(this.form[0].elements).filter(e):V(e).filter(function(){return 0===V(this)._form().length})).not(this.element):V([])},_toggleClasses:function(){var t=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",t)._toggleClass(this.icon,null,"ui-icon-blank",!t),"radio"===this.type&&this._getRadioGroup().each(function(){var t=V(this).checkboxradio("instance");t&&t._removeClass(t.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){if("label"!==t||e){if(this._super(t,e),"disabled"===t)return this._toggleClass(this.label,null,"ui-state-disabled",e),void(this.element[0].disabled=e);this.refresh()}},_updateIcon:function(t){var e="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=V("<span>"),this.iconSpace=V("<span> </span>
12"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(e+=t?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,t?"ui-icon-blank":"ui-icon-check")):e+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",e),t||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),(t=this.iconSpace?t.not(this.iconSpace[0]):t).remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]);var et;V.ui.checkboxradio;V.widget("ui.button",{version:"1.13.2",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),null!=(t=this.element[0].disabled)&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(t){t.keyCode===V.ui.keyCode.SPACE&&(t.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(t,e){var i="iconPosition"!==t,s=i?this.options.iconPosition:e,t="top"===s||"bottom"===s;this.icon?i&&this._removeClass(this.icon,null,this.options.icon):(this.icon=V("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),i&&this._addClass(this.icon,null,e),this._attachIcon(s),t?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconS
vendor: 4,777 bytes, line 12
12pace||(this.iconSpace=V("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(s))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=(void 0===t.showLabel?this.options:t).showLabel,i=(void 0===t.icon?this.options:t).icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),(this.element[0].disabled=e)&&this.element.trigger("blur"))},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),!1!==V.uiBackCompat&&(V.widget("ui.button",V.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){"text"!==t?("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments)):this._super("showLabel",e)}}),V.fn.button=(et=V.fn.button,function(i){var t="string"==typeof i,s=Array.prototype.slice.call(arguments,1),n=this;return t?this.length||"instance"!==i?this.each(function(){var t=V(this).attr("type"),e=V.data(this,"ui-"+("checkbox"!==t&&"radio"!==t?"button":"checkboxradio"));return"instance"===i?(n=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?V.error("no such method '"+i+"' for button widget instance"):(t=e[i].apply(e,s))!==e&&void 0!==t?(n=t&&t.jquery?n.pushStack(t.get()):t,!1):void 0:V.error("cannot call methods on button prior to initialization; attempted to call method '"+i+"'")}):n=void 0:(s.length&&(i=V.widget.extend.apply(null,[i].concat(s))),this.each(function(){var t=V(this).attr("type"),e="checkbox"!==t&&"radio"!==t?"button":"checkboxradio",t=V.data(this,"ui-"+e);t?(t.option(i||{}),t._init&&t._init()):"button"!=e?V(this).checkboxradio(V.extend({icon:!1},i)):et.call(V(this),i)})),n}),V.fn.buttonset=function(){return V.ui.controlgroup||V.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))});var it;V.ui.button;function st(){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","Frid
vendor: 4,737 bytes, line 12
12ay","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:"",selectMonthLabel:"Select month",selectYearLabel:"Select year"},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,onUpdateDatepicker:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},V.extend(this._defaults,this.regional[""]),this.regional.en=V.extend(!0,{},this.regional[""]),this.regional["en-US"]=V.extend(!0,{},this.regional.en),this.dpDiv=nt(V("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function nt(t){var e="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.on("mouseout",e,function(){V(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&V(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&V(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",e,ot)}function ot(){V.datepicker._isDisabledDatepicker((it.inline?it.dpDiv.parent():it.input)[0])||(V(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),V(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&V(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&V(this).addClass("ui-datepicker-next-hover"))}function at(t,e){for(var i in V.extend(t,e),e)null==e[i]&&(t[i]=e[i]);return t}V.extend(V.ui,{datepicker:{version:"1.13.2"}}),V.extend(st.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return at(this._defaults,t||{}),this},_attachDatepicker:function(t,e){var i,s=t.nodeName.toLowerCase(),n="div"===s||"span"===s;t.id||(this.uuid+=1,t.id="dp"+this.uuid),(i=this._newInst(V(t),n)).settings=V.extend({},e||{}),"input"===s?this._connectDatepicker(t,i):n&&this._inlineDatepicker(t,i)},_newInst:function(t,e){return{id:t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1"),input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:e,dpDiv:e?nt(V("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,e){var i=V(t);e.append=V([]),e.trigger=V([]),i.hasClass(this.markerClassName)||(this._attachments(i,e),i.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(e),V.data(t,"datepicker",e),e.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,e){var i,s=this._get(e,"appendText"),n=this._get(e,"isRTL");e.append&&e.append.remove(),s&&(e.append=V("<span>").addClass(this._appendClass).text(s),t[n?"before":"after"](e.append)),t.off("focus",this._showDatepicker),e.trigger&&e.trigger.remove(),"focus"!==(i=this._get(e,"showOn"))&&"both"!==i||t.on("focus",this._showDatepicker),"button"!==i&&"both"!==i||(s=this._get(e,"buttonText"),i=this._get(e,"buttonImage"),this._get(e,"buttonImageOnly")?e.trigger=V("<img>").addClass(this._triggerClass).attr({src:i,alt:s,title:s}):(e.trigger=V("<button type='button'>").addClass(this._triggerClass),i?e.trigger.html(V("<img>").attr({src:i,alt:s,title:s})):e.trigger.text(s)),t[n?"before":"after"](e.trigger),e.trigger.on("click",function(){return V.datepicker._datepickerShowing&&V.datepicker._lastInput===t[0]?V.datepicker._hideDatepicker():(V.datepicker._datepickerShowing&&V.datepicker._lastInput!==t[0]&&V.datepicker._hideDatepicker(),V.datepicker._showDatepicker(t[0])),!1}))},_autoSize:function(t){var e,i,s,n,o,a;this._get(t,"autoSize")&&!t.inline&&(o=new Date(2009,11,20),(a=this._get(t,"dateFormat")).match(/[DM]/)&&(e=function(t){for(n=s=i=0;n<t.length;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length))},_inlineDatepicker:function(t,e){var i=V(t);
vendor: 11,779 bytes, line 12
12i.hasClass(this.markerClassName)||(i.addClass(this.markerClassName).append(e.dpDiv),V.data(t,"datepicker",e),this._setDate(e,this._getDefaultDate(e),!0),this._updateDatepicker(e),this._updateAlternate(e),e.settings.disabled&&this._disableDatepicker(t),e.dpDiv.css("display","block"))},_dialogDatepicker:function(t,e,i,s,n){var o,a=this._dialogInst;return a||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=V("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),V("body").append(this._dialogInput),(a=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},V.data(this._dialogInput[0],"datepicker",a)),at(a.settings,s||{}),e=e&&e.constructor===Date?this._formatDate(a,e):e,this._dialogInput.val(e),this._pos=n?n.length?n:[n.pageX,n.pageY]:null,this._pos||(o=document.documentElement.clientWidth,s=document.documentElement.clientHeight,e=document.documentElement.scrollLeft||document.body.scrollLeft,n=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[o/2-100+e,s/2-150+n]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),a.settings.onSelect=i,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),V.blockUI&&V.blockUI(this.dpDiv),V.data(this._dialogInput[0],"datepicker",a),this},_destroyDatepicker:function(t){var e,i=V(t),s=V.data(t,"datepicker");i.hasClass(this.markerClassName)&&(e=t.nodeName.toLowerCase(),V.removeData(t,"datepicker"),"input"===e?(s.append.remove(),s.trigger.remove(),i.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):"div"!==e&&"span"!==e||i.removeClass(this.markerClassName).empty(),it===s&&(it=null,this._curInst=null))},_enableDatepicker:function(e){var t,i=V(e),s=V.data(e,"datepicker");i.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!1,s.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):"div"!==t&&"span"!==t||((i=i.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=V.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var t,i=V(e),s=V.data(e,"datepicker");i.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!0,s.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):"div"!==t&&"span"!==t||((i=i.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=V.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;e<this._disabledInputs.length;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(t){try{return V.data(t,"datepicker")}catch(t){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,e,i){var s,n,o=this._getInst(t);if(2===arguments.length&&"string"==typeof e)return"defaults"===e?V.extend({},V.datepicker._defaults):o?"all"===e?V.extend({},o.settings):this._get(o,e):null;s=e||{},"string"==typeof e&&((s={})[e]=i),o&&(this._curInst===o&&this._hideDatepicker(),n=this._getDateDatepicker(t,!0),e=this._getMinMaxDate(o,"min"),i=this._getMinMaxDate(o,"max"),at(o.settings,s),null!==e&&void 0!==s.dateFormat&&void 0===s.minDate&&(o.settings.minDate=this._formatDate(o,e)),null!==i&&void 0!==s.dateFormat&&void 0===s.maxDate&&(o.settings.maxDate=this._formatDate(o,i)),"disabled"in s&&(s.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(V(t),o),this._autoSize(o),this._setDate(o,n),this._updateAlternate(o),this._updateDatepicker(o))},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){t=this._getInst(t);t&&this._updateDatepicker(t)},_setDateDatepicker:function(t,e){t=this._getInst(t);t&&(this._setDate(t,e),this._updateDatepicker(t),this._updateAlternate(t))},_getDateDatepicker:function(t,e){t=this._getInst(t);return t&&!t.inline&&this._setDateFromField(t,e),t?this._getDate(t):null},_doKeyDown:function(t){var e,i,s=V.datepicker._getInst(t.target),n=!0,o=s.dpDiv.is(".ui-datepicker-rtl");if(s._keyEvent=!0,V.datepicker._datepickerShowing)switch(t.keyCode){case 9:V.datepicker._hideDatepicker(),n=!1;break;case 13:return(i=V("td."+V.datepicker._dayOverClass+":not(."+V.datepicker._currentClass+")",s.dpDiv))[0]&&V.datepicker._selectDay(t.target,s.selectedMonth,s.selectedYear,i[0]),(e=V.datepicker._get(s,"onSelect"))?(i=V.datepicker._formatDate(s),e.apply(s.input?s.input[0]:null,[i,s])):V.datepicker._hideDatepicker(),!1;case 27:V.datepicker._hideDatepicker();break;case 33:V.datepicker._adjustDate(t.target,t.ctrlKey?-V.datepicker._get(s,"stepBigMonths"):-V.datepicker._get(s,"stepMonths"),"M");break;case 34:V.datepicker._adjustDate(t.target,t.ctrlKey?+V.datepicker._get(s,"stepBigMonths"):+V.datepicker._get(s,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&V.datepicker._clearDate(t.target),n=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&V.datepicker._gotoToday(t.target),n=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,o?1:-1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&V.datepicker._adjustDate(t.target,t.ctrlKey?-V.datepicker._get(s,"stepBigMonths"):-V.datepicker._get(s,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,-7,"D"),n=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,o?-1:1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&V.datepicker._adjustDate(t.target,t.ctrlKey?+V.datepicker._get(s,"stepBigMonths"):+V.datepicker._get(s,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,7,"D"),n=t.ctrlKey||t.metaKey;break;default:n=!1}else 36===t.keyCode&&t.ctrlKey?V.datepicker._showDatepicker(this):n=!1;n&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var e,i=V.datepicker._getInst(t.target);if(V.datepicker._get(i,"constrainInput"))return e=V.datepicker._possibleChars(V.datepicker._get(i,"dateFormat")),i=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||i<" "||!e||-1<e.indexOf(i)},_doKeyUp:function(t){t=V.datepicker._getInst(t.target);if(t.input.val()!==t.lastVal)try{V.datepicker.parseDate(V.datepicker._get(t,"dateFormat"),t.input?t.input.val():null,V.datepicker._getFormatConfig(t))&&(V.datepicker._setDateFromField(t),V.datepicker._updateAlternate(t),V.datepicker._updateDatepicker(t))}catch(t){}return!0},_showDatepicker:function(t){var e,i,s,n;"input"!==(t=t.target||t).nodeName.toLowerCase()&&(t=V("input",t.parentNode)[0]),V.datepicker._isDisabledDatepicker(t)||V.datepicker._lastInput===t||(n=V.datepicker._getInst(t),V.datepicker._curInst&&V.datepicker._curInst!==n&&(V.datepicker._curInst.dpDiv.stop(!0,!0),n&&V.datepicker._datepickerShowing&&V.datepicker._hideDatepicker(V.datepicker._curInst.input[0])),!1!==(i=(s=V.datepicker._get(n,"beforeShow"))?s.apply(t,[t,n]):{})&&(at(n.settings,i),n.lastVal=null,V.datepicker._lastInput=t,V.datepicker._setDateFromField(n),V.datepicker._inDialog&&(t.value=""),V.datepicker._pos||(V.datepicker._pos=V.datepicker._findPos(t),V.datepicker._pos[1]+=t.offsetHeight),e=!1,V(t).parents().each(function(){return!(e|="fixed"===V(this).css("position"))}),s={left:V.datepicker._pos[0],top:V.datepicker._pos[1]},V.datepicker._pos=null,n.dpDiv.empty(),n.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),V.datepicker._updateDatepicker(n),s=V.datepicker._checkOffset(n,s,e),n.dpDiv.css({position:V.datepicker._inDialog&&V.blockUI?"static":e?"fixed":"absolute",display:"none",left:s.left+"px",top:s.top+"px"}),n.inline||(i=V.datepicker._get(n,"showAnim"),s=V.datepicker._get(n,"duration"),n.dpDiv.css("z-index",function(t){for(var e,i;t.length&&t[0]!==document;){if(("absolute"===(e=t.css("position"))||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}(V(t))+1),V.datepicker._datepickerShowing=!0,V.effects&&V.effects.effect[i]?n.dpDiv.show(i,V.datepicker._get(n,"showOptions"),s):n.dpDiv[i||"show"](i?s:null),V.datepicker._shouldFocusInput(n)&&n.input.trigger("focus"),V.datepicker._curInst=n)))},_updateDatepicker:function(t){this.maxRows=4,(it=t).dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var e,i=this._getNumberOfMonths(t),s=i[1],n=t.dpDiv.find("."+this._dayOverClass+" a"),o=V.datepicker._get(t,"onUpdateDatepicker");0<n.length&&ot.apply(n.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),1<s&&t.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",17*s+"em"),t.dpDiv[(1!==i[0]||1!==i[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===V.datepicker._curInst&&V.datepicker._datepickerShowing&&V.datepicker._shouldFocusInput(t)&&t.input.trigger("focus"),t.yearshtml&&(e=t.yearshtml,setTimeout(function(){e===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year").first().replaceWith(t.yearshtml),e=t.yearshtml=null},0)),o&&o.apply(t.input?t.input[0]:null,[t])},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(t,e,i){var s=t.dpDiv.outerWidth(),n=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,a=t.input?t.input.outerHeight():0,r=document.documentElement.clientWidth+(i?0:V(document).scrollLeft()),l=document.documentElement.clientHeight+(i?0:V(document).scrollTop());return e.left-=this._get(t,"isRTL")?s-o:0,e.left-=i&&e.left===t.input.offset().left?V(document).scrollLeft():0,e.top-=i&&e.top===t.input.offset().top+a?V(document).scrollTop():0,e.left-=Math.min(e.left,e.left+s>r&&s<r?Math.abs(e.left+s-r):0),e.top-=Math.min(e.top,e.top+n>l&&n<l?Math.abs(n+a):0),e},_findPos:function(t){for(var e=this._getInst(t),i=this._get(e,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||V.expr.pseudos.hidden(t));)t=t[i?"previousSibling":"nextSibling"];return[(e=V(t).offset()).left,e.top]},_hideDatepicker:function(t){var e,i,s=this._curInst;!s||t&&s!==V.data(t,"datepicker")||this._datepickerShowing&&(e=this._get(s,"showAnim"),i=this._get(s,"duration"),t=function(){V.datepicker._tidyDialog(s)},V.effects&&(V.effects.effect[e]||V.effects[e])?s.dpDiv.hide(e,V.datepicker._get(s,"showOptions"),i,t):s.dpDiv["slideDown"===e?"slideUp":"fadeIn"===e?"fadeOut":"hide"](e?i:null,t),e||t(),this._datepickerShowing=!1,(t=this._get(s,"onClose"))&&t.apply(s.input?s.input[0]:null,[s.input?s.input.val():"",s]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),V.blockUI&&(V.unblockUI(),V("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(t){var e;V.datepicker._curInst&&(e=V(t.target),t=V.datepicker._getInst(e[0]),(e[0].id===V.datepicker._mainDivId||0!==e.parents("#"+V.datepicker._mainDivId).length||e.hasClass(V.datepicker.markerClassName)||e.closest("."+V.datepicker._triggerClass).length||!V.datepicker._datepickerShowing||V.datepicker._inDialog&&V.blockUI)&&(!e.hasClass(V.datepicker.markerClassName)||V.datepicker._curInst===t)||V.datepicker._hideDatepicker())}
vendor: 14,467 bytes, line 12
12,_adjustDate:function(t,e,i){var s=V(t),t=this._getInst(s[0]);this._isDisabledDatepicker(s[0])||(this._adjustInstDate(t,e,i),this._updateDatepicker(t))},_gotoToday:function(t){var e=V(t),i=this._getInst(e[0]);this._get(i,"gotoCurrent")&&i.currentDay?(i.selectedDay=i.currentDay,i.drawMonth=i.selectedMonth=i.currentMonth,i.drawYear=i.selectedYear=i.currentYear):(t=new Date,i.selectedDay=t.getDate(),i.drawMonth=i.selectedMonth=t.getMonth(),i.drawYear=i.selectedYear=t.getFullYear()),this._notifyChange(i),this._adjustDate(e)},_selectMonthYear:function(t,e,i){var s=V(t),t=this._getInst(s[0]);t["selected"+("M"===i?"Month":"Year")]=t["draw"+("M"===i?"Month":"Year")]=parseInt(e.options[e.selectedIndex].value,10),this._notifyChange(t),this._adjustDate(s)},_selectDay:function(t,e,i,s){var n=V(t);V(s).hasClass(this._unselectableClass)||this._isDisabledDatepicker(n[0])||((n=this._getInst(n[0])).selectedDay=n.currentDay=parseInt(V("a",s).attr("data-date")),n.selectedMonth=n.currentMonth=e,n.selectedYear=n.currentYear=i,this._selectDate(t,this._formatDate(n,n.currentDay,n.currentMonth,n.currentYear)))},_clearDate:function(t){t=V(t);this._selectDate(t,"")},_selectDate:function(t,e){var i=V(t),t=this._getInst(i[0]);e=null!=e?e:this._formatDate(t),t.input&&t.input.val(e),this._updateAlternate(t),(i=this._get(t,"onSelect"))?i.apply(t.input?t.input[0]:null,[e,t]):t.input&&t.input.trigger("change"),t.inline?this._updateDatepicker(t):(this._hideDatepicker(),this._lastInput=t.input[0],"object"!=typeof t.input[0]&&t.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(t){var e,i,s=this._get(t,"altField");s&&(e=this._get(t,"altFormat")||this._get(t,"dateFormat"),i=this._getDate(t),t=this.formatDate(e,i,this._getFormatConfig(t)),V(document).find(s).val(t))},noWeekends:function(t){t=t.getDay();return[0<t&&t<6,""]},iso8601Week:function(t){var e=new Date(t.getTime());return e.setDate(e.getDate()+4-(e.getDay()||7)),t=e.getTime(),e.setMonth(0),e.setDate(1),Math.floor(Math.round((t-e)/864e5)/7)+1},parseDate:function(e,n,t){if(null==e||null==n)throw"Invalid arguments";if(""===(n="object"==typeof n?n.toString():n+""))return null;for(var i,s,o,a=0,r=(t?t.shortYearCutoff:null)||this._defaults.shortYearCutoff,r="string"!=typeof r?r:(new Date).getFullYear()%100+parseInt(r,10),l=(t?t.dayNamesShort:null)||this._defaults.dayNamesShort,h=(t?t.dayNames:null)||this._defaults.dayNames,c=(t?t.monthNamesShort:null)||this._defaults.monthNamesShort,u=(t?t.monthNames:null)||this._defaults.monthNames,d=-1,p=-1,f=-1,g=-1,m=!1,_=function(t){t=w+1<e.length&&e.charAt(w+1)===t;return t&&w++,t},v=function(t){var e=_(t),e="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,e=new RegExp("^\\d{"+("y"===t?e:1)+","+e+"}"),e=n.substring(a).match(e);if(!e)throw"Missing number at position "+a;return a+=e[0].length,parseInt(e[0],10)},b=function(t,e,i){var s=-1,e=V.map(_(t)?i:e,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(V.each(e,function(t,e){var i=e[1];if(n.substr(a,i.length).toLowerCase()===i.toLowerCase())return s=e[0],a+=i.length,!1}),-1!==s)return s+1;throw"Unknown name at position "+a},y=function(){if(n.charAt(a)!==e.charAt(w))throw"Unexpected literal at position "+a;a++},w=0;w<e.length;w++)if(m)"'"!==e.charAt(w)||_("'")?y():m=!1;else switch(e.charAt(w)){case"d":f=v("d");break;case"D":b("D",l,h);break;case"o":g=v("o");break;case"m":p=v("m");break;case"M":p=b("M",c,u);break;case"y":d=v("y");break;case"@":d=(o=new Date(v("@"))).getFullYear(),p=o.getMonth()+1,f=o.getDate();break;case"!":d=(o=new Date((v("!")-this._ticksTo1970)/1e4)).getFullYear(),p=o.getMonth()+1,f=o.getDate();break;case"'":_("'")?y():m=!0;break;default:y()}if(a<n.length&&(s=n.substr(a),!/^\s+/.test(s)))throw"Extra/unparsed characters found in date: "+s;if(-1===d?d=(new Date).getFullYear():d<100&&(d+=(new Date).getFullYear()-(new Date).getFullYear()%100+(d<=r?0:-100)),-1<g)for(p=1,f=g;;){if(f<=(i=this._getDaysInMonth(d,p-1)))break;p++,f-=i}if((o=this._daylightSavingAdjust(new Date(d,p-1,f))).getFullYear()!==d||o.getMonth()+1!==p||o.getDate()!==f)throw"Invalid date";return o},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:24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*60*60*1e7,formatDate:function(e,t,i){if(!t)return"";function s(t,e,i){var s=""+e;if(c(t))for(;s.length<i;)s="0"+s;return s}function n(t,e,i,s){return(c(t)?s:i)[e]}var o,a=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,r=(i?i.dayNames:null)||this._defaults.dayNames,l=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,h=(i?i.monthNames:null)||this._defaults.monthNames,c=function(t){t=o+1<e.length&&e.charAt(o+1)===t;return t&&o++,t},u="",d=!1;if(t)for(o=0;o<e.length;o++)if(d)"'"!==e.charAt(o)||c("'")?u+=e.charAt(o):d=!1;else switch(e.charAt(o)){case"d":u+=s("d",t.getDate(),2);break;case"D":u+=n("D",t.getDay(),a,r);break;case"o":u+=s("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=s("m",t.getMonth()+1,2);break;case"M":u+=n("M",t.getMonth(),l,h);break;case"y":u+=c("y")?t.getFullYear():(t.getFullYear()%100<10?"0":"")+t.getFullYear()%100;break;case"@":u+=t.getTime();break;case"!":u+=1e4*t.getTime()+this._ticksTo1970;break;case"'":c("'")?u+="'":d=!0;break;default:u+=e.charAt(o)}return u},_possibleChars:function(e){for(var t="",i=!1,s=function(t){t=n+1<e.length&&e.charAt(n+1)===t;return t&&n++,t},n=0;n<e.length;n++)if(i)"'"!==e.charAt(n)||s("'")?t+=e.charAt(n):i=!1;else switch(e.charAt(n)){case"d":case"m":case"y":case"@":t+="0123456789";break;case"D":case"M":return null;case"'":s("'")?t+="'":i=!0;break;default:t+=e.charAt(n)}return t},_get:function(t,e){return(void 0!==t.settings[e]?t.settings:this._defaults)[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(t){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(r,t,e){var i,s,t=null==t||""===t?e:"string"==typeof t?function(t){try{return V.datepicker.parseDate(V.datepicker._get(r,"dateFormat"),t,V.datepicker._getFormatConfig(r))}catch(t){}for(var e=(t.toLowerCase().match(/^c/)?V.datepicker._getDate(r):null)||new Date,i=e.getFullYear(),s=e.getMonth(),n=e.getDate(),o=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,a=o.exec(t);a;){switch(a[2]||"d"){case"d":case"D":n+=parseInt(a[1],10);break;case"w":case"W":n+=7*parseInt(a[1],10);break;case"m":case"M":s+=parseInt(a[1],10),n=Math.min(n,V.datepicker._getDaysInMonth(i,s));break;case"y":case"Y":i+=parseInt(a[1],10),n=Math.min(n,V.datepicker._getDaysInMonth(i,s))}a=o.exec(t)}return new Date(i,s,n)}(t):"number"==typeof t?isNaN(t)?e:(i=t,(s=new Date).setDate(s.getDate()+i),s):new Date(t.getTime());return(t=t&&"Invalid Date"===t.toString()?e:t)&&(t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)),this._daylightSavingAdjust(t)},_daylightSavingAdjust:function(t){return t?(t.setHours(12<t.getHours()?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,e=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=e.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=e.getMonth(),t.drawYear=t.selectedYear=t.currentYear=e.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){return!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay))},_attachHandlers:function(t){var e=this._get(t,"stepMonths"),i="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){V.datepicker._adjustDate(i,-e,"M")},next:function(){V.datepicker._adjustDate(i,+e,"M")},hide:function(){V.datepicker._hideDatepicker()},today:function(){V.datepicker._gotoToday(i)},selectDay:function(){return V.datepicker._selectDay(i,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return V.datepicker._selectMonthYear(i,this,"M"),!1},selectYear:function(){return V.datepicker._selectMonthYear(i,this,"Y"),!1}};V(this).on(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,l,h,c,u,d,p,f,g,m,_,v,b,y,w,x,k,C,D,I,T,P,M,S,H,z,A=new Date,O=this._daylightSavingAdjust(new Date(A.getFullYear(),A.getMonth(),A.getDate())),N=this._get(t,"isRTL"),E=this._get(t,"showButtonPanel"),W=this._get(t,"hideIfNoPrevNext"),F=this._get(t,"navigationAsDateFormat"),L=this._getNumberOfMonths(t),R=this._get(t,"showCurrentAtPos"),A=this._get(t,"stepMonths"),Y=1!==L[0]||1!==L[1],B=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),j=this._getMinMaxDate(t,"min"),q=this._getMinMaxDate(t,"max"),K=t.drawMonth-R,U=t.drawYear;if(K<0&&(K+=12,U--),q)for(e=this._daylightSavingAdjust(new Date(q.getFullYear(),q.getMonth()-L[0]*L[1]+1,q.getDate())),e=j&&e<j?j:e;this._daylightSavingAdjust(new Date(U,K,1))>e;)--K<0&&(K=11,U--);for(t.drawMonth=K,t.drawYear=U,R=this._get(t,"prevText"),R=F?this.formatDate(R,this._daylightSavingAdjust(new Date(U,K-A,1)),this._getFormatConfig(t)):R,i=this._canAdjustMonth(t,-1,U,K)?V("<a>").attr({class:"ui-datepicker-prev ui-corner-all","data-handler":"prev","data-event":"click",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"e":"w")).text(R))[0].outerHTML:W?"":V("<a>").attr({class:"ui-datepicker-prev ui-corner-all ui-state-disabled",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"e":"w")).text(R))[0].outerHTML,R=this._get(t,"nextText"),R=F?this.formatDate(R,this._daylightSavingAdjust(new Date(U,K+A,1)),this._getFormatConfig(t)):R,s=this._canAdjustMonth(t,1,U,K)?V("<a>").attr({class:"ui-datepicker-next ui-corner-all","data-handler":"next","data-event":"click",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"w":"e")).text(R))[0].outerHTML:W?"":V("<a>").attr({class:"ui-datepicker-next ui-corner-all ui-state-disabled",title:R}).append(V("<span>").attr("class","ui-icon ui-icon-circle-triangle-"+(N?"w":"e")).text(R))[0].outerHTML,A=this._get(t,"currentText"),W=this._get(t,"gotoCurrent")&&t.currentDay?B:O,A=F?this.formatDate(A,W,this._getFormatConfig(t)):A,R="",t.inline||(R=V("<button>").attr({type:"button",class:"ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all","data-handler":"hide","data-event":"click"}).text(this._get(t,"closeText"))[0].outerHTML),F="",E&&(F=V("<div class='ui-datepicker-buttonpane ui-widget-content'>").append(N?R:"").append(this._isInRange(t,W)?V("<button>").attr({type:"button",class:"ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all","data-handler":"today","data-event":"click"}).text(A):"").append(N?"":R)[0].outerHTML),n=parseInt(this._get(t,"firstDay"),10),n=isNaN(n)?0:n,o=this._get(t,"showWeek"),a=this._get(t,"dayNames"),r=this._get(t,"dayNamesMin"),l=this._get(t,"monthNames"),h=this._get(t,"monthNamesShort"),c=this._get(t,"beforeShowDay"),u=this._get(t,"showOtherMonths"),d=this._get(t,"selectOtherMonths"),p=this._getDefaultDate(t),f="",m=0;m<L[0];m++){for(_="",this.maxRows=4,v=0;v<L[1];v++){if(b=this._daylightSavingAdjust(new Date(U,K,t.selectedDay)),y=" ui-corner-all",w="",Y){if(w+="<div class='ui-datepicker-group",1<L[1])switch(v){case 0:w+=" ui-datepicker-group-first",y=" ui-corner-"+(N?"right":"left");break;case L[1]-1:w+=" ui-datepicker-group-last",y=" ui-corner-"+(N?"left":"right");break;default:w+=" ui-datepicker-group-middle",y=""}w+="'>"}for(w+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+y+"'>"+(/all|left/.test(y)&&0===m?N?s:i:"")+(/all|right/.test(y)&&0===m?N?i:s:"")+this._generateMonthYearHeader(t,K,U,j,q,0<m||0<v,l,h)+"</div><table class='ui-datepicker-calendar'><thead><tr>",x=o?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",g=0;g<7;g++)x+="<th scope='col'"+(5<=(g+n+6)%7?" class='ui-datepicker-week-end'":"")+"><span title='"+a[k=(g+n)%7]+"'>"+r[k]+"</span></th>";for(w+=x+"</tr></thead><tbody>",D=this._getDaysInMonth(U,K),U===t.selectedYear&&K===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,D)),C=(this._getFirstDayOfMonth(U,K)-n+7)%7,D=Math.ceil((C+D)/7),I=Y&&this.maxRows>D?this.maxRows:D,this.maxRows=I,T=this._daylightSavingAdjust(new Date(U,K,1-C)),P=0;P<I;P++){for(w+="<tr>",M=o?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(T)+"</td>":"",g=0;g<7;g++)S=c?c.apply(t.input?t.input[0]:null,[T]):[!0,""],z=(H=T.getMonth()!==K)&&!d||!S[0]||j&&T<j||q&&q<T,M+="<td class='"+(5<=(g+n+6)%7?" ui-datepicker-week-end":"")+(H?" ui-datepicker-other-month":"")+(T.getTime()===b.getTime()&&K===t.selectedMonth&&t._keyEvent||p.getTime()===T.getTime()&&p.getTime()===b.getTime()?" "+this._dayOverClass:"")+(z?" "+this._unselectableClass+" ui-state-disabled":"")+(H&&!u?"":" "+S[1]+(T.getTime()===B.getTime()?" "+this._currentClass:"")+(T.getTime()===O.getTime()?" ui-datepicker-today":""))+"'"+(H&&!u||!S[2]?"":" title='"+S[2].replace(/'/g,"&#39;")+"'")+(z?"":" data-handler='selectDay' data-event='click' data-month='"+T.getMonth()+"' data-year='"+T.getFullYear()+"'")+">"+(H&&!u?"&#xa0;":z?"<span class='ui-state-default'>"+T.getDate()+"</span>":"<a class='ui-state-default"+(T.getTime()===O.getTime()?" ui-state-highlight":"")+(T.getTime()===B.getTime()?" ui-state-active":"")+(H?" ui-priority-secondary":"")+"' href='#' aria-current='"+(T.getTime()===B.getTime()?"true":"false")+"' data-date='"+T.getDate()+"'>"+T.getDate()+"</a>")+"</td>",T.setDate(T.getDate()+1),T=this._daylightSavingAdjust(T);w+=M+"</tr>"}11<++K&&(K=0,U++),_+=w+="</tbody></table>"+(Y?"</div>"+(0<L[0]&&v===L[1]-1?"<div class='ui-datepicker-row-break'></div>":""):"")}f+=_}return f+=F,t._keyEvent=!1,f}
vendor: 18,320 bytes, line 12
12,_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var l,h,c,u,d,p,f=this._get(t,"changeMonth"),g=this._get(t,"changeYear"),m=this._get(t,"showMonthAfterYear"),_=this._get(t,"selectMonthLabel"),v=this._get(t,"selectYearLabel"),b="<div class='ui-datepicker-title'>",y="";if(o||!f)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(l=s&&s.getFullYear()===i,h=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' aria-label='"+_+"' data-handler='selectMonth' data-event='change'>",c=0;c<12;c++)(!l||c>=s.getMonth())&&(!h||c<=n.getMonth())&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(m||(b+=y+(!o&&f&&g?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!g)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(a=this._get(t,"yearRange").split(":"),u=(new Date).getFullYear(),d=(_=function(t){t=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?u+parseInt(t,10):parseInt(t,10);return isNaN(t)?u:t})(a[0]),p=Math.max(d,_(a[1]||"")),d=s?Math.max(d,s.getFullYear()):d,p=n?Math.min(p,n.getFullYear()):p,t.yearshtml+="<select class='ui-datepicker-year' aria-label='"+v+"' data-handler='selectYear' data-event='change'>";d<=p;d++)t.yearshtml+="<option value='"+d+"'"+(d===i?" selected='selected'":"")+">"+d+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),m&&(b+=(!o&&f&&g?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),e=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),e=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,e)));t.selectedDay=e.getDate(),t.drawMonth=t.selectedMonth=e.getMonth(),t.drawYear=t.selectedYear=e.getFullYear(),"M"!==i&&"Y"!==i||this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),t=this._getMinMaxDate(t,"max"),e=i&&e<i?i:e;return t&&t<e?t:e},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){t=this._get(t,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),n=this._daylightSavingAdjust(new Date(i,s+(e<0?e:n[0]*n[1]),1));return e<0&&n.setDate(this._getDaysInMonth(n.getFullYear(),n.getMonth())),this._isInRange(t,n)},_isInRange:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=null,o=null,a=this._get(t,"yearRange");return a&&(t=a.split(":"),a=(new Date).getFullYear(),n=parseInt(t[0],10),o=parseInt(t[1],10),t[0].match(/[+\-].*/)&&(n+=a),t[1].match(/[+\-].*/)&&(o+=a)),(!i||e.getTime()>=i.getTime())&&(!s||e.getTime()<=s.getTime())&&(!n||e.getFullYear()>=n)&&(!o||e.getFullYear()<=o)},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return{shortYearCutoff:e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);e=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),e,this._getFormatConfig(t))}}),V.fn.datepicker=function(t){if(!this.length)return this;V.datepicker.initialized||(V(document).on("mousedown",V.datepicker._checkExternalClick),V.datepicker.initialized=!0),0===V("#"+V.datepicker._mainDivId).length&&V("body").append(V.datepicker.dpDiv);var e=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]?V.datepicker["_"+t+"Datepicker"].apply(V.datepicker,[this[0]].concat(e)):this.each(function(){"string"==typeof t?V.datepicker["_"+t+"Datepicker"].apply(V.datepicker,[this].concat(e)):V.datepicker._attachDatepicker(this,t)})},V.datepicker=new st,V.datepicker.initialized=!1,V.datepicker.uuid=(new Date).getTime(),V.datepicker.version="1.13.2";V.datepicker,V.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var rt=!1;V(document).on("mouseup",function(){rt=!1});V.widget("ui.mouse",{version:"1.13.2",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(t){if(!0===V.data(t.target,e.widgetName+".preventClickEvent"))return V.removeData(t.target,e.widgetName+".preventClickEvent"),t.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!rt){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var e=this,i=1===t.which,s=!("string"!=typeof this.options.cancel||!t.target.nodeName)&&V(t.target).closest(this.options.cancel).length;return i&&!s&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(t),!this._mouseStarted)?(t.preventDefault(),!0):(!0===V.data(t.target,this.widgetName+".preventClickEvent")&&V.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return e._mouseMove(t)},this._mouseUpDelegate=function(t){return e._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),rt=!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(V.ui.ie&&(!document.documentMode||document.documentMode<9)&&!t.button)return this._mouseUp(t);if(!t.which)if(t.originalEvent.altKey||t.originalEvent.ctrlKey||t.originalEvent.metaKey||t.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)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=!1!==this._mouseStart(this._mouseDownEvent,t),this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&V.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,rt=!1,t.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),V.ui.plugin={add:function(t,e,i){var s,n=V.ui[t].prototype;for(s in i)n.plugins[s]=n.plugins[s]||[],n.plugins[s].push([e,i[s]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;n<o.length;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},V.ui.safeBlur=function(t){t&&"body"!==t.nodeName.toLowerCase()&&V(t).trigger("blur")};V.widget("ui.draggable",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){(this.helper||this.element).is(".ui-draggable-dragging")?this.destroyOnClear=!0:(this._removeHandleClassName(),this._mouseDestroy())},_mouseCapture:function(t){var e=this.options;return!(this.helper||e.disabled||0<V(t.target).closest(".ui-resizable-handle").length)&&(this.handle=this._getHandle(t),!!this.handle&&(this._blurActiveElement(t),this._blockFrames(!0===e.iframeFix?"iframe":e.iframeFix),!0))},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=V(this);return V("<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 e=V.ui.safeActiveElement(this.document[0]);V(t.target).closest(e).length||V.ui.safeBlur(e)},_mouseStart:function(t){var e=this.options;return this.helper=this._createHelper(t),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),V.ui.ddmanager&&(V.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=0<this.helper.parents().filter(function(){return"fixed"===V(this).css("position")}).length,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this._setContainment(),!1===this._trigger("start",t)?(this._clear(),!1):(this._cacheHelperProportions(),V.ui.ddmanager&&!e.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),V.ui.ddmanager&&V.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(t,e){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!e){e=this._uiHash();if(!1===this._trigger("drag",t,e))return this._mouseUp(new V.Event("mouseup",t)),!1;this.position=e.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",V.ui.ddmanager&&V.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var e=this,i=!1;return V.ui.ddmanager&&!this.options.dropBehaviour&&(i=V.ui.ddmanager.drop(this,t)),this.dropped&&(i=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!i||"valid"===this.options.revert&&i||!0===this.options.revert||"function"==typeof this.options.revert&&this.options.revert.call(this.element,i)?V(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==e._trigger("stop",t)&&e._clear()}):!1!==this._trigger("stop",t)&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),V.ui.ddmanager&&V.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.trigger("focus"),V.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new V.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(t){return!this.options.handle||!!V(t.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(t){var e=this.options,i="function"==typeof e.helper,t=i?V(e.helper.apply(this.element[0],[t])):"clone"===e.helper?this.element.clone().removeAttr("id"):this.element;return t.parents("body").length||t.appendTo("parent"===e.appendTo?this.element[0].parentNode:e.appendTo),i&&t[0]===this.element[0]&&this._setPositionRelative(),t[0]===this.element[0]||/(fixed|absolute)/.test(t.css("position"))||t.css("position","absolute"),t},_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(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}: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(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),e=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==e&&V.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this._isRootNode(this.offsetParent[0])?{top:0,left:0}: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 t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e,i,s=this.options,n=this.document[0];this.relativeContainer=null,s.containment?"window"!==s.containment?"document"!==s.containment?s.containment.constructor!==Array?("parent"===s.containment&&(s.containment=this.helper[0].parentNode),(i=(e=V(s.containment))[0])&&(t=/(scroll|auto)/.test(e.css("overflow")),this.containment=[(parseInt(e.css("borderLeftWidth"),10)||0)+(parseInt(e.css("paddingLeft"),10)||0),(parseInt(e.css("borderTopWidth"),10)||0)+(parseInt(e.css("paddingTop"),10)||0),(t?Math.max(i.scrollWidth,i.offsetWidth):i.offsetWidth)-(parseInt(e.css("borderRightWidth"),10)||0)-(parseInt(e.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(i.scrollHeight,i.offsetHeight):i.offsetHeight)-(parseInt(e.css("borderBottomWidth"),10)||0)-(parseInt(e.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=e)):this.containment=s.containment:this.containment=[0,0,V(n).width()-this.helperProportions.width-this.margins.left,(V(n).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=[V(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,V(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,V(window).scrollLeft()+V(window).width()-this.helperProportions.width-this.margins.left,V(window).scrollTop()+(V(window).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=null},_convertPositionTo:function(t,e){e=e||this.position;var i="absolute"===t?1:-1,t=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:t?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:t?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s=this.options,n=this._isRootNode(this.scrollParent[0]),o=t.pageX,a=t.pageY;return n&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(i=this.relativeContainer?(i=this.relativeContainer.offset(),[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]):this.containment,t.pageX-this.offset.click.left<i[0]&&(o=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(a=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(o=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(a=i[3]+this.offset.click.top)),s.grid&&(t=s.grid[1]?this.originalPageY+Math.round((a-this.originalPageY)/s.grid[1])*s.grid[1]:this.originalPageY,a=!i||t-this.offset.click.top>=i[1]||t-this.offset.click.top>i[3]?t:t-this.offset.click.top>=i[1]?t-s.grid[1]:t+s.grid[1],t=s.grid[0]?this.originalPageX+Math.round((o-this.originalPageX)/s.grid[0])*s.grid[0]:this.originalPageX,o=!i||t-this.offset.click.left>=i[0]||t-this.offset.click.left>i[2]?t:t-this.offset.click.left>=i[0]?t-s.grid[0]:t+s.grid[0]),"y"===s.axis&&(o=this.originalPageX),"x"===s.axis&&(a=this.originalPageY)),{top:a
vendor: 6,471 bytes, line 12
12-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:n?0:this.offset.scroll.top),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:n?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(t,e,i){return i=i||this._uiHash(),V.ui.plugin.call(this,t,[e,i,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),i.offset=this.positionAbs),V.Widget.prototype._trigger.call(this,t,e,i)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),V.ui.plugin.add("draggable","connectToSortable",{start:function(e,t,i){var s=V.extend({},t,{item:i.element});i.sortables=[],V(i.options.connectToSortable).each(function(){var t=V(this).sortable("instance");t&&!t.options.disabled&&(i.sortables.push(t),t.refreshPositions(),t._trigger("activate",e,s))})},stop:function(e,t,i){var s=V.extend({},t,{item:i.element});i.cancelHelperRemoval=!1,V.each(i.sortables,function(){var t=this;t.isOver?(t.isOver=0,i.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,s))})},drag:function(i,s,n){V.each(n.sortables,function(){var t=!1,e=this;e.positionAbs=n.positionAbs,e.helperProportions=n.helperProportions,e.offset.click=n.offset.click,e._intersectsWith(e.containerCache)&&(t=!0,V.each(n.sortables,function(){return this.positionAbs=n.positionAbs,this.helperProportions=n.helperProportions,this.offset.click=n.offset.click,t=this!==e&&this._intersectsWith(this.containerCache)&&V.contains(e.element[0],this.element[0])?!1:t})),t?(e.isOver||(e.isOver=1,n._parent=s.helper.parent(),e.currentItem=s.helper.appendTo(e.element).data("ui-sortable-item",!0),e.options._helper=e.options.helper,e.options.helper=function(){return s.helper[0]},i.target=e.currentItem[0],e._mouseCapture(i,!0),e._mouseStart(i,!0,!0),e.offset.click.top=n.offset.click.top,e.offset.click.left=n.offset.click.left,e.offset.parent.left-=n.offset.parent.left-e.offset.parent.left,e.offset.parent.top-=n.offset.parent.top-e.offset.parent.top,n._trigger("toSortable",i),n.dropped=e.element,V.each(n.sortables,function(){this.refreshPositions()}),n.currentItem=n.element,e.fromOutside=n),e.currentItem&&(e._mouseDrag(i),s.position=e.position)):e.isOver&&(e.isOver=0,e.cancelHelperRemoval=!0,e.options._revert=e.options.revert,e.options.revert=!1,e._trigger("out",i,e._uiHash(e)),e._mouseStop(i,!0),e.options.revert=e.options._revert,e.options.helper=e.options._helper,e.placeholder&&e.placeholder.remove(),s.helper.appendTo(n._parent),n._refreshOffsets(i),s.position=n._generatePosition(i,!0),n._trigger("fromSortable",i),n.dropped=!1,V.each(n.sortables,function(){this.refreshPositions()}))})}}),V.ui.plugin.add("draggable","cursor",{start:function(t,e,i){var s=V("body"),i=i.options;s.css("cursor")&&(i._cursor=s.css("cursor")),s.css("cursor",i.cursor)},stop:function(t,e,i){i=i.options;i._cursor&&V("body").css("cursor",i._cursor)}}),V.ui.plugin.add("draggable","opacity",{start:function(t,e,i){e=V(e.helper),i=i.options;e.css("opacity")&&(i._opacity=e.css("opacity")),e.css("opacity",i.opacity)},stop:function(t,e,i){i=i.options;i._opacity&&V(e.helper).css("opacity",i._opacity)}}),V.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,e,i){var s=i.options,n=!1,o=i.scrollParentNotHidden[0],a=i.document[0];o!==a&&"HTML"!==o.tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+o.offsetHeight-t.pageY<s.scrollSensitivity?o.scrollTop=n=o.scrollTop+s.scrollSpeed:t.pageY-i.overflowOffset.top<s.scrollSensitivity&&(o.scrollTop=n=o.scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+o.offsetWidth-t.pageX<s.scrollSensitivity?o.scrollLeft=n=o.scrollLeft+s.scrollSpeed:t.pageX-i.overflowOffset.left<s.scrollSensitivity&&(o.scrollLeft=n=o.scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(t.pageY-V(a).scrollTop()<s.scrollSensitivity?n=V(a).scrollTop(V(a).scrollTop()-s.scrollSpeed):V(window).height()-(t.pageY-V(a).scrollTop())<s.scrollSensitivity&&(n=V(a).scrollTop(V(a).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(t.pageX-V(a).scrollLeft()<s.scrollSensitivity?n=V(a).scrollLeft(V(a).scrollLeft()-s.scrollSpeed):V(window).width()-(t.pageX-V(a).scrollLeft())<s.scrollSensitivity&&(n=V(a).scrollLeft(V(a).scrollLeft()+s.scrollSpeed)))),!1!==n&&V.ui.ddmanager&&!s.dropBehaviour&&V.ui.ddmanager.prepareOffsets(i,t)}}),V.ui.plugin.add("draggable","snap",{start:function(t,e,i){var s=i.options;i.snapElements=[],V(s.snap.constructor!==String?s.snap.items||":data(ui-draggable)":s.snap).each(function(){var t=V(this),e=t.offset();this!==i.element[0]&&i.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:e.top,left:e.left})})},drag:function(t,e,i){for(var s,n,o,a,r,l,h,c,u,d=i.options,p=d.snapTolerance,f=e.offset.left,g=f+i.helperProportions.width,m=e.offset.top,_=m+i.helperProportions.height,v=i.snapElements.length-1;0<=v;v--)l=(r=i.snapElements[v].left-i.margins.left)+i.snapElements[v].width,c=(h=i.snapElements[v].top-i.margins.top)+i.snapElements[v].height,g<r-p||l+p<f||_<h-p||c+p<m||!V.contains(i.snapElements[v].item.ownerDocument,i.snapElements[v].item)?(i.snapElements[v].snapping&&i.options.snap.release&&i.options.snap.release.call(i.element,t,V.extend(i._uiHash(),{snapItem:i.snapElements[v].item})),i.snapElements[v].snapping=!1):("inner"!==d.snapMode&&(s=Math.abs(h-_)<=p,n=Math.abs(c-m)<=p,o=Math.abs(r-g)<=p,a=Math.abs(l-f)<=p,s&&(e.position.top=i._convertPositionTo("relative",{top:h-i.helperProportions.height,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r-i.helperProportions.width}).left),a
vendor: 9,875 bytes, line 12
12&&(e.position.left=i._convertPositionTo("relative",{top:0,left:l}).left)),u=s||n||o||a,"outer"!==d.snapMode&&(s=Math.abs(h-m)<=p,n=Math.abs(c-_)<=p,o=Math.abs(r-f)<=p,a=Math.abs(l-g)<=p,s&&(e.position.top=i._convertPositionTo("relative",{top:h,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c-i.helperProportions.height,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r}).left),a&&(e.position.left=i._convertPositionTo("relative",{top:0,left:l-i.helperProportions.width}).left)),!i.snapElements[v].snapping&&(s||n||o||a||u)&&i.options.snap.snap&&i.options.snap.snap.call(i.element,t,V.extend(i._uiHash(),{snapItem:i.snapElements[v].item})),i.snapElements[v].snapping=s||n||o||a||u)}}),V.ui.plugin.add("draggable","stack",{start:function(t,e,i){var s,i=i.options,i=V.makeArray(V(i.stack)).sort(function(t,e){return(parseInt(V(t).css("zIndex"),10)||0)-(parseInt(V(e).css("zIndex"),10)||0)});i.length&&(s=parseInt(V(i[0]).css("zIndex"),10)||0,V(i).each(function(t){V(this).css("zIndex",s+t)}),this.css("zIndex",s+i.length))}}),V.ui.plugin.add("draggable","zIndex",{start:function(t,e,i){e=V(e.helper),i=i.options;e.css("zIndex")&&(i._zIndex=e.css("zIndex")),e.css("zIndex",i.zIndex)},stop:function(t,e,i){i=i.options;i._zIndex&&V(e.helper).css("zIndex",i._zIndex)}});V.ui.draggable;V.widget("ui.resizable",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(t,e){if("hidden"===V(t).css("overflow"))return!1;var i=e&&"left"===e?"scrollLeft":"scrollTop",e=!1;if(0<t[i])return!0;try{t[i]=1,e=0<t[i],t[i]=0}catch(t){}return e},_create:function(){var t,e=this.options,i=this;this._addClass("ui-resizable"),V.extend(this,{_aspectRatio:!!e.aspectRatio,aspectRatio:e.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:e.helper||e.ghost||e.animate?e.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(V("<div class='ui-wrapper'></div>").css({overflow:"hidden",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,t={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(t),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(t),this._proportionallyResize()),this._setupHandles(),e.autoHide&&V(this.element).on("mouseenter",function(){e.disabled||(i._removeClass("ui-resizable-autohide"),i._handles.show())}).on("mouseleave",function(){e.disabled||i.resizing||(i._addClass("ui-resizable-autohide"),i._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy(),this._addedHandles.remove();function t(t){V(t).removeData("resizable").removeData("ui-resizable").off(".resizable")}var e;return this.elementIsWrapper&&(t(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;case"aspectRatio":this._aspectRatio=!!e}},_setupHandles:function(){var t,e,i,s,n,o=this.options,a=this;if(this.handles=o.handles||(V(".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=V(),this._addedHandles=V(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),i=this.handles.split(","),this.handles={},e=0;e<i.length;e++)s="ui-resizable-"+(t=String.prototype.trim.call(i[e])),n=V("<div>"),this._addClass(n,"ui-resizable-handle "+s),n.css({zIndex:o.zIndex}),this.handles[t]=".ui-resizable-"+t,this.element.children(this.handles[t]).length||(this.element.append(n),this._addedHandles=this._addedHandles.add(n));this._renderAxis=function(t){var e,i,s;for(e in t=t||this.element,this.handles)this.handles[e].constructor===String?this.handles[e]=this.element.children(this.handles[e]).first().show():(this.handles[e].jquery||this.handles[e].nodeType)&&(this.handles[e]=V(this.handles[e]),this._on(this.handles[e],{mousedown:a._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(i=V(this.handles[e],this.element),s=/sw|ne|nw|se|n|s/.test(e)?i.outerHeight():i.outerWidth(),i=["padding",/ne|nw|n/.test(e)?"Top":/se|sw|s/.test(e)?"Bottom":/^e$/.test(e)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),this._handles=this._handles.add(this.handles[e])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){a.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),a.axis=n&&n[1]?n[1]:"se")}),o.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._addedHandles.remove()},_mouseCapture:function(t){var e,i,s=!1;for(e in this.handles)(i=V(this.handles[e])[0])!==t.target&&!V.contains(i,t.target)||(s=!0);return!this.options.disabled&&s},_mouseStart:function(t){var e,i,s=this.options,n=this.element;return this.resizing=!0,this._renderProxy(),e=this._num(this.helper.css("left")),i=this._num(this.helper.css("top")),s.containment&&(e+=V(s.containment).scrollLeft()||0,i+=V(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:e,top:i},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:n.width(),height:n.height()},this.originalSize=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:n.width(),height:n.height()},this.sizeDiff={width:n.outerWidth()-n.width(),height:n.outerHeight()-n.height()},this.originalPosition={left:e,top:i},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=V(".ui-resizable-"+this.axis).css("cursor"),V("body").css("cursor","auto"===s?this.axis+"-resize":s),this._addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var e=this.originalMousePosition,i=this.axis,s=t.pageX-e.left||0,e=t.pageY-e.top||0,i=this._change[i];return this._updatePrevProperties(),i&&(e=i.apply(this,[t,s,e]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(e=this._updateRatio(e,t)),e=this._respectSize(e,t),this._updateCache(e),this._propagate("resize",t),e=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),V.isEmptyObject(e)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges())),!1},_mouseStop:function(t){this.resizing=!1;var e,i,s,n=this.options,o=this;return this._helper&&(s=(e=(i=this._proportionallyResizeElements).length&&/textarea/i.test(i[0].nodeName))&&this._hasScroll(i[0],"left")?0:o.sizeDiff.height,i=e?0:o.sizeDiff.width,e={width:o.helper.width()-i,height:o.helper.height()-s},i=parseFloat(o.element.css("left"))+(o.position.left-o.originalPosition.left)||null,s=parseFloat(o.element.css("top"))+(o.position.top-o.originalPosition.top)||null,n.animate||this.element.css(V.extend(e,{top:s,left:i})),o.helper.height(o.size.height),o.helper.width(o.size.width),this._helper&&!n.animate&&this._proportionallyResize()),V("body").css("cursor","auto"),this._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 t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s=this.options,n={minWidth:this._isNumber(s.minWidth)?s.minWidth:0,maxWidth:this._isNumber(s.maxWidth)?s.maxWidth:1/0,minHeight:this._isNumber(s.minHeight)?s.minHeight:0,maxHeight:this._isNumber(s.maxHeight)?s.maxHeight:1/0};(this._aspectRatio||t)&&(e=n.minHeight*this.aspectRatio,i=n.minWidth/this.aspectRatio,s=n.maxHeight*this.aspectRatio,t=n.maxWidth/this.aspectRatio,e>n.minWidth&&(n.minWidth=e),i>n.minHeight&&(n.minHeight=i),s<n.maxWidth&&(n.maxWidth=s),t<n.maxHeight&&(n.maxHeight=t)),this._vBoundaries=n},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left
vendor: 5,511 bytes, line 12
12=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,h=/sw|nw|w/.test(i),i=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=r-e.minWidth),s&&h&&(t.left=r-e.maxWidth),a&&i&&(t.top=l-e.minHeight),n&&i&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];e<4;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;e<this._proportionallyResizeElements.length;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,e=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||V("<div></div>").css({overflow:"hidden"}),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++e.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(t,e,i){return V.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},sw:function(t,e,i){return V.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,e,i]))},ne:function(t,e,i){return V.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},nw:function(t,e,i){return V.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,e,i]))}},_propagate:function(t,e){V.ui.plugin.call(this,t,[e,this.ui()]),"resize"!==t&&this._trigger(t,e,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}}}),V.ui.plugin.add("resizable","animate",{stop:function(e){var i=V(this).resizable("instance"),t=i.options,s=i._proportionallyResizeElements,n=s.length&&/textarea/i.test(s[0].nodeName),o=n&&i._hasScroll(s[0],"left")?0:i.sizeDiff.height,a=n?0:i.sizeDiff.width,n={width:i.size.width-a,height:i.size.height-o},a=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,o=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(V.extend(n,o&&a?{top:o,left:a}:{}),{duration:t.animateDuration,easing:t.animateEasing,step:function(){var t={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};s&&s.length&&V(s[0]).css({width:t.width,height:t.height}),i._updateCache(t),i._propagate("resize",e)}})}}),V.ui.plugin.add("resizable","containment",{start:function(){var i,s,n=V(this).resizable("instance"),t=n.options,e=n.element,o=t.containment,a=o instanceof V?o.get(0):/parent/.test(o)?e.parent().get(0):o;a&&(n.containerElement=V(a),/document/.test(o)||o===document?(n.containerOffset={left:0,top:0},n.containerPosition={left:0,top:0},n.parentData={element:V(document),left:0,top:0,width:V(document).width(),height:V(document).height()||document.body.parentNode.scrollHeight}):(i=V(a),s=[],V(["Top","Right","Left","Bottom"]).each(function(t,e){s[t]=n._num(i.css("padding"+e))}),n.containerOffset=i.offset(),n.containerPosition=i.position(),n.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},t=n.containerOffset,e=n.containerSize.height,o=n.containerSize.width,o=n._hasScroll(a,"left")?a.scrollWidth:o,e=n._hasScroll(a)?a.scrollHeight:e,n.parentData={element:a,left:t.left,top:t.top,width:o,height:e}))},resize:function(t){var e=V(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.position,o=e._aspectRatio||t.shiftKey,a={top:0,left:0}
vendor: 22,744 bytes, line 12
12,r=e.containerElement,t=!0;r[0]!==document&&/static/.test(r.css("position"))&&(a=s),n.left<(e._helper?s.left:0)&&(e.size.width=e.size.width+(e._helper?e.position.left-s.left:e.position.left-a.left),o&&(e.size.height=e.size.width/e.aspectRatio,t=!1),e.position.left=i.helper?s.left:0),n.top<(e._helper?s.top:0)&&(e.size.height=e.size.height+(e._helper?e.position.top-s.top:e.position.top),o&&(e.size.width=e.size.height*e.aspectRatio,t=!1),e.position.top=e._helper?s.top:0),i=e.containerElement.get(0)===e.element.parent().get(0),n=/relative|absolute/.test(e.containerElement.css("position")),i&&n?(e.offset.left=e.parentData.left+e.position.left,e.offset.top=e.parentData.top+e.position.top):(e.offset.left=e.element.offset().left,e.offset.top=e.element.offset().top),n=Math.abs(e.sizeDiff.width+(e._helper?e.offset.left-a.left:e.offset.left-s.left)),s=Math.abs(e.sizeDiff.height+(e._helper?e.offset.top-a.top:e.offset.top-s.top)),n+e.size.width>=e.parentData.width&&(e.size.width=e.parentData.width-n,o&&(e.size.height=e.size.width/e.aspectRatio,t=!1)),s+e.size.height>=e.parentData.height&&(e.size.height=e.parentData.height-s,o&&(e.size.width=e.size.height*e.aspectRatio,t=!1)),t||(e.position.left=e.prevPosition.left,e.position.top=e.prevPosition.top,e.size.width=e.prevSize.width,e.size.height=e.prevSize.height)},stop:function(){var t=V(this).resizable("instance"),e=t.options,i=t.containerOffset,s=t.containerPosition,n=t.containerElement,o=V(t.helper),a=o.offset(),r=o.outerWidth()-t.sizeDiff.width,o=o.outerHeight()-t.sizeDiff.height;t._helper&&!e.animate&&/relative/.test(n.css("position"))&&V(this).css({left:a.left-s.left-i.left,width:r,height:o}),t._helper&&!e.animate&&/static/.test(n.css("position"))&&V(this).css({left:a.left-s.left-i.left,width:r,height:o})}}),V.ui.plugin.add("resizable","alsoResize",{start:function(){var t=V(this).resizable("instance").options;V(t.alsoResize).each(function(){var t=V(this);t.data("ui-resizable-alsoresize",{width:parseFloat(t.width()),height:parseFloat(t.height()),left:parseFloat(t.css("left")),top:parseFloat(t.css("top"))})})},resize:function(t,i){var e=V(this).resizable("instance"),s=e.options,n=e.originalSize,o=e.originalPosition,a={height:e.size.height-n.height||0,width:e.size.width-n.width||0,top:e.position.top-o.top||0,left:e.position.left-o.left||0};V(s.alsoResize).each(function(){var t=V(this),s=V(this).data("ui-resizable-alsoresize"),n={},e=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];V.each(e,function(t,e){var i=(s[e]||0)+(a[e]||0);i&&0<=i&&(n[e]=i||null)}),t.css(n)})},stop:function(){V(this).removeData("ui-resizable-alsoresize")}}),V.ui.plugin.add("resizable","ghost",{start:function(){var t=V(this).resizable("instance"),e=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}),t._addClass(t.ghost,"ui-resizable-ghost"),!1!==V.uiBackCompat&&"string"==typeof t.options.ghost&&t.ghost.addClass(this.options.ghost),t.ghost.appendTo(t.helper)},resize:function(){var t=V(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=V(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),V.ui.plugin.add("resizable","grid",{resize:function(){var t,e=V(this).resizable("instance"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,a=e.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,l=r[0]||1,h=r[1]||1,c=Math.round((s.width-n.width)/l)*l,u=Math.round((s.height-n.height)/h)*h,d=n.width+c,p=n.height+u,f=i.maxWidth&&i.maxWidth<d,g=i.maxHeight&&i.maxHeight<p,m=i.minWidth&&i.minWidth>d,s=i.minHeight&&i.minHeight>p;i.grid=r,m&&(d+=l),s&&(p+=h),f&&(d-=l),g&&(p-=h),/^(se|s|e)$/.test(a)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.top=o.top-u):/^(sw)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.left=o.left-c):((p-h<=0||d-l<=0)&&(t=e._getPaddingPlusBorderDimensions(this)),0<p-h?(e.size.height=p,e.position.top=o.top-u):(p=h-t.height,e.size.height=p,e.position.top=o.top+n.height-p),0<d-l?(e.size.width=d,e.position.left=o.left-c):(d=l-t.width,e.size.width=d,e.position.left=o.left+n.width-d))}});V.ui.resizable;V.widget("ui.dialog",{version:"1.13.2",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var e=V(this).css(t).offset().top;e<0&&V(this).css("top",t.top-e)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&V.fn.draggable&&this._makeDraggable(),this.options.resizable&&V.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)?V(t):this.document.find(t||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),(t=e.parent.children().eq(e.index)).length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog},disable:V.noop,enable:V.noop,close:function(t){var e=this;this._isOpen&&!1!==this._trigger("beforeClose",t)&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||V.ui.safeBlur(V.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){e._trigger("close",t)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,e){var i=!1,s=this.uiDialog.siblings(".ui-front:visible").map(function(){return+V(this).css("z-index")}).get(),s=Math.max.apply(null,s);return s>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",s+1),i=!0),i&&!e&&this._trigger("focus",t),i},open:function(){var t=this;this._isOpen?this._moveToTop()&&this._focusTabbable():(this._isOpen=!0,this.opener=V(V.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"))},_focusTabbable:function(){var t=this._focusedElement;(t=!(t=!(t=!(t=!(t=t||this.element.find("[autofocus]")).length?this.element.find(":tabbable"):t).length?this.uiDialogButtonPane.find(":tabbable"):t).length?this.uiDialogTitlebarClose.filter(":tabbable"):t).length?this.uiDialog:t).eq(0).trigger("focus")},_restoreTabbableFocus:function(){var t=V.ui.safeActiveElement(this.document[0]);this.uiDialog[0]===t||V.contains(this.uiDialog[0],t)||this._focusTabbable()},_keepFocus:function(t){t.preventDefault(),this._restoreTabbableFocus(),this._delay(this._restoreTabbableFocus)},_createWrapper:function(){this.uiDialog=V("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===V.ui.keyCode.ESCAPE)return t.preventDefault(),void this.close(t);var e,i,s;t.keyCode!==V.ui.keyCode.TAB||t.isDefaultPrevented()||(e=this.uiDialog.find(":tabbable"),i=e.first(),s=e.last(),t.target!==s[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==i[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){s.trigger("focus")}),t.preventDefault()):(this._delay(function(){i.trigger("focus")}),t.preventDefault()))},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=V("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(t){V(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=V("<button type='button'></button>").button({label:V("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),t=V("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(t,"ui-dialog-title"),this._title(t),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html("&#160;")},_createButtonPane:function(){this.uiDialogButtonPane=V("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=V("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var s=this,t=this.options.buttons;this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),V.isEmptyObject(t)||Array.isArray(t)&&!t.length?this._removeClass(this.uiDialog,"ui-dialog-buttons"):(V.each(t,function(t,e){var i;e=V.extend({type:"button"},e="function"==typeof e?{click:e,text:t}:e),i=e.click,t={icon:e.icon,iconPosition:e.iconPosition,showLabel:e.showLabel,icons:e.icons,text:e.text},delete e.click,delete e.icon,delete e.iconPosition,delete e.showLabel,delete e.icons,"boolean"==typeof e.text&&delete e.text,V("<button></button>",e).button(t).appendTo(s.uiButtonSet).on("click",function(){i.apply(s.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog))},_makeDraggable:function(){var n=this,o=this.options;function a(t){return{position:t.position,offset:t.offset}}this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(t,e){n._addClass(V(this),"ui-dialog-dragging"),n._blockFrames(),n._trigger("dragStart",t,a(e))},drag:function(t,e){n._trigger("drag",t,a(e))},stop:function(t,e){var i=e.offset.left-n.document.scrollLeft(),s=e.offset.top-n.document.scrollTop();o.position={my:"left top",at:"left"+(0<=i?"+":"")+i+" top"+(0<=s?"+":"")+s,of:n.window},n._removeClass(V(this),"ui-dialog-dragging"),n._unblockFrames(),n._trigger("dragStop",t,a(e))}})},_makeResizable:function(){var n=this,o=this.options,t=o.resizable,e=this.uiDialog.css("position"),t="string"==typeof t?t:"n,e,s,w,se,sw,ne,nw";function a(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:o.maxWidth,maxHeight:o.maxHeight,minWidth:o.minWidth,minHeight:this._minHeight(),handles:t,start:function(t,e){n._addClass(V(this),"ui-dialog-resizing"),n._blockFrames(),n._trigger("resizeStart",t,a(e))},resize:function(t,e){n._trigger("resize",t,a(e))},stop:function(t,e){var i=n.uiDialog.offset(),s=i.left-n.document.scrollLeft(),i=i.top-n.document.scrollTop();o.height=n.uiDialog.height(),o.width=n.uiDialog.width(),o.position={my:"left top",at:"left"+(0<=s?"+":"")+s+" top"+(0<=i?"+":"")+i,of:n.window},n._removeClass(V(this),"ui-dialog-resizing"),n._unblockFrames(),n._trigger("resizeStop",t,a(e))}}).css("position",e)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=V(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),e=V.inArray(this,t);-1!==e&&t.splice(e,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||this.document.data("ui-dialog-instances",t=[]),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};V.each(t,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(t,e){var i,s=this.uiDialog;"disabled"!==t&&(this._super(t,e),"appendTo"===t&&this.uiDialog.appendTo(this._appendTo()),"buttons"===t&&this._createButtons(),"closeText"===t&&this.uiDialogTitlebarClose.button({label:V("<a>").text(""+this.options.closeText).html()}),"draggable"===t&&((i=s.is(":data(ui-draggable)"))&&!e&&s.draggable("destroy"),!i&&e&&this._makeDraggable()),"position"===t&&this._position(),"resizable"===t&&((i=s.is(":data(ui-resizable)"))&&!e&&s.resizable("destroy"),i&&"string"==typeof e&&s.resizable("option","handles",e),i||!1===e||this._makeResizable()),"title"===t&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=V(this);return V("<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!!V(t.target).closest(".ui-dialog").length||!!V(t.target).closest(".ui-datepicker").length},_createOverlay:function(){var i,s;this.options.modal&&(i=V.fn.jquery.substring(0,4),s=!0,this._delay(function(){s=!1}),this.document.data("ui-dialog-overlays")||this.document.on("focusin.ui-dialog",function(t){var e;s||((e=this._trackingInstances()[0])._allowInteraction(t)||(t.preventDefault(),e._focusTabbable(),"3.4."!==i&&"3.5."!==i||e._delay(e._restoreTabbableFocus)))}.bind(this)),this.overlay=V("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1))},_destroyOverlay:function(){var t;this.options.modal&&this.overlay&&((t=this.document.data("ui-dialog-overlays")-1)?this.document.data("ui-dialog-overlays",t):(this.document.off("focusin.ui-dialog"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null)}}),!1!==V.uiBackCompat&&V.widget("ui.dialog",V.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}});V.ui.dialog;function lt(t,e,i){return e<=t&&t<e+i}V.widget("ui.droppable",{version:"1.13.2",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,e=this.options,i=e.accept;this.isover=!1,this.isout=!0,this.accept="function"==typeof i?i:function(t){return t.is(i)},this.proportions=function(){if(!arguments.length)return t=t||{width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};t=arguments[0]},this._addToManager(e.scope),e.addClasses&&this._addClass("ui-droppable")},_addToManager:function(t){V.ui.ddmanager.droppables[t]=V.ui.ddmanager.droppables[t]||[],V.ui.ddmanager.droppables[t].push(this)},_splice:function(t){for(var e=0;e<t.length;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var t=V.ui.ddmanager.droppables[this.options.scope];this._splice(t)},_setOption:function(t,e){var i;"accept"===t?this.accept="function"==typeof e?e:function(t){return t.is(e)}:"scope"===t&&(i=V.ui.ddmanager.droppables[this.options.scope],this._splice(i),this._addToManager(e)),this._super(t,e)},_activate:function(t){var e=V.ui.ddmanager.current;this._addActiveClass(),e&&this._trigger("activate",t,this.ui(e))},_deactivate:function(t){var e=V.ui.ddmanager.current;this._removeActiveClass(),e&&this._trigger("deactivate",t,this.ui(e))},_over:function(t){var e=V.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this._addHoverClass(),this._trigger("over",t,this.ui(e)))},_out:function(t){var e=V.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this._removeHoverClass(),this._trigger("out",t,this.ui(e)))},_drop:function(e,t){var i=t||V.ui.ddmanager.current,s=!1;return!(!i||(i.currentItem||i.element)[0]===this.element[0])&&(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=V(this).droppable("instance");if(t.options.greedy&&!t.options.disabled&&t.options.scope===i.options.scope&&t.accept.call(t.element[0],i.currentItem||i.element)&&V.ui.intersect(i,V.extend(t,{offset:t.element.offset()}),t.options.tolerance,e))return!(s=!0)}),!s&&(!!this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(i)),this.element)))},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}}),V.ui.intersect=function(t,e,i,s){if(!e.offset)return!1;var n=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,a=n+t.helperProportions.width,r=o+t.helperProportions.height,l=e.offset.left,h=e.offset.top,c=l+e.proportions().width,u=h+e.proportions().height;switch(i){case"fit":return l<=n&&a<=c&&h<=o&&r<=u;case"intersect":return l<n+t.helperProportions.width/2&&a-t.helperProportions.width/2<c&&h<o+t.helperProportions.height/2&&r-t.helperProportions.height/2<u;case"pointer":return lt(s.pageY,h,e.proportions().height)&&lt(s.pageX,l,e.proportions().width);case"touch":return(h<=o&&o<=u||h<=r&&r<=u||o<h&&u<r)&&(l<=n&&n<=c||l<=a&&a<=c||n<l&&c<a);default:return!1}},!(V.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:function(t,e){var i,s,n=V.ui.ddmanager.droppables[t.options.scope]||[],o=e?e.type:null,a=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();t:for(i=0;i<n.length;i++)if(!(n[i].options.disabled||t&&!n[i].accept.call(n[i].element[0],t.currentItem||t.element))){for(s=0;s<a.length;s++)if(a[s]===n[i].element[0]){n[i].proportions().height=0;continue t}n[i].visible="none"!==n[i].element.css("display"),n[i].visible&&("mousedown"===o&&n[i]._activate.call(n[i],e),n[i].offset=n[i].element.offset(),n[i].proportions({width:n[i].element[0].offsetWidth,height:n[i].element[0].offsetHeight}))}},drop:function(t,e){var i=!1;return V.each((V.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&V.ui.intersect(t,this,this.options.tolerance,e)&&(i=this._drop.call(this,e)||i),!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,e)))}),i},dragStart:function(t,e){t.element.parentsUntil("body").on("scroll.droppable",function(){t.options.refreshPositions||V.ui.ddmanager.prepareOffsets(t,e)})},drag:function(n,o){n.options.refreshPositions&&V.ui.ddmanager.prepareOffsets(n,o),V.each(V.ui.ddmanager.droppables[n.options.scope]||[],function(){var t,e,i,s;this.options.disabled||this.greedyChild||!this.visible||(s=!(i=V.ui.intersect(n,this,this.options.tolerance,o))&&this.isover?"isout":i&&!this.isover?"isover":null)&&(this.options.greedy&&(e=this.options.scope,(i=this.element.parents(":data(ui-droppable)").filter(function(){return V(this).droppable("instance").options.scope===e})).length&&((t=V(i[0]).droppable("instance")).greedyChild="isover"===s)),t&&"isover"===s&&(t.isover=!1,t.isout=!0,t._out.call(t,o)),this[s]=!0,this["isout"===s?"isover":"isout"]=!1,this["isover"===s?"_over":"_out"].call(this,o),t&&"isout"===s&&(t.isout=!1,t.isover=!0,t._over.call(t,o)))})},dragStop:function(t,e){t.element.parentsUntil("body").off("scroll.droppable"),t.options.refreshPositions||V.ui.ddmanager.prepareOffsets(t,e)}})!==V.uiBackCompat&&V.widget("ui.droppable",V.ui.droppable,{options:{hoverClass:!1,activeClass:!1}
vendor: 4,941 bytes, line 12
12,_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}});V.ui.droppable,V.widget("ui.progressbar",{version:"1.13.2",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=V("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){if(void 0===t)return this.options.value;this.options.value=this._constrainedValue(t),this._refreshValue()},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=!1===t,"number"!=typeof t&&(t=0),!this.indeterminate&&Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,e=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).width(e.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,t===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=V("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(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")}}),V.widget("ui.selectable",V.ui.mouse,{version:"1.13.2",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 i=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){i.elementPos=V(i.element[0]).offset(),i.selectees=V(i.options.filter,i.element[0]),i._addClass(i.selectees,"ui-selectee"),i.selectees.each(function(){var t=V(this),e=t.offset(),e={left:e.left-i.elementPos.left,top:e.top-i.elementPos.top};V.data(this,"selectable-item",{element:this,$element:t,left:e.left,top:e.top,right:e.left+t.outerWidth(),bottom:e.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=V("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(i){var s=this,t=this.options;this.opos=[i.pageX,i.pageY],this.elementPos=V(this.element[0]).offset(),this.options.disabled||(this.selectees=V(t.filter,this.element[0]),this._trigger("start",i),V(t.appendTo).append(this.helper),this.helper.css({left:i.pageX,top:i.pageY,width:0,height:0}),t.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var t=V.data(this,"selectable-item");t.startselected=!0,i.metaKey||i.ctrlKey||(s._removeClass(t.$element,"ui-selected"),t.selected=!1,s._addClass(t.$element,"ui-unselecting"),t.unselecting=!0,s._trigger("unselecting",i,{unselecting:t.element}))}),V(i.target).parents().addBack().each(function(){var t,e=V.data(this,"selectable-item");if(e)return t=!i.metaKey&&!i.ctrlKey||!e.$element.hasClass("ui-selected"),s._removeClass(e.$element,t?"ui-unselecting":"ui-selected")._addClass(e.$element,t?"ui-selecting":"ui-unselecting"),e.unselecting=!t,e.selecting=t,(e.selected=t)?s._trigger("selecting",i,{selecting:e.element}):s._trigger("unselecting",i,{unselecting:e.element}),!1}))},_mouseDrag:function(s){if(this.dragged=!0,!this.options.disabled){var t,n=this,o=this.options,a=this.opos[0],r=this.opos[1],l=s.pageX,h=s.pageY;
vendor: 6,948 bytes, line 12
12return l<a&&(t=l,l=a,a=t),h<r&&(t=h,h=r,r=t),this.helper.css({left:a,top:r,width:l-a,height:h-r}),this.selectees.each(function(){var t=V.data(this,"selectable-item"),e=!1,i={};t&&t.element!==n.element[0]&&(i.left=t.left+n.elementPos.left,i.right=t.right+n.elementPos.left,i.top=t.top+n.elementPos.top,i.bottom=t.bottom+n.elementPos.top,"touch"===o.tolerance?e=!(i.left>l||i.right<a||i.top>h||i.bottom<r):"fit"===o.tolerance&&(e=i.left>a&&i.right<l&&i.top>r&&i.bottom<h),e?(t.selected&&(n._removeClass(t.$element,"ui-selected"),t.selected=!1),t.unselecting&&(n._removeClass(t.$element,"ui-unselecting"),t.unselecting=!1),t.selecting||(n._addClass(t.$element,"ui-selecting"),t.selecting=!0,n._trigger("selecting",s,{selecting:t.element}))):(t.selecting&&((s.metaKey||s.ctrlKey)&&t.startselected?(n._removeClass(t.$element,"ui-selecting"),t.selecting=!1,n._addClass(t.$element,"ui-selected"),t.selected=!0):(n._removeClass(t.$element,"ui-selecting"),t.selecting=!1,t.startselected&&(n._addClass(t.$element,"ui-unselecting"),t.unselecting=!0),n._trigger("unselecting",s,{unselecting:t.element}))),t.selected&&(s.metaKey||s.ctrlKey||t.startselected||(n._removeClass(t.$element,"ui-selected"),t.selected=!1,n._addClass(t.$element,"ui-unselecting"),t.unselecting=!0,n._trigger("unselecting",s,{unselecting:t.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,V(".ui-unselecting",this.element[0]).each(function(){var t=V.data(this,"selectable-item");i._removeClass(t.$element,"ui-unselecting"),t.unselecting=!1,t.startselected=!1,i._trigger("unselected",e,{unselected:t.element})}),V(".ui-selecting",this.element[0]).each(function(){var t=V.data(this,"selectable-item");i._removeClass(t.$element,"ui-selecting")._addClass(t.$element,"ui-selected"),t.selecting=!1,t.selected=!0,t.startselected=!0,i._trigger("selected",e,{selected:t.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),V.widget("ui.selectmenu",[V.ui.formResetMixin,{version:"1.13.2",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var t=this.element.uniqueId().attr("id");this.ids={element:t,button:t+"-button",menu:t+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=V()},_drawButton:function(){var t,e=this,i=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.trigger("focus"),t.preventDefault()}}),this.element.hide(),this.button=V("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),t=V("<span>").appendTo(this.button),this._addClass(t,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(i).appendTo(this.button),!1!==this.options.width&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){e._rendered||e._refreshMenu()})},_drawMenu:function(){var i=this;this.menu=V("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=V("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,e){t.preventDefault(),i._setSelection(),i._select(e.item.data("ui-selectmenu-item"),t)},focus:function(t,e){e=e.item.data("ui-selectmenu-item");null!=i.focusIndex&&e.index!==i.focusIndex&&(i._trigger("focus",t,{item:e}),i.isOpen||i._select(e,t)),i.focusIndex=e.index,i.button.attr("aria-activedescendant",i.menuItems.eq(e.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t=this.element.find("option");this.menu.empty(),this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,t.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(V.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(t){var e=V("<span>");return this._setText(e,t.label),this._addClass(e,"ui-selectmenu-text"),e},_renderMenu:function(s,t){var n=this,o="";V.each(t,function(t,e){var i;e.optgroup!==o&&(i=V("<li>",{text:e.optgroup}),n._addClass(i,"ui-selectmenu-optgroup","ui-menu-divider"+(e.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),i.appendTo(s),o=e.optgroup),n._renderItemData(s,e)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(t,e){var i=V("<li>"),s=V("<div>",{title:e.element.attr("title")});return e.disabled&&this._addClass(i,null,"ui-state-disabled"),this._setText(s,e.label),i.append(s).appendTo(t)},_setText:function(t,e){e?t.text(e):t.html("&#160;")},_move:function(t,e){var i,s=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),s+=":not(.ui-state-disabled)"),(s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](s).eq(-1):i[t+"All"](s).eq(0)).length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")}
vendor: 4,336 bytes, line 12
12,_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?((t=window.getSelection()).removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.trigger("focus"))},_documentClick:{mousedown:function(t){this.isOpen&&(V(t.target).closest(".ui-selectmenu-menu, #"+V.escapeSelector(this.ids.button)).length||this.close(t))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection()).rangeCount&&(this.range=t.getRangeAt(0)):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(t){var e=!0;switch(t.keyCode){case V.ui.keyCode.TAB:case V.ui.keyCode.ESCAPE:this.close(t),e=!1;break;case V.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case V.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case V.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case V.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case V.ui.keyCode.LEFT:this._move("prev",t);break;case V.ui.keyCode.RIGHT:this._move("next",t);break;case V.ui.keyCode.HOME:case V.ui.keyCode.PAGE_UP:this._move("first",t);break;case V.ui.keyCode.END:case V.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),e=!1}e&&t.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){t=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(t,e){var i;"icons"===t&&(i=this.button.find("span.ui-icon"),this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)),this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var t=this.options.appendTo;return t=!(t=!(t=t&&(t.jquery||t.nodeType?V(t):this.document.find(t).eq(0)))||!t[0]?this.element.closest(".ui-front, dialog"):t).length?this.document[0].body:t},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;!1!==t?(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t)):this.button.css("width","")},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(t){var i=this,s=[];t.each(function(t,e){e.hidden||s.push(i._parseOption(V(e),t))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),V.widget("ui.slider",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null}
vendor: 20,223 bytes, line 12
12,numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,e=this.options,i=this.element.find(".ui-slider-handle"),s=[],n=e.values&&e.values.length||1;for(i.length>n&&(i.slice(n).remove(),i=i.slice(0,n)),t=i.length;t<n;t++)s.push("<span tabindex='0'></span>");this.handles=i.add(V(s.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(t){V(this).data("ui-slider-handle-index",t).attr("tabIndex",0)})},_createRange:function(){var t=this.options;t.range?(!0===t.range&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:Array.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=V("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),"min"!==t.range&&"max"!==t.range||this._addClass(this.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._mouseDestroy()},_mouseCapture:function(t){var i,s,n,o,e,a,r=this,l=this.options;return!l.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),a={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(a),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var e=Math.abs(i-r.values(t));(e<s||s===e&&(t===r._lastChangedValue||r.values(t)===l.min))&&(s=e,n=V(this),o=t)}),!1!==this._start(t,o)&&(this._mouseSliding=!0,this._handleIndex=o,this._addClass(n,null,"ui-state-active"),n.trigger("focus"),e=n.offset(),a=!V(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=a?{left:0,top:0}:{left:t.pageX-e.left-n.width()/2,top:t.pageY-e.top-n.height()/2-(parseInt(n.css("borderTopWidth"),10)||0)-(parseInt(n.css("borderBottomWidth"),10)||0)+(parseInt(n.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,i),this._animateOff=!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},e=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,e),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,t="horizontal"===this.orientation?(e=this.elementSize.width,t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),t=t/e;return(t=1<t?1:t)<0&&(t=0),"vertical"===this.orientation&&(t=1-t),e=this._valueMax()-this._valueMin(),e=this._valueMin()+t*e,this._trimAlignValue(e)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n=this.value(),o=this.values();this._hasMultipleValues()&&(s=this.values(e?0:1),n=this.values(e),2===this.options.values.length&&!0===this.options.range&&(i=0===e?Math.min(s,i):Math.max(s,i)),o[e]=i),i!==n&&!1!==this._trigger("slide",t,this._uiHash(e,i,o))&&(this._hasMultipleValues()?this.values(e,i):this.value(i))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),void this._change(null,0)):this._value()},values:function(t,e){var i,s,n;if(1<arguments.length)return this.options.values[t]=this._trimAlignValue(e),this._refreshValue(),void this._change(null,t);if(!arguments.length)return this._values();if(!Array.isArray(t))return this._hasMultipleValues()?this._values(t):this.value();for(i=this.options.values,s=t,n=0;n<i.length;n+=1)i[n]=this._trimAlignValue(s[n]),this._change(null,n);this._refreshValue()},_setOption:function(t,e){var i,s=0;switch("range"===t&&!0===this.options.range&&("min"===e?(this.options.value=this._values(0),this.options.values=null):"max"===e&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),Array.isArray(this.options.values)&&(s=this.options.values.length),this._super(t,e),t){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(e),this.handles.css("horizontal"===e?"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(),i=s-1;0<=i;i--)this._change(null,i);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i;if(arguments.length)return t=this.options.values[t],t=this._trimAlignValue(t);if(this._hasMultipleValues()){for(e=this.options.values.slice(),i=0;i<e.length;i+=1)e[i]=this._trimAlignValue(e[i]);return e}return[]},_trimAlignValue:function(t){if(t<=this._valueMin())return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=0<this.options.step?this.options.step:1,i=(t-this._valueMin())%e,t=t-i;return 2*Math.abs(i)>=e&&(t+=0<i?e:-e),parseFloat(t.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step;(t=Math.round((t-e)/i)*i+e)>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return t=null!==this.options.min?Math.max(t,this._precisionOf(this.options.min)):t},_precisionOf:function(t){var e=t.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,t,s,n,o=this.options.range,a=this.options,r=this,l=!this._animateOff&&a.animate,h={};this._hasMultipleValues()?this.handles.each(function(t){i=(r.values(t)-r._valueMin())/(r._valueMax()-r._valueMin())*100,h["horizontal"===r.orientation?"left":"bottom"]=i+"%",V(this).stop(1,1)[l?"animate":"css"](h,a.animate),!0===r.options.range&&("horizontal"===r.orientation?(0===t&&r.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},a.animate),1===t&&r.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:a.animate})):(0===t&&r.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},a.animate),1===t&&r.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:a.animate}))),e=i}):(t=this.value(),s=this._valueMin(),n=this._valueMax(),i=n!==s?(t-s)/(n-s)*100:0,h["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](h,a.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},a.animate),"max"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:100-i+"%"},a.animate),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},a.animate),"max"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:100-i+"%"},a.animate))},_handleEvents:{keydown:function(t){var e,i,s,n=V(t.target).data("ui-slider-handle-index");switch(t.keyCode){case V.ui.keyCode.HOME:case V.ui.keyCode.END:case V.ui.keyCode.PAGE_UP:case V.ui.keyCode.PAGE_DOWN:case V.ui.keyCode.UP:case V.ui.keyCode.RIGHT:case V.ui.keyCode.DOWN:case V.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(V(t.target),null,"ui-state-active"),!1===this._start(t,n)))return}switch(s=this.options.step,e=i=this._hasMultipleValues()?this.values(n):this.value(),t.keyCode){case V.ui.keyCode.HOME:i=this._valueMin();break;case V.ui.keyCode.END:i=this._valueMax();break;case V.ui.keyCode.PAGE_UP:i=this._trimAlignValue(e+(this._valueMax()-this._valueMin())/this.numPages);break;case V.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(e-(this._valueMax()-this._valueMin())/this.numPages);break;case V.ui.keyCode.UP:case V.ui.keyCode.RIGHT:if(e===this._valueMax())return;i=this._trimAlignValue(e+s);break;case V.ui.keyCode.DOWN:case V.ui.keyCode.LEFT:if(e===this._valueMin())return;i=this._trimAlignValue(e-s)}this._slide(t,n,i)},keyup:function(t){var e=V(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,e),this._change(t,e),this._removeClass(V(t.target),null,"ui-state-active"))}}}),V.widget("ui.sortable",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return e<=t&&t<e+i},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var t=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),V.each(this.items,function(){t._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;0<=t;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,e){var i=null,s=!1,n=this;return!this.reverting&&(!this.options.disabled&&"static"!==this.options.type&&(this._refreshItems(t),V(t.target).parents().each(function(){if(V.data(this,n.widgetName+"-item")===n)return i=V(this),!1}),!!(i=V.data(t.target,n.widgetName+"-item")===n?V(t.target):i)&&(!(this.options.handle&&!e&&(V(this.options.handle,i).find("*").addBack().each(function(){this===t.target&&(s=!0)}),!s))&&(this.currentItem=i,this._removeCurrentsFromItems(),!0))))},_mouseStart:function(t,e,i){var s,n,o=this.options;if((this.currentContainer=this).refreshPositions(),this.appendTo=V("parent"!==o.appendTo?o.appendTo:this.currentItem.parent()),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},V.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),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(),this.scrollParent=this.placeholder.scrollParent(),V.extend(this.offset,{parent:this._getParentOffset()}),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(n=this.document.find("body"),this.storedCursor=n.css("cursor"),n.css("cursor",o.cursor),this.storedStylesheet=V("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(n)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),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(),!i)for(s=this.containers.length-1;0<=s;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return V.ui.ddmanager&&(V.ui.ddmanager.current=this),V.ui.ddmanager&&!o.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this.helper.parent().is(this.appendTo)||(this.helper.detach().appendTo(this.appendTo),this.offset.parent=this._getParentOffset()),this.position=this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,this.lastPositionAbs=this.positionAbs=this._convertPositionTo("absolute"),this._mouseDrag(t),!0},_scroll:function(t){var e=this.options,i=!1;return this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<e.scrollSensitivity?this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop+e.scrollSpeed:t.pageY-this.overflowOffset.top<e.scrollSensitivity&&(this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop-e.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<e.scrollSensitivity?this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft+e.scrollSpeed:t.pageX-this.overflowOffset.left<e.scrollSensitivity&&(this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft-e.scrollSpeed)):(t.pageY-this.document.scrollTop()<e.scrollSensitivity?i=this.document.scrollTop(this.document.scrollTop()-e.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<e.scrollSensitivity&&(i=this.document.scrollTop(this.document.scrollTop()+e.scrollSpeed)),t.pageX-this.document.scrollLeft()<e.scrollSensitivity?i=this.document.scrollLeft(this.document.scrollLeft()-e.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<e.scrollSensitivity&&(i=this.document.scrollLeft(this.document.scrollLeft()+e.scrollSpeed))),i},_mouseDrag:function(t){var e,i,s,n,o=this.options;for(this.position=this._generatePosition(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"),o.scroll&&!1!==this._scroll(t)&&(this._refreshItemPositions(!0),V.ui.ddmanager&&!o.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t)),this.dragDirection={vertical:this._getDragVerticalDirection(),horizontal:this._getDragHorizontalDirection()},e=this.items.length-1;0<=e;e--)if(s=(i=this.items[e]).item[0],(n=this._intersectsWithPointer(i))&&i.instance===this.currentContainer&&!(s===this.currentItem[0]||this.placeholder[1===n?"next":"prev"]()[0]===s||V.contains(this.placeholder[0],s)||"semi-dynamic"===this.options.type&&V.contains(this.element[0],s))){if(this.direction=1===n?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;this._rearrange(t,i),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),V.ui.ddmanager&&V.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,e){var i,s,n,o;if(t)return V.ui.ddmanager&&!this.options.dropBehaviour&&V.ui.ddmanager.drop(this,t),this.options.revert?(s=(i=this).placeholder.offset(),o={},(n=this.options.axis)&&"x"!==n||(o.left=s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),n&&"y"!==n||(o.top=s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,V(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){i._clear(t)})):this._clear(t,e),!1},cancel:function(){if(this.dragging){this._mouseUp(new V.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var t=this.containers.length-1;0<=t;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(),V.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?V(this.domPosition.prev).after(this.currentItem):V(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var t=this._getItemsAsjQuery(e&&e.connected),i=[];return e=e||{},V(t).each(function(){var t=(V(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);t&&i.push((e.key||t[1]+"[]")+"="+(e.key&&e.expression?t[1]:t[2]))}),!i.length&&e.key&&i.push(e.key+"="),i.join("&")},toArray:function(t){var e=this._getItemsAsjQuery(t&&t.connected),i=[];return t=t||{},e.each(function(){i.push(V(t.item||this).attr(t.attribute||"id")||"")}),i},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,h="x"===this.options.axis||r<s+h&&s+h<l,c="y"===this.options.axis||o<e+c&&e+c<a;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?h&&c:o<e+this.helperProportions.width/2&&i-this.helperProportions.width/2<a&&r<s+this.helperProportions.height/2&&n-this.helperProportions.height/2<l},_intersectsWithPointer:function(t){var e="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),t="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width);return!(!e||!t)&&(e=this.dragDirection.vertical,t=this.dragDirection.horizontal,this.floating?"right"===t||"down"===e?2:1:e&&("down"===e?2:1))},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this.dragDirection.vertical,t=this.dragDirection.horizontal;return this.floating&&t?"right"===t&&i||"left"===t&&!i:s&&("down"===s&&e||"up"===s
vendor: 4,080 bytes, line 12
12&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!=t&&(0<t?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!=t&&(0<t?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(t){var e,i,s,n,o=[],a=[],r=this._connectWith();if(r&&t)for(e=r.length-1;0<=e;e--)for(i=(s=V(r[e],this.document[0])).length-1;0<=i;i--)(n=V.data(s[i],this.widgetFullName))&&n!==this&&!n.options.disabled&&a.push(["function"==typeof n.options.items?n.options.items.call(n.element):V(n.options.items,n.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),n]);function l(){o.push(this)}for(a.push(["function"==typeof this.options.items?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):V(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),e=a.length-1;0<=e;e--)a[e][0].each(l);return V(o)},_removeCurrentsFromItems:function(){var i=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=V.grep(this.items,function(t){for(var e=0;e<i.length;e++)if(i[e]===t.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var e,i,s,n,o,a,r,l,h=this.items,c=[["function"==typeof this.options.items?this.options.items.call(this.element[0],t,{item:this.currentItem}):V(this.options.items,this.element),this]],u=this._connectWith();if(u&&this.ready)for(e=u.length-1;0<=e;e--)for(i=(s=V(u[e],this.document[0])).length-1;0<=i;i--)(n=V.data(s[i],this.widgetFullName))&&n!==this&&!n.options.disabled&&(c.push(["function"==typeof n.options.items?n.options.items.call(n.element[0],t,{item:this.currentItem}):V(n.options.items,n.element),n]),this.containers.push(n));for(e=c.length-1;0<=e;e--)for(o=c[e][1],l=(a=c[e][i=0]).length;i<l;i++)(r=V(a[i])).data(this.widgetName+"-item",o),h.push({item:r,instance:o,width:0,height:0,left:0,top:0})},_refreshItemPositions:function(t){for(var e,i,s=this.items.length-1;0<=s;s--)e=this.items[s],this.currentContainer&&e.instance!==this.currentContainer&&e.item[0]!==this.currentItem[0]||(i=this.options.toleranceElement?V(this.options.toleranceElement,e.item):e.item,t||(e.width=i.outerWidth(),e.height=i.outerHeight()),i=i.offset(),e.left=i.left,e.top=i.top)},refreshPositions:function(t){var e,i;if(this.floating=!!this.items.length&&("x"===this.options.axis||this._isFloating(this.items[0].item)),this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset()),this._refreshItemPositions(t),this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(e=this.containers.length-1;0<=e;e--)i=this.containers[e].element.offset(),this.containers[e].containerCache.left=i.left,this.containers[e].containerCache.top=i.top,this.containers[e].containerCache.width=this.containers[e].element.outerWidth(),this.containers[e].containerCache.height=this.containers[e].element.outerHeight();return this},_createPlaceholder:function(i){var s,n,o=(i=i||this).options;o.placeholder&&o.placeholder.constructor!==String||(s=o.placeholder,n=i.currentItem[0].nodeName.toLowerCase(),o.placeholder={element:function(){var t=V("<"+n+">",i.document[0]);return i._addClass(t,"ui-sortable-placeholder",s||i.currentItem[0].className)._removeClass(t,"ui-sortable-helper"),"tbody"===n?i._createTrPlaceholder(i.currentItem.find("tr").eq(0),V("<tr>",i.document[0]).appendTo(t)):"tr"===n?i._createTrPlaceholder(i.currentItem,t):"img"===n&&t.attr("src",i.currentItem.attr("src")),s||t.css("visibility","hidden"),t},update:function(t,e){s&&!o.forcePlaceholderSize||(e.height()&&(!o.forcePlaceholderSize||"tbody"!==n&&"tr"!==n)||e.height(i.currentItem.innerHeight()-parseInt(i.currentItem.css("paddingTop")||0,10)-parseInt(i.currentItem.css("paddingBottom")||0,10)),e.width()
vendor: 7,741 bytes, line 12
12||e.width(i.currentItem.innerWidth()-parseInt(i.currentItem.css("paddingLeft")||0,10)-parseInt(i.currentItem.css("paddingRight")||0,10)))}}),i.placeholder=V(o.placeholder.element.call(i.element,i.currentItem)),i.currentItem.after(i.placeholder),o.placeholder.update(i,i.placeholder)},_createTrPlaceholder:function(t,e){var i=this;t.children().each(function(){V("<td>&#160;</td>",i.document[0]).attr("colspan",V(this).attr("colspan")||1).appendTo(e)})},_contactContainers:function(t){for(var e,i,s,n,o,a,r,l,h,c=null,u=null,d=this.containers.length-1;0<=d;d--)V.contains(this.currentItem[0],this.containers[d].element[0])||(this._intersectsWith(this.containers[d].containerCache)?c&&V.contains(this.containers[d].element[0],c.element[0])||(c=this.containers[d],u=d):this.containers[d].containerCache.over&&(this.containers[d]._trigger("out",t,this._uiHash(this)),this.containers[d].containerCache.over=0));if(c)if(1===this.containers.length)this.containers[u].containerCache.over||(this.containers[u]._trigger("over",t,this._uiHash(this)),this.containers[u].containerCache.over=1);else{for(i=1e4,s=null,n=(l=c.floating||this._isFloating(this.currentItem))?"left":"top",o=l?"width":"height",h=l?"pageX":"pageY",e=this.items.length-1;0<=e;e--)V.contains(this.containers[u].element[0],this.items[e].item[0])&&this.items[e].item[0]!==this.currentItem[0]&&(a=this.items[e].item.offset()[n],r=!1,t[h]-a>this.items[e][o]/2&&(r=!0),Math.abs(t[h]-a)<i&&(i=Math.abs(t[h]-a),s=this.items[e],this.direction=r?"up":"down"));(s||this.options.dropOnEmpty)&&(this.currentContainer!==this.containers[u]?(s?this._rearrange(t,s,null,!0):this._rearrange(t,null,this.containers[u].element,!0),this._trigger("change",t,this._uiHash()),this.containers[u]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[u],this.options.placeholder.update(this.currentContainer,this.placeholder),this.scrollParent=this.placeholder.scrollParent(),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this.containers[u]._trigger("over",t,this._uiHash(this)),this.containers[u].containerCache.over=1):this.currentContainer.containerCache.over||(this.containers[u]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1))}},_createHelper:function(t){var e=this.options,t="function"==typeof e.helper?V(e.helper.apply(this.element[0],[t,this.currentItem])):"clone"===e.helper?this.currentItem.clone():this.currentItem;return t.parents("body").length||this.appendTo[0].appendChild(t[0]),t[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")}),t[0].style.width&&!e.forceHelperSize||t.width(this.currentItem.width()),t[0].style.height&&!e.forceHelperSize||t.height(this.currentItem.height()),t},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}: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]&&V.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&V.ui.ie?{top:0,left:0}: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 t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}},_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,e,i=this.options;"parent"===i.containment&&(i.containment=this.helper[0].parentNode),"document"!==i.containment&&"window"!==i.containment||(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===i.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===i.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(i.containment)||(t=V(i.containment)[0],e=V(i.containment).offset(),i="hidden"!==V(t).css("overflow"),this.containment=[e.left+(parseInt(V(t).css("borderLeftWidth"),10)||0)+(parseInt(V(t).css("paddingLeft"),10)||0)-this.margins.left,e.top+(parseInt(V(t).css("borderTopWidth"),10)||0)+(parseInt(V(t).css("paddingTop"),10)||0)-this.margins.top,e.left+(i?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(V(t).css("borderLeftWidth"),10)||0)-(parseInt(V(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,e.top+(i?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(V(t).css("borderTopWidth"),10)||0)-(parseInt(V(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,e){e=e||this.position;var i="absolute"===t?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&V.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,t=/(html|body)/i.test(s[0].tagName);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():t?0:s.scrollTop())*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():t?0:s.scrollLeft())*i}},_generatePosition:function(t){var e=this.options,i=t.pageX,s=t.pageY,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&V.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[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]&&(i=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(s=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(i=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(s=this.containment[3]+this.offset.click.top)),e.grid&&(t=this.originalPageY+Math.round((s-this.originalPageY)/e.grid[1])*e.grid[1],s=!this.containment||t-this.offset.click.top>=this.containment[1]&&t-this.offset.click.top<=this.containment[3]?t:t-this.offset.click.top>=this.containment[1]?t-e.grid[1]:t+e.grid[1],t=this.originalPageX+Math.round((i-this.originalPageX)/e.grid[
vendor: 4,194 bytes, line 12
120])*e.grid[0],i=!this.containment||t-this.offset.click.left>=this.containment[0]&&t-this.offset.click.left<=this.containment[2]?t:t-this.offset.click.left>=this.containment[0]?t-e.grid[0]:t+e.grid[0])),{top:s-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop()),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)"auto"!==this._storedCSS[i]&&"static"!==this._storedCSS[i]||(this._storedCSS[i]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();function n(e,i,s){return function(t){s._trigger(e,t,i._uiHash(i))}}for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;0<=i;i--)e||s.push(n("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(n("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(i=0;i<s.length;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){!1===V.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(t){var e=t||this;return{helper:e.helper,placeholder:e.placeholder||V([]),position:e.position,originalPosition:e.originalPosition,offset:e.positionAbs,item:e.currentItem,sender:t?t.element:null}}});function ht(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}V.widget("ui.spinner",{version:"1.13.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var s=this._super(),n=this.element;return V.each(["min","max","step"],function(t,e){var i=n.attr(e);null!=i&&i.length&&(s[e]=i)}),s}
vendor: 5,973 bytes, line 12
12,_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){this.cancelBlur?delete this.cancelBlur:(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t))},mousewheel:function(t,e){var i=V.ui.safeActiveElement(this.document[0]);if(this.element[0]===i&&e){if(!this.spinning&&!this._start(t))return!1;this._spin((0<e?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(t){var e;function i(){this.element[0]===V.ui.safeActiveElement(this.document[0])||(this.element.trigger("focus"),this.previous=e,this._delay(function(){this.previous=e}))}e=this.element[0]===V.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),!1!==this._start(t)&&this._repeat(null,V(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){if(V(t.currentTarget).hasClass("ui-state-active"))return!1!==this._start(t)&&void this._repeat(null,V(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&0<this.uiSpinner.height()&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(t){var e=this.options,i=V.ui.keyCode;switch(t.keyCode){case i.UP:return this._repeat(null,1,t),!0;case i.DOWN:return this._repeat(null,-1,t),!0;case i.PAGE_UP:return this._repeat(null,e.page,t),!0;case i.PAGE_DOWN:return this._repeat(null,-e.page,t),!0}return!1},_start:function(t){return!(!this.spinning&&!1===this._trigger("start",t))&&(this.counter||(this.counter=1),this.spinning=!0)},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&!1===this._trigger("spin",e,{value:i})||(this._value(i),this.counter++)},_increment:function(t){var e=this.options.incremental;return e?"function"==typeof e?e(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return t=null!==this.options.min?Math.max(t,this._precisionOf(this.options.min)):t},_precisionOf:function(t){var e=t.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_adjustValue:function(t){var e=this.options,i=null!==e.min?e.min:0,s=t-i;return t=i+Math.round(s/e.step)*e.step,t=parseFloat(t.toFixed(this._precision())),null!==e.max&&t>e.max?e.max:null!==e.min&&t<e.min?e.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i;if("culture"===t||"numberFormat"===t)return i=this._parse(this.element.val()),this.options[t]=e,void this.element.val(this._format(i));"max"!==t&&"min"!==t&&"step"!==t||"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(i=this.buttons.first().find(".ui-icon"),this._removeClass(i,null,this.options.icons.up),this._addClass(i,null,e.up),i=this.buttons.last().find(".ui-icon"),this._removeClass(i,null,this.options.icons.down),this._addClass(i,null,e.down)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:ht(function(t){this._super(t)}),_parse:function(t){return""===(t="string"==typeof t&&""!==t?window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t:t)||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null!==t&&t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&null!==(i=this._parse(t))&&(e||(i=this._adjustValue(i)),t=this._format(i)),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:ht(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:ht(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:ht(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:ht(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){if(!arguments.length)return this._parse(this.element.val());ht(this._value).call(this,t)},widget:function(){return this.uiSpinner}}
vendor: 11,349 bytes, line 12
12),!1!==V.uiBackCompat&&V.widget("ui.spinner",V.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}});var ct;V.ui.spinner;V.widget("ui.tabs",{version:"1.13.2",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:(ct=/#.*$/,function(t){var e=t.href.replace(ct,""),i=location.href.replace(ct,"");try{e=decodeURIComponent(e)}catch(t){}try{i=decodeURIComponent(i)}catch(t){}return 1<t.hash.length&&e===i}),_create:function(){var e=this,t=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,t.collapsible),this._processTabs(),t.active=this._initialActive(),Array.isArray(t.disabled)&&(t.disabled=V.uniqueSort(t.disabled.concat(V.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),!1!==this.options.active&&this.anchors.length?this.active=this._findActive(t.active):this.active=V(),this._refresh(),this.active.length&&this.load(t.active)},_initialActive:function(){var i=this.options.active,t=this.options.collapsible,s=location.hash.substring(1);return null===i&&(s&&this.tabs.each(function(t,e){if(V(e).attr("aria-controls")===s)return i=t,!1}),null!==(i=null===i?this.tabs.index(this.tabs.filter(".ui-tabs-active")):i)&&-1!==i||(i=!!this.tabs.length&&0)),!1!==i&&-1===(i=this.tabs.index(this.tabs.eq(i)))&&(i=!t&&0),i=!t&&!1===i&&this.anchors.length?0:i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):V()}},_tabKeydown:function(t){var e=V(V.ui.safeActiveElement(this.document[0])).closest("li"),i=this.tabs.index(e),s=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case V.ui.keyCode.RIGHT:case V.ui.keyCode.DOWN:i++;break;case V.ui.keyCode.UP:case V.ui.keyCode.LEFT:s=!1,i--;break;case V.ui.keyCode.END:i=this.anchors.length-1;break;case V.ui.keyCode.HOME:i=0;break;case V.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),void this._activate(i);case V.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),void this._activate(i!==this.options.active&&i);default:return}t.preventDefault(),clearTimeout(this.activating),i=this._focusNextTab(i,s),t.ctrlKey||t.metaKey||(e.attr("aria-selected","false"),this.tabs.eq(i).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",i)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===V.ui.keyCode.UP&&(t.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(t){return t.altKey&&t.keyCode===V.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===V.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,e){var i=this.tabs.length-1;for(;-1!==V.inArray(t=(t=i<t?0:t)<0?i:t,this.options.disabled);)t=e?t+1:t-1;return t},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){"active"!==t?(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||!1!==this.options.active||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e)):this._activate(e)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,e=this.tablist.children(":has(a[href])");t.disabled=V.map(e.filter(".ui-state-disabled"),function(t){return e.index(t)}),this._processTabs(),!1!==t.active&&this.anchors.length?this.active.length&&!V.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=V()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=V()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var l=this,t=this.tabs,e=this.anchors,i=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(t){V(this).is(".ui-state-disabled")&&t.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){V(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return V("a",this)[0]}).attr({tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=V(),this.anchors.each(function(t,e){var i,s,n,o=V(e).uniqueId().attr("id"),a=V(e).closest("li"),r=a.attr("aria-controls");l._isLocal(e)?(n=(i=e.hash).substring(1),s=l.element.find(l._sanitizeSelector(i))):(n=a.attr("aria-controls")||V({}).uniqueId()[0].id,(s=l.element.find(i="#"+n)).length||(s=l._createPanel(n)).insertAfter(l.panels[t-1]||l.tablist),s.attr("aria-live","polite")),s.length&&(l.panels=l.panels.add(s)),r&&a.data("ui-tabs-aria-controls",r),a.attr({"aria-controls":n,"aria-labelledby":o}),s.attr("aria-labelledby",o)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),t&&(this._off(t.not(this.tabs)),this._off(e.not(this.anchors)),this._off(i.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(t){return V("<div>").attr("id",t).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(t){var e,i;for(Array.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1),i=0;e=this.tabs[i];i++)e=V(e),!0===t||-1!==V.inArray(i,t)?(e.attr("aria-disabled","true"),this._addClass(e,null,"ui-state-disabled")):(e.removeAttr("aria-disabled"),this._removeClass(e,null,"ui-state-disabled"));this.options.disabled=t,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!0===t)},_setupEvents:function(t){var i={};t&&V.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,e=this.element.parent();"fill"===t?(i=e.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=V(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=V(this).outerHeight(!0)}),this.panels.each(function(){V(this).height(Math.max(0,i-V(this).innerHeight()+V(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,V(this).height("").height())}).height(i))},_eventHandler:function(t){var e=this.options,i=this.active,s=V(t.currentTarget).closest("li"),n=s[0]===i[0],o=n&&e.collapsible,a=o?V():this._getPanelForTab(s),r=i.length?this._getPanelForTab(i):V(),i={oldTab:i,oldPanel:r,newTab:o?V():s,newPanel:a};t.preventDefault(),s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||n&&!e.collapsible||!1===this._trigger("beforeActivate",t,i)||(e.active=!o&&this.tabs.index(s),this.active=n?V():s,this.xhr&&this.xhr.abort(),r.length||a.length||V.error("jQuery UI Tabs: Mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,i))},_toggle:function(t,e){var i=this,s=e.newPanel,n=e.oldPanel;function o(){i.running=!1,i._trigger("activate",t,e)}function a(){i._addClass(e.newTab.closest("li"),"ui-tabs-active","ui-state-active"),s.length&&i.options.show?i._show(s,i.options.show,o):(s.show(),o())}this.running=!0,n.length&&this.options.hide?this._hide(n,this.options.hide,function(){i._removeClass(e.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),a()}):(this._removeClass(e.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n.hide(),a()),n.attr("aria-hidden","true"),e.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),s.length&&n.length?e.oldTab.attr("tabIndex",-1):s.length&&this.tabs.filter(function(){return 0===V(this).attr("tabIndex")}).attr("tabIndex",-1),s.attr("aria-hidden","false"),e.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var t=this._findActive(t);t[0]!==this.active[0]&&(t=(t=!t.length?this.active:t).find(".ui-tabs-anchor")[0],this._eventHandler({target:t,currentTarget:t,preventDefault:V.noop}))},_findActive:function(t){return!1===t?V():this.tabs.eq(t)},_getIndex:function(t){return t="string"==typeof t?this.anchors.index(this.anchors.filter("[href$='"+V.escapeSelector(t)+"']")):t},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){V.data(this,"ui-tabs-destroy")?V(this).remove():V(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var t=V(this),e=t.data("ui-tabs-aria-controls");e?t.attr("aria-controls",e).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var t=this.options.disabled;!1!==t&&(t=void 0!==i&&(i=this._getIndex(i),Array.isArray(t)?V.map(t,function(t){return t!==i?t:null}):V.map(this.tabs,function(t,e){return e!==i?e:null})),this._setOptionDisabled(t))},disable:function(t){var e=this.options.disabled;if(!0!==e){if(void 0===t)e=!0;else{if(t=this._getIndex(t),-1!==V.inArray(t,e))return;e=Array.isArray(e)?V.merge([t],e).sort():[t]}this._setOptionDisabled(e)}},load:function(t,s){t=this._getIndex(t);function n(t,e){"abort"===e&&o.panels.stop(!1,!0),o._removeClass(i,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===o.xhr&&delete o.xhr}var o=this,i=this.tabs.eq(t),t=i.find(".ui-tabs-anchor"),a=this._getPanelForTab(i),r={tab:i,panel:a};this._isLocal(t[0])||(this.xhr=V.ajax(this._ajaxSettings(t,s,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(i,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,
vendor: 9,041 bytes, lines 12-94
12i){setTimeout(function(){a.html(t),o._trigger("load",s,r),n(i,e)},1)}).fail(function(t,e){setTimeout(function(){n(t,e)},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href").replace(/#.*$/,""),beforeSend:function(t,e){return n._trigger("beforeLoad",i,V.extend({jqXHR:t,ajaxSettings:e},s))}}},_getPanelForTab:function(t){t=V(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+t))}}),!1!==V.uiBackCompat&&V.widget("ui.tabs",V.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}});V.ui.tabs;V.widget("ui.tooltip",{version:"1.13.2",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var t=V(this).attr("title");return V("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(t,e){var i=(t.attr("aria-describedby")||"").split(/\s+/);i.push(e),t.data("ui-tooltip-id",e).attr("aria-describedby",String.prototype.trim.call(i.join(" ")))},_removeDescribedBy:function(t){var e=t.data("ui-tooltip-id"),i=(t.attr("aria-describedby")||"").split(/\s+/),e=V.inArray(e,i);-1!==e&&i.splice(e,1),t.removeData("ui-tooltip-id"),(i=String.prototype.trim.call(i.join(" ")))?t.attr("aria-describedby",i):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=V("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=V([])},_setOption:function(t,e){var i=this;this._super(t,e),"content"===t&&V.each(this.tooltips,function(t,e){i._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var s=this;V.each(this.tooltips,function(t,e){var i=V.Event("blur");i.target=i.currentTarget=e.element[0],s.close(i,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var t=V(this);if(t.is("[title]"))return t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")}))},_enable:function(){this.disabledTitles.each(function(){var t=V(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))}),this.disabledTitles=V([])},open:function(t){var i=this,e=V(t?t.target:this.element).closest(this.options.items);e.length&&!e.data("ui-tooltip-id")&&(e.attr("title")&&e.data("ui-tooltip-title",e.attr("title")),e.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&e.parents().each(function(){var t,e=V(this);e.data("ui-tooltip-open")&&((t=V.Event("blur")).target=t.currentTarget=this,i.close(t,!0)),e.attr("title")&&(e.uniqueId(),i.parents[this.id]={element:this,title:e.attr("title")},e.attr("title",""))}),this._registerCloseHandlers(t,e),this._updateContent(e,t))},_updateContent:function(e,i){var t=this.options.content,s=this,n=i?i.type:null;if("string"==typeof t||t.nodeType||t.jquery)return this._open(i,e,t);(t=t.call(e[0],function(t){s._delay(function(){e.data("ui-tooltip-open")&&(i&&(i.type=n),this._open(i,e,t))})}))&&this._open(i,e,t)},_open:function(t,e,i){var s,n,o,a=V.extend({},this.options.position);function r(t){a.of=t,n.is(":hidden")||n.position(a)}i&&((s=this._find(e))?s.tooltip.find(".ui-tooltip-content").html(i):(e.is("[title]")&&(t&&"mouseover"===t.type?e.attr("title",""):e.removeAttr("title")),s=this._tooltip(e),n=s.tooltip,this._addDescribedBy(e,n.attr("id")),n.find(".ui-tooltip-content").html(i),this.liveRegion.children().hide(),(i=V("<div>").html(n.find(".ui-tooltip-content").html())).removeAttr("name").find("[name]").removeAttr("name"),i.removeAttr("id").find("[id]").removeAttr("id"),i.appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:r}),r(t)):n.position(V.extend({of:e},this.options.position)),n.hide(),this._show(n,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(o=this.delayedShow=setInterval(function(){n.is(":visible")&&(r(a.of),clearInterval(o))},13)),this._trigger("open",t,{tooltip:n})))},_registerCloseHandlers:function(t,e){var i={keyup:function(t){t.keyCode===V.ui.keyCode.ESCAPE&&((t=V.Event(t)).currentTarget=e[0],this.close(t,!0))}};e[0]!==this.element[0]&&(i.remove=function(){var t=this._find(e);t&&this._removeTooltip(t.tooltip)}),t&&"mouseover"!==t.type||(i.mouseleave="close"),t&&"focusin"!==t.type||(i.focusout="close"),this._on(!0,e,i)},close:function(t){var e,i=this,s=V(t?t.currentTarget:this.element),n=this._find(s);n?(e=n.tooltip,n.closing||(clearInterval(this.delayedShow),s.data("ui-tooltip-title")&&!s.attr("title")&&s.attr("title",s.data("ui-tooltip-title")),this._removeDescribedBy(s),n.hiding=!0,e.stop(!0),this._hide(e,this.options.hide,function(){i._removeTooltip(V(this))}),s.removeData("ui-tooltip-open"),this._off(s,"mouseleave focusout keyup"),s[0]!==this.element[0]&&this._off(s,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&V.each(this.parents,function(t,e){V(e.element).attr("title",e.title),delete i.parents[t]}),n.closing=!0,this._trigger("close",t,{tooltip:e}),n.hiding||(n.closing=!1))):s.removeData("ui-tooltip-open")},_tooltip:function(t){var e=V("<div>").attr("role","tooltip"),i=V("<div>").appendTo(e),s=e.uniqueId().attr("id");return this._addClass(i,"ui-tooltip-content"),this._addClass(e,"ui-tooltip","ui-widget ui-widget-content"),e.appendTo(this._appendTo(t)),this.tooltips[s]={element:t,tooltip:e}},_find:function(t){t=t.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(t){clearInterval(this.delayedShow),t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){t=t.closest(".ui-front, dialog");return t=!t.length?this.document[0].body:t},_destroy:function(){var s=this;V.each(this.tooltips,function(t,e){var i=V.Event("blur"),e=e.element;i.target=i.currentTarget=e[0],s.close(i,!0),V("#"+t).remove(),e.data("ui-tooltip-title")&&(e.attr("title")||e.attr("title",e.data("ui-tooltip-title")),e.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),!1!==V.uiBackCompat&&V.widget("ui.tooltip",V.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}});V.ui.tooltip});;
13/*** Handle jQuery plugin naming conflict between jQuery UI and Bootstrap ***/
14$.widget.bridge('uibutton', $.ui.button);
15$.widget.bridge('uitooltip', $.ui.tooltip);;
16(function (global, factory) {
17    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
18        typeof define === 'function' && define.amd ? define(factory) :
19            (global = global || self, global.Mustache = factory());
20}(this, (function () {
21    'use strict';
22
23    /*!
24     * mustache.js - Logic-less {{mustache}} templates with JavaScript
25     * http://github.com/janl/mustache.js
26     */
27
28    var objectToString = Object.prototype.toString;
29    var isArray = Array.isArray || function isArrayPolyfill(object) {
30        return objectToString.call(object) === '[object Array]';
31    };
32
33    function isFunction(object) {
34        return typeof object === 'function';
35    }
36
37    /**
38     * More correct typeof string handling array
39     * which normally returns typeof 'object'
40     */
41    function typeStr(obj) {
42        return isArray(obj) ? 'array' : typeof obj;
43    }
44
45    function escapeRegExp(string) {
46        return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
47    }
48
49    /**
50     * Null safe way of checking whether or not an object,
51     * including its prototype, has a given property
52     */
53    function hasProperty(obj, propName) {
54        return obj != null && typeof obj === 'object' && (propName in obj);
55    }
56
57    /**
58     * Safe way of detecting whether or not the given thing is a primitive and
59     * whether it has the given property
60     */
61    function primitiveHasOwnProperty(primitive, propName) {
62        return (
63            primitive != null
64            && typeof primitive !== 'object'
65            && primitive.hasOwnProperty
66            && primitive.hasOwnProperty(propName)
67        );
68    }
69
70    // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
71    // See https://github.com/janl/mustache.js/issues/189
72    var regExpTest = RegExp.prototype.test;
73    function testRegExp(re, string) {
74        return regExpTest.call(re, string);
75    }
76
77    var nonSpaceRe = /\S/;
78    function isWhitespace(string) {
79        return !testRegExp(nonSpaceRe, string);
80    }
81
82    var entityMap = {
83        '&': '&amp;',
84        '<': '&lt;',
85        '>': '&gt;',
86        '"': '&quot;',
87        "'": '&#39;',
88        '/': '&#x2F;',
89        '`': '&#x60;',
90        '=': '&#x3D;'
91    };
92
93    function escapeHtml(string) {
94        return String(string).replace(/[&<>
vendor: 22,068 bytes, lines 94-657
94"'`=\/]/g, function fromEntityMap(s) {
95            return entityMap[s];
96        });
97    }
98
99    var whiteRe = /\s*/;
100    var spaceRe = /\s+/;
101    var equalsRe = /\s*=/;
102    var curlyRe = /\s*\}/;
103    var tagRe = /#|\^|\/|>|\{|&|=|!/;
104
105    /**
106     * Breaks up the given `template` string into a tree of tokens. If the `tags`
107     * argument is given here it must be an array with two string values: the
108     * opening and closing tags used in the template (e.g. [ "<%", "%>" ]). Of
109     * course, the default is to use mustaches (i.e. mustache.tags).
110     *
111     * A token is an array with at least 4 elements. The first element is the
112     * mustache symbol that was used inside the tag, e.g. "#" or "&". If the tag
113     * did not contain a symbol (i.e. {{myValue}}) this element is "name". For
114     * all text that appears outside a symbol this element is "text".
115     *
116     * The second element of a token is its "value". For mustache tags this is
117     * whatever else was inside the tag besides the opening symbol. For text tokens
118     * this is the text itself.
119     *
120     * The third and fourth elements of the token are the start and end indices,
121     * respectively, of the token in the original template.
122     *
123     * Tokens that are the root node of a subtree contain two more elements: 1) an
124     * array of tokens in the subtree and 2) the index in the original template at
125     * which the closing tag for that section begins.
126     *
127     * Tokens for partials also contain two more elements: 1) a string value of
128     * indendation prior to that tag and 2) the index of that tag on that line -
129     * eg a value of 2 indicates the partial is the third tag on this line.
130     */
131    function parseTemplate(template, tags) {
132        if (!template)
133            return [];
134        var lineHasNonSpace = false;
135        var sections = [];     // Stack to hold section tokens
136        var tokens = [];       // Buffer to hold the tokens
137        var spaces = [];       // Indices of whitespace tokens on the current line
138        var hasTag = false;    // Is there a {{tag}} on the current line?
139        var nonSpace = false;  // Is there a non-space char on the current line?
140        var indentation = '';  // Tracks indentation for tags that use it
141        var tagIndex = 0;      // Stores a count of number of tags encountered on a line
142
143        // Strips all whitespace tokens array for the current line
144        // if there was a {{#tag}} on it and otherwise only space.
145        function stripSpace() {
146            if (hasTag && !nonSpace) {
147                while (spaces.length)
148                    delete tokens[spaces.pop()];
149            } else {
150                spaces = [];
151            }
152
153            hasTag = false;
154            nonSpace = false;
155        }
156
157        var openingTagRe, closingTagRe, closingCurlyRe;
158        function compileTags(tagsToCompile) {
159            if (typeof tagsToCompile === 'string')
160                tagsToCompile = tagsToCompile.split(spaceRe, 2);
161
162            if (!isArray(tagsToCompile) || tagsToCompile.length !== 2)
163                throw new Error('Invalid tags: ' + tagsToCompile);
164
165            openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + '\\s*');
166            closingTagRe = new RegExp('\\s*' + escapeRegExp(tagsToCompile[1]));
167            closingCurlyRe = new RegExp('\\s*' + escapeRegExp('}' + tagsToCompile[1]));
168        }
169
170        compileTags(tags || mustache.tags);
171
172        var scanner = new Scanner(template);
173
174        var start, type, value, chr, token, openSection;
175        while (!scanner.eos()) {
176            start = scanner.pos;
177
178            // Match any text between tags.
179            value = scanner.scanUntil(openingTagRe);
180
181            if (value) {
182                for (var i = 0, valueLength = value.length; i < valueLength; ++i) {
183                    chr = value.charAt(i);
184
185                    if (isWhitespace(chr)) {
186                        spaces.push(tokens.length);
187                        indentation += chr;
188                    } else {
189                        nonSpace = true;
190                        lineHasNonSpace = true;
191                        indentation += ' ';
192                    }
193
194                    tokens.push(['text', chr, start, start + 1]);
195                    start += 1;
196
197                    // Check for whitespace on the current line.
198                    if (chr === '\n') {
199                        stripSpace();
200                        indentation = '';
201                        tagIndex = 0;
202                        lineHasNonSpace = false;
203                    }
204                }
205            }
206
207            // Match the opening tag.
208            if (!scanner.scan(openingTagRe))
209                break;
210
211            hasTag = true;
212
213            // Get the tag type.
214            type = scanner.scan(tagRe) || 'name';
215            scanner.scan(whiteRe);
216
217            // Get the tag value.
218            if (type === '=') {
219                value = scanner.scanUntil(equalsRe);
220                scanner.scan(equalsRe);
221                scanner.scanUntil(closingTagRe);
222            } else if (type === '{') {
223                value = scanner.scanUntil(closingCurlyRe);
224                scanner.scan(curlyRe);
225                scanner.scanUntil(closingTagRe);
226                type = '&';
227            } else {
228                value = scanner.scanUntil(closingTagRe);
229            }
230
231            // Match the closing tag.
232            if (!scanner.scan(closingTagRe))
233                throw new Error('Unclosed tag at ' + scanner.pos);
234
235            if (type == '>') {
236                token = [type, value, start, scanner.pos, indentation, tagIndex, lineHasNonSpace];
237            } else {
238                token = [type, value, start, scanner.pos];
239            }
240            tagIndex++;
241            tokens.push(token);
242
243            if (type === '#' || type === '^') {
244                sections.push(token);
245            } else if (type === '/') {
246                // Check section nesting.
247                openSection = sections.pop();
248
249                if (!openSection)
250                    throw new Error('Unopened section "' + value + '" at ' + start);
251
252                if (openSection[1] !== value)
253                    throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
254            } else if (type === 'name' || type === '{' || type === '&') {
255                nonSpace = true;
256            } else if (type === '=') {
257                // Set the tags for the next time around.
258                compileTags(value);
259            }
260        }
261
262        stripSpace();
263
264        // Make sure there are no open sections when we're done.
265        openSection = sections.pop();
266
267        if (openSection)
268            throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
269
270        return nestTokens(squashTokens(tokens));
271    }
272
273    /**
274     * Combines the values of consecutive text tokens in the given `tokens` array
275     * to a single token.
276     */
277    function squashTokens(tokens) {
278        var squashedTokens = [];
279
280        var token, lastToken;
281        for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
282            token = tokens[i];
283
284            if (token) {
285                if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
286                    lastToken[1] += token[1];
287                    lastToken[3] = token[3];
288                } else {
289                    squashedTokens.push(token);
290                    lastToken = token;
291                }
292            }
293        }
294
295        return squashedTokens;
296    }
297
298    /**
299     * Forms the given array of `tokens` into a nested tree structure where
300     * tokens that represent a section have two additional items: 1) an array of
301     * all tokens that appear in that section and 2) the index in the original
302     * template that represents the end of that section.
303     */
304    function nestTokens(tokens) {
305        var nestedTokens = [];
306        var collector = nestedTokens;
307        var sections = [];
308
309        var token, section;
310        for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
311            token = tokens[i];
312
313            switch (token[0]) {
314                case '#':
315                case '^':
316                    collector.push(token);
317                    sections.push(token);
318                    collector = token[4] = [];
319                    break;
320                case '/':
321                    section = sections.pop();
322                    section[5] = token[2];
323                    collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
324                    break;
325                default:
326                    collector.push(token);
327            }
328        }
329
330        return nestedTokens;
331    }
332
333    /**
334     * A simple string scanner that is used by the template parser to find
335     * tokens in template strings.
336     */
337    function Scanner(string) {
338        this.string = string;
339        this.tail = string;
340        this.pos = 0;
341    }
342
343    /**
344     * Returns `true` if the tail is empty (end of string).
345     */
346    Scanner.prototype.eos = function eos() {
347        return this.tail === '';
348    };
349
350    /**
351     * Tries to match the given regular expression at the current position.
352     * Returns the matched text if it can match, the empty string otherwise.
353     */
354    Scanner.prototype.scan = function scan(re) {
355        var match = this.tail.match(re);
356
357        if (!match || match.index !== 0)
358            return '';
359
360        var string = match[0];
361
362        this.tail = this.tail.substring(string.length);
363        this.pos += string.length;
364
365        return string;
366    };
367
368    /**
369     * Skips all text until the given regular expression can be matched. Returns
370     * the skipped string, which is the entire tail if no match can be made.
371     */
372    Scanner.prototype.scanUntil = function scanUntil(re) {
373        var index = this.tail.search(re), match;
374
375        switch (index) {
376            case -1:
377                match = this.tail;
378                this.tail = '';
379                break;
380            case 0:
381                match = '';
382                break;
383            default:
384                match = this.tail.substring(0, index);
385                this.tail = this.tail.substring(index);
386        }
387
388        this.pos += match.length;
389
390        return match;
391    };
392
393    /**
394     * Represents a rendering context by wrapping a view object and
395     * maintaining a reference to the parent context.
396     */
397    function Context(view, parentContext) {
398        this.view = view;
399        this.cache = { '.': this.view };
400        this.parent = parentContext;
401    }
402
403    /**
404     * Creates a new context using the given view with this context
405     * as the parent.
406     */
407    Context.prototype.push = function push(view) {
408        return new Context(view, this);
409    };
410
411    /**
412     * Returns the value of the given name in this context, traversing
413     * up the context hierarchy if the value is absent in this context's view.
414     */
415    Context.prototype.lookup = function lookup(name) {
416        var cache = this.cache;
417
418        var value;
419        if (cache.hasOwnProperty(name)) {
420            value = cache[name];
421        } else {
422            var context = this, intermediateValue, names, index, lookupHit = false;
423
424            while (context) {
425                if (name.indexOf('.') > 0) {
426                    intermediateValue = context.view;
427                    names = name.split('.');
428                    index = 0;
429
430                    /**
431                     * Using the dot notion path in `name`, we descend through the
432                     * nested objects.
433                     *
434                     * To be certain that the lookup has been successful, we have to
435                     * check if the last object in the path actually has the property
436                     * we are looking for. We store the result in `lookupHit`.
437                     *
438                     * This is specially necessary for when the value has been set to
439                     * `undefined` and we want to avoid looking up parent contexts.
440                     *
441                     * In the case where dot notation is used, we consider the lookup
442                     * to be successful even if the last "object" in the path is
443                     * not actually an object but a primitive (e.g., a string, or an
444                     * integer), because it is sometimes useful to access a property
445                     * of an autoboxed primitive, such as the length of a string.
446                     **/
447                    while (intermediateValue != null && index < names.length) {
448                        if (index === names.length - 1)
449                            lookupHit = (
450                                hasProperty(intermediateValue, names[index])
451                                || primitiveHasOwnProperty(intermediateValue, names[index])
452                            );
453
454                        intermediateValue = intermediateValue[names[index++]];
455                    }
456                } else {
457                    intermediateValue = context.view[name];
458
459                    /**
460                     * Only checking against `hasProperty`, which always returns `false` if
461                     * `context.view` is not an object. Deliberately omitting the check
462                     * against `primitiveHasOwnProperty` if dot notation is not used.
463                     *
464                     * Consider this example:
465                     * ```
466                     * Mustache.render("The length of a football field is {{#length}}{{length}}{{/length}}.", {length: "100 yards"})
467                     * ```
468                     *
469                     * If we were to check also against `primitiveHasOwnProperty`, as we do
470                     * in the dot notation case, then render call would return:
471                     *
472                     * "The length of a football field is 9."
473                     *
474                     * rather than the expected:
475                     *
476                     * "The length of a football field is 100 yards."
477                     **/
478                    lookupHit = hasProperty(context.view, name);
479                }
480
481                if (lookupHit) {
482                    value = intermediateValue;
483                    break;
484                }
485
486                context = context.parent;
487            }
488
489            cache[name] = value;
490        }
491
492        if (isFunction(value))
493            value = value.call(this.view);
494
495        return value;
496    };
497
498    /**
499     * A Writer knows how to take a stream of tokens and render them to a
500     * string, given a context. It also maintains a cache of templates to
501     * avoid the need to parse the same template twice.
502     */
503    function Writer() {
504        this.templateCache = {
505            _cache: {},
506            set: function set(key, value) {
507                this._cache[key] = value;
508            },
509            get: function get(key) {
510                return this._cache[key];
511            },
512            clear: function clear() {
513                this._cache = {};
514            }
515        };
516    }
517
518    /**
519     * Clears all cached templates in this writer.
520     */
521    Writer.prototype.clearCache = function clearCache() {
522        if (typeof this.templateCache !== 'undefined') {
523            this.templateCache.clear();
524        }
525    };
526
527    /**
528     * Parses and caches the given `template` according to the given `tags` or
529     * `mustache.tags` if `tags` is omitted,  and returns the array of tokens
530     * that is generated from the parse.
531     */
532    Writer.prototype.parse = function parse(template, tags) {
533        var cache = this.templateCache;
534        var cacheKey = template + ':' + (tags || mustache.tags).join(':');
535        var isCacheEnabled = typeof cache !== 'undefined';
536        var tokens = isCacheEnabled ? cache.get(cacheKey) : undefined;
537
538        if (tokens == undefined) {
539            tokens = parseTemplate(template, tags);
540            isCacheEnabled && cache.set(cacheKey, tokens);
541        }
542        return tokens;
543    };
544
545    /**
546     * High-level method that is used to render the given `template` with
547     * the given `view`.
548     *
549     * The optional `partials` argument may be an object that contains the
550     * names and templates of partials that are used in the template. It may
551     * also be a function that is used to load partial templates on the fly
552     * that takes a single argument: the name of the partial.
553     *
554     * If the optional `config` argument is given here, then it should be an
555     * object with a `tags` attribute or an `escape` attribute or both.
556     * If an array is passed, then it will be interpreted the same way as
557     * a `tags` attribute on a `config` object.
558     *
559     * The `tags` attribute of a `config` object must be an array with two
560     * string values: the opening and closing tags used in the template (e.g.
561     * [ "<%", "%>" ]). The default is to mustache.tags.
562     *
563     * The `escape` attribute of a `config` object must be a function which
564     * accepts a string as input and outputs a safely escaped string.
565     * If an `escape` function is not provided, then an HTML-safe string
566     * escaping function is used as the default.
567     */
568    Writer.prototype.render = function render(template, view, partials, config) {
569        var tags = this.getConfigTags(config);
570        var tokens = this.parse(template, tags);
571        var context = (view instanceof Context) ? view : new Context(view, undefined);
572        return this.renderTokens(tokens, context, partials, template, config);
573    };
574
575    /**
576     * Low-level method that renders the given array of `tokens` using
577     * the given `context` and `partials`.
578     *
579     * Note: The `originalTemplate` is only ever used to extract the portion
580     * of the original template that was contained in a higher-order section.
581     * If the template doesn't use higher-order sections, this argument may
582     * be omitted.
583     */
584    Writer.prototype.renderTokens = function renderTokens(tokens, context, partials, originalTemplate, config) {
585        var buffer = '';
586
587        var token, symbol, value;
588        for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {
589            value = undefined;
590            token = tokens[i];
591            symbol = token[0];
592
593            if (symbol === '#') value = this.renderSection(token, context, partials, originalTemplate, config);
594            else if (symbol === '^') value = this.renderInverted(token, context, partials, originalTemplate, config);
595            else if (symbol === '>') value = this.renderPartial(token, context, partials, config);
596            else if (symbol === '&') value = this.unescapedValue(token, context);
597            else if (symbol === 'name') value = this.escapedValue(token, context, config);
598            else if (symbol === 'text') value = this.rawValue(token);
599
600            if (value !== undefined)
601                buffer += value;
602        }
603
604        return buffer;
605    };
606
607    Writer.prototype.renderSection = function renderSection(token, context, partials, originalTemplate, config) {
608        var self = this;
609        var buffer = '';
610        var value = context.lookup(token[1]);
611
612        // This function is used to render an arbitrary template
613        // in the current context by higher-order sections.
614        function subRender(template) {
615            return self.render(template, context, partials, config);
616        }
617
618        if (!value) return;
619
620        if (isArray(value)) {
621            for (var j = 0, valueLength = value.length; j < valueLength; ++j) {
622                buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate, config);
623            }
624        } else if (typeof value === 'object' || typeof value === 'string' || typeof value === 'number') {
625            buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate, config);
626        } else if (isFunction(value)) {
627            if (typeof originalTemplate !== 'string')
628                throw new Error('Cannot use higher-order sections without the original template');
629
630            // Extract the portion of the original template that the section contains.
631            value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);
632
633            if (value != null)
634                buffer += value;
635        } else {
636            buffer += this.renderTokens(token[4], context, partials, originalTemplate, config);
637        }
638        return buffer;
639    };
640
641    Writer.prototype.renderInverted = function renderInverted(token, context, partials, originalTemplate, config) {
642        var value = context.lookup(token[1]);
643
644        // Use JavaScript's definition of falsy. Include empty arrays.
645        // See https://github.com/janl/mustache.js/issues/186
646        if (!value || (isArray(value) && value.length === 0))
647            return this.renderTokens(token[4], context, partials, originalTemplate, config);
648    };
649
650    Writer.prototype.indentPartial = function indentPartial(partial, indentation, lineHasNonSpace) {
651        var filteredIndentation = indentation.replace(/[^ \t]/g, '');
652        var partialByNl = partial.split('\n');
653        for (var i = 0; i < partialByNl.length; i++) {
654            if (partialByNl[i].length && (i > 0 || !lineHasNonSpace)) {
655                partialByNl[i] = filteredIndentation + partialByNl[i];
656            }
657        }
658        return partialByNl.join('\n');
659    };
660
661    Writer.prototype.renderPartial = function renderPartial(token, context, partials, config) {
662        if (!partials) return;
663        var tags = this.getConfigTags(config);
664
665        var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];
666        if (value != null) {
667            var lineHasNonSpace = token[6];
668            var tagIndex = token[5];
669            var indentation = token[4];
670            var indentedValue = value;
671            if (tagIndex == 0 && indentation) {
672                indentedValue = this.indentPartial(value, indentation, lineHasNonSpace);
673            }
674            var tokens = this.parse(indentedValue, tags);
675            return this.renderTokens(tokens, context, partials, indentedValue, config);
676        }
677    };
678
679    Writer.prototype.unescapedValue = function unescapedValue(token, context) {
680        var value = context.lookup(token[1]);
681        if (value != null)
682            return value;
683    };
684
685    Writer.prototype.escapedValue = function escapedValue(token, context, config) {
686        var escape = this.getConfigEscape(config) || mustache.escape;
687        var value = context.lookup(token[1]);
688        if (value != null)
689            return (typeof value === 'number' && escape === mustache.escape) ? String(value) : escape(value);
690    };
691
692    Writer.prototype.rawValue = function rawValue(token) {
693        return token[1];
694    };
695
696    Writer.prototype.getConfigTags = function getConfigTags(config) {
697        if (isArray(config)) {
698            return config;
699        }
700        else if (config && typeof config === 'object') {
701            return config.tags;
702        }
703        else {
704            return undefined;
705        }
706    };
707
708    Writer.prototype.getConfigEscape = function getConfigEscape(config) {
709        if (config && typeof config === 'object' && !isArray(config)) {
710            return config.escape;
711        }
712        else {
713            return undefined;
714        }
715    };
716
717    var mustache = {
718        name: 'mustache.js',
719        version: '4.2.0',
720        tags: ['{{', '}}'],
721        clearCache: undefined,
722        escape: undefined,
723        parse: undefined,
724        render: undefined,
725        Scanner: undefined,
726        Context: undefined,
727        Writer: undefined,
728        /**
729         * Allows a user to override the default caching strategy, by providing an
730         * object with set, get and clear methods. This can also be used to disable
731         * the cache by setting it to the literal `undefined`.
732         */
733        set templateCache(cache) {
734            defaultWriter.templateCache = cache;
735        },
736        /**
737         * Gets the default or overridden caching object from the default writer.
738         */
739        get templateCache() {
740            return defaultWriter.templateCache;
741        }
742    };
743
744    // All high-level mustache.* functions use this writer.
745    var defaultWriter = new Writer();
746
747    /**
748     * Clears all cached templates in the default writer.
749     */
750    mustache.clearCache = function clearCache() {
751        return defaultWriter.clearCache();
752    };
753
754    /**
755     * Parses and caches the given template in the default writer and returns the
756     * array of tokens it contains. Doing this ahead of time avoids the need to
757     * parse templates on the fly as they are rendered.
758     */
759    mustache.parse = function parse(template, tags) {
760        return defaultWriter.parse(template, tags);
761    };
762
763    /**
764     * Renders the `template` with the given `view`, `partials`, and `config`
765     * using the default writer.
766     */
767    mustache.render = function render(template, view, partials, config) {
768        if (typeof template !== 'string') {
769            throw new TypeError('Invalid template! Template should be a "string" ' +
770                'but "' + typeStr(template) + '" was given as the first ' +
771                'argument for mustache#render(template, view, partials)');
772        }
773
774        return defaultWriter.render(template, view, partials, config);
775    };
776
777    // Export the escaping function so that the user may override it.
778    // See https://github.com/janl/mustache.js/issues/244
779    mustache.escape = escapeHtml;
780
781    // Export these mainly for testing, but also for advanced usage.
782    mustache.Scanner = Scanner;
783    mustache.Context = Context;
784    mustache.Writer = Writer;
785
786    return mustache;
787
788})));
789;
790!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var H;function f(){return H.apply(null,arguments)}function a(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function F(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function L(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(c(e,t))return;return 1}function o(e){return void 0===e}function u(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function V(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function G(e,t){for(var n=[],s=e.length,i=0;i<s;++i)n.push(t(e[i],i));return n}function E(e,t){for(var n in t)c(t,n)&&(e[n]=t[n]);return c(t,"toString")&&(e.toString=t.toString),c(t,"valueOf")&&(e.valueOf=t.valueOf),e}function l(e,t,n,s){return Pt(e,t,n,s,!0).utc()}function m(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invali
vendor: 7,452 bytes, line 790
790dMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function A(e){if(null==e._isValid){var t=m(e),n=j.call(t.parsedDateParts,function(e){return null!=e}),n=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(n=n&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return n;e._isValid=n}return e._isValid}function I(e){var t=l(NaN);return null!=e?E(m(t),e):m(t).userInvalidated=!0,t}var j=Array.prototype.some||function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1},Z=f.momentProperties=[],z=!1;function $(e,t){var n,s,i,r=Z.length;if(o(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),o(t._i)||(e._i=t._i),o(t._f)||(e._f=t._f),o(t._l)||(e._l=t._l),o(t._strict)||(e._strict=t._strict),o(t._tzm)||(e._tzm=t._tzm),o(t._isUTC)||(e._isUTC=t._isUTC),o(t._offset)||(e._offset=t._offset),o(t._pf)||(e._pf=m(t)),o(t._locale)||(e._locale=t._locale),0<r)for(n=0;n<r;n++)o(i=t[s=Z[n]])||(e[s]=i);return e}function q(e){$(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===z&&(z=!0,f.updateOffset(this),z=!1)}function h(e){return e instanceof q||null!=e&&null!=e._isAMomentObject}function B(e){!1===f.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function e(r,a){var o=!0;return E(function(){if(null!=f.deprecationHandler&&f.deprecationHandler(null,r),o){for(var e,t,n=[],s=arguments.length,i=0;i<s;i++){if(e="","object"==typeof arguments[i]){for(t in e+="\n["+i+"] ",arguments[0])c(arguments[0],t)&&(e+=t+": "+arguments[0][t]+", ");e=e.slice(0,-2)}else e=arguments[i];n.push(e)}B(r+"\nArguments: "+Array.prototype.slice.call(n).join("")+"\n"+(new Error).stack),o=!1}return a.apply(this,arguments)},a)}var J={};function Q(e,t){null!=f.deprecationHandler&&f.deprecationHandler(e,t),J[e]||(B(t),J[e]=!0)}function d(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function X(e,t){var n,s=E({},e);for(n in t)c(t,n)&&(F(e[n])&&F(t[n])?(s[n]={},E(s[n],e[n]),E(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)c(e,n)&&!c(t,n)&&F(e[n])&&(s[n]=E({},s[n]));return s}function K(e){null!=e&&this.set(e)}f.suppressDeprecationWarnings=!1,f.deprecationHandler=null;var ee=Object.keys||function(e){var t,n=[];for(t in e)c(e,t)&&n.push(t);return n};function r(e,t,n){var s=""+Math.abs(e);return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,t-s.length)).toString().substr(1)+s}var te=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ne=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,se={},ie={};function s(e,t,n,s){var i="string"==typeof s?function(){return this[s]()}:s;e&&(ie[e]=i),t&&(ie[t[0]]=function(){return r(i.apply(this,arguments),t[1],t[2])}),n&&(ie[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function re(e,t){return e.isValid()?(t=ae(t,e.localeData()),se[t]=se[t]||function(s){for(var e,i=s.match(te),t=0,r=i.length;t<r;t++)ie[i[t]]?i[t]=ie[i[t]]:i[t]=(e=i[t]).match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"");return function(e){for(var t="",n=0;n<r;n++)t+=d(i[n])?i[n].call(e,s):i[n];return t}}(t),se[t](e)):e.localeData().invalidDate()}function ae(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(ne.lastIndex=0;0<=n&&ne.test(e);)e=e.replace(ne,s),ne.lastIndex=0,--n;return e}var oe={};function t(e,t){var n=e.toLowerCase();oe[n]=oe[n+"s"]=oe[t]=e}function _(e){return"string"==typeof e?oe[e]||oe[e.toLowerCase()]:void 0}function ue(e){var t,n,s={};for(n in e)c(e,n)&&(t=_(n))&&(s[t]=e[n]);return s}var le={};function n(e,t){le[e]=t}function he(e){return e%4==0&&e%100!=0||e%400==0}function y(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function g(e){var e=+e,t=0;return t=0!=e&&isFinite(e)?y(e):t}function de(t,n){return function(e){return null!=e?(fe(this,t,e),f.updateOffset(this,n),this):ce(this,t)}}function ce(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function fe(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&he(e.year())&&1===e.month()&&29===e.date()?(n=g(n),e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),We(n,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](n))}var i=/\d/,w=/\d\d/,me=/\d{3}/,_e=/\d{4}/,ye=/[+-]?\d{6}/,p=/\d\d?/,ge=/\d\d\d\d?/,we=/\d\d\d\d\d\d?/,pe=/\d{1,3}/,ke=/\d{1,4}/,ve=/[+-]?\d{1,6}/,Me=/\d+/,De=/[+-]?\d+/,Se=/Z|[+-]\d\d:?\d\d/gi,Ye=/Z|[+-]\d\d(?::?\d\d)?/gi,k=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function v(e,n,s){be[e]=d(n)?n:function(e,t){return e&&s?s:n}}function Oe(e,t){return c(be,e)?be[e](t._strict,t._locale):new RegExp(M(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function M(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var be={},xe={};function D(e,n){var t,s,i=n;for("string"==typeof e&&(e=[e]),u(n)&&(i=function(e,t){t[n]=g(e)}),s=e.length,t=0;t<s;t++)xe[e[t]]=i}function Te(e,i){D(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var S,Y=0,O=1,b=2,x=3,T=4,N=5,Ne=6,Pe=7,Re=8;function We(e,t){if(isNaN(e)||isNaN(t))return NaN;var n=(t%(n=12)+n)%n;return e+=(t-n)/12,1==n?he(e)?29:28:31-n%7%2}S=Array.prototype.indexOf||function(e){for(var t=0;t<this.length;++t)if(this[t]===e)return t;return-1},s("M",["MM",2],"Mo",function(){return this.month()+1}),s("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),s("MMMM",0,0,function(e){return this.localeData().months(this,e)}),t("month","M"),n("month",8),v("M",p),v("MM",p,w),v("MMM",function(e,t){return t.monthsShortRegex(e)}),v("MMMM",function(e,t){return t.monthsRegex(e)}),D(["M","MM"],function(e,t){t[O]=g(e)-1}),D(["MMM","MMMM"],function(e,t,n,s){s=n._locale.monthsParse(e,s,n._strict);null!=s?t[O]=s:m(n).invalidMonth=e});var Ce="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Ue="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),He=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Fe=k,Le=k;function Ve(e,t){var n;if(e.isValid()){if("string"==typeof t)if(/^\d+$/.test(t))t=g(t);else if(!u(t=e.localeData().monthsParse(t)))return;n=Math.min(e.date(),We(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n)}}function Ge(e){return null!=e?(Ve(this,e),f.updateOffset(this,!0),this):ce(this,"Month")}function Ee(){function e(e,t){return t.length-e.length}for(var t,n=[],s=[],i=[],r=0;r<12;r++)t=l([2e3,r]),n.push(this.monthsShort(t,"")),s.push(this.months(t,"")),i.push(this.months(t,"")),i.push(this.monthsShort(t,""));for(n.sort(e),s.sort(e),i.sort(e),r=0;r<12;r++)n[r]=M(n[r]),s[r]=M(s[r]);for(r=0;r<24;r++)i[r]=M(i[r]);this._monthsRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+n.join("|")+")","i")}function Ae(e){return he(e)?366:365}s("Y",0,0,function(){var e=this.year();
vendor: 36,992 bytes, line 790
790return e<=9999?r(e,4):"+"+e}),s(0,["YY",2],0,function(){return this.year()%100}),s(0,["YYYY",4],0,"year"),s(0,["YYYYY",5],0,"year"),s(0,["YYYYYY",6,!0],0,"year"),t("year","y"),n("year",1),v("Y",De),v("YY",p,w),v("YYYY",ke,_e),v("YYYYY",ve,ye),v("YYYYYY",ve,ye),D(["YYYYY","YYYYYY"],Y),D("YYYY",function(e,t){t[Y]=2===e.length?f.parseTwoDigitYear(e):g(e)}),D("YY",function(e,t){t[Y]=f.parseTwoDigitYear(e)}),D("Y",function(e,t){t[Y]=parseInt(e,10)}),f.parseTwoDigitYear=function(e){return g(e)+(68<g(e)?1900:2e3)};var Ie=de("FullYear",!0);function je(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}function Ze(e){var t;return e<100&&0<=e?((t=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,t)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function ze(e,t,n){n=7+t-n;return n-(7+Ze(e,0,n).getUTCDay()-t)%7-1}function $e(e,t,n,s,i){var r,t=1+7*(t-1)+(7+n-s)%7+ze(e,s,i),n=t<=0?Ae(r=e-1)+t:t>Ae(e)?(r=e+1,t-Ae(e)):(r=e,t);return{year:r,dayOfYear:n}}function qe(e,t,n){var s,i,r=ze(e.year(),t,n),r=Math.floor((e.dayOfYear()-r-1)/7)+1;return r<1?s=r+P(i=e.year()-1,t,n):r>P(e.year(),t,n)?(s=r-P(e.year(),t,n),i=e.year()+1):(i=e.year(),s=r),{week:s,year:i}}function P(e,t,n){var s=ze(e,t,n),t=ze(e+1,t,n);return(Ae(e)-s+t)/7}s("w",["ww",2],"wo","week"),s("W",["WW",2],"Wo","isoWeek"),t("week","w"),t("isoWeek","W"),n("week",5),n("isoWeek",5),v("w",p),v("ww",p,w),v("W",p),v("WW",p,w),Te(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=g(e)});function Be(e,t){return e.slice(t,7).concat(e.slice(0,t))}s("d",0,"do","day"),s("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),s("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),s("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),s("e",0,0,"weekday"),s("E",0,0,"isoWeekday"),t("day","d"),t("weekday","e"),t("isoWeekday","E"),n("day",11),n("weekday",11),n("isoWeekday",11),v("d",p),v("e",p),v("E",p),v("dd",function(e,t){return t.weekdaysMinRegex(e)}),v("ddd",function(e,t){return t.weekdaysShortRegex(e)}),v("dddd",function(e,t){return t.weekdaysRegex(e)}),Te(["dd","ddd","dddd"],function(e,t,n,s){s=n._locale.weekdaysParse(e,s,n._strict);null!=s?t.d=s:m(n).invalidWeekday=e}),Te(["d","e","E"],function(e,t,n,s){t[s]=g(e)});var Je="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Qe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Xe="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Ke=k,et=k,tt=k;function nt(){function e(e,t){return t.length-e.length}for(var t,n,s,i=[],r=[],a=[],o=[],u=0;u<7;u++)s=l([2e3,1]).day(u),t=M(this.weekdaysMin(s,"")),n=M(this.weekdaysShort(s,"")),s=M(this.weekdays(s,"")),i.push(t),r.push(n),a.push(s),o.push(t),o.push(n),o.push(s);i.sort(e),r.sort(e),a.sort(e),o.sort(e),this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+i.join("|")+")","i")}function st(){return this.hours()%12||12}function it(e,t){s(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function rt(e,t){return t._meridiemParse}s("H",["HH",2],0,"hour"),s("h",["hh",2],0,st),s("k",["kk",2],0,function(){return this.hours()||24}),s("hmm",0,0,function(){return""+st.apply(this)+r(this.minutes(),2)}),s("hmmss",0,0,function(){return""+st.apply(this)+r(this.minutes(),2)+r(this.seconds(),2)}),s("Hmm",0,0,function(){return""+this.hours()+r(this.minutes(),2)}),s("Hmmss",0,0,function(){return""+this.hours()+r(this.minutes(),2)+r(this.seconds(),2)}),it("a",!0),it("A",!1),t("hour","h"),n("hour",13),v("a",rt),v("A",rt),v("H",p),v("h",p),v("k",p),v("HH",p,w),v("hh",p,w),v("kk",p,w),v("hmm",ge),v("hmmss",we),v("Hmm",ge),v("Hmmss",we),D(["H","HH"],x),D(["k","kk"],function(e,t,n){e=g(e);t[x]=24===e?0:e}),D(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),D(["h","hh"],function(e,t,n){t[x]=g(e),m(n).bigHour=!0}),D("hmm",function(e,t,n){var s=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s)),m(n).bigHour=!0}),D("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s,2)),t[N]=g(e.substr(i)),m(n).bigHour=!0}),D("Hmm",function(e,t,n){var s=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s))}),D("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s,2)),t[N]=g(e.substr(i))});k=de("Hours",!0);var at,ot={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ce,monthsShort:Ue,week:{dow:0,doy:6},weekdays:Je,weekdaysMin:Xe,weekdaysShort:Qe,meridiemParse:/[ap]\.?m?\.?/i},R={},ut={};function lt(e){return e&&e.toLowerCase().replace("_","-")}function ht(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=lt(e[r]).split("-")).length,n=(n=lt(e[r+1]))?n.split("-"):null;0<t;){if(s=dt(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s<n;s+=1)if(e[s]!==t[s])return s;return n}(i,n)>=t-1)break;t--}r++}return at}function dt(t){var e;if(void 0===R[t]&&"undefined"!=typeof module&&module&&module.exports&&null!=t.match("^[^/\\\\]*$"))try{e=at._abbr,require("./locale/"+t),ct(e)}catch(e){R[t]=null}return R[t]}function ct(e,t){return e&&((t=o(t)?mt(e):ft(e,t))?at=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),at._abbr}function ft(e,t){if(null===t)return delete R[e],null;var n,s=ot;if(t.abbr=e,null!=R[e])Q("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=R[e]._config;else if(null!=t.parentLocale)if(null!=R[t.parentLocale])s=R[t.parentLocale]._config;else{if(null==(n=dt(t.parentLocale)))return ut[t.parentLocale]||(ut[t.parentLocale]=[]),ut[t.parentLocale].push({name:e,config:t}),null;s=n._config}return R[e]=new K(X(s,t)),ut[e]&&ut[e].forEach(function(e){ft(e.name,e.config)}),ct(e),R[e]}function mt(e){var t;if(!(e=e&&e._locale&&e._locale._abbr?e._locale._abbr:e))return at;if(!a(e)){if(t=dt(e))return t;e=[e]}return ht(e)}function _t(e){var t=e._a;return t&&-2===m(e).overflow&&(t=t[O]<0||11<t[O]?O:t[b]<1||t[b]>We(t[Y],t[O])?b:t[x]<0||24<t[x]||24===t[x]&&(0!==t[T]||0!==t[N]||0!==t[Ne])?x:t[T]<0||59<t[T]?T:t[N]<0||59<t[N]?N:t[Ne]<0||999<t[Ne]?Ne:-1,m(e)._overflowDayOfYear&&(t<Y||b<t)&&(t=b),m(e)._overflowWeeks&&-1===t&&(t=Pe),m(e)._overflowWeekday&&-1===t&&(t=Re),m(e).overflow=t),e}var yt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,gt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,wt=/Z|[+-]\d\d(?::?\d\d)?/,pt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],kt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],vt=/^\/?Date\((-?\d+)/i,Mt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Dt={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function St(e){var t,n,s,i,r,a,o=e._i,u=yt.exec(o)||gt.exec(o),o=pt.length,l=kt.length;if(u){for(m(e).iso=!0,t=0,n=o;t<n;t++)if(pt[t][1].exec(u[1])){i=pt[t][0],s=!1!==pt[t][2];break}if(null==i)e._isValid=!1;else{if(u[3]){for(t=0,n=l;t<n;t++)if(kt[t][1].exec(u[3])){r=(u[2]||" ")+kt[t][0];break}if(null==r)return void(e._isValid=!1)}if(s||null==r){if(u[4]){if(!wt.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),Tt(e)}else e._isValid=!1}}else e._isValid=!1}function Yt(e,t,n,s,i,r){e=[function(e){e=parseInt(e,10);{if(e<=49)return 2e3+e;if(e<=999)return 1900+e}return e}(e),Ue.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&e.push(parseInt(r,10)),e}function Ot(e){var t,n,s,i,r=Mt.exec(e._i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));r?(t=Yt(r[4],r[3],r[2],r[5],r[6],r[7]),n=r[1],s=t,i=e,n&&Qe.indexOf(n)!==new Date(s[0],s[1],s[2]).getDay()?(m(i).weekdayMismatch=!0,i._isValid=!1):(e._a=t,e._tzm=(n=r[8],s=r[9],i=r[10],n?Dt[n]:s?0:60*(((n=parseInt(i,10))-(s=n%100))/100)+s),e._d=Ze.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),m(e).rfc2822=!0)):e._isValid=!1}function bt(e,t,n){return null!=e?e:null!=t?t:n}function xt(e){var t,n,s,i,r,a,o,u,l,h,d,c=[];if(!e._d){for(s=e,i=new Date(f.now()),n=s._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()],e._w&&null==e._a[b]&&null==e._a[O]&&(null!=(i=(s=e)._w).GG||null!=i.W||null!=i.E?(u=1,l=4,r=bt(i.GG,s._a[Y],qe(W(),1,4).year),a=bt(i.W,1),((o=bt(i.E,1))<1||7<o)&&(h=!0)):(u=s._locale._week.dow,l=s._locale._week.doy,d=qe(W(),u,l),r=bt(i.gg,s._a[Y],d.year),a=bt(i.w,d.week),null!=i.d?((o=i.d)<0||6<o)&&(h=!0):null!=i.e?(o=i.e+u,(i.e<0||6<i.e)&&(h=!0)):o=u),a<1||a>P(r,u,l)?m(s)._overflowWeeks=!0:null!=h?m(s)._overflowWeekday=!0:(d=$e(r,a,o,u,l),s._a[Y]=d.year,s._dayOfYear=d.dayOfYear)),null!=e._dayOfYear&&(i=bt(e._a[Y],n[Y]),(e._dayOfYear>Ae(i)||0===e._dayOfYear)&&(m(e)._overflowDayOfYear=!0),h=Ze(i,0,e._dayOfYear),e._a[O]=h.getUTCMonth(),e._a[b]=h.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=c[t]=n[t];for(;t<7;t++)e._a[t]=c[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[x]&&0===e._a[T]&&0===e._a[N]&&0===e._a[Ne]&&(e._nextDay=!0,e._a[x]=0),e._d=(e._useUTC?Ze:je).apply(null,c),r=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[x]=24),e._w&&void 0!==e._w.d&&e._w.d!==r&&(m(e).weekdayMismatch=!0)}}function Tt(e){if(e._f===f.ISO_8601)St(e);else if(e._f===f.RFC_2822)Ot(e);else{e._a=[],m(e).empty=!0;for(var t,n,s,i,r,a=""+e._i,o=a.length,u=0,l=ae(e._f,e._locale).match(te)||[],h=l.length,d=0;d<h;d++)n=l[d],(t=(a.match(Oe(n,e))||[])[0])&&(0<(s=a.substr(0,a.indexOf(t))).length&&m(e).unusedInput.push(s),a=a.slice(a.indexOf(t)+t.length),u+=t.length),ie[n]?(t?m(e).empty=!1:m(e).unusedTokens.push(n),s=n,r=e,null!=(i=t)&&c(xe,s)&&xe[s](i,r._a,r,s)):e._strict&&!t&&m(e).unusedTokens.push(n);m(e).charsLeftOver=o-u,0<a.length&&m(e).unusedInput.push(a),e._a[x]<=12&&!0===m(e).bigHour&&0<e._a[x]&&(m(e).bigHour=void 0),m(e).parsedDateParts=e._a.slice(0),m(e).meridiem=e._meridiem,e._a[x]=function(e,t,n){if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((e=e.isPM(n))&&t<12&&(t+=12),t=e||12!==t?t:0):t}(e._locale,e._a[x],e._meridiem),null!==(o=m(e).era)&&(e._a[Y]=e._locale.erasConvertYear(o,e._a[Y])),xt(e),_t(e)}}function Nt(e){var t,n,s,i=e._i,r=e._f;if(e._locale=e._locale||mt(e._l),null===i||void 0===r&&""===i)return I({nullInput:!0});if("string"==typeof i&&(e._i=i=e._locale.preparse(i)),h(i))return new q(_t(i));if(V(i))e._d=i;else if(a(r))!function(e){var t,n,s,i,r,a,o=!1,u=e._f.length;if(0===u)return m(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<u;i++)r=0,a=!1,t=$({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Tt(t),A(t)&&(a=!0),r=(r+=m(t).charsLeftOver)+10*m(t).unusedTokens.length,m(t).score=r,o?r<s&&(s=r,n=t):(null==s||r<s||a)&&(s=r,n=t,a&&(o=!0));E(e,n||t)}(e);else if(r)Tt(e);else if(o(r=(i=e)._i))i._d=new Date(f.now());else V(r)?i._d=new Date(r.valueOf()):"string"==typeof r?(n=i,null!==(t=vt.exec(n._i))?n._d=new Date(+t[1]):(St(n),!1===n._isValid&&(delete n._isValid,Ot(n),!1===n._isValid&&(delete n._isValid,n._strict?n._isValid=!1:f.createFromInputFallback(n))))):a(r)?(i._a=G(r.slice(0),function(e){return parseInt(e,10)}),xt(i)):F(r)?(t=i)._d||(s=void 0===(n=ue(t._i)).day?n.date:n.day,t._a=G([n.year,n.month,s,n.hour,n.minute,n.second,n.millisecond],function(e){return e&&parseInt(e,10)}),xt(t)):u(r)?i._d=new Date(r):f.createFromInputFallback(i);return A(e)||(e._d=null),e}function Pt(e,t,n,s,i){var r={};return!0!==t&&!1!==t||(s=t,t=void 0),!0!==n&&!1!==n||(s=n,n=void 0),(F(e)&&L(e)||a(e)&&0===e.length)&&(e=void 0),r._isAMomentObject=!0,r._useUTC=r._isUTC=i,r._l=n,r._i=e,r._f=t,r._strict=s,(i=new q(_t(Nt(i=r))))._nextDay&&(i.add(1,"d"),i._nextDay=void 0),i}function W(e,t,n,s){return Pt(e,t,n,s,!1)}f.createFromInputFallback=e("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),f.ISO_8601=function(){},f.RFC_2822=function(){};ge=e("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=W.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:I()}),we=e("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=W.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:I()});function Rt(e,t){var n,s;if(!(t=1===t.length&&a(t[0])?t[0]:t).length)return W();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Wt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ct(e){var e=ue(e),t=e.year||0,n=e.quarter||0,s=e.month||0,i=e.week||e.isoWeek||0,r=e.day||0,a=e.hour||0,o=e.minute||0,u=e.second||0,l=e.millisecond||0;this._isValid=function(e){var t,n,s=!1,i=Wt.length;for(t in e)if(c(e,t)&&(-1===S.call(Wt,t)||null!=e[t]&&isNaN(e[t])))return!1;for(n=0;n<i;++n)if(e[Wt[n]]){if(s)return!1;parseFloat(e[Wt[n]])!==g(e[Wt[n]])&&(s=!0)}return!0}(e),this._milliseconds=+l+1e3*u+6e4*o+1e3*a*60*60,this._days=+r+7*i,this._months=+s+3*n+12*t,this._data={},this._locale=mt(),this._bubble()}function Ut(e){return e instanceof Ct}function Ht(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){s(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+r(~~(e/60),2)+n+r(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),v("Z",Ye),v("ZZ",Ye),D(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Vt(Ye,e)});var Lt=/([\+\-]|\d\d)/gi;function Vt(e,t){var t=(t||"").match(e);return null===t?null:0===(t=60*(e=((t[t.length-1]||[])+"").match(Lt)||["-",0,0])[1]+g(e[2]))?0:"+"===e[0]?t:-t}function Gt(e,t){var n;return t._isUTC?(t=t.clone(),n=(h(e)||V(e)?e:W(e)).valueOf()-t.valueOf(),t._d.setTime(t._d.valueOf()+n),f.updateOffset(t,!1),t):W(e).local()}function Et(e){return-Math.round(e._d.getTimezoneOffset())}function At(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}f.updateOffset=function(){};var It=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,jt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function C(e,t){var n,s=e,i=null;return Ut(e)?s={ms:e._milliseconds,d:e._days,M:e._months}:u(e)||!isNaN(+e)?(s={},t?s[t]=+e:s.milliseconds=+e):(i=It.exec(e))?(n="-"===i[1]?-1:1,s={y:0,d:g(i[b])*n,h:g(i[x])*n,m:g(i[T])*n,s:g(i[N])*n,ms:g(Ht(1e3*i[Ne]))*n}):(i=jt.exec(e))?(n="-"===i[1]?-1:1,s={y:Zt(i[2],n),M:Zt(i[3],n),w:Zt(i[4],n),d:Zt(i[5],n),h:Zt(i[6],n),m:Zt(i[7],n),s:Zt(i[8],n)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(t=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=zt(e,t):((n=zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(W(s.from),W(s.to)),(s={}).ms=t.milliseconds,s.M=t.months),i=new Ct(s),Ut(e)&&c(e,"_locale")&&(i._locale=e._locale),Ut(e)&&c(e,"_isValid")&&(i._isValid=e._isValid),i}function Zt(e,t){e=e&&parseFloat(e.replace(",","."));return(isNaN(e)?0:e)*t}function zt(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function $t(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(Q(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),qt(this,C(e,t),s),this}}function qt(e,t,n,s){var i=t._milliseconds,r=Ht(t._days),t=Ht(t._months);e.isValid()&&(s=null==s||s,t&&Ve(e,ce(e,"Month")+t*n),r&&fe(e,"Date",ce(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&f.updateOffset(e,r||t))}C.fn=Ct.prototype,C.invalid=function(){return C(NaN)};Ce=$t(1,"add"),Je=$t(-1,"subtract");function Bt(e){return"string"==typeof e||e instanceof String}function Jt(e){return h(e)||V(e)||Bt(e)||u(e)||function(t){var e=a(t),n=!1;e&&(n=0===t.filter(function(e){return!u(e)&&Bt(t)}).length);return e&&n}(e)||function(e){var t,n,s=F(e)&&!L(e),i=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],a=r.length;for(t=0;t<a;t+=1)n=r[t],i=i||c(e,n);return s&&i}(e)||null==e}function Qt(e,t){if(e.date()<t.date())return-Qt(t,e);var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months"),t=t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(1+n,"months")-s);return-(n+t)||0}function Xt(e){return void 0===e?this._locale._abbr:(null!=(e=mt(e))&&(this._locale=e),this)}f.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",f.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";Xe=e("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function Kt(){return this._locale}var en=126227808e5;function tn(e,t){return(e%t+t)%t}function nn(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-en:new Date(e,t,n).valueOf()}function sn(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-en:Date.UTC(e,t,n)}function rn(e,t){return t.erasAbbrRegex(e)}function an(){for(var e=[],t=[],n=[],s=[],i=this.eras(),r=0,a=i.length;r<a;++r)t.push(M(i[r].name)),e.push(M(i[r].abbr)),n.push(M(i[r].narrow)),s.push(M(i[r].name)),s.push(M(i[r].abbr)),s.push(M(i[r].narrow));this._erasRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+t.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+e.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}function on(e,t){s(0,[e,e.length],0,t)}function un(e,t,n,s,i){var r;return null==e?qe(this,s,i).year:(r=P(e,s,i),function(e,t,n,s,i){e=$e(e,t,n,s,i),t=Ze(e.year,0,e.dayOfYear);return this.year(t.getUTCFullYear()),this.month(t.getUTCMonth()),this.date(t.getUTCDate()),this}.call(this,e,t=r<t?r:t,n,s,i))}s("N",0,0,"eraAbbr"),s("NN",0,0,"eraAbbr"),s("NNN",0,0,"eraAbbr"),s("NNNN",0,0,"eraName"),s("NNNNN",0,0,"eraNarrow"),s("y",["y",1],"yo","eraYear"),s("y",["yy",2],0,"eraYear"),s("y",["yyy",3],0,"eraYear"),s("y",["yyyy",4],0,"eraYear"),v("N",rn),v("NN",rn),v("NNN",rn),v("NNNN",function(e,t){return t.erasNameRegex(e)}),v("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),D(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){s=n._locale.erasParse(e,s,n._strict);s?m(n).era=s:m(n).invalidEra=e}),v("y",Me),v("yy",Me),v("yyy",Me),v("yyyy",Me),v("yo",function(e,t){return t._eraYearOrdinalRegex||Me}),D(["y","yy","yyy","yyyy"],Y),D(["yo"],function(e,t,n,s){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[Y]=n._locale.eraYearOrdinalParse(e,i):t[Y]=parseInt(e,10)}),s(0,["gg",2],0,function(){return this.weekYear()%100}),s(0,["GG",2],0,function(){return this.isoWeekYear()%100}),on("gggg","weekYear"),on("ggggg","weekYear"),on("GGGG","isoWeekYear"),on("GGGGG","isoWeekYear"),t("weekYear","gg"),t("isoWeekYear","GG"),n("weekYear",1),n("isoWeekYear",1),v("G",De),v("g",De),v("GG",p,w),v("gg",p,w),v("GGGG",ke,_e),v("gggg",ke,_e),v("GGGGG",ve,ye),v("ggggg",ve,ye),Te(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=g(e)}),Te(["gg","GG"],function(e,t,n,s){t[s]=f.parseTwoDigitYear(e)}),s("Q",0,"Qo","quarter"),t("quarter","Q"),n("quarter",7),v("Q",i),D("Q",function(e,t){t[O]=3*(g(e)-1)}),s("D",["DD",2],"Do","date"),t("date","D"),n("date",9),v("D",p),v("DD",p,w),v("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),D(["D","DD"],b),D("Do",function(e,t){t[b]=g(e.match(p)[0])});ke=de("Date",!0);s("DDD",["DDDD",3],"DDDo","dayOfYear"),t("dayOfYear","DDD"),n("dayOfYear",4),v("DDD",pe),v("DDDD",me),D(["DDD","DDDD"],function(e,t,n){n._dayOfYear=g(e)}),s("m",["mm",2],0,"minute"),t("minute","m"),n("minute",14),v("m",p),v("mm",p,w),D(["m","mm"],T);var ln,_e=de("Minutes",!1),ve=(s("s",["ss",2],0,"second"),t("second","s"),n("second",15),v("s",p),v("ss",p,w),D(["s","ss"],N),de("Seconds",!1));for(s("S",0,0,function(){return~~(this.millisecond()/100)}),s(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),s(0,["SSS",3],0,"millisecond"),s(0,["SSSS",4],0,function(){return 10*this.millisecond()}),s(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),s(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),s(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),s(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),s(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),t("millisecond","ms"),n("millisecond",16),v("S",pe,i),v("SS",pe,w),v("SSS",pe,me),ln="SSSS";ln.length<=9;ln+="S")v(ln,Me);function hn(e,t){t[Ne]=g(1e3*("0."+e))}for(ln="S";ln.length<=9;ln+="S")D(ln,hn);ye=de("Milliseconds",!1),s("z",0,0,"zoneAbbr"),s("zz",0,0,"zoneName");i=q.prototype;function dn(e){return e}i.add=Ce,i.calendar=function(e,t){1===arguments.length&&(arguments[0]?Jt(arguments[0])?(e=arguments[0],t=void 0):function(e){for(var t=F(e)&&!L(e),n=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i=0;i<s.length;i+=1)n=n||c(e,s[i]);return t&&n}(arguments[0])&&(t=arguments[0],e=void 0):t=e=void 0);var e=e||W(),n=Gt(e,this).startOf("day"),n=f.calendarFormat(this,n)||"sameElse",t=t&&(d(t[n])?t[n].call(this,e):t[n]);return this.format(t||this.localeData().calendar(n,this,W(e)))},i.clone=function(){return new q(this)},i.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=_(t)){case"year":r=Qt(this,s)/12;break;case"month":r=Qt(this,s);break;case"quarter":r=Qt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:y(r)},i.endOf=function(e){var t,n;if(void 0===(e=_(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?sn:nn,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-tn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-tn(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-tn(t,1e3)-1;break}return this._d.setTime(t),f.updateOffset(this,!0),this},i.format=function(e){return e=e||(this.isUtc()?f.defaultFormatUtc:f.defaultFormat),e=re(this,e),this.localeData().postformat(e)},i.from=function(e,t){return this.isValid()&&(h(e)&&e.isValid()||W(e).isValid())?C({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},i.fromNow=function(e){return this.from(W(),e)},i.to=function(e,t){return this.isValid()&&(h(e)&&e.isValid()||W(e).isValid())?C({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},i.toNow=function(e){return this.to(W(),e)},i.get=function(e){return d(this[e=_(e)])?this[e]():this},i.invalidAt=function(){return m(this).overflow},i.isAfter=function(e,t){return e=h(e)?e:W(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=_(t)||"millisecond")?this.valueOf()>e.valueOf():e.valueOf()<this.clone().startOf(t).valueOf())},i.isBefore=function(e,t){return e=h(e)?e:W(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=_(t)||"millisecond")?this.valueOf()<e.valueOf():this.clone().endOf(t).valueOf()<e.valueOf())},i.isBetween=function(e,t,n,s){return e=h(e)?e:W(e),t=h(t)?t:W(t),!!(this.isValid()&&e.isValid()&&t.isValid())&&(("("===(s=s||"()")[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===s[1]?this.isBefore(t,n):!this.isAfter(t,n)))},i.isSame=function(e,t){var e=h(e)?e:W(e);return!(!this.isValid()||!e.isValid())&&("millisecond"===(t=_(t)||"millisecond")?this.valueOf()===e.valueOf():(e=e.valueOf(),this.clone().startOf(t).valueOf()<=e&&e<=this.clone().endOf(t).valueOf()))},i.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},i.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},i.isValid=function(){return A(this)},i.lang=Xe,i.locale=Xt,i.localeData=Kt,i.max=we,i.min=ge,i.parsingFlags=function(){return E({},m(this))},i.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t,n=[];for(t in e)c(e,t)&&n.push({unit:t,priority:le[t]});return n.sort(function(e,t){return e.priority-t.priority}),n}(e=ue(e)),s=n.length,i=0;i<s;i++)this[n[i].unit](e[n[i].unit]);else if(d(this[e=_(e)]))return this[e](t);return this},i.startOf=function(e){var t,n;if(void 0===(e=_(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?sn:nn,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=tn(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=tn(t,6e4);break;case"second":t=this._d.valueOf(),t-=tn(t,1e3);break}return this._d.setTime(t),f.updateOffset(this,!0),this},i.subtract=Je,i.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},i.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},i.toDate=function(){return new Date(this.valueOf())},i.toISOString=function(e){if(!this.isValid())return null;var t=(e=!0!==e)?this.clone().utc():this;return t.year()<0||9999<t.year()?re(t,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):d(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",re(t,"Z")):re(t,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},i.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t="moment",n="";return this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",n="Z"),t="["+t+'("]',e=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",this.format(t+e+"-MM-DD[T]HH:mm:ss.SSS"+(n+'[")]'))},"undefined"!=typeof Symbol&&null!=Symbol.for&&(i[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},i.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},i.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].name;if(t[n].until<=e&&e<=t[n].since)return t[n].name}return""},i.eraNarrow=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].narrow;if(t[n].until<=e&&e<=t[n].since)return t[n].narrow}return""},i.eraAbbr=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].abbr;if(t[n].until<=e&&e<=t[n].since)return t[n].abbr}return""},i.eraYear=function(){for(var e,t,n=this.localeData().eras(),s=0,i=n.length;s<i;++s)if(e=n[s].since<=n[s].until?1:-1,t=this.clone().startOf("day").valueOf(),n[s].since<=t&&t<=n[s].until||n[s].until<=t&&t<=n[s].since)return(this.year()-f(n[s].since).year())*e+n[s].offset;return this.year()},i.year=Ie,i.isLeapYear=function(){return he(this.year())},i.weekYear=function(e){return un.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},i.isoWeekYear=function(e){return un.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},i.quarter=i.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},i.month=Ge,i.daysInMonth=function(){return We(this.year(),this.month())},i.week=i.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},i.isoWeek=i.isoWeeks=function(e){var t=qe(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},i.weeksInYear=function(){var e=this.localeData()._week;return P(this.year(),e.dow,e.doy)},i.weeksInWeekYear=function(){var e=this.localeData()._week;return P(this.weekYear(),e.dow,e.doy)},i.isoWeeksInYear=function(){return P(this.year(),1,4)},i.isoWeeksInISOWeekYear=function(){return P(this.isoWeekYear(),1,4)},i.date=ke,i.day=i.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},i.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},i.isoWeekday=function(e){return this.isValid()?null!=e?(t=e,n=this.localeData(),n="string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t,this.day(this.day()%7?n:n-7)):this.day()||7:null!=e?this:NaN;var t,n},i.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},i.hour=i.hours=k,i.minute=i.minutes=_e,i.second=i.seconds=ve,i.millisecond=i.milliseconds=ye,i.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Et(this);if("string"==typeof e){if(null===(e=Vt(Ye,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Et(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?qt(this,C(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,f.updateOffset(this,!0),this._changeInProgress=null)),this},i.utc=function(e){return this.utcOffset(0,e)},i.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Et(this),"m")),this},i.parseZone=function(){var e;return null!=this._tzm?this.utcOffset(this._tzm,!1,!0):"string"==typeof this._i&&(null!=(e=Vt(Se,this._i))?this.utcOffset(e):this.utcOffset(0,!0)),this},i.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?W(e).utcOffset():0,(this.utcOffset()-e)%60==0)},i.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},i.isLocal=function(){return!!this.isValid()&&!this._isUTC},i.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},i.isUtc=At,i.isUTC=At,i.zoneAbbr=function(){return this._isUTC?"UTC":""},i.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},i.dates=e("dates accessor is deprecated. Use date instead.",ke),i.months=e("months accessor is deprecated. Use month instead",Ge),i.years=e("years accessor is deprecated. Use year instead",Ie),i.zone=e("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?(this.utcOffset(e="string"!=typeof e?-e:e,t),this):-this.utcOffset()}),i.isDSTShifted=e("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!o(this._isDSTShifted))return this._isDSTShifted;var e,t={};return $(t,this),(t=Nt(t))._a?(e=(t._isUTC?l:W)(t._a),this._isDSTShifted=this.isValid()&&0<function(e,t,n){for(var s=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),r=0,a=0;a<s;a++)(n&&e[a]!==t[a]||!n&&g(e[a])!==g(t[a]))&&r++;return r+i}(t._a,e.toArray())):this._isDSTShifted=!1,this._isDSTShifted});w=K.prototype;function cn(e,t,n,s){var i=mt(),s=l().set(s,t);return i[n](s,e)}function fn(e,t,n){if(u(e)&&(t=e,e=void 0),e=e||"",null!=t)return cn(e,t,n,"month");for(var s=[],i=0;i<12;i++)s[i]=cn(e,i,n,"month");return s}function mn(e,t,n,s){t=("boolean"==typeof e?u(t)&&(n=t,t=void 0):(t=e,e=!1,u(n=t)&&(n=t,t=void 0)),t||"");var i,r=mt(),a=e?r._week.dow:0,o=[];if(null!=n)return cn(t,(n+a)%7,s,"day");for(i=0;i<7;i++)o[i]=cn(t,(i+a)%7,s,"day");return o}w.calendar=function(e,t,n){return d(e=this._calendar[e]||this._calendar.sameElse)?e.call(t,n):e},w.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(te).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},w.invalidDate=function(){return this._invalidDate},w.ordinal=function(e){return this._ordinal.replace("%d",e)},w.preparse=dn,w.postformat=dn,w.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return d(i)?i(e,t,n,s):i.replace(/%d/i,e)},w.pastFuture=function(e,t){return d(e=this._relativeTime[0<e?"future":"past"])?e(t):e.replace(/%s/i,t)},w.set=function(e){var t,n;for(n in e)c(e,n)&&(d(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},w.eras=function(e,t){for(var n,s=this._eras||mt("en")._eras,i=0,r=s.length;i<r;++i){switch(typeof s[i].since){case"string":n=f(s[i].since).startOf("day"),s[i].since=n.valueOf();break}switch(typeof s[i].until){case"undefined":s[i].until=1/0;break;case"string":n=f(s[i].until).startOf("day").valueOf(),s[i].until=n.valueOf();break}}return s},w.erasParse=function(e,t,n){var s,i,r,a,o,u=this.eras();for(e=e.toUpperCase(),s=0,i=u.length;s<i;++s)if(r=u[s].name.toUpperCase(),a=u[s].abbr.toUpperCase(),o=u[s].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(a===e)return u[s];break;case"NNNN":if(r===e)return u[s];break;case"NNNNN":if(o===e)return u[s];break}else if(0<=[r,a,o].indexOf(e))return u[s]},w.erasConvertYear=function(e,t){var n=e.since<=e.until?1:-1;return void 0===t?f(e.since).year():f(e.since).year()+(t-e.offset)*n},w.erasAbbrRegex=function(e){return c(this,"_erasAbbrRegex")||an.call(this),e?this._erasAbbrRegex:this._erasRegex},w.erasNameRegex=function(e){return c(this,"_erasNameRegex")||an.call(this),e?this._erasNameRegex:this._erasRegex},w.erasNarrowRegex=function(e){return c(this,"_erasNarrowRegex")||an.call(this),e?this._erasNarrowRegex:this._erasRegex}
vendor: 12,389 bytes, line 790
790,w.months=function(e,t){return e?(a(this._months)?this._months:this._months[(this._months.isFormat||He).test(t)?"format":"standalone"])[e.month()]:a(this._months)?this._months:this._months.standalone},w.monthsShort=function(e,t){return e?(a(this._monthsShort)?this._monthsShort:this._monthsShort[He.test(t)?"format":"standalone"])[e.month()]:a(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},w.monthsParse=function(e,t,n){var s,i;if(this._monthsParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=l([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=S.call(this._shortMonthsParse,e))?i:null:-1!==(i=S.call(this._longMonthsParse,e))?i:null:"MMM"===t?-1!==(i=S.call(this._shortMonthsParse,e))||-1!==(i=S.call(this._longMonthsParse,e))?i:null:-1!==(i=S.call(this._longMonthsParse,e))||-1!==(i=S.call(this._shortMonthsParse,e))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=l([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(i="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(i.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},w.monthsRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||Ee.call(this),e?this._monthsStrictRegex:this._monthsRegex):(c(this,"_monthsRegex")||(this._monthsRegex=Le),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},w.monthsShortRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||Ee.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(c(this,"_monthsShortRegex")||(this._monthsShortRegex=Fe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},w.week=function(e){return qe(e,this._week.dow,this._week.doy).week},w.firstDayOfYear=function(){return this._week.doy},w.firstDayOfWeek=function(){return this._week.dow},w.weekdays=function(e,t){return t=a(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"],!0===e?Be(t,this._week.dow):e?t[e.day()]:t},w.weekdaysMin=function(e){return!0===e?Be(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},w.weekdaysShort=function(e){return!0===e?Be(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},w.weekdaysParse=function(e,t,n){var s,i;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=l([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=S.call(this._weekdaysParse,e))?i:null:"ddd"===t?-1!==(i=S.call(this._shortWeekdaysParse,e))?i:null:-1!==(i=S.call(this._minWeekdaysParse,e))?i:null:"dddd"===t?-1!==(i=S.call(this._weekdaysParse,e))||-1!==(i=S.call(this._shortWeekdaysParse,e))||-1!==(i=S.call(this._minWeekdaysParse,e))?i:null:"ddd"===t?-1!==(i=S.call(this._shortWeekdaysParse,e))||-1!==(i=S.call(this._weekdaysParse,e))||-1!==(i=S.call(this._minWeekdaysParse,e))?i:null:-1!==(i=S.call(this._minWeekdaysParse,e))||-1!==(i=S.call(this._weekdaysParse,e))||-1!==(i=S.call(this._shortWeekdaysParse,e))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=l([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(i="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(i.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},w.weekdaysRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(c(this,"_weekdaysRegex")||(this._weekdaysRegex=Ke),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},w.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(c(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=et),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},w.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(c(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=tt),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},w.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},w.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ct("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===g(e%100/10)?"th":1==t?"st":2==t?"nd":3==t?"rd":"th")}}),f.lang=e("moment.lang is deprecated. Use moment.locale instead.",ct),f.langData=e("moment.langData is deprecated. Use moment.localeData instead.",mt);var _n=Math.abs;function yn(e,t,n,s){t=C(t,n);return e._milliseconds+=s*t._milliseconds,e._days+=s*t._days,e._months+=s*t._months,e._bubble()}function gn(e){return e<0?Math.floor(e):Math.ceil(e)}function wn(e){return 4800*e/146097}function pn(e){return 146097*e/4800}function kn(e){return function(){return this.as(e)}}pe=kn("ms"),me=kn("s"),Ce=kn("m"),we=kn("h"),ge=kn("d"),Je=kn("w"),k=kn("M"),_e=kn("Q"),ve=kn("y");function vn(e){return function(){return this.isValid()?this._data[e]:NaN}}var ye=vn("milliseconds"),ke=vn("seconds"),Ie=vn("minutes"),w=vn("hours"),Mn=vn("days"),Dn=vn("months"),Sn=vn("years");var Yn=Math.round,On={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function bn(e,t,n,s){var i=C(e).abs(),r=Yn(i.as("s")),a=Yn(i.as("m")),o=Yn(i.as("h")),u=Yn(i.as("d")),l=Yn(i.as("M")),h=Yn(i.as("w")),i=Yn(i.as("y")),r=(r<=n.ss?["s",r]:r<n.s&&["ss",r])||a<=1&&["m"]||a<n.m&&["mm",a]||o<=1&&["h"]||o<n.h&&["hh",o]||u<=1&&["d"]||u<n.d&&["dd",u];return(r=(r=null!=n.w?r||h<=1&&["w"]||h<n.w&&["ww",h]:r)||l<=1&&["M"]||l<n.M&&["MM",l]||i<=1&&["y"]||["yy",i])[2]=t,r[3]=0<+e,r[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,r)}var xn=Math.abs;function Tn(e){return(0<e)-(e<0)||+e}function Nn(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,s,i,r,a,o=xn(this._milliseconds)/1e3,u=xn(this._days),l=xn(this._months),h=this.asSeconds();return h?(e=y(o/60),t=y(e/60),o%=60,e%=60,n=y(l/12),l%=12,s=o?o.toFixed(3).replace(/\.?0+$/,""):"",i=Tn(this._months)!==Tn(h)?"-":"",r=Tn(this._days)!==Tn(h)?"-":"",a=Tn(this._milliseconds)!==Tn(h)?"-":"",(h<0?"-":"")+"P"+(n?i+n+"Y":"")+(l?i+l+"M":"")+(u?r+u+"D":"")+(t||e||o?"T":"")+(t?a+t+"H":"")+(e?a+e+"M":"")+(o?a+s+"S":"")):"P0D"}var U=Ct.prototype;return U.isValid=function(){return this._isValid},U.abs=function(){var e=this._data;return this._milliseconds=_n(this._milliseconds),this._days=_n(this._days),this._months=_n(this._months),e.milliseconds=_n(e.milliseconds),e.seconds=_n(e.seconds),e.minutes=_n(e.minutes),e.hours=_n(e.hours),e.months=_n(e.months),e.years=_n(e.years),this},U.add=function(e,t){return yn(this,e,t,1)},U.subtract=function(e,t){return yn(this,e,t,-1)},U.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=_(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+wn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(pn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},U.asMilliseconds=pe,U.asSeconds=me,U.asMinutes=Ce,U.asHours=we,U.asDays=ge,U.asWeeks=Je,U.asMonths=k,U.asQuarters=_e,U.asYears=ve,U.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*g(this._months/12):NaN},U._bubble=function(){var e=this._milliseconds,t=this._days,n=this._months,s=this._data;return 0<=e&&0<=t&&0<=n||e<=0&&t<=0&&n<=0||(e+=864e5*gn(pn(n)+t),n=t=0),s.milliseconds=e%1e3,e=y(e/1e3),s.seconds=e%60,e=y(e/60),s.minutes=e%60,e=y(e/60),s.hours=e%24,t+=y(e/24),n+=e=y(wn(t)),t-=gn(pn(e)),e=y(n/12),n%=12,s.days=t,s.months=n,s.years=e,this},U.clone=function(){return C(this)},U.get=function(e){return e=_(e),this.isValid()?this[e+"s"]():NaN},U.milliseconds=ye,U.seconds=ke,U.minutes=Ie,U.hours=w,U.days=Mn,U.weeks=function(){return y(this.days()/7)},U.months=Dn,U.years=Sn,U.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var n=!1,s=On;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(n=e),"object"==typeof t&&(s=Object.assign({},On,t),null!=t.s&&null==t.ss&&(s.ss=t.s-1)),e=this.localeData(),t=bn(this,!n,s,e),n&&(t=e.pastFuture(+this,t)),e.postformat(t)},U.toISOString=Nn,U.toString=Nn,U.toJSON=Nn,U.locale=Xt,U.localeData=Kt,U.toIsoString=e("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Nn),U.lang=Xe,s("X",0,0,"unix"),s("x",0,0,"valueOf"),v("x",De),v("X",/[+-]?\d+(\.\d{1,3})?/),D("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e))}),D("x",function(e,t,n){n._d=new Date(g(e))}),f.version="2.29.4",H=W,f.fn=i,f.min=function(){return Rt("isBefore",[].slice.call(arguments,0))},f.max=function(){return Rt("isAfter",[].slice.call(arguments,0))},f.now=function(){return Date.now?Date.now():+new Date},f.utc=l,f.unix=function(e){return W(1e3*e)},f.months=function(e,t){return fn(e,t,"months")},f.isDate=V,f.locale=ct,f.invalid=I,f.duration=C,f.isMoment=h,f.weekdays=function(e,t,n){return mn(e,t,n,"weekdays")},f.parseZone=function(){return W.apply(null,arguments).parseZone()},f.localeData=mt,f.isDuration=Ut,f.monthsShort=function(e,t){return fn(e,t,"monthsShort")},f.weekdaysMin=function(e,t,n){return mn(e,t,n,"weekdaysMin")},f.defineLocale=ft,f.updateLocale=function(e,t){var n,s;return null!=t?(s=ot,null!=R[e]&&null!=R[e].parentLocale?R[e].set(X(R[e]._config,t)):(t=X(s=null!=(n=dt(e))?n._config:s,t),null==n&&(t.abbr=e),(s=new K(t)).parentLocale=R[e],R[e]=s),ct(e)):null!=R[e]&&(null!=R[e].parentLocale?(R[e]=R[e].parentLocale,e===ct()&&ct(e)):null!=R[e]&&delete R[e]),R[e]},f.locales=function(){return ee(R)},f.weekdaysShort=function(e,t,n){return mn(e,t,n,"weekdaysShort")},f.normalizeUnits=_,f.relativeTimeRounding=function(e){return void 0===e?Yn:"function"==typeof e&&(Yn=e,!0)},f.relativeTimeThreshold=function(e,t){return void 0!==On[e]&&(void 0===t?On[e]:(On[e]=t,"s"===e&&(On.ss=t-1),!0))},f.calendarFormat=function(e,t){return(e=e.diff(t,"days",!0))<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse"},f.prototype=i,f.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},f});
vendor: 178,626 bytes, lines 791-1157
791//# sourceMappingURL=moment.min.js.map;
792/*
793 AngularJS v1.8.2
794 (c) 2010-2020 Google LLC. http://angularjs.org
795 License: MIT
796*/
797(function(z){'use strict';function ve(a){if(D(a))w(a.objectMaxDepth)&&(Xb.objectMaxDepth=Yb(a.objectMaxDepth)?a.objectMaxDepth:NaN),w(a.urlErrorParamsEnabled)&&Ga(a.urlErrorParamsEnabled)&&(Xb.urlErrorParamsEnabled=a.urlErrorParamsEnabled);else return Xb}function Yb(a){return X(a)&&0<a}function F(a,b){b=b||Error;return function(){var d=arguments[0],c;c="["+(a?a+":":"")+d+"] http://errors.angularjs.org/1.8.2/"+(a?a+"/":"")+d;for(d=1;d<arguments.length;d++){c=c+(1==d?"?":"&")+"p"+(d-1)+"=";var e=encodeURIComponent,
798f;f=arguments[d];f="function"==typeof f?f.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof f?"undefined":"string"!=typeof f?JSON.stringify(f):f;c+=e(f)}return new b(c)}}function za(a){if(null==a||$a(a))return!1;if(H(a)||C(a)||x&&a instanceof x)return!0;var b="length"in Object(a)&&a.length;return X(b)&&(0<=b&&b-1 in a||"function"===typeof a.item)}function r(a,b,d){var c,e;if(a)if(B(a))for(c in a)"prototype"!==c&&"length"!==c&&"name"!==c&&a.hasOwnProperty(c)&&b.call(d,a[c],c,a);else if(H(a)||
799za(a)){var f="object"!==typeof a;c=0;for(e=a.length;c<e;c++)(f||c in a)&&b.call(d,a[c],c,a)}else if(a.forEach&&a.forEach!==r)a.forEach(b,d,a);else if(Pc(a))for(c in a)b.call(d,a[c],c,a);else if("function"===typeof a.hasOwnProperty)for(c in a)a.hasOwnProperty(c)&&b.call(d,a[c],c,a);else for(c in a)ta.call(a,c)&&b.call(d,a[c],c,a);return a}function Qc(a,b,d){for(var c=Object.keys(a).sort(),e=0;e<c.length;e++)b.call(d,a[c[e]],c[e]);return c}function Zb(a){return function(b,d){a(d,b)}}function we(){return++qb}
800function $b(a,b,d){for(var c=a.$$hashKey,e=0,f=b.length;e<f;++e){var g=b[e];if(D(g)||B(g))for(var k=Object.keys(g),h=0,l=k.length;h<l;h++){var m=k[h],p=g[m];d&&D(p)?ha(p)?a[m]=new Date(p.valueOf()):ab(p)?a[m]=new RegExp(p):p.nodeName?a[m]=p.cloneNode(!0):ac(p)?a[m]=p.clone():"__proto__"!==m&&(D(a[m])||(a[m]=H(p)?[]:{}),$b(a[m],[p],!0)):a[m]=p}}c?a.$$hashKey=c:delete a.$$hashKey;return a}function S(a){return $b(a,Ha.call(arguments,1),!1)}function xe(a){return $b(a,Ha.call(arguments,1),!0)}function fa(a){return parseInt(a,
80110)}function bc(a,b){return S(Object.create(a),b)}function E(){}function Ta(a){return a}function ia(a){return function(){return a}}function cc(a){return B(a.toString)&&a.toString!==la}function A(a){return"undefined"===typeof a}function w(a){return"undefined"!==typeof a}function D(a){return null!==a&&"object"===typeof a}function Pc(a){return null!==a&&"object"===typeof a&&!Rc(a)}function C(a){return"string"===typeof a}function X(a){return"number"===typeof a}function ha(a){return"[object Date]"===la.call(a)}
802function H(a){return Array.isArray(a)||a instanceof Array}function dc(a){switch(la.call(a)){case "[object Error]":return!0;case "[object Exception]":return!0;case "[object DOMException]":return!0;default:return a instanceof Error}}function B(a){return"function"===typeof a}function ab(a){return"[object RegExp]"===la.call(a)}function $a(a){return a&&a.window===a}function bb(a){return a&&a.$evalAsync&&a.$watch}function Ga(a){return"boolean"===typeof a}function ye(a){return a&&X(a.length)&&ze.test(la.call(a))}
803function ac(a){return!(!a||!(a.nodeName||a.prop&&a.attr&&a.find))}function Ae(a){var b={};a=a.split(",");var d;for(d=0;d<a.length;d++)b[a[d]]=!0;return b}function ua(a){return K(a.nodeName||a[0]&&a[0].nodeName)}function cb(a,b){var d=a.indexOf(b);0<=d&&a.splice(d,1);return d}function Ia(a,b,d){function c(a,b,c){c--;if(0>c)return"...";var d=b.$$hashKey,f;if(H(a)){f=0;for(var g=a.length;f<g;f++)b.push(e(a[f],c))}else if(Pc(a))for(f in a)b[f]=e(a[f],c);else if(a&&"function"===typeof a.hasOwnProperty)for(f in a)a.hasOwnProperty(f)&&
804(b[f]=e(a[f],c));else for(f in a)ta.call(a,f)&&(b[f]=e(a[f],c));d?b.$$hashKey=d:delete b.$$hashKey;return b}function e(a,b){if(!D(a))return a;var d=g.indexOf(a);if(-1!==d)return k[d];if($a(a)||bb(a))throw oa("cpws");var d=!1,e=f(a);void 0===e&&(e=H(a)?[]:Object.create(Rc(a)),d=!0);g.push(a);k.push(e);return d?c(a,e,b):e}function f(a){switch(la.call(a)){case "[object Int8Array]":case "[object Int16Array]":case "[object Int32Array]":case "[object Float32Array]":case "[object Float64Array]":case "[object Uint8Array]":case "[object Uint8ClampedArray]":case "[object Uint16Array]":case "[object Uint32Array]":return new a.constructor(e(a.buffer),
805a.byteOffset,a.length);case "[object ArrayBuffer]":if(!a.slice){var b=new ArrayBuffer(a.byteLength);(new Uint8Array(b)).set(new Uint8Array(a));return b}return a.slice(0);case "[object Boolean]":case "[object Number]":case "[object String]":case "[object Date]":return new a.constructor(a.valueOf());case "[object RegExp]":return b=new RegExp(a.source,a.toString().match(/[^/]*$/)[0]),b.lastIndex=a.lastIndex,b;case "[object Blob]":return new a.constructor([a],{type:a.type})}if(B(a.cloneNode))return a.cloneNode(!0)}
806var g=[],k=[];d=Yb(d)?d:NaN;if(b){if(ye(b)||"[object ArrayBuffer]"===la.call(b))throw oa("cpta");if(a===b)throw oa("cpi");H(b)?b.length=0:r(b,function(a,c){"$$hashKey"!==c&&delete b[c]});g.push(a);k.push(b);return c(a,b,d)}return e(a,d)}function ec(a,b){return a===b||a!==a&&b!==b}function va(a,b){if(a===b)return!0;if(null===a||null===b)return!1;if(a!==a&&b!==b)return!0;var d=typeof a,c;if(d===typeof b&&"object"===d)if(H(a)){if(!H(b))return!1;if((d=a.length)===b.length){for(c=0;c<d;c++)if(!va(a[c],
807b[c]))return!1;return!0}}else{if(ha(a))return ha(b)?ec(a.getTime(),b.getTime()):!1;if(ab(a))return ab(b)?a.toString()===b.toString():!1;if(bb(a)||bb(b)||$a(a)||$a(b)||H(b)||ha(b)||ab(b))return!1;d=T();for(c in a)if("$"!==c.charAt(0)&&!B(a[c])){if(!va(a[c],b[c]))return!1;d[c]=!0}for(c in b)if(!(c in d)&&"$"!==c.charAt(0)&&w(b[c])&&!B(b[c]))return!1;return!0}return!1}function db(a,b,d){return a.concat(Ha.call(b,d))}function Va(a,b){var d=2<arguments.length?Ha.call(arguments,2):[];return!B(b)||b instanceof
808RegExp?b:d.length?function(){return arguments.length?b.apply(a,db(d,arguments,0)):b.apply(a,d)}:function(){return arguments.length?b.apply(a,arguments):b.call(a)}}function Sc(a,b){var d=b;"string"===typeof a&&"$"===a.charAt(0)&&"$"===a.charAt(1)?d=void 0:$a(b)?d="$WINDOW":b&&z.document===b?d="$DOCUMENT":bb(b)&&(d="$SCOPE");return d}function eb(a,b){if(!A(a))return X(b)||(b=b?2:null),JSON.stringify(a,Sc,b)}function Tc(a){return C(a)?JSON.parse(a):a}function fc(a,b){a=a.replace(Be,"");var d=Date.parse("Jan 01, 1970 00:00:00 "+
809a)/6E4;return Y(d)?b:d}function Uc(a,b){a=new Date(a.getTime());a.setMinutes(a.getMinutes()+b);return a}function gc(a,b,d){d=d?-1:1;var c=a.getTimezoneOffset();b=fc(b,c);return Uc(a,d*(b-c))}function Aa(a){a=x(a).clone().empty();var b=x("<div></div>").append(a).html();try{return a[0].nodeType===Pa?K(b):b.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,function(a,b){return"<"+K(b)})}catch(d){return K(b)}}function Vc(a){try{return decodeURIComponent(a)}catch(b){}}function hc(a){var b={};r((a||"").split("&"),
810function(a){var c,e,f;a&&(e=a=a.replace(/\+/g,"%20"),c=a.indexOf("="),-1!==c&&(e=a.substring(0,c),f=a.substring(c+1)),e=Vc(e),w(e)&&(f=w(f)?Vc(f):!0,ta.call(b,e)?H(b[e])?b[e].push(f):b[e]=[b[e],f]:b[e]=f))});return b}function Ce(a){var b=[];r(a,function(a,c){H(a)?r(a,function(a){b.push(ba(c,!0)+(!0===a?"":"="+ba(a,!0)))}):b.push(ba(c,!0)+(!0===a?"":"="+ba(a,!0)))});return b.length?b.join("&"):""}function ic(a){return ba(a,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function ba(a,
811b){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,b?"%20":"+")}function De(a,b){var d,c,e=Qa.length;for(c=0;c<e;++c)if(d=Qa[c]+b,C(d=a.getAttribute(d)))return d;return null}function Ee(a,b){var d,c,e={};r(Qa,function(b){b+="app";!d&&a.hasAttribute&&a.hasAttribute(b)&&(d=a,c=a.getAttribute(b))});r(Qa,function(b){b+="app";var e;!d&&(e=a.querySelector("["+b.replace(":","\\:")+"]"))&&(d=e,c=e.getAttribute(b))});
812d&&(Fe?(e.strictDi=null!==De(d,"strict-di"),b(d,c?[c]:[],e)):z.console.error("AngularJS: disabling automatic bootstrap. <script> protocol indicates an extension, document.location.href does not match."))}function Wc(a,b,d){D(d)||(d={});d=S({strictDi:!1},d);var c=function(){a=x(a);if(a.injector()){var c=a[0]===z.document?"document":Aa(a);throw oa("btstrpd",c.replace(/</,"&lt;").replace(/>/,"&gt;"));}b=b||[];b.unshift(["$provide",function(b){b.value("$rootElement",a)}]);d.debugInfoEnabled&&b.push(["$compileProvider",
813function(a){a.debugInfoEnabled(!0)}]);b.unshift("ng");c=fb(b,d.strictDi);c.invoke(["$rootScope","$rootElement","$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;z&&e.test(z.name)&&(d.debugInfoEnabled=!0,z.name=z.name.replace(e,""));if(z&&!f.test(z.name))return c();z.name=z.name.replace(f,"");ca.resumeBootstrap=function(a){r(a,function(a){b.push(a)});return c()};B(ca.resumeDeferredBootstrap)&&
814ca.resumeDeferredBootstrap()}function Ge(){z.name="NG_ENABLE_DEBUG_INFO!"+z.name;z.location.reload()}function He(a){a=ca.element(a).injector();if(!a)throw oa("test");return a.get("$$testability")}function Xc(a,b){b=b||"_";return a.replace(Ie,function(a,c){return(c?b:"")+a.toLowerCase()})}function Je(){var a;if(!Yc){var b=rb();(sb=A(b)?z.jQuery:b?z[b]:void 0)&&sb.fn.on?(x=sb,S(sb.fn,{scope:Wa.scope,isolateScope:Wa.isolateScope,controller:Wa.controller,injector:Wa.injector,inheritedData:Wa.inheritedData})):
815x=U;a=x.cleanData;x.cleanData=function(b){for(var c,e=0,f;null!=(f=b[e]);e++)(c=(x._data(f)||{}).events)&&c.$destroy&&x(f).triggerHandler("$destroy");a(b)};ca.element=x;Yc=!0}}function Ke(){U.legacyXHTMLReplacement=!0}function gb(a,b,d){if(!a)throw oa("areq",b||"?",d||"required");return a}function tb(a,b,d){d&&H(a)&&(a=a[a.length-1]);gb(B(a),b,"not a function, got "+(a&&"object"===typeof a?a.constructor.name||"Object":typeof a));return a}function Ja(a,b){if("hasOwnProperty"===a)throw oa("badname",
816b);}function Le(a,b,d){if(!b)return a;b=b.split(".");for(var c,e=a,f=b.length,g=0;g<f;g++)c=b[g],a&&(a=(e=a)[c]);return!d&&B(a)?Va(e,a):a}function ub(a){for(var b=a[0],d=a[a.length-1],c,e=1;b!==d&&(b=b.nextSibling);e++)if(c||a[e]!==b)c||(c=x(Ha.call(a,0,e))),c.push(b);return c||a}function T(){return Object.create(null)}function jc(a){if(null==a)return"";switch(typeof a){case "string":break;case "number":a=""+a;break;default:a=!cc(a)||H(a)||ha(a)?eb(a):a.toString()}return a}function Me(a){function b(a,
817b,c){return a[b]||(a[b]=c())}var d=F("$injector"),c=F("ng");a=b(a,"angular",Object);a.$$minErr=a.$$minErr||F;return b(a,"module",function(){var a={};return function(f,g,k){var h={};if("hasOwnProperty"===f)throw c("badname","module");g&&a.hasOwnProperty(f)&&(a[f]=null);return b(a,f,function(){function a(b,c,d,f){f||(f=e);return function(){f[d||"push"]([b,c,arguments]);return t}}function b(a,c,d){d||(d=e);return function(b,e){e&&B(e)&&(e.$$moduleName=f);d.push([a,c,arguments]);return t}}if(!g)throw d("nomod",
818f);var e=[],n=[],s=[],G=a("$injector","invoke","push",n),t={_invokeQueue:e,_configBlocks:n,_runBlocks:s,info:function(a){if(w(a)){if(!D(a))throw c("aobj","value");h=a;return this}return h},requires:g,name:f,provider:b("$provide","provider"),factory:b("$provide","factory"),service:b("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),decorator:b("$provide","decorator",n),animation:b("$animateProvider","register"),filter:b("$filterProvider","register"),controller:b("$controllerProvider",
819"register"),directive:b("$compileProvider","directive"),component:b("$compileProvider","component"),config:G,run:function(a){s.push(a);return this}};k&&G(k);return t})}})}function ja(a,b){if(H(a)){b=b||[];for(var d=0,c=a.length;d<c;d++)b[d]=a[d]}else if(D(a))for(d in b=b||{},a)if("$"!==d.charAt(0)||"$"!==d.charAt(1))b[d]=a[d];return b||a}function Ne(a,b){var d=[];Yb(b)&&(a=ca.copy(a,null,b));return JSON.stringify(a,function(a,b){b=Sc(a,b);if(D(b)){if(0<=d.indexOf(b))return"...";d.push(b)}return b})}
820function Oe(a){S(a,{errorHandlingConfig:ve,bootstrap:Wc,copy:Ia,extend:S,merge:xe,equals:va,element:x,forEach:r,injector:fb,noop:E,bind:Va,toJson:eb,fromJson:Tc,identity:Ta,isUndefined:A,isDefined:w,isString:C,isFunction:B,isObject:D,isNumber:X,isElement:ac,isArray:H,version:Pe,isDate:ha,callbacks:{$$counter:0},getTestability:He,reloadWithDebugInfo:Ge,UNSAFE_restoreLegacyJqLiteXHTMLReplacement:Ke,$$minErr:F,$$csp:Ba,$$encodeUriSegment:ic,$$encodeUriQuery:ba,$$lowercase:K,$$stringify:jc,$$uppercase:vb});
821lc=Me(z);lc("ng",["ngLocale"],["$provide",function(a){a.provider({$$sanitizeUri:Qe});a.provider("$compile",Zc).directive({a:Re,input:$c,textarea:$c,form:Se,script:Te,select:Ue,option:Ve,ngBind:We,ngBindHtml:Xe,ngBindTemplate:Ye,ngClass:Ze,ngClassEven:$e,ngClassOdd:af,ngCloak:bf,ngController:cf,ngForm:df,ngHide:ef,ngIf:ff,ngInclude:gf,ngInit:hf,ngNonBindable:jf,ngPluralize:kf,ngRef:lf,ngRepeat:mf,ngShow:nf,ngStyle:of,ngSwitch:pf,ngSwitchWhen:qf,ngSwitchDefault:rf,ngOptions:sf,ngTransclude:tf,ngModel:uf,
822ngList:vf,ngChange:wf,pattern:ad,ngPattern:ad,required:bd,ngRequired:bd,minlength:cd,ngMinlength:cd,maxlength:dd,ngMaxlength:dd,ngValue:xf,ngModelOptions:yf}).directive({ngInclude:zf,input:Af}).directive(wb).directive(ed);a.provider({$anchorScroll:Bf,$animate:Cf,$animateCss:Df,$$animateJs:Ef,$$animateQueue:Ff,$$AnimateRunner:Gf,$$animateAsyncRun:Hf,$browser:If,$cacheFactory:Jf,$controller:Kf,$document:Lf,$$isDocumentHidden:Mf,$exceptionHandler:Nf,$filter:fd,$$forceReflow:Of,$interpolate:Pf,$interval:Qf,
823$$intervalFactory:Rf,$http:Sf,$httpParamSerializer:Tf,$httpParamSerializerJQLike:Uf,$httpBackend:Vf,$xhrFactory:Wf,$jsonpCallbacks:Xf,$location:Yf,$log:Zf,$parse:$f,$rootScope:ag,$q:bg,$$q:cg,$sce:dg,$sceDelegate:eg,$sniffer:fg,$$taskTrackerFactory:gg,$templateCache:hg,$templateRequest:ig,$$testability:jg,$timeout:kg,$window:lg,$$rAF:mg,$$jqLite:ng,$$Map:og,$$cookieReader:pg})}]).info({angularVersion:"1.8.2"})}function xb(a,b){return b.toUpperCase()}function yb(a){return a.replace(qg,xb)}function mc(a){a=
824a.nodeType;return 1===a||!a||9===a}function gd(a,b){var d,c,e,f=b.createDocumentFragment(),g=[],k;if(nc.test(a)){d=f.appendChild(b.createElement("div"));c=(rg.exec(a)||["",""])[1].toLowerCase();e=U.legacyXHTMLReplacement?a.replace(sg,"<$1></$2>"):a;if(10>wa)for(c=hb[c]||hb._default,d.innerHTML=c[1]+e+c[2],k=c[0];k--;)d=d.firstChild;else{c=qa[c]||[];for(k=c.length;-1<--k;)d.appendChild(z.document.createElement(c[k])),d=d.firstChild;d.innerHTML=e}g=db(g,d.childNodes);d=f.firstChild;d.textContent=""}else g.push(b.createTextNode(a));
825f.textContent="";f.innerHTML="";r(g,function(a){f.appendChild(a)});return f}function U(a){if(a instanceof U)return a;var b;C(a)&&(a=V(a),b=!0);if(!(this instanceof U)){if(b&&"<"!==a.charAt(0))throw oc("nosel");return new U(a)}if(b){b=z.document;var d;a=(d=tg.exec(a))?[b.createElement(d[1])]:(d=gd(a,b))?d.childNodes:[];pc(this,a)}else B(a)?hd(a):pc(this,a)}function qc(a){return a.cloneNode(!0)}function zb(a,b){!b&&mc(a)&&x.cleanData([a]);a.querySelectorAll&&x.cleanData(a.querySelectorAll("*"))}function id(a){for(var b in a)return!1;
826return!0}function jd(a){var b=a.ng339,d=b&&Ka[b],c=d&&d.events,d=d&&d.data;d&&!id(d)||c&&!id(c)||(delete Ka[b],a.ng339=void 0)}function kd(a,b,d,c){if(w(c))throw oc("offargs");var e=(c=Ab(a))&&c.events,f=c&&c.handle;if(f){if(b){var g=function(b){var c=e[b];w(d)&&cb(c||[],d);w(d)&&c&&0<c.length||(a.removeEventListener(b,f),delete e[b])};r(b.split(" "),function(a){g(a);Bb[a]&&g(Bb[a])})}else for(b in e)"$destroy"!==b&&a.removeEventListener(b,f),delete e[b];jd(a)}}function rc(a,b){var d=a.ng339;if(d=
827d&&Ka[d])b?delete d.data[b]:d.data={},jd(a)}function Ab(a,b){var d=a.ng339,d=d&&Ka[d];b&&!d&&(a.ng339=d=++ug,d=Ka[d]={events:{},data:{},handle:void 0});return d}function sc(a,b,d){if(mc(a)){var c,e=w(d),f=!e&&b&&!D(b),g=!b;a=(a=Ab(a,!f))&&a.data;if(e)a[yb(b)]=d;else{if(g)return a;if(f)return a&&a[yb(b)];for(c in b)a[yb(c)]=b[c]}}}function Cb(a,b){return a.getAttribute?-1<(" "+(a.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+b+" "):!1}function Db(a,b){if(b&&a.setAttribute){var d=
828(" "+(a.getAttribute("class")||"")+" ").replace(/[\n\t]/g," "),c=d;r(b.split(" "),function(a){a=V(a);c=c.replace(" "+a+" "," ")});c!==d&&a.setAttribute("class",V(c))}}function Eb(a,b){if(b&&a.setAttribute){var d=(" "+(a.getAttribute("class")||"")+" ").replace(/[\n\t]/g," "),c=d;r(b.split(" "),function(a){a=V(a);-1===c.indexOf(" "+a+" ")&&(c+=a+" ")});c!==d&&a.setAttribute("class",V(c))}}function pc(a,b){if(b)if(b.nodeType)a[a.length++]=b;else{var d=b.length;if("number"===typeof d&&b.window!==b){if(d)for(var c=
8290;c<d;c++)a[a.length++]=b[c]}else a[a.length++]=b}}function ld(a,b){return Fb(a,"$"+(b||"ngController")+"Controller")}function Fb(a,b,d){9===a.nodeType&&(a=a.documentElement);for(b=H(b)?b:[b];a;){for(var c=0,e=b.length;c<e;c++)if(w(d=x.data(a,b[c])))return d;a=a.parentNode||11===a.nodeType&&a.host}}function md(a){for(zb(a,!0);a.firstChild;)a.removeChild(a.firstChild)}function Gb(a,b){b||zb(a);var d=a.parentNode;d&&d.removeChild(a)}function vg(a,b){b=b||z;if("complete"===b.document.readyState)b.setTimeout(a);
830else x(b).on("load",a)}function hd(a){function b(){z.document.removeEventListener("DOMContentLoaded",b);z.removeEventListener("load",b);a()}"complete"===z.document.readyState?z.setTimeout(a):(z.document.addEventListener("DOMContentLoaded",b),z.addEventListener("load",b))}function nd(a,b){var d=Hb[b.toLowerCase()];return d&&od[ua(a)]&&d}function wg(a,b){var d=function(c,d){c.isDefaultPrevented=function(){return c.defaultPrevented};var f=b[d||c.type],g=f?f.length:0;if(g){if(A(c.immediatePropagationStopped)){var k=
831c.stopImmediatePropagation;c.stopImmediatePropagation=function(){c.immediatePropagationStopped=!0;c.stopPropagation&&c.stopPropagation();k&&k.call(c)}}c.isImmediatePropagationStopped=function(){return!0===c.immediatePropagationStopped};var h=f.specialHandlerWrapper||xg;1<g&&(f=ja(f));for(var l=0;l<g;l++)c.isImmediatePropagationStopped()||h(a,c,f[l])}};d.elem=a;return d}function xg(a,b,d){d.call(a,b)}function yg(a,b,d){var c=b.relatedTarget;c&&(c===a||zg.call(a,c))||d.call(a,b)}function ng(){this.$get=
832function(){return S(U,{hasClass:function(a,b){a.attr&&(a=a[0]);return Cb(a,b)},addClass:function(a,b){a.attr&&(a=a[0]);return Eb(a,b)},removeClass:function(a,b){a.attr&&(a=a[0]);return Db(a,b)}})}}function La(a,b){var d=a&&a.$$hashKey;if(d)return"function"===typeof d&&(d=a.$$hashKey()),d;d=typeof a;return d="function"===d||"object"===d&&null!==a?a.$$hashKey=d+":"+(b||we)():d+":"+a}function pd(){this._keys=[];this._values=[];this._lastKey=NaN;this._lastIndex=-1}function qd(a){a=Function.prototype.toString.call(a).replace(Ag,
833"");return a.match(Bg)||a.match(Cg)}function Dg(a){return(a=qd(a))?"function("+(a[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function fb(a,b){function d(a){return function(b,c){if(D(b))r(b,Zb(a));else return a(b,c)}}function c(a,b){Ja(a,"service");if(B(b)||H(b))b=n.instantiate(b);if(!b.$get)throw Ca("pget",a);return p[a+"Provider"]=b}function e(a,b){return function(){var c=t.invoke(b,this);if(A(c))throw Ca("undef",a);return c}}function f(a,b,d){return c(a,{$get:!1!==d?e(a,b):b})}function g(a){gb(A(a)||
834H(a),"modulesToLoad","not an array");var b=[],c;r(a,function(a){function d(a){var b,c;b=0;for(c=a.length;b<c;b++){var e=a[b],f=n.get(e[0]);f[e[1]].apply(f,e[2])}}if(!m.get(a)){m.set(a,!0);try{C(a)?(c=lc(a),t.modules[a]=c,b=b.concat(g(c.requires)).concat(c._runBlocks),d(c._invokeQueue),d(c._configBlocks)):B(a)?b.push(n.invoke(a)):H(a)?b.push(n.invoke(a)):tb(a,"module")}catch(e){throw H(a)&&(a=a[a.length-1]),e.message&&e.stack&&-1===e.stack.indexOf(e.message)&&(e=e.message+"\n"+e.stack),Ca("modulerr",
835a,e.stack||e.message||e);}}});return b}function k(a,c){function d(b,e){if(a.hasOwnProperty(b)){if(a[b]===h)throw Ca("cdep",b+" <- "+l.join(" <- "));return a[b]}try{return l.unshift(b),a[b]=h,a[b]=c(b,e),a[b]}catch(f){throw a[b]===h&&delete a[b],f;}finally{l.shift()}}function e(a,c,f){var g=[];a=fb.$$annotate(a,b,f);for(var h=0,k=a.length;h<k;h++){var l=a[h];if("string"!==typeof l)throw Ca("itkn",l);g.push(c&&c.hasOwnProperty(l)?c[l]:d(l,f))}return g}return{invoke:function(a,b,c,d){"string"===typeof c&&
836(d=c,c=null);c=e(a,c,d);H(a)&&(a=a[a.length-1]);d=a;if(wa||"function"!==typeof d)d=!1;else{var f=d.$$ngIsClass;Ga(f)||(f=d.$$ngIsClass=/^class\b/.test(Function.prototype.toString.call(d)));d=f}return d?(c.unshift(null),new (Function.prototype.bind.apply(a,c))):a.apply(b,c)},instantiate:function(a,b,c){var d=H(a)?a[a.length-1]:a;a=e(a,b,c);a.unshift(null);return new (Function.prototype.bind.apply(d,a))},get:d,annotate:fb.$$annotate,has:function(b){return p.hasOwnProperty(b+"Provider")||a.hasOwnProperty(b)}}}
837b=!0===b;var h={},l=[],m=new Ib,p={$provide:{provider:d(c),factory:d(f),service:d(function(a,b){return f(a,["$injector",function(a){return a.instantiate(b)}])}),value:d(function(a,b){return f(a,ia(b),!1)}),constant:d(function(a,b){Ja(a,"constant");p[a]=b;s[a]=b}),decorator:function(a,b){var c=n.get(a+"Provider"),d=c.$get;c.$get=function(){var a=t.invoke(d,c);return t.invoke(b,null,{$delegate:a})}}}},n=p.$injector=k(p,function(a,b){ca.isString(b)&&l.push(b);throw Ca("unpr",l.join(" <- "));}),s={},
838G=k(s,function(a,b){var c=n.get(a+"Provider",b);return t.invoke(c.$get,c,void 0,a)}),t=G;p.$injectorProvider={$get:ia(G)};t.modules=n.modules=T();var N=g(a),t=G.get("$injector");t.strictDi=b;r(N,function(a){a&&t.invoke(a)});t.loadNewModules=function(a){r(g(a),function(a){a&&t.invoke(a)})};return t}function Bf(){var a=!0;this.disableAutoScrolling=function(){a=!1};this.$get=["$window","$location","$rootScope",function(b,d,c){function e(a){var b=null;Array.prototype.some.call(a,function(a){if("a"===
839ua(a))return b=a,!0});return b}function f(a){if(a){a.scrollIntoView();var c;c=g.yOffset;B(c)?c=c():ac(c)?(c=c[0],c="fixed"!==b.getComputedStyle(c).position?0:c.getBoundingClientRect().bottom):X(c)||(c=0);c&&(a=a.getBoundingClientRect().top,b.scrollBy(0,a-c))}else b.scrollTo(0,0)}function g(a){a=C(a)?a:X(a)?a.toString():d.hash();var b;a?(b=k.getElementById(a))?f(b):(b=e(k.getElementsByName(a)))?f(b):"top"===a&&f(null):f(null)}var k=b.document;a&&c.$watch(function(){return d.hash()},function(a,b){a===
840b&&""===a||vg(function(){c.$evalAsync(g)})});return g}]}function ib(a,b){if(!a&&!b)return"";if(!a)return b;if(!b)return a;H(a)&&(a=a.join(" "));H(b)&&(b=b.join(" "));return a+" "+b}function Eg(a){C(a)&&(a=a.split(" "));var b=T();r(a,function(a){a.length&&(b[a]=!0)});return b}function ra(a){return D(a)?a:{}}function Fg(a,b,d,c,e){function f(){pa=null;k()}function g(){t=y();t=A(t)?null:t;va(t,P)&&(t=P);N=P=t}function k(){var a=N;g();if(v!==h.url()||a!==t)v=h.url(),N=t,r(J,function(a){a(h.url(),t)})}
841var h=this,l=a.location,m=a.history,p=a.setTimeout,n=a.clearTimeout,s={},G=e(d);h.isMock=!1;h.$$completeOutstandingRequest=G.completeTask;h.$$incOutstandingRequestCount=G.incTaskCount;h.notifyWhenNoOutstandingRequests=G.notifyWhenNoPendingTasks;var t,N,v=l.href,kc=b.find("base"),pa=null,y=c.history?function(){try{return m.state}catch(a){}}:E;g();h.url=function(b,d,e){A(e)&&(e=null);l!==a.location&&(l=a.location);m!==a.history&&(m=a.history);if(b){var f=N===e;b=ga(b).href;if(v===b&&(!c.history||f))return h;
842var k=v&&Da(v)===Da(b);v=b;N=e;!c.history||k&&f?(k||(pa=b),d?l.replace(b):k?(d=l,e=b,f=e.indexOf("#"),e=-1===f?"":e.substr(f),d.hash=e):l.href=b,l.href!==b&&(pa=b)):(m[d?"replaceState":"pushState"](e,"",b),g());pa&&(pa=b);return h}return(pa||l.href).replace(/#$/,"")};h.state=function(){return t};var J=[],I=!1,P=null;h.onUrlChange=function(b){if(!I){if(c.history)x(a).on("popstate",f);x(a).on("hashchange",f);I=!0}J.push(b);return b};h.$$applicationDestroyed=function(){x(a).off("hashchange popstate",
843f)};h.$$checkUrlChange=k;h.baseHref=function(){var a=kc.attr("href");return a?a.replace(/^(https?:)?\/\/[^/]*/,""):""};h.defer=function(a,b,c){var d;b=b||0;c=c||G.DEFAULT_TASK_TYPE;G.incTaskCount(c);d=p(function(){delete s[d];G.completeTask(a,c)},b);s[d]=c;return d};h.defer.cancel=function(a){if(s.hasOwnProperty(a)){var b=s[a];delete s[a];n(a);G.completeTask(E,b);return!0}return!1}}function If(){this.$get=["$window","$log","$sniffer","$document","$$taskTrackerFactory",function(a,b,d,c,e){return new Fg(a,
844c,b,d,e)}]}function Jf(){this.$get=function(){function a(a,c){function e(a){a!==p&&(n?n===a&&(n=a.n):n=a,f(a.n,a.p),f(a,p),p=a,p.n=null)}function f(a,b){a!==b&&(a&&(a.p=b),b&&(b.n=a))}if(a in b)throw F("$cacheFactory")("iid",a);var g=0,k=S({},c,{id:a}),h=T(),l=c&&c.capacity||Number.MAX_VALUE,m=T(),p=null,n=null;return b[a]={put:function(a,b){if(!A(b)){if(l<Number.MAX_VALUE){var c=m[a]||(m[a]={key:a});e(c)}a in h||g++;h[a]=b;g>l&&this.remove(n.key);return b}},get:function(a){if(l<Number.MAX_VALUE){var b=
845m[a];if(!b)return;e(b)}return h[a]},remove:function(a){if(l<Number.MAX_VALUE){var b=m[a];if(!b)return;b===p&&(p=b.p);b===n&&(n=b.n);f(b.n,b.p);delete m[a]}a in h&&(delete h[a],g--)},removeAll:function(){h=T();g=0;m=T();p=n=null},destroy:function(){m=k=h=null;delete b[a]},info:function(){return S({},k,{size:g})}}}var b={};a.info=function(){var a={};r(b,function(b,e){a[e]=b.info()});return a};a.get=function(a){return b[a]};return a}}function hg(){this.$get=["$cacheFactory",function(a){return a("templates")}]}
846function Zc(a,b){function d(a,b,c){var d=/^([@&]|[=<](\*?))(\??)\s*([\w$]*)$/,e=T();r(a,function(a,f){a=a.trim();if(a in p)e[f]=p[a];else{var g=a.match(d);if(!g)throw $("iscp",b,f,a,c?"controller bindings definition":"isolate scope definition");e[f]={mode:g[1][0],collection:"*"===g[2],optional:"?"===g[3],attrName:g[4]||f};g[4]&&(p[a]=e[f])}});return e}function c(a){var b=a.charAt(0);if(!b||b!==K(b))throw $("baddir",a);if(a!==a.trim())throw $("baddir",a);}function e(a){var b=a.require||a.controller&&
847a.name;!H(b)&&D(b)&&r(b,function(a,c){var d=a.match(l);a.substring(d[0].length)||(b[c]=d[0]+c)});return b}var f={},g=/^\s*directive:\s*([\w-]+)\s+(.*)$/,k=/(([\w-]+)(?::([^;]+))?;?)/,h=Ae("ngSrc,ngSrcset,src,srcset"),l=/^(?:(\^\^?)?(\?)?(\^\^?)?)?/,m=/^(on[a-z]+|formaction)$/,p=T();this.directive=function pa(b,d){gb(b,"name");Ja(b,"directive");C(b)?(c(b),gb(d,"directiveFactory"),f.hasOwnProperty(b)||(f[b]=[],a.factory(b+"Directive",["$injector","$exceptionHandler",function(a,c){var d=[];r(f[b],function(f,
848g){try{var h=a.invoke(f);B(h)?h={compile:ia(h)}:!h.compile&&h.link&&(h.compile=ia(h.link));h.priority=h.priority||0;h.index=g;h.name=h.name||b;h.require=e(h);var k=h,l=h.restrict;if(l&&(!C(l)||!/[EACM]/.test(l)))throw $("badrestrict",l,b);k.restrict=l||"EA";h.$$moduleName=f.$$moduleName;d.push(h)}catch(m){c(m)}});return d}])),f[b].push(d)):r(b,Zb(pa));return this};this.component=function y(a,b){function c(a){function e(b){return B(b)||H(b)?function(c,d){return a.invoke(b,this,{$element:c,$attrs:d})}:
849b}var f=b.template||b.templateUrl?b.template:"",g={controller:d,controllerAs:Gg(b.controller)||b.controllerAs||"$ctrl",template:e(f),templateUrl:e(b.templateUrl),transclude:b.transclude,scope:{},bindToController:b.bindings||{},restrict:"E",require:b.require};r(b,function(a,b){"$"===b.charAt(0)&&(g[b]=a)});return g}if(!C(a))return r(a,Zb(Va(this,y))),this;var d=b.controller||function(){};r(b,function(a,b){"$"===b.charAt(0)&&(c[b]=a,B(d)&&(d[b]=a))});c.$inject=["$injector"];return this.directive(a,
850c)};this.aHrefSanitizationTrustedUrlList=function(a){return w(a)?(b.aHrefSanitizationTrustedUrlList(a),this):b.aHrefSanitizationTrustedUrlList()};Object.defineProperty(this,"aHrefSanitizationWhitelist",{get:function(){return this.aHrefSanitizationTrustedUrlList},set:function(a){this.aHrefSanitizationTrustedUrlList=a}});this.imgSrcSanitizationTrustedUrlList=function(a){return w(a)?(b.imgSrcSanitizationTrustedUrlList(a),this):b.imgSrcSanitizationTrustedUrlList()};Object.defineProperty(this,"imgSrcSanitizationWhitelist",
851{get:function(){return this.imgSrcSanitizationTrustedUrlList},set:function(a){this.imgSrcSanitizationTrustedUrlList=a}});var n=!0;this.debugInfoEnabled=function(a){return w(a)?(n=a,this):n};var s=!1;this.strictComponentBindingsEnabled=function(a){return w(a)?(s=a,this):s};var G=10;this.onChangesTtl=function(a){return arguments.length?(G=a,this):G};var t=!0;this.commentDirectivesEnabled=function(a){return arguments.length?(t=a,this):t};var N=!0;this.cssClassDirectivesEnabled=function(a){return arguments.length?
852(N=a,this):N};var v=T();this.addPropertySecurityContext=function(a,b,c){var d=a.toLowerCase()+"|"+b.toLowerCase();if(d in v&&v[d]!==c)throw $("ctxoverride",a,b,v[d],c);v[d]=c;return this};(function(){function a(b,c){r(c,function(a){v[a.toLowerCase()]=b})}a(W.HTML,["iframe|srcdoc","*|innerHTML","*|outerHTML"]);a(W.CSS,["*|style"]);a(W.URL,"area|href area|ping a|href a|ping blockquote|cite body|background del|cite input|src ins|cite q|cite".split(" "));a(W.MEDIA_URL,"audio|src img|src img|srcset source|src source|srcset track|src video|src video|poster".split(" "));
853a(W.RESOURCE_URL,"*|formAction applet|code applet|codebase base|href embed|src frame|src form|action head|profile html|manifest iframe|src link|href media|src object|codebase object|data script|src".split(" "))})();this.$get=["$injector","$interpolate","$exceptionHandler","$templateRequest","$parse","$controller","$rootScope","$sce","$animate",function(a,b,c,e,p,M,L,u,R){function q(){try{if(!--Ja)throw Ua=void 0,$("infchng",G);L.$apply(function(){for(var a=0,b=Ua.length;a<b;++a)try{Ua[a]()}catch(d){c(d)}Ua=
854void 0})}finally{Ja++}}function ma(a,b){if(!a)return a;if(!C(a))throw $("srcset",b,a.toString());for(var c="",d=V(a),e=/(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/,e=/\s/.test(d)?e:/(,)/,d=d.split(e),e=Math.floor(d.length/2),f=0;f<e;f++)var g=2*f,c=c+u.getTrustedMediaUrl(V(d[g])),c=c+(" "+V(d[g+1]));d=V(d[2*f]).split(/\s/);c+=u.getTrustedMediaUrl(V(d[0]));2===d.length&&(c+=" "+V(d[1]));return c}function w(a,b){if(b){var c=Object.keys(b),d,e,f;d=0;for(e=c.length;d<e;d++)f=c[d],this[f]=b[f]}else this.$attr=
855{};this.$$element=a}function O(a,b,c){Fa.innerHTML="<span "+b+">";b=Fa.firstChild.attributes;var d=b[0];b.removeNamedItem(d.name);d.value=c;a.attributes.setNamedItem(d)}function sa(a,b){try{a.addClass(b)}catch(c){}}function da(a,b,c,d,e){a instanceof x||(a=x(a));var f=Xa(a,b,a,c,d,e);da.$$addScopeClass(a);var g=null;return function(b,c,d){if(!a)throw $("multilink");gb(b,"scope");e&&e.needsNewScope&&(b=b.$parent.$new());d=d||{};var h=d.parentBoundTranscludeFn,k=d.transcludeControllers;d=d.futureParentElement;
856h&&h.$$boundTransclude&&(h=h.$$boundTransclude);g||(g=(d=d&&d[0])?"foreignobject"!==ua(d)&&la.call(d).match(/SVG/)?"svg":"html":"html");d="html"!==g?x(ja(g,x("<div></div>").append(a).html())):c?Wa.clone.call(a):a;if(k)for(var l in k)d.data("$"+l+"Controller",k[l].instance);da.$$addScopeInfo(d,b);c&&c(d,b);f&&f(b,d,d,h);c||(a=f=null);return d}}function Xa(a,b,c,d,e,f){function g(a,c,d,e){var f,k,l,m,p,I,t;if(n)for(t=Array(c.length),m=0;m<h.length;m+=3)f=h[m],t[f]=c[f];else t=c;m=0;for(p=h.length;m<
857p;)k=t[h[m++]],c=h[m++],f=h[m++],c?(c.scope?(l=a.$new(),da.$$addScopeInfo(x(k),l)):l=a,I=c.transcludeOnThisElement?ka(a,c.transclude,e):!c.templateOnThisElement&&e?e:!e&&b?ka(a,b):null,c(f,l,k,d,I)):f&&f(a,k.childNodes,void 0,e)}for(var h=[],k=H(a)||a instanceof x,l,m,p,I,n,t=0;t<a.length;t++){l=new w;11===wa&&jb(a,t,k);m=tc(a[t],[],l,0===t?d:void 0,e);(f=m.length?aa(m,a[t],l,b,c,null,[],[],f):null)&&f.scope&&da.$$addScopeClass(l.$$element);l=f&&f.terminal||!(p=a[t].childNodes)||!p.length?null:Xa(p,
858f?(f.transcludeOnThisElement||!f.templateOnThisElement)&&f.transclude:b);if(f||l)h.push(t,f,l),I=!0,n=n||f;f=null}return I?g:null}function jb(a,b,c){var d=a[b],e=d.parentNode,f;if(d.nodeType===Pa)for(;;){f=e?d.nextSibling:a[b+1];if(!f||f.nodeType!==Pa)break;d.nodeValue+=f.nodeValue;f.parentNode&&f.parentNode.removeChild(f);c&&f===a[b+1]&&a.splice(b+1,1)}}function ka(a,b,c){function d(e,f,g,h,k){e||(e=a.$new(!1,k),e.$$transcluded=!0);return b(e,f,{parentBoundTranscludeFn:c,transcludeControllers:g,
859futureParentElement:h})}var e=d.$$slots=T(),f;for(f in b.$$slots)e[f]=b.$$slots[f]?ka(a,b.$$slots[f],c):null;return d}function tc(a,b,d,e,f){var g=d.$attr,h;switch(a.nodeType){case 1:h=ua(a);Y(b,xa(h),"E",e,f);for(var l,m,n,t,J,s=a.attributes,v=0,G=s&&s.length;v<G;v++){var P=!1,N=!1,r=!1,y=!1,u=!1,M;l=s[v];m=l.name;t=l.value;n=xa(m.toLowerCase());(J=n.match(Ra))?(r="Attr"===J[1],y="Prop"===J[1],u="On"===J[1],m=m.replace(rd,"").toLowerCase().substr(4+J[1].length).replace(/_(.)/g,function(a,b){return b.toUpperCase()})):
860(M=n.match(Sa))&&ca(M[1])&&(P=m,N=m.substr(0,m.length-5)+"end",m=m.substr(0,m.length-6));if(y||u)d[n]=t,g[n]=l.name,y?Ea(a,b,n,m):b.push(sd(p,L,c,n,m,!1));else{n=xa(m.toLowerCase());g[n]=m;if(r||!d.hasOwnProperty(n))d[n]=t,nd(a,n)&&(d[n]=!0);Ia(a,b,t,n,r);Y(b,n,"A",e,f,P,N)}}"input"===h&&"hidden"===a.getAttribute("type")&&a.setAttribute("autocomplete","off");if(!Qa)break;g=a.className;D(g)&&(g=g.animVal);if(C(g)&&""!==g)for(;a=k.exec(g);)n=xa(a[2]),Y(b,n,"C",e,f)&&(d[n]=V(a[3])),g=g.substr(a.index+
861a[0].length);break;case Pa:na(b,a.nodeValue);break;case 8:if(!Oa)break;F(a,b,d,e,f)}b.sort(ia);return b}function F(a,b,c,d,e){try{var f=g.exec(a.nodeValue);if(f){var h=xa(f[1]);Y(b,h,"M",d,e)&&(c[h]=V(f[2]))}}catch(k){}}function U(a,b,c){var d=[],e=0;if(b&&a.hasAttribute&&a.hasAttribute(b)){do{if(!a)throw $("uterdir",b,c);1===a.nodeType&&(a.hasAttribute(b)&&e++,a.hasAttribute(c)&&e--);d.push(a);a=a.nextSibling}while(0<e)}else d.push(a);return x(d)}function W(a,b,c){return function(d,e,f,g,h){e=U(e[0],
862b,c);return a(d,e,f,g,h)}}function Z(a,b,c,d,e,f){var g;return a?da(b,c,d,e,f):function(){g||(g=da(b,c,d,e,f),b=c=f=null);return g.apply(this,arguments)}}function aa(a,b,d,e,f,g,h,k,l){function m(a,b,c,d){if(a){c&&(a=W(a,c,d));a.require=u.require;a.directiveName=Q;if(s===u||u.$$isolateScope)a=Ba(a,{isolateScope:!0});h.push(a)}if(b){c&&(b=W(b,c,d));b.require=u.require;b.directiveName=Q;if(s===u||u.$$isolateScope)b=Ba(b,{isolateScope:!0});k.push(b)}}function p(a,e,f,g,l){function m(a,b,c,d){var e;bb(a)||
863(d=c,c=b,b=a,a=void 0);N&&(e=P);c||(c=N?Q.parent():Q);if(d){var f=l.$$slots[d];if(f)return f(a,b,e,c,R);if(A(f))throw $("noslot",d,Aa(Q));}else return l(a,b,e,c,R)}var n,u,L,y,G,P,M,Q;b===f?(g=d,Q=d.$$element):(Q=x(f),g=new w(Q,d));G=e;s?y=e.$new(!0):t&&(G=e.$parent);l&&(M=m,M.$$boundTransclude=l,M.isSlotFilled=function(a){return!!l.$$slots[a]});J&&(P=ea(Q,g,M,J,y,e,s));s&&(da.$$addScopeInfo(Q,y,!0,!(v&&(v===s||v===s.$$originalDirective))),da.$$addScopeClass(Q,!0),y.$$isolateBindings=s.$$isolateBindings,
864u=Da(e,g,y,y.$$isolateBindings,s),u.removeWatches&&y.$on("$destroy",u.removeWatches));for(n in P){u=J[n];L=P[n];var Hg=u.$$bindings.bindToController;L.instance=L();Q.data("$"+u.name+"Controller",L.instance);L.bindingInfo=Da(G,g,L.instance,Hg,u)}r(J,function(a,b){var c=a.require;a.bindToController&&!H(c)&&D(c)&&S(P[b].instance,X(b,c,Q,P))});r(P,function(a){var b=a.instance;if(B(b.$onChanges))try{b.$onChanges(a.bindingInfo.initialChanges)}catch(d){c(d)}if(B(b.$onInit))try{b.$onInit()}catch(e){c(e)}B(b.$doCheck)&&
865(G.$watch(function(){b.$doCheck()}),b.$doCheck());B(b.$onDestroy)&&G.$on("$destroy",function(){b.$onDestroy()})});n=0;for(u=h.length;n<u;n++)L=h[n],Ca(L,L.isolateScope?y:e,Q,g,L.require&&X(L.directiveName,L.require,Q,P),M);var R=e;s&&(s.template||null===s.templateUrl)&&(R=y);a&&a(R,f.childNodes,void 0,l);for(n=k.length-1;0<=n;n--)L=k[n],Ca(L,L.isolateScope?y:e,Q,g,L.require&&X(L.directiveName,L.require,Q,P),M);r(P,function(a){a=a.instance;B(a.$postLink)&&a.$postLink()})}l=l||{};for(var n=-Number.MAX_VALUE,
866t=l.newScopeDirective,J=l.controllerDirectives,s=l.newIsolateScopeDirective,v=l.templateDirective,L=l.nonTlbTranscludeDirective,G=!1,P=!1,N=l.hasElementTranscludeDirective,y=d.$$element=x(b),u,Q,M,R=e,q,ma=!1,Jb=!1,O,sa=0,C=a.length;sa<C;sa++){u=a[sa];var E=u.$$start,jb=u.$$end;E&&(y=U(b,E,jb));M=void 0;if(n>u.priority)break;if(O=u.scope)u.templateUrl||(D(O)?(ba("new/isolated scope",s||t,u,y),s=u):ba("new/isolated scope",s,u,y)),t=t||u;Q=u.name;if(!ma&&(u.replace&&(u.templateUrl||u.template)||u.transclude&&
867!u.$$tlb)){for(O=sa+1;ma=a[O++];)if(ma.transclude&&!ma.$$tlb||ma.replace&&(ma.templateUrl||ma.template)){Jb=!0;break}ma=!0}!u.templateUrl&&u.controller&&(J=J||T(),ba("'"+Q+"' controller",J[Q],u,y),J[Q]=u);if(O=u.transclude)if(G=!0,u.$$tlb||(ba("transclusion",L,u,y),L=u),"element"===O)N=!0,n=u.priority,M=y,y=d.$$element=x(da.$$createComment(Q,d[Q])),b=y[0],oa(f,Ha.call(M,0),b),R=Z(Jb,M,e,n,g&&g.name,{nonTlbTranscludeDirective:L});else{var ka=T();if(D(O)){M=z.document.createDocumentFragment();var Xa=
868T(),F=T();r(O,function(a,b){var c="?"===a.charAt(0);a=c?a.substring(1):a;Xa[a]=b;ka[b]=null;F[b]=c});r(y.contents(),function(a){var b=Xa[xa(ua(a))];b?(F[b]=!0,ka[b]=ka[b]||z.document.createDocumentFragment(),ka[b].appendChild(a)):M.appendChild(a)});r(F,function(a,b){if(!a)throw $("reqslot",b);});for(var K in ka)ka[K]&&(R=x(ka[K].childNodes),ka[K]=Z(Jb,R,e));M=x(M.childNodes)}else M=x(qc(b)).contents();y.empty();R=Z(Jb,M,e,void 0,void 0,{needsNewScope:u.$$isolateScope||u.$$newScope});R.$$slots=ka}if(u.template)if(P=
869!0,ba("template",v,u,y),v=u,O=B(u.template)?u.template(y,d):u.template,O=Na(O),u.replace){g=u;M=nc.test(O)?td(ja(u.templateNamespace,V(O))):[];b=M[0];if(1!==M.length||1!==b.nodeType)throw $("tplrt",Q,"");oa(f,y,b);C={$attr:{}};O=tc(b,[],C);var Ig=a.splice(sa+1,a.length-(sa+1));(s||t)&&fa(O,s,t);a=a.concat(O).concat(Ig);ga(d,C);C=a.length}else y.html(O);if(u.templateUrl)P=!0,ba("template",v,u,y),v=u,u.replace&&(g=u),p=ha(a.splice(sa,a.length-sa),y,d,f,G&&R,h,k,{controllerDirectives:J,newScopeDirective:t!==
870u&&t,newIsolateScopeDirective:s,templateDirective:v,nonTlbTranscludeDirective:L}),C=a.length;else if(u.compile)try{q=u.compile(y,d,R);var Y=u.$$originalDirective||u;B(q)?m(null,Va(Y,q),E,jb):q&&m(Va(Y,q.pre),Va(Y,q.post),E,jb)}catch(ca){c(ca,Aa(y))}u.terminal&&(p.terminal=!0,n=Math.max(n,u.priority))}p.scope=t&&!0===t.scope;p.transcludeOnThisElement=G;p.templateOnThisElement=P;p.transclude=R;l.hasElementTranscludeDirective=N;return p}function X(a,b,c,d){var e;if(C(b)){var f=b.match(l);b=b.substring(f[0].length);
871var g=f[1]||f[3],f="?"===f[2];"^^"===g?c=c.parent():e=(e=d&&d[b])&&e.instance;if(!e){var h="$"+b+"Controller";e="^^"===g&&c[0]&&9===c[0].nodeType?null:g?c.inheritedData(h):c.data(h)}if(!e&&!f)throw $("ctreq",b,a);}else if(H(b))for(e=[],g=0,f=b.length;g<f;g++)e[g]=X(a,b[g],c,d);else D(b)&&(e={},r(b,function(b,f){e[f]=X(a,b,c,d)}));return e||null}function ea(a,b,c,d,e,f,g){var h=T(),k;for(k in d){var l=d[k],m={$scope:l===g||l.$$isolateScope?e:f,$element:a,$attrs:b,$transclude:c},p=l.controller;"@"===
872p&&(p=b[l.name]);m=M(p,m,!0,l.controllerAs);h[l.name]=m;a.data("$"+l.name+"Controller",m.instance)}return h}function fa(a,b,c){for(var d=0,e=a.length;d<e;d++)a[d]=bc(a[d],{$$isolateScope:b,$$newScope:c})}function Y(b,c,e,g,h,k,l){if(c===h)return null;var m=null;if(f.hasOwnProperty(c)){h=a.get(c+"Directive");for(var p=0,n=h.length;p<n;p++)if(c=h[p],(A(g)||g>c.priority)&&-1!==c.restrict.indexOf(e)){k&&(c=bc(c,{$$start:k,$$end:l}));if(!c.$$bindings){var I=m=c,t=c.name,u={isolateScope:null,bindToController:null};
873D(I.scope)&&(!0===I.bindToController?(u.bindToController=d(I.scope,t,!0),u.isolateScope={}):u.isolateScope=d(I.scope,t,!1));D(I.bindToController)&&(u.bindToController=d(I.bindToController,t,!0));if(u.bindToController&&!I.controller)throw $("noctrl",t);m=m.$$bindings=u;D(m.isolateScope)&&(c.$$isolateBindings=m.isolateScope)}b.push(c);m=c}}return m}function ca(b){if(f.hasOwnProperty(b))for(var c=a.get(b+"Directive"),d=0,e=c.length;d<e;d++)if(b=c[d],b.multiElement)return!0;return!1}function ga(a,b){var c=
874b.$attr,d=a.$attr;r(a,function(d,e){"$"!==e.charAt(0)&&(b[e]&&b[e]!==d&&(d=d.length?d+(("style"===e?";":" ")+b[e]):b[e]),a.$set(e,d,!0,c[e]))});r(b,function(b,e){a.hasOwnProperty(e)||"$"===e.charAt(0)||(a[e]=b,"class"!==e&&"style"!==e&&(d[e]=c[e]))})}function ha(a,b,d,f,g,h,k,l){var m=[],p,n,t=b[0],u=a.shift(),J=bc(u,{templateUrl:null,transclude:null,replace:null,$$originalDirective:u}),s=B(u.templateUrl)?u.templateUrl(b,d):u.templateUrl,L=u.templateNamespace;b.empty();e(s).then(function(c){var e,
875I;c=Na(c);if(u.replace){c=nc.test(c)?td(ja(L,V(c))):[];e=c[0];if(1!==c.length||1!==e.nodeType)throw $("tplrt",u.name,s);c={$attr:{}};oa(f,b,e);var v=tc(e,[],c);D(u.scope)&&fa(v,!0);a=v.concat(a);ga(d,c)}else e=t,b.html(c);a.unshift(J);p=aa(a,e,d,g,b,u,h,k,l);r(f,function(a,c){a===e&&(f[c]=b[0])});for(n=Xa(b[0].childNodes,g);m.length;){c=m.shift();I=m.shift();var y=m.shift(),P=m.shift(),v=b[0];if(!c.$$destroyed){if(I!==t){var G=I.className;l.hasElementTranscludeDirective&&u.replace||(v=qc(e));oa(y,
876x(I),v);sa(x(v),G)}I=p.transcludeOnThisElement?ka(c,p.transclude,P):P;p(n,c,v,f,I)}}m=null}).catch(function(a){dc(a)&&c(a)});return function(a,b,c,d,e){a=e;b.$$destroyed||(m?m.push(b,c,d,a):(p.transcludeOnThisElement&&(a=ka(b,p.transclude,e)),p(n,b,c,d,a)))}}function ia(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name<b.name?-1:1:a.index-b.index}function ba(a,b,c,d){function e(a){return a?" (module: "+a+")":""}if(b)throw $("multidir",b.name,e(b.$$moduleName),c.name,e(c.$$moduleName),
877a,Aa(d));}function na(a,c){var d=b(c,!0);d&&a.push({priority:0,compile:function(a){a=a.parent();var b=!!a.length;b&&da.$$addBindingClass(a);return function(a,c){var e=c.parent();b||da.$$addBindingClass(e);da.$$addBindingInfo(e,d.expressions);a.$watch(d,function(a){c[0].nodeValue=a})}}})}function ja(a,b){a=K(a||"html");switch(a){case "svg":case "math":var c=z.document.createElement("div");c.innerHTML="<"+a+">"+b+"</"+a+">";return c.childNodes[0].childNodes;default:return b}}function qa(a,b){if("srcdoc"===
878b)return u.HTML;if("src"===b||"ngSrc"===b)return-1===["img","video","audio","source","track"].indexOf(a)?u.RESOURCE_URL:u.MEDIA_URL;if("xlinkHref"===b)return"image"===a?u.MEDIA_URL:"a"===a?u.URL:u.RESOURCE_URL;if("form"===a&&"action"===b||"base"===a&&"href"===b||"link"===a&&"href"===b)return u.RESOURCE_URL;if("a"===a&&("href"===b||"ngHref"===b))return u.URL}function ya(a,b){var c=b.toLowerCase();return v[a+"|"+c]||v["*|"+c]}function za(a){return ma(u.valueOf(a),"ng-prop-srcset")}function Ea(a,b,c,
879d){if(m.test(d))throw $("nodomevents");a=ua(a);var e=ya(a,d),f=Ta;"srcset"!==d||"img"!==a&&"source"!==a?e&&(f=u.getTrusted.bind(u,e)):f=za;b.push({priority:100,compile:function(a,b){var e=p(b[c]),g=p(b[c],function(a){return u.valueOf(a)});return{pre:function(a,b){function c(){var g=e(a);b[0][d]=f(g)}c();a.$watch(g,c)}}}})}function Ia(a,c,d,e,f){var g=ua(a),k=qa(g,e),l=h[e]||f,p=b(d,!f,k,l);if(p){if("multiple"===e&&"select"===g)throw $("selmulti",Aa(a));if(m.test(e))throw $("nodomevents");c.push({priority:100,
880compile:function(){return{pre:function(a,c,f){c=f.$$observers||(f.$$observers=T());var g=f[e];g!==d&&(p=g&&b(g,!0,k,l),d=g);p&&(f[e]=p(a),(c[e]||(c[e]=[])).$$inter=!0,(f.$$observers&&f.$$observers[e].$$scope||a).$watch(p,function(a,b){"class"===e&&a!==b?f.$updateClass(a,b):f.$set(e,a)}))}}}})}}function oa(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,h;if(a)for(g=0,h=a.length;g<h;g++)if(a[g]===d){a[g++]=c;h=g+e-1;for(var k=a.length;g<k;g++,h++)h<k?a[g]=a[h]:delete a[g];a.length-=e-1;a.context===d&&
881(a.context=c);break}f&&f.replaceChild(c,d);a=z.document.createDocumentFragment();for(g=0;g<e;g++)a.appendChild(b[g]);x.hasData(d)&&(x.data(c,x.data(d)),x(d).off("$destroy"));x.cleanData(a.querySelectorAll("*"));for(g=1;g<e;g++)delete b[g];b[0]=c;b.length=1}function Ba(a,b){return S(function(){return a.apply(null,arguments)},a,b)}function Ca(a,b,d,e,f,g){try{a(b,d,e,f,g)}catch(h){c(h,Aa(d))}}function ra(a,b){if(s)throw $("missingattr",a,b);}function Da(a,c,d,e,f){function g(b,c,e){B(d.$onChanges)&&
882!ec(c,e)&&(Ua||(a.$$postDigest(q),Ua=[]),m||(m={},Ua.push(h)),m[b]&&(e=m[b].previousValue),m[b]=new Kb(e,c))}function h(){d.$onChanges(m);m=void 0}var k=[],l={},m;r(e,function(e,h){var m=e.attrName,n=e.optional,I,t,u,s;switch(e.mode){case "@":n||ta.call(c,m)||(ra(m,f.name),d[h]=c[m]=void 0);n=c.$observe(m,function(a){if(C(a)||Ga(a))g(h,a,d[h]),d[h]=a});c.$$observers[m].$$scope=a;I=c[m];C(I)?d[h]=b(I)(a):Ga(I)&&(d[h]=I);l[h]=new Kb(uc,d[h]);k.push(n);break;case "=":if(!ta.call(c,m)){if(n)break;ra(m,
883f.name);c[m]=void 0}if(n&&!c[m])break;t=p(c[m]);s=t.literal?va:ec;u=t.assign||function(){I=d[h]=t(a);throw $("nonassign",c[m],m,f.name);};I=d[h]=t(a);n=function(b){s(b,d[h])||(s(b,I)?u(a,b=d[h]):d[h]=b);return I=b};n.$stateful=!0;n=e.collection?a.$watchCollection(c[m],n):a.$watch(p(c[m],n),null,t.literal);k.push(n);break;case "<":if(!ta.call(c,m)){if(n)break;ra(m,f.name);c[m]=void 0}if(n&&!c[m])break;t=p(c[m]);var v=t.literal,L=d[h]=t(a);l[h]=new Kb(uc,d[h]);n=a[e.collection?"$watchCollection":"$watch"](t,
884function(a,b){if(b===a){if(b===L||v&&va(b,L))return;b=L}g(h,a,b);d[h]=a});k.push(n);break;case "&":n||ta.call(c,m)||ra(m,f.name);t=c.hasOwnProperty(m)?p(c[m]):E;if(t===E&&n)break;d[h]=function(b){return t(a,b)}}});return{initialChanges:l,removeWatches:k.length&&function(){for(var a=0,b=k.length;a<b;++a)k[a]()}}}var Ma=/^\w/,Fa=z.document.createElement("div"),Oa=t,Qa=N,Ja=G,Ua;w.prototype={$normalize:xa,$addClass:function(a){a&&0<a.length&&R.addClass(this.$$element,a)},$removeClass:function(a){a&&
8850<a.length&&R.removeClass(this.$$element,a)},$updateClass:function(a,b){var c=ud(a,b);c&&c.length&&R.addClass(this.$$element,c);(c=ud(b,a))&&c.length&&R.removeClass(this.$$element,c)},$set:function(a,b,d,e){var f=nd(this.$$element[0],a),g=vd[a],h=a;f?(this.$$element.prop(a,b),e=f):g&&(this[g]=b,h=g);this[a]=b;e?this.$attr[a]=e:(e=this.$attr[a])||(this.$attr[a]=e=Xc(a,"-"));"img"===ua(this.$$element)&&"srcset"===a&&(this[a]=b=ma(b,"$set('srcset', value)"));!1!==d&&(null===b||A(b)?this.$$element.removeAttr(e):
886Ma.test(e)?f&&!1===b?this.$$element.removeAttr(e):this.$$element.attr(e,b):O(this.$$element[0],e,b));(a=this.$$observers)&&r(a[h],function(a){try{a(b)}catch(d){c(d)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers=T()),e=d[a]||(d[a]=[]);e.push(b);L.$evalAsync(function(){e.$$inter||!c.hasOwnProperty(a)||A(c[a])||b(c[a])});return function(){cb(e,b)}}};var Ka=b.startSymbol(),La=b.endSymbol(),Na="{{"===Ka&&"}}"===La?Ta:function(a){return a.replace(/\{\{/g,Ka).replace(/}}/g,La)},Ra=
887/^ng(Attr|Prop|On)([A-Z].*)$/,Sa=/^(.+)Start$/;da.$$addBindingInfo=n?function(a,b){var c=a.data("$binding")||[];H(b)?c=c.concat(b):c.push(b);a.data("$binding",c)}:E;da.$$addBindingClass=n?function(a){sa(a,"ng-binding")}:E;da.$$addScopeInfo=n?function(a,b,c,d){a.data(c?d?"$isolateScopeNoTemplate":"$isolateScope":"$scope",b)}:E;da.$$addScopeClass=n?function(a,b){sa(a,b?"ng-isolate-scope":"ng-scope")}:E;da.$$createComment=function(a,b){var c="";n&&(c=" "+(a||"")+": ",b&&(c+=b+" "));return z.document.createComment(c)};
888return da}]}function Kb(a,b){this.previousValue=a;this.currentValue=b}function xa(a){return a.replace(rd,"").replace(Jg,function(a,d,c){return c?d.toUpperCase():d})}function ud(a,b){var d="",c=a.split(/\s+/),e=b.split(/\s+/),f=0;a:for(;f<c.length;f++){for(var g=c[f],k=0;k<e.length;k++)if(g===e[k])continue a;d+=(0<d.length?" ":"")+g}return d}function td(a){a=x(a);var b=a.length;if(1>=b)return a;for(;b--;){var d=a[b];(8===d.nodeType||d.nodeType===Pa&&""===d.nodeValue.trim())&&Kg.call(a,b,1)}return a}
889function Gg(a,b){if(b&&C(b))return b;if(C(a)){var d=wd.exec(a);if(d)return d[3]}}function Kf(){var a={};this.has=function(b){return a.hasOwnProperty(b)};this.register=function(b,d){Ja(b,"controller");D(b)?S(a,b):a[b]=d};this.$get=["$injector",function(b){function d(a,b,d,g){if(!a||!D(a.$scope))throw F("$controller")("noscp",g,b);a.$scope[b]=d}return function(c,e,f,g){var k,h,l;f=!0===f;g&&C(g)&&(l=g);if(C(c)){g=c.match(wd);if(!g)throw xd("ctrlfmt",c);h=g[1];l=l||g[3];c=a.hasOwnProperty(h)?a[h]:Le(e.$scope,
890h,!0);if(!c)throw xd("ctrlreg",h);tb(c,h,!0)}if(f)return f=(H(c)?c[c.length-1]:c).prototype,k=Object.create(f||null),l&&d(e,l,k,h||c.name),S(function(){var a=b.invoke(c,k,e,h);a!==k&&(D(a)||B(a))&&(k=a,l&&d(e,l,k,h||c.name));return k},{instance:k,identifier:l});k=b.instantiate(c,e,h);l&&d(e,l,k,h||c.name);return k}}]}function Lf(){this.$get=["$window",function(a){return x(a.document)}]}function Mf(){this.$get=["$document","$rootScope",function(a,b){function d(){e=c.hidden}var c=a[0],e=c&&c.hidden;
891a.on("visibilitychange",d);b.$on("$destroy",function(){a.off("visibilitychange",d)});return function(){return e}}]}function Nf(){this.$get=["$log",function(a){return function(b,d){a.error.apply(a,arguments)}}]}function vc(a){return D(a)?ha(a)?a.toISOString():eb(a):a}function Tf(){this.$get=function(){return function(a){if(!a)return"";var b=[];Qc(a,function(a,c){null===a||A(a)||B(a)||(H(a)?r(a,function(a){b.push(ba(c)+"="+ba(vc(a)))}):b.push(ba(c)+"="+ba(vc(a))))});return b.join("&")}}}function Uf(){this.$get=
892function(){return function(a){function b(a,e,f){H(a)?r(a,function(a,c){b(a,e+"["+(D(a)?c:"")+"]")}):D(a)&&!ha(a)?Qc(a,function(a,c){b(a,e+(f?"":"[")+c+(f?"":"]"))}):(B(a)&&(a=a()),d.push(ba(e)+"="+(null==a?"":ba(vc(a)))))}if(!a)return"";var d=[];b(a,"",!0);return d.join("&")}}}function wc(a,b){if(C(a)){var d=a.replace(Lg,"").trim();if(d){var c=b("Content-Type"),c=c&&0===c.indexOf(yd),e;(e=c)||(e=(e=d.match(Mg))&&Ng[e[0]].test(d));if(e)try{a=Tc(d)}catch(f){if(!c)return a;throw Lb("baddata",a,f);}}}return a}
893function zd(a){var b=T(),d;C(a)?r(a.split("\n"),function(a){d=a.indexOf(":");var e=K(V(a.substr(0,d)));a=V(a.substr(d+1));e&&(b[e]=b[e]?b[e]+", "+a:a)}):D(a)&&r(a,function(a,d){var f=K(d),g=V(a);f&&(b[f]=b[f]?b[f]+", "+g:g)});return b}function Ad(a){var b;return function(d){b||(b=zd(a));return d?(d=b[K(d)],void 0===d&&(d=null),d):b}}function Bd(a,b,d,c){if(B(c))return c(a,b,d);r(c,function(c){a=c(a,b,d)});return a}function Sf(){var a=this.defaults={transformResponse:[wc],transformRequest:[function(a){return D(a)&&
894"[object File]"!==la.call(a)&&"[object Blob]"!==la.call(a)&&"[object FormData]"!==la.call(a)?eb(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:ja(xc),put:ja(xc),patch:ja(xc)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer",jsonpCallbackParam:"callback"},b=!1;this.useApplyAsync=function(a){return w(a)?(b=!!a,this):b};var d=this.interceptors=[],c=this.xsrfTrustedOrigins=[];Object.defineProperty(this,"xsrfWhitelistedOrigins",
895{get:function(){return this.xsrfTrustedOrigins},set:function(a){this.xsrfTrustedOrigins=a}});this.$get=["$browser","$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector","$sce",function(e,f,g,k,h,l,m,p){function n(b){function c(a,b){for(var d=0,e=b.length;d<e;){var f=b[d++],g=b[d++];a=a.then(f,g)}b.length=0;return a}function d(a,b){var c,e={};r(a,function(a,d){B(a)?(c=a(b),null!=c&&(e[d]=c)):e[d]=a});return e}function f(a){var b=S({},a);b.data=Bd(a.data,a.headers,a.status,g.transformResponse);
896a=a.status;return 200<=a&&300>a?b:l.reject(b)}if(!D(b))throw F("$http")("badreq",b);if(!C(p.valueOf(b.url)))throw F("$http")("badreq",b.url);var g=S({method:"get",transformRequest:a.transformRequest,transformResponse:a.transformResponse,paramSerializer:a.paramSerializer,jsonpCallbackParam:a.jsonpCallbackParam},b);g.headers=function(b){var c=a.headers,e=S({},b.headers),f,g,h,c=S({},c.common,c[K(b.method)]);a:for(f in c){g=K(f);for(h in e)if(K(h)===g)continue a;e[f]=c[f]}return d(e,ja(b))}(b);g.method=
897vb(g.method);g.paramSerializer=C(g.paramSerializer)?m.get(g.paramSerializer):g.paramSerializer;e.$$incOutstandingRequestCount("$http");var h=[],k=[];b=l.resolve(g);r(v,function(a){(a.request||a.requestError)&&h.unshift(a.request,a.requestError);(a.response||a.responseError)&&k.push(a.response,a.responseError)});b=c(b,h);b=b.then(function(b){var c=b.headers,d=Bd(b.data,Ad(c),void 0,b.transformRequest);A(d)&&r(c,function(a,b){"content-type"===K(b)&&delete c[b]});A(b.withCredentials)&&!A(a.withCredentials)&&
898(b.withCredentials=a.withCredentials);return s(b,d).then(f,f)});b=c(b,k);return b=b.finally(function(){e.$$completeOutstandingRequest(E,"$http")})}function s(c,d){function e(a){if(a){var c={};r(a,function(a,d){c[d]=function(c){function d(){a(c)}b?h.$applyAsync(d):h.$$phase?d():h.$apply(d)}});return c}}function k(a,c,d,e,f){function g(){m(c,a,d,e,f)}R&&(200<=a&&300>a?R.put(O,[a,c,zd(d),e,f]):R.remove(O));b?h.$applyAsync(g):(g(),h.$$phase||h.$apply())}function m(a,b,d,e,f){b=-1<=b?b:0;(200<=b&&300>
899b?L.resolve:L.reject)({data:a,status:b,headers:Ad(d),config:c,statusText:e,xhrStatus:f})}function s(a){m(a.data,a.status,ja(a.headers()),a.statusText,a.xhrStatus)}function v(){var a=n.pendingRequests.indexOf(c);-1!==a&&n.pendingRequests.splice(a,1)}var L=l.defer(),u=L.promise,R,q,ma=c.headers,x="jsonp"===K(c.method),O=c.url;x?O=p.getTrustedResourceUrl(O):C(O)||(O=p.valueOf(O));O=G(O,c.paramSerializer(c.params));x&&(O=t(O,c.jsonpCallbackParam));n.pendingRequests.push(c);u.then(v,v);!c.cache&&!a.cache||
900!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(R=D(c.cache)?c.cache:D(a.cache)?a.cache:N);R&&(q=R.get(O),w(q)?q&&B(q.then)?q.then(s,s):H(q)?m(q[1],q[0],ja(q[2]),q[3],q[4]):m(q,200,{},"OK","complete"):R.put(O,u));A(q)&&((q=kc(c.url)?g()[c.xsrfCookieName||a.xsrfCookieName]:void 0)&&(ma[c.xsrfHeaderName||a.xsrfHeaderName]=q),f(c.method,O,d,k,ma,c.timeout,c.withCredentials,c.responseType,e(c.eventHandlers),e(c.uploadEventHandlers)));return u}function G(a,b){0<b.length&&(a+=(-1===a.indexOf("?")?
901"?":"&")+b);return a}function t(a,b){var c=a.split("?");if(2<c.length)throw Lb("badjsonp",a);c=hc(c[1]);r(c,function(c,d){if("JSON_CALLBACK"===c)throw Lb("badjsonp",a);if(d===b)throw Lb("badjsonp",b,a);});return a+=(-1===a.indexOf("?")?"?":"&")+b+"=JSON_CALLBACK"}var N=k("$http");a.paramSerializer=C(a.paramSerializer)?m.get(a.paramSerializer):a.paramSerializer;var v=[];r(d,function(a){v.unshift(C(a)?m.get(a):m.invoke(a))});var kc=Og(c);n.pendingRequests=[];(function(a){r(arguments,function(a){n[a]=
902function(b,c){return n(S({},c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){r(arguments,function(a){n[a]=function(b,c,d){return n(S({},d||{},{method:a,url:b,data:c}))}})})("post","put","patch");n.defaults=a;return n}]}function Wf(){this.$get=function(){return function(){return new z.XMLHttpRequest}}}function Vf(){this.$get=["$browser","$jsonpCallbacks","$document","$xhrFactory",function(a,b,d,c){return Pg(a,c,a.defer,b,d[0])}]}function Pg(a,b,d,c,e){function f(a,b,d){a=a.replace("JSON_CALLBACK",
903b);var f=e.createElement("script"),m=null;f.type="text/javascript";f.src=a;f.async=!0;m=function(a){f.removeEventListener("load",m);f.removeEventListener("error",m);e.body.removeChild(f);f=null;var g=-1,s="unknown";a&&("load"!==a.type||c.wasCalled(b)||(a={type:"error"}),s=a.type,g="error"===a.type?404:200);d&&d(g,s)};f.addEventListener("load",m);f.addEventListener("error",m);e.body.appendChild(f);return m}return function(e,k,h,l,m,p,n,s,G,t){function N(a){J="timeout"===a;pa&&pa();y&&y.abort()}function v(a,
904b,c,e,f,g){w(P)&&d.cancel(P);pa=y=null;a(b,c,e,f,g)}k=k||a.url();if("jsonp"===K(e))var q=c.createCallback(k),pa=f(k,q,function(a,b){var d=200===a&&c.getResponse(q);v(l,a,d,"",b,"complete");c.removeCallback(q)});else{var y=b(e,k),J=!1;y.open(e,k,!0);r(m,function(a,b){w(a)&&y.setRequestHeader(b,a)});y.onload=function(){var a=y.statusText||"",b="response"in y?y.response:y.responseText,c=1223===y.status?204:y.status;0===c&&(c=b?200:"file"===ga(k).protocol?404:0);v(l,c,b,y.getAllResponseHeaders(),a,"complete")};
905y.onerror=function(){v(l,-1,null,null,"","error")};y.ontimeout=function(){v(l,-1,null,null,"","timeout")};y.onabort=function(){v(l,-1,null,null,"",J?"timeout":"abort")};r(G,function(a,b){y.addEventListener(b,a)});r(t,function(a,b){y.upload.addEventListener(b,a)});n&&(y.withCredentials=!0);if(s)try{y.responseType=s}catch(I){if("json"!==s)throw I;}y.send(A(h)?null:h)}if(0<p)var P=d(function(){N("timeout")},p);else p&&B(p.then)&&p.then(function(){N(w(p.$$timeoutId)?"timeout":"abort")})}}function Pf(){var a=
906"{{",b="}}";this.startSymbol=function(b){return b?(a=b,this):a};this.endSymbol=function(a){return a?(b=a,this):b};this.$get=["$parse","$exceptionHandler","$sce",function(d,c,e){function f(a){return"\\\\\\"+a}function g(c){return c.replace(p,a).replace(n,b)}function k(a,b,c,d){var e=a.$watch(function(a){e();return d(a)},b,c);return e}function h(f,h,n,p){function v(a){try{return a=n&&!r?e.getTrusted(n,a):e.valueOf(a),p&&!w(a)?a:jc(a)}catch(b){c(Ma.interr(f,b))}}var r=n===e.URL||n===e.MEDIA_URL;if(!f.length||
907-1===f.indexOf(a)){if(h)return;h=g(f);r&&(h=e.getTrusted(n,h));h=ia(h);h.exp=f;h.expressions=[];h.$$watchDelegate=k;return h}p=!!p;for(var q,y,J=0,I=[],P,Q=f.length,M=[],L=[],u;J<Q;)if(-1!==(q=f.indexOf(a,J))&&-1!==(y=f.indexOf(b,q+l)))J!==q&&M.push(g(f.substring(J,q))),J=f.substring(q+l,y),I.push(J),J=y+m,L.push(M.length),M.push("");else{J!==Q&&M.push(g(f.substring(J)));break}u=1===M.length&&1===L.length;var R=r&&u?void 0:v;P=I.map(function(a){return d(a,R)});if(!h||I.length){var x=function(a){for(var b=
9080,c=I.length;b<c;b++){if(p&&A(a[b]))return;M[L[b]]=a[b]}if(r)return e.getTrusted(n,u?M[0]:M.join(""));n&&1<M.length&&Ma.throwNoconcat(f);return M.join("")};return S(function(a){var b=0,d=I.length,e=Array(d);try{for(;b<d;b++)e[b]=P[b](a);return x(e)}catch(g){c(Ma.interr(f,g))}},{exp:f,expressions:I,$$watchDelegate:function(a,b){var c;return a.$watchGroup(P,function(d,e){var f=x(d);b.call(this,f,d!==e?c:f,a);c=f})}})}}var l=a.length,m=b.length,p=new RegExp(a.replace(/./g,f),"g"),n=new RegExp(b.replace(/./g,
909f),"g");h.startSymbol=function(){return a};h.endSymbol=function(){return b};return h}]}function Qf(){this.$get=["$$intervalFactory","$window",function(a,b){var d={},c=function(a){b.clearInterval(a);delete d[a]},e=a(function(a,c,e){a=b.setInterval(a,c);d[a]=e;return a},c);e.cancel=function(a){if(!a)return!1;if(!a.hasOwnProperty("$$intervalId"))throw Qg("badprom");if(!d.hasOwnProperty(a.$$intervalId))return!1;a=a.$$intervalId;var b=d[a],e=b.promise;e.$$state&&(e.$$state.pur=!0);b.reject("canceled");
910c(a);return!0};return e}]}function Rf(){this.$get=["$browser","$q","$$q","$rootScope",function(a,b,d,c){return function(e,f){return function(g,k,h,l){function m(){p?g.apply(null,n):g(s)}var p=4<arguments.length,n=p?Ha.call(arguments,4):[],s=0,G=w(l)&&!l,t=(G?d:b).defer(),r=t.promise;h=w(h)?h:0;r.$$intervalId=e(function(){G?a.defer(m):c.$evalAsync(m);t.notify(s++);0<h&&s>=h&&(t.resolve(s),f(r.$$intervalId));G||c.$apply()},k,t,G);return r}}}]}function Cd(a,b){var d=ga(a);b.$$protocol=d.protocol;b.$$host=
911d.hostname;b.$$port=fa(d.port)||Rg[d.protocol]||null}function Dd(a,b,d){if(Sg.test(a))throw kb("badpath",a);var c="/"!==a.charAt(0);c&&(a="/"+a);a=ga(a);for(var c=(c&&"/"===a.pathname.charAt(0)?a.pathname.substring(1):a.pathname).split("/"),e=c.length;e--;)c[e]=decodeURIComponent(c[e]),d&&(c[e]=c[e].replace(/\//g,"%2F"));d=c.join("/");b.$$path=d;b.$$search=hc(a.search);b.$$hash=decodeURIComponent(a.hash);b.$$path&&"/"!==b.$$path.charAt(0)&&(b.$$path="/"+b.$$path)}function yc(a,b){return a.slice(0,
912b.length)===b}function ya(a,b){if(yc(b,a))return b.substr(a.length)}function Da(a){var b=a.indexOf("#");return-1===b?a:a.substr(0,b)}function zc(a,b,d){this.$$html5=!0;d=d||"";Cd(a,this);this.$$parse=function(a){var d=ya(b,a);if(!C(d))throw kb("ipthprfx",a,b);Dd(d,this,!0);this.$$path||(this.$$path="/");this.$$compose()};this.$$normalizeUrl=function(a){return b+a.substr(1)};this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;w(f=ya(a,c))?(g=f,g=d&&w(f=ya(d,f))?
913b+(ya("/",f)||f):a+g):w(f=ya(b,c))?g=b+f:b===c+"/"&&(g=b);g&&this.$$parse(g);return!!g}}function Ac(a,b,d){Cd(a,this);this.$$parse=function(c){var e=ya(a,c)||ya(b,c),f;A(e)||"#"!==e.charAt(0)?this.$$html5?f=e:(f="",A(e)&&(a=c,this.replace())):(f=ya(d,e),A(f)&&(f=e));Dd(f,this,!1);c=this.$$path;var e=a,g=/^\/[A-Z]:(\/.*)/;yc(f,e)&&(f=f.replace(e,""));g.exec(f)||(c=(f=g.exec(c))?f[1]:c);this.$$path=c;this.$$compose()};this.$$normalizeUrl=function(b){return a+(b?d+b:"")};this.$$parseLinkUrl=function(b,
914d){return Da(a)===Da(b)?(this.$$parse(b),!0):!1}}function Ed(a,b,d){this.$$html5=!0;Ac.apply(this,arguments);this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;a===Da(c)?f=c:(g=ya(b,c))?f=a+d+g:b===c+"/"&&(f=b);f&&this.$$parse(f);return!!f};this.$$normalizeUrl=function(b){return a+d+b}}function Mb(a){return function(){return this[a]}}function Fd(a,b){return function(d){if(A(d))return this[a];this[a]=b(d);this.$$compose();return this}}function Yf(){var a="!",
915b={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(b){return w(b)?(a=b,this):a};this.html5Mode=function(a){if(Ga(a))return b.enabled=a,this;if(D(a)){Ga(a.enabled)&&(b.enabled=a.enabled);Ga(a.requireBase)&&(b.requireBase=a.requireBase);if(Ga(a.rewriteLinks)||C(a.rewriteLinks))b.rewriteLinks=a.rewriteLinks;return this}return b};this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(d,c,e,f,g){function k(a,b){return a===b||ga(a).href===ga(b).href}function h(a,
916b,d){var e=m.url(),f=m.$$state;try{c.url(a,b,d),m.$$state=c.state()}catch(g){throw m.url(e),m.$$state=f,g;}}function l(a,b){d.$broadcast("$locationChangeSuccess",m.absUrl(),a,m.$$state,b)}var m,p;p=c.baseHref();var n=c.url(),s;if(b.enabled){if(!p&&b.requireBase)throw kb("nobase");s=n.substring(0,n.indexOf("/",n.indexOf("//")+2))+(p||"/");p=e.history?zc:Ed}else s=Da(n),p=Ac;var r=s.substr(0,Da(s).lastIndexOf("/")+1);m=new p(s,r,"#"+a);m.$$parseLinkUrl(n,n);m.$$state=c.state();var t=/^\s*(javascript|mailto):/i;
917f.on("click",function(a){var e=b.rewriteLinks;if(e&&!a.ctrlKey&&!a.metaKey&&!a.shiftKey&&2!==a.which&&2!==a.button){for(var g=x(a.target);"a"!==ua(g[0]);)if(g[0]===f[0]||!(g=g.parent())[0])return;if(!C(e)||!A(g.attr(e))){var e=g.prop("href"),h=g.attr("href")||g.attr("xlink:href");D(e)&&"[object SVGAnimatedString]"===e.toString()&&(e=ga(e.animVal).href);t.test(e)||!e||g.attr("target")||a.isDefaultPrevented()||!m.$$parseLinkUrl(e,h)||(a.preventDefault(),m.absUrl()!==c.url()&&d.$apply())}}});m.absUrl()!==
918n&&c.url(m.absUrl(),!0);var N=!0;c.onUrlChange(function(a,b){yc(a,r)?(d.$evalAsync(function(){var c=m.absUrl(),e=m.$$state,f;m.$$parse(a);m.$$state=b;f=d.$broadcast("$locationChangeStart",a,c,b,e).defaultPrevented;m.absUrl()===a&&(f?(m.$$parse(c),m.$$state=e,h(c,!1,e)):(N=!1,l(c,e)))}),d.$$phase||d.$digest()):g.location.href=a});d.$watch(function(){if(N||m.$$urlUpdatedByLocation){m.$$urlUpdatedByLocation=!1;var a=c.url(),b=m.absUrl(),f=c.state(),g=m.$$replace,n=!k(a,b)||m.$$html5&&e.history&&f!==
919m.$$state;if(N||n)N=!1,d.$evalAsync(function(){var b=m.absUrl(),c=d.$broadcast("$locationChangeStart",b,a,m.$$state,f).defaultPrevented;m.absUrl()===b&&(c?(m.$$parse(a),m.$$state=f):(n&&h(b,g,f===m.$$state?null:m.$$state),l(a,f)))})}m.$$replace=!1});return m}]}function Zf(){var a=!0,b=this;this.debugEnabled=function(b){return w(b)?(a=b,this):a};this.$get=["$window",function(d){function c(a){dc(a)&&(a.stack&&f?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&
920(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=d.console||{},e=b[a]||b.log||E;return function(){var a=[];r(arguments,function(b){a.push(c(b))});return Function.prototype.apply.call(e,b,a)}}var f=wa||/\bEdge\//.test(d.navigator&&d.navigator.userAgent);return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){a&&c.apply(b,arguments)}}()}}]}function Tg(a){return a+""}function Ug(a,b){return"undefined"!==typeof a?a:
921b}function Gd(a,b){return"undefined"===typeof a?b:"undefined"===typeof b?a:a+b}function Vg(a,b){switch(a.type){case q.MemberExpression:if(a.computed)return!1;break;case q.UnaryExpression:return 1;case q.BinaryExpression:return"+"!==a.operator?1:!1;case q.CallExpression:return!1}return void 0===b?Hd:b}function Z(a,b,d){var c,e,f=a.isPure=Vg(a,d);switch(a.type){case q.Program:c=!0;r(a.body,function(a){Z(a.expression,b,f);c=c&&a.expression.constant});a.constant=c;break;case q.Literal:a.constant=!0;a.toWatch=
922[];break;case q.UnaryExpression:Z(a.argument,b,f);a.constant=a.argument.constant;a.toWatch=a.argument.toWatch;break;case q.BinaryExpression:Z(a.left,b,f);Z(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.left.toWatch.concat(a.right.toWatch);break;case q.LogicalExpression:Z(a.left,b,f);Z(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.constant?[]:[a];break;case q.ConditionalExpression:Z(a.test,b,f);Z(a.alternate,b,f);Z(a.consequent,b,f);a.constant=a.test.constant&&
923a.alternate.constant&&a.consequent.constant;a.toWatch=a.constant?[]:[a];break;case q.Identifier:a.constant=!1;a.toWatch=[a];break;case q.MemberExpression:Z(a.object,b,f);a.computed&&Z(a.property,b,f);a.constant=a.object.constant&&(!a.computed||a.property.constant);a.toWatch=a.constant?[]:[a];break;case q.CallExpression:c=d=a.filter?!b(a.callee.name).$stateful:!1;e=[];r(a.arguments,function(a){Z(a,b,f);c=c&&a.constant;e.push.apply(e,a.toWatch)});a.constant=c;a.toWatch=d?e:[a];break;case q.AssignmentExpression:Z(a.left,
924b,f);Z(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=[a];break;case q.ArrayExpression:c=!0;e=[];r(a.elements,function(a){Z(a,b,f);c=c&&a.constant;e.push.apply(e,a.toWatch)});a.constant=c;a.toWatch=e;break;case q.ObjectExpression:c=!0;e=[];r(a.properties,function(a){Z(a.value,b,f);c=c&&a.value.constant;e.push.apply(e,a.value.toWatch);a.computed&&(Z(a.key,b,!1),c=c&&a.key.constant,e.push.apply(e,a.key.toWatch))});a.constant=c;a.toWatch=e;break;case q.ThisExpression:a.constant=
925!1;a.toWatch=[];break;case q.LocalsExpression:a.constant=!1,a.toWatch=[]}}function Id(a){if(1===a.length){a=a[0].expression;var b=a.toWatch;return 1!==b.length?b:b[0]!==a?b:void 0}}function Jd(a){return a.type===q.Identifier||a.type===q.MemberExpression}function Kd(a){if(1===a.body.length&&Jd(a.body[0].expression))return{type:q.AssignmentExpression,left:a.body[0].expression,right:{type:q.NGValueParameter},operator:"="}}function Ld(a){this.$filter=a}function Md(a){this.$filter=a}function Nb(a,b,d){this.ast=
926new q(a,d);this.astCompiler=d.csp?new Md(b):new Ld(b)}function Bc(a){return B(a.valueOf)?a.valueOf():Wg.call(a)}function $f(){var a=T(),b={"true":!0,"false":!1,"null":null,undefined:void 0},d,c;this.addLiteral=function(a,c){b[a]=c};this.setIdentifierFns=function(a,b){d=a;c=b;return this};this.$get=["$filter",function(e){function f(b,c){var d,f;switch(typeof b){case "string":return f=b=b.trim(),d=a[f],d||(d=new Ob(G),d=(new Nb(d,e,G)).parse(b),a[f]=p(d)),s(d,c);case "function":return s(b,c);default:return s(E,
927c)}}function g(a,b,c){return null==a||null==b?a===b:"object"!==typeof a||(a=Bc(a),"object"!==typeof a||c)?a===b||a!==a&&b!==b:!1}function k(a,b,c,d,e){var f=d.inputs,h;if(1===f.length){var k=g,f=f[0];return a.$watch(function(a){var b=f(a);g(b,k,f.isPure)||(h=d(a,void 0,void 0,[b]),k=b&&Bc(b));return h},b,c,e)}for(var l=[],m=[],n=0,p=f.length;n<p;n++)l[n]=g,m[n]=null;return a.$watch(function(a){for(var b=!1,c=0,e=f.length;c<e;c++){var k=f[c](a);if(b||(b=!g(k,l[c],f[c].isPure)))m[c]=k,l[c]=k&&Bc(k)}b&&
928(h=d(a,void 0,void 0,m));return h},b,c,e)}function h(a,b,c,d,e){function f(){h(m)&&k()}function g(a,b,c,d){m=u&&d?d[0]:n(a,b,c,d);h(m)&&a.$$postDigest(f);return s(m)}var h=d.literal?l:w,k,m,n=d.$$intercepted||d,s=d.$$interceptor||Ta,u=d.inputs&&!n.inputs;g.literal=d.literal;g.constant=d.constant;g.inputs=d.inputs;p(g);return k=a.$watch(g,b,c,e)}function l(a){var b=!0;r(a,function(a){w(a)||(b=!1)});return b}function m(a,b,c,d){var e=a.$watch(function(a){e();return d(a)},b,c);return e}function p(a){a.constant?
929a.$$watchDelegate=m:a.oneTime?a.$$watchDelegate=h:a.inputs&&(a.$$watchDelegate=k);return a}function n(a,b){function c(d){return b(a(d))}c.$stateful=a.$stateful||b.$stateful;c.$$pure=a.$$pure&&b.$$pure;return c}function s(a,b){if(!b)return a;a.$$interceptor&&(b=n(a.$$interceptor,b),a=a.$$intercepted);var c=!1,d=function(d,e,f,g){d=c&&g?g[0]:a(d,e,f,g);return b(d)};d.$$intercepted=a;d.$$interceptor=b;d.literal=a.literal;d.oneTime=a.oneTime;d.constant=a.constant;b.$stateful||(c=!a.inputs,d.inputs=a.inputs?
930a.inputs:[a],b.$$pure||(d.inputs=d.inputs.map(function(a){return a.isPure===Hd?function(b){return a(b)}:a})));return p(d)}var G={csp:Ba().noUnsafeEval,literals:Ia(b),isIdentifierStart:B(d)&&d,isIdentifierContinue:B(c)&&c};f.$$getAst=function(a){var b=new Ob(G);return(new Nb(b,e,G)).getAst(a).ast};return f}]}function bg(){var a=!0;this.$get=["$rootScope","$exceptionHandler",function(b,d){return Nd(function(a){b.$evalAsync(a)},d,a)}];this.errorOnUnhandledRejections=function(b){return w(b)?(a=b,this):
931a}}function cg(){var a=!0;this.$get=["$browser","$exceptionHandler",function(b,d){return Nd(function(a){b.defer(a)},d,a)}];this.errorOnUnhandledRejections=function(b){return w(b)?(a=b,this):a}}function Nd(a,b,d){function c(){return new e}function e(){var a=this.promise=new f;this.resolve=function(b){h(a,b)};this.reject=function(b){m(a,b)};this.notify=function(b){n(a,b)}}function f(){this.$$state={status:0}}function g(){for(;!w&&x.length;){var a=x.shift();if(!a.pur){a.pur=!0;var c=a.value,c="Possibly unhandled rejection: "+
932("function"===typeof c?c.toString().replace(/ \{[\s\S]*$/,""):A(c)?"undefined":"string"!==typeof c?Ne(c,void 0):c);dc(a.value)?b(a.value,c):b(c)}}}function k(c){!d||c.pending||2!==c.status||c.pur||(0===w&&0===x.length&&a(g),x.push(c));!c.processScheduled&&c.pending&&(c.processScheduled=!0,++w,a(function(){var e,f,k;k=c.pending;c.processScheduled=!1;c.pending=void 0;try{for(var l=0,n=k.length;l<n;++l){c.pur=!0;f=k[l][0];e=k[l][c.status];try{B(e)?h(f,e(c.value)):1===c.status?h(f,c.value):m(f,c.value)}catch(p){m(f,
933p),p&&!0===p.$$passToExceptionHandler&&b(p)}}}finally{--w,d&&0===w&&a(g)}}))}function h(a,b){a.$$state.status||(b===a?p(a,v("qcycle",b)):l(a,b))}function l(a,b){function c(b){g||(g=!0,l(a,b))}function d(b){g||(g=!0,p(a,b))}function e(b){n(a,b)}var f,g=!1;try{if(D(b)||B(b))f=b.then;B(f)?(a.$$state.status=-1,f.call(b,c,d,e)):(a.$$state.value=b,a.$$state.status=1,k(a.$$state))}catch(h){d(h)}}function m(a,b){a.$$state.status||p(a,b)}function p(a,b){a.$$state.value=b;a.$$state.status=2;k(a.$$state)}function n(c,
934d){var e=c.$$state.pending;0>=c.$$state.status&&e&&e.length&&a(function(){for(var a,c,f=0,g=e.length;f<g;f++){c=e[f][0];a=e[f][3];try{n(c,B(a)?a(d):d)}catch(h){b(h)}}})}function s(a){var b=new f;m(b,a);return b}function G(a,b,c){var d=null;try{B(c)&&(d=c())}catch(e){return s(e)}return d&&B(d.then)?d.then(function(){return b(a)},s):b(a)}function t(a,b,c,d){var e=new f;h(e,a);return e.then(b,c,d)}function q(a){if(!B(a))throw v("norslvr",a);var b=new f;a(function(a){h(b,a)},function(a){m(b,a)});return b}
935var v=F("$q",TypeError),w=0,x=[];S(f.prototype,{then:function(a,b,c){if(A(a)&&A(b)&&A(c))return this;var d=new f;this.$$state.pending=this.$$state.pending||[];this.$$state.pending.push([d,a,b,c]);0<this.$$state.status&&k(this.$$state);return d},"catch":function(a){return this.then(null,a)},"finally":function(a,b){return this.then(function(b){return G(b,y,a)},function(b){return G(b,s,a)},b)}});var y=t;q.prototype=f.prototype;q.defer=c;q.reject=s;q.when=t;q.resolve=y;q.all=function(a){var b=new f,c=
9360,d=H(a)?[]:{};r(a,function(a,e){c++;t(a).then(function(a){d[e]=a;--c||h(b,d)},function(a){m(b,a)})});0===c&&h(b,d);return b};q.race=function(a){var b=c();r(a,function(a){t(a).then(b.resolve,b.reject)});return b.promise};return q}function mg(){this.$get=["$window","$timeout",function(a,b){var d=a.requestAnimationFrame||a.webkitRequestAnimationFrame,c=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.webkitCancelRequestAnimationFrame,e=!!d,f=e?function(a){var b=d(a);return function(){c(b)}}:
937function(a){var c=b(a,16.66,!1);return function(){b.cancel(c)}};f.supported=e;return f}]}function ag(){function a(a){function b(){this.$$watchers=this.$$nextSibling=this.$$childHead=this.$$childTail=null;this.$$listeners={};this.$$listenerCount={};this.$$watchersCount=0;this.$id=++qb;this.$$ChildScope=null;this.$$suspended=!1}b.prototype=a;return b}var b=10,d=F("$rootScope"),c=null,e=null;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$exceptionHandler","$parse","$browser",
938function(f,g,k){function h(a){a.currentScope.$$destroyed=!0}function l(a){9===wa&&(a.$$childHead&&l(a.$$childHead),a.$$nextSibling&&l(a.$$nextSibling));a.$parent=a.$$nextSibling=a.$$prevSibling=a.$$childHead=a.$$childTail=a.$root=a.$$watchers=null}function m(){this.$id=++qb;this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this.$root=this;this.$$suspended=this.$$destroyed=!1;this.$$listeners={};this.$$listenerCount={};this.$$watchersCount=
9390;this.$$isolateBindings=null}function p(a){if(v.$$phase)throw d("inprog",v.$$phase);v.$$phase=a}function n(a,b){do a.$$watchersCount+=b;while(a=a.$parent)}function s(a,b,c){do a.$$listenerCount[c]-=b,0===a.$$listenerCount[c]&&delete a.$$listenerCount[c];while(a=a.$parent)}function G(){}function t(){for(;y.length;)try{y.shift()()}catch(a){f(a)}e=null}function q(){null===e&&(e=k.defer(function(){v.$apply(t)},null,"$applyAsync"))}m.prototype={constructor:m,$new:function(b,c){var d;c=c||this;b?(d=new m,
940d.$root=this.$root):(this.$$ChildScope||(this.$$ChildScope=a(this)),d=new this.$$ChildScope);d.$parent=c;d.$$prevSibling=c.$$childTail;c.$$childHead?(c.$$childTail.$$nextSibling=d,c.$$childTail=d):c.$$childHead=c.$$childTail=d;(b||c!==this)&&d.$on("$destroy",h);return d},$watch:function(a,b,d,e){var f=g(a);b=B(b)?b:E;if(f.$$watchDelegate)return f.$$watchDelegate(this,b,d,f,a);var h=this,k=h.$$watchers,l={fn:b,last:G,get:f,exp:e||a,eq:!!d};c=null;k||(k=h.$$watchers=[],k.$$digestWatchIndex=-1);k.unshift(l);
941k.$$digestWatchIndex++;n(this,1);return function(){var a=cb(k,l);0<=a&&(n(h,-1),a<k.$$digestWatchIndex&&k.$$digestWatchIndex--);c=null}},$watchGroup:function(a,b){function c(){h=!1;try{k?(k=!1,b(e,e,g)):b(e,d,g)}finally{for(var f=0;f<a.length;f++)d[f]=e[f]}}var d=Array(a.length),e=Array(a.length),f=[],g=this,h=!1,k=!0;if(!a.length){var l=!0;g.$evalAsync(function(){l&&b(e,e,g)});return function(){l=!1}}if(1===a.length)return this.$watch(a[0],function(a,c,f){e[0]=a;d[0]=c;b(e,a===c?e:d,f)});r(a,function(a,
942b){var d=g.$watch(a,function(a){e[b]=a;h||(h=!0,g.$evalAsync(c))});f.push(d)});return function(){for(;f.length;)f.shift()()}},$watchCollection:function(a,b){function c(a){e=a;var b,d,g,h;if(!A(e)){if(D(e))if(za(e))for(f!==n&&(f=n,t=f.length=0,l++),a=e.length,t!==a&&(l++,f.length=t=a),b=0;b<a;b++)h=f[b],g=e[b],d=h!==h&&g!==g,d||h===g||(l++,f[b]=g);else{f!==p&&(f=p={},t=0,l++);a=0;for(b in e)ta.call(e,b)&&(a++,g=e[b],h=f[b],b in f?(d=h!==h&&g!==g,d||h===g||(l++,f[b]=g)):(t++,f[b]=g,l++));if(t>a)for(b in l++,
943f)ta.call(e,b)||(t--,delete f[b])}else f!==e&&(f=e,l++);return l}}c.$$pure=g(a).literal;c.$stateful=!c.$$pure;var d=this,e,f,h,k=1<b.length,l=0,m=g(a,c),n=[],p={},s=!0,t=0;return this.$watch(m,function(){s?(s=!1,b(e,e,d)):b(e,h,d);if(k)if(D(e))if(za(e)){h=Array(e.length);for(var a=0;a<e.length;a++)h[a]=e[a]}else for(a in h={},e)ta.call(e,a)&&(h[a]=e[a]);else h=e})},$digest:function(){var a,g,h,l,m,n,s,r=b,q,y=w.length?v:this,N=[],A,z;p("$digest");k.$$checkUrlChange();this===v&&null!==e&&(k.defer.cancel(e),
944t());c=null;do{s=!1;q=y;for(n=0;n<w.length;n++){try{z=w[n],l=z.fn,l(z.scope,z.locals)}catch(C){f(C)}c=null}w.length=0;a:do{if(n=!q.$$suspended&&q.$$watchers)for(n.$$digestWatchIndex=n.length;n.$$digestWatchIndex--;)try{if(a=n[n.$$digestWatchIndex])if(m=a.get,(g=m(q))!==(h=a.last)&&!(a.eq?va(g,h):Y(g)&&Y(h)))s=!0,c=a,a.last=a.eq?Ia(g,null):g,l=a.fn,l(g,h===G?g:h,q),5>r&&(A=4-r,N[A]||(N[A]=[]),N[A].push({msg:B(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,newVal:g,oldVal:h}));else if(a===c){s=
945!1;break a}}catch(E){f(E)}if(!(n=!q.$$suspended&&q.$$watchersCount&&q.$$childHead||q!==y&&q.$$nextSibling))for(;q!==y&&!(n=q.$$nextSibling);)q=q.$parent}while(q=n);if((s||w.length)&&!r--)throw v.$$phase=null,d("infdig",b,N);}while(s||w.length);for(v.$$phase=null;J<x.length;)try{x[J++]()}catch(D){f(D)}x.length=J=0;k.$$checkUrlChange()},$suspend:function(){this.$$suspended=!0},$isSuspended:function(){return this.$$suspended},$resume:function(){this.$$suspended=!1},$destroy:function(){if(!this.$$destroyed){var a=
946this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;this===v&&k.$$applicationDestroyed();n(this,-this.$$watchersCount);for(var b in this.$$listenerCount)s(this,this.$$listenerCount[b],b);a&&a.$$childHead===this&&(a.$$childHead=this.$$nextSibling);a&&a.$$childTail===this&&(a.$$childTail=this.$$prevSibling);this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling);this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling);this.$destroy=this.$digest=this.$apply=
947this.$evalAsync=this.$applyAsync=E;this.$on=this.$watch=this.$watchGroup=function(){return E};this.$$listeners={};this.$$nextSibling=null;l(this)}},$eval:function(a,b){return g(a)(this,b)},$evalAsync:function(a,b){v.$$phase||w.length||k.defer(function(){w.length&&v.$digest()},null,"$evalAsync");w.push({scope:this,fn:g(a),locals:b})},$$postDigest:function(a){x.push(a)},$apply:function(a){try{p("$apply");try{return this.$eval(a)}finally{v.$$phase=null}}catch(b){f(b)}finally{try{v.$digest()}catch(c){throw f(c),
948c;}}},$applyAsync:function(a){function b(){c.$eval(a)}var c=this;a&&y.push(b);a=g(a);q()},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){var d=c.indexOf(b);-1!==d&&(delete c[d],s(e,1,a))}},$emit:function(a,b){var c=[],d,e=this,g=!1,h={name:a,targetScope:e,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=
949!0},defaultPrevented:!1},k=db([h],arguments,1),l,m;do{d=e.$$listeners[a]||c;h.currentScope=e;l=0;for(m=d.length;l<m;l++)if(d[l])try{d[l].apply(null,k)}catch(n){f(n)}else d.splice(l,1),l--,m--;if(g)break;e=e.$parent}while(e);h.currentScope=null;return h},$broadcast:function(a,b){var c=this,d=this,e={name:a,targetScope:this,preventDefault:function(){e.defaultPrevented=!0},defaultPrevented:!1};if(!this.$$listenerCount[a])return e;for(var g=db([e],arguments,1),h,k;c=d;){e.currentScope=c;d=c.$$listeners[a]||
950[];h=0;for(k=d.length;h<k;h++)if(d[h])try{d[h].apply(null,g)}catch(l){f(l)}else d.splice(h,1),h--,k--;if(!(d=c.$$listenerCount[a]&&c.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=c.$parent}e.currentScope=null;return e}};var v=new m,w=v.$$asyncQueue=[],x=v.$$postDigestQueue=[],y=v.$$applyAsyncQueue=[],J=0;return v}]}function Qe(){var a=/^\s*(https?|s?ftp|mailto|tel|file):/,b=/^\s*((https?|ftp|file|blob):|data:image\/)/;this.aHrefSanitizationTrustedUrlList=function(b){return w(b)?
951(a=b,this):a};this.imgSrcSanitizationTrustedUrlList=function(a){return w(a)?(b=a,this):b};this.$get=function(){return function(d,c){var e=c?b:a,f=ga(d&&d.trim()).href;return""===f||f.match(e)?d:"unsafe:"+f}}}function Xg(a){if("self"===a)return a;if(C(a)){if(-1<a.indexOf("***"))throw Ea("iwcard",a);a=Od(a).replace(/\\\*\\\*/g,".*").replace(/\\\*/g,"[^:/.?&;]*");return new RegExp("^"+a+"$")}if(ab(a))return new RegExp("^"+a.source+"$");throw Ea("imatcher");}function Pd(a){var b=[];w(a)&&r(a,function(a){b.push(Xg(a))});
952return b}function eg(){this.SCE_CONTEXTS=W;var a=["self"],b=[];this.trustedResourceUrlList=function(b){arguments.length&&(a=Pd(b));return a};Object.defineProperty(this,"resourceUrlWhitelist",{get:function(){return this.trustedResourceUrlList},set:function(a){this.trustedResourceUrlList=a}});this.bannedResourceUrlList=function(a){arguments.length&&(b=Pd(a));return b};Object.defineProperty(this,"resourceUrlBlacklist",{get:function(){return this.bannedResourceUrlList},set:function(a){this.bannedResourceUrlList=
953a}});this.$get=["$injector","$$sanitizeUri",function(d,c){function e(a,b){var c;"self"===a?(c=Cc(b,Qd))||(z.document.baseURI?c=z.document.baseURI:(Na||(Na=z.document.createElement("a"),Na.href=".",Na=Na.cloneNode(!1)),c=Na.href),c=Cc(b,c)):c=!!a.exec(b.href);return c}function f(a){var b=function(a){this.$$unwrapTrustedValue=function(){return a}};a&&(b.prototype=new a);b.prototype.valueOf=function(){return this.$$unwrapTrustedValue()};b.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()};
954return b}var g=function(a){throw Ea("unsafe");};d.has("$sanitize")&&(g=d.get("$sanitize"));var k=f(),h={};h[W.HTML]=f(k);h[W.CSS]=f(k);h[W.MEDIA_URL]=f(k);h[W.URL]=f(h[W.MEDIA_URL]);h[W.JS]=f(k);h[W.RESOURCE_URL]=f(h[W.URL]);return{trustAs:function(a,b){var c=h.hasOwnProperty(a)?h[a]:null;if(!c)throw Ea("icontext",a,b);if(null===b||A(b)||""===b)return b;if("string"!==typeof b)throw Ea("itype",a);return new c(b)},getTrusted:function(d,f){if(null===f||A(f)||""===f)return f;var k=h.hasOwnProperty(d)?
955h[d]:null;if(k&&f instanceof k)return f.$$unwrapTrustedValue();B(f.$$unwrapTrustedValue)&&(f=f.$$unwrapTrustedValue());if(d===W.MEDIA_URL||d===W.URL)return c(f.toString(),d===W.MEDIA_URL);if(d===W.RESOURCE_URL){var k=ga(f.toString()),n,s,r=!1;n=0;for(s=a.length;n<s;n++)if(e(a[n],k)){r=!0;break}if(r)for(n=0,s=b.length;n<s;n++)if(e(b[n],k)){r=!1;break}if(r)return f;throw Ea("insecurl",f.toString());}if(d===W.HTML)return g(f);throw Ea("unsafe");},valueOf:function(a){return a instanceof k?a.$$unwrapTrustedValue():
956a}}}]}function dg(){var a=!0;this.enabled=function(b){arguments.length&&(a=!!b);return a};this.$get=["$parse","$sceDelegate",function(b,d){if(a&&8>wa)throw Ea("iequirks");var c=ja(W);c.isEnabled=function(){return a};c.trustAs=d.trustAs;c.getTrusted=d.getTrusted;c.valueOf=d.valueOf;a||(c.trustAs=c.getTrusted=function(a,b){return b},c.valueOf=Ta);c.parseAs=function(a,d){var e=b(d);return e.literal&&e.constant?e:b(d,function(b){return c.getTrusted(a,b)})};var e=c.parseAs,f=c.getTrusted,g=c.trustAs;r(W,
957function(a,b){var d=K(b);c[("parse_as_"+d).replace(Dc,xb)]=function(b){return e(a,b)};c[("get_trusted_"+d).replace(Dc,xb)]=function(b){return f(a,b)};c[("trust_as_"+d).replace(Dc,xb)]=function(b){return g(a,b)}});return c}]}function fg(){this.$get=["$window","$document",function(a,b){var d={},c=!((!a.nw||!a.nw.process)&&a.chrome&&(a.chrome.app&&a.chrome.app.runtime||!a.chrome.app&&a.chrome.runtime&&a.chrome.runtime.id))&&a.history&&a.history.pushState,e=fa((/android (\d+)/.exec(K((a.navigator||{}).userAgent))||
958[])[1]),f=/Boxee/i.test((a.navigator||{}).userAgent),g=b[0]||{},k=g.body&&g.body.style,h=!1,l=!1;k&&(h=!!("transition"in k||"webkitTransition"in k),l=!!("animation"in k||"webkitAnimation"in k));return{history:!(!c||4>e||f),hasEvent:function(a){if("input"===a&&wa)return!1;if(A(d[a])){var b=g.createElement("div");d[a]="on"+a in b}return d[a]},csp:Ba(),transitions:h,animations:l,android:e}}]}function gg(){this.$get=ia(function(a){return new Yg(a)})}function Yg(a){function b(){var a=e.pop();return a&&
959a.cb}function d(a){for(var b=e.length-1;0<=b;--b){var c=e[b];if(c.type===a)return e.splice(b,1),c.cb}}var c={},e=[],f=this.ALL_TASKS_TYPE="$$all$$",g=this.DEFAULT_TASK_TYPE="$$default$$";this.completeTask=function(e,h){h=h||g;try{e()}finally{var l;l=h||g;c[l]&&(c[l]--,c[f]--);l=c[h];var m=c[f];if(!m||!l)for(l=m?d:b;m=l(h);)try{m()}catch(p){a.error(p)}}};this.incTaskCount=function(a){a=a||g;c[a]=(c[a]||0)+1;c[f]=(c[f]||0)+1};this.notifyWhenNoPendingTasks=function(a,b){b=b||f;c[b]?e.push({type:b,cb:a}):
960a()}}function ig(){var a;this.httpOptions=function(b){return b?(a=b,this):a};this.$get=["$exceptionHandler","$templateCache","$http","$q","$sce",function(b,d,c,e,f){function g(k,h){g.totalPendingRequests++;if(!C(k)||A(d.get(k)))k=f.getTrustedResourceUrl(k);var l=c.defaults&&c.defaults.transformResponse;H(l)?l=l.filter(function(a){return a!==wc}):l===wc&&(l=null);return c.get(k,S({cache:d,transformResponse:l},a)).finally(function(){g.totalPendingRequests--}).then(function(a){return d.put(k,a.data)},
961function(a){h||(a=Zg("tpload",k,a.status,a.statusText),b(a));return e.reject(a)})}g.totalPendingRequests=0;return g}]}function jg(){this.$get=["$rootScope","$browser","$location",function(a,b,d){return{findBindings:function(a,b,d){a=a.getElementsByClassName("ng-binding");var g=[];r(a,function(a){var c=ca.element(a).data("$binding");c&&r(c,function(c){d?(new RegExp("(^|\\s)"+Od(b)+"(\\s|\\||$)")).test(c)&&g.push(a):-1!==c.indexOf(b)&&g.push(a)})});return g},findModels:function(a,b,d){for(var g=["ng-",
962"data-ng-","ng\\:"],k=0;k<g.length;++k){var h=a.querySelectorAll("["+g[k]+"model"+(d?"=":"*=")+'"'+b+'"]');if(h.length)return h}},getLocation:function(){return d.url()},setLocation:function(b){b!==d.url()&&(d.url(b),a.$digest())},whenStable:function(a){b.notifyWhenNoOutstandingRequests(a)}}}]}function kg(){this.$get=["$rootScope","$browser","$q","$$q","$exceptionHandler",function(a,b,d,c,e){function f(f,h,l){B(f)||(l=h,h=f,f=E);var m=Ha.call(arguments,3),p=w(l)&&!l,n=(p?c:d).defer(),s=n.promise,r;
963r=b.defer(function(){try{n.resolve(f.apply(null,m))}catch(b){n.reject(b),e(b)}finally{delete g[s.$$timeoutId]}p||a.$apply()},h,"$timeout");s.$$timeoutId=r;g[r]=n;return s}var g={};f.cancel=function(a){if(!a)return!1;if(!a.hasOwnProperty("$$timeoutId"))throw $g("badprom");if(!g.hasOwnProperty(a.$$timeoutId))return!1;a=a.$$timeoutId;var c=g[a],d=c.promise;d.$$state&&(d.$$state.pur=!0);c.reject("canceled");delete g[a];return b.defer.cancel(a)};return f}]}function ga(a){if(!C(a))return a;wa&&(aa.setAttribute("href",
964a),a=aa.href);aa.setAttribute("href",a);a=aa.hostname;!ah&&-1<a.indexOf(":")&&(a="["+a+"]");return{href:aa.href,protocol:aa.protocol?aa.protocol.replace(/:$/,""):"",host:aa.host,search:aa.search?aa.search.replace(/^\?/,""):"",hash:aa.hash?aa.hash.replace(/^#/,""):"",hostname:a,port:aa.port,pathname:"/"===aa.pathname.charAt(0)?aa.pathname:"/"+aa.pathname}}function Og(a){var b=[Qd].concat(a.map(ga));return function(a){a=ga(a);return b.some(Cc.bind(null,a))}}function Cc(a,b){a=ga(a);b=ga(b);return a.protocol===
965b.protocol&&a.host===b.host}function lg(){this.$get=ia(z)}function Rd(a){function b(a){try{return decodeURIComponent(a)}catch(b){return a}}var d=a[0]||{},c={},e="";return function(){var a,g,k,h,l;try{a=d.cookie||""}catch(m){a=""}if(a!==e)for(e=a,a=e.split("; "),c={},k=0;k<a.length;k++)g=a[k],h=g.indexOf("="),0<h&&(l=b(g.substring(0,h)),A(c[l])&&(c[l]=b(g.substring(h+1))));return c}}function pg(){this.$get=Rd}function fd(a){function b(d,c){if(D(d)){var e={};r(d,function(a,c){e[c]=b(c,a)});return e}return a.factory(d+
966"Filter",c)}this.register=b;this.$get=["$injector",function(a){return function(b){return a.get(b+"Filter")}}];b("currency",Sd);b("date",Td);b("filter",bh);b("json",ch);b("limitTo",dh);b("lowercase",eh);b("number",Ud);b("orderBy",Vd);b("uppercase",fh)}function bh(){return function(a,b,d,c){if(!za(a)){if(null==a)return a;throw F("filter")("notarray",a);}c=c||"$";var e;switch(Ec(b)){case "function":break;case "boolean":case "null":case "number":case "string":e=!0;case "object":b=gh(b,d,c,e);break;default:return a}return Array.prototype.filter.call(a,
967b)}}function gh(a,b,d,c){var e=D(a)&&d in a;!0===b?b=va:B(b)||(b=function(a,b){if(A(a))return!1;if(null===a||null===b)return a===b;if(D(b)||D(a)&&!cc(a))return!1;a=K(""+a);b=K(""+b);return-1!==a.indexOf(b)});return function(f){return e&&!D(f)?Fa(f,a[d],b,d,!1):Fa(f,a,b,d,c)}}function Fa(a,b,d,c,e,f){var g=Ec(a),k=Ec(b);if("string"===k&&"!"===b.charAt(0))return!Fa(a,b.substring(1),d,c,e);if(H(a))return a.some(function(a){return Fa(a,b,d,c,e)});switch(g){case "object":var h;if(e){for(h in a)if(h.charAt&&
968"$"!==h.charAt(0)&&Fa(a[h],b,d,c,!0))return!0;return f?!1:Fa(a,b,d,c,!1)}if("object"===k){for(h in b)if(f=b[h],!B(f)&&!A(f)&&(g=h===c,!Fa(g?a:a[h],f,d,c,g,g)))return!1;return!0}return d(a,b);case "function":return!1;default:return d(a,b)}}function Ec(a){return null===a?"null":typeof a}function Sd(a){var b=a.NUMBER_FORMATS;return function(a,c,e){A(c)&&(c=b.CURRENCY_SYM);A(e)&&(e=b.PATTERNS[1].maxFrac);var f=c?/\u00A4/g:/\s*\u00A4\s*/g;return null==a?a:Wd(a,b.PATTERNS[1],b.GROUP_SEP,b.DECIMAL_SEP,e).replace(f,
969c)}}function Ud(a){var b=a.NUMBER_FORMATS;return function(a,c){return null==a?a:Wd(a,b.PATTERNS[0],b.GROUP_SEP,b.DECIMAL_SEP,c)}}function hh(a){var b=0,d,c,e,f,g;-1<(c=a.indexOf(Xd))&&(a=a.replace(Xd,""));0<(e=a.search(/e/i))?(0>c&&(c=e),c+=+a.slice(e+1),a=a.substring(0,e)):0>c&&(c=a.length);for(e=0;a.charAt(e)===Fc;e++);if(e===(g=a.length))d=[0],c=1;else{for(g--;a.charAt(g)===Fc;)g--;c-=e;d=[];for(f=0;e<=g;e++,f++)d[f]=+a.charAt(e)}c>Yd&&(d=d.splice(0,Yd-1),b=c-1,c=1);return{d:d,e:b,i:c}}function ih(a,
970b,d,c){var e=a.d,f=e.length-a.i;b=A(b)?Math.min(Math.max(d,f),c):+b;d=b+a.i;c=e[d];if(0<d){e.splice(Math.max(a.i,d));for(var g=d;g<e.length;g++)e[g]=0}else for(f=Math.max(0,f),a.i=1,e.length=Math.max(1,d=b+1),e[0]=0,g=1;g<d;g++)e[g]=0;if(5<=c)if(0>d-1){for(c=0;c>d;c--)e.unshift(0),a.i++;e.unshift(1);a.i++}else e[d-1]++;for(;f<Math.max(0,b);f++)e.push(0);if(b=e.reduceRight(function(a,b,c,d){b+=a;d[c]=b%10;return Math.floor(b/10)},0))e.unshift(b),a.i++}function Wd(a,b,d,c,e){if(!C(a)&&!X(a)||isNaN(a))return"";
971var f=!isFinite(a),g=!1,k=Math.abs(a)+"",h="";if(f)h="\u221e";else{g=hh(k);ih(g,e,b.minFrac,b.maxFrac);h=g.d;k=g.i;e=g.e;f=[];for(g=h.reduce(function(a,b){return a&&!b},!0);0>k;)h.unshift(0),k++;0<k?f=h.splice(k,h.length):(f=h,h=[0]);k=[];for(h.length>=b.lgSize&&k.unshift(h.splice(-b.lgSize,h.length).join(""));h.length>b.gSize;)k.unshift(h.splice(-b.gSize,h.length).join(""));h.length&&k.unshift(h.join(""));h=k.join(d);f.length&&(h+=c+f.join(""));e&&(h+="e+"+e)}return 0>a&&!g?b.negPre+h+b.negSuf:b.posPre+
972h+b.posSuf}function Pb(a,b,d,c){var e="";if(0>a||c&&0>=a)c?a=-a+1:(a=-a,e="-");for(a=""+a;a.length<b;)a=Fc+a;d&&(a=a.substr(a.length-b));return e+a}function ea(a,b,d,c,e){d=d||0;return function(f){f=f["get"+a]();if(0<d||f>-d)f+=d;0===f&&-12===d&&(f=12);return Pb(f,b,c,e)}}function lb(a,b,d){return function(c,e){var f=c["get"+a](),g=vb((d?"STANDALONE":"")+(b?"SHORT":"")+a);return e[g][f]}}function Zd(a){var b=(new Date(a,0,1)).getDay();return new Date(a,0,(4>=b?5:12)-b)}function $d(a){return function(b){var d=
973Zd(b.getFullYear());b=+new Date(b.getFullYear(),b.getMonth(),b.getDate()+(4-b.getDay()))-+d;b=1+Math.round(b/6048E5);return Pb(b,a)}}function Gc(a,b){return 0>=a.getFullYear()?b.ERAS[0]:b.ERAS[1]}function Td(a){function b(a){var b;if(b=a.match(d)){a=new Date(0);var f=0,g=0,k=b[8]?a.setUTCFullYear:a.setFullYear,h=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=fa(b[9]+b[10]),g=fa(b[9]+b[11]));k.call(a,fa(b[1]),fa(b[2])-1,fa(b[3]));f=fa(b[4]||0)-f;g=fa(b[5]||0)-g;k=fa(b[6]||0);b=Math.round(1E3*parseFloat("0."+
974(b[7]||0)));h.call(a,f,g,k,b)}return a}var d=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,d,f){var g="",k=[],h,l;d=d||"mediumDate";d=a.DATETIME_FORMATS[d]||d;C(c)&&(c=jh.test(c)?fa(c):b(c));X(c)&&(c=new Date(c));if(!ha(c)||!isFinite(c.getTime()))return c;for(;d;)(l=kh.exec(d))?(k=db(k,l,1),d=k.pop()):(k.push(d),d=null);var m=c.getTimezoneOffset();f&&(m=fc(f,m),c=gc(c,f,!0));r(k,function(b){h=lh[b];g+=h?h(c,a.DATETIME_FORMATS,
975m):"''"===b?"'":b.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function ch(){return function(a,b){A(b)&&(b=2);return eb(a,b)}}function dh(){return function(a,b,d){b=Infinity===Math.abs(Number(b))?Number(b):fa(b);if(Y(b))return a;X(a)&&(a=a.toString());if(!za(a))return a;d=!d||isNaN(d)?0:fa(d);d=0>d?Math.max(0,a.length+d):d;return 0<=b?Hc(a,d,d+b):0===d?Hc(a,b,a.length):Hc(a,Math.max(0,d+b),d)}}function Hc(a,b,d){return C(a)?a.slice(b,d):Ha.call(a,b,d)}function Vd(a){function b(b){return b.map(function(b){var c=
9761,d=Ta;if(B(b))d=b;else if(C(b)){if("+"===b.charAt(0)||"-"===b.charAt(0))c="-"===b.charAt(0)?-1:1,b=b.substring(1);if(""!==b&&(d=a(b),d.constant))var e=d(),d=function(a){return a[e]}}return{get:d,descending:c}})}function d(a){switch(typeof a){case "number":case "boolean":case "string":return!0;default:return!1}}function c(a,b){var c=0,d=a.type,h=b.type;if(d===h){var h=a.value,l=b.value;"string"===d?(h=h.toLowerCase(),l=l.toLowerCase()):"object"===d&&(D(h)&&(h=a.index),D(l)&&(l=b.index));h!==l&&(c=
977h<l?-1:1)}else c="undefined"===d?1:"undefined"===h?-1:"null"===d?1:"null"===h?-1:d<h?-1:1;return c}return function(a,f,g,k){if(null==a)return a;if(!za(a))throw F("orderBy")("notarray",a);H(f)||(f=[f]);0===f.length&&(f=["+"]);var h=b(f),l=g?-1:1,m=B(k)?k:c;a=Array.prototype.map.call(a,function(a,b){return{value:a,tieBreaker:{value:b,type:"number",index:b},predicateValues:h.map(function(c){var e=c.get(a);c=typeof e;if(null===e)c="null";else if("object"===c)a:{if(B(e.valueOf)&&(e=e.valueOf(),d(e)))break a;
978cc(e)&&(e=e.toString(),d(e))}return{value:e,type:c,index:b}})}});a.sort(function(a,b){for(var d=0,e=h.length;d<e;d++){var f=m(a.predicateValues[d],b.predicateValues[d]);if(f)return f*h[d].descending*l}return(m(a.tieBreaker,b.tieBreaker)||c(a.tieBreaker,b.tieBreaker))*l});return a=a.map(function(a){return a.value})}}function Ra(a){B(a)&&(a={link:a});a.restrict=a.restrict||"AC";return ia(a)}function Qb(a,b,d,c,e){this.$$controls=[];this.$error={};this.$$success={};this.$pending=void 0;this.$name=e(b.name||
979b.ngForm||"")(d);this.$dirty=!1;this.$valid=this.$pristine=!0;this.$submitted=this.$invalid=!1;this.$$parentForm=mb;this.$$element=a;this.$$animate=c;ae(this)}function ae(a){a.$$classCache={};a.$$classCache[be]=!(a.$$classCache[nb]=a.$$element.hasClass(nb))}function ce(a){function b(a,b,c){c&&!a.$$classCache[b]?(a.$$animate.addClass(a.$$element,b),a.$$classCache[b]=!0):!c&&a.$$classCache[b]&&(a.$$animate.removeClass(a.$$element,b),a.$$classCache[b]=!1)}function d(a,c,d){c=c?"-"+Xc(c,"-"):"";b(a,nb+
980c,!0===d);b(a,be+c,!1===d)}var c=a.set,e=a.unset;a.clazz.prototype.$setValidity=function(a,g,k){A(g)?(this.$pending||(this.$pending={}),c(this.$pending,a,k)):(this.$pending&&e(this.$pending,a,k),de(this.$pending)&&(this.$pending=void 0));Ga(g)?g?(e(this.$error,a,k),c(this.$$success,a,k)):(c(this.$error,a,k),e(this.$$success,a,k)):(e(this.$error,a,k),e(this.$$success,a,k));this.$pending?(b(this,"ng-pending",!0),this.$valid=this.$invalid=void 0,d(this,"",null)):(b(this,"ng-pending",!1),this.$valid=
981de(this.$error),this.$invalid=!this.$valid,d(this,"",this.$valid));g=this.$pending&&this.$pending[a]?void 0:this.$error[a]?!1:this.$$success[a]?!0:null;d(this,a,g);this.$$parentForm.$setValidity(a,g,this)}}function de(a){if(a)for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}function Ic(a){a.$formatters.push(function(b){return a.$isEmpty(b)?b:b.toString()})}function Sa(a,b,d,c,e,f){var g=K(b[0].type);if(!e.android){var k=!1;b.on("compositionstart",function(){k=!0});b.on("compositionupdate",
982function(a){if(A(a.data)||""===a.data)k=!1});b.on("compositionend",function(){k=!1;l()})}var h,l=function(a){h&&(f.defer.cancel(h),h=null);if(!k){var e=b.val();a=a&&a.type;"password"===g||d.ngTrim&&"false"===d.ngTrim||(e=V(e));(c.$viewValue!==e||""===e&&c.$$hasNativeValidators)&&c.$setViewValue(e,a)}};if(e.hasEvent("input"))b.on("input",l);else{var m=function(a,b,c){h||(h=f.defer(function(){h=null;b&&b.value===c||l(a)}))};b.on("keydown",function(a){var b=a.keyCode;91===b||15<b&&19>b||37<=b&&40>=b||
983m(a,this,this.value)});if(e.hasEvent("paste"))b.on("paste cut drop",m)}b.on("change",l);if(ee[g]&&c.$$hasNativeValidators&&g===d.type)b.on("keydown wheel mousedown",function(a){if(!h){var b=this.validity,c=b.badInput,d=b.typeMismatch;h=f.defer(function(){h=null;b.badInput===c&&b.typeMismatch===d||l(a)})}});c.$render=function(){var a=c.$isEmpty(c.$viewValue)?"":c.$viewValue;b.val()!==a&&b.val(a)}}function Rb(a,b){return function(d,c){var e,f;if(ha(d))return d;if(C(d)){'"'===d.charAt(0)&&'"'===d.charAt(d.length-
9841)&&(d=d.substring(1,d.length-1));if(mh.test(d))return new Date(d);a.lastIndex=0;if(e=a.exec(d))return e.shift(),f=c?{yyyy:c.getFullYear(),MM:c.getMonth()+1,dd:c.getDate(),HH:c.getHours(),mm:c.getMinutes(),ss:c.getSeconds(),sss:c.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},r(e,function(a,c){c<b.length&&(f[b[c]]=+a)}),e=new Date(f.yyyy,f.MM-1,f.dd,f.HH,f.mm,f.ss||0,1E3*f.sss||0),100>f.yyyy&&e.setFullYear(f.yyyy),e}return NaN}}function ob(a,b,d,c){return function(e,f,g,k,h,l,m,
985p){function n(a){return a&&!(a.getTime&&a.getTime()!==a.getTime())}function s(a){return w(a)&&!ha(a)?r(a)||void 0:a}function r(a,b){var c=k.$options.getOption("timezone");v&&v!==c&&(b=Uc(b,fc(v)));var e=d(a,b);!isNaN(e)&&c&&(e=gc(e,c));return e}Jc(e,f,g,k,a);Sa(e,f,g,k,h,l);var t="time"===a||"datetimelocal"===a,q,v;k.$parsers.push(function(c){if(k.$isEmpty(c))return null;if(b.test(c))return r(c,q);k.$$parserName=a});k.$formatters.push(function(a){if(a&&!ha(a))throw pb("datefmt",a);if(n(a)){q=a;var b=
986k.$options.getOption("timezone");b&&(v=b,q=gc(q,b,!0));var d=c;t&&C(k.$options.getOption("timeSecondsFormat"))&&(d=c.replace("ss.sss",k.$options.getOption("timeSecondsFormat")).replace(/:$/,""));a=m("date")(a,d,b);t&&k.$options.getOption("timeStripZeroSeconds")&&(a=a.replace(/(?::00)?(?:\.000)?$/,""));return a}v=q=null;return""});if(w(g.min)||g.ngMin){var x=g.min||p(g.ngMin)(e),z=s(x);k.$validators.min=function(a){return!n(a)||A(z)||d(a)>=z};g.$observe("min",function(a){a!==x&&(z=s(a),x=a,k.$validate())})}if(w(g.max)||
987g.ngMax){var y=g.max||p(g.ngMax)(e),J=s(y);k.$validators.max=function(a){return!n(a)||A(J)||d(a)<=J};g.$observe("max",function(a){a!==y&&(J=s(a),y=a,k.$validate())})}}}function Jc(a,b,d,c,e){(c.$$hasNativeValidators=D(b[0].validity))&&c.$parsers.push(function(a){var d=b.prop("validity")||{};if(d.badInput||d.typeMismatch)c.$$parserName=e;else return a})}function fe(a){a.$parsers.push(function(b){if(a.$isEmpty(b))return null;if(nh.test(b))return parseFloat(b);a.$$parserName="number"});a.$formatters.push(function(b){if(!a.$isEmpty(b)){if(!X(b))throw pb("numfmt",
988b);b=b.toString()}return b})}function na(a){w(a)&&!X(a)&&(a=parseFloat(a));return Y(a)?void 0:a}function Kc(a){var b=a.toString(),d=b.indexOf(".");return-1===d?-1<a&&1>a&&(a=/e-(\d+)$/.exec(b))?Number(a[1]):0:b.length-d-1}function ge(a,b,d){a=Number(a);var c=(a|0)!==a,e=(b|0)!==b,f=(d|0)!==d;if(c||e||f){var g=c?Kc(a):0,k=e?Kc(b):0,h=f?Kc(d):0,g=Math.max(g,k,h),g=Math.pow(10,g);a*=g;b*=g;d*=g;c&&(a=Math.round(a));e&&(b=Math.round(b));f&&(d=Math.round(d))}return 0===(a-b)%d}function he(a,b,d,c,e){if(w(c)){a=
989a(c);if(!a.constant)throw pb("constexpr",d,c);return a(b)}return e}function Lc(a,b){function d(a,b){if(!a||!a.length)return[];if(!b||!b.length)return a;var c=[],d=0;a:for(;d<a.length;d++){for(var e=a[d],m=0;m<b.length;m++)if(e===b[m])continue a;c.push(e)}return c}function c(a){if(!a)return a;var b=a;H(a)?b=a.map(c).join(" "):D(a)?b=Object.keys(a).filter(function(b){return a[b]}).join(" "):C(a)||(b=a+"");return b}a="ngClass"+a;var e;return["$parse",function(f){return{restrict:"AC",link:function(g,
990k,h){function l(a,b){var c=[];r(a,function(a){if(0<b||p[a])p[a]=(p[a]||0)+b,p[a]===+(0<b)&&c.push(a)});return c.join(" ")}function m(a){if(a===b){var c=s,c=l(c&&c.split(" "),1);h.$addClass(c)}else c=s,c=l(c&&c.split(" "),-1),h.$removeClass(c);n=a}var p=k.data("$classCounts"),n=!0,s;p||(p=T(),k.data("$classCounts",p));"ngClass"!==a&&(e||(e=f("$index",function(a){return a&1})),g.$watch(e,m));g.$watch(f(h[a],c),function(a){if(n===b){var c=s&&s.split(" "),e=a&&a.split(" "),f=d(c,e),c=d(e,c),f=l(f,-1),
991c=l(c,1);h.$addClass(c);h.$removeClass(f)}s=a})}}}]}function sd(a,b,d,c,e,f){return{restrict:"A",compile:function(g,k){var h=a(k[c]);return function(a,c){c.on(e,function(c){var e=function(){h(a,{$event:c})};if(b.$$phase)if(f)a.$evalAsync(e);else try{e()}catch(g){d(g)}else a.$apply(e)})}}}}function Sb(a,b,d,c,e,f,g,k,h){this.$modelValue=this.$viewValue=Number.NaN;this.$$rawModelValue=void 0;this.$validators={};this.$asyncValidators={};this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=
992[];this.$untouched=!0;this.$touched=!1;this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$error={};this.$$success={};this.$pending=void 0;this.$name=h(d.name||"",!1)(a);this.$$parentForm=mb;this.$options=Tb;this.$$updateEvents="";this.$$updateEventHandler=this.$$updateEventHandler.bind(this);this.$$parsedNgModel=e(d.ngModel);this.$$parsedNgModelAssign=this.$$parsedNgModel.assign;this.$$ngModelGet=this.$$parsedNgModel;this.$$ngModelSet=this.$$parsedNgModelAssign;this.$$pendingDebounce=
993null;this.$$parserValid=void 0;this.$$parserName="parse";this.$$currentValidationRunId=0;this.$$scope=a;this.$$rootScope=a.$root;this.$$attr=d;this.$$element=c;this.$$animate=f;this.$$timeout=g;this.$$parse=e;this.$$q=k;this.$$exceptionHandler=b;ae(this);oh(this)}function oh(a){a.$$scope.$watch(function(b){b=a.$$ngModelGet(b);b===a.$modelValue||a.$modelValue!==a.$modelValue&&b!==b||a.$$setModelValue(b);return b})}function Mc(a){this.$$options=a}function ie(a,b){r(b,function(b,c){w(a[c])||(a[c]=b)})}
994function Oa(a,b){a.prop("selected",b);a.attr("selected",b)}function je(a,b,d){if(a){C(a)&&(a=new RegExp("^"+a+"$"));if(!a.test)throw F("ngPattern")("noregexp",b,a,Aa(d));return a}}function Ub(a){a=fa(a);return Y(a)?-1:a}var Xb={objectMaxDepth:5,urlErrorParamsEnabled:!0},ke=/^\/(.+)\/([a-z]*)$/,ta=Object.prototype.hasOwnProperty,K=function(a){return C(a)?a.toLowerCase():a},vb=function(a){return C(a)?a.toUpperCase():a},wa,x,sb,Ha=[].slice,Kg=[].splice,ph=[].push,la=Object.prototype.toString,Rc=Object.getPrototypeOf,
995oa=F("ng"),ca=z.angular||(z.angular={}),lc,qb=0;wa=z.document.documentMode;var Y=Number.isNaN||function(a){return a!==a};E.$inject=[];Ta.$inject=[];var ze=/^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array]$/,V=function(a){return C(a)?a.trim():a},Od=function(a){return a.replace(/([-()[\]{}+?*.$^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")},Ba=function(){if(!w(Ba.rules)){var a=z.document.querySelector("[ng-csp]")||z.document.querySelector("[data-ng-csp]");if(a){var b=
996a.getAttribute("ng-csp")||a.getAttribute("data-ng-csp");Ba.rules={noUnsafeEval:!b||-1!==b.indexOf("no-unsafe-eval"),noInlineStyle:!b||-1!==b.indexOf("no-inline-style")}}else{a=Ba;try{new Function(""),b=!1}catch(d){b=!0}a.rules={noUnsafeEval:b,noInlineStyle:!1}}}return Ba.rules},rb=function(){if(w(rb.name_))return rb.name_;var a,b,d=Qa.length,c,e;for(b=0;b<d;++b)if(c=Qa[b],a=z.document.querySelector("["+c.replace(":","\\:")+"jq]")){e=a.getAttribute(c+"jq");break}return rb.name_=e},Be=/:/g,Qa=["ng-",
997"data-ng-","ng:","x-ng-"],Fe=function(a){var b=a.currentScript;if(!b)return!0;if(!(b instanceof z.HTMLScriptElement||b instanceof z.SVGScriptElement))return!1;b=b.attributes;return[b.getNamedItem("src"),b.getNamedItem("href"),b.getNamedItem("xlink:href")].every(function(b){if(!b)return!0;if(!b.value)return!1;var c=a.createElement("a");c.href=b.value;if(a.location.origin===c.origin)return!0;switch(c.protocol){case "http:":case "https:":case "ftp:":case "blob:":case "file:":case "data:":return!0;default:return!1}})}(z.document),
998Ie=/[A-Z]/g,Yc=!1,Pa=3,Pe={full:"1.8.2",major:1,minor:8,dot:2,codeName:"meteoric-mining"};U.expando="ng339";var Ka=U.cache={},ug=1;U._data=function(a){return this.cache[a[this.expando]]||{}};var qg=/-([a-z])/g,qh=/^-ms-/,Bb={mouseleave:"mouseout",mouseenter:"mouseover"},oc=F("jqLite"),tg=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,nc=/<|&#?\w+;/,rg=/<([\w:-]+)/,sg=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,qa={thead:["table"],col:["colgroup","table"],tr:["tbody","table"],td:["tr",
999"tbody","table"]};qa.tbody=qa.tfoot=qa.colgroup=qa.caption=qa.thead;qa.th=qa.td;var hb={option:[1,'<select multiple="multiple">',"</select>"],_default:[0,"",""]},Nc;for(Nc in qa){var le=qa[Nc],me=le.slice().reverse();hb[Nc]=[me.length,"<"+me.join("><")+">","</"+le.join("></")+">"]}hb.optgroup=hb.option;var zg=z.Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)&16)},Wa=U.prototype={ready:hd,toString:function(){var a=[];r(this,function(b){a.push(""+b)});return"["+a.join(", ")+
1000"]"},eq:function(a){return 0<=a?x(this[a]):x(this[this.length+a])},length:0,push:ph,sort:[].sort,splice:[].splice},Hb={};r("multiple selected checked disabled readOnly required open".split(" "),function(a){Hb[K(a)]=a});var od={};r("input select option textarea button form details".split(" "),function(a){od[a]=!0});var vd={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};r({data:sc,removeData:rc,hasData:function(a){for(var b in Ka[a.ng339])return!0;
1001return!1},cleanData:function(a){for(var b=0,d=a.length;b<d;b++)rc(a[b]),kd(a[b])}},function(a,b){U[b]=a});r({data:sc,inheritedData:Fb,scope:function(a){return x.data(a,"$scope")||Fb(a.parentNode||a,["$isolateScope","$scope"])},isolateScope:function(a){return x.data(a,"$isolateScope")||x.data(a,"$isolateScopeNoTemplate")},controller:ld,injector:function(a){return Fb(a,"$injector")},removeAttr:function(a,b){a.removeAttribute(b)},hasClass:Cb,css:function(a,b,d){b=yb(b.replace(qh,"ms-"));if(w(d))a.style[b]=
1002d;else return a.style[b]},attr:function(a,b,d){var c=a.nodeType;if(c!==Pa&&2!==c&&8!==c&&a.getAttribute){var c=K(b),e=Hb[c];if(w(d))null===d||!1===d&&e?a.removeAttribute(b):a.setAttribute(b,e?c:d);else return a=a.getAttribute(b),e&&null!==a&&(a=c),null===a?void 0:a}},prop:function(a,b,d){if(w(d))a[b]=d;else return a[b]},text:function(){function a(a,d){if(A(d)){var c=a.nodeType;return 1===c||c===Pa?a.textContent:""}a.textContent=d}a.$dv="";return a}(),val:function(a,b){if(A(b)){if(a.multiple&&"select"===
1003ua(a)){var d=[];r(a.options,function(a){a.selected&&d.push(a.value||a.text)});return d}return a.value}a.value=b},html:function(a,b){if(A(b))return a.innerHTML;zb(a,!0);a.innerHTML=b},empty:md},function(a,b){U.prototype[b]=function(b,c){var e,f,g=this.length;if(a!==md&&A(2===a.length&&a!==Cb&&a!==ld?b:c)){if(D(b)){for(e=0;e<g;e++)if(a===sc)a(this[e],b);else for(f in b)a(this[e],f,b[f]);return this}e=a.$dv;g=A(e)?Math.min(g,1):g;for(f=0;f<g;f++){var k=a(this[f],b,c);e=e?e+k:k}return e}for(e=0;e<g;e++)a(this[e],
1004b,c);return this}});r({removeData:rc,on:function(a,b,d,c){if(w(c))throw oc("onargs");if(mc(a)){c=Ab(a,!0);var e=c.events,f=c.handle;f||(f=c.handle=wg(a,e));c=0<=b.indexOf(" ")?b.split(" "):[b];for(var g=c.length,k=function(b,c,g){var k=e[b];k||(k=e[b]=[],k.specialHandlerWrapper=c,"$destroy"===b||g||a.addEventListener(b,f));k.push(d)};g--;)b=c[g],Bb[b]?(k(Bb[b],yg),k(b,void 0,!0)):k(b)}},off:kd,one:function(a,b,d){a=x(a);a.on(b,function e(){a.off(b,d);a.off(b,e)});a.on(b,d)},replaceWith:function(a,
1005b){var d,c=a.parentNode;zb(a);r(new U(b),function(b){d?c.insertBefore(b,d.nextSibling):c.replaceChild(b,a);d=b})},children:function(a){var b=[];r(a.childNodes,function(a){1===a.nodeType&&b.push(a)});return b},contents:function(a){return a.contentDocument||a.childNodes||[]},append:function(a,b){var d=a.nodeType;if(1===d||11===d){b=new U(b);for(var d=0,c=b.length;d<c;d++)a.appendChild(b[d])}},prepend:function(a,b){if(1===a.nodeType){var d=a.firstChild;r(new U(b),function(b){a.insertBefore(b,d)})}},
1006wrap:function(a,b){var d=x(b).eq(0).clone()[0],c=a.parentNode;c&&c.replaceChild(d,a);d.appendChild(a)},remove:Gb,detach:function(a){Gb(a,!0)},after:function(a,b){var d=a,c=a.parentNode;if(c){b=new U(b);for(var e=0,f=b.length;e<f;e++){var g=b[e];c.insertBefore(g,d.nextSibling);d=g}}},addClass:Eb,removeClass:Db,toggleClass:function(a,b,d){b&&r(b.split(" "),function(b){var e=d;A(e)&&(e=!Cb(a,b));(e?Eb:Db)(a,b)})},parent:function(a){return(a=a.parentNode)&&11!==a.nodeType?a:null},next:function(a){return a.nextElementSibling},
1007find:function(a,b){return a.getElementsByTagName?a.getElementsByTagName(b):[]},clone:qc,triggerHandler:function(a,b,d){var c,e,f=b.type||b,g=Ab(a);if(g=(g=g&&g.events)&&g[f])c={preventDefault:function(){this.defaultPrevented=!0},isDefaultPrevented:function(){return!0===this.defaultPrevented},stopImmediatePropagation:function(){this.immediatePropagationStopped=!0},isImmediatePropagationStopped:function(){return!0===this.immediatePropagationStopped},stopPropagation:E,type:f,target:a},b.type&&(c=S(c,
1008b)),b=ja(g),e=d?[c].concat(d):[c],r(b,function(b){c.isImmediatePropagationStopped()||b.apply(a,e)})}},function(a,b){U.prototype[b]=function(b,c,e){for(var f,g=0,k=this.length;g<k;g++)A(f)?(f=a(this[g],b,c,e),w(f)&&(f=x(f))):pc(f,a(this[g],b,c,e));return w(f)?f:this}});U.prototype.bind=U.prototype.on;U.prototype.unbind=U.prototype.off;var rh=Object.create(null);pd.prototype={_idx:function(a){a!==this._lastKey&&(this._lastKey=a,this._lastIndex=this._keys.indexOf(a));return this._lastIndex},_transformKey:function(a){return Y(a)?
1009rh:a},get:function(a){a=this._transformKey(a);a=this._idx(a);if(-1!==a)return this._values[a]},has:function(a){a=this._transformKey(a);return-1!==this._idx(a)},set:function(a,b){a=this._transformKey(a);var d=this._idx(a);-1===d&&(d=this._lastIndex=this._keys.length);this._keys[d]=a;this._values[d]=b},delete:function(a){a=this._transformKey(a);a=this._idx(a);if(-1===a)return!1;this._keys.splice(a,1);this._values.splice(a,1);this._lastKey=NaN;this._lastIndex=-1;return!0}};var Ib=pd,og=[function(){this.$get=
1010[function(){return Ib}]}],Bg=/^([^(]+?)=>/,Cg=/^[^(]*\(\s*([^)]*)\)/m,sh=/,/,th=/^\s*(_?)(\S+?)\1\s*$/,Ag=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Ca=F("$injector");fb.$$annotate=function(a,b,d){var c;if("function"===typeof a){if(!(c=a.$inject)){c=[];if(a.length){if(b)throw C(d)&&d||(d=a.name||Dg(a)),Ca("strictdi",d);b=qd(a);r(b[1].split(sh),function(a){a.replace(th,function(a,b,d){c.push(d)})})}a.$inject=c}}else H(a)?(b=a.length-1,tb(a[b],"fn"),c=a.slice(0,b)):tb(a,"fn",!0);return c};var ne=F("$animate"),
1011Ef=function(){this.$get=E},Ff=function(){var a=new Ib,b=[];this.$get=["$$AnimateRunner","$rootScope",function(d,c){function e(a,b,c){var d=!1;b&&(b=C(b)?b.split(" "):H(b)?b:[],r(b,function(b){b&&(d=!0,a[b]=c)}));return d}function f(){r(b,function(b){var c=a.get(b);if(c){var d=Eg(b.attr("class")),e="",f="";r(c,function(a,b){a!==!!d[b]&&(a?e+=(e.length?" ":"")+b:f+=(f.length?" ":"")+b)});r(b,function(a){e&&Eb(a,e);f&&Db(a,f)});a.delete(b)}});b.length=0}return{enabled:E,on:E,off:E,pin:E,push:function(g,
1012k,h,l){l&&l();h=h||{};h.from&&g.css(h.from);h.to&&g.css(h.to);if(h.addClass||h.removeClass)if(k=h.addClass,l=h.removeClass,h=a.get(g)||{},k=e(h,k,!0),l=e(h,l,!1),k||l)a.set(g,h),b.push(g),1===b.length&&c.$$postDigest(f);g=new d;g.complete();return g}}}]},Cf=["$provide",function(a){var b=this,d=null,c=null;this.$$registeredAnimations=Object.create(null);this.register=function(c,d){if(c&&"."!==c.charAt(0))throw ne("notcsel",c);var g=c+"-animation";b.$$registeredAnimations[c.substr(1)]=g;a.factory(g,
1013d)};this.customFilter=function(a){1===arguments.length&&(c=B(a)?a:null);return c};this.classNameFilter=function(a){if(1===arguments.length&&(d=a instanceof RegExp?a:null)&&/[(\s|\/)]ng-animate[(\s|\/)]/.test(d.toString()))throw d=null,ne("nongcls","ng-animate");return d};this.$get=["$$animateQueue",function(a){function b(a,c,d){if(d){var e;a:{for(e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){e=f;break a}}e=void 0}!e||e.parentNode||e.previousElementSibling||(d=null)}d?d.after(a):c.prepend(a)}return{on:a.on,
1014off:a.off,pin:a.pin,enabled:a.enabled,cancel:function(a){a.cancel&&a.cancel()},enter:function(c,d,h,l){d=d&&x(d);h=h&&x(h);d=d||h.parent();b(c,d,h);return a.push(c,"enter",ra(l))},move:function(c,d,h,l){d=d&&x(d);h=h&&x(h);d=d||h.parent();b(c,d,h);return a.push(c,"move",ra(l))},leave:function(b,c){return a.push(b,"leave",ra(c),function(){b.remove()})},addClass:function(b,c,d){d=ra(d);d.addClass=ib(d.addclass,c);return a.push(b,"addClass",d)},removeClass:function(b,c,d){d=ra(d);d.removeClass=ib(d.removeClass,
1015c);return a.push(b,"removeClass",d)},setClass:function(b,c,d,f){f=ra(f);f.addClass=ib(f.addClass,c);f.removeClass=ib(f.removeClass,d);return a.push(b,"setClass",f)},animate:function(b,c,d,f,m){m=ra(m);m.from=m.from?S(m.from,c):c;m.to=m.to?S(m.to,d):d;m.tempClasses=ib(m.tempClasses,f||"ng-inline-animate");return a.push(b,"animate",m)}}}]}],Hf=function(){this.$get=["$$rAF",function(a){function b(b){d.push(b);1<d.length||a(function(){for(var a=0;a<d.length;a++)d[a]();d=[]})}var d=[];return function(){var a=
1016!1;b(function(){a=!0});return function(d){a?d():b(d)}}}]},Gf=function(){this.$get=["$q","$sniffer","$$animateAsyncRun","$$isDocumentHidden","$timeout",function(a,b,d,c,e){function f(a){this.setHost(a);var b=d();this._doneCallbacks=[];this._tick=function(a){c()?e(a,0,!1):b(a)};this._state=0}f.chain=function(a,b){function c(){if(d===a.length)b(!0);else a[d](function(a){!1===a?b(!1):(d++,c())})}var d=0;c()};f.all=function(a,b){function c(f){e=e&&f;++d===a.length&&b(e)}var d=0,e=!0;r(a,function(a){a.done(c)})};
1017f.prototype={setHost:function(a){this.host=a||{}},done:function(a){2===this._state?a():this._doneCallbacks.push(a)},progress:E,getPromise:function(){if(!this.promise){var b=this;this.promise=a(function(a,c){b.done(function(b){!1===b?c():a()})})}return this.promise},then:function(a,b){return this.getPromise().then(a,b)},"catch":function(a){return this.getPromise()["catch"](a)},"finally":function(a){return this.getPromise()["finally"](a)},pause:function(){this.host.pause&&this.host.pause()},resume:function(){this.host.resume&&
1018this.host.resume()},end:function(){this.host.end&&this.host.end();this._resolve(!0)},cancel:function(){this.host.cancel&&this.host.cancel();this._resolve(!1)},complete:function(a){var b=this;0===b._state&&(b._state=1,b._tick(function(){b._resolve(a)}))},_resolve:function(a){2!==this._state&&(r(this._doneCallbacks,function(b){b(a)}),this._doneCallbacks.length=0,this._state=2)}};return f}]},Df=function(){this.$get=["$$rAF","$q","$$AnimateRunner",function(a,b,d){return function(b,e){function f(){a(function(){g.addClass&&
1019(b.addClass(g.addClass),g.addClass=null);g.removeClass&&(b.removeClass(g.removeClass),g.removeClass=null);g.to&&(b.css(g.to),g.to=null);k||h.complete();k=!0});return h}var g=e||{};g.$$prepared||(g=Ia(g));g.cleanupStyles&&(g.from=g.to=null);g.from&&(b.css(g.from),g.from=null);var k,h=new d;return{start:f,end:f}}}]},$=F("$compile"),uc=new function(){};Zc.$inject=["$provide","$$sanitizeUriProvider"];Kb.prototype.isFirstChange=function(){return this.previousValue===uc};var rd=/^((?:x|data)[:\-_])/i,Jg=
1020/[:\-_]+(.)/g,xd=F("$controller"),wd=/^(\S+)(\s+as\s+([\w$]+))?$/,Of=function(){this.$get=["$document",function(a){return function(b){b?!b.nodeType&&b instanceof x&&(b=b[0]):b=a[0].body;return b.offsetWidth+1}}]},yd="application/json",xc={"Content-Type":yd+";charset=utf-8"},Mg=/^\[|^\{(?!\{)/,Ng={"[":/]$/,"{":/}$/},Lg=/^\)]\}',?\n/,Lb=F("$http"),Ma=ca.$interpolateMinErr=F("$interpolate");Ma.throwNoconcat=function(a){throw Ma("noconcat",a);};Ma.interr=function(a,b){return Ma("interr",a,b.toString())};
1021var Qg=F("$interval"),Xf=function(){this.$get=function(){function a(a){var b=function(a){b.data=a;b.called=!0};b.id=a;return b}var b=ca.callbacks,d={};return{createCallback:function(c){c="_"+(b.$$counter++).toString(36);var e="angular.callbacks."+c,f=a(c);d[e]=b[c]=f;return e},wasCalled:function(a){return d[a].called},getResponse:function(a){return d[a].data},removeCallback:function(a){delete b[d[a].id];delete d[a]}}}},uh=/^([^?#]*)(\?([^#]*))?(#(.*))?$/,Rg={http:80,https:443,ftp:21},kb=F("$location"),
1022Sg=/^\s*[\\/]{2,}/,vh={$$absUrl:"",$$html5:!1,$$replace:!1,$$compose:function(){for(var a=this.$$path,b=this.$$hash,d=Ce(this.$$search),b=b?"#"+ic(b):"",a=a.split("/"),c=a.length;c--;)a[c]=ic(a[c].replace(/%2F/g,"/"));this.$$url=a.join("/")+(d?"?"+d:"")+b;this.$$absUrl=this.$$normalizeUrl(this.$$url);this.$$urlUpdatedByLocation=!0},absUrl:Mb("$$absUrl"),url:function(a){if(A(a))return this.$$url;var b=uh.exec(a);(b[1]||""===a)&&this.path(decodeURIComponent(b[1]));(b[2]||b[1]||""===a)&&this.search(b[3]||
1023"");this.hash(b[5]||"");return this},protocol:Mb("$$protocol"),host:Mb("$$host"),port:Mb("$$port"),path:Fd("$$path",function(a){a=null!==a?a.toString():"";return"/"===a.charAt(0)?a:"/"+a}),search:function(a,b){switch(arguments.length){case 0:return this.$$search;case 1:if(C(a)||X(a))a=a.toString(),this.$$search=hc(a);else if(D(a))a=Ia(a,{}),r(a,function(b,c){null==b&&delete a[c]}),this.$$search=a;else throw kb("isrcharg");break;default:A(b)||null===b?delete this.$$search[a]:this.$$search[a]=b}this.$$compose();
1024return this},hash:Fd("$$hash",function(a){return null!==a?a.toString():""}),replace:function(){this.$$replace=!0;return this}};r([Ed,Ac,zc],function(a){a.prototype=Object.create(vh);a.prototype.state=function(b){if(!arguments.length)return this.$$state;if(a!==zc||!this.$$html5)throw kb("nostate");this.$$state=A(b)?null:b;this.$$urlUpdatedByLocation=!0;return this}});var Ya=F("$parse"),Wg={}.constructor.prototype.valueOf,Vb=T();r("+ - * / % === !== == != < > <= >= && || ! = |".split(" "),function(a){Vb[a]=
1025!0});var wh={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Ob=function(a){this.options=a};Ob.prototype={constructor:Ob,lex:function(a){this.text=a;this.index=0;for(this.tokens=[];this.index<this.text.length;)if(a=this.text.charAt(this.index),'"'===a||"'"===a)this.readString(a);else if(this.isNumber(a)||"."===a&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdentifierStart(this.peekMultichar()))this.readIdent();else if(this.is(a,"(){}[].,;:?"))this.tokens.push({index:this.index,
1026text:a}),this.index++;else if(this.isWhitespace(a))this.index++;else{var b=a+this.peek(),d=b+this.peek(2),c=Vb[b],e=Vb[d];Vb[a]||c||e?(a=e?d:c?b:a,this.tokens.push({index:this.index,text:a,operator:!0}),this.index+=a.length):this.throwError("Unexpected next character ",this.index,this.index+1)}return this.tokens},is:function(a,b){return-1!==b.indexOf(a)},peek:function(a){a=a||1;return this.index+a<this.text.length?this.text.charAt(this.index+a):!1},isNumber:function(a){return"0"<=a&&"9">=a&&"string"===
1027typeof a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdentifierStart:function(a){return this.options.isIdentifierStart?this.options.isIdentifierStart(a,this.codePointAt(a)):this.isValidIdentifierStart(a)},isValidIdentifierStart:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isIdentifierContinue:function(a){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(a,this.codePointAt(a)):this.isValidIdentifierContinue(a)},
1028isValidIdentifierContinue:function(a,b){return this.isValidIdentifierStart(a,b)||this.isNumber(a)},codePointAt:function(a){return 1===a.length?a.charCodeAt(0):(a.charCodeAt(0)<<10)+a.charCodeAt(1)-56613888},peekMultichar:function(){var a=this.text.charAt(this.index),b=this.peek();if(!b)return a;var d=a.charCodeAt(0),c=b.charCodeAt(0);return 55296<=d&&56319>=d&&56320<=c&&57343>=c?a+b:a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,b,d){d=d||this.index;b=
1029w(b)?"s "+b+"-"+this.index+" ["+this.text.substring(b,d)+"]":" "+d;throw Ya("lexerr",a,b,this.text);},readNumber:function(){for(var a="",b=this.index;this.index<this.text.length;){var d=K(this.text.charAt(this.index));if("."===d||this.isNumber(d))a+=d;else{var c=this.peek();if("e"===d&&this.isExpOperator(c))a+=d;else if(this.isExpOperator(d)&&c&&this.isNumber(c)&&"e"===a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||c&&this.isNumber(c)||"e"!==a.charAt(a.length-1))break;else this.throwError("Invalid exponent")}this.index++}this.tokens.push({index:b,
1030text:a,constant:!0,value:Number(a)})},readIdent:function(){var a=this.index;for(this.index+=this.peekMultichar().length;this.index<this.text.length;){var b=this.peekMultichar();if(!this.isIdentifierContinue(b))break;this.index+=b.length}this.tokens.push({index:a,text:this.text.slice(a,this.index),identifier:!0})},readString:function(a){var b=this.index;this.index++;for(var d="",c=a,e=!1;this.index<this.text.length;){var f=this.text.charAt(this.index),c=c+f;if(e)"u"===f?(e=this.text.substring(this.index+
10311,this.index+5),e.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+e+"]"),this.index+=4,d+=String.fromCharCode(parseInt(e,16))):d+=wh[f]||f,e=!1;else if("\\"===f)e=!0;else{if(f===a){this.index++;this.tokens.push({index:b,text:c,constant:!0,value:d});return}d+=f}this.index++}this.throwError("Unterminated quote",b)}};var q=function(a,b){this.lexer=a;this.options=b};q.Program="Program";q.ExpressionStatement="ExpressionStatement";q.AssignmentExpression="AssignmentExpression";q.ConditionalExpression=
1032"ConditionalExpression";q.LogicalExpression="LogicalExpression";q.BinaryExpression="BinaryExpression";q.UnaryExpression="UnaryExpression";q.CallExpression="CallExpression";q.MemberExpression="MemberExpression";q.Identifier="Identifier";q.Literal="Literal";q.ArrayExpression="ArrayExpression";q.Property="Property";q.ObjectExpression="ObjectExpression";q.ThisExpression="ThisExpression";q.LocalsExpression="LocalsExpression";q.NGValueParameter="NGValueParameter";q.prototype={ast:function(a){this.text=
1033a;this.tokens=this.lexer.lex(a);a=this.program();0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]);return a},program:function(){for(var a=[];;)if(0<this.tokens.length&&!this.peek("}",")",";","]")&&a.push(this.expressionStatement()),!this.expect(";"))return{type:q.Program,body:a}},expressionStatement:function(){return{type:q.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var a=this.expression();this.expect("|");)a=this.filter(a);return a},
1034expression:function(){return this.assignment()},assignment:function(){var a=this.ternary();if(this.expect("=")){if(!Jd(a))throw Ya("lval");a={type:q.AssignmentExpression,left:a,right:this.assignment(),operator:"="}}return a},ternary:function(){var a=this.logicalOR(),b,d;return this.expect("?")&&(b=this.expression(),this.consume(":"))?(d=this.expression(),{type:q.ConditionalExpression,test:a,alternate:b,consequent:d}):a},logicalOR:function(){for(var a=this.logicalAND();this.expect("||");)a={type:q.LogicalExpression,
1035operator:"||",left:a,right:this.logicalAND()};return a},logicalAND:function(){for(var a=this.equality();this.expect("&&");)a={type:q.LogicalExpression,operator:"&&",left:a,right:this.equality()};return a},equality:function(){for(var a=this.relational(),b;b=this.expect("==","!=","===","!==");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.relational()};return a},relational:function(){for(var a=this.additive(),b;b=this.expect("<",">","<=",">=");)a={type:q.BinaryExpression,operator:b.text,
1036left:a,right:this.additive()};return a},additive:function(){for(var a=this.multiplicative(),b;b=this.expect("+","-");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.multiplicative()};return a},multiplicative:function(){for(var a=this.unary(),b;b=this.expect("*","/","%");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.unary()};return a},unary:function(){var a;return(a=this.expect("+","-","!"))?{type:q.UnaryExpression,operator:a.text,prefix:!0,argument:this.unary()}:this.primary()},
1037primary:function(){var a;this.expect("(")?(a=this.filterChain(),this.consume(")")):this.expect("[")?a=this.arrayDeclaration():this.expect("{")?a=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?a=Ia(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?a={type:q.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?a=this.identifier():this.peek().constant?a=this.constant():this.throwError("not a primary expression",
1038this.peek());for(var b;b=this.expect("(","[",".");)"("===b.text?(a={type:q.CallExpression,callee:a,arguments:this.parseArguments()},this.consume(")")):"["===b.text?(a={type:q.MemberExpression,object:a,property:this.expression(),computed:!0},this.consume("]")):"."===b.text?a={type:q.MemberExpression,object:a,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return a},filter:function(a){a=[a];for(var b={type:q.CallExpression,callee:this.identifier(),arguments:a,filter:!0};this.expect(":");)a.push(this.expression());
1039return b},parseArguments:function(){var a=[];if(")"!==this.peekToken().text){do a.push(this.filterChain());while(this.expect(","))}return a},identifier:function(){var a=this.consume();a.identifier||this.throwError("is not a valid identifier",a);return{type:q.Identifier,name:a.text}},constant:function(){return{type:q.Literal,value:this.consume().value}},arrayDeclaration:function(){var a=[];if("]"!==this.peekToken().text){do{if(this.peek("]"))break;a.push(this.expression())}while(this.expect(","))}this.consume("]");
1040return{type:q.ArrayExpression,elements:a}},object:function(){var a=[],b;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;b={type:q.Property,kind:"init"};this.peek().constant?(b.key=this.constant(),b.computed=!1,this.consume(":"),b.value=this.expression()):this.peek().identifier?(b.key=this.identifier(),b.computed=!1,this.peek(":")?(this.consume(":"),b.value=this.expression()):b.value=b.key):this.peek("[")?(this.consume("["),b.key=this.expression(),this.consume("]"),b.computed=!0,this.consume(":"),
1041b.value=this.expression()):this.throwError("invalid key",this.peek());a.push(b)}while(this.expect(","))}this.consume("}");return{type:q.ObjectExpression,properties:a}},throwError:function(a,b){throw Ya("syntax",b.text,a,b.index+1,this.text,this.text.substring(b.index));},consume:function(a){if(0===this.tokens.length)throw Ya("ueoe",this.text);var b=this.expect(a);b||this.throwError("is unexpected, expecting ["+a+"]",this.peek());return b},peekToken:function(){if(0===this.tokens.length)throw Ya("ueoe",
1042this.text);return this.tokens[0]},peek:function(a,b,d,c){return this.peekAhead(0,a,b,d,c)},peekAhead:function(a,b,d,c,e){if(this.tokens.length>a){a=this.tokens[a];var f=a.text;if(f===b||f===d||f===c||f===e||!(b||d||c||e))return a}return!1},expect:function(a,b,d,c){return(a=this.peek(a,b,d,c))?(this.tokens.shift(),a):!1},selfReferential:{"this":{type:q.ThisExpression},$locals:{type:q.LocalsExpression}}};var Hd=2;Ld.prototype={compile:function(a){var b=this;this.state={nextId:0,filters:{},fn:{vars:[],
1043body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]};Z(a,b.$filter);var d="",c;this.stage="assign";if(c=Kd(a))this.state.computing="assign",d=this.nextId(),this.recurse(c,d),this.return_(d),d="fn.assign="+this.generateFunction("assign","s,v,l");c=Id(a.body);b.stage="inputs";r(c,function(a,c){var d="fn"+c;b.state[d]={vars:[],body:[],own:{}};b.state.computing=d;var k=b.nextId();b.recurse(a,k);b.return_(k);b.state.inputs.push({name:d,isPure:a.isPure});a.watchId=c});this.state.computing="fn";this.stage=
1044"main";this.recurse(a);a='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+d+this.watchFns()+"return fn;";a=(new Function("$filter","getStringValue","ifDefined","plus",a))(this.$filter,Tg,Ug,Gd);this.state=this.stage=void 0;return a},USE:"use",STRICT:"strict",watchFns:function(){var a=[],b=this.state.inputs,d=this;r(b,function(b){a.push("var "+b.name+"="+d.generateFunction(b.name,"s"));b.isPure&&a.push(b.name,".isPure="+JSON.stringify(b.isPure)+
1045";")});b.length&&a.push("fn.inputs=["+b.map(function(a){return a.name}).join(",")+"];");return a.join("")},generateFunction:function(a,b){return"function("+b+"){"+this.varsPrefix(a)+this.body(a)+"};"},filterPrefix:function(){var a=[],b=this;r(this.state.filters,function(d,c){a.push(d+"=$filter("+b.escape(c)+")")});return a.length?"var "+a.join(",")+";":""},varsPrefix:function(a){return this.state[a].vars.length?"var "+this.state[a].vars.join(",")+";":""},body:function(a){return this.state[a].body.join("")},
1046recurse:function(a,b,d,c,e,f){var g,k,h=this,l,m,p;c=c||E;if(!f&&w(a.watchId))b=b||this.nextId(),this.if_("i",this.lazyAssign(b,this.computedMember("i",a.watchId)),this.lazyRecurse(a,b,d,c,e,!0));else switch(a.type){case q.Program:r(a.body,function(b,c){h.recurse(b.expression,void 0,void 0,function(a){k=a});c!==a.body.length-1?h.current().body.push(k,";"):h.return_(k)});break;case q.Literal:m=this.escape(a.value);this.assign(b,m);c(b||m);break;case q.UnaryExpression:this.recurse(a.argument,void 0,
1047void 0,function(a){k=a});m=a.operator+"("+this.ifDefined(k,0)+")";this.assign(b,m);c(m);break;case q.BinaryExpression:this.recurse(a.left,void 0,void 0,function(a){g=a});this.recurse(a.right,void 0,void 0,function(a){k=a});m="+"===a.operator?this.plus(g,k):"-"===a.operator?this.ifDefined(g,0)+a.operator+this.ifDefined(k,0):"("+g+")"+a.operator+"("+k+")";this.assign(b,m);c(m);break;case q.LogicalExpression:b=b||this.nextId();h.recurse(a.left,b);h.if_("&&"===a.operator?b:h.not(b),h.lazyRecurse(a.right,
1048b));c(b);break;case q.ConditionalExpression:b=b||this.nextId();h.recurse(a.test,b);h.if_(b,h.lazyRecurse(a.alternate,b),h.lazyRecurse(a.consequent,b));c(b);break;case q.Identifier:b=b||this.nextId();d&&(d.context="inputs"===h.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",a.name)+"?l:s"),d.computed=!1,d.name=a.name);h.if_("inputs"===h.stage||h.not(h.getHasOwnProperty("l",a.name)),function(){h.if_("inputs"===h.stage||"s",function(){e&&1!==e&&h.if_(h.isNull(h.nonComputedMember("s",a.name)),
1049h.lazyAssign(h.nonComputedMember("s",a.name),"{}"));h.assign(b,h.nonComputedMember("s",a.name))})},b&&h.lazyAssign(b,h.nonComputedMember("l",a.name)));c(b);break;case q.MemberExpression:g=d&&(d.context=this.nextId())||this.nextId();b=b||this.nextId();h.recurse(a.object,g,void 0,function(){h.if_(h.notNull(g),function(){a.computed?(k=h.nextId(),h.recurse(a.property,k),h.getStringValue(k),e&&1!==e&&h.if_(h.not(h.computedMember(g,k)),h.lazyAssign(h.computedMember(g,k),"{}")),m=h.computedMember(g,k),h.assign(b,
1050m),d&&(d.computed=!0,d.name=k)):(e&&1!==e&&h.if_(h.isNull(h.nonComputedMember(g,a.property.name)),h.lazyAssign(h.nonComputedMember(g,a.property.name),"{}")),m=h.nonComputedMember(g,a.property.name),h.assign(b,m),d&&(d.computed=!1,d.name=a.property.name))},function(){h.assign(b,"undefined")});c(b)},!!e);break;case q.CallExpression:b=b||this.nextId();a.filter?(k=h.filter(a.callee.name),l=[],r(a.arguments,function(a){var b=h.nextId();h.recurse(a,b);l.push(b)}),m=k+"("+l.join(",")+")",h.assign(b,m),c(b)):
1051(k=h.nextId(),g={},l=[],h.recurse(a.callee,k,g,function(){h.if_(h.notNull(k),function(){r(a.arguments,function(b){h.recurse(b,a.constant?void 0:h.nextId(),void 0,function(a){l.push(a)})});m=g.name?h.member(g.context,g.name,g.computed)+"("+l.join(",")+")":k+"("+l.join(",")+")";h.assign(b,m)},function(){h.assign(b,"undefined")});c(b)}));break;case q.AssignmentExpression:k=this.nextId();g={};this.recurse(a.left,void 0,g,function(){h.if_(h.notNull(g.context),function(){h.recurse(a.right,k);m=h.member(g.context,
1052g.name,g.computed)+a.operator+k;h.assign(b,m);c(b||m)})},1);break;case q.ArrayExpression:l=[];r(a.elements,function(b){h.recurse(b,a.constant?void 0:h.nextId(),void 0,function(a){l.push(a)})});m="["+l.join(",")+"]";this.assign(b,m);c(b||m);break;case q.ObjectExpression:l=[];p=!1;r(a.properties,function(a){a.computed&&(p=!0)});p?(b=b||this.nextId(),this.assign(b,"{}"),r(a.properties,function(a){a.computed?(g=h.nextId(),h.recurse(a.key,g)):g=a.key.type===q.Identifier?a.key.name:""+a.key.value;k=h.nextId();
1053h.recurse(a.value,k);h.assign(h.member(b,g,a.computed),k)})):(r(a.properties,function(b){h.recurse(b.value,a.constant?void 0:h.nextId(),void 0,function(a){l.push(h.escape(b.key.type===q.Identifier?b.key.name:""+b.key.value)+":"+a)})}),m="{"+l.join(",")+"}",this.assign(b,m));c(b||m);break;case q.ThisExpression:this.assign(b,"s");c(b||"s");break;case q.LocalsExpression:this.assign(b,"l");c(b||"l");break;case q.NGValueParameter:this.assign(b,"v"),c(b||"v")}},getHasOwnProperty:function(a,b){var d=a+"."+
1054b,c=this.current().own;c.hasOwnProperty(d)||(c[d]=this.nextId(!1,a+"&&("+this.escape(b)+" in "+a+")"));return c[d]},assign:function(a,b){if(a)return this.current().body.push(a,"=",b,";"),a},filter:function(a){this.state.filters.hasOwnProperty(a)||(this.state.filters[a]=this.nextId(!0));return this.state.filters[a]},ifDefined:function(a,b){return"ifDefined("+a+","+this.escape(b)+")"},plus:function(a,b){return"plus("+a+","+b+")"},return_:function(a){this.current().body.push("return ",a,";")},if_:function(a,
1055b,d){if(!0===a)b();else{var c=this.current().body;c.push("if(",a,"){");b();c.push("}");d&&(c.push("else{"),d(),c.push("}"))}},not:function(a){return"!("+a+")"},isNull:function(a){return a+"==null"},notNull:function(a){return a+"!=null"},nonComputedMember:function(a,b){var d=/[^$_a-zA-Z0-9]/g;return/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(b)?a+"."+b:a+'["'+b.replace(d,this.stringEscapeFn)+'"]'},computedMember:function(a,b){return a+"["+b+"]"},member:function(a,b,d){return d?this.computedMember(a,b):this.nonComputedMember(a,
1056b)},getStringValue:function(a){this.assign(a,"getStringValue("+a+")")},lazyRecurse:function(a,b,d,c,e,f){var g=this;return function(){g.recurse(a,b,d,c,e,f)}},lazyAssign:function(a,b){var d=this;return function(){d.assign(a,b)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)},escape:function(a){if(C(a))return"'"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(X(a))return a.toString();if(!0===a)return"true";if(!1===
1057a)return"false";if(null===a)return"null";if("undefined"===typeof a)return"undefined";throw Ya("esc");},nextId:function(a,b){var d="v"+this.state.nextId++;a||this.current().vars.push(d+(b?"="+b:""));return d},current:function(){return this.state[this.state.computing]}};Md.prototype={compile:function(a){var b=this;Z(a,b.$filter);var d,c;if(d=Kd(a))c=this.recurse(d);d=Id(a.body);var e;d&&(e=[],r(d,function(a,c){var d=b.recurse(a);d.isPure=a.isPure;a.input=d;e.push(d);a.watchId=c}));var f=[];r(a.body,
1058function(a){f.push(b.recurse(a.expression))});a=0===a.body.length?E:1===a.body.length?f[0]:function(a,b){var c;r(f,function(d){c=d(a,b)});return c};c&&(a.assign=function(a,b,d){return c(a,d,b)});e&&(a.inputs=e);return a},recurse:function(a,b,d){var c,e,f=this,g;if(a.input)return this.inputs(a.input,a.watchId);switch(a.type){case q.Literal:return this.value(a.value,b);case q.UnaryExpression:return e=this.recurse(a.argument),this["unary"+a.operator](e,b);case q.BinaryExpression:return c=this.recurse(a.left),
1059e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case q.LogicalExpression:return c=this.recurse(a.left),e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case q.ConditionalExpression:return this["ternary?:"](this.recurse(a.test),this.recurse(a.alternate),this.recurse(a.consequent),b);case q.Identifier:return f.identifier(a.name,b,d);case q.MemberExpression:return c=this.recurse(a.object,!1,!!d),a.computed||(e=a.property.name),a.computed&&(e=this.recurse(a.property)),a.computed?this.computedMember(c,
1060e,b,d):this.nonComputedMember(c,e,b,d);case q.CallExpression:return g=[],r(a.arguments,function(a){g.push(f.recurse(a))}),a.filter&&(e=this.$filter(a.callee.name)),a.filter||(e=this.recurse(a.callee,!0)),a.filter?function(a,c,d,f){for(var p=[],n=0;n<g.length;++n)p.push(g[n](a,c,d,f));a=e.apply(void 0,p,f);return b?{context:void 0,name:void 0,value:a}:a}:function(a,c,d,f){var p=e(a,c,d,f),n;if(null!=p.value){n=[];for(var s=0;s<g.length;++s)n.push(g[s](a,c,d,f));n=p.value.apply(p.context,n)}return b?
1061{value:n}:n};case q.AssignmentExpression:return c=this.recurse(a.left,!0,1),e=this.recurse(a.right),function(a,d,f,g){var p=c(a,d,f,g);a=e(a,d,f,g);p.context[p.name]=a;return b?{value:a}:a};case q.ArrayExpression:return g=[],r(a.elements,function(a){g.push(f.recurse(a))}),function(a,c,d,e){for(var f=[],n=0;n<g.length;++n)f.push(g[n](a,c,d,e));return b?{value:f}:f};case q.ObjectExpression:return g=[],r(a.properties,function(a){a.computed?g.push({key:f.recurse(a.key),computed:!0,value:f.recurse(a.value)}):
1062g.push({key:a.key.type===q.Identifier?a.key.name:""+a.key.value,computed:!1,value:f.recurse(a.value)})}),function(a,c,d,e){for(var f={},n=0;n<g.length;++n)g[n].computed?f[g[n].key(a,c,d,e)]=g[n].value(a,c,d,e):f[g[n].key]=g[n].value(a,c,d,e);return b?{value:f}:f};case q.ThisExpression:return function(a){return b?{value:a}:a};case q.LocalsExpression:return function(a,c){return b?{value:c}:c};case q.NGValueParameter:return function(a,c,d){return b?{value:d}:d}}},"unary+":function(a,b){return function(d,
1063c,e,f){d=a(d,c,e,f);d=w(d)?+d:0;return b?{value:d}:d}},"unary-":function(a,b){return function(d,c,e,f){d=a(d,c,e,f);d=w(d)?-d:-0;return b?{value:d}:d}},"unary!":function(a,b){return function(d,c,e,f){d=!a(d,c,e,f);return b?{value:d}:d}},"binary+":function(a,b,d){return function(c,e,f,g){var k=a(c,e,f,g);c=b(c,e,f,g);k=Gd(k,c);return d?{value:k}:k}},"binary-":function(a,b,d){return function(c,e,f,g){var k=a(c,e,f,g);c=b(c,e,f,g);k=(w(k)?k:0)-(w(c)?c:0);return d?{value:k}:k}},"binary*":function(a,b,
1064d){return function(c,e,f,g){c=a(c,e,f,g)*b(c,e,f,g);return d?{value:c}:c}},"binary/":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)/b(c,e,f,g);return d?{value:c}:c}},"binary%":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)%b(c,e,f,g);return d?{value:c}:c}},"binary===":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)===b(c,e,f,g);return d?{value:c}:c}},"binary!==":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)!==b(c,e,f,g);return d?{value:c}:c}},"binary==":function(a,b,d){return function(c,
1065e,f,g){c=a(c,e,f,g)==b(c,e,f,g);return d?{value:c}:c}},"binary!=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)!=b(c,e,f,g);return d?{value:c}:c}},"binary<":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)<b(c,e,f,g);return d?{value:c}:c}},"binary>":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>b(c,e,f,g);return d?{value:c}:c}},"binary<=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)<=b(c,e,f,g);return d?{value:c}:c}},"binary>=":function(a,b,d){return function(c,e,f,g){c=
1066a(c,e,f,g)>=b(c,e,f,g);return d?{value:c}:c}},"binary&&":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)&&b(c,e,f,g);return d?{value:c}:c}},"binary||":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)||b(c,e,f,g);return d?{value:c}:c}},"ternary?:":function(a,b,d,c){return function(e,f,g,k){e=a(e,f,g,k)?b(e,f,g,k):d(e,f,g,k);return c?{value:e}:e}},value:function(a,b){return function(){return b?{context:void 0,name:void 0,value:a}:a}},identifier:function(a,b,d){return function(c,e,f,g){c=
1067e&&a in e?e:c;d&&1!==d&&c&&null==c[a]&&(c[a]={});e=c?c[a]:void 0;return b?{context:c,name:a,value:e}:e}},computedMember:function(a,b,d,c){return function(e,f,g,k){var h=a(e,f,g,k),l,m;null!=h&&(l=b(e,f,g,k),l+="",c&&1!==c&&h&&!h[l]&&(h[l]={}),m=h[l]);return d?{context:h,name:l,value:m}:m}},nonComputedMember:function(a,b,d,c){return function(e,f,g,k){e=a(e,f,g,k);c&&1!==c&&e&&null==e[b]&&(e[b]={});f=null!=e?e[b]:void 0;return d?{context:e,name:b,value:f}:f}},inputs:function(a,b){return function(d,
1068c,e,f){return f?f[b]:a(d,c,e)}}};Nb.prototype={constructor:Nb,parse:function(a){a=this.getAst(a);var b=this.astCompiler.compile(a.ast),d=a.ast;b.literal=0===d.body.length||1===d.body.length&&(d.body[0].expression.type===q.Literal||d.body[0].expression.type===q.ArrayExpression||d.body[0].expression.type===q.ObjectExpression);b.constant=a.ast.constant;b.oneTime=a.oneTime;return b},getAst:function(a){var b=!1;a=a.trim();":"===a.charAt(0)&&":"===a.charAt(1)&&(b=!0,a=a.substring(2));return{ast:this.ast.ast(a),
1069oneTime:b}}};var Ea=F("$sce"),W={HTML:"html",CSS:"css",MEDIA_URL:"mediaUrl",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Dc=/_([a-z])/g,Zg=F("$templateRequest"),$g=F("$timeout"),aa=z.document.createElement("a"),Qd=ga(z.location.href),Na;aa.href="http://[::1]";var ah="[::1]"===aa.hostname;Rd.$inject=["$document"];fd.$inject=["$provide"];var Yd=22,Xd=".",Fc="0";Sd.$inject=["$locale"];Ud.$inject=["$locale"];var lh={yyyy:ea("FullYear",4,0,!1,!0),yy:ea("FullYear",2,0,!0,!0),y:ea("FullYear",1,0,!1,!0),
1070MMMM:lb("Month"),MMM:lb("Month",!0),MM:ea("Month",2,1),M:ea("Month",1,1),LLLL:lb("Month",!1,!0),dd:ea("Date",2),d:ea("Date",1),HH:ea("Hours",2),H:ea("Hours",1),hh:ea("Hours",2,-12),h:ea("Hours",1,-12),mm:ea("Minutes",2),m:ea("Minutes",1),ss:ea("Seconds",2),s:ea("Seconds",1),sss:ea("Milliseconds",3),EEEE:lb("Day"),EEE:lb("Day",!0),a:function(a,b){return 12>a.getHours()?b.AMPMS[0]:b.AMPMS[1]},Z:function(a,b,d){a=-1*d;return a=(0<=a?"+":"")+(Pb(Math[0<a?"floor":"ceil"](a/60),2)+Pb(Math.abs(a%60),2))},
1071ww:$d(2),w:$d(1),G:Gc,GG:Gc,GGG:Gc,GGGG:function(a,b){return 0>=a.getFullYear()?b.ERANAMES[0]:b.ERANAMES[1]}},kh=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,jh=/^-?\d+$/;Td.$inject=["$locale"];var eh=ia(K),fh=ia(vb);Vd.$inject=["$parse"];var Re=ia({restrict:"E",compile:function(a,b){if(!b.href&&!b.xlinkHref)return function(a,b){if("a"===b[0].nodeName.toLowerCase()){var e="[object SVGAnimatedString]"===la.call(b.prop("href"))?"xlink:href":"href";
1072b.on("click",function(a){b.attr(e)||a.preventDefault()})}}}}),wb={};r(Hb,function(a,b){function d(a,d,e){a.$watch(e[c],function(a){e.$set(b,!!a)})}if("multiple"!==a){var c=xa("ng-"+b),e=d;"checked"===a&&(e=function(a,b,e){e.ngModel!==e[c]&&d(a,b,e)});wb[c]=function(){return{restrict:"A",priority:100,link:e}}}});r(vd,function(a,b){wb[b]=function(){return{priority:100,link:function(a,c,e){if("ngPattern"===b&&"/"===e.ngPattern.charAt(0)&&(c=e.ngPattern.match(ke))){e.$set("ngPattern",new RegExp(c[1],
1073c[2]));return}a.$watch(e[b],function(a){e.$set(b,a)})}}}});r(["src","srcset","href"],function(a){var b=xa("ng-"+a);wb[b]=["$sce",function(d){return{priority:99,link:function(c,e,f){var g=a,k=a;"href"===a&&"[object SVGAnimatedString]"===la.call(e.prop("href"))&&(k="xlinkHref",f.$attr[k]="xlink:href",g=null);f.$set(b,d.getTrustedMediaUrl(f[b]));f.$observe(b,function(b){b?(f.$set(k,b),wa&&g&&e.prop(g,f[k])):"href"===a&&f.$set(k,null)})}}}]});var mb={$addControl:E,$getControls:ia([]),$$renameControl:function(a,
1074b){a.$name=b},$removeControl:E,$setValidity:E,$setDirty:E,$setPristine:E,$setSubmitted:E,$$setSubmitted:E};Qb.$inject=["$element","$attrs","$scope","$animate","$interpolate"];Qb.prototype={$rollbackViewValue:function(){r(this.$$controls,function(a){a.$rollbackViewValue()})},$commitViewValue:function(){r(this.$$controls,function(a){a.$commitViewValue()})},$addControl:function(a){Ja(a.$name,"input");this.$$controls.push(a);a.$name&&(this[a.$name]=a);a.$$parentForm=this},$getControls:function(){return ja(this.$$controls)},
1075$$renameControl:function(a,b){var d=a.$name;this[d]===a&&delete this[d];this[b]=a;a.$name=b},$removeControl:function(a){a.$name&&this[a.$name]===a&&delete this[a.$name];r(this.$pending,function(b,d){this.$setValidity(d,null,a)},this);r(this.$error,function(b,d){this.$setValidity(d,null,a)},this);r(this.$$success,function(b,d){this.$setValidity(d,null,a)},this);cb(this.$$controls,a);a.$$parentForm=mb},$setDirty:function(){this.$$animate.removeClass(this.$$element,Za);this.$$animate.addClass(this.$$element,
1076Wb);this.$dirty=!0;this.$pristine=!1;this.$$parentForm.$setDirty()},$setPristine:function(){this.$$animate.setClass(this.$$element,Za,Wb+" ng-submitted");this.$dirty=!1;this.$pristine=!0;this.$submitted=!1;r(this.$$controls,function(a){a.$setPristine()})},$setUntouched:function(){r(this.$$controls,function(a){a.$setUntouched()})},$setSubmitted:function(){for(var a=this;a.$$parentForm&&a.$$parentForm!==mb;)a=a.$$parentForm;a.$$setSubmitted()},$$setSubmitted:function(){this.$$animate.addClass(this.$$element,
1077"ng-submitted");this.$submitted=!0;r(this.$$controls,function(a){a.$$setSubmitted&&a.$$setSubmitted()})}};ce({clazz:Qb,set:function(a,b,d){var c=a[b];c?-1===c.indexOf(d)&&c.push(d):a[b]=[d]},unset:function(a,b,d){var c=a[b];c&&(cb(c,d),0===c.length&&delete a[b])}});var oe=function(a){return["$timeout","$parse",function(b,d){function c(a){return""===a?d('this[""]').assign:d(a).assign||E}return{name:"form",restrict:a?"EAC":"E",require:["form","^^?form"],controller:Qb,compile:function(d,f){d.addClass(Za).addClass(nb);
1078var g=f.name?"name":a&&f.ngForm?"ngForm":!1;return{pre:function(a,d,e,f){var p=f[0];if(!("action"in e)){var n=function(b){a.$apply(function(){p.$commitViewValue();p.$setSubmitted()});b.preventDefault()};d[0].addEventListener("submit",n);d.on("$destroy",function(){b(function(){d[0].removeEventListener("submit",n)},0,!1)})}(f[1]||p.$$parentForm).$addControl(p);var s=g?c(p.$name):E;g&&(s(a,p),e.$observe(g,function(b){p.$name!==b&&(s(a,void 0),p.$$parentForm.$$renameControl(p,b),s=c(p.$name),s(a,p))}));
1079d.on("$destroy",function(){p.$$parentForm.$removeControl(p);s(a,void 0);S(p,mb)})}}}}}]},Se=oe(),df=oe(!0),mh=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,xh=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,yh=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,
1080nh=/^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,pe=/^(\d{4,})-(\d{2})-(\d{2})$/,qe=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Oc=/^(\d{4,})-W(\d\d)$/,re=/^(\d{4,})-(\d\d)$/,se=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,ee=T();r(["date","datetime-local","month","time","week"],function(a){ee[a]=!0});var te={text:function(a,b,d,c,e,f){Sa(a,b,d,c,e,f);Ic(c)},date:ob("date",pe,Rb(pe,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":ob("datetimelocal",qe,Rb(qe,"yyyy MM dd HH mm ss sss".split(" ")),
1081"yyyy-MM-ddTHH:mm:ss.sss"),time:ob("time",se,Rb(se,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:ob("week",Oc,function(a,b){if(ha(a))return a;if(C(a)){Oc.lastIndex=0;var d=Oc.exec(a);if(d){var c=+d[1],e=+d[2],f=d=0,g=0,k=0,h=Zd(c),e=7*(e-1);b&&(d=b.getHours(),f=b.getMinutes(),g=b.getSeconds(),k=b.getMilliseconds());return new Date(c,0,h.getDate()+e,d,f,g,k)}}return NaN},"yyyy-Www"),month:ob("month",re,Rb(re,["yyyy","MM"]),"yyyy-MM"),number:function(a,b,d,c,e,f,g,k){Jc(a,b,d,c,"number");fe(c);Sa(a,
1082b,d,c,e,f);var h;if(w(d.min)||d.ngMin){var l=d.min||k(d.ngMin)(a);h=na(l);c.$validators.min=function(a,b){return c.$isEmpty(b)||A(h)||b>=h};d.$observe("min",function(a){a!==l&&(h=na(a),l=a,c.$validate())})}if(w(d.max)||d.ngMax){var m=d.max||k(d.ngMax)(a),p=na(m);c.$validators.max=function(a,b){return c.$isEmpty(b)||A(p)||b<=p};d.$observe("max",function(a){a!==m&&(p=na(a),m=a,c.$validate())})}if(w(d.step)||d.ngStep){var n=d.step||k(d.ngStep)(a),s=na(n);c.$validators.step=function(a,b){return c.$isEmpty(b)||
1083A(s)||ge(b,h||0,s)};d.$observe("step",function(a){a!==n&&(s=na(a),n=a,c.$validate())})}},url:function(a,b,d,c,e,f){Sa(a,b,d,c,e,f);Ic(c);c.$validators.url=function(a,b){var d=a||b;return c.$isEmpty(d)||xh.test(d)}},email:function(a,b,d,c,e,f){Sa(a,b,d,c,e,f);Ic(c);c.$validators.email=function(a,b){var d=a||b;return c.$isEmpty(d)||yh.test(d)}},radio:function(a,b,d,c){var e=!d.ngTrim||"false"!==V(d.ngTrim);A(d.name)&&b.attr("name",++qb);b.on("change",function(a){var g;b[0].checked&&(g=d.value,e&&(g=
1084V(g)),c.$setViewValue(g,a&&a.type))});c.$render=function(){var a=d.value;e&&(a=V(a));b[0].checked=a===c.$viewValue};d.$observe("value",c.$render)},range:function(a,b,d,c,e,f){function g(a,c){b.attr(a,d[a]);var e=d[a];d.$observe(a,function(a){a!==e&&(e=a,c(a))})}function k(a){p=na(a);Y(c.$modelValue)||(m?(a=b.val(),p>a&&(a=p,b.val(a)),c.$setViewValue(a)):c.$validate())}function h(a){n=na(a);Y(c.$modelValue)||(m?(a=b.val(),n<a&&(b.val(n),a=n<p?p:n),c.$setViewValue(a)):c.$validate())}function l(a){s=
1085na(a);Y(c.$modelValue)||(m?c.$viewValue!==b.val()&&c.$setViewValue(b.val()):c.$validate())}Jc(a,b,d,c,"range");fe(c);Sa(a,b,d,c,e,f);var m=c.$$hasNativeValidators&&"range"===b[0].type,p=m?0:void 0,n=m?100:void 0,s=m?1:void 0,r=b[0].validity;a=w(d.min);e=w(d.max);f=w(d.step);var q=c.$render;c.$render=m&&w(r.rangeUnderflow)&&w(r.rangeOverflow)?function(){q();c.$setViewValue(b.val())}:q;a&&(p=na(d.min),c.$validators.min=m?function(){return!0}:function(a,b){return c.$isEmpty(b)||A(p)||b>=p},g("min",k));
1086e&&(n=na(d.max),c.$validators.max=m?function(){return!0}:function(a,b){return c.$isEmpty(b)||A(n)||b<=n},g("max",h));f&&(s=na(d.step),c.$validators.step=m?function(){return!r.stepMismatch}:function(a,b){return c.$isEmpty(b)||A(s)||ge(b,p||0,s)},g("step",l))},checkbox:function(a,b,d,c,e,f,g,k){var h=he(k,a,"ngTrueValue",d.ngTrueValue,!0),l=he(k,a,"ngFalseValue",d.ngFalseValue,!1);b.on("change",function(a){c.$setViewValue(b[0].checked,a&&a.type)});c.$render=function(){b[0].checked=c.$viewValue};c.$isEmpty=
1087function(a){return!1===a};c.$formatters.push(function(a){return va(a,h)});c.$parsers.push(function(a){return a?h:l})},hidden:E,button:E,submit:E,reset:E,file:E},$c=["$browser","$sniffer","$filter","$parse",function(a,b,d,c){return{restrict:"E",require:["?ngModel"],link:{pre:function(e,f,g,k){k[0]&&(te[K(g.type)]||te.text)(e,f,g,k[0],b,a,d,c)}}}}],Af=function(){var a={configurable:!0,enumerable:!1,get:function(){return this.getAttribute("value")||""},set:function(a){this.setAttribute("value",a)}};
1088return{restrict:"E",priority:200,compile:function(b,d){if("hidden"===K(d.type))return{pre:function(b,d,f,g){b=d[0];b.parentNode&&b.parentNode.insertBefore(b,b.nextSibling);Object.defineProperty&&Object.defineProperty(b,"value",a)}}}}},zh=/^(true|false|\d+)$/,xf=function(){function a(a,d,c){var e=w(c)?c:9===wa?"":null;a.prop("value",e);d.$set("value",c)}return{restrict:"A",priority:100,compile:function(b,d){return zh.test(d.ngValue)?function(b,d,f){b=b.$eval(f.ngValue);a(d,f,b)}:function(b,d,f){b.$watch(f.ngValue,
1089function(b){a(d,f,b)})}}}},We=["$compile",function(a){return{restrict:"AC",compile:function(b){a.$$addBindingClass(b);return function(b,c,e){a.$$addBindingInfo(c,e.ngBind);c=c[0];b.$watch(e.ngBind,function(a){c.textContent=jc(a)})}}}}],Ye=["$interpolate","$compile",function(a,b){return{compile:function(d){b.$$addBindingClass(d);return function(c,d,f){c=a(d.attr(f.$attr.ngBindTemplate));b.$$addBindingInfo(d,c.expressions);d=d[0];f.$observe("ngBindTemplate",function(a){d.textContent=A(a)?"":a})}}}}],
1090Xe=["$sce","$parse","$compile",function(a,b,d){return{restrict:"A",compile:function(c,e){var f=b(e.ngBindHtml),g=b(e.ngBindHtml,function(b){return a.valueOf(b)});d.$$addBindingClass(c);return function(b,c,e){d.$$addBindingInfo(c,e.ngBindHtml);b.$watch(g,function(){var d=f(b);c.html(a.getTrustedHtml(d)||"")})}}}}],wf=ia({restrict:"A",require:"ngModel",link:function(a,b,d,c){c.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),Ze=Lc("",!0),af=Lc("Odd",0),$e=Lc("Even",1),bf=Ra({compile:function(a,
1091b){b.$set("ngCloak",void 0);a.removeClass("ng-cloak")}}),cf=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],ed={},Ah={blur:!0,focus:!0};r("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(a){var b=xa("ng-"+a);ed[b]=["$parse","$rootScope","$exceptionHandler",function(d,c,e){return sd(d,c,e,b,a,Ah[a])}]});var ff=["$animate","$compile",function(a,b){return{multiElement:!0,
1092transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(d,c,e,f,g){var k,h,l;d.$watch(e.ngIf,function(d){d?h||g(function(d,f){h=f;d[d.length++]=b.$$createComment("end ngIf",e.ngIf);k={clone:d};a.enter(d,c.parent(),c)}):(l&&(l.remove(),l=null),h&&(h.$destroy(),h=null),k&&(l=ub(k.clone),a.leave(l).done(function(a){!1!==a&&(l=null)}),k=null))})}}}],gf=["$templateRequest","$anchorScroll","$animate",function(a,b,d){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",
1093controller:ca.noop,compile:function(c,e){var f=e.ngInclude||e.src,g=e.onload||"",k=e.autoscroll;return function(c,e,m,p,n){var r=0,q,t,x,v=function(){t&&(t.remove(),t=null);q&&(q.$destroy(),q=null);x&&(d.leave(x).done(function(a){!1!==a&&(t=null)}),t=x,x=null)};c.$watch(f,function(f){var m=function(a){!1===a||!w(k)||k&&!c.$eval(k)||b()},t=++r;f?(a(f,!0).then(function(a){if(!c.$$destroyed&&t===r){var b=c.$new();p.template=a;a=n(b,function(a){v();d.enter(a,null,e).done(m)});q=b;x=a;q.$emit("$includeContentLoaded",
1094f);c.$eval(g)}},function(){c.$$destroyed||t!==r||(v(),c.$emit("$includeContentError",f))}),c.$emit("$includeContentRequested",f)):(v(),p.template=null)})}}}}],zf=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(b,d,c,e){la.call(d[0]).match(/SVG/)?(d.empty(),a(gd(e.template,z.document).childNodes)(b,function(a){d.append(a)},{futureParentElement:d})):(d.html(e.template),a(d.contents())(b))}}}],hf=Ra({priority:450,compile:function(){return{pre:function(a,
1095b,d){a.$eval(d.ngInit)}}}}),vf=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(a,b,d,c){var e=d.ngList||", ",f="false"!==d.ngTrim,g=f?V(e):e;c.$parsers.push(function(a){if(!A(a)){var b=[];a&&r(a.split(g),function(a){a&&b.push(f?V(a):a)});return b}});c.$formatters.push(function(a){if(H(a))return a.join(e)});c.$isEmpty=function(a){return!a||!a.length}}}},nb="ng-valid",be="ng-invalid",Za="ng-pristine",Wb="ng-dirty",pb=F("ngModel");Sb.$inject="$scope $exceptionHandler $attrs $element $parse $animate $timeout $q $interpolate".split(" ");
1096Sb.prototype={$$initGetterSetters:function(){if(this.$options.getOption("getterSetter")){var a=this.$$parse(this.$$attr.ngModel+"()"),b=this.$$parse(this.$$attr.ngModel+"($$$p)");this.$$ngModelGet=function(b){var c=this.$$parsedNgModel(b);B(c)&&(c=a(b));return c};this.$$ngModelSet=function(a,c){B(this.$$parsedNgModel(a))?b(a,{$$$p:c}):this.$$parsedNgModelAssign(a,c)}}else if(!this.$$parsedNgModel.assign)throw pb("nonassign",this.$$attr.ngModel,Aa(this.$$element));},$render:E,$isEmpty:function(a){return A(a)||
1097""===a||null===a||a!==a},$$updateEmptyClasses:function(a){this.$isEmpty(a)?(this.$$animate.removeClass(this.$$element,"ng-not-empty"),this.$$animate.addClass(this.$$element,"ng-empty")):(this.$$animate.removeClass(this.$$element,"ng-empty"),this.$$animate.addClass(this.$$element,"ng-not-empty"))},$setPristine:function(){this.$dirty=!1;this.$pristine=!0;this.$$animate.removeClass(this.$$element,Wb);this.$$animate.addClass(this.$$element,Za)},$setDirty:function(){this.$dirty=!0;this.$pristine=!1;this.$$animate.removeClass(this.$$element,
1098Za);this.$$animate.addClass(this.$$element,Wb);this.$$parentForm.$setDirty()},$setUntouched:function(){this.$touched=!1;this.$untouched=!0;this.$$animate.setClass(this.$$element,"ng-untouched","ng-touched")},$setTouched:function(){this.$touched=!0;this.$untouched=!1;this.$$animate.setClass(this.$$element,"ng-touched","ng-untouched")},$rollbackViewValue:function(){this.$$timeout.cancel(this.$$pendingDebounce);this.$viewValue=this.$$lastCommittedViewValue;this.$render()},$validate:function(){if(!Y(this.$modelValue)){var a=
1099this.$$lastCommittedViewValue,b=this.$$rawModelValue,d=this.$valid,c=this.$modelValue,e=this.$options.getOption("allowInvalid"),f=this;this.$$runValidators(b,a,function(a){e||d===a||(f.$modelValue=a?b:void 0,f.$modelValue!==c&&f.$$writeModelToScope())})}},$$runValidators:function(a,b,d){function c(){var c=!0;r(h.$validators,function(d,e){var g=Boolean(d(a,b));c=c&&g;f(e,g)});return c?!0:(r(h.$asyncValidators,function(a,b){f(b,null)}),!1)}function e(){var c=[],d=!0;r(h.$asyncValidators,function(e,
1100g){var h=e(a,b);if(!h||!B(h.then))throw pb("nopromise",h);f(g,void 0);c.push(h.then(function(){f(g,!0)},function(){d=!1;f(g,!1)}))});c.length?h.$$q.all(c).then(function(){g(d)},E):g(!0)}function f(a,b){k===h.$$currentValidationRunId&&h.$setValidity(a,b)}function g(a){k===h.$$currentValidationRunId&&d(a)}this.$$currentValidationRunId++;var k=this.$$currentValidationRunId,h=this;(function(){var a=h.$$parserName;if(A(h.$$parserValid))f(a,null);else return h.$$parserValid||(r(h.$validators,function(a,
1101b){f(b,null)}),r(h.$asyncValidators,function(a,b){f(b,null)})),f(a,h.$$parserValid),h.$$parserValid;return!0})()?c()?e():g(!1):g(!1)},$commitViewValue:function(){var a=this.$viewValue;this.$$timeout.cancel(this.$$pendingDebounce);if(this.$$lastCommittedViewValue!==a||""===a&&this.$$hasNativeValidators)this.$$updateEmptyClasses(a),this.$$lastCommittedViewValue=a,this.$pristine&&this.$setDirty(),this.$$parseAndValidate()},$$parseAndValidate:function(){var a=this.$$lastCommittedViewValue,b=this;this.$$parserValid=
1102A(a)?void 0:!0;this.$setValidity(this.$$parserName,null);this.$$parserName="parse";if(this.$$parserValid)for(var d=0;d<this.$parsers.length;d++)if(a=this.$parsers[d](a),A(a)){this.$$parserValid=!1;break}Y(this.$modelValue)&&(this.$modelValue=this.$$ngModelGet(this.$$scope));var c=this.$modelValue,e=this.$options.getOption("allowInvalid");this.$$rawModelValue=a;e&&(this.$modelValue=a,b.$modelValue!==c&&b.$$writeModelToScope());this.$$runValidators(a,this.$$lastCommittedViewValue,function(d){e||(b.$modelValue=
1103d?a:void 0,b.$modelValue!==c&&b.$$writeModelToScope())})},$$writeModelToScope:function(){this.$$ngModelSet(this.$$scope,this.$modelValue);r(this.$viewChangeListeners,function(a){try{a()}catch(b){this.$$exceptionHandler(b)}},this)},$setViewValue:function(a,b){this.$viewValue=a;this.$options.getOption("updateOnDefault")&&this.$$debounceViewValueCommit(b)},$$debounceViewValueCommit:function(a){var b=this.$options.getOption("debounce");X(b[a])?b=b[a]:X(b["default"])&&-1===this.$options.getOption("updateOn").indexOf(a)?
1104b=b["default"]:X(b["*"])&&(b=b["*"]);this.$$timeout.cancel(this.$$pendingDebounce);var d=this;0<b?this.$$pendingDebounce=this.$$timeout(function(){d.$commitViewValue()},b):this.$$rootScope.$$phase?this.$commitViewValue():this.$$scope.$apply(function(){d.$commitViewValue()})},$overrideModelOptions:function(a){this.$options=this.$options.createChild(a);this.$$setUpdateOnEvents()},$processModelValue:function(){var a=this.$$format();this.$viewValue!==a&&(this.$$updateEmptyClasses(a),this.$viewValue=this.$$lastCommittedViewValue=
1105a,this.$render(),this.$$runValidators(this.$modelValue,this.$viewValue,E))},$$format:function(){for(var a=this.$formatters,b=a.length,d=this.$modelValue;b--;)d=a[b](d);return d},$$setModelValue:function(a){this.$modelValue=this.$$rawModelValue=a;this.$$parserValid=void 0;this.$processModelValue()},$$setUpdateOnEvents:function(){this.$$updateEvents&&this.$$element.off(this.$$updateEvents,this.$$updateEventHandler);if(this.$$updateEvents=this.$options.getOption("updateOn"))this.$$element.on(this.$$updateEvents,
1106this.$$updateEventHandler)},$$updateEventHandler:function(a){this.$$debounceViewValueCommit(a&&a.type)}};ce({clazz:Sb,set:function(a,b){a[b]=!0},unset:function(a,b){delete a[b]}});var uf=["$rootScope",function(a){return{restrict:"A",require:["ngModel","^?form","^?ngModelOptions"],controller:Sb,priority:1,compile:function(b){b.addClass(Za).addClass("ng-untouched").addClass(nb);return{pre:function(a,b,e,f){var g=f[0];b=f[1]||g.$$parentForm;if(f=f[2])g.$options=f.$options;g.$$initGetterSetters();b.$addControl(g);
1107e.$observe("name",function(a){g.$name!==a&&g.$$parentForm.$$renameControl(g,a)});a.$on("$destroy",function(){g.$$parentForm.$removeControl(g)})},post:function(b,c,e,f){function g(){k.$setTouched()}var k=f[0];k.$$setUpdateOnEvents();c.on("blur",function(){k.$touched||(a.$$phase?b.$evalAsync(g):b.$apply(g))})}}}}}],Tb,Bh=/(\s+|^)default(\s+|$)/;Mc.prototype={getOption:function(a){return this.$$options[a]},createChild:function(a){var b=!1;a=S({},a);r(a,function(d,c){"$inherit"===d?"*"===c?b=!0:(a[c]=
1108this.$$options[c],"updateOn"===c&&(a.updateOnDefault=this.$$options.updateOnDefault)):"updateOn"===c&&(a.updateOnDefault=!1,a[c]=V(d.replace(Bh,function(){a.updateOnDefault=!0;return" "})))},this);b&&(delete a["*"],ie(a,this.$$options));ie(a,Tb.$$options);return new Mc(a)}};Tb=new Mc({updateOn:"",updateOnDefault:!0,debounce:0,getterSetter:!1,allowInvalid:!1,timezone:null});var yf=function(){function a(a,d){this.$$attrs=a;this.$$scope=d}a.$inject=["$attrs","$scope"];a.prototype={$onInit:function(){var a=
1109this.parentCtrl?this.parentCtrl.$options:Tb,d=this.$$scope.$eval(this.$$attrs.ngModelOptions);this.$options=a.createChild(d)}};return{restrict:"A",priority:10,require:{parentCtrl:"?^^ngModelOptions"},bindToController:!0,controller:a}},jf=Ra({terminal:!0,priority:1E3}),Ch=F("ngOptions"),Dh=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([$\w][$\w]*)|(?:\(\s*([$\w][$\w]*)\s*,\s*([$\w][$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,
1110sf=["$compile","$document","$parse",function(a,b,d){function c(a,b,c){function e(a,b,c,d,f){this.selectValue=a;this.viewValue=b;this.label=c;this.group=d;this.disabled=f}function f(a){var b;if(!r&&za(a))b=a;else{b=[];for(var c in a)a.hasOwnProperty(c)&&"$"!==c.charAt(0)&&b.push(c)}return b}var p=a.match(Dh);if(!p)throw Ch("iexp",a,Aa(b));var n=p[5]||p[7],r=p[6];a=/ as /.test(p[0])&&p[1];var q=p[9];b=d(p[2]?p[1]:n);var t=a&&d(a)||b,w=q&&d(q),v=q?function(a,b){return w(c,b)}:function(a){return La(a)},
1111x=function(a,b){return v(a,B(a,b))},A=d(p[2]||p[1]),y=d(p[3]||""),J=d(p[4]||""),I=d(p[8]),z={},B=r?function(a,b){z[r]=b;z[n]=a;return z}:function(a){z[n]=a;return z};return{trackBy:q,getTrackByValue:x,getWatchables:d(I,function(a){var b=[];a=a||[];for(var d=f(a),e=d.length,g=0;g<e;g++){var k=a===d?g:d[g],l=a[k],k=B(l,k),l=v(l,k);b.push(l);if(p[2]||p[1])l=A(c,k),b.push(l);p[4]&&(k=J(c,k),b.push(k))}return b}),getOptions:function(){for(var a=[],b={},d=I(c)||[],g=f(d),k=g.length,n=0;n<k;n++){var p=d===
1112g?n:g[n],r=B(d[p],p),s=t(c,r),p=v(s,r),w=A(c,r),z=y(c,r),r=J(c,r),s=new e(p,s,w,z,r);a.push(s);b[p]=s}return{items:a,selectValueMap:b,getOptionFromViewValue:function(a){return b[x(a)]},getViewValueFromOption:function(a){return q?Ia(a.viewValue):a.viewValue}}}}}var e=z.document.createElement("option"),f=z.document.createElement("optgroup");return{restrict:"A",terminal:!0,require:["select","ngModel"],link:{pre:function(a,b,c,d){d[0].registerOption=E},post:function(d,k,h,l){function m(a){var b=(a=v.getOptionFromViewValue(a))&&
1113a.element;b&&!b.selected&&(b.selected=!0);return a}function p(a,b){a.element=b;b.disabled=a.disabled;a.label!==b.label&&(b.label=a.label,b.textContent=a.label);b.value=a.selectValue}var n=l[0],q=l[1],A=h.multiple;l=0;for(var t=k.children(),z=t.length;l<z;l++)if(""===t[l].value){n.hasEmptyOption=!0;n.emptyOption=t.eq(l);break}k.empty();l=!!n.emptyOption;x(e.cloneNode(!1)).val("?");var v,B=c(h.ngOptions,k,d),C=b[0].createDocumentFragment();n.generateUnknownOptionValue=function(a){return"?"};A?(n.writeValue=
1114function(a){if(v){var b=a&&a.map(m)||[];v.items.forEach(function(a){a.element.selected&&-1===Array.prototype.indexOf.call(b,a)&&(a.element.selected=!1)})}},n.readValue=function(){var a=k.val()||[],b=[];r(a,function(a){(a=v.selectValueMap[a])&&!a.disabled&&b.push(v.getViewValueFromOption(a))});return b},B.trackBy&&d.$watchCollection(function(){if(H(q.$viewValue))return q.$viewValue.map(function(a){return B.getTrackByValue(a)})},function(){q.$render()})):(n.writeValue=function(a){if(v){var b=k[0].options[k[0].selectedIndex],
1115c=v.getOptionFromViewValue(a);b&&b.removeAttribute("selected");c?(k[0].value!==c.selectValue&&(n.removeUnknownOption(),k[0].value=c.selectValue,c.element.selected=!0),c.element.setAttribute("selected","selected")):n.selectUnknownOrEmptyOption(a)}},n.readValue=function(){var a=v.selectValueMap[k.val()];return a&&!a.disabled?(n.unselectEmptyOption(),n.removeUnknownOption(),v.getViewValueFromOption(a)):null},B.trackBy&&d.$watch(function(){return B.getTrackByValue(q.$viewValue)},function(){q.$render()}));
1116l&&(a(n.emptyOption)(d),k.prepend(n.emptyOption),8===n.emptyOption[0].nodeType?(n.hasEmptyOption=!1,n.registerOption=function(a,b){""===b.val()&&(n.hasEmptyOption=!0,n.emptyOption=b,n.emptyOption.removeClass("ng-scope"),q.$render(),b.on("$destroy",function(){var a=n.$isEmptyOptionSelected();n.hasEmptyOption=!1;n.emptyOption=void 0;a&&q.$render()}))}):n.emptyOption.removeClass("ng-scope"));d.$watchCollection(B.getWatchables,function(){var a=v&&n.readValue();if(v)for(var b=v.items.length-1;0<=b;b--){var c=
1117v.items[b];w(c.group)?Gb(c.element.parentNode):Gb(c.element)}v=B.getOptions();var d={};v.items.forEach(function(a){var b;if(w(a.group)){b=d[a.group];b||(b=f.cloneNode(!1),C.appendChild(b),b.label=null===a.group?"null":a.group,d[a.group]=b);var c=e.cloneNode(!1);b.appendChild(c);p(a,c)}else b=e.cloneNode(!1),C.appendChild(b),p(a,b)});k[0].appendChild(C);q.$render();q.$isEmpty(a)||(b=n.readValue(),(B.trackBy||A?va(a,b):a===b)||(q.$setViewValue(b),q.$render()))})}}}}],kf=["$locale","$interpolate","$log",
1118function(a,b,d){var c=/{}/g,e=/^when(Minus)?(.+)$/;return{link:function(f,g,k){function h(a){g.text(a||"")}var l=k.count,m=k.$attr.when&&g.attr(k.$attr.when),p=k.offset||0,n=f.$eval(m)||{},q={},w=b.startSymbol(),t=b.endSymbol(),x=w+l+"-"+p+t,v=ca.noop,z;r(k,function(a,b){var c=e.exec(b);c&&(c=(c[1]?"-":"")+K(c[2]),n[c]=g.attr(k.$attr[b]))});r(n,function(a,d){q[d]=b(a.replace(c,x))});f.$watch(l,function(b){var c=parseFloat(b),e=Y(c);e||c in n||(c=a.pluralCat(c-p));c===z||e&&Y(z)||(v(),e=q[c],A(e)?
1119(null!=b&&d.debug("ngPluralize: no rule defined for '"+c+"' in "+m),v=E,h()):v=f.$watch(e,h),z=c)})}}}],ue=F("ngRef"),lf=["$parse",function(a){return{priority:-1,restrict:"A",compile:function(b,d){var c=xa(ua(b)),e=a(d.ngRef),f=e.assign||function(){throw ue("nonassign",d.ngRef);};return function(a,b,h){var l;if(h.hasOwnProperty("ngRefRead"))if("$element"===h.ngRefRead)l=b;else{if(l=b.data("$"+h.ngRefRead+"Controller"),!l)throw ue("noctrl",h.ngRefRead,d.ngRef);}else l=b.data("$"+c+"Controller");l=
1120l||b;f(a,l);b.on("$destroy",function(){e(a)===l&&f(a,null)})}}}}],mf=["$parse","$animate","$compile",function(a,b,d){var c=F("ngRepeat"),e=function(a,b,c,d,e,f,g){a[c]=d;e&&(a[e]=f);a.$index=b;a.$first=0===b;a.$last=b===g-1;a.$middle=!(a.$first||a.$last);a.$odd=!(a.$even=0===(b&1))},f=function(a,b,c){return La(c)},g=function(a,b){return b};return{restrict:"A",multiElement:!0,transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,compile:function(k,h){var l=h.ngRepeat,m=d.$$createComment("end ngRepeat",
1121l),p=l.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!p)throw c("iexp",l);var n=p[1],q=p[2],w=p[3],t=p[4],p=n.match(/^(?:(\s*[$\w]+)|\(\s*([$\w]+)\s*,\s*([$\w]+)\s*\))$/);if(!p)throw c("iidexp",n);var x=p[3]||p[1],v=p[2];if(w&&(!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(w)||/^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(w)))throw c("badident",w);var A;if(t){var z={$id:La},y=a(t);A=function(a,b,c,d){v&&
1122(z[v]=b);z[x]=c;z.$index=d;return y(a,z)}}return function(a,d,h,k,n){var p=T();a.$watchCollection(q,function(h){var k,q,t=d[0],s,y=T(),B,C,E,D,H,F,K;w&&(a[w]=h);if(za(h))H=h,q=A||f;else for(K in q=A||g,H=[],h)ta.call(h,K)&&"$"!==K.charAt(0)&&H.push(K);B=H.length;K=Array(B);for(k=0;k<B;k++)if(C=h===H?k:H[k],E=h[C],D=q(a,C,E,k),p[D])F=p[D],delete p[D],y[D]=F,K[k]=F;else{if(y[D])throw r(K,function(a){a&&a.scope&&(p[a.id]=a)}),c("dupes",l,D,E);K[k]={id:D,scope:void 0,clone:void 0};y[D]=!0}z&&(z[x]=void 0);
1123for(s in p){F=p[s];D=ub(F.clone);b.leave(D);if(D[0].parentNode)for(k=0,q=D.length;k<q;k++)D[k].$$NG_REMOVED=!0;F.scope.$destroy()}for(k=0;k<B;k++)if(C=h===H?k:H[k],E=h[C],F=K[k],F.scope){s=t;do s=s.nextSibling;while(s&&s.$$NG_REMOVED);F.clone[0]!==s&&b.move(ub(F.clone),null,t);t=F.clone[F.clone.length-1];e(F.scope,k,x,E,v,C,B)}else n(function(a,c){F.scope=c;var d=m.cloneNode(!1);a[a.length++]=d;b.enter(a,null,t);t=d;F.clone=a;y[F.id]=F;e(F.scope,k,x,E,v,C,B)});p=y})}}}}],nf=["$animate",function(a){return{restrict:"A",
1124multiElement:!0,link:function(b,d,c){b.$watch(c.ngShow,function(b){a[b?"removeClass":"addClass"](d,"ng-hide",{tempClasses:"ng-hide-animate"})})}}}],ef=["$animate",function(a){return{restrict:"A",multiElement:!0,link:function(b,d,c){b.$watch(c.ngHide,function(b){a[b?"addClass":"removeClass"](d,"ng-hide",{tempClasses:"ng-hide-animate"})})}}}],of=Ra(function(a,b,d){a.$watchCollection(d.ngStyle,function(a,d){d&&a!==d&&r(d,function(a,c){b.css(c,"")});a&&b.css(a)})}),pf=["$animate","$compile",function(a,
1125b){return{require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(d,c,e,f){var g=[],k=[],h=[],l=[],m=function(a,b){return function(c){!1!==c&&a.splice(b,1)}};d.$watch(e.ngSwitch||e.on,function(c){for(var d,e;h.length;)a.cancel(h.pop());d=0;for(e=l.length;d<e;++d){var q=ub(k[d].clone);l[d].$destroy();(h[d]=a.leave(q)).done(m(h,d))}k.length=0;l.length=0;(g=f.cases["!"+c]||f.cases["?"])&&r(g,function(c){c.transclude(function(d,e){l.push(e);var f=c.element;d[d.length++]=b.$$createComment("end ngSwitchWhen");
1126k.push({clone:d});a.enter(d,f.parent(),f)})})})}}}],qf=Ra({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(a,b,d,c,e){a=d.ngSwitchWhen.split(d.ngSwitchWhenSeparator).sort().filter(function(a,b,c){return c[b-1]!==a});r(a,function(a){c.cases["!"+a]=c.cases["!"+a]||[];c.cases["!"+a].push({transclude:e,element:b})})}}),rf=Ra({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(a,b,d,c,e){c.cases["?"]=c.cases["?"]||[];c.cases["?"].push({transclude:e,
1127element:b})}}),Eh=F("ngTransclude"),tf=["$compile",function(a){return{restrict:"EAC",compile:function(b){var d=a(b.contents());b.empty();return function(a,b,f,g,k){function h(){d(a,function(a){b.append(a)})}if(!k)throw Eh("orphan",Aa(b));f.ngTransclude===f.$attr.ngTransclude&&(f.ngTransclude="");f=f.ngTransclude||f.ngTranscludeSlot;k(function(a,c){var d;if(d=a.length)a:{d=0;for(var f=a.length;d<f;d++){var g=a[d];if(g.nodeType!==Pa||g.nodeValue.trim()){d=!0;break a}}d=void 0}d?b.append(a):(h(),c.$destroy())},
1128null,f);f&&!k.isSlotFilled(f)&&h()}}}}],Te=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(b,d){"text/ng-template"===d.type&&a.put(d.id,b[0].text)}}}],Fh={$setViewValue:E,$render:E},Gh=["$element","$scope",function(a,b){function d(){g||(g=!0,b.$$postDigest(function(){g=!1;e.ngModelCtrl.$render()}))}function c(a){k||(k=!0,b.$$postDigest(function(){b.$$destroyed||(k=!1,e.ngModelCtrl.$setViewValue(e.readValue()),a&&e.ngModelCtrl.$render())}))}var e=this,f=new Ib;e.selectValueMap=
1129{};e.ngModelCtrl=Fh;e.multiple=!1;e.unknownOption=x(z.document.createElement("option"));e.hasEmptyOption=!1;e.emptyOption=void 0;e.renderUnknownOption=function(b){b=e.generateUnknownOptionValue(b);e.unknownOption.val(b);a.prepend(e.unknownOption);Oa(e.unknownOption,!0);a.val(b)};e.updateUnknownOption=function(b){b=e.generateUnknownOptionValue(b);e.unknownOption.val(b);Oa(e.unknownOption,!0);a.val(b)};e.generateUnknownOptionValue=function(a){return"? "+La(a)+" ?"};e.removeUnknownOption=function(){e.unknownOption.parent()&&
1130e.unknownOption.remove()};e.selectEmptyOption=function(){e.emptyOption&&(a.val(""),Oa(e.emptyOption,!0))};e.unselectEmptyOption=function(){e.hasEmptyOption&&Oa(e.emptyOption,!1)};b.$on("$destroy",function(){e.renderUnknownOption=E});e.readValue=function(){var b=a.val(),b=b in e.selectValueMap?e.selectValueMap[b]:b;return e.hasOption(b)?b:null};e.writeValue=function(b){var c=a[0].options[a[0].selectedIndex];c&&Oa(x(c),!1);e.hasOption(b)?(e.removeUnknownOption(),c=La(b),a.val(c in e.selectValueMap?
1131c:b),Oa(x(a[0].options[a[0].selectedIndex]),!0)):e.selectUnknownOrEmptyOption(b)};e.addOption=function(a,b){if(8!==b[0].nodeType){Ja(a,'"option value"');""===a&&(e.hasEmptyOption=!0,e.emptyOption=b);var c=f.get(a)||0;f.set(a,c+1);d()}};e.removeOption=function(a){var b=f.get(a);b&&(1===b?(f.delete(a),""===a&&(e.hasEmptyOption=!1,e.emptyOption=void 0)):f.set(a,b-1))};e.hasOption=function(a){return!!f.get(a)};e.$hasEmptyOption=function(){return e.hasEmptyOption};e.$isUnknownOptionSelected=function(){return a[0].options[0]===
1132e.unknownOption[0]};e.$isEmptyOptionSelected=function(){return e.hasEmptyOption&&a[0].options[a[0].selectedIndex]===e.emptyOption[0]};e.selectUnknownOrEmptyOption=function(a){null==a&&e.emptyOption?(e.removeUnknownOption(),e.selectEmptyOption()):e.unknownOption.parent().length?e.updateUnknownOption(a):e.renderUnknownOption(a)};var g=!1,k=!1;e.registerOption=function(a,b,f,g,k){if(f.$attr.ngValue){var q,r;f.$observe("value",function(a){var d,f=b.prop("selected");w(r)&&(e.removeOption(q),delete e.selectValueMap[r],
1133d=!0);r=La(a);q=a;e.selectValueMap[r]=a;e.addOption(a,b);b.attr("value",r);d&&f&&c()})}else g?f.$observe("value",function(a){e.readValue();var d,f=b.prop("selected");w(q)&&(e.removeOption(q),d=!0);q=a;e.addOption(a,b);d&&f&&c()}):k?a.$watch(k,function(a,d){f.$set("value",a);var g=b.prop("selected");d!==a&&e.removeOption(d);e.addOption(a,b);d&&g&&c()}):e.addOption(f.value,b);f.$observe("disabled",function(a){if("true"===a||a&&b.prop("selected"))e.multiple?c(!0):(e.ngModelCtrl.$setViewValue(null),e.ngModelCtrl.$render())});
1134b.on("$destroy",function(){var a=e.readValue(),b=f.value;e.removeOption(b);d();(e.multiple&&a&&-1!==a.indexOf(b)||a===b)&&c(!0)})}}],Ue=function(){return{restrict:"E",require:["select","?ngModel"],controller:Gh,priority:1,link:{pre:function(a,b,d,c){var e=c[0],f=c[1];if(f){if(e.ngModelCtrl=f,b.on("change",function(){e.removeUnknownOption();a.$apply(function(){f.$setViewValue(e.readValue())})}),d.multiple){e.multiple=!0;e.readValue=function(){var a=[];r(b.find("option"),function(b){b.selected&&!b.disabled&&
1135(b=b.value,a.push(b in e.selectValueMap?e.selectValueMap[b]:b))});return a};e.writeValue=function(a){r(b.find("option"),function(b){var c=!!a&&(-1!==Array.prototype.indexOf.call(a,b.value)||-1!==Array.prototype.indexOf.call(a,e.selectValueMap[b.value]));c!==b.selected&&Oa(x(b),c)})};var g,k=NaN;a.$watch(function(){k!==f.$viewValue||va(g,f.$viewValue)||(g=ja(f.$viewValue),f.$render());k=f.$viewValue});f.$isEmpty=function(a){return!a||0===a.length}}}else e.registerOption=E},post:function(a,b,d,c){var e=
1136c[1];if(e){var f=c[0];e.$render=function(){f.writeValue(e.$viewValue)}}}}}},Ve=["$interpolate",function(a){return{restrict:"E",priority:100,compile:function(b,d){var c,e;w(d.ngValue)||(w(d.value)?c=a(d.value,!0):(e=a(b.text(),!0))||d.$set("value",b.text()));return function(a,b,d){var h=b.parent();(h=h.data("$selectController")||h.parent().data("$selectController"))&&h.registerOption(a,b,d,c,e)}}}}],bd=["$parse",function(a){return{restrict:"A",require:"?ngModel",link:function(b,d,c,e){if(e){var f=
1137c.hasOwnProperty("required")||a(c.ngRequired)(b);c.ngRequired||(c.required=!0);e.$validators.required=function(a,b){return!f||!e.$isEmpty(b)};c.$observe("required",function(a){f!==a&&(f=a,e.$validate())})}}}}],ad=["$parse",function(a){return{restrict:"A",require:"?ngModel",compile:function(b,d){var c,e;d.ngPattern&&(c=d.ngPattern,e="/"===d.ngPattern.charAt(0)&&ke.test(d.ngPattern)?function(){return d.ngPattern}:a(d.ngPattern));return function(a,b,d,h){if(h){var l=d.pattern;d.ngPattern?l=e(a):c=d.pattern;
1138var m=je(l,c,b);d.$observe("pattern",function(a){var d=m;m=je(a,c,b);(d&&d.toString())!==(m&&m.toString())&&h.$validate()});h.$validators.pattern=function(a,b){return h.$isEmpty(b)||A(m)||m.test(b)}}}}}}],dd=["$parse",function(a){return{restrict:"A",require:"?ngModel",link:function(b,d,c,e){if(e){var f=c.maxlength||a(c.ngMaxlength)(b),g=Ub(f);c.$observe("maxlength",function(a){f!==a&&(g=Ub(a),f=a,e.$validate())});e.$validators.maxlength=function(a,b){return 0>g||e.$isEmpty(b)||b.length<=g}}}}}],cd=
1139["$parse",function(a){return{restrict:"A",require:"?ngModel",link:function(b,d,c,e){if(e){var f=c.minlength||a(c.ngMinlength)(b),g=Ub(f)||-1;c.$observe("minlength",function(a){f!==a&&(g=Ub(a)||-1,f=a,e.$validate())});e.$validators.minlength=function(a,b){return e.$isEmpty(b)||b.length>=g}}}}}];z.angular.bootstrap?z.console&&console.log("WARNING: Tried to load AngularJS more than once."):(Je(),Oe(ca),ca.module("ngLocale",[],["$provide",function(a){function b(a){a+="";var b=a.indexOf(".");return-1==
1140b?0:a.length-b-1}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:"January February March April May June July August September October November December".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),STANDALONEMONTH:"January February March April May June July August September October November December".split(" "),
1141WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(a,
1142c){var e=a|0,f=c;void 0===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?"one":"other"}})}]),x(function(){Ee(z.document,Wc)}))})(window);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(window.angular.element("<style>").text('@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}'));
1143//# sourceMappingURL=angular.min.js.map
1144;
1145angular.uppercase = function (text) {
1146    return (text || '').toUpperCase();
1147}
1148angular.lowercase = function (text) {
1149    return (text || '').toLowerCase();
1150};
1151/*
1152 AngularJS v1.8.2
1153 (c) 2010-2020 Google LLC. http://angularjs.org
1154 License: MIT
1155*/
1156(function(I,b){'use strict';function z(b,h){var d=[],c=b.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)(\*\?|[?*])?/g,function(b,c,h,k){b="?"===k||"*?"===k;k="*"===k||"*?"===k;d.push({name:h,optional:b});c=c||"";return(b?"(?:"+c:c+"(?:")+(k?"(.+?)":"([^/]+)")+(b?"?)?":")")}).replace(/([/$*])/g,"\\$1");h.ignoreTrailingSlashes&&(c=c.replace(/\/+$/,"")+"/*");return{keys:d,regexp:new RegExp("^"+c+"(?:[?#]|$)",h.caseInsensitiveMatch?"i":"")}}function A(b){p&&b.get("$route")}function v(u,h,d){return{restrict:"ECA",
1157terminal:!0,priority:400,transclude:"element",link:function(c,f,g,l,k){function q(){r&&(d.c
vendor: 4,428 bytes, lines 1157-1165
1157ancel(r),r=null);m&&(m.$destroy(),m=null);s&&(r=d.leave(s),r.done(function(b){!1!==b&&(r=null)}),s=null)}function C(){var g=u.current&&u.current.locals;if(b.isDefined(g&&g.$template)){var g=c.$new(),l=u.current;s=k(g,function(g){d.enter(g,null,s||f).done(function(d){!1===d||!b.isDefined(w)||w&&!c.$eval(w)||h()});q()});m=l.scope=g;m.$emit("$viewContentLoaded");m.$eval(p)}else q()}var m,s,r,w=g.autoscroll,p=g.onload||
1158"";c.$on("$routeChangeSuccess",C);C()}}}function x(b,h,d){return{restrict:"ECA",priority:-400,link:function(c,f){var g=d.current,l=g.locals;f.html(l.$template);var k=b(f.contents());if(g.controller){l.$scope=c;var q=h(g.controller,l);g.controllerAs&&(c[g.controllerAs]=q);f.data("$ngControllerController",q);f.children().data("$ngControllerController",q)}c[g.resolveAs||"$resolve"]=l;k(c)}}}var D,E,F,G,y=b.module("ngRoute",[]).info({angularVersion:"1.8.2"}).provider("$route",function(){function u(d,
1159c){return b.extend(Object.create(d),c)}D=b.isArray;E=b.isObject;F=b.isDefined;G=b.noop;var h={};this.when=function(d,c){var f;f=void 0;if(D(c)){f=f||[];for(var g=0,l=c.length;g<l;g++)f[g]=c[g]}else if(E(c))for(g in f=f||{},c)if("$"!==g.charAt(0)||"$"!==g.charAt(1))f[g]=c[g];f=f||c;b.isUndefined(f.reloadOnUrl)&&(f.reloadOnUrl=!0);b.isUndefined(f.reloadOnSearch)&&(f.reloadOnSearch=!0);b.isUndefined(f.caseInsensitiveMatch)&&(f.caseInsensitiveMatch=this.caseInsensitiveMatch);h[d]=b.extend(f,{originalPath:d},
1160d&&z(d,f));d&&(g="/"===d[d.length-1]?d.substr(0,d.length-1):d+"/",h[g]=b.extend({originalPath:d,redirectTo:d},z(g,f)));return this};this.caseInsensitiveMatch=!1;this.otherwise=function(b){"string"===typeof b&&(b={redirectTo:b});this.when(null,b);return this};p=!0;this.eagerInstantiationEnabled=function(b){return F(b)?(p=b,this):p};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce","$browser",function(d,c,f,g,l,k,q,p){function m(a){var e=t.current;n=A();(x=
1161!B&&n&&e&&n.$$route===e.$$route&&(!n.reloadOnUrl||!n.reloadOnSearch&&b.equals(n.pathParams,e.pathParams)))||!e&&!n||d.$broadcast("$routeChangeStart",n,e).defaultPrevented&&a&&a.preventDefault()}function s(){var a=t.current,e=n;if(x)a.params=e.params,b.copy(a.params,f),d.$broadcast("$routeUpdate",a);else if(e||a){B=!1;t.current=e;var c=g.resolve(e);p.$$incOutstandingRequestCount("$route");c.then(r).then(w).then(function(g){return g&&c.then(y).then(function(c){e===t.current&&(e&&(e.locals=c,b.copy(e.params,
1162f)),d.$broadcast("$routeChangeSuccess",e,a))})}).catch(function(b){e===t.current&&d.$broadcast("$routeChangeError",e,a,b)}).finally(function(){p.$$completeOutstandingRequest(G,"$route")})}}function r(a){var e={route:a,hasRedirection:!1};if(a)if(a.redirectTo)if(b.isString(a.redirectTo))e.path=v(a.redirectTo,a.params),e.search=a.params,e.hasRedirection=!0;else{var d=c.path(),f=c.search();a=a.redirectTo(a.pathParams,d,f);b.isDefined(a)&&(e.url=a,e.hasRedirection=!0)}else if(a.resolveRedirectTo)return g.resolve(l.invoke(a.resolveRedirectTo)).then(function(a){b.isDefined(a)&&
1163(e.url=a,e.hasRedirection=!0);return e});return e}function w(a){var b=!0;if(a.route!==t.current)b=!1;else if(a.hasRedirection){var g=c.url(),d=a.url;d?c.url(d).replace():d=c.path(a.path).search(a.search).replace().url();d!==g&&(b=!1)}return b}function y(a){if(a){var e=b.extend({},a.resolve);b.forEach(e,function(a,c){e[c]=b.isString(a)?l.get(a):l.invoke(a,null,null,c)});a=z(a);b.isDefined(a)&&(e.$template=a);return g.all(e)}}function z(a){var e,c;b.isDefined(e=a.template)?b.isFunction(e)&&(e=e(a.params)):
1164b.isDefined(c=a.templateUrl)&&(b.isFunction(c)&&(c=c(a.params)),b.isDefined(c)&&(a.loadedTemplateUrl=q.valueOf(c),e=k(c)));return e}function A(){var a,e;b.forEach(h,function(d,g){var f;if(f=!e){var h=c.path();f=d.keys;var l={};if(d.regexp)if(h=d.regexp.exec(h)){for(var k=1,p=h.length;k<p;++k){var m=f[k-1],n=h[k];m&&n&&(l[m.name]=n)}f=l}else f=null;else f=null;f=a=f}f&&(e=u(d,{params:b.extend({},c.search(),a),pathParams:a}),e.$$route=d)});return e||h[null]&&u(h[null],{params:{},pathParams:{}})}function v(a,
1165c){var d=[];b.forEach((a||"").split(":"),function(a,b){if(0===b)d.push(a);else{var f=a.match(/(\w+)(?:[?*])?(.*)/),g=f[1];d.push(c[g]);d.push(f[2]||"");delete c[g]}});return d.join("")}var B=!1,n,x,t={routes:h,reload:function(){B=!0;var a={defaultPrevented:!1,preventDefault:function(){this.defaultPrevented=!0;B=!1}};d.$evalAsync(function(){m(a);a.defaultPrevented||s()})}
1165,updateParams:function(a){if(this.current&&this.current.$$route)a=b.extend({},this.current.params,a),c.path(v(this.current.$$route.originalPath,
1166a)),c.search(a);else throw H("norout");}};d.$on("$locationChangeStart",m);d.$on("$locationChangeSuccess",s);return t}]}).run(A),H=b.$$minErr("ngRoute"),p;A.$inject=["$injector"];y.provider("$routeParams",function(){this.$get=function(){return{}}});y.directive("ngView",v);y.directive("ngView",x);v.$inject=["$route","$anchorScroll","$animate"];x.$inject=["$compile","$controller","$route"]})(window,window.angular);
1167//# sourceMappingURL=angular-route.min.js.map
1168;
1169/*
1170 AngularJS v1.8.2
1171 (c) 2010-2020 Google LLC. http://angularjs.org
1172 License: MIT
1173*/
1174(function(n,e){'use strict';function m(d,k,l){var a=l.baseHref(),h=d[0];return function(f,b,c){var d,g;c=c||{};g=c.expires;d=e.isDefined(c.path)?c.path:a;e.isUndefined(b)&&(g="Thu, 01 Jan 1970 00:00:00 GMT",b="");e.isString(g)&&(g=new Date(g));b=encodeURIComponent(f)+"="+encodeURIComponent(b);b=b+(d?";path="+d:"")+(c.domain?";domain="+c.domain:"");b+=g?";expires="+g.toUTCString():"";b+=c.secure?";secure":"";b+=c.samesite?";samesite="+c.samesite:"";c=b.length+1;4096<c&&k.warn("Cookie '"+f+"' possibly not set or overflowed because it was too large ("+
1175c+" > 4096 bytes)!");h.cookie=b}}e.module("ngCookies",["ng"]).info({angularVersion:"1.8.2"}).provider("$cookies",[function(){var d=this.defaults={};this.$get=["$$cookieReader","$$cookieWriter",function(k,l){return{get:function(a){return k()[a]},getObject:function(a){return(a=this.get(a))?e.fromJson(a):a},getAll:function(){return k()},put:function(a,h,f){l(a,h,f?e.extend({},d,f):d)},putObject:function(a,d,f){this.put(a,e.toJson(d),f)},remove:function(a,h){l(a,void 0,h?e.extend({},d,h):d)}}}]}]);m.$inject=
1176["$document","$log","$browser"];e.module("ngCookies").provider("$$cookieWriter",function(){this.$get=m})})(window,window.angular);
1177//# sourceMappingURL=angular-cookies.min.js.map
1178;
1179/*
1180 AngularJS v1.8.2
1181 (c) 2010-2020 Google LLC. http://angularjs.org
1182 License: MIT
1183*/
1184(function(Y,z){'use strict';function Fa(a,b,c){if(!a)throw Pa("areq",b||"?",c||"required");return a}function Ga(a,b){if(!a&&!b)return"";if(!a)return b;if(!b)return a;Z(a)&&(a=a.join(" "));Z(b)&&(b=b.join(" "));return a+" "+b}function Qa(a){var b={};a&&(a.to||a.from)&&(b.to=a.to,b.from=a.from);return b}function $(a,b,c){var d="";a=Z(a)?a:a&&G(a)&&a.length?a.split(/\s+/):[];s(a,function(a,k){a&&0<a.length&&(d+=0<k?" ":"",d+=c?b+a:a+b)});return d}function Ha(a){if(a instanceof A)switch(a.length){case 0:return a;
1185case 1:if(1===a[0].nodeType)return a;break;default:return A(va(a))}if(1===a.nodeType)return A(a)}
vendor: 23,325 bytes, lines 1185-1230
1185function va(a){if(!a[0])return a;for(var b=0;b<a.length;b++){var c=a[b];if(1===c.nodeType)return c}}function Ra(a,b,c){s(b,function(b){a.addClass(b,c)})}function Sa(a,b,c){s(b,function(b){a.removeClass(b,c)})}function aa(a){return function(b,c){c.addClass&&(Ra(a,b,c.addClass),c.addClass=null);c.removeClass&&(Sa(a,b,c.removeClass),c.removeClass=null)}}function pa(a){a=a||{};if(!a.$$prepared){var b=a.domOperation||
1186N;a.domOperation=function(){a.$$domOperationFired=!0;b();b=N};a.$$prepared=!0}return a}function ha(a,b){Ia(a,b);Ja(a,b)}function Ia(a,b){b.from&&(a.css(b.from),b.from=null)}function Ja(a,b){b.to&&(a.css(b.to),b.to=null)}function T(a,b,c){var d=b.options||{};c=c.options||{};var f=(d.addClass||"")+" "+(c.addClass||""),k=(d.removeClass||"")+" "+(c.removeClass||"");a=Ta(a.attr("class"),f,k);c.preparationClasses&&(d.preparationClasses=ba(c.preparationClasses,d.preparationClasses),delete c.preparationClasses);
1187f=d.domOperation!==N?d.domOperation:null;wa(d,c);f&&(d.domOperation=f);d.addClass=a.addClass?a.addClass:null;d.removeClass=a.removeClass?a.removeClass:null;b.addClass=d.addClass;b.removeClass=d.removeClass;return d}function Ta(a,b,c){function d(a){G(a)&&(a=a.split(" "));var c={};s(a,function(a){a.length&&(c[a]=!0)});return c}var f={};a=d(a);b=d(b);s(b,function(a,c){f[c]=1});c=d(c);s(c,function(a,c){f[c]=1===f[c]?null:-1});var k={addClass:"",removeClass:""};s(f,function(c,b){var d,f;1===c?(d="addClass",
1188f=!a[b]||a[b+"-remove"]):-1===c&&(d="removeClass",f=a[b]||a[b+"-add"]);f&&(k[d].length&&(k[d]+=" "),k[d]+=b)});return k}function K(a){return a instanceof A?a[0]:a}function Ua(a,b,c,d){a="";c&&(a=$(c,"ng-",!0));d.addClass&&(a=ba(a,$(d.addClass,"-add")));d.removeClass&&(a=ba(a,$(d.removeClass,"-remove")));a.length&&(d.preparationClasses=a,b.addClass(a))}function xa(a,b){var c=b?"paused":"",d=ca+"PlayState";ma(a,[d,c]);return[d,c]}function ma(a,b){a.style[b[0]]=b[1]}function ba(a,b){return a?b?a+" "+
1189b:a:b}function Ka(a,b,c){var d=Object.create(null),f=a.getComputedStyle(b)||{};s(c,function(a,c){var b=f[a];if(b){var L=b.charAt(0);if("-"===L||"+"===L||0<=L)b=Va(b);0===b&&(b=null);d[c]=b}});return d}function Va(a){var b=0;a=a.split(/\s*,\s*/);s(a,function(a){"s"===a.charAt(a.length-1)&&(a=a.substring(0,a.length-1));a=parseFloat(a)||0;b=b?Math.max(a,b):a});return b}function ya(a){return 0===a||null!=a}function La(a,b){var c=M,d=a+"s";b?c+="Duration":d+=" linear all";return[c,d]}function Ma(a,b,c){s(c,
1190function(c){a[c]=za(a[c])?a[c]:b.style.getPropertyValue(c)})}var M,Aa,ca,Ba;void 0===Y.ontransitionend&&void 0!==Y.onwebkittransitionend?(M="WebkitTransition",Aa="webkitTransitionEnd transitionend"):(M="transition",Aa="transitionend");void 0===Y.onanimationend&&void 0!==Y.onwebkitanimationend?(ca="WebkitAnimation",Ba="webkitAnimationEnd animationend"):(ca="animation",Ba="animationend");var qa=ca+"Delay",Ca=ca+"Duration",na=M+"Delay",Na=M+"Duration",Pa=z.$$minErr("ng"),ra={blockTransitions:function(a,
1191b){var c=b?"-"+b+"s":"";ma(a,[na,c]);return[na,c]}},Wa={transitionDuration:Na,transitionDelay:na,transitionProperty:M+"Property",animationDuration:Ca,animationDelay:qa,animationIterationCount:ca+"IterationCount"},Xa={transitionDuration:Na,transitionDelay:na,animationDuration:Ca,animationDelay:qa},Da,wa,s,Z,za,sa,Ea,ta,G,R,A,N;z.module("ngAnimate",[],function(){N=z.noop;Da=z.copy;wa=z.extend;A=z.element;s=z.forEach;Z=z.isArray;G=z.isString;ta=z.isObject;R=z.isUndefined;za=z.isDefined;Ea=z.isFunction;
1192sa=z.isElement}).info({angularVersion:"1.8.2"}).directive("ngAnimateSwap",["$animate",function(a){return{restrict:"A",transclude:"element",terminal:!0,priority:550,link:function(b,c,d,f,k){var e,Q;b.$watchCollection(d.ngAnimateSwap||d["for"],function(b){e&&a.leave(e);Q&&(Q.$destroy(),Q=null);(b||0===b)&&k(function(b,d){e=b;Q=d;a.enter(b,null,c)})})}}}]).directive("ngAnimateChildren",["$interpolate",function(a){return{link:function(b,c,d){function f(a){c.data("$$ngAnimateChildren","on"===a||"true"===
1193a)}var k=d.ngAnimateChildren;G(k)&&0===k.length?c.data("$$ngAnimateChildren",!0):(f(a(k)(b)),d.$observe("ngAnimateChildren",f))}}}]).factory("$$rAFScheduler",["$$rAF",function(a){function b(a){d=d.concat(a);c()}function c(){if(d.length){for(var b=d.shift(),e=0;e<b.length;e++)b[e]();f||a(function(){f||c()})}}var d,f;d=b.queue=[];b.waitUntilQuiet=function(b){f&&f();f=a(function(){f=null;b();c()})};return b}]).provider("$$animateQueue",["$animateProvider",function(a){function b(a){return{addClass:a.addClass,
1194removeClass:a.removeClass,from:a.from,to:a.to}}function c(a){if(!a)return null;a=a.split(" ");var b=Object.create(null);s(a,function(a){b[a]=!0});return b}function d(a,b){if(a&&b){var d=c(b);return a.split(" ").some(function(a){return d[a]})}}function f(a,b,c){return e[a].some(function(a){return a(b,c)})}function k(a,b){var c=0<(a.addClass||"").length,d=0<(a.removeClass||"").length;return b?c&&d:c||d}var e=this.rules={skip:[],cancel:[],join:[]};e.join.push(function(a,b){return!a.structural&&k(a)});
1195e.skip.push(function(a,b){return!a.structural&&!k(a)});e.skip.push(function(a,b){return"leave"===b.event&&a.structural});e.skip.push(function(a,b){return b.structural&&2===b.state&&!a.structural});e.cancel.push(function(a,b){return b.structural&&a.structural});e.cancel.push(function(a,b){return 2===b.state&&a.structural});e.cancel.push(function(a,b){if(b.structural)return!1;var c=a.addClass,f=a.removeClass,k=b.addClass,e=b.removeClass;return R(c)&&R(f)||R(k)&&R(e)?!1:d(c,e)||d(f,k)});this.$get=["$$rAF",
1196"$rootScope","$rootElement","$document","$$Map","$$animation","$$AnimateRunner","$templateRequest","$$jqLite","$$forceReflow","$$isDocumentHidden",function(c,d,e,C,U,oa,H,u,t,I,da){function ia(a){O.delete(a.target)}function v(){var a=!1;return function(b){a?b():d.$$postDigest(function(){a=!0;b()})}}function ua(a,b,c){var g=[],l=m[c];l&&s(l,function(l){Oa.call(l.node,b)?g.push(l.callback):"leave"===c&&Oa.call(l.node,a)&&g.push(l.callback)});return g}function h(a,b,c){var l=va(b);return a.filter(function(a){return!(a.node===
1197l&&(!c||a.callback===c))})}function q(a,J,w){function e(a,b,l,g){u(function(){var a=ua(ia,m,b);a.length?c(function(){s(a,function(a){a(h,l,g)});"close"!==l||m.parentNode||D.off(m)}):"close"!==l||m.parentNode||D.off(m)});a.progress(b,l,g)}function I(a){var b=h,c=n;c.preparationClasses&&(b.removeClass(c.preparationClasses),c.preparationClasses=null);c.activeClasses&&(b.removeClass(c.activeClasses),c.activeClasses=null);W(h,n);ha(h,n);n.domOperation();q.complete(!a)}var n=Da(w),h=Ha(a),m=K(h),ia=m&&
1198m.parentNode,n=pa(n),q=new H,u=v();Z(n.addClass)&&(n.addClass=n.addClass.join(" "));n.addClass&&!G(n.addClass)&&(n.addClass=null);Z(n.removeClass)&&(n.removeClass=n.removeClass.join(" "));n.removeClass&&!G(n.removeClass)&&(n.removeClass=null);n.from&&!ta(n.from)&&(n.from=null);n.to&&!ta(n.to)&&(n.to=null);if(!(B&&m&&fa(m,J,w)&&Ya(m,n)))return I(),q;var x=0<=["enter","move","leave"].indexOf(J),r=da(),P=r||O.get(m);w=!P&&y.get(m)||{};var p=!!w.state;P||p&&1===w.state||(P=!E(m,ia,J));if(P)return r&&
1199e(q,J,"start",b(n)),I(),r&&e(q,J,"close",b(n)),q;x&&F(m);r={structural:x,element:h,event:J,addClass:n.addClass,removeClass:n.removeClass,close:I,options:n,runner:q};if(p){if(f("skip",r,w)){if(2===w.state)return I(),q;T(h,w,r);return w.runner}if(f("cancel",r,w))if(2===w.state)w.runner.end();else if(w.structural)w.close();else return T(h,w,r),w.runner;else if(f("join",r,w))if(2===w.state)T(h,r,{});else return Ua(t,h,x?J:null,n),J=r.event=w.event,n=T(h,w,r),w.runner}else T(h,r,{});(p=r.structural)||
1200(p="animate"===r.event&&0<Object.keys(r.options.to||{}).length||k(r));if(!p)return I(),g(m),q;var C=(w.counter||0)+1;r.counter=C;l(m,1,r);d.$$postDigest(function(){h=Ha(a);var c=y.get(m),d=!c,c=c||{},t=0<(h.parent()||[]).length&&("animate"===c.event||c.structural||k(c));if(d||c.counter!==C||!t){d&&(W(h,n),ha(h,n));if(d||x&&c.event!==J)n.domOperation(),q.end();t||g(m)}else J=!c.structural&&k(c,!0)?"setClass":c.event,l(m,2),c=oa(h,J,c.options),q.setHost(c),e(q,J,"start",b(n)),c.done(function(a){I(!a);
1201(a=y.get(m))&&a.counter===C&&g(m);e(q,J,"close",b(n))})});return q}function F(a){a=a.querySelectorAll("[data-ng-animate]");s(a,function(a){var b=parseInt(a.getAttribute("data-ng-animate"),10),c=y.get(a);if(c)switch(b){case 2:c.runner.end();case 1:y.delete(a)}})}function g(a){a.removeAttribute("data-ng-animate");y.delete(a)}function E(a,b,c){c=C[0].body;var l=K(e),g=a===c||"HTML"===a.nodeName,d=a===l,t=!1,m=O.get(a),h;for((a=A.data(a,"$ngAnimatePin"))&&(b=K(a));b;){d||(d=b===l);if(1!==b.nodeType)break;
1202a=y.get(b)||{};if(!t){var f=O.get(b);if(!0===f&&!1!==m){m=!0;break}else!1===f&&(m=!1);t=a.structural}if(R(h)||!0===h)a=A.data(b,"$$ngAnimateChildren"),za(a)&&(h=a);if(t&&!1===h)break;g||(g=b===c);if(g&&d)break;if(!d&&(a=A.data(b,"$ngAnimatePin"))){b=K(a);continue}b=b.parentNode}return(!t||h)&&!0!==m&&d&&g}function l(a,b,c){c=c||{};c.state=b;a.setAttribute("data-ng-animate",b);c=(b=y.get(a))?wa(b,c):c;y.set(a,c)}var y=new U,O=new U,B=null,P=d.$watch(function(){return 0===u.totalPendingRequests},function(a){a&&
1203(P(),d.$$postDigest(function(){d.$$postDigest(function(){null===B&&(B=!0)})}))}),m=Object.create(null);U=a.customFilter();var la=a.classNameFilter();I=function(){return!0};var fa=U||I,Ya=la?function(a,b){var c=[a.getAttribute("class"),b.addClass,b.removeClass].join(" ");return la.test(c)}:I,W=aa(t),Oa=Y.Node.prototype.contains||function(a){return this===a||!!(this.compareDocumentPosition(a)&16)},D={on:function(a,b,c){var l=va(b);m[a]=m[a]||[];m[a].push({node:l,callback:c});A(b).on("$destroy",function(){y.get(l)||
1204D.off(a,b,c)})},off:function(a,b,c){if(1!==arguments.length||G(arguments[0])){var l=m[a];l&&(m[a]=1===arguments.length?null:h(l,b,c))}else for(l in b=arguments[0],m)m[l]=h(m[l],b)},pin:function(a,b){Fa(sa(a),"element","not an element");Fa(sa(b),"parentElement","not an element");a.data("$ngAnimatePin",b)},push:function(a,b,c,l){c=c||{};c.domOperation=l;return q(a,b,c)},enabled:function(a,b){var c=arguments.length;if(0===c)b=!!B;else if(sa(a)){var l=K(a);if(1===c)b=!O.get(l);else{if(!O.has(l))A(a).on("$destroy",
1205ia);O.set(l,!b)}}else b=B=!!a;return b}};return D}]}]).provider("$$animateCache",function(){var a=0,b=Object.create(null);this.$get=[function(){return{cacheKey:function(b,d,f,k){var e=b.parentNode;b=[e.$$ngAnimateParentKey||(e.$$ngAnimateParentKey=++a),d,b.getAttribute("class")];f&&b.push(f);k&&b.push(k);return b.join(" ")},containsCachedAnimationWithoutDuration:function(a){return(a=b[a])&&!a.isValid||!1},flush:function(){b=Object.create(null)},count:function(a){return(a=b[a])?a.total:0},get:function(a){return(a=
1206b[a])&&a.value},put:function(a,d,f){b[a]?(b[a].total++,b[a].value=d):b[a]={total:1,value:d,isValid:f}}}}]}).provider("$$animation",["$animateProvider",function(a){var b=this.drivers=[];this.$get=["$$jqLite","$rootScope","$injector","$$AnimateRunner","$$Map","$$rAFScheduler","$$animateCache",function(a,d,f,k,e,Q,L){function x(a){function b(a){if(a.processed)return a;a.processed=!0;var d=a.domNode,t=d.parentNode;f.set(d,a);for(var h;t;){if(h=f.get(t)){h.processed||(h=b(h));break}t=t.parentNode}(h||
1207c).children.push(a);return a}var c={children:[]},d,f=new e;for(d=0;d<a.length;d++){var da=a[d];f.set(da.domNode,a[d]={domNode:da.domNode,element:da.element,fn:da.fn,children:[]})}for(d=0;d<a.length;d++)b(a[d]);return function(a){var b=[],c=[],d;for(d=0;d<a.children.length;d++)c.push(a.children[d]);a=c.length;var t=0,f=[];for(d=0;d<c.length;d++){var g=c[d];0>=a&&(a=t,t=0,b.push(f),f=[]);f.push(g);g.children.forEach(function(a){t++;c.push(a)});a--}f.length&&b.push(f);return b}(c)}var C=[],U=aa(a);return function(e,
1208H,u){function t(a){a=a.hasAttribute("ng-animate-ref")?[a]:a.querySelectorAll("[ng-animate-ref]");var b=[];s(a,function(a){var c=a.getAttribute("ng-animate-ref");c&&c.length&&b.push(a)});return b}function I(a){var b=[],c={};s(a,function(a,d){var l=K(a.element),g=0<=["enter","move"].indexOf(a.event),l=a.structural?t(l):[];if(l.length){var f=g?"to":"from";s(l,function(a){var b=a.getAttribute("ng-animate-ref");c[b]=c[b]||{};c[b][f]={animationID:d,element:A(a)}})}else b.push(a)});var d={},g={};s(c,function(c,
1209t){var f=c.from,e=c.to;if(f&&e){var h=a[f.animationID],k=a[e.animationID],E=f.animationID.toString();if(!g[E]){var I=g[E]={structural:!0,beforeStart:function(){h.beforeStart();k.beforeStart()},close:function(){h.close();k.close()},classes:da(h.classes,k.classes),from:h,to:k,anchors:[]};I.classes.length?b.push(I):(b.push(h),b.push(k))}g[E].anchors.push({out:f.element,"in":e.element})}else f=f?f.animationID:e.animationID,e=f.toString(),d[e]||(d[e]=!0,b.push(a[f]))});return b}function da(a,b){a=a.split(" ");
1210b=b.split(" ");for(var c=[],d=0;d<a.length;d++){var g=a[d];if("ng-"!==g.substring(0,3))for(var t=0;t<b.length;t++)if(g===b[t]){c.push(g);break}}return c.join(" ")}function ia(a){for(var c=b.length-1;0<=c;c--){var d=f.get(b[c])(a);if(d)return d}}function v(a,b){function c(a){(a=a.data("$$animationRunner"))&&a.setHost(b)}a.from&&a.to?(c(a.from.element),c(a.to.element)):c(a.element)}function ua(){var a=e.data("$$animationRunner");!a||"leave"===H&&u.$$domOperationFired||a.end()}function h(b){e.off("$destroy",
1211ua);e.removeData("$$animationRunner");U(e,u);ha(e,u);u.domOperation();E&&a.removeClass(e,E);F.complete(!b)}u=pa(u);var q=0<=["enter","move","leave"].indexOf(H),F=new k({end:function(){h()},cancel:function(){h(!0)}});if(!b.length)return h(),F;var g=Ga(e.attr("class"),Ga(u.addClass,u.removeClass)),E=u.tempClasses;E&&(g+=" "+E,u.tempClasses=null);q&&e.data("$$animatePrepareClasses","ng-"+H+"-prepare");e.data("$$animationRunner",F);C.push({element:e,classes:g,event:H,structural:q,options:u,beforeStart:function(){E=
1212(E?E+" ":"")+"ng-animate";a.addClass(e,E);var b=e.data("$$animatePrepareClasses");b&&a.removeClass(e,b)},close:h});e.on("$destroy",ua);if(1<C.length)return F;d.$$postDigest(function(){var b=[];s(C,function(a){a.element.data("$$animationRunner")?b.push(a):a.close()});C.length=0;var d=I(b),g=[];s(d,function(a){var b=a.from?a.from.element:a.element,c=u.addClass,d=L.cacheKey(b[0],a.event,(c?c+" ":"")+"ng-animate",u.removeClass);g.push({element:b,domNode:K(b),fn:function(){var b,c=a.close;if(L.containsCachedAnimationWithoutDuration(d))c();
1213else{a.beforeStart();if((a.anchors?a.from.element||a.to.element:a.element).data("$$animationRunner")){var g=ia(a);g&&(b=g.start)}b?(b=b(),b.done(function(a){c(!a)}),v(a,b)):c()}}})});for(var d=x(g),t=0;t<d.length;t++)for(var f=d[t],e=0;e<f.length;e++){var h=f[e],k=h.element;d[t][e]=h.fn;0===t?k.removeData("$$animatePrepareClasses"):(h=k.data("$$animatePrepareClasses"))&&a.addClass(k,h)}Q(d)});return F}}]}]).provider("$animateCss",["$animateProvider",function(a){this.$get=["$window","$$jqLite","$$AnimateRunner",
1214"$timeout","$$animateCache","$$forceReflow","$sniffer","$$rAFScheduler","$$animateQueue",function(a,c,d,f,k,e,Q,L,x){function C(d,f,e,x){var v,s="stagger-"+e;0<k.count(e)&&(v=k.get(s),v||(f=$(f,"-stagger"),c.addClass(d,f),v=Ka(a,d,x),v.animationDuration=Math.max(v.animationDuration,0),v.transitionDuration=Math.max(v.transitionDuration,0),c.removeClass(d,f),k.put(s,v,!0)));return v||{}}function U(a){u.push(a);L.waitUntilQuiet(function(){k.flush();for(var a=e(),b=0;b<u.length;b++)u[b](a);u.length=0})}
1215function z(c,d,f,e){d=k.get(f);d||(d=Ka(a,c,Wa),"infinite"===d.animationIterationCount&&(d.animationIterationCount=1));k.put(f,d,e||0<d.transitionDuration||0<d.animationDuration);c=d;f=c.animationDelay;e=c.transitionDelay;c.maxDelay=f&&e?Math.max(f,e):f||e;c.maxDuration=Math.max(c.animationDuration*c.animationIterationCount,c.transitionDuration);return c}var H=aa(c),u=[];return function(a,b){function e(){v()}function L(){v(!0)}function v(b){if(!(P||la&&m)){P=!0;m=!1;V&&!g.$$skipPreparationClasses&&
1216c.removeClass(a,V);ba&&c.removeClass(a,ba);xa(l,!1);ra.blockTransitions(l,!1);s(y,function(a){l.style[a[0]]=""});H(a,g);ha(a,g);Object.keys(E).length&&s(E,function(a,b){a?l.style.setProperty(b,a):l.style.removeProperty(b)});if(g.onDone)g.onDone();w&&w.length&&a.off(w.join(" "),q);var d=a.data("$$animateCss");d&&(f.cancel(d[0].timer),a.removeData("$$animateCss"));fa&&fa.complete(!b)}}function u(a){p.blockTransition&&ra.blockTransitions(l,a);p.blockKeyframeAnimation&&xa(l,!!a)}function h(){fa=new d({end:e,
1217cancel:L});U(N);v();return{$$willAnimate:!1,start:function(){return fa},end:e}}function q(a){a.stopPropagation();var b=a.originalEvent||a;b.target===l&&(a=b.$manualTimeStamp||Date.now(),b=parseFloat(b.elapsedTime.toFixed(3)),Math.max(a-J,0)>=G&&b>=D&&(la=!0,v()))}function F(){function b(){if(!P){u(!1);s(y,function(a){l.style[a[0]]=a[1]});H(a,g);c.addClass(a,ba);if(p.recalculateTimingStyles){T=l.getAttribute("class")+" "+V;ka=k.cacheKey(l,ja,g.addClass,g.removeClass);r=z(l,T,ka,!1);ga=r.maxDelay;W=
1218Math.max(ga,0);D=r.maxDuration;if(0===D){v();return}p.hasTransitions=0<r.transitionDuration;p.hasAnimations=0<r.animationDuration}p.applyAnimationDelay&&(ga="boolean"!==typeof g.delay&&ya(g.delay)?parseFloat(g.delay):ga,W=Math.max(ga,0),r.animationDelay=ga,ea=[qa,ga+"s"],y.push(ea),l.style[ea[0]]=ea[1]);G=1E3*W;R=1E3*D;if(g.easing){var e,h=g.easing;p.hasTransitions&&(e=M+"TimingFunction",y.push([e,h]),l.style[e]=h);p.hasAnimations&&(e=ca+"TimingFunction",y.push([e,h]),l.style[e]=h)}r.transitionDuration&&
1219w.push(Aa);r.animationDuration&&w.push(Ba);J=Date.now();var m=G+1.5*R;e=J+m;var h=a.data("$$animateCss")||[],F=!0;if(h.length){var n=h[0];(F=e>n.expectedEndTime)?f.cancel(n.timer):h.push(v)}F&&(m=f(d,m,!1),h[0]={timer:m,expectedEndTime:e},h.push(v),a.data("$$animateCss",h));if(w.length)a.on(w.join(" "),q);g.to&&(g.cleanupStyles&&Ma(E,l,Object.keys(g.to)),Ja(a,g))}}function d(){var b=a.data("$$animateCss");if(b){for(var c=1;c<b.length;c++)b[c]();a.removeData("$$animateCss")}}if(!P)if(l.parentNode){var e=
1220function(a){if(la)m&&a&&(m=!1,v());else if(m=!a,r.animationDuration)if(a=xa(l,m),m)y.push(a);else{var b=y,c=b.indexOf(a);0<=a&&b.splice(c,1)}},h=0<aa&&(r.transitionDuration&&0===X.transitionDuration||r.animationDuration&&0===X.animationDuration)&&Math.max(X.animationDelay,X.transitionDelay);h?f(b,Math.floor(h*aa*1E3),!1):b();A.resume=function(){e(!0)};A.pause=function(){e(!1)}}else v()}var g=b||{};g.$$prepared||(g=pa(Da(g)));var E={},l=K(a);if(!l||!l.parentNode||!x.enabled())return h();var y=[],O=
1221a.attr("class"),B=Qa(g),P,m,la,fa,A,W,G,D,R,J,w=[];if(0===g.duration||!Q.animations&&!Q.transitions)return h();var ja=g.event&&Z(g.event)?g.event.join(" "):g.event,Y=ja&&g.structural,n="",S="";Y?n=$(ja,"ng-",!0):ja&&(n=ja);g.addClass&&(S+=$(g.addClass,"-add"));g.removeClass&&(S.length&&(S+=" "),S+=$(g.removeClass,"-remove"));g.applyClassesEarly&&S.length&&H(a,g);var V=[n,S].join(" ").trim(),T=O+" "+V,O=B.to&&0<Object.keys(B.to).length;if(!(0<(g.keyframeStyle||"").length||O||V))return h();var X,ka=
1222k.cacheKey(l,ja,g.addClass,g.removeClass);if(k.containsCachedAnimationWithoutDuration(ka))return V=null,h();0<g.stagger?(B=parseFloat(g.stagger),X={transitionDelay:B,animationDelay:B,transitionDuration:0,animationDuration:0}):X=C(l,V,ka,Xa);g.$$skipPreparationClasses||c.addClass(a,V);g.transitionStyle&&(B=[M,g.transitionStyle],ma(l,B),y.push(B));0<=g.duration&&(B=0<l.style[M].length,B=La(g.duration,B),ma(l,B),y.push(B));g.keyframeStyle&&(B=[ca,g.keyframeStyle],ma(l,B),y.push(B));var aa=X?0<=g.staggerIndex?
1223g.staggerIndex:k.count(ka):0;(n=0===aa)&&!g.skipBlocking&&ra.blockTransitions(l,9999);var r=z(l,T,ka,!Y),ga=r.maxDelay;W=Math.max(ga,0);D=r.maxDuration;var p={};p.hasTransitions=0<r.transitionDuration;p.hasAnimations=0<r.animationDuration;p.hasTransitionAll=p.hasTransitions&&"all"===r.transitionProperty;p.applyTransitionDuration=O&&(p.hasTransitions&&!p.hasTransitionAll||p.hasAnimations&&!p.hasTransitions);p.applyAnimationDuration=g.duration&&p.hasAnimations;p.applyTransitionDelay=ya(g.delay)&&(p.applyTransitionDuration||
1224p.hasTransitions);p.applyAnimationDelay=ya(g.delay)&&p.hasAnimations;p.recalculateTimingStyles=0<S.length;if(p.applyTransitionDuration||p.applyAnimationDuration)D=g.duration?parseFloat(g.duration):D,p.applyTransitionDuration&&(p.hasTransitions=!0,r.transitionDuration=D,B=0<l.style[M+"Property"].length,y.push(La(D,B))),p.applyAnimationDuration&&(p.hasAnimations=!0,r.animationDuration=D,y.push([Ca,D+"s"]));if(0===D&&!p.recalculateTimingStyles)return h();var ba=$(V,"-active");if(null!=g.delay){var ea;
1225"boolean"!==typeof g.delay&&(ea=parseFloat(g.delay),W=Math.max(ea,0));p.applyTransitionDelay&&y.push([na,ea+"s"]);p.applyAnimationDelay&&y.push([qa,ea+"s"])}null==g.duration&&0<r.transitionDuration&&(p.recalculateTimingStyles=p.recalculateTimingStyles||n);G=1E3*W;R=1E3*D;g.skipBlocking||(p.blockTransition=0<r.transitionDuration,p.blockKeyframeAnimation=0<r.animationDuration&&0<X.animationDelay&&0===X.animationDuration);g.from&&(g.cleanupStyles&&Ma(E,l,Object.keys(g.from)),Ia(a,g));p.blockTransition||
1226p.blockKeyframeAnimation?u(D):g.skipBlocking||ra.blockTransitions(l,!1);return{$$willAnimate:!0,end:e,start:function(){if(!P)return A={end:e,cancel:L,resume:null,pause:null},fa=new d(A),U(F),fa}}}}]}]).provider("$$animateCssDriver",["$$animationProvider",function(a){a.drivers.push("$$animateCssDriver");this.$get=["$animateCss","$rootScope","$$AnimateRunner","$rootElement","$sniffer","$$jqLite","$document",function(a,c,d,f,k,e,Q){function L(a){return a.replace(/\bng-\S+\b/g,"")}function x(a,b){G(a)&&
1227(a=a.split(" "));G(b)&&(b=b.split(" "));return a.filter(function(a){return-1===b.indexOf(a)}).join(" ")}function C(c,e,f){function k(a){var b={},c=K(a).getBoundingClientRect();s(["width","height","top","left"],function(a){var d=c[a];switch(a){case "top":d+=H.scrollTop;break;case "left":d+=H.scrollLeft}b[a]=Math.floor(d)+"px"});return b}function v(){var c=L(f.attr("class")||""),d=x(c,q),c=x(q,c),d=a(h,{to:k(f),addClass:"ng-anchor-in "+d,removeClass:"ng-anchor-out "+c,delay:!0});return d.$$willAnimate?
1228d:null}function C(){h.remove();e.removeClass("ng-animate-shim");f.removeClass("ng-animate-shim")}var h=A(K(e).cloneNode(!0)),q=L(h.attr("class")||"");e.addClass("ng-animate-shim");f.addClass("ng-animate-shim");h.addClass("ng-anchor");u.append(h);var F;c=function(){var c=a(h,{addClass:"ng-anchor-out",delay:!0,from:k(e)});return c.$$willAnimate?c:null}();if(!c&&(F=v(),!F))return C();var g=c||F;return{start:function(){function a(){c&&c.end()}var b,c=g.start();c.done(function(){c=null;if(!F&&(F=v()))return c=
1229F.start(),c.done(function(){c=null;C();b.complete()}),c;C();b.complete()});return b=new d({end:a,cancel:a})}}}function z(a,b,c,e){var f=oa(a,N),k=oa(b,N),h=[];s(e,function(a){(a=C(c,a.out,a["in"]))&&h.push(a)});if(f||k||0!==h.length)return{start:function(){function a(){s(b,function(a){a.end()})}var b=[];f&&b.push(f.start());k&&b.push(k.start());s(h,function(a){b.push(a.start())});var c=new d({end:a,cancel:a});d.all(b,function(a){c.complete(a)});return c}}}function oa(c){var d=c.element,e=c.options||
1230{};c.structural&&(e.event=c.event,e.structural=!0,e.applyClassesEarly=!0,"leave"===c.event&&(e.onDone=e.domOperation));e.preparationClasses&&(e.event=ba(e.event,e.preparationClasses));c=a(d,e);return c.$$willAnimate?c:null}if(!k.animations&&!k.transitions)return N;var H=Q[0].body;c=K(f);var u=A(c.parentNode&&11===c.parentNode.nodeType||H.contains(c)?c:H);return function(a){return a.from&&a.to?z(a.from,a.to,a.classes,a.anch
1230ors):oa(a)}}]}]).provider("$$animateJs",["$animateProvider",function(a){this.$get=
1231["$injector","$$AnimateRunner","$$jqLite",function(b,c,d){function f(c){c=Z(c)?c:c.split(" ");for(var d=[],f={},k=0;k<c.length;k++){var s=c[k],z=a.$$registeredAnimations[s];z&&!f[s]&&(d.push(b.get(z)),f[s]=!0)}return d}var k=aa(d);return function(a,b,d,x){function C(){x.domOperation();k(a,x)}function z(a,b,d,f,e){switch(d){case "animate":b=[b,f.from,f.to,e];break;case "setClass":b=[b,t,I,e];break;case "addClass":b=[b,t,e];break;case "removeClass":b=[b,I,e];break;default:b=[b,e]}b.push(f);if(a=a.apply(a,
1232b))if(Ea(a.start)&&(a=a.start()),a instanceof c)a.done(e);else if(Ea(a))return a;return N}function A(a,b,d,e,f){var h=[];s(e,function(e){var l=e[f];l&&h.push(function(){var e,f,h=!1,k=function(a){h||(h=!0,(f||N)(a),e.complete(!a))};e=new c({end:function(){k()},cancel:function(){k(!0)}});f=z(l,a,b,d,function(a){k(!1===a)});return e})});return h}function H(a,b,d,e,f){var h=A(a,b,d,e,f);if(0===h.length){var k,q;"beforeSetClass"===f?(k=A(a,"removeClass",d,e,"beforeRemoveClass"),q=A(a,"addClass",d,e,"beforeAddClass")):
1233"setClass"===f&&(k=A(a,"removeClass",d,e,"removeClass"),q=A(a,"addClass",d,e,"addClass"));k&&(h=h.concat(k));q&&(h=h.concat(q))}if(0!==h.length)return function(a){var b=[];h.length&&s(h,function(a){b.push(a())});b.length?c.all(b,a):a();return function(a){s(b,function(b){a?b.cancel():b.end()})}}}var u=!1;3===arguments.length&&ta(d)&&(x=d,d=null);x=pa(x);d||(d=a.attr("class")||"",x.addClass&&(d+=" "+x.addClass),x.removeClass&&(d+=" "+x.removeClass));var t=x.addClass,I=x.removeClass,G=f(d),K,v;if(G.length){var M,
1234h;"leave"===b?(h="leave",M="afterLeave"):(h="before"+b.charAt(0).toUpperCase()+b.substr(1),M=b);"enter"!==b&&"move"!==b&&(K=H(a,b,x,G,h));v=H(a,b,x,G,M)}if(K||v){var q;return{$$willAnimate:!0,end:function(){q?q.end():(u=!0,C(),ha(a,x),q=new c,q.complete(!0));return q},start:function(){function b(c){u=!0;C();ha(a,x);q.complete(c)}if(q)return q;q=new c;var d,f=[];K&&f.push(function(a){d=K(a)});f.length?f.push(function(a){C();a(!0)}):C();v&&f.push(function(a){d=v(a)});q.setHost({end:function(){u||((d||
1235N)(void 0),b(void 0))},cancel:function(){u||((d||N)(!0),b(!0))}});c.chain(f,b);return q}}}}}]}]).provider("$$animateJsDriver",["$$animationProvider",function(a){a.drivers.push("$$animateJsDriver");this.$get=["$$animateJs","$$AnimateRunner",function(a,c){function d(c){return a(c.element,c.event,c.classes,c.options)}return function(a){if(a.from&&a.to){var b=d(a.from),e=d(a.to);if(b||e)return{start:function(){function a(){return function(){s(d,function(a){a.end()})}}var d=[];b&&d.push(b.start());e&&
1236d.push(e.start());c.all(d,function(a){f.complete(a)});var f=new c({end:a(),cancel:a()});return f}}}else return d(a)}}]}])})(window,window.angular);
1237//# sourceMappingURL=angular-animate.min.js.map
1238;
1239/*
1240 * angular-ui-bootstrap
1241 * http://angular-ui.github.io/bootstrap/
1242
1243 * Version: 2.5.0 - 2017-01-28
1244 * License: MIT
1245 */angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.collapse","ui.bootstrap.tabindex","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.isClass","ui.bootstrap.datepicker","ui.bootstrap.position","ui.bootstrap.datepickerPopup","ui.bootstrap.debounce","ui.bootstrap.multiMap","ui.bootstrap.dropdown","ui.bootstrap.stackedMap","ui.bootstrap.modal","ui.bootstrap.paging","ui.bootstrap.pager","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]),angular.module("ui.bootstrap.tpls",["uib/template/accordion/accordion-group.html","uib/template/accordion/accordion.html","uib/template/alert/alert.html","uib/template/carousel/carousel.html","uib/template/carousel/slide.html","uib/template/datepicker/datepicker.html","uib/template/datepicker/day.html","uib/template/datepicker/month.html","uib/template/datepicker/year.html","uib/template/datepickerPopup/popup.html","uib/template/modal/window.html","uib/template/pager/pager.html","uib/template/pagination/pagination.html","uib/template/tooltip/tooltip-html-popup.html","uib/template/tooltip/tooltip-popup.html","uib/template/tooltip/tooltip-template-popup.html","uib/template/popover/popover-html.html","uib/template/popover/popover-template.html","uib/template/popover/popover.html","uib/template/progressbar/bar.html","uib/template/progressbar/progress.html","uib/template/progressbar/progressbar.html","uib/template/rating/rating.html","uib/template/tabs/tab.html","uib/template/tabs/tabset.html","uib/template/timepicker/timepicker.html","uib/template/typeahead/typeahead-match.html","uib/template/typeahead/typeahead-popup.html"]),angular.module("ui.bootstrap.collapse",[]).directive("uibCollapse",["$animate","$q","$parse","$injector",function(a,b,c,d){var e=d.has("$animateCss")?d.get("$animateCss"):null;return{link:function(d,f,g){function h(){r=!!("horizontal"in g),r?(s={width:""},t={width:"0"}):(s={height:""},t={height:"0"}),d.$eval(g.uibCollapse)||f.addClass("in").addClass("collapse").attr("aria-expanded",!0).attr("aria-hidden",!1).css(s)}function i(a){return r?{width:a.scrollWidth+"px"}:{height:a.scrollHeight+"px"}}function j(){f.hasClass("collapse")&&f.hasClass("in")||b.resolve(n(d)).then(function(){f.removeClass("collapse").addClass("collapsing").attr("aria-expanded",!0).attr("aria-hidden",!1),e?e(f,{addClass:"in",easing:"ease",css:{overflow:"hidden"},to:i(f[0])}).start()["finally"](k):a.addClass(f,"in",{css:{overflow:"hidden"},to:i(f[0])}).then(k)},angular.noop)}function k(){f.removeClass("collapsing").addClass("collapse").css(s),o(d)}function l(){return f.hasClass("collapse")||f.hasClass("in")?void b.resolve(p(d)).then(function(){f.css(i(f[0])).removeClass("collapse").addClass("collapsing").attr("aria-expanded",!1).attr("aria-hidden",!0),e?e(f,{removeClass:"in",to:t}).start()["finally"](m):a.removeClass(f,"in",{to:t}).then(m)},angular.noop):m()}function m(){f.css(t),f.removeClass("collapsing").addClass("collapse"),q(d)}var n=c(g.expanding),o=c(g.expanded),p=c(g.collapsing),q=c(g.collapsed),r=!1,s={},t={};
vendor: 4,630 bytes, line 1245
1245h(),d.$watch(g.uibCollapse,function(a){a?l():j()})}}}]),angular.module("ui.bootstrap.tabindex",[]).directive("uibTabindexToggle",function(){return{restrict:"A",link:function(a,b,c){c.$observe("disabled",function(a){c.$set("tabindex",a?-1:null)})}}}),angular.module("ui.bootstrap.accordion",["ui.bootstrap.collapse","ui.bootstrap.tabindex"]).constant("uibAccordionConfig",{closeOthers:!0}).controller("UibAccordionController",["$scope","$attrs","uibAccordionConfig",function(a,b,c){this.groups=[],this.closeOthers=function(d){var e=angular.isDefined(b.closeOthers)?a.$eval(b.closeOthers):c.closeOthers;e&&angular.forEach(this.groups,function(a){a!==d&&(a.isOpen=!1)})},this.addGroup=function(a){var b=this;this.groups.push(a),a.$on("$destroy",function(c){b.removeGroup(a)})},this.removeGroup=function(a){var b=this.groups.indexOf(a);-1!==b&&this.groups.splice(b,1)}}]).directive("uibAccordion",function(){return{controller:"UibAccordionController",controllerAs:"accordion",transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/accordion/accordion.html"}}}).directive("uibAccordionGroup",function(){return{require:"^uibAccordion",transclude:!0,restrict:"A",templateUrl:function(a,b){return b.templateUrl||"uib/template/accordion/accordion-group.html"},scope:{heading:"@",panelClass:"@?",isOpen:"=?",isDisabled:"=?"},controller:function(){this.setHeading=function(a){this.heading=a}},link:function(a,b,c,d){b.addClass("panel"),d.addGroup(a),a.openClass=c.openClass||"panel-open",a.panelClass=c.panelClass||"panel-default",a.$watch("isOpen",function(c){b.toggleClass(a.openClass,!!c),c&&d.closeOthers(a)}),a.toggleOpen=function(b){a.isDisabled||b&&32!==b.which||(a.isOpen=!a.isOpen)};var e="accordiongroup-"+a.$id+"-"+Math.floor(1e4*Math.random());a.headingId=e+"-tab",a.panelId=e+"-panel"}}}).directive("uibAccordionHeading",function(){return{transclude:!0,template:"",replace:!0,require:"^uibAccordionGroup",link:function(a,b,c,d,e){d.setHeading(e(a,angular.noop))}}}).directive("uibAccordionTransclude",function(){function a(){return"uib-accordion-header,data-uib-accordion-header,x-uib-accordion-header,uib\\:accordion-header,[uib-accordion-header],[data-uib-accordion-header],[x-uib-accordion-header]"}return{require:"^uibAccordionGroup",link:function(b,c,d,e){b.$watch(function(){return e[d.uibAccordionTransclude]},function(b){if(b){var d=angular.element(c[0].querySelector(a()));d.html(""),d.append(b)}})}}}),angular.module("ui.bootstrap.alert",[]).controller("UibAlertController",["$scope","$element","$attrs","$interpolate","$timeout",function(a,b,c,d,e){a.closeable=!!c.close,b.addClass("alert"),c.$set("role","alert"),a.closeable&&b.addClass("alert-dismissible");var f=angular.isDefined(c.dismissOnTimeout)?d(c.dismissOnTimeout)(a.$parent):null;f&&e(function(){a.close()},parseInt(f,10))}]).directive("uibAlert",function(){return{controller:"UibAlertController",controllerAs:"alert",restrict:"A",templateUrl:function(a,b){return b.templateUrl||"uib/template/alert/alert.html"},transclude:!0,scope:{close:"&"}}}),angular.module("ui.bootstrap.buttons",[]).constant("uibButtonConfig",{activeClass:"active",toggleEvent:"click"}).controller("UibButtonsController",["uibButtonConfig",function(a){this.activeClass=a.activeClass||"active",this.toggleEvent=a.toggleEvent||"click"}]).directive("uibBtnRadio",["$parse",function(a){return{require:["uibBtnRadio","ngModel"],controller:"UibButtonsController",controllerAs:"buttons",link:function(b,c,d,e){var f=e[0],g=e[1],h=a(d.uibUncheckable);c.find("input").css({display:"none"}),g.$render=function(){c.toggleClass(f.activeClass,angular.equals(g.$modelValue,b.$eval(d.uibBtnRadio)))},c.on(f.toggleEvent,function(){if(!d.disabled){var a=c.hasClass(f.activeClass);a&&!angular.isDefined(d.uncheckable)||b.$apply(function(){g.$setViewValue(a?null:b.$eval(d.uibBtnRadio)),g.$render()})}}),d.uibUncheckable&&b.$watch(h,function(a){d.$set("uncheckable",a?"":void 0)})}}}]).directive("uibBtnCheckbox",function(){return{require:["uibBtnCheckbox","ngModel"],controller:"UibButtonsController",controllerAs:"button",link:function(a,b,c,d){function e(){return g(c.btnCheckboxTrue,!0)}function f(){return g(c.btnCheckboxFalse,!1)}function g(b,c){return angular.isDefined(b)?a.$eval(b):c}var h=d[0],i=d[1];b.find("input").css({display:"none"}),i.$render=function(){b.toggleClass(h.activeClass,angular.equals(i.$modelValue,e()))},b.on(h.toggleEvent,function(){c.disabled||a.$apply(function(){i.$setViewValue(b.hasClass(h.activeClass)?f():e()),i.$render()})})}}}),angular.module("ui.bootstrap.carousel",[]).controller("UibCarouselController",["$scope","$element","$interval","$t
1245imeout","$animate",function(a,b,c,d,e){function f(a){for(var b=0;b<p.length;b++)p[b].slide.active=b===a}function g(c,d,g){if(!s){if(angular.extend(c,{direction:g}),angular.extend(p[r].slide||{},{direction:g}),e.enabled(b)&&!a.$currentTransition&&p[d].element&&o.slides.length>1){p[d].element.data(q,c.direction);var h=o.getCurrentIndex();angular.isNumber(h)&&p[h].element&&p[h].element.data(q,c.direction),a.$currentTransition=!0,e.on("addClass",p[d].element,function(b,c){"close"===c&&(a.$currentTransition=null,e.off("addClass",b))})}a.active=c.index,r=c.index,f(d),k()}}function h(a){for(var b=0;b<p.length;b++)if(p[b].slide===a)return b}function i(){m&&(c.cancel(m),m=null)}function j(b){b.length||(a.$currentTransition=null)}function k(){i();var b=+a.interval;!isNaN(b)&&b>0&&(m=c(l,b))}function l(){var b=+a.interval;n&&!isNaN(b)&&b>0&&p.length?a.next():a.pause()}var m,n,o=this,p=o.slides=a.slides=[],q="uib-slideDirection",r=a.active,s=!1;b.addClass("carousel"),o.addSlide=function(b,c){p.push({slide:b,element:c}),p.sort(function(a,b){return+a.slide.index-+b.slide.index}),(b.index===a.active||1===p.length&&!angular.isNumber(a.active))&&(a.$currentTransition&&(a.$currentTransition=null),r=b.index,a.active=b.index,f(r),o.select(p[h(b)]),1===p.length&&a.play())},o.getCurrentIndex=function(){for(var a=0;a<p.length;a++)if(p[a].slide.index===r)return a},o.next=a.next=function(){var b=(o.getCurrentIndex()+1)%p.length;return 0===b&&a.noWrap()?void a.pause():o.select(p[b],"next")},o.prev=a.prev=function(){var b=o.getCurrentIndex()-1<0?p.length-1:o.getCurrentIndex()-1;return a.noWrap()&&b===p.length-1?void a.pause():o.select(p[b],"prev")},o.removeSlide=function(b){var c=h(b);p.splice(c,1),p.length>0&&r===c?c>=p.length?(r=p.length-1,a.active=r,f(r),o.select(p[p.length-1])):(r=c,a.active=r,f(r),o.select(p[c])):r>c&&(r--,a.active=r),0===p.length&&(r=null,a.active=null)},o.select=a.select=function(b,c){var d=h(b.slide);void 0===c&&(c=d>o.getCurrentIndex()?"next":"prev"),b.slide.index===r||a.$currentTransition||g(b.slide,d,c)},a.indexOfSlide=function(a){return+a.slide.index},a.isActive=function(b){return a.active===b.slide.index},a.isPrevDisabled=function(){return 0===a.active&&a.noWrap()},a.isNextDisabled=function(){return a.active===p.length-1&&a.noWrap()},a.pause=function(){a.noPause||(n=!1,i())},a.play=function(){n||(n=!0,k())},b.on("mouseenter",a.pause),b.on("mouseleave",a.play),a.$on("$destroy",function(){s=!0,i()}),a.$watch("noTransition",function(a){e.enabled(b,!a)}),a.$watch("interval",k),a.$watchCollection("slides",j),a.$watch("active",function(a){if(angular.isNumber(a)&&r!==a){for(var b=0;b<p.length;b++)if(p[b].slide.index===a){a=b;break}var c=p[a];c&&(f(a),o.select(p[a]),r=a)}})}]).directive("uibCarousel",function(){return{transclude:!0,controller:"UibCarouselController",controllerAs:"carousel",restrict:"A",templateUrl:function(a,b){return b.templateUrl||"uib/template/carousel/carousel.html"},scope:{active:"=",interval:"=",noTransition:"=",noPause:"=",noWrap:"&"}}}).directive("uibSlide",["$animate",function(a){return{require:"^uibCarousel",restrict:"A",transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/carousel/slide.html"},scope:{actual:"=?",index:"=?"},link:function(b,c,d,e){c.addClass("item"),e.addSlide(b,c),b.$on("$destroy",function(){e.removeSlide(b)}),b.$watch("active",function(b){a[b?"addClass":"removeClass"](c,"active")})}}}]).animation(".item",["$animateCss",function(a){function b(a,b,c){a.removeClass(b),c&&c()}var c="uib-slideDirection";return{beforeAddClass:function(d,e,f){if("active"===e){var g=!1,h=d.data(c),i="next"===h?"left":"right",j=b.bind(this,d,i+" "+h,f);return d.addClass(h),a(d,{addClass:i}).start().done(j),function(){g=!0}}f()},beforeRemoveClass:function(d,e,f){if("active"===e){var g=!1,h=d.data(c),i="next"===h?"left":"right",j=b.bind(this,d,i,f);return a(d,{addClass:i}).start().done(j),function(){g=!0}}f()}}}]),angular.module("ui.bootstrap.dateparser",[]).service("uibDateParser",["$log","$locale","dateFilter","orderByFilter","filterFilter",function(a,b,c,d,e){function f(a){return e(s,{key:a},!0)[0]}
vendor: 28,179 bytes, lines 1245-1246
1245function g(a){var b=[],c=a.split(""),e=a.indexOf("'");if(e>-1){var f=!1;a=a.split("");for(var g=e;g<a.length;g++)f?("'"===a[g]&&(g+1<a.length&&"'"===a[g+1]?(a[g+1]="$",c[g+1]=""):(c[g]="",f=!1)),a[g]="$"):"'"===a[g]&&(a[g]="$",c[g]="",f=!0);a=a.join("")}return angular.forEach(s,function(d){var e=a.indexOf(d.key);if(e>-1){a=a.split(""),c[e]="("+d.regex+")",a[e]="$";for(var f=e+1,g=e+d.key.length;g>f;f++)c[f]="",a[f]="$";a=a.join(""),b.push({index:e,key:d.key,apply:d.apply,matcher:d.regex})}}),{regex:new RegExp("^"+c.join("")+"$"),map:d(b,"index")}}function h(a){for(var b,c,d=[],e=0;e<a.length;)if(angular.isNumber(c)){if("'"===a.charAt(e))(e+1>=a.length||"'"!==a.charAt(e+1))&&(d.push(i(a,c,e)),c=null);else if(e===a.length)for(;c<a.length;)b=j(a,c),d.push(b),c=b.endIdx;e++}else"'"!==a.charAt(e)?(b=j(a,e),d.push(b.parser),e=b.endIdx):(c=e,e++);return d}function i(a,b,c){return function(){return a.substr(b+1,c-b-1)}}function j(a,b){for(var c=a.substr(b),d=0;d<s.length;d++)if(new RegExp("^"+s[d].key).test(c)){var e=s[d];return{endIdx:b+e.key.length,parser:e.formatter}}return{endIdx:b+1,parser:function(){return c.charAt(0)}}}function k(a,b,c){return 1>c?!1:1===b&&c>28?29===c&&(a%4===0&&a%100!==0||a%400===0):3===b||5===b||8===b||10===b?31>c:!0}function l(a){return parseInt(a,10)}function m(a,b){return a&&b?q(a,b):a}function n(a,b){return a&&b?q(a,b,!0):a}function o(a,b){a=a.replace(/:/g,"");var c=Date.parse("Jan 01, 1970 00:00:00 "+a)/6e4;return isNaN(c)?b:c}function p(a,b){return a=new Date(a.getTime()),a.setMinutes(a.getMinutes()+b),a}function q(a,b,c){c=c?-1:1;var d=a.getTimezoneOffset(),e=o(b,d);return p(a,c*(e-d))}var r,s,t=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;this.init=function(){r=b.id,this.parsers={},this.formatters={},s=[{key:"yyyy",regex:"\\d{4}",apply:function(a){this.year=+a},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"yyyy")}},{key:"yy",regex:"\\d{2}",apply:function(a){a=+a,this.year=69>a?a+2e3:a+1900},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"yy")}},{key:"y",regex:"\\d{1,4}",apply:function(a){this.year=+a},formatter:function(a){var b=new Date;return b.setFullYear(Math.abs(a.getFullYear())),c(b,"y")}},{key:"M!",regex:"0?[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){var b=a.getMonth();return/^[0-9]$/.test(b)?c(a,"MM"):c(a,"M")}},{key:"MMMM",regex:b.DATETIME_FORMATS.MONTH.join("|"),apply:function(a){this.month=b.DATETIME_FORMATS.MONTH.indexOf(a)},formatter:function(a){return c(a,"MMMM")}},{key:"MMM",regex:b.DATETIME_FORMATS.SHORTMONTH.join("|"),apply:function(a){this.month=b.DATETIME_FORMATS.SHORTMONTH.indexOf(a)},formatter:function(a){return c(a,"MMM")}},{key:"MM",regex:"0[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){return c(a,"MM")}},{key:"M",regex:"[1-9]|1[0-2]",apply:function(a){this.month=a-1},formatter:function(a){return c(a,"M")}},{key:"d!",regex:"[0-2]?[0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){var b=a.getDate();return/^[1-9]$/.test(b)?c(a,"dd"):c(a,"d")}},{key:"dd",regex:"[0-2][0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){return c(a,"dd")}},{key:"d",regex:"[1-2]?[0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a},formatter:function(a){return c(a,"d")}},{key:"EEEE",regex:b.DATETIME_FORMATS.DAY.join("|"),formatter:function(a){return c(a,"EEEE")}},{key:"EEE",regex:b.DATETIME_FORMATS.SHORTDAY.join("|"),formatter:function(a){return c(a,"EEE")}},{key:"HH",regex:"(?:0|1)[0-9]|2[0-3]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"HH")}},{key:"hh",regex:"0[0-9]|1[0-2]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"hh")}},{key:"H",regex:"1?[0-9]|2[0-3]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"H")}},{key:"h",regex:"[0-9]|1[0-2]",apply:function(a){this.hours=+a},formatter:function(a){return c(a,"h")}},{key:"mm",regex:"[0-5][0-9]",apply:function(a){this.minutes=+a},formatter:function(a){return c(a,"mm")}},{key:"m",regex:"[0-9]|[1-5][0-9]",apply:function(a){this.minutes=+a},formatter:function(a){return c(a,"m")}},{key:"sss",regex:"[0-9][0-9][0-9]",apply:function(a){this.milliseconds=+a},formatter:function(a){return c(a,"sss")}},{key:"ss",regex:"[0-5][0-9]",apply:function(a){this.seconds=+a},formatter:function(a){return c(a,"ss")}},{key:"s",regex:"[0-9]|[1-5][0-9]",apply:function(a){this.seconds=+a},formatter:function(a){return c(a,"s")}},{key:"a",regex:b.DATETIME_FORMATS.AMPMS.join("|"),apply:function(a){12===this.hours&&(this.hours=0),"PM"===a&&(this.hours+=12)},formatter:function(a){return c(a,"a")}},{key:"Z",regex:"[+-]\\d{4}",apply:function(a){var b=a.match(/([+-])(\d{2})(\d{2})/),c=b[1],d=b[2],e=b[3];this.hours+=l(c+d),this.minutes+=l(c+e)},formatter:function(a){return c(a,"Z")}},{key:"ww",regex:"[0-4][0-9]|5[0-3]",formatter:function(a){return c(a,"ww")}},{key:"w",regex:"[0-9]|[1-4][0-9]|5[0-3]",formatter:function(a){return c(a,"w")}},{key:"GGGG",regex:b.DATETIME_FORMATS.ERANAMES.join("|").replace(/\s/g,"\\s"),formatter:function(a){return c(a,"GGGG")}},{key:"GGG",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"GGG")}},{key:"GG",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"GG")}},{key:"G",regex:b.DATETIME_FORMATS.ERAS.join("|"),formatter:function(a){return c(a,"G")}}],angular.version.major>=1&&angular.version.minor>4&&s.push({key:"LLLL",regex:b.DATETIME_FORMATS.STANDALONEMONTH.join("|"),apply:function(a){this.month=b.DATETIME_FORMATS.STANDALONEMONTH.indexOf(a)},formatter:function(a){return c(a,"LLLL")}})},this.init(),this.getParser=function(a){var b=f(a);return b&&b.apply||null},this.overrideParser=function(a,b){var c=f(a);c&&angular.isFunction(b)&&(this.parsers={},c.apply=b)}.bind(this),this.filter=function(a,c){if(!angular.isDate(a)||isNaN(a)||!c)return"";c=b.DATETIME_FORMATS[c]||c,b.id!==r&&this.init(),this.formatters[c]||(this.formatters[c]=h(c));var d=this.formatters[c];return d.reduce(function(b,c){return b+c(a)},"")},this.parse=function(c,d,e){if(!angular.isString(c)||!d)return c;d=b.DATETIME_FORMATS[d]||d,d=d.replace(t,"\\$&"),b.id!==r&&this.init(),this.parsers[d]||(this.parsers[d]=g(d,"apply"));var f=this.parsers[d],h=f.regex,i=f.map,j=c.match(h),l=!1;if(j&&j.length){var m,n;angular.isDate(e)&&!isNaN(e.getTime())?m={year:e.getFullYear(),month:e.getMonth(),date:e.getDate(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}:(e&&a.warn("dateparser:","baseDate is not a valid date"),m={year:1900,month:0,date:1,hours:0,minutes:0,seconds:0,milliseconds:0});for(var o=1,p=j.length;p>o;o++){var q=i[o-1];"Z"===q.matcher&&(l=!0),q.apply&&q.apply.call(m,j[o])}var s=l?Date.prototype.setUTCFullYear:Date.prototype.setFullYear,u=l?Date.prototype.setUTCHours:Date.prototype.setHours;return k(m.year,m.month,m.date)&&(!angular.isDate(e)||isNaN(e.getTime())||l?(n=new Date(0),s.call(n,m.year,m.month,m.date),u.call(n,m.hours||0,m.minutes||0,m.seconds||0,m.milliseconds||0)):(n=new Date(e),s.call(n,m.year,m.month,m.date),u.call(n,m.hours,m.minutes,m.seconds,m.milliseconds))),n}},this.toTimezone=m,this.fromTimezone=n,this.timezoneToOffset=o,this.addDateMinutes=p,this.convertTimezoneToLocal=q}]),angular.module("ui.bootstrap.isClass",[]).directive("uibIsClass",["$animate",function(a){var b=/^\s*([\s\S]+?)\s+on\s+([\s\S]+?)\s*$/,c=/^\s*([\s\S]+?)\s+for\s+([\s\S]+?)\s*$/;return{restrict:"A",compile:function(d,e){function f(a,b,c){i.push(a),j.push({scope:a,element:b}),o.forEach(function(b,c){g(b,a)}),a.$on("$destroy",h)}function g(b,d){var e=b.match(c),f=d.$eval(e[1]),g=e[2],h=k[b];if(!h){var i=function(b){var c=null;j.some(function(a){var d=a.scope.$eval(m);return d===b?(c=a,!0):void 0}),h.lastActivated!==c&&(h.lastActivated&&a.removeClass(h.lastActivated.element,f),c&&a.addClass(c.element,f),h.lastActivated=c)};k[b]=h={lastActivated:null,scope:d,watchFn:i,compareWithExp:g,watcher:d.$watch(g,i)}}h.watchFn(d.$eval(g))}function h(a){var b=a.targetScope,c=i.indexOf(b);if(i.splice(c,1),j.splice(c,1),i.length){var d=i[0];angular.forEach(k,function(a){a.scope===b&&(a.watcher=d.$watch(a.compareWithExp,a.watchFn),a.scope=d)})}else k={}}var i=[],j=[],k={},l=e.uibIsClass.match(b),m=l[2],n=l[1],o=n.split(",");return f}}}]),angular.module("ui.bootstrap.datepicker",["ui.bootstrap.dateparser","ui.bootstrap.isClass"]).value("$datepickerSuppressError",!1).value("$datepickerLiteralWarning",!0).constant("uibDatepickerConfig",{datepickerMode:"day",formatDay:"dd",formatMonth:"MMMM",formatYear:"yyyy",formatDayHeader:"EEE",formatDayTitle:"MMMM yyyy",formatMonthTitle:"yyyy",maxDate:null,maxMode:"year",minDate:null,minMode:"day",monthColumns:3,ngModelOptions:{},shortcutPropagation:!1,showWeeks:!0,yearColumns:5,yearRows:4}).controller("UibDatepickerController",["$scope","$element","$attrs","$parse","$interpolate","$locale","$log","dateFilter","uibDatepickerConfig","$datepickerLiteralWarning","$datepickerSuppressError","uibDateParser",function(a,b,c,d,e,f,g,h,i,j,k,l){function m(b){a.datepickerMode=b,a.datepickerOptions.datepickerMode=b}function n(b){var c;if(angular.version.minor<6)c=b.$options||a.datepickerOptions.ngModelOptions||i.ngModelOptions||{},c.getOption=function(a){return c[a]};else{var d=b.$options.getOption("timezone")||(a.datepickerOptions.ngModelOptions?a.datepickerOptions.ngModelOptions.timezone:null)||(i.ngModelOptions?i.ngModelOptions.timezone:null);c=b.$options.createChild(i.ngModelOptions).createChild(a.datepickerOptions.ngModelOptions).createChild(b.$options).createChild({timezone:d})}return c}var o=this,p={$setViewValue:angular.noop},q={},r=[];b.addClass("uib-datepicker"),c.$set("role","application"),a.datepickerOptions||(a.datepickerOptions={}),this.modes=["day","month","year"],["customClass","dateDisabled","datepickerMode","formatDay","formatDayHeader","formatDayTitle","formatMonth","formatMonthTitle","formatYear","maxDate","maxMode","minDate","minMode","monthColumns","showWeeks","shortcutPropagation","startingDay","yearColumns","yearRows"].forEach(function(b){switch(b){case"customClass":case"dateDisabled":a[b]=a.datepickerOptions[b]||angular.noop;break;case"datepickerMode":a.datepickerMode=angular.isDefined(a.datepickerOptions.datepickerMode)?a.datepickerOptions.datepickerMode:i.datepickerMode;break;case"formatDay":case"formatDayHeader":case"formatDayTitle":case"formatMonth":case"formatMonthTitle":case"formatYear":o[b]=angular.isDefined(a.datepickerOptions[b])?e(a.datepickerOptions[b])(a.$parent):i[b];break;case"monthColumns":case"showWeeks":case"shortcutPropagation":case"yearColumns":case"yearRows":o[b]=angular.isDefined(a.datepickerOptions[b])?a.datepickerOptions[b]:i[b];break;case"startingDay":angular.isDefined(a.datepickerOptions.startingDay)?o.startingDay=a.datepickerOptions.startingDay:angular.isNumber(i.startingDay)?o.startingDay=i.startingDay:o.startingDay=(f.DATETIME_FORMATS.FIRSTDAYOFWEEK+8)%7;break;case"maxDate":case"minDate":a.$watch("datepickerOptions."+b,function(a){a?angular.isDate(a)?o[b]=l.fromTimezone(new Date(a),q.getOption("timezone")):(j&&g.warn("Literal date support has been deprecated, please switch to date object usage"),o[b]=new Date(h(a,"medium"))):o[b]=i[b]?l.fromTimezone(new Date(i[b]),q.getOption("timezone")):null,o.refreshView()});break;case"maxMode":case"minMode":a.datepickerOptions[b]?a.$watch(function(){return a.datepickerOptions[b]},function(c){o[b]=a[b]=angular.isDefined(c)?c:a.datepickerOptions[b],("minMode"===b&&o.modes.indexOf(a.datepickerOptions.datepickerMode)<o.modes.indexOf(o[b])||"maxMode"===b&&o.modes.indexOf(a.datepickerOptions.datepickerMode)>o.modes.indexOf(o[b]))&&(a.datepickerMode=o[b],a.datepickerOptions.datepickerMode=o[b])}):o[b]=a[b]=i[b]||null}}),a.uniqueId="datepicker-"+a.$id+"-"+Math.floor(1e4*Math.random()),a.disabled=angular.isDefined(c.disabled)||!1,angular.isDefined(c.ngDisabled)&&r.push(a.$parent.$watch(c.ngDisabled,function(b){a.disabled=b,o.refreshView()})),a.isActive=function(b){return 0===o.compare(b.date,o.activeDate)?(a.activeDateId=b.uid,!0):!1},this.init=function(b){p=b,q=n(p),a.datepickerOptions.initDate?(o.activeDate=l.fromTimezone(a.datepickerOptions.initDate,q.getOption("timezone"))||new Date,a.$watch("datepickerOptions.initDate",function(a){a&&(p.$isEmpty(p.$modelValue)||p.$invalid)&&(o.activeDate=l.fromTimezone(a,q.getOption("timezone")),o.refreshView())})):o.activeDate=new Date;var c=p.$modelValue?new Date(p.$modelValue):new Date;this.activeDate=isNaN(c)?l.fromTimezone(new Date,q.getOption("timezone")):l.fromTimezone(c,q.getOption("timezone")),p.$render=function(){o.render()}},this.render=function(){if(p.$viewValue){var a=new Date(p.$viewValue),b=!isNaN(a);b?this.activeDate=l.fromTimezone(a,q.getOption("timezone")):k||g.error('Datepicker directive: "ng-model" value must be a Date object')}this.refreshView()},this.refreshView=function(){if(this.element){a.selectedDt=null,this._refreshView(),a.activeDt&&(a.activeDateId=a.activeDt.uid);var b=p.$viewValue?new Date(p.$viewValue):null;b=l.fromTimezone(b,q.getOption("timezone")),p.$setValidity("dateDisabled",!b||this.element&&!this.isDisabled(b))}},this.createDateObject=function(b,c){var d=p.$viewValue?new Date(p.$viewValue):null;d=l.fromTimezone(d,q.getOption("timezone"));var e=new Date;e=l.fromTimezone(e,q.getOption("timezone"));var f=this.compare(b,e),g={date:b,label:l.filter(b,c),selected:d&&0===this.compare(b,d),disabled:this.isDisabled(b),past:0>f,current:0===f,future:f>0,customClass:this.customClass(b)||null};return d&&0===this.compare(b,d)&&(a.selectedDt=g),o.activeDate&&0===this.compare(g.date,o.activeDate)&&(a.activeDt=g),g},this.isDisabled=function(b){return a.disabled||this.minDate&&this.compare(b,this.minDate)<0||this.maxDate&&this.compare(b,this.maxDate)>0||a.dateDisabled&&a.dateDisabled({date:b,mode:a.datepickerMode})},this.customClass=function(b){return a.customClass({date:b,mode:a.datepickerMode})},this.split=function(a,b){for(var c=[];a.length>0;)c.push(a.splice(0,b));return c},a.select=function(b){if(a.datepickerMode===o.minMode){var c=p.$viewValue?l.fromTimezone(new Date(p.$viewValue),q.getOption("timezone")):new Date(0,0,0,0,0,0,0);c.setFullYear(b.getFullYear(),b.getMonth(),b.getDate()),c=l.toTimezone(c,q.getOption("timezone")),p.$setViewValue(c),p.$render()}else o.activeDate=b,m(o.modes[o.modes.indexOf(a.datepickerMode)-1]),a.$emit("uib:datepicker.mode");a.$broadcast("uib:datepicker.focus")},a.move=function(a){var b=o.activeDate.getFullYear()+a*(o.step.years||0),c=o.activeDate.getMonth()+a*(o.step.months||0);o.activeDate.setFullYear(b,c,1),o.refreshView()},a.toggleMode=function(b){b=b||1,a.datepickerMode===o.maxMode&&1===b||a.datepickerMode===o.minMode&&-1===b||(m(o.modes[o.modes.indexOf(a.datepickerMode)+b]),a.$emit("uib:datepicker.mode"))},a.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var s=function(){o.element[0].focus()};a.$on("uib:datepicker.focus",s),a.keydown=function(b){var c=a.keys[b.which];if(c&&!b.shiftKey&&!b.altKey&&!a.disabled)if(b.preventDefault(),o.shortcutPropagation||b.stopPropagation(),"enter"===c||"space"===c){if(o.isDisabled(o.activeDate))return;a.select(o.activeDate)}else!b.ctrlKey||"up"!==c&&"down"!==c?(o.handleKeyDown(c,b),o.refreshView()):a.toggleMode("up"===c?1:-1)},b.on("keydown",function(b){a.$apply(function(){a.keydown(b)})}),a.$on("$destroy",function(){for(;r.length;)r.shift()()})}]).controller("UibDaypickerController",["$scope","$element","dateFilter",function(a,b,c){function d(a,b){return 1!==b||a%4!==0||a%100===0&&a%400!==0?f[b]:29}function e(a){var b=new Date(a);b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1}var f=[31,28,31,30,31,30,31,31,30,31,30,31];this.step={months:1},this.element=b,this.init=function(b){angular.extend(b,this),a.showWeeks=b.showWeeks,b.refreshView()},this.getDates=function(a,b){for(var c,d=new Array(b),e=new Date(a),f=0;b>f;)c=new Date(e),d[f++]=c,e.setDate(e.getDate()+1);return d},this._refreshView=function(){var b=this.activeDate.getFullYear(),d=this.activeDate.getMonth(),f=new Date(this.activeDate);f.setFullYear(b,d,1);var g=this.startingDay-f.getDay(),h=g>0?7-g:-g,i=new Date(f);h>0&&i.setDate(-h+1);for(var j=this.getDates(i,42),k=0;42>k;k++)j[k]=angular.extend(this.createDateObject(j[k],this.formatDay),{secondary:j[k].getMonth()!==d,uid:a.uniqueId+"-"+k});a.labels=new Array(7);for(var l=0;7>l;l++)a.labels[l]={abbr:c(j[l].date,this.formatDayHeader),full:c(j[l].date,"EEEE")};if(a.title=c(this.activeDate,this.formatDayTitle),a.rows=this.split(j,7),a.showWeeks){a.weekNumbers=[];for(var m=(11-this.startingDay)%7,n=a.rows.length,o=0;n>o;o++)a.weekNumbers.push(e(a.rows[o][m].date))}},this.compare=function(a,b){var c=new Date(a.getFullYear(),a.getMonth(),a.getDate()),d=new Date(b.getFullYear(),b.getMonth(),b.getDate());return c.setFullYear(a.getFullYear()),d.setFullYear(b.getFullYear()),c-d},this.handleKeyDown=function(a,b){var c=this.activeDate.getDate();if("left"===a)c-=1;else if("up"===a)c-=7;else if("right"===a)c+=1;else if("down"===a)c+=7;else if("pageup"===a||"pagedown"===a){var e=this.activeDate.getMonth()+("pageup"===a?-1:1);this.activeDate.setMonth(e,1),c=Math.min(d(this.activeDate.getFullYear(),this.activeDate.getMonth()),c)}else"home"===a?c=1:"end"===a&&(c=d(this.activeDate.getFullYear(),this.activeDate.getMonth()));this.activeDate.setDate(c)}}]).controller("UibMonthpickerController",["$scope","$element","dateFilter",function(a,b,c){this.step={years:1},this.element=b,this.init=function(a){angular.extend(a,this),a.refreshView()},this._refreshView=function(){for(var b,d=new Array(12),e=this.activeDate.getFullYear(),f=0;12>f;f++)b=new Date(this.activeDate),b.setFullYear(e,f,1),d[f]=angular.extend(this.createDateObject(b,this.formatMonth),{uid:a.uniqueId+"-"+f});a.title=c(this.activeDate,this.formatMonthTitle),a.rows=this.split(d,this.monthColumns),a.yearHeaderColspan=this.monthColumns>3?this.monthColumns-2:1},this.compare=function(a,b){var c=new Date(a.getFullYear(),a.getMonth()),d=new Date(b.getFullYear(),b.getMonth());return c.setFullYear(a.getFullYear()),d.setFullYear(b.getFullYear()),c-d},this.handleKeyDown=function(a,b){var c=this.activeDate.getMonth();if("left"===a)c-=1;else if("up"===a)c-=this.monthColumns;else if("right"===a)c+=1;else if("down"===a)c+=this.monthColumns;else if("pageup"===a||"pagedown"===a){var d=this.activeDate.getFullYear()+("pageup"===a?-1:1);this.activeDate.setFullYear(d)}else"home"===a?c=0:"end"===a&&(c=11);this.activeDate.setMonth(c)}}]).controller("UibYearpickerController",["$scope","$element","dateFilter",function(a,b,c){function d(a){return parseInt((a-1)/f,10)*f+1}var e,f;this.element=b,this.yearpickerInit=function(){e=this.yearColumns,f=this.yearRows*e,this.step={years:f}},this._refreshView=function(){for(var b,c=new Array(f),g=0,h=d(this.activeDate.getFullYear());f>g;g++)b=new Date(this.activeDate),b.setFullYear(h+g,0,1),c[g]=angular.extend(this.createDateObject(b,this.formatYear),{uid:a.uniqueId+"-"+g});a.title=[c[0].label,c[f-1].label].join(" - "),a.rows=this.split(c,e),a.columns=e},this.compare=function(a,b){return a.getFullYear()-b.getFullYear()},this.handleKeyDown=function(a,b){var c=this.activeDate.getFullYear();"left"===a?c-=1:"up"===a?c-=e:"right"===a?c+=1:"down"===a?c+=e:"pageup"===a||"pagedown"===a?c+=("pageup"===a?-1:1)*f:"home"===a?c=d(this.activeDate.getFullYear()):"end"===a&&(c=d(this.activeDate.getFullYear())+f-1),this.activeDate.setFullYear(c)}}]).directive("uibDatepicker",function(){return{templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/datepicker.html"},scope:{datepickerOptions:"=?"},require:["uibDatepicker","^ngModel"],restrict:"A",controller:"UibDatepickerController",controllerAs:"datepicker",link:function(a,b,c,d){var e=d[0],f=d[1];e.init(f)}}}).directive("uibDaypicker",function(){return{templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/day.html"},
1246require:["^uibDatepicker","uibDaypicker"],restrict:"A",controller:"UibDaypickerController",link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibMonthpicker",function(){return{templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/month.html"},require:["^uibDatepicker","uibMonthpicker"],restrict:"A",controller:"UibMonthpickerController",link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibYearpicker",function(){return{templateUrl:function(a,b){return b.templateUrl||"uib/template/datepicker/year.html"},require:["^uibDatepicker","uibYearpicker"],restrict:"A",controller:"UibYearpickerController",link:function(a,b,c,d){var e=d[0];angular.extend(e,d[1]),e.yearpickerInit(),e.refreshView()}}}),angular.module("ui.bootstrap.position",[]).factory("$uibPosition",["$document","$window",function(a,b){var c,d,e={normal:/(auto|scroll)/,hidden:/(auto|scroll|hidden)/},f={auto:/\s?auto?\s?/i,primary:/^(top|bottom|left|right)$/,secondary:/^(top|bottom|left|right|center)$/,vertical:/^(top|bottom)$/},g=/(HTML|BODY)/;return{getRawNode:function(a){return a.nodeName?a:a[0]||a},parseStyle:function(a){return a=parseFloat(a),isFinite(a)?a:0},offsetParent:function(c){function d(a){return"static"===(b.getComputedStyle(a).position||"static")}c=this.getRawNode(c);for(var e=c.offsetParent||a[0].documentElement;e&&e!==a[0].documentElement&&d(e);)e=e.offsetParent;return e||a[0].documentElement},scrollbarWidth:function(e){if(e){if(angular.isUndefined(d)){var f=a.find("body");f.addClass("uib-position-body-scrollbar-measure"),d=b.innerWidth-f[0].clientWidth,d=isFinite(d)?d:0,f.removeClass("uib-position-body-scrollbar-measure")}return d}if(angular.isUndefined(c)){var g=angular.element('<div class="uib-position-scrollbar-measure"></div>');a.find("body").append(g),c=g[0].offsetWidth-g[0].clientWidth,c=isFinite(c)?c:0,g.remove()}return c},scrollbarPadding:function(a){a=this.getRawNode(a);var c=b.getComputedStyle(a),d=this.parseStyle(c.paddingRight),e=this.parseStyle(c.paddingBottom),f=this.scrollParent(a,!1,!0),h=this.scrollbarWidth(g.test(f.tagName));return{scrollbarWidth:h,widthOverflow:f.scrollWidth>f.clientWidth,right:d+h,originalRight:d,heightOverflow:f.scrollHeight>f.clientHeight,bottom:e+h,originalBottom:e}},isScrollable:function(a,c){a=this.getRawNode(a);var d=c?e.hidden:e.normal,f=b.getComputedStyle(a);return d.test(f.overflow+f.overflowY+f.overflowX)},scrollParent:function(c,d,f){c=this.getRawNode(c);var g=d?e.hidden:e.normal,h=a[0].documentElement,i=b.getComputedStyle(c);if(f&&g.test(i.overflow+i.overflowY+i.overflowX))return c;var j="absolute"===i.position,k=c.parentElement||h;if(k===h||"fixed"===i.position)return h;for(;k.parentElement&&k!==h;){var l=b.getComputedStyle(k);if(j&&"static"!==l.position&&(j=!1),!j&&g.test(l.overflow+l.overflowY+l.overflowX))break;k=k.parentElement}return k},position:function(c,d){c=this.getRawNode(c);var e=this.offset(c);if(d){var f=b.getComputedStyle(c);e.top-=this.parseStyle(f.marginTop),e.left-=this.parseStyle(f.marginLeft)}var g=this.offsetParent(c),h={top:0,left:0};return g!==a[0].documentElement&&(h=this.offset(g),h.top+=g.clientTop-g.scrollTop,h.left+=g.clientLeft-g.scrollLeft),{width:Math.round(angular.isNumber(e.width)?e.width:c.offsetWidth),height:Math.round(angular.isNumber(e.height)?e.height:c.offsetHeight),top:Math.round(e.top-h.top),left:Math.round(e.left-h.left)}},offset:function(c){c=this.getRawNode(c);var d=c.getBoundingClientRect();return{width:Math.round(angular.isNumber(d.width)?d.width:c.offsetWidth),height:Math.round(angular.isNumber(d.height)?d.height:c.offsetHeight),top:Math.round(d.top+(b.pageYOffset||a[0].documentElement.scrollTop)),left:Math.round(d.left+(b.pageXOffset||a[0].documentElement.scrollLeft))}},viewportOffset:function(c,d,e){c=this.getRawNode(c),e=e!==!1;var f=c.getBoundingClientRect(),g={top:0,left:0,bottom:0,right:0},h=d?a[0].documentElement:this.scrollParent(c),i=h.getBoundingClientRect();if(g.top=i.top+h.clientTop,g.left=i.left+h.clientLeft,h===a[0].documentElement&&(g.top+=b.pageYOffset,g.left+=b.pageXOffset),g.bottom=g.top+h.clientHeight,g.right=g.left+h.clientWidth,e){var j=b.getComputedStyle(h);g.top+=this.parseStyle(j.paddingTop),g.bottom-=this.parseStyle(j.paddingBottom),g.left+=this.parseStyle(j.paddingLeft),g.right-=this.parseStyle(j.paddingRight)}return{top:Math.round(f.top-g.top),bottom:Math.round(g.bottom-f.bottom),left:Math.round(f.left-g.left),right:Math.round(g.right-f.right)}},parsePlacement:function(a){var b=f.auto.test(a);return b&&(a=a.replace(f.auto,"")),a=a.split("-"),a[0]=a[0]||"top",f.primary.test(a[0])||(a[0]="top"),a[1]=a[1]||"center",f.secondary.test(a[1])||(a[1]="center"),b?a[2]=!0:a[2]=!1,a},positionElements:function(a,c,d,e){a=this.getRawNode(a),c=this.getRawNode(c);var g=angular.isDefined(c.offsetWidth)?c.offsetWidth:c.prop("offsetWidth"),h=angular.isDefined(c.offsetHeight)?c.offsetHeight:c.prop("offsetHeight");d=this.parsePlacement(d);var i=e?this.offset(a):this.position(a),j={top:0,left:0,placement:""};if(d[2]){var k=this.viewportOffset(a,e),l=b.getComputedStyle(c),m={width:g+Math.round(Math.abs(this.parseStyle(l.marginLeft)+this.parseStyle(l.marginRight))),height:h+Math.round(Math.abs(this.parseStyle(l.marginTop)+this.parseStyle(l.marginBottom)))};if(d[0]="top"===d[0]&&m.height>k.top&&m.height<=k.bottom?"bottom":"bottom"===d[0]&&m.height>k.bottom&&m.height<=k.top?"top":"left"===d[0]&&m.width>k.left&&m.width<=k.right?"right":"right"===d[0]&&m.width>k.right&&m.width<=k.left?"left":d[0],d[1]="top"===d[1]&&m.height-i.height>k.bottom&&m.height-i.height<=k.top?"bottom":"bottom"===d[1]&&m.height-i.height>k.top&&m.height-i.height<=k.bottom?"top":"left"===d[1]&&m.width-i.width>k.right&&m.width-i.width<=k.left?"right":"right"===d[1]&&m.width-i.width>k.left&&m.width-i.width<=k.right?"left":d[1],"center"===d[1])if(f.vertical.test(d[0])){var n=i.width/2-g/2;k.left+n<0&&m.width-i.width<=k.right?d[1]="left":k.right+n<0&&m.width-i.width<=k.left&&(d[1]="right")}else{var o=i.height/2-m.height/2;k.top+o<0&&m.height-i.height<=k.bottom?d[1]="top":k.bottom+o<0&&m.height-i.height<=k.top&&(d[1]="bottom")}}switch(d[0]){case"top":j.top=i.top-h;break;case"bottom":j.top=i.top+i.height;break;case"left":j.left=i.left-g;break;case"right":j.left=i.left+i.width}switch(d[1]){case"top":j.top=i.top;break;case"bottom":j.top=i.top+i.height-h;break;case"left":j.left=i.left;break;case"right":j.left=i.left+i.width-g;break;case"center":f.vertical.test(d[0])?j.left=i.left+i.width/2-g/2:j.top=i.top+i.height/2-h/2}return j.top=Math.round(j.top),j.left=Math.round(j.left),j.placement="center"===d[1]?d[0]:d[0]+"-"+d[1],j},adjustTop:function(a,b,c,d){return-1!==a.indexOf("top")&&c!==d?{top:b.top-d+"px"}:void 0},positionArrow:function(a,c){a=this.getRawNode(a);var d=a.querySelector(".tooltip-inner, .popover-inner");if(d){var e=angular.element(d).hasClass("tooltip-inner"),g=e?a.querySelector(".tooltip-arrow"):a.querySelector(".arrow");if(g){var h={top:"",bottom:"",left:"",right:""};if(c=this.parsePlacement(c),"center"===c[1])return void angular.element(g).css(h);var i="border-"+c[0]+"-width",j=b.getComputedStyle(g)[i],k="border-";k+=f.vertical.test(c[0])?c[0]+"-"+c[1]:c[1]+"-"+c[0],k+="-radius";var l=b.getComputedStyle(e?d:a)[k];switch(c[0]){case"top":h.bottom=e?"0":"-"+j;break;case"bottom":h.top=e?"0":"-"+j;break;case"left":h.right=e?"0":"-"+j;break;case"right":h.left=e?"0":"-"+j}h[c[1]]=l,angular.element(g).css(h)}}}}}]),angular.module("ui.bootstrap.datepickerPopup",["ui.bootstrap.datepicker","ui.bootstrap.position"]).value("$datepickerPopupLiteralWarning",!0).constant("uibDatepickerPopupConfig",{altInputFormats:[],appendToBody:!1,clearText:"Clear",closeOnDateSelection:!0,closeText:"Done",currentText:"Today",datepickerPopup:"yyyy-MM-dd",datepickerPopupTemplateUrl:"uib/template/datepickerPopup/popup.html",datepickerTemplateUrl:"uib/template/datepicker/datepicker.html",html5Types:{date:"yyyy-MM-dd","datetime-local":"yyyy-MM-ddTHH:mm:ss.sss",month:"yyyy-MM"},onOpenFocus:!0,showButtonBar:!0,placement:"auto bottom-left"}).controller("UibDatepickerPopupController",["$scope","$element","$attrs","$compile","$log","$parse","$
1246window","$document","$rootScope","$uibPosition","dateFilter","uibDateParser","uibDatepickerPopupConfig","$timeout","uibDatepickerConfig","$datepickerPopupLiteralWarning",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){function q(b){var c=l.parse(b,x,a.date);if(isNaN(c))for(var d=0;d<J.length;d++)if(c=l.parse(b,J[d],a.date),!isNaN(c))return c;return c}function r(a){if(angular.isNumber(a)&&(a=new Date(a)),!a)return null;if(angular.isDate(a)&&!isNaN(a))return a;if(angular.isString(a)){var b=q(a);if(!isNaN(b))return l.toTimezone(b,H.getOption("timezone"))}return H.getOption("allowInvalid")?a:void 0}function s(a,b){var d=a||b;return c.ngRequired||d?(angular.isNumber(d)&&(d=new Date(d)),d?angular.isDate(d)&&!isNaN(d)?!0:angular.isString(d)?!isNaN(q(d)):!1:!0):!0}function t(c){if(a.isOpen||!a.disabled){var d=I[0],e=b[0].contains(c.target),f=void 0!==d.contains&&d.contains(c.target);!a.isOpen||e||f||a.$apply(function(){a.isOpen=!1})}}function u(c){27===c.which&&a.isOpen?(c.preventDefault(),c.stopPropagation(),a.$apply(function(){a.isOpen=!1}),b[0].focus()):40!==c.which||a.isOpen||(c.preventDefault(),c.stopPropagation(),a.$apply(function(){a.isOpen=!0}))}function v(){if(a.isOpen){var d=angular.element(I[0].querySelector(".uib-datepicker-popup")),e=c.popupPlacement?c.popupPlacement:m.placement,f=j.positionElements(b,d,e,z);d.css({top:f.top+"px",left:f.left+"px"}),d.hasClass("uib-position-measure")&&d.removeClass("uib-position-measure")}}function w(a){var b;return angular.version.minor<6?(b=angular.isObject(a.$options)?a.$options:{timezone:null},b.getOption=function(a){return b[a]}):b=a.$options,b}var x,y,z,A,B,C,D,E,F,G,H,I,J,K=!1,L=[];this.init=function(e){if(G=e,H=w(G),y=angular.isDefined(c.closeOnDateSelection)?a.$parent.$eval(c.closeOnDateSelection):m.closeOnDateSelection,z=angular.isDefined(c.datepickerAppendToBody)?a.$parent.$eval(c.datepickerAppendToBody):m.appendToBody,A=angular.isDefined(c.onOpenFocus)?a.$parent.$eval(c.onOpenFocus):m.onOpenFocus,B=angular.isDefined(c.datepickerPopupTemplateUrl)?c.datepickerPopupTemplateUrl:m.datepickerPopupTemplateUrl,C=angular.isDefined(c.datepickerTemplateUrl)?c.datepickerTemplateUrl:m.datepickerTemplateUrl,J=angular.isDefined(c.altInputFormats)?a.$parent.$eval(c.altInputFormats):m.altInputFormats,a.showButtonBar=angular.isDefined(c.showButtonBar)?a.$parent.$eval(c.showButtonBar):m.showButtonBar,m.html5Types[c.type]?(x=m.html5Types[c.type],K=!0):(x=c.uibDatepickerPopup||m.datepickerPopup,c.$observe("uibDatepickerPopup",function(a,b){var c=a||m.datepickerPopup;if(c!==x&&(x=c,G.$modelValue=null,!x))throw new Error("uibDatepickerPopup must have a date format specified.")})),!x)throw new Error("uibDatepickerPopup must have a date format specified.");if(K&&c.uibDatepickerPopup)throw new Error("HTML5 date input types do not support custom formats.");D=angular.element("<div uib-datepicker-popup-wrap><div uib-datepicker></div></div>"),D.attr({"ng-model":"date","ng-change":"dateSelection(date)","template-url":B}),E=angular.element(D.children()[0]),E.attr("template-url",C),a.datepickerOptions||(a.datepickerOptions={}),K&&"month"===c.type&&(a.datepickerOptions.datepickerMode="month",a.datepickerOptions.minMode="month"),E.attr("datepicker-options","datepickerOptions"),K?G.$formatters.push(function(b){return a.date=l.fromTimezone(b,H.getOption("timezone")),b}):(G.$$parserName="date",G.$validators.date=s,G.$parsers.unshift(r),G.$formatters.push(function(b){return G.$isEmpty(b)?(a.date=b,b):(angular.isNumber(b)&&(b=new Date(b)),a.date=l.fromTimezone(b,H.getOption("timezone")),l.filter(a.date,x))})),G.$viewChangeListeners.push(function(){a.date=q(G.$viewValue)}),b.on("keydown",u),I=d(D)(a),D.remove(),z?h.find("body").append(I):b.after(I),a.$on("$destroy",function(){for(a.isOpen===!0&&(i.$$phase||a.$apply(function(){a.isOpen=!1})),I.remove(),b.off("keydown",u),h.off("click",t),F&&F.off("scroll",v),angular.element(g).off("resize",v);L.length;)L.shift()()})},a.getText=function(b){return a[b+"Text"]||m[b+"Text"]},a.isDisabled=function(b){"today"===b&&(b=l.fromTimezone(new Date,H.getOption("timezone")));var c={};return angular.forEach(["minDate","maxDate"],function(b){a.datepickerOptions[b]?angular.isDate(a.datepickerOptions[b])?c[b]=new Date(a.datepickerOptions[b]):(p&&e.warn("Literal date support has been deprecated, please switch to date object usage"),c[b]=new Date(k(a.datepickerOptions[b],"medium"))):c[b]=null}),a.datepickerOptions&&c.minDate&&a.compare(b,c.minDate)<0||c.maxDate&&a.compare(b,c.maxDate)>0},a.compare=function(a,b){return new Date(a.getFullYear(),a.getMonth(),a.getDate())-new Date(b.getFullYear(),b.getMonth(),b.getDate())},a.dateSelection=function(c){a.date=c;var d=a.date?l.filter(a.date,x):null;b.val(d),G.$setViewValue(d),y&&(a.isOpen=!1,b[0].focus())},a.keydown=function(c){27===c.which&&(c.stopPropagation(),a.isOpen=!1,b[0].focus())},a.select=function(b,c){if(c.stopPropagation(),"today"===b){var d=new Date;angular.isDate(a.date)?(b=new Date(a.date),b.setFullYear(d.getFullYear(),d.getMonth(),d.getDate())):(b=l.fromTimezone(d,H.getOption("timezone")),b.setHours(0,0,0,0))}a.dateSelection(b)},a.close=function(c){c.stopPropagation(),a.isOpen=!1,b[0].focus()},a.disabled=angular.isDefined(c.disabled)||!1,c.ngDisabled&&L.push(a.$parent.$watch(f(c.ngDisabled),function(b){a.disabled=b})),a.$watch("isOpen",function(d){d?a.disabled?a.isOpen=!1:n(function(){v(),A&&a.$broadcast("uib:datepicker.focus"),h.on("click",t);var d=c.popupPlacement?c.popupPlacement:m.placement;z||j.parsePlacement(d)[2]?(F=F||angular.element(j.scrollParent(b)),F&&F.on("scroll",v)):F=null,angular.element(g).on("resize",v)},0,!1):(h.off("click",t),F&&F.off("scroll",v),angular.element(g).off("resize",v))}),a.$on("uib:datepicker.mode",function(){n(v,0,!1)})}]).directive("uibDatepickerPopup",function(){return{require:["ngModel","uibDatepickerPopup"],controller:"UibDatepickerPopupController",scope:{datepickerOptions:"=?",isOpen:"=?",currentText:"@",clearText:"@",closeText:"@"},link:function(a,b,c,d){var e=d[0],f=d[1];f.init(e)}}}).directive("uibDatepickerPopupWrap",function(){return{restrict:"A",transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/datepickerPopup/popup.html"}}}),angular.module("ui.bootstrap.debounce",[]).factory("$$debounce",["$timeout",function(a){return function(b,c){var d;return function(){var e=this,f=Array.prototype.slice.call(arguments);d&&a.cancel(d),d=a(function(){b.apply(e,f)},c)}}}]),angular.module("ui.bootstrap.multiMap",[]).factory("$$multiMap",function(){return{createNew:function(){var a={};return{entries:function(){return Object.keys(a).map(function(b){return{key:b,value:a[b]}})},get:function(b){return a[b]},hasKey:function(b){return!!a[b]},keys:function(){return Object.keys(a)},put:function(b,c){a[b]||(a[b]=[]),a[b].push(c)},remove:function(b,c){var d=a[b];if(d){var e=d.indexOf(c);-1!==e&&d.splice(e,1),d.length||delete a[b]}}}}}}),angular.module("ui.bootstrap.dropdown",["ui.bootstrap.multiMap","ui.bootstrap.position"]).constant("uibDropdownConfig",{appendToOpenClass:"uib-dropdown-open",openClass:"open"}).service("uibDropdownService",["$document","$rootScope","$$multiMap",function(a,b,c){var d=null,e=c.createNew();this.isOnlyOpen=function(a,b){var c=e.get(b);if(c){var d=c.reduce(function(b,c){return c.scope===a?c:b},{});if(d)return 1===c.length}return!1},this.open=function(b,c,g){if(d||a.on("click",f),d&&d!==b&&(d.isOpen=!1),d=b,g){var h=e.get(g);if(h){var i=h.map(function(a){return a.scope});-1===i.indexOf(b)&&e.put(g,{scope:b})}else e.put(g,{scope:b})}},this.close=function(b,c,g){if(d===b&&(a.off("click",f),a.off("keydown",this.keybindFilter),d=null),g){var h=e.get(g);if(h){var i=h.reduce(function(a,c){return c.scope===b?c:a},{});i&&e.remove(g,i)}}};
vendor: 9,649 bytes, line 1246
1246var f=function(a){if(d&&d.isOpen&&!(a&&"disabled"===d.getAutoClose()||a&&3===a.which)){var c=d.getToggleElement();if(!(a&&c&&c[0].contains(a.target))){var e=d.getDropdownElement();a&&"outsideClick"===d.getAutoClose()&&e&&e[0].contains(a.target)||(d.focusToggleElement(),d.isOpen=!1,b.$$phase||d.$apply())}}};this.keybindFilter=function(a){if(d){var b=d.getDropdownElement(),c=d.getToggleElement(),e=b&&b[0].contains(a.target),g=c&&c[0].contains(a.target);27===a.which?(a.stopPropagation(),d.focusToggleElement(),f()):d.isKeynavEnabled()&&-1!==[38,40].indexOf(a.which)&&d.isOpen&&(e||g)&&(a.preventDefault(),a.stopPropagation(),d.focusDropdownEntry(a.which))}}}]).controller("UibDropdownController",["$scope","$element","$attrs","$parse","uibDropdownConfig","uibDropdownService","$animate","$uibPosition","$document","$compile","$templateRequest",function(a,b,c,d,e,f,g,h,i,j,k){function l(){b.append(o.dropdownMenu)}var m,n,o=this,p=a.$new(),q=e.appendToOpenClass,r=e.openClass,s=angular.noop,t=c.onToggle?d(c.onToggle):angular.noop,u=!1,v=i.find("body");b.addClass("dropdown"),this.init=function(){c.isOpen&&(n=d(c.isOpen),s=n.assign,a.$watch(n,function(a){p.isOpen=!!a})),u=angular.isDefined(c.keyboardNav)},this.toggle=function(a){return p.isOpen=arguments.length?!!a:!p.isOpen,angular.isFunction(s)&&s(p,p.isOpen),p.isOpen},this.isOpen=function(){return p.isOpen},p.getToggleElement=function(){return o.toggleElement},p.getAutoClose=function(){return c.autoClose||"always"},p.getElement=function(){return b},p.isKeynavEnabled=function(){return u},p.focusDropdownEntry=function(a){var c=o.dropdownMenu?angular.element(o.dropdownMenu).find("a"):b.find("ul").eq(0).find("a");switch(a){case 40:angular.isNumber(o.selectedOption)?o.selectedOption=o.selectedOption===c.length-1?o.selectedOption:o.selectedOption+1:o.selectedOption=0;break;case 38:angular.isNumber(o.selectedOption)?o.selectedOption=0===o.selectedOption?0:o.selectedOption-1:o.selectedOption=c.length-1}c[o.selectedOption].focus()},p.getDropdownElement=function(){return o.dropdownMenu},p.focusToggleElement=function(){o.toggleElement&&o.toggleElement[0].focus()},p.$watch("isOpen",function(e,n){var u=null,w=!1;if(angular.isDefined(c.dropdownAppendTo)){var x=d(c.dropdownAppendTo)(p);x&&(u=angular.element(x))}if(angular.isDefined(c.dropdownAppendToBody)){var y=d(c.dropdownAppendToBody)(p);y!==!1&&(w=!0)}if(w&&!u&&(u=v),u&&o.dropdownMenu&&(e?(u.append(o.dropdownMenu),b.on("$destroy",l)):(b.off("$destroy",l),l())),u&&o.dropdownMenu){var z,A,B,C=h.positionElements(b,o.dropdownMenu,"bottom-left",!0),D=0;if(z={top:C.top+"px",display:e?"block":"none"},A=o.dropdownMenu.hasClass("dropdown-menu-right"),A?(z.left="auto",B=h.scrollbarPadding(u),B.heightOverflow&&B.scrollbarWidth&&(D=B.scrollbarWidth),z.right=window.innerWidth-D-(C.left+b.prop("offsetWidth"))+"px"):(z.left=C.left+"px",z.right="auto"),!w){var E=h.offset(u);z.top=C.top-E.top+"px",A?z.right=window.innerWidth-(C.left-E.left+b.prop("offsetWidth"))+"px":z.left=C.left-E.left+"px"}o.dropdownMenu.css(z)}var F=u?u:b,G=u?q:r,H=F.hasClass(G),I=f.isOnlyOpen(a,u);if(H===!e){var J;J=u?I?"removeClass":"addClass":e?"addClass":"removeClass",g[J](F,G).then(function(){angular.isDefined(e)&&e!==n&&t(a,{open:!!e})})}if(e)o.dropdownMenuTemplateUrl?k(o.dropdownMenuTemplateUrl).then(function(a){m=p.$new(),j(a.trim())(m,function(a){var b=a;o.dropdownMenu.replaceWith(b),o.dropdownMenu=b,i.on("keydown",f.keybindFilter)})}):i.on("keydown",f.keybindFilter),p.focusToggleElement(),f.open(p,b,u);else{if(f.close(p,b,u),o.dropdownMenuTemplateUrl){m&&m.$destroy();var K=angular.element('<ul class="dropdown-menu"></ul>');o.dropdownMenu.replaceWith(K),o.dropdownMenu=K}o.selectedOption=null}angular.isFunction(s)&&s(a,e)})}]).directive("uibDropdown",function(){return{controller:"UibDropdownController",link:function(a,b,c,d){d.init()}}}).directive("uibDropdownMenu",function(){return{restrict:"A",require:"?^uibDropdown",link:function(a,b,c,d){if(d&&!angular.isDefined(c.dropdownNested)){b.addClass("dropdown-menu");var e=c.templateUrl;e&&(d.dropdownMenuTemplateUrl=e),d.dropdownMenu||(d.dropdownMenu=b)}}}}).directive("uibDropdownToggle",function(){return{require:"?^uibDropdown",link:function(a,b,c,d){if(d){b.addClass("dropdown-toggle"),d.toggleElement=b;var e=function(e){e.preventDefault(),b.hasClass("disabled")||c.disabled||a.$apply(function(){d.toggle()})};b.on("click",e),b.attr({"aria-haspopup":!0,"aria-expanded":!1}),a.$watch(d.isOpen,function(a){b.attr("aria-expanded",!!a)}),a.$on("$destroy",function(){b.off("click",e)})}}}}),angular.module("ui.bootstrap.stackedMap",[]).factory("$$stackedMap",function(){return{createNew:function(){var a=[];return{add:function(b,c){a.push({key:b,value:c})},get:function(b){for(var c=0;c<a.length;c++)if(b===a[c].key)return a[c]},keys:function(){for(var b=[],c=0;c<a.length;c++)b.push(a[c].key);return b},top:function(){return a[a.length-1]},remove:function(b){for(var c=-1,d=0;d<a.length;d++)if(b===a[d].key){c=d;break}return a.splice(c,1)[0]},removeTop:function(){return a.pop()},length:function(){return a.length}}}}}),angular.module("ui.bootstrap.modal",["ui.bootstrap.multiMap","ui.bootstrap.stackedMap","ui.bootstrap.position"]).provider("$uibResolve",function(){var a=this;this.resolver=null,this.setResolver=function(a){this.resolver=a},this.$get=["$injector","$q",function(b,c){var d=a.resolver?b.get(a.resolver):null;return{resolve:function(a,e,f,g){if(d)return d.resolve(a,e,f,g);var h=[];return angular.forEach(a,function(a){angular.isFunction(a)||angular.isArray(a)?h.push(c.resolve(b.invoke(a))):angular.isString(a)?h.push(c.resolve(b.get(a))):h.push(c.resolve(a))}),c.all(h).then(function(b){var c={},d=0;return angular.forEach(a,function(a,e){c[e]=b[d++]}),c})}}}]}).directive("uibModalBackdrop",["$animate","$injector","$uibModalStack",function(a,b,c){function d(b,d,e){e.modalInClass&&(a.addClass(d,e.modalInClass),b.$on(c.NOW_CLOSING_EVENT,function(c,f){var g=f();b.modalOptions.animation?a.removeClass(d,e.modalInClass).then(g):g()}))}return{restrict:"A",compile:function(a,b){return a.addClass(b.backdropClass),d}}}]).directive("uibModalWindow",["$uibModalStack","$q","$animateCss","$document",function(a,b,c,d){return{scope:{index:"@"},restrict:"A",transclude:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/modal/window.html"},link:function(e,f,g){f.addClass(g.windowTopClass||""),e.size=g.size,e.close=function(b){var c=a.getTop();c&&c.value.backdrop&&"static"!==c.value.backdrop&&b.target===b.currentTarget&&(b.preventDefault(),b.stopPropagation(),a.dismiss(c.key,"backdrop click"))},f.on("click",e.close),e.$isRendered=!0;var h=b.defer();e.$$postDigest(function(){h.resolve()}),h.promise.then(function(){var h=null;g.modalInClass&&(h=c(f,{addClass:g.modalInClass}).start(),e.$on(a.NOW_CLOSING_EVENT,function(a,b){var d=b();c(f,{removeClass:g.modalInClass}).start().then(d)})),b.when(h).then(function(){var b=a.getTop();if(b&&a.modalRendered(b.key),!d[0].activeElement||!f[0].contains(d[0].activeElement)){var c=f[0].querySelector("[autofocus]");c?c.focus():f[0].focus()}})})}}}]).directive("uibModalAnimationClass",function(){return{compile:function(a,b){b.modalAnimation&&a.addClass(b.uibModalAnimationClass)}}}).directive("uibModalTransclude",["$animate",function(a){return{link:function(b,c,d,e,f){f(b.$parent,function(b){c.empty(),a.enter(b,c)})}}}]).factory("$uibModalStack",["$animate","$animateCss","$document","$compile","$rootScope","$q","$$multiMap","$$stackedMap","$uibPosition",function(a,b,c,d,e,f,g,h,i){function j(a){var b="-";return a.replace(E,function(a,c){return(c?b:"")+a.toLowerCase()})}function k(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)}function l(){for(var a=-1,b=x.keys(),c=0;c<b.length;c++)x.get(b[c]).value.backdrop&&(a=c);return a>-1&&A>a&&(a=A),a}function m(a,b){var c=x.get(a).value,d=c.appendTo;x.remove(a),B=x.top(),B&&(A=parseInt(B.value.modalDomEl.attr("index"),10)),p(c.modalDomEl,c.modalScope,function(){var b=c.openedClass||w;y.remove(b,a);var e=y.hasKey(b);d.toggleClass(b,e),!e&&v&&v.heightOverflow&&v.scrollbarWidth&&(v.originalRight?d.css({paddingRight:v.originalRight+"px"}):d.css({paddingRight:""}),v=null),n(!0)},c.closedDeferred),o(),b&&b.focus?b.focus():d.focus&&d.focus()}function n(a){var b;x.length()>0&&(b=x.top().value,b.modalDomEl.toggleClass(b.windowTopClass||"",a))}function o(){if(t&&-1===l()){var a=u;p(t,u,function(){a=null}),t=void 0,u=void 0}}function p(b,c,d,e){function g(){g.done||(g.done=!0,a.leave(b).then(function(){d&&d(),b.remove(),e&&e.resolve()}),c.$destroy())}var h,i=null,j=function(){return h||(h=f.defer(),i=h.promise),function(){h.resolve()}};return c.$broadcast(z.NOW_CLOSING_EVENT,j),f.when(i).then(g)}function q(a){if(a.isDefaultPrevented())return a;var b=x.top();if(b)switch(a.which){case 27:b.value.keyboard&&(a.preventDefault(),e.$apply(function(){z.dismiss(b.key,"escape key press")}));break;case 9:var c=z.loadFocusElementList(b),d=!1;a.shiftKey?(z.isFocusInFirstItem(a,c)||z.isModalFocused(a,b))&&(d=z.focusLastFocusableElement(c)):z.isFocusInLastItem(a,c)&&(d=z.focusFirstFocusableElement(c)),d&&(a.preventDefault(),a.stopPropagation())}}function r(a,b,c){return!a.value.modalScope.$broadcast("modal.closing",b,c).defaultPrevented}function s(){Array.prototype.forEach.call(document.querySelectorAll("["+C+"]"),function(a){var b=parseInt(a.getAttribute(C),10),c=b-1;a.setAttribute(C,c),c||(a.removeAttribute(C),a.removeAttribute("aria-hidden"))})}var t,u,v,w="modal-open",x=h.createNew(),y=g.createNew(),z={NOW_CLOSING_EVENT:"modal.stack.now-closing"},A=0,B=null,C="data-bootstrap-modal-aria-hidden-count",D="a[href], area[href], input
1246:not([disabled]):not([tabindex='-1']), button:not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']), textarea:not([disabled]):not([tabindex='-1']), iframe, object, embed, *[tabindex]:not([tabindex='-1']), *[contenteditable=true]",E=/[A-Z]/g;return e.$watch(l,function(a){u&&(u.index=a)}),c.on("keydown",q),e.$on("$destroy",function(){c.off("keydown",q)}),z.open=function(b,f){function g(a){function b(a){var b=a.parent()?a.parent().children():[];return Array.prototype.filter.call(b,function(b){return b!==a[0]})}if(a&&"BODY"!==a[0].tagName)return b(a).forEach(function(a){var b="true"===a.getAttribute("aria-hidden"),c=parseInt(a.getAttribute(C),10);c||(c=b?1:0),a.setAttribute(C,c+1),a.setAttribute("aria-hidden","true")}),g(a.parent())}var h=c[0].activeElement,k=f.openedClass||w;n(!1),B=x.top(),x.add(b,{deferred:f.deferred,renderDeferred:f.renderDeferred,closedDeferred:f.closedDeferred,modalScope:f.scope,backdrop:f.backdrop,keyboard:f.keyboard,openedClass:f.openedClass,windowTopClass:f.windowTopClass,animation:f.animation,appendTo:f.appendTo}),y.put(k,b);var m=f.appendTo,o=l();o>=0&&!t&&(u=e.$new(!0),u.modalOptions=f,u.index=o,t=angular.element('<div uib-modal-backdrop="modal-backdrop"></div>'),t.attr({"class":"modal-backdrop","ng-style":"{'z-index': 1040 + (index && 1 || 0) + index*10}","uib-modal-animation-class":"fade","modal-in-class":"in"}),f.backdropClass&&t.addClass(f.backdropClass),f.animation&&t.attr("modal-animation","true"),d(t)(u),a.enter(t,m),i.isScrollable(m)&&(v=i.scrollbarPadding(m),v.heightOverflow&&v.scrollbarWidth&&m.css({paddingRight:v.right+"px"})));var p;f.component?(p=document.createElement(j(f.component.name)),p=angular.element(p),p.attr({resolve:"$resolve","modal-instance":"$uibModalInstance",close:"$close($value)",dismiss:"$dismiss($value)"})):p=f.content,A=B?parseInt(B.value.modalDomEl.attr("index"),10)+1:0;var q=angular.element('<div uib-modal-window="modal-window"></div>');q.attr({"class":"modal","template-url":f.windowTemplateUrl,"window-top-class":f.windowTopClass,role:"dialog","aria-labelledby":f.ariaLabelledBy,"aria-describedby":f.ariaDescribedBy,size:f.size,index:A,animate:"animate","ng-style":"{'z-index': 1050 + $$topModalIndex*10, display: 'block'}",tabindex:-1,"uib-modal-animation-class":"fade","modal-in-class":"in"}).append(p),f.windowClass&&q.addClass(f.windowClass),f.animation&&q.attr("modal-animation","true"),m.addClass(k),f.scope&&(f.scope.$$topModalIndex=A),a.enter(d(q)(f.scope),m),x.top().value.modalDomEl=q,x.top().value.modalOpener=h,g(q)},z.close=function(a,b){var c=x.get(a);return s(),c&&r(c,b,!0)?(c.value.modalScope.$$uibDestructionScheduled=!0,c.value.deferred.resolve(b),m(a,c.value.modalOpener),!0):!c},z.dismiss=function(a,b){var c=x.get(a);return s(),c&&r(c,b,!1)?(c.value.modalScope.$$uibDestructionScheduled=!0,c.value.deferred.reject(b),m(a,c.value.modalOpener),!0):!c},z.dismissAll=function(a){for(var b=this.getTop();b&&this.dismiss(b.key,a);)b=this.getTop()},z.getTop=function(){return x.top()},z.modalRendered=function(a){var b=x.get(a);b&&b.value.renderDeferred.resolve()},z.focusFirstFocusableElement=function(a){return a.length>0?(a[0].focus(),!0):!1},z.focusLastFocusableElement=function(a){return a.length>0?(a[a.length-1].focus(),!0):!1},z.isModalFocused=function(a,b){if(a&&b){var c=b.value.modalDomEl;if(c&&c.length)return(a.target||a.srcElement)===c[0]}return!1},z.isFocusInFirstItem=function(a,b){return b.length>0?(a.target||a.srcElement)===b[0]:!1},z.isFocusInLastItem=function(a,b){return b.length>0?(a.target||a.srcElement)===b[b.length-1]:!1},z.loadFocusElementList=function(a){if(a){var b=a.value.modalDomEl;if(b&&b.length){var c=b[0].querySelectorAll(D);return c?Array.prototype.filter.call(c,function(a){return k(a)}):c}}},z}]).provider("$uibModal",function(){var a={options:{animation:!0,backdrop:!0,keyboard:!0},$get:["$rootScope","$q","$document","$templateRequest","$controller","$uibResolve","$uibModalStack",function(b,c,d,e,f,g,h){function i(a){return a.template?c.when(a.template):e(angular.isFunction(a.templateUrl)?a.templateUrl():a.templateUrl)}var j={},k=null;return j.getPromiseChain=function(){return k},j.open=function(e){function j(){return q}var l=c.defer(),m=c.defer(),n=c.defer(),o=c.defer(),p={result:l.promise,opened:m.promise,closed:n.promise,rendered:o.promise,close:function(a){return h.close(p,a)}
vendor: 9,409 bytes, lines 1246-1247
1246,dismiss:function(a){return h.dismiss(p,a)}};if(e=angular.extend({},a.options,e),e.resolve=e.resolve||{},e.appendTo=e.appendTo||d.find("body").eq(0),!e.appendTo.length)throw new Error("appendTo element not found. Make sure that the element passed is in DOM.");if(!e.component&&!e.template&&!e.templateUrl)throw new Error("One of component or template or templateUrl options is required.");var q;q=e.component?c.when(g.resolve(e.resolve,{},null,null)):c.all([i(e),g.resolve(e.resolve,{},null,null)]);var r;return r=k=c.all([k]).then(j,j).then(function(a){function c(b,c,d,e){b.$scope=g,b.$scope.$resolve={},d?b.$scope.$uibModalInstance=p:b.$uibModalInstance=p;var f=c?a[1]:a;angular.forEach(f,function(a,c){e&&(b[c]=a),b.$scope.$resolve[c]=a})}var d=e.scope||b,g=d.$new();g.$close=p.close,g.$dismiss=p.dismiss,g.$on("$destroy",function(){g.$$uibDestructionScheduled||g.$dismiss("$uibUnscheduledDestruction")});var i,j,k={scope:g,deferred:l,renderDeferred:o,closedDeferred:n,animation:e.animation,backdrop:e.backdrop,keyboard:e.keyboard,backdropClass:e.backdropClass,windowTopClass:e.windowTopClass,windowClass:e.windowClass,windowTemplateUrl:e.windowTemplateUrl,ariaLabelledBy:e.ariaLabelledBy,ariaDescribedBy:e.ariaDescribedBy,size:e.size,openedClass:e.openedClass,appendTo:e.appendTo},q={},r={};e.component?(c(q,!1,!0,!1),q.name=e.component,k.component=q):e.controller&&(c(r,!0,!1,!0),j=f(e.controller,r,!0,e.controllerAs),e.controllerAs&&e.bindToController&&(i=j.instance,i.$close=g.$close,i.$dismiss=g.$dismiss,angular.extend(i,{$resolve:r.$scope.$resolve},d)),i=j(),angular.isFunction(i.$onInit)&&i.$onInit()),e.component||(k.content=a[0]),h.open(p,k),m.resolve(!0)},function(a){m.reject(a),l.reject(a)})["finally"](function(){k===r&&(k=null)}),p},j}]};return a}),angular.module("ui.bootstrap.paging",[]).factory("uibPaging",["$parse",function(a){return{create:function(b,c,d){b.setNumPages=d.numPages?a(d.numPages).assign:angular.noop,b.ngModelCtrl={$setViewValue:angular.noop},b._watchers=[],b.init=function(a,e){b.ngModelCtrl=a,b.config=e,a.$render=function(){b.render()},d.itemsPerPage?b._watchers.push(c.$parent.$watch(d.itemsPerPage,function(a){
1247b.itemsPerPage=parseInt(a,10),c.totalPages=b.calculateTotalPages(),b.updatePage()})):b.itemsPerPage=e.itemsPerPage,c.$watch("totalItems",function(a,d){(angular.isDefined(a)||a!==d)&&(c.totalPages=b.calculateTotalPages(),b.updatePage())})},b.calculateTotalPages=function(){var a=b.itemsPerPage<1?1:Math.ceil(c.totalItems/b.itemsPerPage);return Math.max(a||0,1)},b.render=function(){c.page=parseInt(b.ngModelCtrl.$viewValue,10)||1},c.selectPage=function(a,d){d&&d.preventDefault();var e=!c.ngDisabled||!d;e&&c.page!==a&&a>0&&a<=c.totalPages&&(d&&d.target&&d.target.blur(),b.ngModelCtrl.$setViewValue(a),b.ngModelCtrl.$render())},c.getText=function(a){return c[a+"Text"]||b.config[a+"Text"]},c.noPrevious=function(){return 1===c.page},c.noNext=function(){return c.page===c.totalPages},b.updatePage=function(){b.setNumPages(c.$parent,c.totalPages),c.page>c.totalPages?c.selectPage(c.totalPages):b.ngModelCtrl.$render()},c.$on("$destroy",function(){for(;b._watchers.length;)b._watchers.shift()()})}}}]),angular.module("ui.bootstrap.pager",["ui.bootstrap.paging","ui.bootstrap.tabindex"]).controller("UibPagerController",["$scope","$attrs","uibPaging","uibPagerConfig",function(a,b,c,d){a.align=angular.isDefined(b.align)?a.$parent.$eval(b.align):d.align,c.create(this,a,b)}]).constant("uibPagerConfig",{itemsPerPage:10,previousText:"« Previous",nextText:"Next »",align:!0}).directive("uibPager",["uibPagerConfig",function(a){return{scope:{totalItems:"=",previousText:"@",nextText:"@",ngDisabled:"="},require:["uibPager","?ngModel"],restrict:"A",controller:"UibPagerController",controllerAs:"pager",templateUrl:function(a,b){return b.templateUrl||"uib/template/pager/pager.html"},link:function(b,c,d,e){c.addClass("pager");var f=e[0],g=e[1];g&&f.init(g,a)}}}]),angular.module("ui.bootstrap.pagination",["ui.bootstrap.paging","ui.bootstrap.tabindex"]).controller("UibPaginationController",["$scope","$attrs","$parse","uibPaging","uibPaginationConfig",function(a,b,c,d,e){function f(a,b,c){return{number:a,text:b,active:c}}function g(a,b){var c=[],d=1,e=b,g=angular.isDefined(i)&&b>i;g&&(j?(d=Math.max(a-Math.floor(i/2),1),e=d+i-1,e>b&&(e=b,d=e-i+1)):(d=(Math.ceil(a/i)-1)*i+1,e=Math.min(d+i-1,b)));for(var h=d;e>=h;h++){var n=f(h,m(h),h===a);c.push(n)}if(g&&i>0&&(!j||k||l)){if(d>1){if(!l||d>3){var o=f(d-1,"...",!1);c.unshift(o)}if(l){if(3===d){var p=f(2,"2",!1);c.unshift(p)}var q=f(1,"1",!1);c.unshift(q)}}if(b>e){if(!l||b-2>e){var r=f(e+1,"...",!1);c.push(r)}if(l){if(e===b-2){var s=f(b-1,b-1,!1);c.push(s)}var t=f(b,b,!1);c.push(t)}}}return c}var h=this,i=angular.isDefined(b.maxSize)?a.$parent.$eval(b.maxSize):e.maxSize,j=angular.isDefined(b.rotate)?a.$parent.$eval(b.rotate):e.rotate,k=angular.isDefined(b.forceEllipses)?a.$parent.$eval(b.forceEllipses):e.forceEllipses,l=angular.isDefined(b.boundaryLinkNumbers)?a.$parent.$eval(b.boundaryLinkNumbers):e.boundaryLinkNumbers,m=angular.isDefined(b.pageLabel)?function(c){return a.$parent.$eval(b.pageLabel,{$page:c})}:angular.identity;a.boundaryLinks=angular.isDefined(b.boundaryLinks)?a.$parent.$eval(b.boundaryLinks):e.boundaryLinks,a.directionLinks=angular.isDefined(b.directionLinks)?a.$parent.$eval(b.directionLinks):e.directionLinks,b.$set("role","menu"),d.create(this,a,b),b.maxSize&&h._watchers.push(a.$parent.$watch(c(b.maxSize),function(a){i=parseInt(a,10),h.render()}));var n=this.render;this.render=function(){n(),a.page>0&&a.page<=a.totalPages&&(a.pages=g(a.page,a.totalPages))}}]).constant("uibPaginationConfig",{itemsPerPage:10,boundaryLinks:!1,boundaryLinkNumbers:!1,directionLinks:!0,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last",rotate:!0,forceEllipses:!1}).directive("uibPagination",["$parse","uibPaginationConfig",function(a,b){return{scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@",ngDisabled:"="},require:["uibPagination","?ngModel"],restrict:"A",controller:"UibPaginationController",controllerAs:"pagination",templateUrl:function(a,b){return b.templateUrl||"uib/template/pagination/pagination.html"},link:function(a,c,d,e){c.addClass("pagination");var f=e[0],g=e[1];g&&f.init(g,b)}}}]),angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position","ui.bootstrap.stackedMap"]).provider("$uibTooltip",function(){function a(a){var b=/[A-Z]/g,c="-";return a.replace(b,function(a,b){return(b?c:"")+a.toLowerCase()})}var b={placement:"top",placementClassPrefix:"",animation:!0,popupDelay:0,popupCloseDelay:0,useContentExp:!1},c={mouseenter:"mouseleave",click:"click",outsideClick:"outsideClick",focus:"blur",none:""},d={};this.options=function(a){angular.extend(d,a)},this.setTriggers=function(a){angular.extend(c,a)},this.$get=["$window","$compile","$timeout","$document","$uibPosition","$interpolate","$rootScope","$parse","$$stackedMap",function(e,f,g,h,i,j,k,l,m){function n(a){if(27===a.which){var b=o.top();b&&(b.value.close(),b=null)}}var o=m.createNew();return h.on("keyup",n),k.$on("$destroy",function(){h.off("keyup",n)}),function(e,k,m,n){function p(a){var b=(a||n.trigger||m).split(" "),d=b.map(function(a){return c[a]||a});return{show:b,hide:d}}n=angular.extend({},b,d,n);var q=a(e),r=j.startSymbol(),s=j.endSymbol(),t="<div "+q+'-popup uib-title="'+r+"title"+s+'" '+(n.useContentExp?'content-exp="contentExp()" ':'content="'+r+"content"+s+'" ')+'origin-scope="origScope" class="uib-position-measure '+k+'" tooltip-animation-class="fade"uib-tooltip-classes ng-class="{ in: isOpen }" ></div>';return{compile:function(a,b){var c=f(t);return function(a,b,d,f){function j(){P.isOpen?q():m()}function m(){O&&!a.$eval(d[k+"Enable"])||(u(),x(),P.popupDelay?H||(H=g(r,P.popupDelay,!1)):r())}function q(){s(),P.popupCloseDelay?I||(I=g(t,P.popupCloseDelay,!1)):t()}function r(){return s(),u(),P.content?(v(),void P.$evalAsync(function(){P.isOpen=!0,y(!0),U()})):angular.noop}function s(){H&&(g.cancel(H),H=null),J&&(g.cancel(J),J=null)}function t(){P&&P.$evalAsync(function(){P&&(P.isOpen=!1,y(!1),P.animation?G||(G=g(w,150,!1)):w())})}function u(){I&&(g.cancel(I),I=null),G&&(g.cancel(G),G=null)}function v(){E||(F=P.$new(),E=c(F,function(a){M?h.find("body").append(a):b.after(a)}),o.add(P,{close:t}),z())}function w(){s(),u(),A(),E&&(E.remove(),E=null,K&&g.cancel(K)),o.remove(P),F&&(F.$destroy(),F=null)}function x(){P.title=d[k+"Title"],S?P.content=S(a):P.content=d[e],P.popupClass=d[k+"Class"],P.placement=angular.isDefined(d[k+"Placement"])?d[k+"Placement"]:n.placement;var b=i.parsePlacement(P.placement);L=b[1]?b[0]+"-"+b[1]:b[0];var c=parseInt(d[k+"PopupDelay"],10),f=parseInt(d[k+"PopupCloseDelay"],10);P.popupDelay=isNaN(c)?n.popupDelay:c,P.popupCloseDelay=isNaN(f)?n.popupCloseDelay:f}function y(b){R&&angular.isFunction(R.assign)&&R.assign(a,b)}function z(){T.length=0,S?(T.push(a.$watch(S,function(a){P.content=a,!a&&P.isOpen&&t()})),T.push(F.$watch(function(){Q||(Q=!0,F.$$postDigest(function(){Q=!1,P&&P.isOpen&&U()}))}))):T.push(d.$observe(e,function(a){P.content=a,!a&&P.isOpen?t():U()})),T.push(d.$observe(k+"Title",function(a){P.title=a,P.isOpen&&U()})),T.push(d.$observe(k+"Placement",function(a){P.placement=a?a:n.placement,P.isOpen&&U()}))}function A(){T.length&&(angular.forEach(T,function(a){a()}),T.length=0)}function B(a){P&&P.isOpen&&E&&(b[0].contains(a.target)||E[0].contains(a.target)||q())}
vendor: 5,491 bytes, line 1247
1247function C(a){27===a.which&&q()}function D(){var c=[],e=[],f=a.$eval(d[k+"Trigger"]);V(),angular.isObject(f)?(Object.keys(f).forEach(function(a){c.push(a),e.push(f[a])}),N={show:c,hide:e}):N=p(f),"none"!==N.show&&N.show.forEach(function(a,c){"outsideClick"===a?(b.on("click",j),h.on("click",B)):a===N.hide[c]?b.on(a,j):a&&(b.on(a,m),b.on(N.hide[c],q)),b.on("keypress",C)})}var E,F,G,H,I,J,K,L,M=angular.isDefined(n.appendToBody)?n.appendToBody:!1,N=p(void 0),O=angular.isDefined(d[k+"Enable"]),P=a.$new(!0),Q=!1,R=angular.isDefined(d[k+"IsOpen"])?l(d[k+"IsOpen"]):!1,S=n.useContentExp?l(d[e]):!1,T=[],U=function(){E&&E.html()&&(J||(J=g(function(){var a=i.positionElements(b,E,P.placement,M),c=angular.isDefined(E.offsetHeight)?E.offsetHeight:E.prop("offsetHeight"),d=M?i.offset(b):i.position(b);E.css({top:a.top+"px",left:a.left+"px"});var e=a.placement.split("-");E.hasClass(e[0])||(E.removeClass(L.split("-")[0]),E.addClass(e[0])),E.hasClass(n.placementClassPrefix+a.placement)||(E.removeClass(n.placementClassPrefix+L),E.addClass(n.placementClassPrefix+a.placement)),K=g(function(){var a=angular.isDefined(E.offsetHeight)?E.offsetHeight:E.prop("offsetHeight"),b=i.adjustTop(e,d,c,a);b&&E.css(b),K=null},0,!1),E.hasClass("uib-position-measure")?(i.positionArrow(E,a.placement),E.removeClass("uib-position-measure")):L!==a.placement&&i.positionArrow(E,a.placement),L=a.placement,J=null},0,!1)))};P.origScope=a,P.isOpen=!1,P.contentExp=function(){return P.content},d.$observe("disabled",function(a){a&&s(),a&&P.isOpen&&t()}),R&&a.$watch(R,function(a){P&&!a===P.isOpen&&j()});var V=function(){N.show.forEach(function(a){"outsideClick"===a?b.off("click",j):(b.off(a,m),b.off(a,j)),b.off("keypress",C)}),N.hide.forEach(function(a){"outsideClick"===a?h.off("click",B):b.off(a,q)})};D();var W=a.$eval(d[k+"Animation"]);P.animation=angular.isDefined(W)?!!W:n.animation;var X,Y=k+"AppendToBody";X=Y in d&&void 0===d[Y]?!0:a.$eval(d[Y]),M=angular.isDefined(X)?X:M,a.$on("$destroy",function(){V(),w(),P=null})}}}}}]}).directive("uibTooltipTemplateTransclude",["$animate","$sce","$compile","$templateRequest",function(a,b,c,d){return{link:function(e,f,g){var h,i,j,k=e.$eval(g.tooltipTemplateTranscludeScope),l=0,m=function(){i&&(i.remove(),i=null),h&&(h.$destroy(),h=null),j&&(a.leave(j).then(function(){i=null}),i=j,j=null)};e.$watch(b.parseAsResourceUrl(g.uibTooltipTemplateTransclude),function(b){var g=++l;b?(d(b,!0).then(function(d){if(g===l){var e=k.$new(),i=d,n=c(i)(e,function(b){m(),a.enter(b,f)});h=e,j=n,h.$emit("$includeContentLoaded",b)}},function(){g===l&&(m(),e.$emit("$includeContentError",b))}),e.$emit("$includeContentRequested",b)):m()}),e.$on("$destroy",m)}}}]).directive("uibTooltipClasses",["$uibPosition",function(a){return{restrict:"A",link:function(b,c,d){if(b.placement){var e=a.parsePlacement(b.placement);c.addClass(e[0])}b.popupClass&&c.addClass(b.popupClass),b.animation&&c.addClass(d.tooltipAnimationClass)}}}]).directive("uibTooltipPopup",function(){return{restrict:"A",scope:{content:"@"},templateUrl:"uib/template/tooltip/tooltip-popup.html"}}).directive("uibTooltip",["$uibTooltip",function(a){return a("uibTooltip","tooltip","mouseenter")}]).directive("uibTooltipTemplatePopup",function(){return{restrict:"A",scope:{contentExp:"&",originScope:"&"},templateUrl:"uib/template/tooltip/tooltip-template-popup.html"}}).directive("uibTooltipTemplate",["$uibTooltip",function(a){return a("uibTooltipTemplate","tooltip","mouseenter",{useContentExp:!0})}]).directive("uibTooltipHtmlPopup",function(){return{restrict:"A",scope:{contentExp:"&"},templateUrl:"uib/template/tooltip/tooltip-html-popup.html"}}).directive("uibTooltipHtml",["$uibTooltip",function(a){return a("uibTooltipHtml","tooltip","mouseenter",{useContentExp:!0})}]),angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("uibPopoverTemplatePopup",function(){return{restrict:"A",scope:{uibTitle:"@",contentExp:"&",originScope:"&"},templateUrl:"uib/template/popover/popover-template.html"}}).directive("uibPopoverTemplate",["$uibTooltip",function(a){return a("uibPopoverTemplate","popover","click",{useContentExp:!0})}]).directive("uibPopoverHtmlPopup",function(){return{restrict:"A",scope:{contentExp:"&",uibTitle:"@"},templateUrl:"uib/template/popover/popover-html.html"}}).directive("uibPopoverHtml",["$uibTooltip",function(a){return a("uibPopoverHtml","popover","click",{useContentExp:!0})}]).directive("uibPopoverPopup",function(){return{restrict:"A",scope:{uibTitle:"@",content:"@"},templateUrl:"uib/template/popover/popover.html"}}).directive("uibPopover",["$uibTooltip",function(a){return a("uibPopover","popover","click")}]),angular.module("ui.bootstrap.progressbar",[]).constant("uibProgressConfig",{animate:!0,max:100}).controller("UibProgressController",["$scope","$attrs","uibProgressConfig",function(a,b,c){function d(){return angular.isDefined(a.maxParam)?a.maxParam:c.max}var e=this,f=angular.isDefined(b.animate)?a.$parent.$eval(b.animate):c.animate;this.bars=[],a.max=d(),this.addBar=function(a,b,c){f||b.css({transition:"none"}),this.bars.push(a),a.max=d(),a.title=c&&angular.isDefined(c.title)?c.title:"progressbar",a.$watch("value",function(b){a.recalculatePercentage()}),a.recalculatePercentage=function(){var b=e.bars.reduce(function(a,b){return b.percent=+(100*b.value/b.max).toFixed(2),a+b.percent},0);b>100&&(a.percent-=b-100)},a.$on("$destroy",function(){b=null,e.removeBar(a)})},this.removeBar=function(a){this.bars.splice(this.bars.indexOf(a),1),this.bars.forEac
vendor: 17,149 bytes, line 1247
1247h(function(a){a.recalculatePercentage()})},a.$watch("maxParam",function(a){e.bars.forEach(function(a){a.max=d(),a.recalculatePercentage()})})}]).directive("uibProgress",function(){return{replace:!0,transclude:!0,controller:"UibProgressController",require:"uibProgress",scope:{maxParam:"=?max"},templateUrl:"uib/template/progressbar/progress.html"}}).directive("uibBar",function(){return{replace:!0,transclude:!0,require:"^uibProgress",scope:{value:"=",type:"@"},templateUrl:"uib/template/progressbar/bar.html",link:function(a,b,c,d){d.addBar(a,b,c)}}}).directive("uibProgressbar",function(){return{replace:!0,transclude:!0,controller:"UibProgressController",scope:{value:"=",maxParam:"=?max",type:"@"},templateUrl:"uib/template/progressbar/progressbar.html",link:function(a,b,c,d){d.addBar(a,angular.element(b.children()[0]),{title:c.title})}}}),angular.module("ui.bootstrap.rating",[]).constant("uibRatingConfig",{max:5,stateOn:null,stateOff:null,enableReset:!0,titles:["one","two","three","four","five"]}).controller("UibRatingController",["$scope","$attrs","uibRatingConfig",function(a,b,c){var d={$setViewValue:angular.noop},e=this;this.init=function(e){d=e,d.$render=this.render,d.$formatters.push(function(a){return angular.isNumber(a)&&a<<0!==a&&(a=Math.round(a)),a}),this.stateOn=angular.isDefined(b.stateOn)?a.$parent.$eval(b.stateOn):c.stateOn,this.stateOff=angular.isDefined(b.stateOff)?a.$parent.$eval(b.stateOff):c.stateOff,this.enableReset=angular.isDefined(b.enableReset)?a.$parent.$eval(b.enableReset):c.enableReset;var f=angular.isDefined(b.titles)?a.$parent.$eval(b.titles):c.titles;this.titles=angular.isArray(f)&&f.length>0?f:c.titles;var g=angular.isDefined(b.ratingStates)?a.$parent.$eval(b.ratingStates):new Array(angular.isDefined(b.max)?a.$parent.$eval(b.max):c.max);a.range=this.buildTemplateObjects(g)},this.buildTemplateObjects=function(a){for(var b=0,c=a.length;c>b;b++)a[b]=angular.extend({index:b},{stateOn:this.stateOn,stateOff:this.stateOff,title:this.getTitle(b)},a[b]);return a},this.getTitle=function(a){return a>=this.titles.length?a+1:this.titles[a]},a.rate=function(b){if(!a.readonly&&b>=0&&b<=a.range.length){var c=e.enableReset&&d.$viewValue===b?0:b;d.$setViewValue(c),d.$render()}},a.enter=function(b){a.readonly||(a.value=b),a.onHover({value:b})},a.reset=function(){a.value=d.$viewValue,a.onLeave()},a.onKeydown=function(b){/(37|38|39|40)/.test(b.which)&&(b.preventDefault(),b.stopPropagation(),a.rate(a.value+(38===b.which||39===b.which?1:-1)))},this.render=function(){a.value=d.$viewValue,a.title=e.getTitle(a.value-1)}}]).directive("uibRating",function(){return{require:["uibRating","ngModel"],restrict:"A",scope:{readonly:"=?readOnly",onHover:"&",onLeave:"&"},controller:"UibRatingController",templateUrl:"uib/template/rating/rating.html",link:function(a,b,c,d){var e=d[0],f=d[1];e.init(f)}}}),angular.module("ui.bootstrap.tabs",[]).controller("UibTabsetController",["$scope",function(a){function b(a){for(var b=0;b<d.tabs.length;b++)if(d.tabs[b].index===a)return b}var c,d=this;d.tabs=[],d.select=function(a,f){if(!e){var g=b(c),h=d.tabs[g];if(h){if(h.tab.onDeselect({$event:f,$selectedIndex:a}),f&&f.isDefaultPrevented())return;h.tab.active=!1}var i=d.tabs[a];i?(i.tab.onSelect({$event:f}),i.tab.active=!0,d.active=i.index,c=i.index):!i&&angular.isDefined(c)&&(d.active=null,c=null)}},d.addTab=function(a){if(d.tabs.push({tab:a,index:a.index}),d.tabs.sort(function(a,b){return a.index>b.index?1:a.index<b.index?-1:0}),a.index===d.active||!angular.isDefined(d.active)&&1===d.tabs.length){var c=b(a.index);d.select(c)}},d.removeTab=function(a){for(var b,c=0;c<d.tabs.length;c++)if(d.tabs[c].tab===a){b=c;break}if(d.tabs[b].index===d.active){var e=b===d.tabs.length-1?b-1:b+1%d.tabs.length;d.select(e)}d.tabs.splice(b,1)},a.$watch("tabset.active",function(a){angular.isDefined(a)&&a!==c&&d.select(b(a))});var e;a.$on("$destroy",function(){e=!0})}]).directive("uibTabset",function(){return{transclude:!0,replace:!0,scope:{},bindToController:{active:"=?",type:"@"},controller:"UibTabsetController",controllerAs:"tabset",templateUrl:function(a,b){return b.templateUrl||"uib/template/tabs/tabset.html"},link:function(a,b,c){a.vertical=angular.isDefined(c.vertical)?a.$parent.$eval(c.vertical):!1,a.justified=angular.isDefined(c.justified)?a.$parent.$eval(c.justified):!1}}}).directive("uibTab",["$parse",function(a){return{require:"^uibTabset",replace:!0,templateUrl:function(a,b){return b.templateUrl||"uib/template/tabs/tab.html"},transclude:!0,scope:{heading:"@",index:"=?",classes:"@?",onSelect:"&select",onDeselect:"&deselect"},controller:function(){},controllerAs:"tab",link:function(b,c,d,e,f){b.disabled=!1,d.disable&&b.$parent.$watch(a(d.disable),function(a){b.disabled=!!a}),angular.isUndefined(d.index)&&(e.tabs&&e.tabs.length?b.index=Math.max.apply(null,e.tabs.map(function(a){return a.index}))+1:b.index=0),angular.isUndefined(d.classes)&&(b.classes=""),b.select=function(a){if(!b.disabled){for(var c,d=0;d<e.tabs.length;d++)if(e.tabs[d].tab===b){c=d;break}e.select(c,a)}},e.addTab(b),b.$on("$destroy",function(){e.removeTab(b)}),b.$transcludeFn=f}}}]).directive("uibTabHeadingTransclude",function(){return{restrict:"A",require:"^uibTab",link:function(a,b){a.$watch("headingElement",function(a){a&&(b.html(""),b.append(a))})}}}).directive("uibTabContentTransclude",function(){function a(a){return a.tagName&&(a.hasAttribute("uib-tab-heading")||a.hasAttribute("data-uib-tab-heading")||a.hasAttribute("x-uib-tab-heading")||"uib-tab-heading"===a.tagName.toLowerCase()||"data-uib-tab-heading"===a.tagName.toLowerCase()||"x-uib-tab-heading"===a.tagName.toLowerCase()||"uib:tab-heading"===a.tagName.toLowerCase())}return{restrict:"A",require:"^uibTabset",link:function(b,c,d){var e=b.$eval(d.uibTabContentTransclude).tab;e.$transcludeFn(e.$parent,function(b){angular.forEach(b,function(b){a(b)?e.headingElement=b:c.append(b)})})}}}),angular.module("ui.bootstrap.timepicker",[]).constant("uibTimepickerConfig",{hourStep:1,minuteStep:1,secondStep:1,showMeridian:!0,showSeconds:!1,meridians:null,readonlyInput:!1,mousewheel:!0,arrowkeys:!0,showSpinners:!0,templateUrl:"uib/template/timepicker/timepicker.html"}).controller("UibTimepickerController",["$scope","$element","$attrs","$parse","$log","$locale","uibTimepickerConfig",function(a,b,c,d,e,f,g){function h(){var b=+a.hours,c=a.showMeridian?b>0&&13>b:b>=0&&24>b;return c&&""!==a.hours?(a.showMeridian&&(12===b&&(b=0),a.meridian===y[1]&&(b+=12)),b):void 0}function i(){var b=+a.minutes,c=b>=0&&60>b;return c&&""!==a.minutes?b:void 0}function j(){var b=+a.seconds;return b>=0&&60>b?b:void 0}function k(a,b){return null===a?"":angular.isDefined(a)&&a.toString().length<2&&!b?"0"+a:a.toString()}function l(a){m(),x.$setViewValue(new Date(v)),n(a)}function m(){s&&s.$setValidity("hours",!0),t&&t.$setValidity("minutes",!0),u&&u.$setValidity("seconds",!0),x.$setValidity("time",!0),a.invalidHours=!1,a.invalidMinutes=!1,a.invalidSeconds=!1}function n(b){if(x.$modelValue){var c=v.getHours(),d=v.getMinutes(),e=v.getSeconds();a.showMeridian&&(c=0===c||12===c?12:c%12),a.hours="h"===b?c:k(c,!z),"m"!==b&&(a.minutes=k(d)),a.meridian=v.getHours()<12?y[0]:y[1],"s"!==b&&(a.seconds=k(e)),a.meridian=v.getHours()<12?y[0]:y[1]}else a.hours=null,a.minutes=null,a.seconds=null,a.meridian=y[0]}function o(a){v=q(v,a),l()}function p(a,b){return q(a,60*b)}function q(a,b){var c=new Date(a.getTime()+1e3*b),d=new Date(a);return d.setHours(c.getHours(),c.getMinutes(),c.getSeconds()),d}function r(){return(null===a.hours||""===a.hours)&&(null===a.minutes||""===a.minutes)&&(!a.showSeconds||a.showSeconds&&(null===a.seconds||""===a.seconds))}var s,t,u,v=new Date,w=[],x={$setViewValue:angular.noop},y=angular.isDefined(c.meridians)?a.$parent.$eval(c.meridians):g.meridians||f.DATETIME_FORMATS.AMPMS,z=angular.isDefined(c.padHours)?a.$parent.$eval(c.padHours):!0;a.tabindex=angular.isDefined(c.tabindex)?c.tabindex:0,b.removeAttr("tabindex"),this.init=function(b,d){x=b,x.$render=this.render,x.$formatters.unshift(function(a){return a?new Date(a):null});var e=d.eq(0),f=d.eq(1),h=d.eq(2);s=e.controller("ngModel"),t=f.controller("ngModel"),u=h.controller("ngModel");var i=angular.isDefined(c.mousewheel)?a.$parent.$eval(c.mousewheel):g.mousewheel;i&&this.setupMousewheelEvents(e,f,h);var j=angular.isDefined(c.arrowkeys)?a.$parent.$eval(c.arrowkeys):g.arrowkeys;j&&this.setupArrowkeyEvents(e,f,h),a.readonlyInput=angular.isDefined(c.readonlyInput)?a.$parent.$eval(c.readonlyInput):g.readonlyInput,this.setupInputEvents(e,f,h)};var A=g.hourStep;c.hourStep&&w.push(a.$parent.$watch(d(c.hourStep),function(a){A=+a}));var B=g.minuteStep;c.minuteStep&&w.push(a.$parent.$watch(d(c.minuteStep),function(a){B=+a}));var C;w.push(a.$parent.$watch(d(c.min),function(a){var b=new Date(a);C=isNaN(b)?void 0:b}));var D;w.push(a.$parent.$watch(d(c.max),function(a){var b=new Date(a);D=isNaN(b)?void 0:b}));var E=!1;c.ngDisabled&&w.push(a.$parent.$watch(d(c.ngDisabled),function(a){E=a})),a.noIncrementHours=function(){var a=p(v,60*A);return E||a>D||v>a&&C>a},a.noDecrementHours=function(){var a=p(v,60*-A);return E||C>a||a>v&&a>D},a.noIncrementMinutes=function(){var a=p(v,B);return E||a>D||v>a&&C>a},a.noDecrementMinutes=function(){var a=p(v,-B);return E||C>a||a>v&&a>D},a.noIncrementSeconds=function(){var a=q(v,F);return E||a>D||v>a&&C>a},a.noDecrementSeconds=function(){var a=q(v,-F);return E||C>a||a>v&&a>D},a.noToggleMeridian=function(){return v.getHours()<12?E||p(v,720)>D:E||p(v,-720)<C};var F=g.secondStep;c.secondStep&&w.push(a.$parent.$watch(d(c.secondStep),function(a){F=+a})),a.showSeconds=g.showSeconds,c.showSeconds&&w.push(a.$parent.$watch(d(c.showSeconds),function(b){a.showSeconds=!!b})),a.showMeridian=g.showMeridian,c.showMeridian&&w.push(a.$parent.$watch(d(c.showMeridian),function(b){if(a.showMeridian=!!b,x.$error.time){var c=h(),d=i();angular.isDefined(c)&&angular.isDefined(d)&&(v.setHours(c),l())}else n()})),this.setupMousewheelEvents=function(b,c,d){var e=function(a){a.originalEvent&&(a=a.originalEvent);var b=a.wheelDelta?a.wheelDelta:-a.deltaY;return a.detail||b>0};b.on("mousewheel wheel",function(b){E||a.$apply(e(b)?a.incrementHours():a.decrementHours()),b.preventDefault()}),c.on("mousewheel wheel",function(b){E||a.$apply(e(b)?a.incrementMinutes():a.decrementMinutes()),b.preventDefault()}),d.on("mousewheel wheel",function(b){E||a.$apply(e(b)?a.incrementSeconds():a.decrementSeconds()),b.preventDefault()})},this.setupArrowkeyEvents=function(b,c,d){b.on("keydown",function(b){E||(38===b.which?(b.preventDefault(),a.incrementHours(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementHours(),a.$apply()))}),c.on("keydown",function(b){E||(38===b.which?(b.preventDefault(),a.incrementMinutes(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementMinutes(),a.$apply()))}),d.on("keydown",function(b){E||(38===b.which?(b.preventDefault(),a.incrementSeconds(),a.$apply()):40===b.which&&(b.preventDefault(),a.decrementSeconds(),a.$apply()))})},this.setupInputEvents=function(b,c,d){if(a.readonlyInput)return a.updateHours=angular.noop,a.updateMinutes=angular.noop,void(a.updateSeconds=angular.noop);var e=function(b,c,d){x.$setViewValue(null),x.$setValidity("time",!1),angular.isDefined(b)&&(a.invalidHours=b,s&&s.$setValidity("hours",!1)),angular.isDefined(c)&&(a.invalidMinutes=c,t&&t.$setValidity("minutes",!1)),angular.isDefined(d)&&(a.invalidSeconds=d,u&&u.$setValidity("seconds",!1))};a.updateHours=function(){var a=h(),b=i();x.$setDirty(),angular.isDefined(a)&&angular.isDefined(b)?(v.setHours(a),v.setMinutes(b),C>v||v>D?e(!0):l("h")):e(!0)},b.on("blur",function(b){x.$setTouched(),r()?m():null===a.hours||""===a.hours?e(!0):!a.invalidHours&&a.hours<10&&a.$apply(function(){a.hours=k(a.hours,!z)})}),a.updateMinutes=function(){var a=i(),b=h();x.$setDirty(),angular.isDefined(a)&&angular.isDefined(b)?(v.setHours(b),v.setMinutes(a),C>v||v>D?e(void 0,!0):l("m")):e(void 0,!0)},c.on("blur",function(b){x.$setTouched(),r()?m():null===a.minutes?e(void 0,!0):!a.invalidMinutes&&a.minutes<10&&a.$apply(function(){a.minutes=k(a.minutes)})}),a.updateSeconds=function(){var a=j();x.$setDirty(),angular.isDefined(a)?(v.setSeconds(a),l("s")):e(void 0,void 0,!0)},d.on("blur",function(b){r()?m():!a.invalidSeconds&&a.seconds<10&&a.$apply(function(){a.seconds=k(a.seconds)})})},this.render=function(){var b=x.$viewValue;isNaN(b)?(x.$setValidity("time",!1),e.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.')):(b&&(v=b),C>v||v>D?(x.$setValidity("time",!1),a.invalidHours=!0,a.invalidMinutes=!0):m(),n())},a.showSpinners=angular.isDefined(c.showSpinners)?a.$parent.$eval(c.showSpinners):g.showSpinners,a.incrementHours=function(){a.noIncrementHours()||o(60*A*60)},a.decrementHours=function(){a.noDecrementHours()||o(60*-A*60)},a.incrementMinutes=function(){a.noIncrementMinutes()||o(60*B)},a.decrementMinutes=function(){a.noDecrementMinutes()||o(60*-B)},a.incrementSeconds=function(){a.noIncrementSeconds()||o(F)},a.decrementSeconds=function(){a.noDecrementSeconds()||o(-F)},a.toggleMeridian=function(){var b=i(),c=h();a.noToggleMeridian()||(angular.isDefined(b)&&angular.isDefined(c)?o(720*(v.getHours()<12?60:-60)):a.meridian=a.meridian===y[0]?y[1]:y[0])},a.blur=function(){x.$setTouched()},a.$on("$destroy",function(){for(;w.length;)w.shift()()})}]).directive("uibTimepicker",["uibTimepickerConfig",function(a){return{require:["uibTimepicker","?^ngModel"],restrict:"A",controller:"UibTimepickerController",controllerAs:"timepicker",scope:{},templateUrl:function(b,c){return c.templateUrl||a.templateUrl},link:function(a,b,c,d){var e=d[0],f=d[1];f&&e.init(f,b.find("input"))}}}]),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.debounce","ui.bootstrap.position"]).factory("uibTypeaheadParser",["$parse",function(a){var b=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/;return{parse:function(c){var d=c.match(b);if(!d)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+c+'".');return{itemName:d[3],source:a(d[4]),viewMapper:a(d[2]||d[1]),modelMapper:a(d[1])}}}}]).controller("UibTypeaheadController",["$scope","$element","$attrs","$compile","$parse","$q","$timeout","$document","$window","$rootScope","$$debounce","$uibPosition","uibTypeaheadParser",function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(){P.moveInProgress||(P.moveInProgress=!0,P.$digest()),$()}function o(){P.position=F?l.offset(b):l.position(b),P.position.top+=b.prop("offsetHeight")}function p(a){var b;return angular.version.minor<6?(b=a.$options||{},b.getOption=function(a){return b[a]}):b=a.$options,b}var q,r,s=[9,13,27,38,40],t=200,u=a.$eval(c.typeaheadMinLength);u||0===u||(u=1),a.$watch(c.typeaheadMinLength,function(a){u=a||0===a?a:1});var v=a.$eval(c.typeaheadWaitMs)||0,w=a.$eval(c.typeaheadEditable)!==!1;a.$watch(c.typeaheadEditable,function(a){w=a!==!1});var x,y,z=e(c.typeaheadLoading).assign||angular.noop,A=c.typeaheadShouldSelect?e(c.typeaheadShouldSelect):function(a,b){var c=b.$event;return 13===c.which||9===c.which},B=e(c.typeaheadOnSelect),C=angular.isDefined(c.typeaheadSelectOnBlur)?a.$eval(c.typeaheadSelectOnBlur):!1,D=e(c.typeaheadNoResults).assign||angular.noop,E=c.typeaheadInputFormatter?e(c.typeaheadInputFormatter):void 0,F=c.typeaheadAppendToBody?a.$eval(c.typeaheadAppendToBody):!1,G=c.typeaheadAppendTo?a.$eval(c.typeaheadAppendTo):null,H=a.$eval(c.typeaheadFocusFirst)!==!1,I=c.typeaheadSelectOnExact?a.$eval(c.typeaheadSelectOnExact):!1,J=e(c.typeaheadIsOpen).assign||angular.noop,K=a.$eval(c.typeaheadShowHint)||!1,L=e(c.ngModel),M=e(c.ngModel+"($$$p)"),N=function(b,c){return angular.isFunction(L(a))&&r.getOption("getterSetter")?M(b,{$$$p:c}):L.assign(b,c)},O=m.parse(c.uibTypeahead),P=a.$new(),Q=a.$on("$destroy",function(){P.$destroy()});P.$on("$destroy",Q);var R="typeahead-"+P.$id+"-"+Math.floor(1e4*Math.random());b.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":R});var S,T;K&&(S=angular.element("<div></div>"),S.css("position","relative"),b.after(S),T=b.clone(),T.attr("placeholder",""),T.attr("tabindex","-1"),T.val(""),T.css({position:"absolute",top:"0px",left:"0px","border-color":"transparent","box-shadow":"none",opacity:1,background:"none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255)",color:"#999"}),b.css({position:"relative","vertical-align":"top","background-color":"transparent"}),T.attr("id")&&T.removeAttr("id"),S.append(T),T.after(b));var U=angular.element("<div uib-typeahead-popup></div>");U.attr({id:R,matches:"matches",active:"activeIdx",select:"select(activeIdx, evt)","move-in-progress":"moveInProgress",query:"query",position:"position","assign-is-open":"assignIsOpen(isOpen)",debounce:"debounceUpdate"}),angular.isDefined(c.typeaheadTemplateUrl)&&U.attr("template-url",c.typeaheadTemplateUrl),angular.isDefined(c.typeaheadPopupTemplateUrl)&&U.attr("popup-template-url",c.typeaheadPopupTemplateUrl);var V=function(){K&&T.val("")},W=function(){P.matches=[],P.activeIdx=-1,b.attr("aria-expanded",!1),V()},X=function(a){return R+"-option-"+a};
vendor: 6,585 bytes, lines 1247-1248
1247P.$watch("activeIdx",function(a){0>a?b.removeAttr("aria-activedescendant"):b.attr("aria-activedescendant",X(a))});var Y=function(a,b){return P.matches.length>b&&a?a.toUpperCase()===P.matches[b].label.toUpperCase():!1},Z=function(c,d){var e={$viewValue:c};z(a,!0),D(a,!1),f.when(O.source(a,e)).then(function(f){var g=c===q.$viewValue;if(g&&x)if(f&&f.length>0){P.activeIdx=H?0:-1,D(a,!1),P.matches.length=0;for(var h=0;h<f.length;h++)e[O.itemName]=f[h],P.matches.push({id:X(h),label:O.viewMapper(P,e),model:f[h]});if(P.query=c,o(),b.attr("aria-expanded",!0),I&&1===P.matches.length&&Y(c,0)&&(angular.isNumber(P.debounceUpdate)||angular.isObject(P.debounceUpdate)?k(function(){P.select(0,d)},angular.isNumber(P.debounceUpdate)?P.debounceUpdate:P.debounceUpdate["default"]):P.select(0,d)),K){var i=P.matches[0].label;angular.isString(c)&&c.length>0&&i.slice(0,c.length).toUpperCase()===c.toUpperCase()?T.val(c+i.slice(c.length)):T.val("")}}else W(),D(a,!0);g&&z(a,!1)},function(){W(),z(a,!1),D(a,!0)})};F&&(angular.element(i).on("resize",n),h.find("body").on("scroll",n));var $=k(function(){P.matches.length&&o(),P.moveInProgress=!1},t);P.moveInProgress=!1,P.query=void 0;var _,aa=function(a){_=g(function(){Z(a)},v)},ba=function(){_&&g.cancel(_)};W(),P.assignIsOpen=function(b){J(a,b)},P.select=function(d,e){var f,h,i={};y=!0,i[O.itemName]=h=P.matches[d].model,f=O.modelMapper(a,i),N(a,f),q.$setValidity("editable",!0),q.$setValidity("parse",!0),B(a,{$item:h,$model:f,$label:O.viewMapper(a,i),$event:e}),W(),P.$eval(c.typeaheadFocusOnSelect)!==!1&&g(function(){b[0].focus()},0,!1)},b.on("keydown",function(b){if(0!==P.matches.length&&-1!==s.indexOf(b.which)){var c=A(a,{$event:b});if(-1===P.activeIdx&&c||9===b.which&&b.shiftKey)return W(),void P.$digest();b.preventDefault();var d;switch(b.which){case 27:b.stopPropagation(),W(),a.$digest();break;case 38:P.activeIdx=(P.activeIdx>0?P.activeIdx:P.matches.length)-1,P.$digest(),d=U[0].querySelectorAll(".uib-typeahead-match")[P.activeIdx],d.parentNode.scrollTop=d.offsetTop;break;case 40:P.activeIdx=(P.activeIdx+1)%P.matches.length,P.$digest(),d=U[0].querySelectorAll(".uib-typeahead-match")[P.activeIdx],
1248d.parentNode.scrollTop=d.offsetTop;break;default:c&&P.$apply(function(){angular.isNumber(P.debounceUpdate)||angular.isObject(P.debounceUpdate)?k(function(){P.select(P.activeIdx,b)},angular.isNumber(P.debounceUpdate)?P.debounceUpdate:P.debounceUpdate["default"]):P.select(P.activeIdx,b)})}}}),b.on("focus",function(a){x=!0,0!==u||q.$viewValue||g(function(){Z(q.$viewValue,a)},0)}),b.on("blur",function(a){C&&P.matches.length&&-1!==P.activeIdx&&!y&&(y=!0,P.$apply(function(){angular.isObject(P.debounceUpdate)&&angular.isNumber(P.debounceUpdate.blur)?k(function(){P.select(P.activeIdx,a)},P.debounceUpdate.blur):P.select(P.activeIdx,a)})),!w&&q.$error.editable&&(q.$setViewValue(),P.$apply(function(){q.$setValidity("editable",!0),q.$setValidity("parse",!0)}),b.val("")),x=!1,y=!1});var ca=function(c){b[0]!==c.target&&3!==c.which&&0!==P.matches.length&&(W(),j.$$phase||a.$digest())};h.on("click",ca),a.$on("$destroy",function(){h.off("click",ca),(F||G)&&da.remove(),F&&(angular.element(i).off("resize",n),h.find("body").off("scroll",n)),U.remove(),K&&S.remove()});var da=d(U)(P);F?h.find("body").append(da):G?angular.element(G).eq(0).append(da):b.after(da),this.init=function(b){q=b,r=p(q),P.debounceUpdate=e(r.getOption("debounce"))(a),q.$parsers.unshift(function(b){return x=!0,0===u||b&&b.length>=u?v>0?(ba(),aa(b)):Z(b):(z(a,!1),ba(),W()),w?b:b?void q.$setValidity("editable",!1):(q.$setValidity("editable",!0),null)}),q.$formatters.push(function(b){var c,d,e={};return w||q.$setValidity("editable",!0),E?(e.$model=b,E(a,e)):(e[O.itemName]=b,c=O.viewMapper(a,e),e[O.itemName]=void 0,d=O.viewMapper(a,e),c!==d?c:b)})}}]).directive("uibTypeahead",function(){return{controller:"UibTypeaheadController",require:["ngModel","uibTypeahead"],link:function(a,b,c,d){d[1].init(d[0])}}}).directive("uibTypeaheadPopup",["$$debounce",function(a){return{scope:{matches:"=",query:"=",active:"=",position:"&",moveInProgress:"=",select:"&",assignIsOpen:"&",debounce:"&"},replace:!0,templateUrl:function(a,b){return b.popupTemplateUrl||"uib/template/typeahead/typeahead-popup.html"},link:function(b,c,d){b.templateUrl=d.templateUrl,b.isOpen=function(){var a=b.matches.length>0;return b.assignIsOpen({isOpen:a}),a},b.isActive=function(a){return b.active===a},b.selectActive=function(a){b.active=a},b.selectMatch=function(c,d){var e=b.debounce();angular.isNumber(e)||angular.isObject(e)?a(function(){b.select({activeIdx:c,evt:d})},angular.isNumber(e)?e:e["default"]):b.select({activeIdx:c,evt:d})}}}}]).directive("uibTypeaheadMatch",["$templateRequest","$compile","$parse",function(a,b,c){return{scope:{index:"=",match:"=",query:"="},link:function(d,e,f){var g=c(f.templateUrl)(d.$parent)||"uib/template/typeahead/typeahead-match.html";a(g).then(function(a){var c=angular.element(a.trim());e.replaceWith(c),b(c)(d)})}}}]).filter("uibTypeaheadHighlight",["$sce","$injector","$log",function(a,b,c){function d(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function e(a){return/<.*>/g.test(a)}var f;return f=b.has("$sanitize"),function(b,g){return!f&&e(b)&&c.warn("Unsafe use of typeahead please use ngSanitize"),b=g?(""+b).replace(new RegExp(d(g),"gi"),"<strong>$&</strong>"):b,f||(b=a.trustAsHtml(b)),b}}]),angular.module("uib/template/accordion/accordion-group.html",[]).run(["$templateCache",function(a){a.put("uib/template/accordion/accordion-group.html",'<div role="tab" id="{{::headingId}}" aria-selected="{{isOpen}}" class="panel-heading" ng-keypress="toggleOpen($event)">\n  <h4 class="panel-title">\n    <a role="button" data-toggle="collapse" href aria-expanded="{{isOpen}}" aria-controls="{{::panelId}}" tabindex="0" class="accordion-toggle" ng-click="toggleOpen()" uib-accordion-transclude="heading" ng-disabled="isDisabled" uib-tabindex-toggle><span uib-accordion-header ng-class="{\'text-muted\': isDisabled}">{{heading}}</span></a>\n  </h4>\n</div>\n<div id="{{::panelId}}" aria-labelledby="{{::headingId}}" aria-hidden="{{!isOpen}}" role="tabpanel" class="panel-collapse collapse" uib-collapse="!isOpen">\n  <div class="panel-body" ng-transclude></div>\n</div>\n')}]),angular.module("uib/template/accordion/accordion.html",[]).run(["$templateCache",function(a){a.put("uib/template/accordion/accordion.html",'<div role="tablist" class="panel-group" ng-transclude></div>')}]),angular.module("uib/template/alert/alert.html",[]).run(["$templateCache",function(a){a.put("uib/template/alert/alert.html",'<button ng-show="closeable" t
1248ype="button" class="close" ng-click="close({$event: $event})">\n  <span aria-hidden="true">&times;</span>\n  <span class="sr-only">Close</span>\n</button>\n<div ng-transclude></div>\n')}]),angular.module("uib/template/carousel/carousel.html",[]).run(["$templateCache",function(a){a.put("uib/template/carousel/carousel.html",'<div class="carousel-inner" ng-transclude></div>\n<a role="button" href class="left carousel-control" ng-click="prev()" ng-class="{ disabled: isPrevDisabled() }" ng-show="slides.length > 1">\n  <span aria-hidden="true" class="glyphicon glyphicon-chevron-left"></span>\n  <span class="sr-only">previous</span>\n</a>\n<a role="button" href class="right carousel-control" ng-click="next()" ng-class="{ disabled: isNextDisabled() }" ng-show="slides.length > 1">\n  <span aria-hidden="true" class="glyphicon glyphicon-chevron-right"></span>\n  <span class="sr-only">next</span>\n</a>\n<ol class="carousel-indicators" ng-show="slides.length > 1">\n  <li ng-repeat="slide in slides | orderBy:indexOfSlide track by $index" ng-class="{ active: isActive(slide) }" ng-click="select(slide)">\n    <span class="sr-only">slide {{ $index + 1 }} of {{ slides.length }}<span ng-if="isActive(slide)">, currently active</span></span>\n  </li>\n</ol>\n')}]),angular.module("uib/template/carousel/slide.html",[]).run(["$templateCache",function(a){a.put("uib/template/carousel/slide.html",'<div class="text-center" ng-transclude></div>\n')}]),angular.module("uib/template/datepicker/datepicker.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/datepicker.html",'<div ng-switch="datepickerMode">\n  <div uib-daypicker ng-switch-when="day" tabindex="0" class="uib-daypicker"></div>\n  <div uib-monthpicker ng-switch-when="month" tabindex="0" class="uib-monthpicker"></div>\n  <div uib-yearpicker ng-switch-when="year" tabindex="0" class="uib-yearpicker"></div>\n</div>\n')}]),angular.module("uib/template/datepicker/day.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/day.html",'<table role="grid" aria-labelledby="{{::uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="-1"><i aria-hidden="true" class="glyphicon glyphicon-chevron-left"></i><span class="sr-only">previous</span></button></th>\n      <th colspan="{{::5 + showWeeks}}"><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="-1"><i aria-hidden="true" class="glyphicon glyphicon-chevron-right"></i><span class="sr-only">next</span></button></th>\n    </tr>\n    <tr>\n      <th ng-if="showWeeks" class="text-center"></th>\n      <th ng-repeat="label in ::labels track by $index" class="text-center"><small aria-label="{{::label.full}}">{{::label.abbr}}</small></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr class="uib-weeks" ng-repeat="row in rows track by $index" role="row">\n      <td ng-if="showWeeks" class="text-center h6"><em>{{ weekNumbers[$index] }}</em></td>\n      <td ng-repeat="dt in row" class="uib-day text-center" role="gridcell"\n        id="{{::dt.uid}}"\n        ng-class="::dt.customClass">\n        <button type="button" class="btn btn-default btn-sm"\n          uib-is-class="\n            \'btn-info\' for selectedDt,\n            \'active\' for activeDt\n            on dt"\n          ng-click="select(dt.date)"\n          ng-disabled="::dt.disabled"\n          tabindex="-1"><span ng-class="::{\'text-muted\': dt.secondary, \'text-info\': dt.current}">{{::dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("uib/template/datepicker/month.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/month.html",'<table role="grid" aria-labelledby="{{::uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="-1"><i aria-hidden="true" class="glyphicon glyphicon-chevron-left"></i><span class="sr-only">previous</span></button></th>\n      <th colspan="{{::yearHeaderColspan}}"><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === max
1248Mode" tabindex="-1"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="-1"><i aria-hidden="true" class="glyphicon glyphicon-chevron-right"></i><span class="sr-only">next</span></i></button></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr class="uib-months" ng-repeat="row in rows track by $index" role="row">\n      <td ng-repeat="dt in row" class="uib-month text-center" role="gridcell"\n        id="{{::dt.uid}}"\n        ng-class="::dt.customClass">\n        <button type="button" class="btn btn-default"\n          uib-is-class="\n            \'btn-info\' for selectedDt,\n            \'active\' for activeDt\n            on dt"\n          ng-click="select(dt.date)"\n          ng-disabled="::dt.disabled"\n          tabindex="-1"><span ng-class="::{\'text-info\': dt.current}">{{::dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("uib/template/datepicker/year.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepicker/year.html",'<table role="grid" aria-labelledby="{{::uniqueId}}-title" aria-activedescendant="{{activeDateId}}">\n  <thead>\n    <tr>\n      <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="-1"><i aria-hidden="true" class="glyphicon glyphicon-chevron-left"></i><span class="sr-only">previous</span></button></th>\n      <th colspan="{{::columns - 2}}"><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th>\n      <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="-1"><i aria-hidden="true" class="glyphicon glyphicon-chevron-right"></i><span class="sr-only">next</span></button></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr class="uib-years" ng-repeat="row in rows track by $index" role="row">\n      <td ng-repeat="dt in row" class="uib-year text-center" role="gridcell"\n        id="{{::dt.uid}}"\n        ng-class="::dt.customClass">\n        <button type="button" class="btn btn-default"\n          uib-is-class="\n            \'btn-info\' for selectedDt,\n            \'active\' for activeDt\n            on dt"\n          ng-click="select(dt.date)"\n          ng-disabled="::dt.disabled"\n          tabindex="-1"><span ng-class="::{\'text-info\': dt.current}">{{::dt.label}}</span></button>\n      </td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("uib/template/datepickerPopup/popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/datepickerPopup/popup.html",'<ul role="presentation" class="uib-datepicker-popup dropdown-menu uib-position-measure" dropdown-nested ng-if="isOpen" ng-keydown="keydown($event)" ng-click="$event.stopPropagation()">\n  <li ng-transclude></li>\n  <li ng-if="showButtonBar" class="uib-button-bar">\n    <span class="btn-group pull-left">\n      <button type="button" class="btn btn-sm btn-info uib-datepicker-current" ng-click="select(\'today\', $event)" ng-disabled="isDisabled(\'today\')">{{ getText(\'current\') }}</button>\n      <button type="button" class="btn btn-sm btn-danger uib-clear" ng-click="select(null, $event)">{{ getText(\'clear\') }}</button>\n    </span>\n    <button type="button" class="btn btn-sm btn-success pull-right uib-close" ng-click="close($event)">{{ getText(\'close\') }}</button>\n  </li>\n</ul>\n')}]),angular.module("uib/template/modal/window.html",[]).run(["$templateCache",function(a){a.put("uib/template/modal/window.html","<div class=\"modal-dialog {{size ? 'modal-' + size : ''}}\"><div class=\"modal-content\" uib-modal-transclude></div></div>\n")}]),angular.module("uib/template/pager/pager.html",[]).run(["$templateCache",function(a){a.put("uib/template/pager/pager.html",'<li ng-class="{disabled: noPrevious()||ngDisabled, previous: align}"><a href ng-click="selectPage(page - 1, $event)" ng-disabled="noPrevious()||ngDisabled" uib-tabindex-toggle>{{::getText(\'previous\')}}</a></li>\n<li ng-class="{disabled: noNext()||ngDisabled, next: align}"><a href ng-click="selectPage(page + 1, $event)" ng-disabled="noNext()||ngDisabled" uib-tabindex-toggle>{{::getText(\'next\')}}</a></li>\n')}]),angular.module("uib/template/pagination/pagination.html",[]).run(["$templateCache",function(a){a.put("uib/template/pagination/pagination.html",'<li role="menuitem" ng-if="::boundaryLinks" ng-class="{disabled: noPrevious()||ngDisabled}" class="pagination-first"><a href ng-click="selectPage(1, $event)" ng-disabled="noPrevious()||ngDisabled" uib-tabindex-toggle>{{::getText(\'first\')}}</a></li>\n<li role="menuitem" ng-if="::directionLinks" ng-class="{disabled: noPrevious()||ngDisabled}" class="pagination-prev"><a href ng-click="selectPage(page - 1, $event)" ng-disabled="noPrevious()||ngDisabled" uib-tabindex-toggle>{{::getText(\'previous\')}}</a></li>\n<li role="menuitem" ng-repeat="page in pages track by $index" ng-class="{active: page.active,disabled: ngDisabled&&!page.active}" class="pagination-page"><a href ng-click="selectPage(page.number, $event)" ng-disabled="ngDisabled&&!page.active" uib-tabindex-toggle>{{page.text}}</a></li>\n<li role="menuitem" ng-if="::directionLinks" ng-class="{disabled: noNext()||ngDisabled}" class="pagination-next"><a href ng-click="selectPage(page + 1, $event)" ng-disabled="noNext()||ngDisabled" uib-tabindex-toggle>{{::getText(\'next\')}}</a></li>\n<li role="menuitem" ng-if="::boundaryLinks" ng-class="{disabled: noNext()||ngDisabled}" class="pagination-last"><a href ng-click="selectPage(totalPages, $event)" ng-disabled="noNext()||ngDisabled" uib-tabindex-toggle>{{::getText(\'last\')}}</a></li>\n')}]),angular.module("uib/template/tooltip/tooltip-html-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/tooltip/tooltip-html-popup.html",'<div class="tooltip-arrow"></div>\n<div class="tooltip-inner" ng-bind-html="contentExp()"></div>\n')}]),angular.module("uib/template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/tooltip/tooltip-popup.html",'<div class="tooltip-arrow"></div>\n<div class="tooltip-inner" ng-bind="content"></div>\n')}]),angular.module("uib/template/tooltip/tooltip-template-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/tooltip/tooltip-template-popup.html",'<div class="tooltip-arrow"></div>\n<div class="tooltip-inner"\n  uib-tooltip-template-transclude="contentExp()"\n  tooltip-template-transclude-scope="originScope()"></div>\n')}]),angular.module("uib/template/popover/popover-html.html",[]).run(["$templateCache",function(a){a.put("uib/template/popover/popover-html.html",'<div class="arrow"></div>\n\n<div class="popover-inner">\n    <h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>\n    <div class="popover-content" ng-bind-html="contentExp()"></div>\n</div>\n')}]),angular.module("uib/template/popover/popover-template.html",[]).run(["$templateCache",function(a){a.put("uib/template/popover/popover-template.html",'<div class="arrow"></div>\n\n<div class="popover-inner">\n    <h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>\n    <div class="popover-content"\n      uib-tooltip-template-transclude="contentExp()"\n      tooltip-template-transclude-scope="originScope()"></div>\n</div>\n')}]),angular.module("uib/template/popover/popover.html",[]).run(["$templateCache",function(a){a.put("uib/template/popover/popover.html",'<div class="arrow"></div>\n\n<div class="popover-inner">\n    <h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>\n    <div class="popover-content" ng-bind="content"></div>\n</div>\n')}]),angular.module("uib/template/progressbar/bar.html",[]).run(["$templateCache",function(a){a.put("uib/template/progressbar/bar.html",'<div class="progress-bar" ng-class="type && \'progress-bar-\' + type" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="{{max}}" ng-style="{width: (percent < 100 ? percent : 100) + \'%\'}" aria-valuetext="{{percent | number:0}}%" aria-labelledby="{{::title}}" ng-transclude></div>\n')}]),angular.module("uib/template/progressbar/progress.html",[]).run(["$templateCache",function(a){a.put("uib/template/progressbar/progress.html",'<div class="progress" ng-transclude aria-labelledby="{{::title}}"></div>')}]),angular.module("uib/template/progressbar/progressbar.html",[]).run(["$templateCache",function(a){a.put("uib/template/progressbar/progressbar.html",'<div class="progress">\n  <div class="progress-bar" ng-class="type && \'progress-bar-\' + type" role="progressbar" aria-valuenow="{{value}}" aria-valuemin="0" aria-valuemax="{{max}}" ng-style="{width: (percent < 100 ? percent : 100) + \'%\'}" aria-valuetext="{{percent | number:0}}%" aria-labelledby="{{::title}}" ng-transclude></div>\n</div>\n')}]),angular.module("uib/template/rating/rating.html",[]).run(["$templateCache",function(a){a.put("uib/template/rating/rating.html",'<span ng-mouseleave="reset()" ng-keydown="onKeydown($event)" tabindex="0" role="slider" aria-valuemin="0" aria-valuemax="{{range.length}}" aria-valuenow="{{value}}" aria-valuetext="{{title}}">\n    <span ng-repeat-start="r in range track by $index" class="sr-only">({{ $index < value ? \'*\' : \' \' }})</span>\n    <i ng-repeat-end ng-mouseenter="enter($index + 1)" ng-click="rate($index + 1)" class="glyphicon" ng-class="$index < value && (r.stateOn || \'glyphicon-star\') || (r.stateOff || \'glyphicon-star-empty\')" ng-attr-title="{{r.title}}"></i>\n</span>\n')}]),angular.module("uib/template/tabs/tab.html",[]).run(["$templateCache",function(a){a.put("uib/template/tabs/tab.html",'<li ng-class="[{active: active, disabled: disabled}, classes]" class="uib-tab nav-item">\n  <a href ng-click="select($event)" class="nav-link" uib-tab-heading-transclude>{{heading}}</a>\n</li>\n')}]),angular.module("uib/template/tabs/tabset.html",[]).run(["$templateCache",function(a){a.put("uib/template/tabs/tabset.html",'<div>\n  <ul class="nav nav-{{tabset.type || \'tabs\'}}" ng-class="{\'nav-stacked\': vertical, \'nav-justified\': justified}" ng-transclude></ul>\n  <div class="tab-content">\n    <div class="tab-pane"\n         ng-repeat="tab in tabset.tabs"\n         ng-class="{active: tabset.active === tab.index}"\n         uib-tab-content-transclude="tab">\n    </div>\n  </div>\n</div>\n')}]),angular.module("uib/template/timepicker/timepicker.html",[]).run(["$templateCache",function(a){a.put("uib/template/timepicker/timepicker.html",'<table class="uib-timepicker">\n  <tbody>\n    <tr class="text-center" ng-show="::showSpinners">\n      <td class="uib-increment hours"><a ng-click="incrementHours()" ng-class="{disabled: noIncrementHours()}" class="btn btn-link" ng-disabled="noIncrementHours()" tabindex="-1"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n      <td>&nbsp;</td>\n      <td class="uib-increment minutes"><a ng-click="incrementMinutes()" ng-class="{disabled: noIncrementMinutes()}" class="btn btn-link" ng-disabled="noIncrementMinutes()" tabindex="-1"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n      <td ng-show="showSeconds">&nbsp;</td>\n      <td ng-show="showSeconds" class="uib-increment seconds"><a ng-click="incrementSeconds()" ng-class="{disabled: noIncrementSeconds()}" class="btn btn-link" ng-disabled="noIncrementSeconds()" tabindex="-1"><span class="glyphicon glyphicon-chevron-up"></span></a></td>\n      <td ng-show="showMeridian"></td>\n    </tr>\n    <tr>\n      <td class="form-group uib-time hours" ng-class="{\'has-error\': invalidHours}">\n        <input type="text" placeholder="HH" ng-model="hours" ng-change="updateHours()" class="form-control text-center" ng-readonly="::readonlyInput" maxlength="2" tabindex="{{::tabindex}}" ng-disabled="noIncrementHours()" ng-blur="blur()">\n      </td>\n      <td class="uib-separator">:</td>\n      <td class="form-group uib-time minutes" ng-class="{\'has-error\': invalidMinutes}">\n        <input type="text" placeholder="MM" ng-model="minutes" ng-change="updateMinutes()" class="form-control text-center" ng-readonly="::readonlyInput" maxlength="2" tabindex="{{::tabindex}}" ng-disabled="noIncrementMinutes()" ng-blur="blur()">\n      </td>\n      <td ng-show="showSeconds" class="uib-separator">:</td>\n      <td class="form-group uib-time seconds" ng-class="{\'has-error\': invalidSeconds}" ng-show="showSeconds">\n        <input type="text" placeholder="SS" ng-model="seconds" ng-change="updateSeconds()" class="form-control text-center" ng-readonly="readonlyInput" maxlength="2" tabindex="{{::tabindex}}" ng-disabled="noIncrementSeconds()" ng-blur="blur()">\n      </td>\n      <td ng-show="showMeridian" class="uib-time am-pm"><button type="button" ng-class="{disabled: noToggleMeridian()}" class="btn btn-default text-center" ng-click="toggleMeridian()" ng-disabled="noToggleMeridian()" tabindex="{{::tabindex}}">{{meridian}}</button></td>\n    </tr>\n    <tr class="text-center" ng-show="::showSpinners">\n      <td class="uib-decrement hours"><a ng-click="decrementHours()" ng-class="{disabled: noDecrementHours()}" class="btn btn-link" ng-disabled="noDecrementHours()" tabindex="-1"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n      <td>&nbsp;</td>\n      <td class="uib-decrement minutes"><a ng-click="decrementMinutes()" ng-class="{disabled: noDecrementMinutes()}" class="btn btn-link" ng-disabled="noDecrementMinutes()" tabindex="-1"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n      <td ng-show="showSeconds">&nbsp;</td>\n      <td ng-show="showSeconds" class="uib-decrement seconds"><a ng-click="decrementSeconds()" ng-class="{disabled: noDecrementSeconds()}" class="btn btn-link" ng-disabled="noDecrementSeconds()" tabindex="-1"><span class="glyphicon glyphicon-chevron-down"></span></a></td>\n      <td ng-show="showMeridian"></td>\n    </tr>\n  </tbody>\n</table>\n')}]),angular.module("uib/template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(a){a.put("uib/template/typeahead/typeahead-match.html",'<a href\n   tabindex="-1"\n   ng-bind-html="match.label | uibTypeaheadHighlight:query"\n   ng-attr-title="{{match.label}}"></a>\n')}]),angular.module("uib/template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(a){a.put("uib/template/typeahead/typeahead-popup.html",'<ul class="dropdown-menu" ng-show="isOpen() && !moveInProgress" ng-style="{top: position().top+\'px\', left: position().left+\'px\'}" role="listbox" aria-hidden="{{!isOpen()}}">\n    <li class="uib-typeahead-match" ng-repeat="match in matches track by $index" ng-class="{active: isActive($index) }" ng-mouseenter="selectActive($index)" ng-click="selectMatch($index, $event)" role="option" id="{{::match.id}}">\n        <div uib-typeahead-match index="$index" match="match" query="query" template-url="templateUrl"></div>\n    </li>\n</ul>\n')}]),angular.module("ui.bootstrap.carousel").run(function(){!angular.$$csp().noInlineStyle&&!
1248angular.$$uibCarouselCss&&angular.element(document).find("head").prepend('<style type="text/css">.ng-animate.item:not(.left):not(.right){-webkit-transition:0s ease-in-out left;transition:0s ease-in-out left}</style>'),angular.$$uibCarouselCss=!0}),angular.module("ui.bootstrap.datepicker").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibDatepickerCss&&angular.element(document).find("head").prepend('<style type="text/css">.uib-datepicker .uib-title{width:100%;}.uib-day button,.uib-month button,.uib-year button{min-width:100%;}.uib-left,.uib-right{width:100%}</style>'),angular.$$uibDatepickerCss=!0}),angular.module("ui.bootstrap.position").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibPositionCss&&angular.element(document).find("head").prepend('<style type="text/css">.uib-position-measure{display:block !important;visibility:hidden !important;position:absolute !important;top:-9999px !important;left:-9999px !important;}.uib-position-scrollbar-measure{position:absolute !important;top:-9999px !important;width:50px !important;height:50px !important;overflow:scroll !important;}.uib-position-body-scrollbar-measure{overflow:scroll !important;}</style>'),angular.$$uibPositionCss=!0}),angular.module("ui.bootstrap.datepickerPopup").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibDatepickerpopupCss&&angular.element(document).find("head").prepend('<style type="text/css">.uib-datepicker-popup.dropdown-menu{display:block;float:none;margin:0;}.uib-button-bar{padding:10px 9px 2px;}</style>'),angular.$$uibDatepickerpopupCss=!0}),angular.module("ui.bootstrap.tooltip").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibTooltipCss&&angular.element(document).find("head").prepend('<style type="text/css">[uib-tooltip-popup].tooltip.top-left > .tooltip-arrow,[uib-tooltip-popup].tooltip.top-right > .tooltip-arrow,[uib-tooltip-popup].tooltip.bottom-left > .tooltip-arrow,[uib-tooltip-popup].tooltip.bottom-right > .tooltip-arrow,[uib-tooltip-popup].tooltip.left-top > .tooltip-arrow,[uib-tooltip-popup].tooltip.left-bottom > .tooltip-arrow,[uib-tooltip-popup].tooltip.right-top > .tooltip-arrow,[uib-tooltip-popup].tooltip.right-bottom > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.top-left > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.top-right > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.bottom-left > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.bottom-right > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.left-top > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.left-bottom > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.right-top > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.right-bottom > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.top-left > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.top-right > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.bottom-left > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.bottom-right > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.left-top > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.left-bottom > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.right-top > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.right-bottom > .tooltip-arrow,[uib-popover-popup].popover.top-left > .arrow,[uib-popover-popup].popover.top-right > .arrow,[uib-popover-popup].popover.bottom-left > .arrow,[uib-popover-popup].popover.bottom-right > .arrow,[uib-popover-popup].popover.left-top > .arrow,[uib-popover-popup].popover.left-bottom > .arrow,[uib-popover-popup].popover.right-top > .arrow,[uib-popover-popup].popover.right-bottom > .arrow,[uib-popover-html-popup].popover.top-left > .arrow,[uib-popover-html-popup].popover.top-right > .arrow,[uib-popover-html-popup].popover.bottom-left > .arrow,[uib-popover-html-popup].popover.bottom-right > .arrow,[uib-popover-html-popup].popover.left-top > .arrow,[uib-popover-html-popup].popover.left-bottom > .arrow,[uib-popover-html-popup].popover.right-top > .arrow,[uib-popover-html-popup].popover.right-bottom > .arrow,[uib-popover-template-popup].popover.top-left > .arrow,[uib-popover-template-popup].popover.top-right > .arrow,[uib-popover-template-popup].popover.bottom-left > .arrow,[uib-popover-template-popup].popover.bottom-right > .arrow,[uib-popover-template-popup].popover.left-top > .arrow,[uib-popover-template-popup].popover.left-bottom > .arrow,[uib-popover-template-popup].popover.right-top > .arrow,[uib-popover-template-popup].popover.right-bottom > .arrow{top:auto;bottom:auto;left:auto;right:auto;margin:0;}[uib-popover-popup].popover,[uib-popover-html-popup].popover,[uib-popover-template-popup].popover{display:block !important;}</style>'),angular.$$uibTooltipCss=!0}),angular.module("ui.bootstrap.timepicker").run(function(){!angular.$$csp().noInlineStyle&&!
1248angular.$$uibTimepickerCss&&angular.element(document).find("head").prepend('<style type="text/css">.uib-time input{width:50px;}</style>'),angular.$$uibTimepickerCss=!0}),angular.module("ui.bootstrap.typeahead").run(function(){!angular.$$csp().noInlineStyle&&!angular.$$uibTypeaheadCss&&angular.element(document).find("head").prepend('<style type="text/css">[uib-typeahead-popup].dropdown-menu{display:block;}</style>'),angular.$$uibTypeaheadCss=!0});;
1249/*!
1250 * Bootstrap v3.3.7 (http://getbootstrap.com)
1251 * Copyright 2011-2016 Twitter, Inc.
1252 * Licensed under the MIT license
1253 */�
vendor: 32,034 bytes, lines 1253-1254
1253
1254if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){document===a.target||this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);if(this.$element.trigger(g),!g.isDefaultPrevented())return f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=window.SVGElement&&c instanceof window.SVGElement,g=d?{top:0,left:0}:f?null:b.offset(),h={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},i=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,h,i,g)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){
vendor: 2,604 bytes, lines 1254-1255
1254
1255this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;
1255e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e<c&&"top";if("bottom"==this.affixed)return null!=c?!(e+this.unpin<=f.top)&&"bottom":!(e+g<=a-d)&&"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&e<=c?"top":null!=d&&i+j>=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);;
1256/**
1257*
1258*  MD5 (Message-Digest Algorithm)
1259*  http://www.webtoolkit.info/
1260*
1261**/
1262
1263var MD5 = function (string) {
1264
1265	function RotateLeft(lValue, iShiftBits) {
1266		return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
1267	}
1268
1269	function AddUnsigned(lX,lY) {
1270		var lX4,lY4,lX8,lY8,lResult;
1271		lX8 = (lX & 0x80000000);
1272		lY8 = (lY & 0x80000000);
1273		lX4 = (lX & 0x40000000);
1274		lY4 = (lY & 0x40000000);
1275		lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF);
1276		if (lX4 & lY4) {
1277			return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
1278		}
1279		if (lX4 | lY4) {
1280			if (lResult & 0x40000000) {
1281				return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
1282			} else {
1283				return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
1284			}
1285		} else {
1286			return (lResult ^ lX8 ^ lY8);
1287		}
1288 	}
1289
1290 	function F(x,y,z) { return (x & y) | ((~x) & z); }
1291 	function G(x,y,z) { return (x & z) | (y & (~z)); }
1292 	function H(x,y,z) { return (x ^ y ^ z); }
1293	function I(x,y,z) { return (y ^ (x | (~z))); }
1294
1295	function FF(a,b,c,d,x,s,ac) {
1296		a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
1297		return AddUnsigned(RotateLeft(a, s), b);
1298	};
1299
1300	function GG(a,b,c,d,x,s,ac) {
1301		a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
1302		return AddUnsigned(RotateLeft(a, s), b);
1303	};
1304
1305	function HH(a,b,c,d,x,s,ac) {
1306		a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
1307		return AddUnsigned(RotateLeft(a, s), b);
1308	};
1309
1310	function II(a,b,c,d,x,s,ac) {
1311		a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
1312		return AddUnsigned(RotateLeft(a, s), b);
1313	};
1314
1315	function ConvertToWordArray(string) {
1316		var lWordCount;
1317		var lMessageLength = string.length;
1318		var lNumberOfWords_temp1=lMessageLength + 8;
1319		var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64;
1320		var lNumberOfWords = (lNumberOfWords_temp2+1)*16;
1321		var lWordArray=Array(lNumberOfWords-1);
1322		var lBytePosition = 0;
1323		var lByteCount = 0;
1324		while ( lByteCount < lMessageLength ) {
1325			lWordCount = (lByteCount-(lByteCount % 4))/4;
1326			lBytePosition = (lByteCount % 4)*8;
1327			lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition));
1328			lByteCount++;
1329		}
1330		lWordCount = (lByteCount-(lByteCount % 4))/4;
1331		lBytePosition = (lByteCount % 4)*8;
1332		lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition);
1333		lWordArray[lNumberOfWords-2] = lMessageLength<<3;
1334		lWordArray[lNumberOfWords-1] = lMessageLength>>>29;
1335		return lWordArray;
1336	};
1337
1338	function WordToHex(lValue) {
1339		var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;
1340		for (lCount = 0;lCount<=3;lCount++) {
1341			lByte = (lValue>>>(lCount*8)) & 255;
1342			WordToHexValue_temp = "0" + lByte.toString(16);
1343			WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2);
1344		}
1345		return WordToHexValue;
1346	};
1347
1348	function Utf8Encode(string) {
1349		string = string.replace(/\r\n/g,"\n");
1350		var utftext = "";
1351
1352		for (var n = 0; n < string.length; n++) {
1353
1354			var c = string.charCodeAt(n);
1355
1356			if (c < 128) {
1357				utftext += String.fromCharCode(c);
1358			}
1359			else if((c > 127) && (c < 2048)) {
1360				utftext += String.fromCharCode((c >> 6) | 192);
1361				utftext += String.fromCharCode((c & 63) | 128);
1362			}
1363			else {
1364				utftext += String.fromCharCode((c >> 12) | 224);
1365				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
1366				utftext += String.fromCharCode((c & 63) | 128);
1367			}
1368
1369		}
1370
1371		return utftext;
1372	};
1373
1374	var x=Array();
1375	var k,AA,BB,CC,DD,a,b,c,d;
1376	var S11=7, S12=12, S13=17, S14=22;
1377	var S21=5, S22=9 , S23=14, S24=20;
1378	var S31=4, S32=11, S33=16, S34=23;
1379	var S41=6, S42=10, S43=15, S44=21;
1380
1381	string = Utf8Encode(string);
1382
1383	x = ConvertToWordArray(string);
1384
1385	a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
1386
1387	for (k=0;k<x.length;k+=16) {
1388		AA=a; BB=b; CC=c; DD=d;
1389		a=FF(a,b,c,d,x[k+0], S11,0xD76AA478);
1390		d=FF(d,a,b,c,x[k+1], S12,0xE8C7B756);
1391		c=FF(c,d,a,b,x[k+2], S13,0x242070DB);
1392		b=FF(b,c,d,a,x[k+3], S14,0xC1BDCEEE);
1393		a=FF(a,b,c,d,x[k+4], S11,0xF57C0FAF);
1394		d=FF(d,a,b,c,x[k+5], S12,0x4787C62A);
1395		c=FF(c,d,a,b,x[k+6], S13,0xA8304613);
1396		b=FF(b,c,d,a,x[k+7], S14,0xFD469501);
1397		a=FF(a,b,c,d,x[k+8], S11,0x698098D8);
1398		d=FF(d,a,b,c,x[k+9], S12,0x8B44F7AF);
1399		c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);
1400		b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE);
1401		a=FF(a,b,c,d,x[k+12],S11,0x6B901122);
1402		d=FF(d,a,b,c,x[k+13],S12,0xFD987193);
1403		c=FF(c,d,a,b,x[k+14],S13,0xA679438E);
1404		b=FF(b,c,d,a,x[k+15],S14,0x49B40821);
1405		a=GG(a,b,c,d,x[k+1], S21,0xF61E2562);
1406		d=GG(d,a,b,c,x[k+6], S22,0xC040B340);
1407		c=GG(c,d,a,b,x[k+11],S23,0x265E5A51);
1408		b=GG(b,c,d,a,x[k+0], S24,0xE9B6C7AA);
1409		a=GG(a,b,c,d,x[k+5], S21,0xD62F105D);
1410		d=GG(d,a,b,c,x[k+10],S22,0x2441453);
1411		c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681);
1412		b=GG(b,c,d,a,x[k+4], S24,0xE7D3FBC8);
1413		a=GG(a,b,c,d,x[k+9], S21,0x21E1CDE6);
1414		d=GG(d,a,b,c,x[k+14],S22,0xC33707D6);
1415		c=GG(c,d,a,b,x[k+3], S23,0xF4D50D87);
1416		b=GG(b,c,d,a,x[k+8], S24,0x455A14ED);
1417		a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905);
1418		d=GG(d,a,b,c,x[k+2], S22,0xFCEFA3F8);
1419		c=GG(c,d,a,b,x[k+7], S23,0x676F02D9);
1420		b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);
1421		a=HH(a,b,c,d,x[k+5], S31,0xFFFA3942);
1422		d=HH(d,a,b,c,x[k+8], S32,0x8771F681);
1423		c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122);
1424		b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C);
1425		a=HH(a,b,c,d,x[k+1], S31,0xA4BEEA44);
1426		d=HH(d,a,b,c,x[k+4], S32,0x4BDECFA9);
1427		c=HH(c,d,a,b,x[k+7], S33,0xF6BB4B60);
1428		b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70);
1429		a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6);
1430		d=HH(d,a,b,c,x[k+0], S32,0xEAA127FA);
1431		c=HH(c,d,a,b,x[k+3], S33,0xD4EF3085);
1432		b=HH(b,c,d,a,x[k+6], S34,0x4881D05);
1433		a=HH(a,b,c,d,x[k+9], S31,0xD9D4D039);
1434		d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5);
1435		c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8);
1436		b=HH(b,c,d,a,x[k+2], S34,0xC4AC5665);
1437		a=II(a,b,c,d,x[k+0], S41,0xF4292244);
1438		d=II(d,a,b,c,x[k+7], S42,0x432AFF97);
1439		c=II(c,d,a,b,x[k+14],S43,0xAB9423A7);
1440		b=II(b,c,d,a,x[k+5], S44,0xFC93A039);
1441		a=II(a,b,c,d,x[k+12],S41,0x655B59C3);
1442		d=II(d,a,b,c,x[k+3], S42,0x8F0CCC92);
1443		c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D);
1444		b=II(b,c,d,a,x[k+1], S44,0x85845DD1);
1445		a=II(a,b,c,d,x[k+8], S41,0x6FA87E4F);
1446		d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0);
1447		c=II(c,d,a,b,x[k+6], S43,0xA3014314);
1448		b=II(b,c,d,a,x[k+13],S44,0x4E0811A1);
1449		a=II(a,b,c,d,x[k+4], S41,0xF7537E82);
1450		d=II(d,a,b,c,x[k+11],S42,0xBD3AF235);
1451		c=II(c,d,a,b,x[k+2], S43,0x2AD7D2BB);
1452		b=II(b,c,d,a,x[k+9], S44,0xEB86D391);
1453		a=AddUnsigned(a,AA);
1454		b=AddUnsigned(b,BB);
1455		c=AddUnsigned(c,CC);
1456		d=AddUnsigned(d,DD);
1457	}
1458
1459	var temp = WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d);
1460
1461	return temp.toLowerCase();
1462};
1463/*
1464This software is allowed to use under GPL or you need to obtain Commercial or Enterprise License
1465 to use it in non-GPL project. Please contact [email protected] for details
1466*/
1467if (!window.dhtmlx) {
1468	dhtmlx = function(obj){
1469		for (var a in obj) dhtmlx[a]=obj[a];
1470		return dhtmlx; //simple singleton
1471	};
1472}
1473dhtmlx.extend_api=function(name,map,ext){
1474    var t = window[name];
1475    if (!t) return; //component not defined
1476    window[name]=function(obj){
1477        var that;
1478
1479        if (obj && typeof obj == "object" && !obj.tagName){
1480            that = t.apply(this,(map._init?map._init(obj):arguments));
1481            //global settings
1482            for (var a in dhtmlx)
1483                if (map[a]) this[map[a]](dhtmlx[a]);
1484            //local settings
1485            for (var a in obj){
1486                if (map[a]) this[map[a]](obj[a]);
1487                else if (a.indexOf("on")===0){
1488                    this.attachEvent(a,obj[a]);
1489                }
1490            }
1491        } else
1492            that = t.apply(this,arguments);
1493        if (map._patch) map._patch(this);
1494        return that||this;
1495    };
1496    window[name].prototype=t.prototype;
1497    if (ext)
1498        dhtmlXHeir(window[name].prototype,ext);
1499};
1500
1501dhtmlxAjax={
1502    get:function(url,callback){
1503        var t=new dtmlXMLLoaderObject(true);
1504        t.async=(arguments.length<3);
1505        t.waitCall=callback;
1506        t.loadXML(url);
1507        return t;
1508    },
1509    post:function(url,post,callback){
1510        var t=new dtmlXMLLoaderObject(true);
1511        t.async=(arguments.length<4);
1512        t.waitCall=callback;
1513        t.loadXML(url,true,post);
1514        return t;
1515    },
1516    getSync:function(url){
1517        return this.get(url,null,true);
1518    },
1519    postSync:function(url,post){
1520        return this.post(url,post,null,true);
1521    }
1522};
1523
1524/**
1525 *     @desc: xmlLoader object
1526 *     @type: private
1527 *     @param: funcObject - xml parser function
1528 *     @param: object - jsControl object
1529 *     @param: async - sync/async mode (async by default)
1530 *     @param: rSeed - enable/disable random seed ( prevent IE caching)
1531 *     @topic: 0
1532 */
1533function dtmlXMLLoaderObject(funcObject, dhtmlObject, async, rSeed){
1534    this.xmlDoc="";
1535
1536    if (typeof (async) != "undefined")
1537        this.async=async;
1538    else
1539        this.async=true;
1540
1541    this.onloadAction=funcObject||null;
1542    this.mainObject=dhtmlObject||null;
1543    this.waitCall=null;
1544    this.rSeed=rSeed||false;
1545    return this;
1546}
1547
1548dtmlXMLLoaderObject.count = 0;
1549
1550/**
1551 *     @desc: xml loading handler
1552 *     @type: private
1553 *     @param: dtmlObject - xmlLoader object
1554 *     @topic: 0
1555 */
1556dtmlXMLLoaderObject.prototype.waitLoadFunction=function(dhtmlObject){
1557    var once = true;
1558    this.check=function (){
1559        if ((dhtmlObject)&&(dhtmlObject.onloadAction)){
1560            if ((!dhtmlObject.xmlDoc.readyState)||(dhtmlObject.xmlDoc.readyState == 4)){
1561                if (!once)
1562                    return;
1563
1564                once=false; //IE 5 fix
1565                dtmlXMLLoaderObject.count++;
1566                if (typeof dhtmlObject.onloadAction == "function")
1567                    dhtmlObject.onloadAction(dhtmlObject.mainObject, null, null, null, dhtmlObject);
1568
1569                if (dhtmlObject.waitCall){
1570                    dhtmlObject.waitCall.call(this,dhtmlObject);
1571                    dhtmlObject.waitCall=null;
1572                }
1573            }
1574        }
1575    };
1576    return this.check;
1577};
1578
1579/**
1580 *     @desc: return XML top node
1581 *     @param: tagName - top XML node tag name (not used in IE, required for Safari and Mozilla)
1582 *     @type: private
1583 *     @returns: top XML node
1584 *     @topic: 0
1585 */
1586dtmlXMLLoaderObject.prototype.getXMLTopNode=function(tagName, oldObj){
1587    var z;
1588
1589    if (this.xmlDoc.responseXML){
1590        var temp = this.xmlDoc.responseXML.getElementsByTagName(tagName);
1591        if(temp.length === 0 && tagName.indexOf(":")!=-1)
1592            var temp = this.xmlDoc.responseXML.getElementsByTagName((tagName.split(":"))[1]);
1593        z = temp[0];
1594    } else
1595        z = this.xmlDoc.documentElement;
1596
1597    if (z){
1598        this._retry=false;
1599        return z;
1600    }
1601
1602    if (!this._retry&&_isIE){
1603        this._retry=true;
1604        var oldObj = this.xmlDoc;
1605        this.loadXMLString(this.xmlDoc.responseText.replace(/^[\s]+/,""), true);
1606        return this.getXMLTopNode(tagName, oldObj);
1607    }
1608
1609    dhtmlxError.throwError("LoadXML", "Incorrect XML", [
1610        (oldObj||this.xmlDoc),
1611        this.mainObject
1612    ]);
1613
1614    return document.createElement("DIV");
1615};
1616
1617/**
1618 *     @desc: load XML from string
1619 *     @type: private
1620 *     @param: xmlString - xml string
1621 *     @topic: 0
1622 */
1623dtmlXMLLoaderObject.prototype.loadXMLString=function(xmlString, silent){
1624
1625    if (!_isIE){
1626        var parser = new DOMParser();
1627        this.xmlDoc=parser.parseFromString(xmlString, "text/xml");
1628    } else {
1629        this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
1630        this.xmlDoc.async=this.async;
1631        this.xmlDoc.onreadystatechange = function(){};
1632        this.xmlDoc["loadXM"+"L"](xmlString);
1633    }
1634
1635    if (silent)
1636        return;
1637
1638    if (this.onloadAction)
1639        this.onloadAction(this.mainObject, null, null, null, this);
1640
1641    if (this.waitCall){
1642        this.waitCall();
1643        this.waitCall=null;
1644    }
1645};
1646/**
1647 *     @desc: load XML
1648 *     @type: private
1649 *     @param: filePath - xml file path
1650 *     @param: postMode - send POST request
1651 *     @param: postVars - list of vars for post request
1652 *     @topic: 0
1653 */
1654dtmlXMLLoaderObject.prototype.loadXML=function(filePath, postMode, postVars, rpc){
1655    if (this.rSeed)
1656        filePath+=((filePath.indexOf("?") != -1) ? "&" : "?")+"a_dhx_rSeed="+(new Date()).valueOf();
1657    this.filePath=filePath;
1658
1659    if ((!_isIE)&&(window.XMLHttpRequest))
1660        this.xmlDoc=new XMLHttpRequest();
1661    else {
1662        this.xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");
1663    }
1664
1665    if (this.async)
1666        this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this);
1667    this.xmlDoc.open(postMode ? "POST" : "GET", filePath, this.async);
1668
1669    if (rpc){
1670        this.xmlDoc.setRequestHeader("User-Agent", "dhtmlxRPC v0.1 ("+navigator.userAgent+")");
1671        this.xmlDoc.setRequestHeader("Content-type", "text/xml");
1672    }
1673
1674    else if (postMode)
1675        this.xmlDoc.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
1676
1677    this.xmlDoc.setRequestHeader("X-Requested-With","XMLHttpRequest");
1678    this.xmlDoc.send(null||postVars);
1679
1680    if (!this.async)
1681        (new this.waitLoadFunction(this))();
1682};
1683/**
1684 *     @desc: destructor, cleans used memory
1685 *     @type: private
1686 *     @topic: 0
1687 */
1688dtmlXMLLoaderObject.prototype.destructor=function(){
1689    this._filterXPath = null;
1690    this._getAllNamedChilds = null;
1691    this._retry = null;
1692    this.async = null;
1693    this.rSeed = null;
1694    this.filePath = null;
1695    this.onloadAction = null;
1696    this.mainObject = null;
1697    this.xmlDoc = null;
1698    this.doXPath = null;
1699    this.doXPathOpera = null;
1700    this.doXSLTransToObject = null;
1701    this.doXSLTransToString = null;
1702    this.loadXML = null;
1703    this.loadXMLString = null;
1704    // this.waitLoadFunction = null;
1705    this.doSerialization = null;
1706    this.xmlNodeToJSON = null;
1707    this.getXMLTopNode = null;
1708    this.setXSLParamValue = null;
1709    return null;
1710};
1711
1712dtmlXMLLoaderObject.prototype.xmlNodeToJSON = function(node){
1713    var t={};
1714    for (var i=0; i<node.attributes.length; i++)
1715        t[node.attributes[i].name]=node.attributes[i].value;
1716    t["_tagvalue"]=node.firstChild?node.firstChild.nodeValue:"";
1717    for (var i=0; i<node.childNodes.length; i++){
1718        var name=node.childNodes[i].tagName;
1719        if (name){
1720            if (!t[name]) t[name]=[];
1721            t[name].push(this.xmlNodeToJSON(node.childNodes[i]));
1722        }
1723    }
1724    return t;
1725};
1726
1727/**
1728 *     @desc: Call wrapper
1729 *     @type: private
1730 *     @param: funcObject - action handler
1731 *     @param: dhtmlObject - user data
1732 *     @returns: function handler
1733 *     @topic: 0
1734 */
1735function callerFunction(funcObject, dhtmlObject){
1736    this.handler=function(e){
1737        if (!e)
1738            e=window.event;
1739        funcObject(e, dhtmlObject);
1740        return true;
1741    };
1742    return this.handler;
1743}
1744
1745/**
1746 *     @desc: Calculate absolute position of html object
1747 *     @type: private
1748 *     @param: htmlObject - html object
1749 *     @topic: 0
1750 */
1751function getAbsoluteLeft(htmlObject){
1752    return getOffset(htmlObject).left;
1753}
1754/**
1755 *     @desc: Calculate absolute position of html object
1756 *     @type: private
1757 *     @param: htmlObject - html object
1758 *     @topic: 0
1759 */
1760function getAbsoluteTop(htmlObject){
1761    return getOffset(htmlObject).top;
1762}
1763
1764function getOffsetSum(elem) {
1765    var top=0, left=0;
1766    while(elem) {
1767        top = top + parseInt(elem.offsetTop);
1768        left = left + parseInt(elem.offsetLeft);
1769        elem = elem.offsetParent;
1770    }
1771    return {top: top, left: left};
1772}
1773function getOffsetRect(elem) {
1774    var box = elem.getBoundingClientRect();
1775    var body = document.body;
1776    var docElem = document.documentElement;
1777    var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
1778    var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
1779    var clientTop = docElem.clientTop || body.clientTop || 0;
1780    var clientLeft = docElem.clientLeft || body.clientLeft || 0;
1781    var top  = box.top +  scrollTop - clientTop;
1782    var left = box.left + scrollLeft - clientLeft;
1783    return { top: Math.round(top), left: Math.round(left) };
1784}
1785function getOffset(elem) {
1786    if (elem.getBoundingClientRect) {
1787        return getOffsetRect(elem);
1788    } else {
1789        return getOffsetSum(elem);
1790    }
1791}
1792
1793/**
1794 *     @desc: Convert string to it boolean representation
1795 *     @type: private
1796 *     @param: inputString - string for covertion
1797 *     @topic: 0
1798 */
1799function convertStringToBoolean(inputString){
1800    if (typeof (inputString) == "string")
1801        inputString=inputString.toLowerCase();
1802
1803    switch (inputString){
1804        case "1":
1805        case "true":
1806        case "yes":
1807        case "y":
1808        case 1:
1809        case true:
1810            return true;
1811        default:
1812            return false;
1813    }
1814}
1815
1816/**
1817 *     @desc: find out what symbol to use as url param delimiters in further params
1818 *     @type: private
1819 *     @param: str - current url string
1820 *     @topic: 0
1821 */
1822function getUrlSymbol(str){
1823    if (str.indexOf("?") != -1)
1824        return "&";
1825    else
1826        return "?";
1827}
1828
1829function dhtmlDragAndDropObject(){
1830    if (window.dhtmlDragAndDrop)
1831        return window.dhtmlDragAndDrop;
1832
1833    this.lastLanding=0;
1834    this.dragNode=0;
1835    this.dragStartNode=0;
1836    this.dragStartObject=0;
1837    this.tempDOMU=null;
1838    this.tempDOMM=null;
1839    this.waitDrag=0;
1840    window.dhtmlDragAndDrop=this;
1841
1842    return this;
1843}
1844
1845dhtmlDragAndDropObject.prototype.removeDraggableItem=function(htmlNode){
1846    htmlNode.onmousedown=null;
1847    htmlNode.dragStarter=null;
1848    htmlNode.dragLanding=null;
1849};
1850
1851dhtmlDragAndDropObject.prototype.addDraggableItem=function(htmlNode, dhtmlObject){
1852    htmlNode.onmousedown=this.preCreateDragCopy;
1853    htmlNode.dragStarter=dhtmlObject;
1854    this.addDragLanding(htmlNode, dhtmlObject);
1855};
1856
1857dhtmlDragAndDropObject.prototype.addDragLanding=function(htmlNode, dhtmlObject){
1858    htmlNode.dragLanding=dhtmlObject;
1859};
1860
1861dhtmlDragAndDropObject.prototype.preCreateDragCopy=function(e){
1862    if ((e||window.event) && (e||event).button == 2)
1863        return;
1864
1865    if (window.dhtmlDragAndDrop.waitDrag){
1866        window.dhtmlDragAndDrop.waitDrag=0;
1867        document.body.onmouseup=window.dhtmlDragAndDrop.tempDOMU;
1868        document.body.onmousemove=window.dhtmlDragAndDrop.tempDOMM;
1869        return false;
1870    }
1871
1872    if (window.dhtmlDragAndDrop.dragNode)
1873        window.dhtmlDragAndDrop.stopDrag(e);
1874
1875    window.dhtmlDragAndDrop.waitDrag=1;
1876    window.dhtmlDragAndDrop.tempDOMU=document.body.onmouseup;
1877    window.dhtmlDragAndDrop.tempDOMM=document.body.onmousemove;
1878    window.dhtmlDragAndDrop.dragStartNode=this;
1879    window.dhtmlDragAndDrop.dragStartObject=this.dragStarter;
1880    document.body.onmouseup=window.dhtmlDragAndDrop.preCreateDragCopy;
1881    document.body.onmousemove=window.dhtmlDragAndDrop.callDrag;
1882    window.dhtmlDragAndDrop.downtime = new Date().valueOf();
1883
1884
1885    if ((e)&&(e.preventDefault)){
1886        e.preventDefault();
1887        return false;
1888    }
1889    return false;
1890};
1891
1892dhtmlDragAndDropObject.prototype.callDrag=function(e){
1893    if (!e)
1894        e=window.event;
1895    var dragger=window.dhtmlDragAndDrop;
1896    if ((new Date()).valueOf()-dragger.downtime<100) return;
1897
1898    //if ((e.button == 0)&&(_isIE))
1899    //	return dragger.stopDrag();
1900
1901    if (!dragger.dragNode){
1902        if (dragger.waitDrag){
1903            dragger.dragNode=dragger.dragStartObject._createDragNode(dragger.dragStartNode, e);
1904
1905            if (!dragger.dragNode)
1906                return dragger.stopDrag();
1907
1908            dragger.dragNode.onselectstart=function(){return false;};
1909            dragger.gldragNode=dragger.dragNode;
1910            document.body.appendChild(dragger.dragNode);
1911            document.body.onmouseup=dragger.stopDrag;
1912            dragger.waitDrag=0;
1913            dragger.dragNode.pWindow=window;
1914            dragger.initFrameRoute();
1915        }
1916        else return dragger.stopDrag(e, true);
1917    }
1918
1919    if (dragger.dragNode.parentNode != window.document.body && dragger.gldragNode){
1920        var grd = dragger.gldragNode;
1921
1922        if (dragger.gldragNode.old)
1923            grd=dragger.gldragNode.old;
1924
1925        //if (!document.all) dragger.calculateFramePosition();
1926        grd.parentNode.removeChild(grd);
1927        var oldBody = dragger.dragNode.pWindow;
1928
1929        if (grd.pWindow &&	grd.pWindow.dhtmlDragAndDrop.lastLanding)
1930            grd.pWindow.dhtmlDragAndDrop.lastLanding.dragLanding._dragOut(grd.pWindow.dhtmlDragAndDrop.lastLanding);
1931
1932        //		var oldp=dragger.dragNode.parentObject;
1933        if (_isIE){
1934            var div = document.createElement("Div");
1935            div.innerHTML=dragger.dragNode.outerHTML;
1936            dragger.dragNode=div.childNodes[0];
1937        } else
1938            dragger.dragNode=dragger.dragNode.cloneNode(true);
1939
1940        dragger.dragNode.pWindow=window;
1941        //		dragger.dragNode.parentObject=oldp;
1942
1943        dragger.gldragNode.old=dragger.dragNode;
1944        document.body.appendChild(dragger.dragNode);
1945        oldBody.dhtmlDragAndDrop.dragNode=dragger.dragNode;
1946    }
1947
1948    dragger.dragNode.style.left=e.clientX+15 + 
1949        (dragger.fx ? dragger.fx*(-1) : 0) +
1950        (document.body.scrollLeft||document.documentElement.scrollLeft)+"px";
1951    dragger.dragNode.style.top=e.clientY+3+
1952        (dragger.fy ? dragger.fy*(-1) : 0) +
1953        (document.body.scrollTop||document.documentElement.scrollTop)+"px";
1954
1955    var z;
1956    if (!e.srcElement)
1957        z = e.target;
1958    else
1959        z=e.srcElement;
1960    dragger.checkLanding(z, e);
1961};
1962
1963dhtmlDragAndDropObject.prototype.calculateFramePosition=function(n){
1964    //this.fx = 0, this.fy = 0;
1965    if (window.name){
1966        var el = parent.frames[window.name].frameElement.offsetParent;
1967        var fx = 0;
1968        var fy = 0;
1969
1970        while (el){
1971            fx+=el.offsetLeft;
1972            fy+=el.offsetTop;
1973            el=el.offsetParent;
1974        }
1975
1976        if ((parent.dhtmlDragAndDrop)){
1977            var ls = parent.dhtmlDragAndDrop.calculateFramePosition(1);
1978            fx+=ls.split('_')[0]*1;
1979            fy+=ls.split('_')[1]*1;
1980        }
1981
1982        if (n)
1983            return fx+"_"+fy;
1984        else
1985            this.fx=fx;
1986        this.fy=fy;
1987    }
1988    return "0_0";
1989};
1990
1991dhtmlDragAndDropObject.prototype.checkLanding=function(htmlObject, e){
1992    if ((htmlObject)&&(htmlObject.dragLanding)){
1993        if (this.lastLanding)
1994            this.lastLanding.dragLanding._dragOut(this.lastLanding);
1995        this.lastLanding=htmlObject;
1996        this.lastLanding=this.lastLanding.dragLanding._dragIn(this.lastLanding, this.dragStartNode, e.clientX,
1997            e.clientY, e);
1998        this.lastLanding_scr=(_isIE ? e.srcElement : e.target);
1999    } else {
2000        if ((htmlObject)&&(htmlObject.tagName != "BODY"))
2001            this.checkLanding(htmlObject.parentNode, e);
2002        else {
2003            if (this.lastLanding)
2004                this.lastLanding.dragLanding._dragOut(this.lastLanding, e.clientX, e.clientY, e);
2005            this.lastLanding=0;
2006
2007            if (this._onNotFound)
2008                this._onNotFound();
2009        }
2010    }
2011};
2012
2013dhtmlDragAndDropObject.prototype.stopDrag=function(e, mode){
2014    var dragger=window.dhtmlDragAndDrop;
2015
2016    if (!mode){
2017        dragger.stopFrameRoute();
2018        var temp = dragger.lastLanding;
2019        dragger.lastLanding=null;
2020
2021        if (temp)
2022            temp.dragLanding._drag(dragger.dragStartNode, dragger.dragStartObject, temp,
2023                (_isIE ? event.srcElement : e.target));
2024    }
2025    dragger.lastLanding=null;
2026
2027    if ((dragger.dragNode)&&(dragger.dragNode.parentNode == document.body))
2028        dragger.dragNode.parentNode.removeChild(dragger.dragNode);
2029    dragger.dragNode=0;
2030    dragger.gldragNode=0;
2031    dragger.fx=0;
2032    dragger.fy=0;
2033    dragger.dragStartNode=0;
2034    dragger.dragStartObject=0;
2035    document.body.onmouseup=dragger.tempDOMU;
2036    document.body.onmousemove=dragger.tempDOMM;
2037    dragger.tempDOMU=null;
2038    dragger.tempDOMM=null;
2039    dragger.waitDrag=0;
2040};
2041
2042dhtmlDragAndDropObject.prototype.stopFrameRoute=function(win){
2043    if (win)
2044        window.dhtmlDragAndDrop.stopDrag(1, 1);
2045
2046    for (var i = 0; i < window.frames.length; i++){
2047        try{
2048            if ((window.frames[i] != win)&&(window.frames[i].dhtmlDragAndDrop))
2049                window.frames[i].dhtmlDragAndDrop.stopFrameRoute(window);
2050        } catch(e){}
2051    }
2052
2053    try{
2054        if ((parent.dhtmlDragAndDrop)&&(parent != window)&&(parent != win))
2055            parent.dhtmlDragAndDrop.stopFrameRoute(window);
2056    } catch(e){}
2057};
2058
2059dhtmlDragAndDropObject.prototype.initFrameRoute=function(win, mode){
2060    if (win){
2061        window.dhtmlDragAndDrop.preCreateDragCopy();
2062        window.dhtmlDragAndDrop.dragStartNode=win.dhtmlDragAndDrop.dragStartNode;
2063        window.dhtmlDragAndDrop.dragStartObject=win.dhtmlDragAndDrop.dragStartObject;
2064        window.dhtmlDragAndDrop.dragNode=win.dhtmlDragAndDrop.dragNode;
2065        window.dhtmlDragAndDrop.gldragNode=win.dhtmlDragAndDrop.dragNode;
2066        window.document.body.onmouseup=window.dhtmlDragAndDrop.stopDrag;
2067        window.waitDrag=0;
2068
2069        if (((!_isIE)&&(mode))&&((!_isFF)||(_FFrv < 1.8)))
2070            window.dhtmlDragAndDrop.calculateFramePosition();
2071    }
2072    try{
2073        if ((parent.dhtmlDragAndDrop)&&(parent != window)&&(parent != win))
2074            parent.dhtmlDragAndDrop.initFrameRoute(window);
2075    }catch(e){}
2076
2077    for (var i = 0; i < window.frames.length; i++){
2078        try{
2079            if ((window.frames[i] != win)&&(window.frames[i].dhtmlDragAndDrop))
2080                window.frames[i].dhtmlDragAndDrop.initFrameRoute(window, ((!win||mode) ? 1 : 0));
2081        } catch(e){}
2082    }
2083};
2084
2085_isFF = false;
2086_isIE = false;
2087_isOpera = false;
2088_isKHTML = false;
2089_isMacOS = false;
2090_isChrome = false;
2091_FFrv = false;
2092_KHTMLrv = false;
2093_OperaRv = false;
2094
2095if (navigator.userAgent.indexOf('Macintosh') != -1)
2096    _isMacOS=true;
2097
2098
2099if (navigator.userAgent.toLowerCase().indexOf('chrome')>-1)
2100    _isChrome=true;
2101
2102if ((navigator.userAgent.indexOf('Safari') != -1)||(navigator.userAgent.indexOf('Konqueror') != -1)){
2103    _KHTMLrv = parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf('Safari')+7, 5));
2104
2105    if (_KHTMLrv > 525){ //mimic FF behavior for Safari 3.1+
2106        _isFF=true;
2107        _FFrv = 1.9;
2108    } else
2109        _isKHTML=true;
2110} else if (navigator.userAgent.indexOf('Opera') != -1){
2111    _isOpera=true;
2112    _OperaRv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf('Opera')+6, 3));
2113}
2114
2115
2116else if (navigator.appName.indexOf("Microsoft") != -1){
2117    _isIE=true;
2118    if ((navigator.appVersion.indexOf("MSIE 8.0")!= -1 || navigator.appVersion.indexOf("MSIE 9.0")!= -1 || navigator.appVersion.indexOf("MSIE 10.0")!= -1 ) && document.compatMode != "BackCompat"){
2119        _isIE=8;
2120    }
2121} else if (navigator.appName  == 'Netscape' && navigator.userAgent.indexOf("Trident") != -1){
2122	//ie11
2123	_isIE=8;
2124} else {
2125    _isFF=true;
2126    _FFrv = parseFloat(navigator.userAgent.split("rv:")[1]);
2127}
2128
2129
2130//multibrowser Xpath processor
2131dtmlXMLLoaderObject.prototype.doXPath=function(xpathExp, docObj, namespace, result_type){
2132    if (_isKHTML || (!_isIE && !window.XPathResult))
2133        return this.doXPathOpera(xpathExp, docObj);
2134
2135    if (_isIE){ //IE
2136        if (!docObj)
2137            if (!this.xmlDoc.nodeName)
2138                docObj=this.xmlDoc.responseXML;
2139            else
2140                docObj=this.xmlDoc;
2141
2142        if (!docObj)
2143            dhtmlxError.throwError("LoadXML", "Incorrect XML", [
2144                (docObj||this.xmlDoc),
2145                this.mainObject
2146            ]);
2147
2148        if (namespace)
2149            docObj.setProperty("SelectionNamespaces", "xmlns:xsl='"+namespace+"'"); //
2150
2151        if (result_type == 'single'){
2152            return docObj.selectSingleNode(xpathExp);
2153        }
2154        else {
2155            return docObj.selectNodes(xpathExp)||new Array(0);
2156        }
2157    } else { //Mozilla
2158        var nodeObj = docObj;
2159
2160        if (!docObj){
2161            if (!this.xmlDoc.nodeName){
2162                docObj=this.xmlDoc.responseXML;
2163            }
2164            else {
2165                docObj=this.xmlDoc;
2166            }
2167        }
2168
2169        if (!docObj)
2170            dhtmlxError.throwError("LoadXML", "Incorrect XML", [
2171                (docObj||this.xmlDoc),
2172                this.mainObject
2173            ]);
2174
2175        if (docObj.nodeName.indexOf("document") != -1){
2176            nodeObj=docObj;
2177        }
2178        else {
2179            nodeObj=docObj;
2180            docObj=docObj.ownerDocument;
2181        }
2182        var retType = XPathResult.ANY_TYPE;
2183
2184        if (result_type == 'single')
2185            retType=XPathResult.FIRST_ORDERED_NODE_TYPE;
2186        var rowsCol = [];
2187        var col = docObj.evaluate(xpathExp, nodeObj, function(pref){
2188            return namespace;
2189        }, retType, null);
2190
2191        if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE){
2192            return col.singleNodeValue;
2193        }
2194        var thisColMemb = col.iterateNext();
2195
2196        while (thisColMemb){
2197            rowsCol[rowsCol.length]=thisColMemb;
2198            thisColMemb=col.iterateNext();
2199        }
2200        return rowsCol;
2201    }
2202};
2203
2204function _dhtmlxError(type, name, params){
2205    if (!this.catches)
2206        this.catches=[];
2207
2208    return this;
2209}
2210
2211_dhtmlxError.prototype.catchError=function(type, func_name){
2212    this.catches[type]=func_name;
2213};
2214
2215_dhtmlxError.prototype.throwError=function(type, name, params){
2216    if (this.catches[type])
2217        return this.catches[type](type, name, params);
2218
2219    if (this.catches["ALL"])
2220        return this.catches["ALL"](type, name, params);
2221
2222    window.alert("Error type: "+arguments[0]+"\nDescription: "+arguments[1]);
2223    return null;
2224};
2225
2226window.dhtmlxError=new _dhtmlxError();
2227
2228
2229//opera fake, while 9.0 not released
2230//multibrowser Xpath processor
2231dtmlXMLLoaderObject.prototype.doXPathOpera=function(xpathExp, docObj){
2232    //this is fake for Opera
2233    var z = xpathExp.replace(/[\/]+/gi, "/").split('/');
2234    var obj = null;
2235    var i = 1;
2236
2237    if (!z.length)
2238        return [];
2239
2240    if (z[0] == ".")
2241        obj=[docObj]; else if (z[0] === ""){
2242        obj=(this.xmlDoc.responseXML||this.xmlDoc).getElementsByTagName(z[i].replace(/\[[^\]]*\]/g, ""));
2243        i++;
2244    } else
2245        return [];
2246
2247    for (i; i < z.length; i++)obj=this._getAllNamedChilds(obj, z[i]);
2248
2249    if (z[i-1].indexOf("[") != -1)
2250        obj=this._filterXPath(obj, z[i-1]);
2251    return obj;
2252};
2253
2254dtmlXMLLoaderObject.prototype._filterXPath=function(a, b){
2255    var c = [];
2256    var b = b.replace(/[^\[]*\[\@/g, "").replace(/[\[\]\@]*/g, "");
2257
2258    for (var i = 0; i < a.length; i++)
2259        if (a[i].getAttribute(b))
2260            c[c.length]=a[i];
2261
2262    return c;
2263};
2264
2265dtmlXMLLoaderObject.prototype._getAllNamedChilds=function(a, b){
2266    var c = [];
2267
2268    if (_isKHTML)
2269        b=b.toUpperCase();
2270
2271    for (var i = 0; i < a.length; i++)for (var j = 0; j < a[i].childNodes.length; j++){
2272        if (_isKHTML){
2273            if (a[i].childNodes[j].tagName&&a[i].childNodes[j].tagName.toUpperCase() == b)
2274                c[c.length]=a[i].childNodes[j];
2275        }
2276
2277        else if (a[i].childNodes[j].tagName == b)
2278            c[c.length]=a[i].childNodes[j];
2279    }
2280
2281    return c;
2282};
2283
2284function dhtmlXHeir(a, b){
2285    for (var c in b)
2286        if (typeof (b[c]) == "function")
2287            a[c]=b[c];
2288    return a;
2289}
2290
2291function dhtmlxEvent(el, event, handler){
2292    if (el.addEventListener)
2293        el.addEventListener(event, handler, false);
2294
2295    else if (el.attachEvent)
2296        el.attachEvent("on"+event, handler);
2297}
2298
2299//============= XSL Extension ===================================
2300
2301dtmlXMLLoaderObject.prototype.xslDoc=null;
2302dtmlXMLLoaderObject.prototype.setXSLParamValue=function(paramName, paramValue, xslDoc){
2303    if (!xslDoc)
2304        xslDoc=this.xslDoc;
2305
2306    if (xslDoc.responseXML)
2307        xslDoc=xslDoc.responseXML;
2308    var item =
2309        this.doXPath("/xsl:stylesheet/xsl:variable[@name='"+paramName+"']", xslDoc,
2310            "http:/\/www.w3.org/1999/XSL/Transform", "single");
2311
2312    if (item)
2313        item.firstChild.nodeValue=paramValue;
2314};
2315
2316dtmlXMLLoaderObject.prototype.doXSLTransToObject=function(xslDoc, xmlDoc){
2317    if (!xslDoc)
2318        xslDoc=this.xslDoc;
2319
2320    if (xslDoc.responseXML)
2321        xslDoc=xslDoc.responseXML;
2322
2323    if (!xmlDoc)
2324        xmlDoc=this.xmlDoc;
2325
2326    if (xmlDoc.responseXML)
2327        xmlDoc=xmlDoc.responseXML;
2328
2329    
2330    var result;
2331    //Mozilla
2332    if (!_isIE){
2333        if (!this.XSLProcessor){
2334            this.XSLProcessor=new XSLTProcessor();
2335            this.XSLProcessor.importStylesheet(xslDoc);
2336        }
2337        result = this.XSLProcessor.transformToDocument(xmlDoc);
2338    } else {
2339        result = new ActiveXObject("Msxml2.DOMDocument.3.0");
2340        try{
2341            xmlDoc.transformNodeToObject(xslDoc, result);
2342        }catch(e){
2343            result = xmlDoc.transformNode(xslDoc);
2344        }
2345    }
2346    return result;
2347};
2348
2349dtmlXMLLoaderObject.prototype.doXSLTransToString=function(xslDoc, xmlDoc){
2350    var res = this.doXSLTransToObject(xslDoc, xmlDoc);
2351    if(typeof(res)=="string")
2352        return res;
2353    return this.doSerialization(res);
2354};
2355
2356dtmlXMLLoaderObject.prototype.doSerialization=function(xmlDoc){
2357    if (!xmlDoc)
2358        xmlDoc=this.xmlDoc;
2359    if (xmlDoc.responseXML)
2360        xmlDoc=xmlDoc.responseXML;
2361    if (!_isIE){
2362        var xmlSerializer = new XMLSerializer();
2363        return xmlSerializer.serializeToString(xmlDoc);
2364    } else
2365        return xmlDoc.xml;
2366};
2367
2368/**
2369 *   @desc:
2370 *   @type: private
2371 */
2372dhtmlxEventable=function(obj){
2373    obj.attachEvent=function(name, catcher, callObj){
2374        name='ev_'+name.toLowerCase();
2375        if (!this[name])
2376            this[name]=new this.eventCatcher(callObj||this);
2377
2378        return(name+':'+this[name].addEvent(catcher)); //return ID (event name & event ID)
2379    };
2380    obj.callEvent=function(name, arg0){
2381        name='ev_'+name.toLowerCase();
2382        if (this[name])
2383            return this[name].apply(this, arg0);
2384        return true;
2385    };
2386    obj.checkEvent=function(name){
2387        return (!!this['ev_'+name.toLowerCase()]);
2388    };
2389    obj.eventCatcher=function(obj){
2390        var dhx_catch = [];
2391        var z = function(){
2392            var res = true;
2393            for (var i = 0; i < dhx_catch.length; i++){
2394                if (dhx_catch[i]){
2395                    var zr = dhx_catch[i].apply(obj, arguments);
2396                    res=res&&zr;
2397                }
2398            }
2399            return res;
2400        };
2401        z.addEvent=function(ev){
2402            if (typeof (ev) != "function")
2403                ev=eval(ev);
2404            if (ev)
2405                return dhx_catch.push(ev)-1;
2406            return false;
2407        };
2408        z.removeEvent=function(id){
2409            dhx_catch[id]=null;
2410        };
2411        return z;
2412    };
2413    obj.detachEvent=function(id){
2414        if (id){
2415            var list = id.split(':');           //get EventName and ID
2416            this[list[0]].removeEvent(list[1]); //remove event
2417        }
2418    };
2419    obj.detachAllEvents = function(){
2420        for (var name in this){
2421            if (name.indexOf("ev_")===0){
2422                this.detachEvent(name);
2423                this[name] = null;
2424            }
2425        }
2426    };
2427    obj = null;
2428};
2429if(!window.dhtmlx)
2430	window.dhtmlx = {};
2431
2432(function(){
2433	var _dhx_msg_cfg = null;
2434	function callback(config, result){
2435			var usercall = config.callback;
2436			modality(false);
2437			config.box.parentNode.removeChild(config.box);
2438			_dhx_msg_cfg = config.box = null;
2439			if (usercall)
2440				usercall(result);
2441	}
2442	function modal_key(e){
2443		if (_dhx_msg_cfg){
2444			e = e||event;
2445			var code = e.which||event.keyCode;
2446			if (dhtmlx.message.keyboard){
2447				if (code == 13 || code == 32)
2448					callback(_dhx_msg_cfg, true);
2449				if (code == 27)
2450					callback(_dhx_msg_cfg, false);
2451			}
2452			if (e.preventDefault)
2453				e.preventDefault();
2454			return !(e.cancelBubble = true);
2455		}
2456	}
2457	if (document.attachEvent)
2458		document.attachEvent("onkeydown", modal_key);
2459	else
2460		document.addEventListener("keydown", modal_key, true);
2461		
2462	function modality(mode){
2463		if(!modality.cover){
2464			modality.cover = document.createElement("DIV");
2465			//necessary for IE only
2466			modality.cover.onkeydown = modal_key;
2467			modality.cover.className = "dhx_modal_cover";
2468			document.body.appendChild(modality.cover);
2469		}
2470		var height =  document.body.scrollHeight;
2471		modality.cover.style.display = mode?"inline-block":"none";
2472	}
2473
2474	function button(text, result){
2475		var button_css = "dhtmlx_"+text.toLowerCase().replace(/ /g, "_")+"_button"; // dhtmlx_ok_button, dhtmlx_click_me_button
2476		return "<div class='dhtmlx_popup_button "+button_css+"' result='"+result+"' ><div>"+text+"</div></div>";
2477	}
2478
2479	function info(text){
2480		if (!t.area){
2481			t.area = document.createElement("DIV");
2482			t.area.className = "dhtmlx_message_area";
2483			t.area.style[t.position]="5px";
2484			document.body.appendChild(t.area);
2485		}
2486
2487		t.hide(text.id);
2488		var message = document.createElement("DIV");
2489		message.innerHTML = "<div>"+text.text+"</div>";
2490		message.className = "dhtmlx-info dhtmlx-" + text.type;
2491		message.onclick = function(){
2492			t.hide(text.id);
2493			text = null;
2494		};
2495
2496		if (t.position == "bottom" && t.area.firstChild)
2497			t.area.insertBefore(message,t.area.firstChild);
2498		else
2499			t.area.appendChild(message);
2500		
2501		if (text.expire > 0)
2502			t.timers[text.id]=window.setTimeout(function(){
2503				t.hide(text.id);
2504			}, text.expire);
2505
2506		t.pull[text.id] = message;
2507		message = null;
2508
2509		return text.id;
2510	}
2511	function _boxStructure(config, ok, cancel){
2512		var box = document.createElement("DIV");
2513		box.className = " dhtmlx_modal_box dhtmlx-"+config.type;
2514		box.setAttribute("dhxbox", 1);
2515			
2516		var inner = '';
2517
2518		if (config.width)
2519			box.style.width = config.width;
2520		if (config.height)
2521			box.style.height = config.height;
2522		if (config.title)
2523			inner+='<div class="dhtmlx_popup_title">'+config.title+'</div>';
2524		inner+='<div class="dhtmlx_popup_text"><span>'+(config.content?'':config.text)+'</span></div><div  class="dhtmlx_popup_controls">';
2525		if (ok)
2526			inner += button(config.ok || "OK", true);
2527		if (cancel)
2528			inner += button(config.cancel || "Cancel", false);
2529		if (config.buttons){
2530			for (var i=0; i<config.buttons.length; i++)
2531				inner += button(config.buttons[i],i);
2532		}
2533		inner += '</div>';
2534		box.innerHTML = inner;
2535
2536		if (config.content){
2537			var node = config.content;
2538			if (typeof node == "string") 
2539				node = document.getElementById(node);
2540			if (node.style.display == 'none')
2541				node.style.display = "";
2542			box.childNodes[config.title?1:0].appendChild(node);
2543		}
2544
2545		box.onclick = function(e){
2546			e = e ||event;
2547			var source = e.target || e.srcElement;
2548			if (!source.className) source = source.parentNode;
2549			if (source.className.split(" ")[0] == "dhtmlx_popup_button"){
2550				var result = source.getAttribute("result");
2551				result = (result == "true")||(result == "false"?false:result);
2552				callback(config, result);
2553			}
2554		};
2555		config.box = box;
2556		if (ok||cancel)
2557			_dhx_msg_cfg = config;
2558
2559		return box;
2560	}
2561	function _createBox(config, ok, cancel){
2562		var box = config.tagName ? config : _boxStructure(config, ok, cancel);
2563		
2564		if (!config.hidden)
2565			modality(true);
2566		document.body.appendChild(box);
2567		var x = Math.abs(Math.floor(((window.innerWidth||document.documentElement.offsetWidth) - box.offsetWidth)/2));
2568		var y = Math.abs(Math.floor(((window.innerHeight||document.documentElement.offsetHeight) - box.offsetHeight)/2));
2569		if (config.position == "top")
2570			box.style.top = "-3px";
2571		else
2572			box.style.top = y+'px';
2573		box.style.left = x+'px';
2574		//necessary for IE only
2575		box.onkeydown = modal_key;
2576
2577		box.focus();
2578		if (config.hidden)
2579			dhtmlx.modalbox.hide(box);
2580
2581		return box;
2582	}
2583
2584	function alertPopup(config){
2585		return _createBox(config, true, false);
2586	}
2587	function confirmPopup(config){
2588		return _createBox(config, true, true);
2589	}
2590	function boxPopup(config){
2591		return _createBox(config);
2592	}
2593	function box_params(text, type, callback){
2594		if (typeof text != "object"){
2595			if (typeof type == "function"){
2596				callback = type;
2597				type = "";
2598			}
2599			text = {text:text, type:type, callback:callback };
2600		}
2601		return text;
2602	}
2603	function params(text, type, expire, id){
2604		if (typeof text != "object")
2605			text = {text:text, type:type, expire:expire, id:id};
2606		text.id = text.id||t.uid();
2607		text.expire = text.expire||t.expire;
2608		return text;
2609	}
2610	dhtmlx.alert = function(){
2611		var text = box_params.apply(this, arguments);
2612		text.type = text.type || "confirm";
2613		return alertPopup(text);
2614	};
2615	dhtmlx.confirm = function(){
2616		var text = box_params.apply(this, arguments);
2617		text.type = text.type || "alert";
2618		return confirmPopup(text);
2619	};
2620	dhtmlx.modalbox = function(){
2621		var text = box_params.apply(this, arguments);
2622		text.type = text.type || "alert";
2623		return boxPopup(text);
2624	};
2625	dhtmlx.modalbox.hide = function(node){
2626		while (node && node.getAttribute && !node.getAttribute("dhxbox"))
2627			node = node.parentNode;
2628		if (node){
2629			node.parentNode.removeChild(node);
2630			modality(false);
2631		}
2632	};
2633	var t = dhtmlx.message = function(text, type, expire, id){
2634		text = params.apply(this, arguments);
2635		text.type = text.type||"info";
2636
2637		var subtype = text.type.split("-")[0];
2638		switch (subtype){
2639			case "alert":
2640				return alertPopup(text);
2641			case "confirm":
2642				return confirmPopup(text);
2643			case "modalbox":
2644				return boxPopup(text);
2645			default:
2646				return info(text);
2647		}
2648	};
2649
2650	t.seed = (new Date()).valueOf();
2651	t.uid = function(){return t.seed++;};
2652	t.expire = 4000;
2653	t.keyboard = true;
2654	t.position = "top";
2655	t.pull = {};
2656	t.timers = {};
2657
2658	t.hideAll = function(){
2659		for (var key in t.pull)
2660			t.hide(key);
2661	};
2662	t.hide = function(id){
2663		var obj = t.pull[id];
2664		if (obj && obj.parentNode){
2665			window.setTimeout(function(){
2666				obj.parentNode.removeChild(obj);
2667				obj = null;
2668			},2000);
2669			obj.className+=" hidden";
2670			
2671			if(t.timers[id])
2672				window.clearTimeout(t.timers[id]);
2673			delete t.pull[id];
2674		}
2675	};
2676})();
2677gantt = {
2678	version:"2.1.0"
2679};
2680
2681/*jsl:ignore*/
2682//import from dhtmlxcommon.js
2683
2684function dhtmlxDetachEvent(el, event, handler){
2685    if (el.removeEventListener)
2686        el.removeEventListener(event, handler, false);
2687
2688    else if (el.detachEvent)
2689        el.detachEvent("on"+event, handler);
2690}
2691
2692
2693/** Overrides event functionality.
2694 *  Includes all default methods from dhtmlx.common but adds _silentStart, _silendEnd
2695 *   @desc:
2696 *   @type: private
2697 */
2698dhtmlxEventable=function(obj){
2699    obj._silent_mode = false;
2700    obj._silentStart = function() {
2701        this._silent_mode = true;
2702    };
2703    obj._silentEnd = function() {
2704        this._silent_mode = false;
2705    };
2706	obj.attachEvent=function(name, catcher, callObj){
2707		name='ev_'+name.toLowerCase();
2708		if (!this[name])
2709			this[name]=new this._eventCatcher(callObj||this);
2710
2711		return(name+':'+this[name].addEvent(catcher)); //return ID (event name & event ID)
2712	};
2713	obj.callEvent=function(name, arg0){
2714        if (this._silent_mode) return true;
2715		name='ev_'+name.toLowerCase();
2716		if (this[name])
2717			return this[name].apply(this, arg0);
2718		return true;
2719	};
2720	obj.checkEvent=function(name){
2721		return (!!this['ev_'+name.toLowerCase()]);
2722	};
2723	obj._eventCatcher=function(obj){
2724		var dhx_catch = [];
2725		var z = function(){
2726			var res = true;
2727			for (var i = 0; i < dhx_catch.length; i++){
2728				if (dhx_catch[i]){
2729					var zr = dhx_catch[i].apply(obj, arguments);
2730					res=res&&zr;
2731				}
2732			}
2733			return res;
2734		};
2735		z.addEvent=function(ev){
2736			if (typeof (ev) != "function")
2737				ev=eval(ev);
2738			if (ev)
2739				return dhx_catch.push(ev)-1;
2740			return false;
2741		};
2742		z.removeEvent=function(id){
2743			dhx_catch[id]=null;
2744		};
2745		return z;
2746	};
2747	obj.detachEvent=function(id){
2748		if (id){
2749			var list = id.split(':');           //get EventName and ID
2750			this[list[0]].removeEvent(list[1]); //remove event
2751		}
2752	};
2753	obj.detachAllEvents = function(){
2754		for (var name in this){
2755			if (name.indexOf("ev_") === 0)
2756				delete this[name];
2757		}
2758	};
2759	obj = null;
2760};
2761
2762
2763/*jsl:end*/
2764
2765
2766dhtmlx.copy = function(object) {
2767    var i, t, result; // iterator, types array, result
2768
2769    if (object && typeof object == "object") {
2770        result = {};
2771        t = [Array,Date,Number,String,Boolean];
2772        for (i=0; i<t.length; i++) {
2773            if (object instanceof t[i])
2774                result = i ? new t[i](object) : new t[i](); // first one is array
2775        }
2776
2777        for (i in object) {
2778            if (Object.prototype.hasOwnProperty.apply(object, [i]))
2779                result[i] = dhtmlx.copy(object[i]);
2780        }
2781    }
2782    return result || object;
2783};
2784
2785dhtmlx.mixin = function(target, source, force){
2786    for (var f in source)
2787        if ((!target[f] || force)) target[f]=source[f];
2788    return target;
2789};
2790
2791
2792dhtmlx.defined = function(obj) {
2793    return typeof(obj) != "undefined";
2794};
2795
2796dhtmlx.uid = function() {
2797    if (!this._seed)
2798        this._seed = (new Date()).valueOf();
2799    
2800    this._seed++;
2801    return this._seed;
2802};
2803
2804
2805//creates function with specified "this" pointer
2806dhtmlx.bind=function(functor, object){
2807    return function(){ return functor.apply(object,arguments); };
2808};
2809
2810
2811//returns position of html element on the page
2812gantt._get_position = function(elem) {
2813	var top=0, left=0;
2814    if (elem.getBoundingClientRect) { //HTML5 method
2815        var box = elem.getBoundingClientRect();
2816        var body = document.body;
2817        var docElem = document.documentElement;
2818        var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
2819        var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
2820        var clientTop = docElem.clientTop || body.clientTop || 0;
2821        var clientLeft = docElem.clientLeft || body.clientLeft || 0;
2822        top  = box.top +  scrollTop - clientTop;
2823        left = box.left + scrollLeft - clientLeft;
2824        return { y: Math.round(top), x: Math.round(left), width:elem.offsetWidth, height:elem.offsetHeight };
2825    } else { //fallback to naive approach
2826        while(elem) {
2827            top = top + parseInt(elem.offsetTop,10);
2828            left = left + parseInt(elem.offsetLeft,10);
2829            elem = elem.offsetParent;
2830        }
2831        return { y: top, x: left, width:elem.offsetWidth, height: elem.offsetHeight};
2832    }
2833};
2834
2835
2836gantt._detectScrollSize = function(){
2837    var div = document.createElement("div");
2838    div.style.cssText="visibility:hidden;position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;height:110px;min-height:100px;overflow-y:scroll;";
2839
2840    document.body.appendChild(div);
2841    var width = div.offsetWidth-div.clientWidth;
2842    document.body.removeChild(div);
2843
2844    return width;
2845};
2846
2847dhtmlxEventable(gantt);
2848
2849gantt._click = {};
2850gantt._dbl_click = {};
2851gantt._context_menu = {};
2852gantt._on_click = function(e) {
2853    e = e || window.event;
2854    var trg = e.target || e.srcElement;
2855    var id = gantt.locate(e);
2856
2857	if (id !== null){
2858		var res = !gantt.checkEvent("onTaskClick") || gantt.callEvent("onTaskClick", [id, e]);
2859		if(res && gantt.config.select_task){
2860			gantt.selectTask(id);
2861		}
2862	}else{
2863		gantt.callEvent("onEmptyClick", [e]);
2864	}
2865
2866	gantt._find_ev_handler(e, trg, gantt._click, id);
2867};
2868gantt._on_contextmenu = function(e){
2869	e = e || window.event;
2870	var src = e.target||e.srcElement,
2871		taskId = gantt.locate(src),
2872		linkId = gantt.locate(src, gantt.config.link_attribute);
2873
2874	var res = !gantt.checkEvent("onContextMenu") || gantt.callEvent("onContextMenu", [taskId, linkId, e]);
2875	if(!res)
2876		e.preventDefault();
2877	return res;
2878};
2879gantt._find_ev_handler = function(e, trg, hash, id){
2880	var res = true;
2881	while (trg && trg.parentNode){
2882		var css = trg.className;
2883		if (css) {
2884			css = css.split(" ");
2885			for (var i = 0; i < css.length; i++) {
2886				if (!css[i]) continue;
2887				if (hash[css[i]]){
2888					res =  hash[css[i]].call(gantt, e, id, trg);
2889					res = !(typeof res!="undefined"&&res!==true);
2890				}
2891			}
2892		}
2893		trg=trg.parentNode;
2894	}
2895	return res;
2896};
2897gantt._on_dblclick = function(e) {
2898	e = e || window.event;
2899	var trg = e.target || e.srcElement;
2900    var id = gantt.locate(e);
2901
2902	var default_action = gantt._find_ev_handler(e, trg, gantt._dbl_click, id);
2903	if(!default_action)
2904		return;
2905
2906    if (id !== null){
2907        var res = !gantt.checkEvent("onTaskDblClick") || gantt.callEvent("onTaskDblClick", [id, e]);
2908		if(res && gantt.config.details_on_dblclick){
2909			gantt.showLightbox(id);
2910		}
2911	}
2912};
2913
2914gantt._on_mousemove = function(e){
2915	if (gantt.checkEvent("onMouseMove")){
2916    	var id = gantt.locate(e);
2917    	gantt._last_move_event = e;
2918		gantt.callEvent("onMouseMove", [id,e]);
2919	}
2920};
2921function dhtmlxDnD(obj, config) {
2922    if(config){
2923        this._settings = config;
2924    }
2925    dhtmlxEventable(this);
2926    dhtmlxEvent(obj, "mousedown", dhtmlx.bind(function(e) {
2927        this.dragStart(obj, e);
2928    }, this));
2929
2930}
2931dhtmlxDnD.prototype = {
2932    dragStart: function(obj, e) {
2933        this.config = {
2934            obj: obj,
2935            marker: null,
2936            started: false,
2937            pos: this.getPosition(e),
2938            sensitivity: 4
2939        };
2940        if(this._settings)
2941            dhtmlx.mixin(this.config, this._settings, true);
2942
2943        var mousemove = dhtmlx.bind(function(e) { return this.dragMove(obj, e); }, this);
2944        var scroll = dhtmlx.bind(function(e) { return this.dragScroll(obj, e); }, this);
2945
2946        var limited_mousemove = dhtmlx.bind(function(e) {
2947            if(dhtmlx.defined(this.config.updates_per_second)){
2948                if(!gantt._checkTimeout(this, this.config.updates_per_second))
2949                    return true;
2950            }
2951
2952			return mousemove(e);
2953        }, this);
2954
2955        var mouseup = dhtmlx.bind(function(e) {
2956            dhtmlxDetachEvent(document.body, "mousemove", limited_mousemove);
2957            dhtmlxDetachEvent(document.body, "mouseup", mouseup);
2958            return this.dragEnd(obj);
2959        }, this);
2960
2961
2962        dhtmlxEvent(document.body, "mousemove", limited_mousemove);
2963        dhtmlxEvent(document.body, "mouseup", mouseup);
2964        document.body.className += " gantt_noselect";
2965    },
2966    dragMove: function(obj, e) {
2967        if (!this.config.marker && !this.config.started) {
2968            var pos = this.getPosition(e);
2969            var diff_x = pos.x - this.config.pos.x;
2970            var diff_y = pos.y - this.config.pos.y;
2971            var distance = Math.sqrt(Math.pow(Math.abs(diff_x), 2) + Math.pow(Math.abs(diff_y), 2));
2972
2973            if (distance > this.config.sensitivity) {
2974                // real drag starts here,
2975                // when user moves mouse at first time after onmousedown
2976                this.config.started = true;
2977                this.config.ignore = false;
2978                if (this.callEvent("onBeforeDragStart", [obj,e]) === false) {
2979                    this.config.ignore = true;
2980                    return true;
2981                }
2982
2983                // initialize dnd marker
2984                var marker = this.config.marker = document.createElement("div");
2985                marker.className = "gantt_drag_marker";
2986                marker.innerHTML = "Dragging object";
2987                document.body.appendChild(marker);
2988
2989                this.callEvent("onAfterDragStart", [obj,e]);
2990            } else
2991                this.config.ignore = true;
2992        }
2993        if (!this.config.ignore) {
2994            e.pos = this.getPosition(e);
2995            this.config.marker.style.left = e.pos.x + "px";
2996            this.config.marker.style.top = e.pos.y + "px";
2997            this.callEvent("onDragMove", [obj,e]);
2998        }
2999    },
3000
3001    dragEnd: function(obj) {
3002        if (this.config.marker) {
3003            this.config.marker.parentNode.removeChild(this.config.marker);
3004            this.config.marker = null;
3005            this.callEvent("onDragEnd", []);
3006        }
3007        document.body.className = document.body.className.replace(" gantt_noselect", "");
3008    },
3009
3010    getPosition: function(e) {
3011        var x = 0, y = 0;
3012        e = e || window.event;
3013        if (e.pageX || e.pageY) {
3014            x = e.pageX;
3015            y = e.pageY;
3016        } else if (e.clientX || e.clientY) 	{
3017            x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
3018            y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
3019        }
3020        return { x:x, y:y };
3021    }
3022};
3023gantt._init_grid = function() {
3024    this._click.gantt_close = dhtmlx.bind(function(e, id, trg) {
3025        this.close(id);
3026    }, this);
3027    this._click.gantt_open = dhtmlx.bind(function(e, id, trg) {
3028        this.open(id);
3029    }, this);
3030
3031
3032    this._click.gantt_row = dhtmlx.bind(function(e, id, trg) {
3033        if (id!==null) {
3034            var el = this.getTaskNode(id);
3035            var left = Math.max(el.offsetLeft - this.config.task_scroll_offset, 0);
3036            this.scrollTo(left);
3037			this.callEvent("onTaskRowClick", [id, trg]);
3038        }
3039    }, this);
3040
3041	this._click.gantt_grid_head_cell = dhtmlx.bind(function(e, id, trg) {
3042		var column = trg.getAttribute("column_id");
3043
3044		if(!this.callEvent("onGridHeaderClick", [column, e]))
3045			return;
3046
3047		if (column == "add") {
3048			this._click.gantt_add(e, this.config.root_id);
3049		} else if (this.config.sort){
3050			var sort = (this._sort && this._sort.direction && this._sort.name == column) ? this._sort.direction : "desc";
3051			// invert sort direction
3052			sort = (sort == "desc") ? "asc" : "desc";
3053			this._sort = {
3054				name: column,
3055				direction: sort
3056			};
3057			this._render_grid_header();
3058
3059			this.sort(column, sort == "desc");
3060		}
3061	}, this);
3062
3063    if(!this.config.sort && this.config.order_branch) {
3064        this._init_dnd();
3065    }
3066
3067    this._click.gantt_add = dhtmlx.bind(function(e, id, trg) {
3068		if(this.config.readonly) return;
3069
3070		var parent = id ? this.getTask(id) : false,
3071			startDate = '';
3072		if(parent){
3073			startDate = parent.start_date;
3074		}else{
3075			var first = this._order[0];
3076			startDate = first ? this.getTask(first).start_date : this.getState().min_date;
3077		}
3078
3079
3080		if(parent)
3081			parent.$open = true;
3082
3083        var item = { text:gantt.locale.labels.new_task, start_date:this.templates.xml_format(startDate), duration: 1, progress: 0, parent: id };
3084        this.callEvent("onTaskCreated", [item]);
3085        this.addTask(item);
3086        this.showTask(item.id);
3087		this.selectTask(item.id);
3088        if (this.config.details_on_create)
3089            this.showLightbox(item.id);
3090    }, this);
3091
3092
3093};
3094
3095gantt._render_grid = function(){
3096	if(this._is_grid_visible()){
3097		this._calc_grid_width();
3098		this._render_grid_header();
3099	}
3100};
3101
3102gantt._calc_grid_width = function() {
3103    if (this.config.autofit) {
3104        var columns = this.config.columns;
3105        var cols_width = 0;
3106        var unknown = [];
3107        var width = [];
3108        for (var i = 0; i < columns.length; i++) {
3109            var v = parseInt(columns[i].width, 10);
3110            if (window.isNaN(v)) {
3111                v = 50;
3112                unknown.push(i);
3113            }
3114            width[i] = v;
3115            cols_width += v;
3116        }
3117        var diff = this._get_grid_width() - cols_width;
3118        // TODO: logic may be improved for proportional changing of width
3119        var step = diff/(unknown.length > 0 ? unknown.length : (width.length > 0 ? width.length : 1));
3120        if (unknown.length > 0) {
3121            // there are several columns with undefined width
3122            var delta = diff/(unknown.length ? unknown.length : 1);
3123            for (var i = 0; i < unknown.length; i++) {
3124                var index = unknown[i];
3125                width[index] += delta;
3126            }
3127        } else {
3128            // delta must be added for all columns
3129            var delta = diff/(width.length ? width.length : 1);
3130            for (var i = 0; i < width.length; i++)
3131                width[i] += delta;
3132        }
3133
3134        for (var i = 0; i < width.length; i++) {
3135            columns[i].width = width[i];
3136        }
3137    }
3138};
3139
3140gantt._render_grid_header = function() {
3141    var columns = this.config.columns;
3142    var cells = [];
3143    var width = 0,
3144		labels = this.locale.labels;
3145
3146    var lineHeigth = this.config.scale_height-2;
3147
3148    for (var i = 0; i < columns.length; i++) {
3149        var last = i == columns.length-1;
3150        var col = columns[i];
3151        if (last && this._get_grid_width() > width+col.width)
3152            col.width = this._get_grid_width() - width;
3153        width += col.width;
3154        var sort = (this._sort && col.name == this._sort.name) ? ("<div class='gantt_sort gantt_" + this._sort.direction + "'></div>") : "";
3155        var cssClass = ["gantt_grid_head_cell",
3156			("gantt_grid_head_" + col.name),
3157			(last ? "gantt_last_cell" : ""),
3158			this.templates.grid_header_class(col.name, col)].join(" ");
3159
3160        var style = "width:" + (col.width-(last?1:0)) + "px;";
3161		var label = (col.label || labels["column_" + col.name]);
3162		label = label || "";
3163        var cell = "<div class='" + cssClass + "' style='" + style + "' column_id='" + col.name + "'>" + label + sort +  "</div>";
3164        cells.push(cell);
3165    }
3166    this.$grid_scale.style.height = (this.config.scale_height-1) + "px";
3167    this.$grid_scale.style.lineHeight = lineHeigth + "px";
3168    this.$grid_scale.style.width = (width-1) + "px";
3169    this.$grid_scale.innerHTML = cells.join("");
3170};
3171
3172
3173
3174gantt._render_grid_item = function(item) {
3175	if(!gantt._is_grid_visible())
3176		return null;
3177
3178    var columns = this.config.columns;
3179    var cells = [];
3180    var width = 0;
3181    for (var i = 0; i < columns.length; i++) {
3182        var last = i == columns.length-1;
3183        var col = columns[i];
3184        var cell;
3185
3186        var value;
3187        if (col.name == "add" && i == columns.length-1) {
3188        	// Logium customization begins
3189        	if (item.add_disabled)
3190        		value = "";
3191        	else
3192        		// Logium customization ends
3193        		value = "<div class='gantt_add'></div>";
3194        } else {
3195            if (col.template)
3196                value = col.template(item);
3197            else
3198                value = item[col.name];
3199
3200            if (value instanceof Date)
3201                value = this.templates.date_grid(value);
3202			value = "<div class='gantt_tree_content'>" + value + "</div>";
3203        }
3204        var css = "gantt_cell" + (last ? " gantt_last_cell" : "");
3205
3206        var tree = "";
3207        if (col.tree) {
3208            for (var j = 0; j < item.$level; j++)
3209                tree += this.templates.grid_indent(item);
3210
3211            var has_child = (this._branches[item.id] && this._branches[item.id].length > 0);
3212            if (has_child) {
3213                tree += this.templates.grid_open(item);
3214                tree += this.templates.grid_folder(item);
3215            } else {
3216                tree += this.templates.grid_blank(item);
3217                tree += this.templates.grid_file(item);
3218            }
3219        }
3220        var style = "width:" + (col.width-(last ? 1 : 0)) + "px;";
3221        if (dhtmlx.defined(col.align))
3222            style += "text-align:" + col.align + ";";
3223        cell = "<div class='" + css + "' style='" + style + "'>" + tree + value + "</div>";
3224        cells.push(cell);
3225    }
3226    var css = item.$index%2 === 0 ? "" : " odd";
3227    css += (item.$transparent) ? " gantt_transparent" : "";
3228    if (this.templates.grid_row_class) {
3229        var css_template = this.templates.grid_row_class.call(this, item.start_date, item.end_date, item);
3230        if (css_template)
3231            css += " " + css_template;
3232    }
3233
3234	if(this.getState().selected_task == item.id){
3235		css += " gantt_selected";
3236	}
3237	var el = document.createElement("div");
3238	el.className = "gantt_row" + css;
3239	el.style.height = this.config.row_height + "px";
3240	el.style.lineHeight = (gantt.config.row_height)+"px";
3241	el.setAttribute(this.config.task_attribute, item.id);
3242	el.innerHTML = cells.join("");
3243	return el;
3244};
3245
3246
3247gantt.open = function(id){
3248	gantt._set_item_state(id, true);
3249	this.callEvent("onTaskOpened", [id]);
3250};
3251gantt.close = function(id){
3252	gantt._set_item_state(id, false);
3253	this.callEvent("onTaskClosed", [id]);
3254};
3255gantt._set_item_state = function(id, state) {
3256    if (id && this._pull[id]) {
3257        this._pull[id].$open = state;
3258		this.refreshData();
3259    }
3260};
3261
3262gantt._is_grid_visible = function(){
3263	return (this.config.grid_width && this.config.show_grid);
3264};
3265gantt._get_grid_width = function(){
3266	if(this._is_grid_visible()){
3267		if(this._is_chart_visible()){
3268			return this.config.grid_width;
3269		}else{
3270			return this._x;
3271		}
3272	}else{
3273		return 0;
3274	}
3275};
3276gantt.getTaskIndex = function(id){
3277    var branch = this._branches[this.getTask(id).parent];
3278    for (var i = 0; i < branch.length; i++)
3279            if (branch[i] == id)
3280                return i;
3281
3282    return -1;
3283};
3284gantt.getGlobalTaskIndex = function(id){
3285    var branch = this._order;
3286    for (var i = 0; i < branch.length; i++)
3287            if (branch[i] == id)
3288                return i;
3289
3290    return -1;
3291};
3292gantt.moveTask = function(sid, tindex, parent){
3293    //target id as 4th parameter
3294    var id = arguments[3];
3295    if (id){
3296        if (id === sid) return;
3297
3298        parent = this.getTask(id).parent;
3299        tindex = this.getTaskIndex(id);
3300    }
3301
3302	parent = parent || this.config.root_id;
3303    var source = this.getTask(sid);
3304    var sbranch = this._branches[source.parent];
3305
3306    var tbranch = this._branches[parent];
3307    if (tindex == -1)
3308        tindex = tbranch.length + 1;
3309    if (source.parent == parent){
3310        var sindex = this.getTaskIndex(sid);
3311        if (sindex == tindex) return;
3312        if (sindex < tindex)
3313            tindex--;
3314    }
3315
3316    this._replace_branch_child(source.parent, sid);
3317    tbranch = this._branches[parent];
3318
3319    var tid = tbranch[tindex];
3320    if (!tid) //adding as last element
3321        tbranch.push(sid);
3322    else
3323        tbranch = tbranch.slice(0, tindex).concat([ sid ]).concat(tbranch.slice(tindex));
3324    
3325    source.parent = parent;
3326    this._branches[parent] = tbranch;
3327    this.refreshData();
3328};
3329
3330gantt._init_dnd = function() {
3331    var dnd = new dhtmlxDnD(this.$grid_data, {updates_per_second : 60});
3332    if (dhtmlx.defined(this.config.dnd_sensitivity))
3333        dnd.config.sensitivity = this.config.dnd_sensitivity;
3334
3335    dnd.attachEvent("onBeforeDragStart", dhtmlx.bind(function(obj,e) {
3336        var el = this._locateHTML(e);
3337        if (!el) return false;
3338        if (this.hideQuickInfo) this._hideQuickInfo();
3339
3340		var id =  this.locate(e);
3341		if(!this.callEvent("onRowDragStart", [id, e.target || e.srcElement, e])){
3342			return false;
3343		}
3344
3345    }, this));
3346
3347    dnd.attachEvent("onAfterDragStart", dhtmlx.bind(function(obj,e) {
3348        var el = this._locateHTML(e);
3349        dnd.config.marker.innerHTML = el.outerHTML;
3350
3351        dnd.config.id = this.locate(e);
3352        var task = this.getTask(dnd.config.id);
3353        task.$open = false;
3354        task.$transparent = true;
3355		this.refreshData();
3356    }, this));
3357
3358
3359
3360	dnd.lastTaskOfLevel = function(level){
3361		var ids = gantt._order,
3362			pull = gantt._pull,
3363			last_item = null;
3364		for(var i= 0, len = ids.length; i < len; i++){
3365			if(pull[ids[i]].$level == level){
3366				last_item = pull[ids[i]];
3367			}
3368		}
3369		return last_item ? last_item.id : null;
3370	};
3371    dnd.attachEvent("onDragMove", dhtmlx.bind(function(obj,e) {
3372        var dd = dnd.config;
3373        var pos = this._get_position(this.$grid_data);
3374
3375        // row offset
3376        var x = pos.x + 10;
3377        var y = e.pos.y - 10;
3378
3379        // prevent moving row out of grid_data container
3380        if (y < pos.y) y = pos.y;
3381        if (y > pos.y + this.$grid_data.offsetHeight - this.config.row_height) y = pos.y + this.$grid_data.offsetHeight - this.config.row_height;
3382
3383        // setting position of row
3384        dd.marker.style.left = x + "px";
3385        dd.marker.style.top = y + "px";
3386
3387
3388        // highlight row when mouseover
3389        var target = document.elementFromPoint(pos.x-document.body.scrollLeft+1, y-document.body.scrollTop);
3390        var el = this.locate(target);
3391
3392		var item = this.getTask(dnd.config.id);
3393		if(!this.isTaskExists(el)){
3394			el = dnd.lastTaskOfLevel(item.$level);
3395			if(el == dnd.config.id){
3396				el = null;
3397			}
3398		}
3399
3400        if (this.isTaskExists(el)) {
3401            var box = gantt._get_position(target);
3402            var over = this.getTask(el);
3403
3404
3405            if (box.y + target.offsetHeight/2 < y){
3406                //hovering over bottom part of item, check can be drop to bottom
3407                var index = this.getGlobalTaskIndex(over.id);
3408                var next = this._pull[this._order[index+1+(over.id == item.id ? 1 : 0)]]; //adds +1 when hovering over placeholder
3409                if (next){
3410                    if (next.id != item.id)
3411                        over = next; //there is a valid target
3412                    else
3413                        return;
3414                } else {
3415                    //we at end of the list, check and drop at the end of list
3416                    next = this._pull[this._order[index]];
3417                    if (next.$level == item.$level){
3418                        this.moveTask(item.id, -1, next.parent);
3419                        dd.target = "next:"+next.id;
3420                        return;
3421                    }
3422                }
3423            }
3424
3425            //replacing item under cursor
3426            if (over.$level == item.$level && item.id != over.id){
3427                this.moveTask(item.id, 0, 0, over.id);
3428                dd.target = over.id;
3429            } else {
3430                //if item is on different level, check the one before it
3431                if (item.id == over.id) return;
3432
3433                var index = this.getGlobalTaskIndex(over.id);
3434                var prev = this._pull[this._order[index-1]];
3435                if (prev && prev.$level == item.$level && item.id != prev.id){
3436                    this.moveTask(item.id, -1, prev.parent);
3437                    dd.target = "next:"+prev.id;
3438                }
3439            }
3440        }
3441        return true;
3442    }, this));
3443
3444
3445    dnd.attachEvent("onDragEnd", dhtmlx.bind(function(){
3446        this.getTask(dnd.config.id).$transparent = false;
3447        this.refreshData();
3448        this.callEvent("onRowDragEnd", [dnd.config.id, dnd.config.target]);
3449    }, this));
3450};
3451gantt._scale_helpers = {
3452	getSum : function(sizes, from, to){
3453		if(to === undefined)
3454			to = sizes.length - 1;
3455		if(from === undefined)
3456			from = 0;
3457
3458		var summ = 0;
3459		for(var i=from; i <= to; i++)
3460			summ += sizes[i];
3461
3462		return summ;
3463	},
3464	setSumWidth : function(sum_width, scale, from, to){
3465		var parts = scale.width;
3466
3467		if(to === undefined)
3468			to = parts.length - 1;
3469		if(from === undefined)
3470			from = 0;
3471		var length = to - from + 1;
3472
3473		if(from > parts.length - 1 || length <= 0 || to > parts.length - 1)
3474			return;
3475
3476		var oldWidth = this.getSum(parts, from, to);
3477
3478		var diff = sum_width - oldWidth;
3479
3480		this.adjustSize(diff, parts, from, to);
3481		this.adjustSize(- diff, parts, to + 1);
3482
3483		scale.full_width = this.getSum(parts);
3484	},
3485	splitSize : function(width, count){
3486		var arr = [];
3487		for(var i=0; i < count; i++) arr[i] = 0;
3488
3489		this.adjustSize(width, arr);
3490		return arr;
3491
3492	},
3493	adjustSize : function(width, parts, from, to){
3494		if(!from)
3495			from = 0;
3496		if(to === undefined)
3497			to = parts.length - 1;
3498
3499		var length = to - from + 1;
3500
3501		var full = this.getSum(parts, from, to);
3502
3503		var shared = 0;
3504
3505		for(var i = from; i <= to; i++){
3506			var share = Math.floor(width*(full ? (parts[i]/full) : (1/length)));
3507
3508			full -= parts[i];
3509			width -= share;
3510			length--;
3511
3512			parts[i] += share;
3513			shared += share;
3514		}
3515		parts[parts.length - 1] += width;
3516		//parts[parts.length - 1] += width - shared;
3517	},
3518	sortScales : function(scales){
3519		function cellSize(unit, step){
3520			var d = new Date(1970, 0, 1);
3521			return gantt.date.add(d, step, unit) - d;
3522		}
3523
3524		scales.sort(function(a, b){
3525			return cellSize(a.unit, a.step) < cellSize(b.unit, b.step) ? 1 : -1;
3526		});
3527	},
3528	primaryScale : function(){
3529
3530		gantt._init_template("date_scale");
3531
3532		return {
3533			unit: gantt.config.scale_unit,
3534			step: gantt.config.step,
3535			template : gantt.templates.date_scale,
3536			date : gantt.config.date_scale,
3537			css: gantt.templates.scale_cell_class
3538		};
3539	},
3540
3541	prepareConfigs : function(scales, min_coll_width, container_width, scale_height){
3542		var heights = this.splitSize(scale_height, scales.length);
3543		var full_width = container_width;
3544
3545		var configs = [];
3546		for(var i=scales.length-1; i >= 0; i--){
3547			var main_scale = (i == scales.length - 1);
3548			var cfg = this.initScaleConfig(scales[i]);
3549			if(main_scale){
3550				this.processIgnores(cfg);
3551			}
3552
3553			this.initColSizes(cfg, min_coll_width, full_width, heights[i]);
3554			this.limitVisibleRange(cfg);
3555
3556			if(main_scale){
3557				full_width = cfg.full_width;
3558			}
3559
3560			configs.unshift(cfg);
3561		}
3562
3563
3564		for( var i =0; i < configs.length-1; i++){
3565			this.alineScaleColumns(configs[configs.length-1], configs[i]);
3566		}
3567
3568		return configs;
3569
3570	},
3571
3572	_ignore_time_config : function(date){
3573		if(this.config.skip_off_time){
3574			return !this.isWorkTime(date);
3575		}
3576		return false;
3577	},
3578	processIgnores : function(config){
3579		var display_count = config.count;
3580		config.ignore_x = {};
3581		if(gantt.ignore_time || gantt.config.skip_off_time){
3582			var ignore = gantt.ignore_time || function(){return false;};
3583			display_count = 0;
3584			for(var i=0; i < config.trace_x.length; i++){
3585
3586				if(ignore.call(gantt, config.trace_x[i]) || this._ignore_time_config.call(gantt,config.trace_x[i])){
3587					config.ignore_x[config.trace_x[i].valueOf()] = true;
3588					config.ignored_colls = true;
3589				}else{
3590					display_count++;
3591				}
3592			}
3593
3594		}
3595		config.display_count = display_count;
3596	},
3597	initColSizes : function(config, min_col_width, full_width, line_height){
3598		var cont_width = full_width;
3599
3600		config.height = line_height;
3601
3602		var column_count = config.display_count === undefined ? config.count : config.display_count;
3603
3604		if(!column_count)
3605			column_count = 1;
3606
3607		config.col_width = Math.floor(cont_width/column_count);
3608
3609		if(min_col_width){
3610			if (config.col_width < min_col_width){
3611				config.col_width = min_col_width;
3612				cont_width = config.col_width * column_count;
3613			}
3614		}
3615		config.width = [];
3616		var ignores = config.ignore_x || {};
3617		for(var i =0; i < config.trace_x.length; i++){
3618			if(ignores[config.trace_x[i].valueOf()] || (config.display_count == config.count)){
3619				config.width[i] = 0;
3620			}else{
3621				config.width[i] = 1;
3622			}
3623		}
3624
3625		this.adjustSize(cont_width - this.getSum(config.width)/* 1 width per column from the code above */, config.width);
3626		config.full_width = this.getSum(config.width);
3627	},
3628	initScaleConfig : function(config){
3629		var cfg = dhtmlx.mixin({
3630			count:0,
3631			col_width:0,
3632			full_width:0,
3633			height:0,
3634			width:[],
3635			trace_x:[]
3636		}, config);
3637
3638		this.eachColumn(config.unit, config.step, function(date){
3639			cfg.count++;
3640			cfg.trace_x.push(new Date(date));
3641		});
3642
3643		return cfg;
3644	},
3645	iterateScales : function(lower_scale, upper_scale, from, to, callback){
3646		var upper_dates = upper_scale.trace_x;
3647		var lower_dates = lower_scale.trace_x;
3648
3649		var prev = from || 0;
3650		var end = to || (lower_dates.length - 1);
3651		var prevUpper = 0;
3652		for(var up=1; up < upper_dates.length; up++){
3653			for(var next=prev; next <= end; next++){
3654				if(+lower_dates[next] == +upper_dates[up]){
3655					if(callback){
3656						callback.apply(this, [prevUpper, up, prev, next]);
3657					}
3658					prev = next;
3659					prevUpper = up;
3660					continue;
3661				}
3662			}
3663		}
3664	},
3665	alineScaleColumns : function(lower_scale, upper_scale, from, to){
3666		this.iterateScales(lower_scale, upper_scale, from, to, function(upper_start, up
3666per_end, lower_start, lower_end){
3667			var targetWidth = this.getSum(lower_scale.width, lower_start, lower_end - 1);
3668			var actualWidth = this.getSum(upper_scale.width, upper_start, upper_end - 1);
3669			if(actualWidth != targetWidth){
3670				this.setSumWidth(targetWidth, upper_scale, upper_start, upper_end - 1);
3671			}
3672
3673		});
3674	},
3675
3676	eachColumn : function(unit, step, callback){
3677		var start = new Date(gantt._min_date),
3678			end = new Date(gantt._max_date);
3679		if(gantt.date[unit + "_start"]){
3680			start = gantt.date[unit + "_start"](start);
3681		}
3682
3683		var curr = new Date(start);
3684		while(+curr < +end){
3685			callback.call(this, new Date(curr));
3686			curr = gantt.date.add(curr, step, unit);
3687		}
3688	},
3689	limitVisibleRange : function(cfg){
3690		var dates = cfg.trace_x;
3691
3692		var left = 0, right = cfg.width.length-1;
3693		var diff = 0;
3694		if(+dates[0] < +gantt._min_date && left != right){
3695			var width = Math.floor(cfg.width[0] * ((dates[1] - gantt._min_date)/ (dates[1] - dates[0])));
3696			diff += cfg.width[0] - width;
3697			cfg.width[0] = width;
3698
3699			dates[0] = new Date(gantt._min_date);
3700		}
3701
3702		var last = dates.length - 1;
3703		var lastDate = dates[last];
3704		var outDate = gantt.date.add(lastDate, cfg.step, cfg.unit);
3705		if(+outDate > +gantt._max_date && last > 0){
3706			var width = cfg.width[last] - Math.floor(cfg.width[last] * ((outDate - gantt._max_date)/(outDate - lastDate)));
3707			diff += cfg.width[last] - width;
3708			cfg.width[last] = width;
3709		}
3710
3711		if(diff){
3712			var full = this.getSum(cfg.width);
3713			var shared = 0;
3714			for(var i =0; i < cfg.width.length; i++){
3715				var share = Math.floor(diff*(cfg.width[i]/full));
3716				cfg.width[i] += share;
3717				shared += share;
3718			}
3719			this.adjustSize(diff - shared, cfg.width);
3720		}
3721
3722	}
3723};
3724gantt._tasks_dnd = {
3725	drag : null,
3726	_events:{
3727		before_start:{},
3728		before_finish:{},
3729		after_finish:{}
3730	},
3731	_handlers:{},
3732	init:function(){
3733		this.clear_drag_state();
3734		var drag = gantt.config.drag_mode;
3735		this.set_actions();
3736
3737		var evs = {
3738			"before_start":"onBeforeTaskDrag",
3739			"before_finish":"onBeforeTaskChanged",
3740			"after_finish":"onAfterTaskDrag"
3741		};
3742		//for now, all drag operations will trigger the same events
3743		for(var stage in this._events){
3744			for(var mode in drag){
3745				this._events[stage][mode] = evs[stage];
3746			}
3747		}
3748
3749		this._handlers[drag.move] = this._move;
3750		this._handlers[drag.resize] = this._resize;
3751		this._handlers[drag.progress] = this._resize_progress;
3752
3753	},
3754	set_actions:function(){
3755		var data = gantt.$task_data;
3756		dhtmlxEvent(data, "mousemove", dhtmlx.bind(function(e){
3757			this.on_mouse_move(e||event);
3758		}, this));
3759		dhtmlxEvent(data, "mousedown", dhtmlx.bind(function(e){
3760			this.on_mouse_down(e||event);
3761		}, this));
3762		dhtmlxEvent(data, "mouseup", dhtmlx.bind(function(e){
3763			this.on_mouse_up(e||event);
3764		}, this));
3765	},
3766
3767	clear_drag_state : function(){
3768		this.drag = {
3769			id:null,
3770			mode:null,
3771			pos:null,
3772			start_x:null,
3773			start_y:null,
3774			obj:null,
3775			left:null
3776		};
3777	},
3778	_resize : function(ev, shift, drag){
3779		var cfg = gantt.config;
3780		var coords_x = this._drag_task_coords(ev, drag);
3781		if(drag.left){
3782			ev.start_date = gantt._date_from_pos(coords_x.start + shift);
3783			if(!ev.start_date){
3784				ev.start_date = new Date(gantt.getState().min_date);
3785			}
3786		}else{
3787			ev.end_date =gantt._date_from_pos(coords_x.end + shift);
3788			if(!ev.end_date){
3789				ev.end_date = new Date(gantt.getState().max_date);
3790			}
3791		}
3792
3793		if (ev.end_date - ev.start_date < cfg.min_duration){
3794			if(drag.left)
3795				ev.start_date = gantt.calculateEndDate(ev.end_date, -1);
3796			else
3797				ev.end_date = gantt.calculateEndDate(ev.start_date, 1);
3798		}
3799		gantt._init_task_timing(ev);
3800	},
3801	_resize_progress:function(ev, shift, drag){
3802		var coords_x = this._drag_task_coords(ev, drag);
3803
3804		var diff = Math.max(0, drag.pos.x - coords_x.start);
3805		ev.progress = Math.min(1, diff / (coords_x.end-coords_x.start));
3806	},
3807	_move : function(ev, shift, drag){
3808		var coords_x = this._drag_task_coords(ev, drag);
3809		var new_start = gantt._date_from_pos(coords_x.start + shift),
3810			new_end = gantt._date_from_pos(coords_x.end + shift);
3811		if(!new_start){
3812			ev.start_date = new Date(gantt.getState().min_date);
3813			ev.end_date = gantt._date_from_pos(gantt.posFromDate(ev.start_date) + (coords_x.end - coords_x.start));
3814		}else if(!new_end){
3815			ev.end_date = new Date(gantt.getState().max_date);
3816			ev.start_date = gantt._date_from_pos(gantt.posFromDate(ev.end_date) - (coords_x.end - coords_x.start));
3817		}else{
3818			ev.start_date = new_start;
3819			ev.end_date = new_end;
3820		}
3821	},
3822	_drag_task_coords : function(t, drag){
3823		var start = drag.obj_s_x = drag.obj_s_x || gantt.posFromDate(t.start_date);
3824		var end = drag.obj_e_x = drag.obj_e_x || gantt.posFromDate(t.end_date);
3825		return {
3826			start : start,
3827			end : end
3828		};
3829	},
3830	on_mouse_move : function(e){
3831		if(this.drag.start_drag)
3832			this._start_dnd(e);
3833
3834		var drag = this.drag;
3835
3836		if (drag.mode){
3837			if(!gantt._checkTimeout(this, 40))//limit update frequency
3838				return;
3839
3840			this._update_on_move(e);
3841
3842		}
3843	},
3844	_update_on_move : function(e){
3845		var drag = this.drag;
3846
3847		if (drag.mode){
3848			var pos = gantt._get_mouse_pos(e);
3849			if(drag.pos && drag.pos.x == pos.x)
3850				return;
3851
3852			drag.pos=pos;
3853
3854			var curr_date = gantt._date_from_pos(pos.x);
3855			if(!curr_date || isNaN( curr_date.getTime() ))
3856				return;
3857
3858
3859			var shift = pos.x - drag.start_x;
3860			var ev = gantt.getTask(drag.id);
3861
3862
3863			if(this._handlers[drag.mode]){
3864				var original = dhtmlx.mixin({}, ev);
3865				var copy =  dhtmlx.mixin({}, ev);
3866				this._handlers[drag.mode].apply(this, [copy, shift, drag]);
3867				dhtmlx.mixin(ev, copy, true);
3868				gantt._update_parents(drag.id, true);
3869				gantt.callEvent("onTaskDrag", [ev.id, drag.mode, copy, original, e]);
3870
3871
3872				dhtmlx.mixin(ev, copy, true);
3873				gantt._update_parents(drag.id);
3874				gantt.refreshTask(drag.id);
3875			}
3876
3877		}
3878	},
3879
3880	on_mouse_down : function(e, src){
3881		// on Mac we do not get onmouseup event when clicking right mouse button leaving us in dnd state
3882		// let's ignore right mouse button then
3883		if (e.button == 2)
3884			return;
3885
3886		if (gantt.config.readonly || this.drag.mode) return;
3887
3888		this.clear_drag_state();
3889
3890		src = src||(e.target||e.srcElement);
3891
3892		var className = gantt._trim(src.className || "");
3893		if(!className || !this._get_drag_mode(className)){
3894			if(src.parentNode)
3895				return this.on_mouse_down(e, src.parentNode);
3896			else
3897				return;
3898		}
3899
3900		var drag = this._get_drag_mode(className);
3901
3902		if(!drag){
3903			if (gantt.checkEvent("onMouseDown") && gantt.callEvent("onMouseDown", [className.split(" ")[0]])) {
3904				if (src.parentNode)
3905					return this.on_mouse_down(e,src.parentNode);
3906
3907			}
3908		}else{
3909			if (drag.mode && drag.mode != gantt.config.drag_mode.ignore && gantt.config["drag_" + drag.mode]){
3910				var id =  gantt.locate(src),
3911					task = dhtmlx.copy(gantt.getTask(id) || {});
3912
3913				if(gantt._is_flex_task(task) && drag.mode != gantt.config.drag_mode.progress){//only progress drag is allowed for tasks with flexible duration
3914					this.clear_drag_state();
3915					return;
3916				}
3917
3918				drag.id = id;
3919				var pos = gantt._get_mouse_pos(e);
3920
3921				drag.start_x = pos.x;
3922				drag.start_y = pos.y;
3923				drag.obj = task;
3924				this.drag.start_drag = drag;
3925
3926			}else
3927				this.clear_drag_state();
3928		}
3929	},
3930	_fix_dnd_scale_time:function(task, drag){
3931		var unit = gantt._tasks.unit,
3932			step = gantt._tasks.step;
3933		if(!gantt.config.round_dnd_dates){
3934			unit = 'minute';
3935			step = gantt.config.time_step;
3936		}
3937
3938		if(drag.mode == gantt.config.drag_mode.resize){
3939			if(drag.left){
3940				task.start_date = gantt._get_closest_date({date:task.start_date, unit:unit, step:step});
3941			}else{
3942				task.end_date = gantt._get_closest_date({date:task.end_date, unit:unit, step:step});
3943			}
3944		}else if(drag.mode == gantt.config.drag_mode.move){
3945			task.start_date = gantt._get_closest_date({date:task.start_date, unit:unit, step:step});
3946			task.end_date = gantt.calculateEndDate(task.start_date, task.duration, gantt.config.duration_unit);
3947		}
3948	},
3949	_fix_working_times:function(task, drag){
3950		if(gantt.config.work_time && gantt.config.correct_work_time){
3951			if(drag.mode == gantt.config.drag_mode.resize){
3952				if(drag.left){
3953					task.start_date = gantt.getClosestWorkTime({date:task.start_date, dir:'future'});
3954				}else{
3955					task.end_date = gantt.getClosestWorkTime({date:task.end_date, dir:'past'});
3956				}
3957			}else if(drag.mode == gantt.config.drag_mode.move){
3958				if(!gantt.isWorkTime(task.start_date)){
3959					task.start_date = gantt.getClosestWorkTime({date:task.start_date, dir:'future'});
3960					task.end_date = gantt.calculateEndDate(task.start_date, task.duration);
3961				}else if(!gantt.isWorkTime(new Date(+task.end_date - 1))){
3962					task.end_date = gantt.getClosestWorkTime({date:task.end_date, dir:'past'});
3963					task.start_date = gantt.calculateEndDate(task.end_date, task.duration*-1);
3964				}
3965
3966			}
3967		}
3968	},
3969	on_mouse_up : function(e){
3970		var drag = this.drag;
3971		if (drag.mode && drag.id){
3972			//drop
3973			var ev=gantt.getTask(drag.id);
3974
3975			if(gantt.config.work_time && gantt.config.correct_work_time){
3976				this._fix_working_times(ev, drag);
3977			}
3978
3979			this._fix_dnd_scale_time(ev, drag);
3980
3981			gantt._init_task_timing(ev);
3982
3983			if(!this._fireEvent("before_finish", drag.mode, [drag.id, drag.mode, dhtmlx.copy(drag.obj), e])){
3984				drag.obj._dhx_changed = false;
3985				dhtmlx.mixin(ev, drag.obj, true);
3986
3987
3988
3989
3990				gantt.updateTask(ev.id);
3991			} else {
3992				var drag_id = drag.id;
3993
3994
3995
3996
3997
3998				gantt._init_task_timing(ev);
3999				gantt.updateTask(ev.id);
4000				this._fireEvent("after_finish", drag.mode, [drag_id, drag.mode, e]);
4001				this.clear_drag_state();
4002			}
4003
4004		}
4005		this.clear_drag_state();
4006	},
4007	_get_drag_mode : function(className){
4008		var modes = gantt.config.drag_mode;
4009		var classes = (className || "").split(" ");
4010		var classname = classes[0];
4011		var drag = {mode:null, left:null};
4012		switch (classname) {
4013			case "gantt_task_line":
4014			case "gantt_task_content":
4015				drag.mode = modes.move;
4016				break;
4017			case "gantt_task_drag":
4018				drag.mode = modes.resize;
4019				if(classes[1] && classes[1].indexOf("left", classes[1].length - "left".length) !== -1){
4020					drag.left = true;
4021				}else{
4022					drag.left = false;
4023				}
4024				break;
4025			case "gantt_task_progress_drag":
4026				drag.mode = modes.progress;
4027				break;
4028			case "gantt_link_control":
4029			case "gantt_link_point":
4030				drag.mode = modes.ignore;
4031				break;
4032			default:
4033				drag = null;
4034				break;
4035		}
4036		return drag;
4037
4038	},
4039
4040	_start_dnd : function(e){
4041		var drag = this.drag = this.drag.start_drag;
4042		delete drag.start_drag;
4043
4044		var cfg = gantt.config;
4045		var id = drag.id;
4046		if (!cfg["drag_"+drag.mode] || !gantt.callEvent("onBeforeDrag",[id, drag.mode, e]) || !this._fireEvent("before_start", drag.mode, [id, drag.mode, e])){
4047			this.clear_drag_state();
4048		}else {
4049			delete drag.start_drag;
4050		}
4051
4052	},
4053	_fireEvent:function(stage, mode, params){
4054		dhtmlx.assert(this._events[stage], "Invalid stage:{" + stage + "}");
4055
4056		var trigger = this._events[stage][mode];
4057
4058		dhtmlx.assert(trigger, "Unknown after drop mode:{" + mode + "}");
4059		dhtmlx.assert(params, "Invalid event arguments");
4060
4061
4062		if(!gantt.checkEvent(trigger))
4063			return true;
4064
4065		return gantt.callEvent(trigger, params);
4066	}
4067};
4068
4069
4070
4071
4072
4073
4074
4075gantt._render_link = function(id){
4076	var link = this.getLink(id);
4077	gantt._linkRenderer.render_item(link, this.$task_links);
4078};
4079gantt._get_link_type = function(from_start, to_start){
4080	var type = null;
4081	if(from_start && to_start){
4082		type = gantt.config.links.start_to_start;
4083	}else if(!from_start && to_start){
4084		type = gantt.config.links.finish_to_start;
4085	}else if(!from_start && !to_start){
4086		type = gantt.config.links.finish_to_finish;
4087	}else if(from_start && !to_start){
4088		type = gantt.config.links.start_to_finish;
4089	}
4090	return type;
4091};
4092
4093gantt.isLinkAllowed = function(from, to, from_start, to_start){
4094	var link = null;
4095	if(typeof(from) == "object"){
4096		link = from;
4097	}else{
4098		link = {source:from, target:to, type: this._get_link_type(from_start, to_start)};
4099	}
4100
4101	if(!link) return false;
4102	if(!(link.source && link.target && link.type)) return false;
4103	if(link.source == link.target) return false;
4104
4105	var res = true;
4106	//any custom rules
4107	if(this.checkEvent("onLinkValidation"))
4108		res = this.callEvent("onLinkValidation", [link]);
4109
4110	return res;
4111};
4112
4113gantt._render_link_element = function(link){
4114	var dots = this._path_builder.get_points(link);
4115	var drawer = gantt._drawer;
4116	var lines = drawer.get_lines(dots);
4117
4118	var div = document.createElement("div");
4119
4120
4121	var css = "gantt_task_link";
4122	var cssTemplate = this.templates.link_class ? this.templates.link_class(link) : "";
4123	if(cssTemplate){
4124		css += " " + cssTemplate;
4125	}
4126
4127
4128	div.className = css;
4129	div.setAttribute(gantt.config.link_attribute, link.id);
4130	for(var i=0; i < lines.length; i++){
4131		if(i == lines.length - 1){
4132			lines[i].size -= gantt.config.link_arrow_size;
4133		}
4134		div.appendChild(drawer.render_line(lines[i], lines[i+1]));
4135	}
4136
4137	var direction = lines[lines.length - 1].direction;
4138	var endpoint = gantt._render_link_arrow(dots[dots.length - 1], direction);
4139	div.appendChild(endpoint);
4140
4141	return div;
4142};
4143
4144gantt._render_link_arrow = function(point, direction){
4145	var div = document.createElement("div");
4146	var drawer = gantt._drawer;
4147	var top = point.y;
4148	var left = point.x;
4149
4150	var size = gantt.config.link_arrow_size;
4151	var line_width = gantt.config.row_height;
4152	var className = "gantt_link_arrow gantt_link_arrow_" + direction;
4153	switch (direction){
4154		case drawer.dirs.right:
4155			top -= (size - line_width)/2;
4156			left -= size;
4157			break;
4158		case drawer.dirs.left:
4159			top -= (size - line_width)/2;
4160			break;
4161		case drawer.dirs.up:
4162			left -= (size - line_width)/2;
4163			break;
4164		case drawer.dirs.down:
4165			top -= size;
4166			left -= (size - line_width)/2;
4167			break;
4168		default:
4169			break;
4170	}
4171	div.style.cssText = [
4172		"top:"+top + "px",
4173		"left:"+left+'px'].join(';');
4174	div.className = className;
4175
4176	return div;
4177};
4178
4179
4180gantt._drawer = {
4181	current_pos:null,
4182	dirs:{"left":'left',"right":'right',"up":'up', "down":'down'},
4183	path:[],
4184	clear:function(){
4185		this.current_pos = null;
4186		this.path = [];
4187	},
4188	point:function(pos){
4189		this.current_pos = dhtmlx.copy(pos);
4190	},
4191	get_lines:function(dots){
4192		this.clear();
4193		this.point(dots[0]);
4194		for(var i=1; i<dots.length ; i++){
4195			this.line_to(dots[i]);
4196		}
4197		return this.get_path();
4198	},
4199	line_to:function(pos){
4200		var next = dhtmlx.copy(pos);
4201		var prev = this.current_pos;
4202
4203		var line = this._get_line(prev, next);
4204		this.path.push(line);
4205		this.current_pos = next;
4206	},
4207	get_path:function(){
4208		return this.path;
4209	},
4210	get_wrapper_sizes :function(v){
4211		var res,
4212			wrapper_size = gantt.config.link_wrapper_width,
4213			line_size = gantt.config.link_line_width,
4214			y = v.y + (gantt.config.row_height - wrapper_size)/2;
4215		switch (v.direction){
4216			case this.dirs.left:
4217				res = {	top : y,
4218					height : wrapper_size,
4219					lineHeight : wrapper_size,
4220					left : v.x - v.size - wrapper_size/2 ,
4221					width : v.size +wrapper_size};
4222				break;
4223			case this.dirs.right:
4224				res = {	top : y,
4225					lineHeight : wrapper_size,
4226					height : wrapper_size,
4227					left : v.x - wrapper_size/2,
4228					width : v.size + wrapper_size};
4229				break;
4230			case this.dirs.up:
4231				res = {	top : y - v.size,
4232					lineHeight: v.size + wrapper_size,
4233					height : v.size + wrapper_size,
4234					left : v.x - wrapper_size/2,
4235					width : wrapper_size};
4236				break;
4237			case this.dirs.down:
4238				res = {	top : y,
4239					lineHeight: v.size + wrapper_size,
4240					height : v.size + wrapper_size,
4241					left : v.x - wrapper_size/2,
4242					width : wrapper_size};
4243				break;
4244			default:
4245				break;
4246		}
4247
4248		return res;
4249	},
4250	get_line_sizes : function(v){
4251		var res,
4252			line_size = gantt.config.link_line_width,
4253			wrapper_size = gantt.config.link_wrapper_width,
4254			size =  v.size + line_size;
4255		switch (v.direction){
4256			case this.dirs.left:
4257			case this.dirs.right:
4258				res = {
4259					height : line_size,
4260					width : size,
4261					marginTop: (wrapper_size - line_size)/2,
4262					marginLeft: (wrapper_size - line_size)/2
4263				};
4264				break;
4265			case this.dirs.up:
4266			case this.dirs.down:
4267				res = {
4268					height : size,
4269					width : line_size,
4270					marginTop: (wrapper_size - line_size)/2,
4271					marginLeft: (wrapper_size - line_size)/2
4272				};
4273				break;
4274			default:
4275				break;
4276		}
4277
4278
4279
4280		return res;
4281	},
4282	render_line : function(v){
4283		var pos = this.get_wrapper_sizes(v);
4284		var wrapper = document.createElement("div");
4285		wrapper.style.cssText = [
4286			"top:" + pos.top + "px",
4287			"left:" + pos.left + "px",
4288			"height:" + pos.height + "px",
4289			"width:" + pos.width + "px"
4290		].join(';');
4291		wrapper.className = "gantt_line_wrapper";
4292
4293		var innerPos = this.get_line_sizes(v);
4294		var inner = document.createElement("div");
4295		inner.style.cssText = [
4296			"height:" + innerPos.height + "px",
4297			"width:" + innerPos.width + "px",
4298			"margin-top:" + innerPos.marginTop + "px",
4299			"margin-left:" + innerPos.marginLeft + "px"
4300		].join(";");
4301
4302		inner.className = "gantt_link_line_" + v.direction;
4303		wrapper.appendChild(inner);
4304
4305		return wrapper;
4306	},
4307	_get_line:function(from, to){
4308		var direction = this.get_direction(from, to);
4309		var vect = {
4310			x : from.x,
4311			y : from.y,
4312			direction : this.get_direction(from, to)
4313		};
4314		if(direction == this.dirs.left || direction == this.dirs.right){
4315			vect.size =  Math.abs(from.x - to.x);
4316		}else{
4317			vect.size =  Math.abs(from.y - to.y);
4318		}
4319		return vect;
4320	},
4321	get_direction:function(from, to){
4322		var direction = 0;
4323		if(to.x < from.x){
4324			direction = this.dirs.left;
4325		}else if (to.x > from.x){
4326			direction = this.dirs.right;
4327		}else if (to.y > from.y){
4328			direction = this.dirs.down;
4329		}else {
4330			direction = this.dirs.up;
4331		}
4332		return direction;
4333	}
4334
4335};
4336gantt._y_from_ind = function(index){
4337	return (index)*gantt.config.row_height;
4338};
4339gantt._path_builder = {
4340
4341	path:[],
4342	clear:function(){
4343		this.path = [];
4344	},
4345	current:function(){
4346		return this.path[this.path.length - 1];
4347	},
4348	point:function(next){
4349		if(!next)
4350			return this.current();
4351
4352		this.path.push(dhtmlx.copy(next));
4353		return next;
4354	},
4355	point_to:function(direction, diff, point){
4356		if(!point)
4357			point = dhtmlx.copy(this.point());
4358		else
4359			point = {x:point.x, y:point.y};
4360		var dir = gantt._drawer.dirs;
4361		switch (direction){
4362			case (dir.left):
4363				point.x -= diff;
4364				break;
4365			case (dir.right):
4366				point.x += diff;
4367				break;
4368			case (dir.up):
4369				point.y -= diff;
4370				break;
4371			case (dir.down):
4372				point.y += diff;
4373				break;
4374			default:
4375				break;
4376		}
4377		return this.point(point);
4378	},
4379	get_points:function(link){
4380		var pt = this.get_endpoint(link);
4381		var xy = gantt.config;
4382
4383
4384		var dy = pt.e_y - pt.y;
4385		var dx = pt.e_x - pt.x;
4386
4387		var dir = gantt._drawer.dirs;
4388
4389		this.clear();
4390		this.point({x: pt.x, y : pt.y});
4391
4392		var shiftX = 2*xy.link_arrow_size;//just random size for first line
4393
4394
4395		var forward = (pt.e_x > pt.x);
4396		if(link.type == gantt.config.links.start_to_start){
4397			this.point_to(dir.left, shiftX);
4398			if(forward){
4399				this.point_to(dir.down, dy);
4400				this.point_to(dir.right,  dx);
4401			}else{
4402				this.point_to(dir.right, dx);
4403				this.point_to(dir.down, dy);
4404			}
4405			this.point_to(dir.right, shiftX);
4406
4407		}else if(link.type == gantt.config.links.finish_to_start){
4408			forward = (pt.e_x > (pt.x + 2*shiftX));
4409			this.point_to(dir.right, shiftX);
4410			if(forward){
4411				dx -= shiftX;
4412				this.point_to(dir.down, dy);
4413				this.point_to(dir.right, dx);
4414			}else{
4415				dx -= 2*shiftX;
4416				var sign = dy > 0 ? 1 : -1;
4417
4418				this.point_to(dir.down, sign * (xy.row_height/2));
4419				this.point_to(dir.right, dx);
4420				this.point_to(dir.down, sign * ( Math.abs(dy) - (xy.row_height/2)));
4421				this.point_to(dir.right, shiftX);
4422			}
4423
4424		}else if(link.type == gantt.config.links.finish_to_finish){
4425			this.point_to(dir.right, shiftX);
4426			if(forward){
4427				this.point_to(dir.right, dx);
4428				this.point_to(dir.down, dy);
4429			}else{
4430				this.point_to(dir.down, dy);
4431				this.point_to(dir.right, dx);
4432			}
4433			this.point_to(dir.left, shiftX);
4434		}else if(link.type == gantt.config.links.start_to_finish){
4435
4436			forward = (pt.e_x > (pt.x - 2*shiftX));
4437			this.point_to(dir.left, shiftX);
4438
4439			if(!forward){
4440				dx += shiftX;
4441				this.point_to(dir.down, dy);
4442				this.point_to(dir.right,  dx);
4443			}else{
4444				dx += 2*shiftX;
4445				var sign = dy > 0 ? 1 : -1;
4446				this.point_to(dir.down, sign * (xy.row_height/2));
4447				this.point_to(dir.right, dx);
4448				this.point_to(dir.down, sign * ( Math.abs(dy) - (xy.row_height/2)));
4449				this.point_to(dir.left, shiftX);
4450			}
4451
4452		}
4453
4454		return this.path;
4455	},
4456	get_endpoint : function(link){
4457		var types = gantt.config.links;
4458		var from_start = false, to_start = false;
4459
4460		if(link.type == types.start_to_start){
4461			from_start = to_start = true;
4462		}else if(link.type == types.finish_to_finish){
4463			from_start = to_start = false;
4464		}else if(link.type == types.finish_to_start){
4465			from_start = false;
4466			to_start = true;
4467		}else if(link.type == types.start_to_finish){
4468			from_start = true;
4469			to_start = false;
4470		}else{
4471			dhtmlx.assert(false, "Invalid link type");
4472		}
4473
4474		var from = gantt._get_task_visible_pos(gantt._pull[link.source], from_start);
4475		var to = gantt._get_task_visible_pos(gantt._pull[link.target], to_start);
4476
4477		return {
4478			x :  from.x,
4479			e_x : to.x,
4480			y : from.y ,
4481			e_y : to.y
4482		};
4483	}
4484};
4485
4486gantt._init_links_dnd = function() {
4487	var dnd = new dhtmlxDnD(this.$task_bars, { sensitivity : 0, updates_per_second : 60 }),
4488		start_marker = "task_left",
4489		end_marker = "task_right",
4490		link_edge_marker = "gantt_link_point",
4491		link_landing_hover_area = "gantt_link_control";
4492
4493	dnd.attachEvent("onBeforeDragStart", dhtmlx.bind(function(obj,e) {
4494		if(gantt.config.readonly)
4495			return false;
4496
4497		var target = (e.target||e.srcElement);
4498		resetDndState();
4499		if(gantt.getState().drag_id)
4500			return false;
4501
4502
4503		if(gantt._locate_css(target, link_edge_marker)){
4504			if(gantt._locate_css(target, start_marker))
4505				gantt._link_source_task_start = true;
4506
4507			var sid = gantt._link_source_task = this.locate(e);
4508			var t = gantt.getTask(sid);
4509
4510			var shift = 0;
4511			if(t.type == gantt.config.types.milestone){
4512				shift = (gantt._get_visible_milestone_width() - gantt._get_milestone_width())/2;
4513			}
4514
4515			this._dir_start = getLinePos(t, !!gantt._link_source_task_start, shift);
4516			return true;
4517		}else{
4518			return false;
4519		}
4520
4521	}, this));
4522
4523	dnd.attachEvent("onAfterDragStart", dhtmlx.bind(function(obj,e) {
4524		updateMarkedHtml(dnd.config.marker);
4525	}, this));
4526
4527	function getLinePos(task, to_start, shift){
4528		var pos = gantt._get_task_pos(task, !!to_start);
4529		pos.y += gantt._get_task_height()/2;
4530
4531		shift = shift || 0;
4532		pos.x += (to_start ? -1 : 1)*shift;
4533		return pos;
4534	}
4535
4536	dnd.attachEvent("onDragMove", dhtmlx.bind(function(obj,e) {
4537		var dd = dnd.config;
4538		var pos = dnd.getPosition(e);
4539		advanceMarker(dd.marker, pos);
4540		var landing = gantt._is_link_drop_area(e);
4541
4542		var prevTarget = gantt._link_target_task;
4543		var prevLanding = gantt._link_landing;
4544		var prevToStart = gantt._link_target_task_start;
4545
4546		var targ = gantt.locate(e),
4547			to_start = true;
4548		if(landing){
4549			//refreshTask
4550			to_start = !gantt._locate_css(e, end_marker);
4551			landing = !!targ;
4552		}
4553
4554		gantt._link_target_task = targ;
4555		gantt._link_landing = landing;
4556		gantt._link_target_task_start = to_start;
4557
4558		if(landing){
4559			var t = gantt.getTask(targ);
4560
4561			var node = gantt._locate_css(e, link_landing_hover_area);
4562			var shift = 0;
4563			if(node){
4564				shift = Math.floor(node.offsetWidth  / 2);
4565			}
4566
4567			this._dir_end = getLinePos(t, !!gantt._link_target_task_start,shift);
4568		}else{
4569			this._dir_end = gantt._get_mouse_pos(e);
4570		}
4571
4572		var targetChanged = !(prevLanding == landing && prevTarget == targ && prevToStart == to_start);
4573		if(targetChanged){
4574			if(prevTarget)
4575				gantt.refreshTask(prevTarget, false);
4576			if(targ)
4577				gantt.refreshTask(targ, false);
4578		}
4579
4580		if(targetChanged){
4581			updateMarkedHtml(dd.marker);
4582		}
4583
4584
4585
4586		showDirectingLine(this._dir_start.x, this._dir_start.y, this._dir_end.x, this._dir_end.y);
4587
4588		return true;
4589	}, this));
4590
4591
4592	dnd.attachEvent("onDragEnd", dhtmlx.bind(function() {
4593		var link = getDndState();
4594
4595		if(link.from && link.to && link.from != link.to){
4596			var type = gantt._get_link_type(link.from_start, link.to_start);
4597
4598			if(type)
4599				gantt.addLink({source : link.from, target: link.to, type:type});
4600		}
4601
4602		resetDndState();
4603
4604		if(link.from)
4605			gantt.refreshTask(link.from, false);
4606		if(link.to)
4607			gantt.refreshTask(link.to, false);
4608		removeDirectionLine();
4609	}, this));
4610
4611	function updateMarkedHtml(marker){
4612		var link = getDndState();
4613
4614		var css = ["gantt_link_tooltip"];
4615		if(link.from && link.to){
4616			if(gantt.isLinkAllowed(link.from, link.to, link.from_start, link.to_start)){
4617				css.push("gantt_allowed_link");
4618			}else{
4619				css.push("gantt_invalid_link");
4620			}
4621		}
4622
4623		var className = gantt.templates.drag_link_class(link.from, link.from_start, link.to, link.to_start);
4624		if(className)
4625			css.push(className);
4626
4627		var html = "<div class='"+className+ "'>" +
4628			gantt.templates.drag_link(link.from, link.from_start, link.to, link.to_start) +
4629			"</div>";
4630		marker.innerHTML = html;
4631	}
4632
4633	function advanceMarker(marker, pos){
4634		marker.style.left = pos.x + 5 + "px";
4635		marker.style.top = pos.y + 5 + "px";
4636	}
4637	function getDndState(){
4638		return { from : gantt._link_source_task,
4639				to : gantt._link_target_task,
4640				from_start : gantt._link_source_task_start,
4641				to_start : gantt._link_target_task_start};
4642	}
4643	function resetDndState(){
4644		gantt._link_source_task =
4645			gantt._link_source_task_start =
4646				gantt._link_target_task = null;
4647		gantt._link_target_task_start = true;
4648	}
4649	function showDirectingLine(s_x, s_y, e_x, e_y){
4650		var div = getDirectionLine();
4651
4652		var link = getDndState();
4653
4654		var css = ["gantt_link_direction"];
4655		if(gantt.templates.link_direction_class){
4656			css.push(gantt.templates.link_direction_class(link.from, link.from_start, link.to, link.to_start));
4657		}
4658
4659		var dist =Math.sqrt( (Math.pow(e_x - s_x, 2)) + (Math.pow(e_y - s_y, 2)) );
4660		dist = Math.max(0, dist - 3);
4661		if(!dist)
4662			return;
4663
4664		div.className = css.join(" ");
4665		var tan = (e_y - s_y)/(e_x - s_x),
4666			angle = Math.atan(tan);
4667
4668		if(coordinateCircleQuarter(s_x, e_x, s_y, e_y) == 2){
4669			angle += Math.PI;
4670		}else if(coordinateCircleQuarter(s_x, e_x, s_y, e_y) == 3){
4671			angle -= Math.PI;
4672		}
4673
4674
4675
4676		var sin = Math.sin(angle),
4677			cos = Math.cos(angle),
4678			top = Math.round(s_y),
4679			left = Math.round(s_x);
4680
4681
4682		var style = [
4683			"-webkit-transform: rotate("+angle+"rad)",
4684			"-moz-transform: rotate("+angle+"rad)",
4685			"-ms-transform: rotate("+angle+"rad)",
4686			"-o-transform: rotate("+angle+"rad)",
4687			"transform: rotate("+angle+"rad)",
4688			"width:" + Math.round(dist) + "px"
4689		];
4690
4691		if(window.navigator.userAgent.indexOf("MSIE 8.0") != -1){
4692			//ms-filter breaks styles in ie9, so add it only for 8th
4693			style.push("-ms-filter: \"" + ieTransform(sin, cos) + "\"");
4694
4695			var shiftLeft = Math.abs(Math.round(s_x - e_x)),
4696				shiftTop = Math.abs(Math.round(e_y - s_y));
4697			//fix rotation axis
4698			switch(coordinateCircleQuarter(s_x, e_x, s_y, e_y)){
4699				case 1:
4700					top -= shiftTop;
4701					break;
4702				case 2:
4703					left -= shiftLeft;
4704					top -= shiftTop;
4705					break;
4706				case 3:
4707					left -= shiftLeft;
4708					break;
4709				default:
4710					break;
4711			}
4712
4713		}
4714
4715		style.push("top:" +  top + "px");
4716		style.push("left:" +  left + "px");
4717
4718		div.style.cssText = style.join(";");
4719	}
4720
4721	function ieTransform(sin, cos){
4722		return "progid:DXImageTransform.Microsoft.Matrix("+
4723			"M11 = "+cos+","+
4724			"M12 = -"+sin+","+
4725			"M21 = "+sin+","+
4726			"M22 = "+cos+","+
4727			"SizingMethod = 'auto expand'"+
4728		")";
4729	}
4730	function coordinateCircleQuarter(sX, eX, sY, eY){
4731		if(eX >= sX){
4732			if(eY <= sY){
4733				return 1;
4734			}else{
4735				return 4;
4736			}
4737		}else{
4738			if(eY <= sY){
4739				return 2;
4740			}else{
4741				return 3;
4742			}
4743		}
4744
4745	}
4746	function getDirectionLine(){
4747		if(!dnd._direction){
4748			dnd._direction = document.createElement("div");
4749			gantt.$task_links.appendChild(dnd._direction);
4750		}
4751		return dnd._direction;
4752	}
4753	function removeDirectionLine(){
4754		if(dnd._direction){
4755			if (dnd._direction.parentNode)	//the event line can be detached because of data refresh
4756				dnd._direction.parentNode.removeChild(dnd._direction);
4757
4758			dnd._direction = null;
4759		}
4760	}
4761
4762	gantt._is_link_drop_area = function(e){
4763		return !!gantt._locate_css(e, link_landing_hover_area);
4764	};
4765};
4766gantt._get_link_state = function(){
4767	return {
4768		link_landing_area : this._link_landing,
4769		link_target_id : this._link_target_task,
4770		link_target_start : this._link_target_task_start,
4771		link_source_id : this._link_source_task,
4772		link_source_start : this._link_source_task_start
4773	};
4774};
4775
4776gantt._init_tasks = function(){
4777	//store temporary configs
4778	this._tasks = {
4779		col_width:this.config.columnWidth,
4780        width: [], // width of each column
4781        full_width: 0, // width of all columns
4782		trace_x:[],
4783		rendered:{}
4784	};
4785
4786
4787	this._click.gantt_task_link = dhtmlx.bind(function(e, trg){
4788		var id = this.locate(e, gantt.config.link_attribute);
4789		if(id){
4790			this.callEvent("onLinkClick", [id, e]);
4791		}
4792	}, this);
4793
4794	this._dbl_click.gantt_task_link = dhtmlx.bind(function(e, id, trg){
4795		var id = this.locate(e, gantt.config.link_attribute);
4796		this._delete_link_handler(id, e);
4797	}, this);
4798
4799	this._dbl_click.gantt_link_point = dhtmlx.bind(function(e, id, trg){
4800		var id = this.locate(e),
4801			task = this.getTask(id);
4802
4803
4804		var link = null;
4805		if(trg.parentNode && trg.parentNode.className){
4806			if(trg.parentNode.className.indexOf("_left") > -1){
4807				link = task.$target[0];
4808			}else{
4809				link = task.$source[0];
4810			}
4811		}
4812		if(link)
4813			this._delete_link_handler(link, e);
4814		return false;
4815	}, this);
4816
4817	this._tasks_dnd.init();
4818	this._init_links_dnd();
4819
4820
4821	var filter_grid_task = this._create_filter('_filter_task', '_is_grid_visible');
4822	var filter_chart_task =  this._create_filter('_filter_task', '_is_chart_visible');
4823	var filter_link =  this._create_filter('_filter_link', '_is_chart_visible');
4824
4825
4826	this._taskRenderer = gantt._task_renderer("line", this._render_task_element, this.$task_bars, filter_chart_task);
4827	this._linkRenderer = gantt._task_renderer("links", this._render_link_element, this.$task_links, filter_link);
4828	this._gridRenderer = gantt._task_renderer("grid_items", this._render_grid_item, this.$grid_data, filter_grid_task);
4829	this._bgRenderer = gantt._task_renderer("bg_lines", this._render_bg_line, this.$task_bg, filter_chart_task);
4830
4831
4832	function refreshId(renders, oldId, newId, item){
4833		for(var i =0; i < renders.length; i++){
4834			renders[i].change_id(oldId, newId);
4835			renders[i].render_item(item);
4836		}
4837	}
4838	this.attachEvent("onTaskIdChange", function(oldId, newId){
4839		var render = this._get_task_renderers();
4840		refreshId(render, oldId, newId, this.getTask(newId));
4841	});
4842
4843	this.attachEvent("onLinkIdChange", function(oldId, newId){
4844		var render = this._get_link_renderers();
4845		refreshId(render, oldId, newId, this.getLink(newId));
4846	});
4847
4848};
4849
4850gantt._create_filter = function(filter_methods){
4851	if(!(filter_methods instanceof Array)){
4852		filter_methods = Array.prototype.slice.call(arguments, 0);
4853	}
4854
4855	return function(obj){
4856		var res = true;
4857		for(var i = 0, len = filter_methods.length; i < len; i++){
4858			var filter_method = filter_methods[i];
4859			if(gantt[filter_method]){
4860				res = res && (gantt[filter_method].apply(gantt, [obj.id, obj]) !== false);
4861			}
4862		}
4863
4864		return res;
4865	};
4866};
4867
4868gantt._is_chart_visible = function(){
4869	return !!this.config.show_chart;
4870};
4871
4872gantt._filter_task = function(id, task){
4873	var min = null, max = null;
4874	if(this.config.start_date && this.config.end_date){
4875		min = this.config.start_date.valueOf();
4876		max = this.config.end_date.valueOf();
4877
4878		if(+task.start_date > max || +task.end_date < +min)
4879			return false;
4880	}
4881	return true;
4882};
4883gantt._filter_link = function(id, link){
4884	if(!this.config.show_links){
4885		return false;
4886	}
4887
4888	if(!(gantt.isTaskVisible(link.source) && gantt.isTaskVisible(link.target)))
4889		return false;
4890
4891	return this.callEvent("onBeforeLinkDisplay", [id, link]);
4892};
4893
4894gantt._get_task_renderers = function(){
4895	return [
4896		this._taskRenderer,
4897		this._gridRenderer,
4898		this._bgRenderer
4899	];
4900};
4901gantt._get_link_renderers = function(){
4902	return [
4903		this._linkRenderer
4904	];
4905};
4906gantt._delete_link_handler = function(id, e){
4907	if(id && this.callEvent("onLinkDblClick", [id, e])){
4908		if(this.config.readonly) return;
4909
4910		var title = "";
4911		var question = gantt.locale.labels.link + " " +this.templates.link_description(this.getLink(id)) + " " + gantt.locale.labels.confirm_link_deleting;
4912		
4913		window.setTimeout(function(){
4914			gantt._dhtmlx_confirm(question, title, function(){
4915				gantt.deleteLink(id);
4916			});		
4917		},(gantt.config.touch ? 300 : 1));
4918	}
4919};
4920gantt.getTaskNode = function(id){
4921	return this._taskRenderer.rendered[id];
4922};
4923gantt.getLinkNode = function(id){
4924	return this._linkRenderer.rendered[id];
4925};
4926
4927
4928
4929
4930
4931gantt._get_tasks_data = function(){
4932	var rows = [];
4933	for(var i=0; i < this._order.length; i++){
4934		var item = this._pull[this._order[i]];
4935		item.$index = i;
4936		this._update_parents(item.id, true);
4937		rows.push(item);
4938	}
4939	return rows;
4940};
4941gantt._get_links_data = function(){
4942	var links = [];
4943	for(var i in this._lpull)
4944		links.push(this._lpull[i]);
4945
4946	return links;
4947};
4948gantt._render_data = function(){
4949	this._update_layout_sizes();
4950
4951	var data = this._get_tasks_data();
4952
4953	var renderers = this._get_task_renderers();
4954	for(var i=0; i < renderers.length; i++){
4955		renderers[i].render_items(data);
4956	}
4957
4958	var links = gantt._get_links_data();
4959	renderers = this._get_link_renderers();
4960	for(var i=0; i < renderers.length; i++)
4961		renderers[i].render_items(links);
4962};
4963
4964gantt._update_layout_sizes = function(){
4965	var cfg = this._tasks;
4966
4967	cfg.bar_height = this._get_task_height();
4968
4969	//task bars layer
4970	this.$task_data.style.height = Math.max(this.$task.offsetHeight - this.config.scale_height, 0) + 'px';
4971
4972	//background layer
4973	this.$task_bg.style.width = cfg.full_width + "px";
4974
4975	//grid area
4976	if(this._is_grid_visible()){
4977		var columns = this.config.columns;
4978		var width = 0;
4979		for (var i = 0; i < columns.length; i++)
4980			width += columns[i].width;
4981		this.$grid_data.style.width = Math.max(width-1, 0) + "px";
4982	}
4983};
4984
4985
4986gantt._init_tasks_range = function(){
4987	var unit = this.config.scale_unit;
4988	if(this.config.start_date && this.config.end_date){
4989		this._min_date = this.date[unit + "_start"]( new Date(this.config.start_date));
4990		this._max_date = this.date[unit + "_start"]( new Date(this.config.end_date));
4991		return;
4992	}
4993
4994	var data = this._get_tasks_data();
4995	var root = this._init_task({id:this.config.root_id});
4996	data.push(root);
4997
4998
4999	var max = -Infinity,
5000		min = Infinity;
5001
5002	this.eachTask(function(child){
5003		if(child.end_date && +child.end_date > +max){
5004			max = new Date(child.end_date);
5005		}
5006	}, this.config.root_id);
5007
5008	this.eachTask(function(child){
5009		if(child.start_date && +child.start_date < +min){
5010			min = new Date(child.start_date);
5011		}
5012	}, this.config.root_id);
5013
5014	this._min_date = min;
5015	this._max_date = max;
5016	
5017	if(!max || max == -Infinity){
5018		this._min_date = new Date();
5019		this._max_date = new Date(this._min_date);
5020	}
5021
5022	this._min_date = this.date[unit + "_start"](this._min_date);
5023	if(+this._min_date == +min)
5024		this._min_date = this.date.add(this.date[unit + "_start"](this._min_date), -1, unit);
5025
5026	this._max_date = this.date[unit + "_start"](this._max_date);
5027	this._max_date = this.date.add(this._max_date, 1, unit);
5028};
5029
5030
5031
5032gantt._prepare_scale_html = function(config){
5033	var cells = [];
5034	var date = null, content = null, css = null;
5035
5036	if(config.template || config.date){
5037		content = config.template || this.date.date_to_str(config.date);
5038	}
5039
5040
5041	css = config.css || gantt.templates.scale_cell_class;
5042
5043
5044	for (var i = 0; i < config.count; i++) {
5045		date = new Date(config.trace_x[i]);
5046		var value = content.call(this, date),
5047			width = config.width[i],
5048			style = "",
5049			template = "",
5050			cssclass = "";
5051
5052		if(width){
5053			style = "width:"+(width)+"px;";
5054			cssclass = "gantt_scale_cell" + (i == config.count-1 ? " gantt_last_cell" : "");
5055
5056			template = css.call(this, date);
5057			if(template) cssclass += " " + template;
5058			var cell = "<div class='" + cssclass + "' style='" + style + "'>" + value + "</div>";
5059			cells.push(cell);
5060		}else{
5061			//do not render ignored cells
5062		}
5063
5064	}
5065	return cells.join("");
5066};
5067
5068gantt._render_tasks_scales = function() {
5069	this._init_tasks_range();
5070    this._scroll_resize();
5071    this._set_sizes();
5072
5073	var scales_html = "",
5074		outer_width = 0,
5075		data_width = 0,
5076		scale_height = 0;
5077
5078	if(this._is_chart_visible()){
5079		var helpers = this._scale_helpers;
5080		var scales = [helpers.primaryScale()].concat(this.config.subscales);
5081		scale_height = (this.config.scale_height-1);
5082
5083		helpers.sortScales(scales);
5084
5085		var resize = this._get_resize_options();
5086		var avail_width = resize.x ? 0 : this.$task.offsetWidth;
5087		var cfgs = helpers.prepareConfigs(scales,this.config.min_column_width, avail_width, scale_height);
5088		var cfg = this._tasks = cfgs[cfgs.length - 1];
5089
5090		var html = [];
5091
5092		var css = this.templates.scale_row_class;
5093		for(var i=0; i < cfgs.length; i++){
5094			var cssClass = "gantt_scale_line";
5095			var tplClass = css(cfgs[i]);
5096			if(tplClass){
5097				cssClass += " " + tplClass;
5098			}
5099
5100			html.push("<div class=\""+cssClass+"\" style=\"height:"+(cfgs[i].height)+"px;line-height:"+(cfgs[i].height)+"px\">" + this._prepare_scale_html(cfgs[i]) + "</div>");
5101		}
5102
5103		scales_html = html.join("");
5104		outer_width = cfg.full_width + this.$scroll_ver.offsetWidth + "px";
5105		data_width = cfg.full_width + "px";
5106		scale_height += "px";
5107	}
5108
5109	if(this._is_chart_visible()){
5110		this.$task.style.display = "";
5111	}else{
5112		this.$task.style.display = "none";
5113	}
5114
5115    this.$task_scale.style.height = scale_height;
5116
5117    this.$task_data.style.width =
5118	this.$task_scale.style.width = outer_width;
5119	this.$task_links.style.width =
5120		this.$task_bars.style.width = data_width;
5121
5122    this.$task_scale.innerHTML = scales_html;
5123
5124};
5125
5126
5127
5128gantt._render_bg_line = function(item){
5129	var cfg = gantt._tasks;
5130	var count = cfg.count;
5131	var cells = [];
5132
5133	if(gantt.config.show_task_cells){
5134		for (var j = 0; j < count; j++) {
5135			var width = cfg.width[j],
5136				style = "",
5137				cssclass = "";
5138
5139			if(width > 0){//do not render skipped columns
5140
5141				style = "width:"+(width)+"px;";
5142				cssclass = "gantt_task_cell" + (j == count-1 ? " gantt_last_cell" : "");
5143
5144				cssTemplate = this.templates.task_cell_class(item, cfg.trace_x[j]);
5145				if(cssTemplate)
5146					cssclass += " " + cssTemplate;
5147				var cell = "<div class='" + cssclass + "' style='" + style + "'></div>";
5148				cells.push(cell);
5149			}
5150
5151		}
5152	}
5153	var odd = item.$index%2 !== 0;
5154	var cssTemplate = gantt.templates.task_row_class(item.start_date, item.end_date, item);
5155	var css = "gantt_task_row" + (odd ? " odd" : "") + (cssTemplate ? ' '+cssTemplate : '');
5156
5157	if(this.getState().selected_task == item.id){
5158		css += " gantt_selected";
5159	}
5160
5161	//var row = "<div class='" + css + "' " + this.config.task_attribute + "='" + item.id + "'>" + cells.join("") + "</div>";
5162	var row = document.createElement("div");
5163	row.className = css;
5164	row.style.height = (gantt.config.row_height)+"px";
5165	row.setAttribute(this.config.task_attribute, item.id);
5166	row.innerHTML = cells.join("");
5167	return row;
5168};
5169
5170
5171gantt._adjust_scales = function(){
5172	if(this.config.fit_tasks){
5173		var old_min = +this._min_date,
5174			old_max = +this._max_date;
5175		this._init_tasks_range();
5176		if(+this._min_date != old_min || +this._max_date != old_max){
5177			this.render();
5178
5179			this.callEvent("onScaleAdjusted", []);
5180			return true;
5181		}
5182	}
5183	return false;
5184};
5185
5186//refresh task and related links
5187gantt.refreshTask = function(taskId, refresh_links){
5188	var renders = this._get_task_renderers();
5189
5190	var task = this.getTask(taskId);
5191	if(task && this.isTaskVisible(taskId)){
5192		for(var i =0; i < renders.length; i++)
5193			renders[i].render_item(task);
5194	}else{
5195		for(var i =0; i < renders.length; i++)
5196			renders[i].remove_item(taskId);
5197	}
5198
5199
5200	if(refresh_links !== undefined && !refresh_links)
5201		return;
5202
5203	var task = this.getTask(taskId);
5204	for(var i=0; i < task.$source.length; i++){
5205		gantt.refreshLink(task.$source[i]);
5206	}
5207	for(var i=0; i < task.$target.length; i++){
5208		gantt.refreshLink(task.$target[i]);
5209	}
5210};
5211gantt.refreshLink = function(linkId){
5212	if(this.isLinkExists(linkId))
5213		gantt._render_link(linkId);
5214	else
5215		gantt._linkRenderer.remove_item(linkId);
5216};
5217
5218
5219
5220gantt._combine_item_class = function(basic, template, itemId){
5221	var css = [basic];
5222	if(template)
5223		css.push(template);
5224
5225	var state = gantt.getState();
5226
5227	var task = this.getTask(itemId);
5228
5229	if(this._get_safe_type(task.type) == this.config.types.milestone){
5230		css.push("gantt_milestone");
5231	}
5232
5233	if(this._get_safe_type(task.type) == this.config.types.project){
5234		css.push("gantt_project");
5235	}
5236
5237	if(this._is_flex_task(task))
5238		css.push("gantt_dependent_task");
5239
5240	if(this.config.select_task && itemId == state.selected_task)
5241		css.push("gantt_selected");
5242
5243	if(itemId == state.drag_id)
5244		css.push("gantt_drag_" + state.drag_mode);
5245
5246	var links = gantt._get_link_state();
5247	if(links.link_source_id == itemId)
5248		css.push("gantt_link_source");
5249
5250	if(links.link_target_id == itemId)
5251		css.push("gantt_link_target");
5252
5253	if(links.link_landing_area &&
5254		(links.link_target_id && links.link_source_id) &&
5255		(links.link_target_id != links.link_source_id)){
5256
5257		var from_id = links.link_source_id;
5258		var from_start = links.link_source_start;
5259		var to_start = links.link_target_start;
5260
5261		var allowDrag = gantt.isLinkAllowed(from_id, itemId, from_start, to_start);
5262
5263		var dragClass = "";
5264		if(allowDrag){
5265			if(to_start)
5266				dragClass = "link_start_allow";
5267			else
5268				dragClass = "link_finish_allow";
5269		}else{
5270			if(to_start)
5271				dragClass = "link_start_deny";
5272			else
5273				dragClass = "link_finish_deny";
5274		}
5275		css.push(dragClass);
5276	}
5277	return css.join(" ");
5278};
5279
5280gantt._render_pair = function(parent, css, task, content){
5281	var state = gantt.getState();
5282
5283	if(+task.end_date <= +state.max_date)
5284		parent.appendChild(content(css+" task_right"));
5285
5286	if(+task.start_date >= +state.min_date)
5287		parent.appendChild(content(css+" task_left"));
5288};
5289
5290gantt._get_task_height = function(){
5291	// height of the bar item
5292	var height = this.config.task_height;
5293	if(height == "full")
5294		height = this.config.row_height - 5;
5295	//item height cannot be bigger than row height
5296	height = Math.min(height, this.config.row_height);
5297	return Math.max(height, 0);
5298};
5299
5300gantt._get_milestone_width = function(){
5301	return this._get_task_height();
5302};
5303gantt._get_visible_milestone_width = function(){
5304	var origWidth = gantt._get_task_height();//m-s have square shape
5305	return Math.sqrt(2*origWidth*origWidth);
5306};
5307
5308gantt._get_task_width = function(task, start, end ){
5309	return Math.round(this._get_task_pos(task, false).x - this._get_task_pos(task, true).x);
5310};
5311
5312gantt._render_task_element = function(task){
5313	var pos = this._get_task_pos(task);
5314
5315	var cfg = this.config;
5316	var height = this._get_task_height();
5317
5318	var padd = Math.floor((this.config.row_height - height)/2);
5319	if(task.type == cfg.types.milestone && cfg.link_line_width > 1){
5320		//little adjust milestone position, so horisontal corners would match link arrow when thickness of link line is more than 1px
5321		padd += 1;
5322	}
5323
5324	var div = document.createElement("div");
5325	var width = gantt._get_task_width(task);
5326
5327	var type = this._get_safe_type(task.type);
5328
5329	div.setAttribute(this.config.task_attribute, task.id);
5330	//use separate div to display content above progress bar
5331	div.appendChild(gantt._render_task_content(task, width));
5332
5333	div.className = this._combine_item_class("gantt_task_line",
5334		this.templates.task_class(task.start_date, task.end_date, task),
5335		task.id);
5336
5337
5338	div.style.cssText = [
5339		"left:" + pos.x + "px",
5340		"top:" + (padd + pos.y) + 'px',
5341		"height:" + height + 'px',
5342		"line-height:" + height + 'px',
5343		"width:" + width + 'px'
5344	].join(";");
5345
5346	var side = this._render_leftside_content(task);
5347	if(side) div.appendChild(side);
5348
5349	side = this._render_rightside_content(task);
5350	if(side) div.appendChild(side);
5351
5352	if(cfg.show_progress && type != this.config.types.milestone){
5353		this._render_task_progress(task,div, width);
5354	}
5355
5356
5357	if(!this.config.readonly){
5358		if(cfg.drag_resize && !this._is_flex_task(task) && type != this.config.types.milestone){
5359			gantt._render_pair(div, "gantt_task_drag", task, function(css){
5360				var el = document.createElement("div");
5361				el.className = css;
5362				return el;
5363			});
5364		}
5365		if(cfg.drag_links){
5366			gantt._render_pair(div, "gantt_link_control", task, function(css){
5367				var outer = document.createElement("div");
5368				outer.className = css;
5369				outer.style.cssText = [
5370					"height:" + height + 'px',
5371					"line-height:" + height + 'px'
5372				].join(";");
5373				var inner = document.createElement("div");
5374				inner.className = "gantt_link_point";
5375				outer.appendChild(inner);
5376				return outer;
5377			});
5378		}
5379	}
5380	return div;
5381};
5382
5383gantt._render_side_content = function(task, template, cssClass){
5384	if(!template) return null;
5385
5386	var text = template(task.start_date, task.end_date, task);
5387	if(!text) return null;
5388	var content = document.createElement("div");
5389	content.className = "gantt_side_content " + cssClass;
5390	content.innerHTML = text;
5391	return content;
5392};
5393
5394
5395
5396gantt._render_leftside_content = function(task){
5397	var css = "gantt_left " + gantt._get_link_crossing_css(true, task);
5398	return gantt._render_side_content(task, this.templates.leftside_text, css);
5399};
5400gantt._render_rightside_content = function(task){
5401	var css = "gantt_right " + gantt._get_link_crossing_css(false, task);
5402	return gantt._render_side_content(task, this.templates.rightside_text, css);
5403};
5404
5405gantt._get_conditions = function(leftside){
5406	if(leftside){
5407		return {
5408			$source : [
5409				gantt.config.links.start_to_start
5410			],
5411			$target : [
5412				gantt.config.links.start_to_start,
5413				gantt.config.links.finish_to_start
5414			]
5415		};
5416	}else{
5417		return {
5418			$source : [
5419				gantt.config.links.finish_to_start,
5420				gantt.config.links.finish_to_finish
5421			],
5422			$target : [
5423				gantt.config.links.finish_to_finish
5424			]
5425		};
5426	}
5427};
5428
5429gantt._get_link_crossing_css = function(left, task){
5430	var cond = gantt._get_conditions(left);
5431
5432	for(var i in cond){
5433		var links = task[i];
5434		for(var ln =0; ln < links.length; ln++){
5435			var link = gantt.getLink(links[ln]);
5436
5437			for(var tp =0; tp < cond[i].length; tp++){
5438				if(link.type == cond[i][tp]){
5439					return "gantt_link_crossing";
5440				}
5441			}
5442		}
5443	}
5444	return "";
5445};
5446
5447
5448
5449gantt._render_task_content = function(task, width){
5450	var content = document.createElement("div");
5451	if(this._get_safe_type(task.type) != this.config.types.milestone)
5452		content.innerHTML = this.templates.task_text(task.start_date, task.end_date, task);
5453	content.className = "gantt_task_content";
5454	//content.style.width = width + 'px';
5455	return content;
5456};
5457gantt._render_task_progress = function(task, element, maxWidth){
5458	var done = task.progress*1 || 0;
5459
5460	maxWidth = Math.max(maxWidth - 2, 0);//2px for borders
5461	var pr = document.createElement("div");
5462	var width = Math.round(maxWidth*done);
5463
5464	width = Math.min(maxWidth, width);
5465
5466	pr.style.width = width + 'px';
5467	pr.className = "gantt_task_progress";
5468	pr.innerHTML = this.templates.progress_text(task.start_date, task.end_date, task);
5469	element.appendChild(pr);
5470	if(this.config.drag_progress && !gantt.config.readonly){
5471		var drag = document.createElement("div");
5472		drag.style.left = width + 'px';
5473		drag.className = "gantt_task_progress_drag";
5474		pr.appendChild(drag);
5475		element.appendChild(drag);
5476	}
5477};
5478gantt._get_line = function(step) {
5479    var steps = {
5480        "second": 1,
5481        "minute": 60,
5482        "hour": 60*60,
5483        "day": 60*60*24,
5484        "week": 60*60*24*7,
5485        "month": 60*60*24*30,
5486        "year": 60*60*24*365
5487    };
5488    return steps[step] || 0;
5489};
5490
5491
5492gantt._date_from_pos = function(x){
5493	var scale = this._tasks;
5494	if(x < 0 || x > scale.full_width){
5495		return null;
5496	}
5497	var ind = 0;
5498	var summ = 0;
5499	while(summ + scale.width[ind] < x){
5500		summ += scale.width[ind];
5501		ind++;
5502	}
5503	var part = (x - summ)/scale.width[ind];
5504
5505	var unit =  gantt._get_coll_duration(scale, scale.trace_x[ind]);
5506
5507
5508	var date = new Date(scale.trace_x[ind].valueOf() + Math.round(part*unit));
5509	return date;
5510};
5511
5512gantt.posFromDate = function(date){
5513	var ind = gantt._day_index_by_date(date);
5514	dhtmlx.assert(ind >= 0, "Invalid day index");
5515
5516	var wholeCells = Math.floor(ind);
5517	var partCell = ind % 1;
5518
5519	var pos = 0;
5520	for(var i=1; i <= wholeCells; i++)
5521		pos += gantt._tasks.width[i-1];
5522
5523	if(partCell){
5524		if(wholeCells < gantt._tasks.width.length){
5525			pos += gantt._tasks.width[wholeCells]*(partCell % 1);
5526		}else{
5527			pos += 1;
5528		}
5529
5530	}
5531	return pos;
5532};
5533
5534gantt._day_index_by_date = function(date){
5535	var pos = new Date(date);
5536	var days = gantt._tasks.trace_x,
5537		ignores = gantt._tasks.ignore_x;
5538
5539	if(+pos <= this._min_date)
5540		return 0;
5541
5542	if(+pos >= this._max_date)
5543		return days.length;
5544
5545	for (var xind = 0; xind < days.length-1; xind++) {
5546		// | 8:00, 8:30 | 8:15 should be checked against 8:30
5547		// clicking at the most left part of the cell, say 8:30 should create event in that cell, not previous one
5548		if (+pos < days[xind+1] && !ignores[+days[xind+1]])
5549			break;
5550	}
5551	return xind + ((date - days[xind]) / gantt._get_coll_duration(gantt._tasks, days[xind]));
5552};
5553gantt._get_coll_duration = function(scale, date){
5554	return gantt.date.add(date, scale.step, scale.unit) -  date;
5555};
5556
5557gantt._get_x_pos = function(task, to_start){
5558	to_start = to_start !== false;
5559	var x = gantt.posFromDate(to_start ? task.start_date : task.end_date);
5560
5561
5562
5563};
5564
5565gantt._get_task_coord = function(task, to_start, x_correction){
5566	to_start = to_start !== false;
5567	x_correction = x_correction || 0;
5568
5569	var isMilestone = (task.type == this.config.types.milestone);
5570	var x = this.posFromDate((to_start || isMilestone) ? task.start_date : task.end_date),
5571		y = this._y_from_ind(this._get_visible_order(task.id));
5572
5573	if(isMilestone){
5574		if(to_start){
5575			x -= x_correction;
5576		}else{
5577			x += x_correction;
5578		}
5579	}
5580	return {x:x, y:y};
5581};
5582gantt._get_task_pos = function(task, to_start){
5583	to_start = to_start !== false;
5584	var mstoneCorrection = gantt._get_milestone_width()/2;
5585	return this._get_task_coord(task, to_start, mstoneCorrection);
5586};
5587
5588gantt._get_task_visible_pos = function(task, to_start){
5589	to_start = to_start !== false;
5590	var mstoneCorrection = gantt._get_visible_milestone_width()/2;
5591	return this._get_task_coord(task, to_start, mstoneCorrection);
5592};
5593
5594
5595gantt._correct_shift=function(start, back){
5596	return start-=((new Date(gantt._min_date)).getTimezoneOffset()-(new Date(start)).getTimezoneOffset())*60000*(back?-1:1);
5597};
5598
5599
5600
5601gantt._get_mouse_pos = function(ev){
5602	if (ev.pageX || ev.pageY)
5603		var pos = {x:ev.pageX, y:ev.pageY};
5604
5605	var d = _isIE ? document.documentElement : document.body;
5606	var pos = {
5607		x:ev.clientX + d.scrollLeft - d.clientLeft,
5608		y:ev.clientY + d.scrollTop - d.clientTop
5609	};
5610
5611	var box = gantt._get_position(gantt.$task_data);
5612	pos.x = pos.x - box.x + gantt.$task_data.scrollLeft;
5613	pos.y = pos.y - box.y + gantt.$task_data.scrollTop;
5614	return pos;
5615};
5616
5617//helper for rendering bars and links
5618gantt._task_renderer = function(id, render_one, node, filter){
5619	//hash of dom elements is needed to redraw single bar/link
5620	if(!this._task_area_pulls)
5621		this._task_area_pulls = {};
5622
5623	if(!this._task_area_renderers)
5624		this._task_area_renderers = {};
5625
5626	if(this._task_area_renderers[id])
5627		return this._task_area_renderers[id];
5628
5629	if(!render_one)
5630		dhtmlx.assert(false, "Invalid renderer call");
5631
5632	this._task_area_renderers[id] = {
5633		render_item : function(item, container){
5634			var pull = gantt._task_area_pulls[id];
5635			container = container || node;
5636
5637
5638			if(filter){
5639				if(!filter(item)){
5640					this.remove_item(item.id);
5641					return;
5642				}
5643			}
5644
5645			var dom = render_one.call(gantt, item);
5646			if(!dom) return;
5647			if(pull[item.id]){
5648				this.replace_item(item.id, dom);
5649			}else{
5650				pull[item.id] = dom;
5651				container.appendChild(dom);
5652			}
5653		},
5654		render_items : function(items, container){
5655			this.rendered = gantt._task_area_pulls[id] = {};
5656			container = container || node;
5657			container.innerHTML = "";
5658			var buffer = document.createDocumentFragment();
5659			for(var i= 0, vis = items.length; i < vis; i++){
5660				this.render_item(items[i], buffer);
5661			}
5662			container.appendChild(buffer);
5663		},
5664		replace_item: function(item_id, newNode){
5665			var item = this.rendered[item_id];
5666			if(item && item.parentNode){
5667				item.parentNode.replaceChild(newNode, item);
5668			}
5669			this.rendered[item_id] = newNode;
5670		},
5671		remove_item:function(item_id){
5672			var item = this.rendered[item_id];
5673			if(item && item.parentNode){
5674				item.parentNode.removeChild(item);
5675			}
5676			delete this.rendered[item_id];
5677		},
5678        change_id: function(oldid, newid) {
5679            this.rendered[newid] = this.rendered[oldid];
5680            delete this.rendered[oldid];
5681        },
5682		rendered : this._task_area_pulls[id],
5683		node: node
5684	};
5685
5686	return this._task_area_renderers[id];
5687};
5688
5689
5690
5691gantt._pull = {};
5692gantt._branches = {};
5693gantt._order = [];
5694gantt._lpull = {};
5695
5696gantt.load = function(url, type, callback){
5697	dhtmlx.assert(arguments.length, "Invalid load arguments");
5698	this.callEvent("onLoadStart", []);
5699	var tp = 'json', cl = null;
5700	if(arguments.length >= 3){
5701		tp = type;
5702		cl = callback;
5703	}else{
5704		if(typeof arguments[1] == "string")
5705			tp = arguments[1];
5706		else if(typeof arguments[1] == "function")
5707			cl = arguments[1];
5708	}
5709
5710	dhtmlxAjax.get(url, dhtmlx.bind(function(l) {
5711		this.on_load(l, tp);
5712		if(typeof cl == "function")
5713			cl.call(this);
5714	}, this));
5715};
5716gantt.parse = function(data, type) {
5717	this.on_load({xmlDoc: {responseText: data}}, type);
5718};
5719
5720gantt.serialize = function(type){
5721	type = type || "json";
5722	return this[type].serialize();
5723};
5724
5725/*
5726tasks and relations
5727{
5728data:[
5729	{
5730		"id":"string",
5731		"text":"...",
5732		"start_date":"Date or string",
5733		"end_date":"Date or string",
5734		"duration":"number",
5735		"progress":"0..1",
5736		"parent_id":"string",
5737		"order":"number"
5738	},...],
5739links:[
5740	{
5741		id:"string",
5742		source:"string",
5743		target:"string",
5744		type:"string"
5745	},...],
5746collections:{
5747		collectionName:[
5748			{key:, label:, optional:...},...
5749		],...
5750	}
5751}
5752
5753 gantt._pull - id to object hash
5754 gantt._branch - array of per branch arrays of objects|ids
5755 gantt._order - array of visible elements
5756 gantt._order_full - array of all elements
5757
5758 gantt._links
5759* */
5760
5761gantt.on_load = function(resp, type){
5762	if(!type)
5763		type = "json";
5764	dhtmlx.assert(this[type], "Invalid data type:'" + type + "'");
5765
5766	var raw = resp.xmlDoc.responseText;
5767
5768	var data = this[type].parse(raw, resp);
5769	this._process_loading(data);
5770	this.callEvent("onLoadEnd", []);
5771};
5772
5773
5774
5775gantt._process_loading = function(data){
5776	if(data.collections)
5777		this._load_collections(data.collections);
5778
5779	var tasks = data.data;
5780
5781	for (var i = 0; i < tasks.length; i++) {
5782		var task = tasks[i];
5783		this._init_task(task);
5784		if (!this.callEvent("onTaskLoading", [task])) continue;
5785
5786		this._pull[task.id] = task;
5787		this._add_branch(task);
5788	}
5789
5790
5791    this._sync_order();
5792
5793    // calculating $level for each item
5794    for (var i in this._pull)
5795        this._pull[i].$level = this._item_level(this._pull[i]);
5796
5797	this._init_links(data.links || (data.collections ? data.collections.links : []));
5798
5799};
5800
5801
5802gantt._init_links = function(links){
5803	if (links)
5804		for(var i=0; i < links.length; i++){
5805			if(links[i]){
5806	        var link = this._init_link(links[i]);
5807	        this._lpull[link.id] = link;
5808			}
5809		}
5810    this._sync_links();
5811};
5812
5813
5814gantt._load_collections = function(collections){
5815	var collections_loaded = false;
5816	for (var key in collections) {
5817		if (collections.hasOwnProperty(key)) {
5818			collections_loaded = true;
5819			var collection = collections[key];
5820			var arr = this.serverList[key];
5821			if (!arr) continue;
5822			arr.splice(0, arr.length); //clear old options
5823			for (var j = 0; j < collection.length; j++) {
5824				var option = collection[j];
5825				var obj =  dhtmlx.copy(option);
5826				obj.key = obj.value;// resulting option object
5827
5828				for (var option_key in option) {
5829					if (option.hasOwnProperty(option_key)) {
5830						if (option_key == "value" || option_key == "label")
5831							continue;
5832						obj[option_key] = option[option_key]; // obj['value'] = option['value']
5833					}
5834				}
5835				arr.push(obj);
5836			}
5837		}
5838	}
5839	if (collections_loaded)
5840		this.callEvent("onOptionsLoad", []);
5841};
5842
5843gantt._sync_order = function() {
5844    this._order = [];
5845    this._sync_order_item({parent:this.config.root_id, $open:true, $ignore:true, id:this.config.root_id});
5846
5847    this._scroll_resize();
5848    this._set_sizes();
5849};
5850gantt.attachEvent("onBeforeTaskDisplay", function(id, task){
5851	return !task.$ignore;
5852});
5853gantt._sync_order_item = function(item) {
5854
5855	if(item.id && //do not trigger event for virtual root
5856		this._filter_task(item.id, item) &&
5857		this.callEvent("onBeforeTaskDisplay", [item.id, item])){
5858			this._order.push(item.id);
5859	}
5860
5861
5862    if (item.$open) {
5863        var children = this._branches[item.id];
5864        if (children)
5865        	for (var i = 0; i < children.length; i++)
5866        		this._sync_order_item(this._pull[children[i]]);            	
5867    }
5868};
5869
5870gantt._get_visible_order = function(id){
5871	dhtmlx.assert(id, "Invalid argument");
5872	var ord = this._order;
5873	for(var i= 0, count = ord.length; i < count; i++)
5874		if(ord[i] == id) return i;
5875
5876	return -1;
5877};
5878
5879
5880
5881gantt.eachTask = function(code, parent, master){
5882	parent = parent || this.config.root_id;
5883	master = master || this;
5884
5885	var branch = this._branches[parent];
5886	if (branch)
5887		for (var i=0; i<branch.length; i++){
5888			var item = this._pull[branch[i]];
5889			code.call(master, item);
5890			if (this._branches[item.id])
5891				this.eachTask(code, item.id, master);
5892		}
5893};
5894
5895gantt.json = {
5896	parse : function(data){
5897		dhtmlx.assert(data, "Invalid data");
5898
5899		if (typeof data == "string") {
5900			if(window.JSON)
5901				data = JSON.parse(data);
5902			else{
5903				gantt._temp = eval("(" + data + ")");
5904				data = gantt._temp || {};
5905				gantt._temp = null;
5906			}
5907		}
5908
5909		if (data.dhx_security)
5910			dhtmlx.security_key = data.dhx_security;
5911		return data;
5912	},
5913	_copyLink:function(obj){
5914		var copy = {};
5915		for (var key in obj)
5916			copy[key] = obj[key];
5917		return copy;
5918	},
5919	_copyObject:function(obj){
5920		var copy = {};
5921		for (var key in obj){
5922			if (key.charAt(0) == "$")
5923				continue;
5924			copy[key] = obj[key];
5925		}
5926		copy.start_date = gantt.templates.xml_format(copy.start_date);
5927		if (copy.end_date)
5928			copy.end_date = gantt.templates.xml_format(copy.end_date);
5929		return copy;
5930	},
5931	serialize:function(){
5932		var tasks = [];
5933		var links = [];
5934
5935		gantt.eachTask(function(obj){
5936			tasks.push(this._copyObject(obj));
5937		}, gantt.config.root_id, this);
5938		for (var key in gantt._lpull)
5939			links.push(this._copyLink(gantt._lpull[key]));
5940
5941		return {
5942			data : tasks,
5943			links: links
5944		};
5945	}
5946};
5947
5948/*
5949<data>
5950	<task id:"some" parent_id="0" progress="0.5">
5951		<text>My task 1</text>
5952		<start_date>16.08.2013</start_date>
5953		<end_date>22.08.2013</end_date>
5954	</task>
5955	<coll_options>
5956		<links>
5957			<link source='a1' target='b2' type='c3' />
5958		</links>
5959	</coll_options>
5960</data>
5961*/
5962
5963gantt.xml = {
5964	_xmlNodeToJSON:function(node, attrs_only){
5965		var t = {};
5966		for (var i = 0; i < node.attributes.length; i++)
5967			t[node.attributes[i].name] = node.attributes[i].value;
5968
5969		if (!attrs_only){
5970			for (var i = 0; i < node.childNodes.length; i++) {
5971				var child = node.childNodes[i];
5972				if (child.nodeType == 1)
5973					t[child.tagName] = child.firstChild ? child.firstChild.nodeValue : "";
5974			}
5975
5976			if (!t.text) t.text = node.firstChild ? node.firstChild.nodeValue : "";
5977		}
5978
5979		return t;
5980	},
5981	_getCollections:function(loader){
5982		var collection = {};
5983		var opts = loader.doXPath("//coll_options");
5984		for (var i = 0; i < opts.length; i++) {
5985			var bind = opts[i].getAttribute("for");
5986			var arr = collection[bind] = [];
5987			var itms = loader.doXPath(".//item", opts[i]);
5988			for (var j = 0; j < itms.length; j++) {
5989				var itm = itms[j];
5990				var attrs = itm.attributes;
5991				var obj = { key: itms[j].getAttribute("value"), label: itms[j].getAttribute("label")};
5992				for (var k = 0; k < attrs.length; k++) {
5993					var attr = attrs[k];
5994					if (attr.nodeName == "value" || attr.nodeName == "label")
5995						continue;
5996					obj[attr.nodeName] = attr.nodeValue;
5997				}
5998				arr.push(obj);
5999			}
6000		}
6001		return collection;
6002	},
6003	_getXML:function(text, loader, toptag){
6004		toptag = toptag || "data";
6005		if (!loader.getXMLTopNode){
6006			loader = new dtmlXMLLoaderObject(function() {});
6007			loader.loadXMLString(text);	
6008		}
6009
6010		var xml = loader.getXMLTopNode(toptag);
6011		if (xml.tagName != toptag) throw "Invalid XML data";
6012
6013		var skey = xml.getAttribute("dhx_security");
6014		if (skey)
6015			dhtmlx.security_key = skey;
6016
6017		return loader;
6018	},
6019	parse:function(text, loader){
6020		loader = this._getXML(text, loader);
6021		var data = { };
6022
6023		var evs = data.data = [];
6024		var xml = loader.doXPath("//task");
6025
6026		for (var i = 0; i < xml.length; i++)
6027			evs[i] = this._xmlNodeToJSON(xml[i]);
6028
6029		data.collections = this._getCollections(loader);
6030		return data;
6031	},
6032	_copyLink:function(obj){
6033		return "<item id='"+obj.id+"' source='"+obj.source+"' target='"+obj.target+"' type='"+obj.type+"' />";
6034	},
6035	_copyObject:function(obj){
6036		var start_date = gantt.templates.xml_format(obj.start_date);
6037		var end_date   = gantt.templates.xml_format(obj.end_date);
6038
6039		return "<task id='"+obj.id+"' parent='"+(obj.parent||"")+"' start_date='"+start_date+"' duration='"+obj.duration+"' open='"+(!!obj.open)+"' progress='"+obj.progress+"' end_date='"+end_date+"'><![CDATA["+obj.text+"]]></task>";
6040	},
6041	serialize:function(){
6042		var tasks = [];
6043		var links = [];
6044
6045		gantt.eachTask(function(obj){
6046			tasks.push(this._copyObject(obj));
6047		},this.config.root_id, this);
6048		for (var key in gantt._lpull)
6049			links.push(this._copyLink(gantt._lpull[key]));
6050
6051		return "<data>"+tasks.join("")+"<coll_options for='links'>"+links.join("")+"</coll_options></data>";			
6052	}
6053};
6054
6055
6056gantt.oldxml = {
6057	parse:function(text, loader){
6058		loader = gantt.xml._getXML(text, loader, "projects");
6059		var data = { collections:{ links:[] } };
6060
6061		var evs = data.data = [];
6062		var xml = loader.doXPath("//task");
6063		for (var i = 0; i < xml.length; i++){
6064			evs[i] = gantt.xml._xmlNodeToJSON(xml[i]);
6065			var parent = xml[i].parentNode;
6066
6067			if (parent.tagName == "project")
6068				evs[i].parent = "project-"+parent.getAttribute("id");
6069			else
6070				evs[i].parent = parent.parentNode.getAttribute("id");
6071		}
6072
6073		xml = loader.doXPath("//project");
6074		for (var i = 0; i < xml.length; i++){
6075			var ev = gantt.xml._xmlNodeToJSON(xml[i], true);
6076			ev.id ="project-"+ev.id;
6077			evs.push(ev);
6078		}
6079
6080		for (var i=0; i<evs.length; i++){
6081			var ev = evs[i];
6082			ev.start_date = ev.startdate || ev.est;
6083			ev.end_date = ev.enddate;
6084			ev.text = ev.name;
6085			ev.duration = ev.duration / 8;
6086			ev.open = 1;
6087			if (!ev.duration && !ev.end_date) ev.duration = 1;
6088			if (ev.predecessortasks)
6089				data.collections.links.push({ target:ev.id, source:ev.predecessortasks, type:gantt.config.links.finish_to_start });
6090		}
6091
6092		return data;
6093	},
6094	serialize:function(){
6095		dhtmlx.message("Serialization to 'old XML' is not implemented");
6096	}
6097};
6098
6099gantt.serverList = function(name, array) {
6100	if (array) {
6101		this.serverList[name] = array.slice(0);
6102	}else if(!this.serverList[name]){
6103		this.serverList[name] = [];
6104	}
6105	return this.serverList[name];
6106};
6107gantt._working_time_helper = {
6108	units : [
6109		"year",
6110		"month",
6111		"week",
6112		"day",
6113		"hour",
6114		"minute"
6115	],
6116
6117	hours:[8, 17],
6118	dates:{
6119		0:false,
6120		6:false
6121	},
6122
6123	_get_unit_order : function(unit){
6124		for(var i= 0, len =  this.units.length; i < len; i++){
6125			if(this.units[i] == unit)
6126				return i;
6127		}
6128		dhtmlx.assert(false, "Incorrect duration unit");
6129	},
6130
6131	_timestamp:function(settings){
6132
6133		var timestamp = null;
6134		if((settings.day || settings.day === 0)){
6135			timestamp = settings.day;
6136		}else if(settings.date){
6137			timestamp = gantt.date.date_part(new Date(settings.date)).valueOf();
6138		}
6139		return timestamp;
6140	},
6141	set_time:function(settings){
6142		var hours = settings.hours !== undefined ? settings.hours : true;
6143
6144		var timestamp = this._timestamp(settings);
6145
6146		if(timestamp !== null){
6147			this.dates[timestamp] = hours;
6148		}else{
6149			this.hours = hours;
6150		}
6151	},
6152	unset_time:function(settings){
6153
6154
6155		if(!settings){
6156			this.hours = [];
6157		}else{
6158
6159			var timestamp = this._timestamp(settings);
6160
6161			if(timestamp !== null){
6162				delete this.dates[timestamp];
6163			}
6164		}
6165	},
6166
6167	is_working_unit : function(date, unit, order){
6168		if(!gantt.config.work_time) return true;
6169
6170		if(order === undefined){
6171			order = this._get_unit_order(unit);
6172		}
6173		if(order === undefined){
6174			return false;
6175		}
6176		if(order){
6177			//check if bigger time unit is a work time (hour < day < month...)
6178			//i.e. don't check particular hour if the whole day is marked as 
6178not working
6179			if(!this.is_working_unit(date, this.units[order-1], order-1))
6180				return false;
6181		}
6182		if(!this["is_work_" + unit])
6183			return true;
6184		return this["is_work_" + unit](date);
6185	},
6186
6187	//checkings for particular time units
6188	//methods for month-year-week can be defined, otherwise always return 'true'
6189	is_work_day:function(date){
6190		var val = this.get_working_hours(date);
6191
6192		if(val instanceof Array){
6193			return val.length > 0;
6194		}
6195		return false;
6196	},
6197	is_work_hour:function(date){
6198		var hours = this.get_working_hours(date);
6199		var hour = date.getHours();
6200		for(var i=0; i < hours.length; i += 2){
6201			if(hours[i+1] === undefined){
6202				return hours[i] == hour;
6203			}else{
6204				if(hour >= hours[i] && hour < hours[i+1])
6205					return true;
6206			}
6207		}
6208		return false;
6209	},
6210
6211	get_working_hours:function(date){
6212		var t = this._timestamp({date:date});
6213		var hours = true;
6214		if(this.dates[t] !== undefined){
6215			hours = this.dates[t];//custom day
6216		}else if(this.dates[date.getDay()] !== undefined){
6217			hours = this.dates[date.getDay()];//week day
6218		}
6219		if(hours === true){
6220			return this.hours;
6221		}else if(hours){
6222			return hours;
6223		}
6224		return [];
6225
6226
6227	},
6228
6229	get_work_units_between:function(from, to, unit, step){
6230		if(!unit){
6231			return false;
6232		}
6233		var start = new Date(from),
6234			end = new Date(to),
6235			step = step || 1;
6236		var units = 0;
6237		while(start.valueOf() < end.valueOf()){
6238			if(this.is_working_unit(start, unit))
6239				units++;
6240			start = gantt.date.add(start, step, unit);
6241		}
6242		return units;
6243	},
6244
6245	add_worktime : function(from, duration, unit, step){
6246		if(!unit)
6247			return false;
6248
6249		var start = new Date(from),
6250			added = 0,
6251			step = step || 1,
6252			duration = duration*1;
6253
6254		while(added < duration){
6255			var next = gantt.date.add(start, step, unit);
6256			if(this.is_working_unit(step > 0 ? start : next, unit))
6257				added++;
6258			start = next;
6259		}
6260		return start;
6261	},
6262
6263	/* settings:
6264		{
6265		date:date,
6266		unit:'day'/'hour'...,
6267		dir:'future'/'past'/'any'/''
6268		}
6269	 */
6270	get_closest_worktime : function(settings){
6271		if(this.is_working_unit(settings.date, settings.unit))
6272			return settings.date;
6273
6274		var unit = settings.unit;
6275
6276		var curr = gantt.date[unit + '_start'](settings.date);
6277
6278		var future_target = new Date(curr),
6279			prev_target = new Date(curr),
6280			tick = true,
6281			maximum_loop = 3000,//be extra sure we won't fall into infinite loop, 3k seems big enough
6282			count = 0,
6283			both_directins = (settings.dir == 'any' || !settings.dir);
6284
6285		var inc = 1;
6286		if(settings.dir == 'past')
6287			inc = -1;
6288
6289		//will seek closest working hour in future or in past, one step in one direction per iteration
6290		while(!this.is_working_unit(curr, unit)){
6291
6292			if(both_directins){
6293				curr = tick ? future_target : prev_target;
6294				inc = inc*(-1);
6295			}
6296
6297			curr = gantt.date.add(curr, inc, unit);
6298
6299			if(both_directins){
6300				if(tick){
6301					future_target = curr;
6302				}else{
6303					prev_target = curr;
6304				}
6305			}
6306			tick = !tick;
6307			count++;
6308			if(count > maximum_loop){
6309				dhtmlx.assert(false, "Invalid working time check");
6310				return false;
6311			}
6312		}
6313
6314		if(curr == prev_target || settings.dir == 'past'){
6315			curr = gantt.date.add(curr, 1, unit);
6316		}
6317
6318		return curr;
6319	}
6320
6321
6322};
6323
6324gantt.getTask = function(id) {
6325    dhtmlx.assert(this._pull[id]);
6326    return this._pull[id];
6327};
6328gantt.getTaskByTime = function(from, to){
6329	var p = this._pull,
6330		res = [],
6331		pos = 0,
6332		taken = 0;
6333
6334	if(!(from || to)){
6335        for (var t in p) res.push(p[t]);
6336	}else{
6337		from = +from || -Infinity;
6338		to = +to || Infinity;
6339        for (var t in p){
6340            var task = p[t];
6341            if (+task.start_date < to && +task.end_date > from)
6342                res.push(task);
6343        }
6344	}
6345
6346	return res;
6347};
6348
6349gantt.isTaskExists = function(id) {
6350    return dhtmlx.defined(this._pull[id]);
6351};
6352
6353gantt.isTaskVisible = function(id){
6354	if(!this._pull[id])
6355		return false;
6356
6357	if(!(+this._pull[id].start_date < +this._max_date && +this._pull[id].end_date > +this._min_date))
6358		return false;
6359
6360	for(var i= 0, count = this._order.length; i < count; i++)
6361		if(this._order[i] == id) return true;
6362	return false;
6363};
6364
6365
6366gantt.updateTask = function(id, item) {
6367    if (!dhtmlx.defined(item)) item = this.getTask(id);
6368    if (this.callEvent("onBeforeTaskUpdate", [id, item])===false) return false;
6369
6370    this._pull[item.id] = item;
6371	if(!this._is_parent_sync(item)){
6372		this._resync_parent(item);
6373	}
6374	this._update_parents(item.id);
6375    this.refreshTask(item.id);
6376
6377    this.callEvent("onAfterTaskUpdate", [id, item]);
6378
6379    this._sync_order();
6380
6381	this._adjust_scales();
6382};
6383
6384gantt._add_branch = function(task){
6385	if (!this._branches[task.parent])
6386		this._branches[task.parent] = [];
6387	this._branches[task.parent].push(task.id);
6388	this._sync_parent(task);
6389	this._sync_order();
6390};
6391
6392gantt._move_branch = function(task, old_parent, new_parent){
6393	task.parent = new_parent;
6394	this._sync_parent(task);
6395	this._replace_branch_child(old_parent, task.id);
6396	if(new_parent){
6397
6398		this._add_branch(task);
6399	}else{
6400		delete this._branches[task.id];
6401	}
6402	task.$level =  this._item_level(task);
6403	this._sync_order();
6404};
6405gantt._resync_parent = function(task){
6406	this._move_branch(task, task.$rendered_parent, task.parent);
6407};
6408gantt._sync_parent = function(task){
6409	task.$rendered_parent = task.parent;
6410};
6411gantt._is_parent_sync = function(task){
6412	return (task.$rendered_parent == task.parent);
6413};
6414
6415
6416gantt._replace_branch_child = function(node, old_id, new_id){
6417	var branch = this._branches[node];
6418	if (branch){
6419		var newbranch = [];
6420		for (var i=0; i<branch.length; i++){
6421			if (branch[i] != old_id)
6422				newbranch.push(branch[i]);
6423			else if (new_id)
6424				newbranch.push(new_id);
6425		}
6426		this._branches[node] = newbranch;
6427	}
6428	this._sync_order();
6429};
6430
6431gantt.addTask = function(item, parent) {
6432    if (!dhtmlx.defined(parent)) parent = item.parent || 0;
6433    if (!dhtmlx.defined(this._pull[parent])) parent = 0;
6434    item.parent = parent;
6435    item = this._init_task(item);
6436
6437    if (this.callEvent("onBeforeTaskAdd", [item.id, item])===false) return false;
6438
6439    this._pull[item.id] = item;
6440
6441	this._add_branch(item);
6442
6443    this.refreshData();
6444
6445    this.callEvent("onAfterTaskAdd", [item.id, item]);
6446	this._adjust_scales();
6447    return item.id;
6448};
6449
6450gantt.deleteTask = function(id) {
6451    return this._deleteTask(id);
6452};
6453
6454gantt._deleteTask = function(id, silent) {
6455    var item = this.getTask(id);
6456    if (!silent && this.callEvent("onBeforeTaskDelete", [id, item])===false) return false;
6457
6458    if (!silent && this._dp)
6459        this._dp.setUpdateMode("off");
6460    var branches = this._branches[item.id] || [];
6461
6462    if(this._selected_task == id)
6463        this._selected_task = null;
6464
6465    for (var i = 0; i < branches.length; i++) {
6466        this._silentStart();
6467        this._deleteTask(branches[i], true);
6468        // add deleted subrow into dataprocessor update list manually
6469        // because silent mode is on
6470        if (this._dp) {
6471            this._dp._ganttMode = "tasks";
6472            this._dp.setUpdated(branches[i],true,"deleted");
6473        }
6474        this._silentEnd();
6475    }
6476    if (!silent && this._dp)
6477        this._dp.setUpdateMode("cell");
6478
6479    while (item.$source.length > 0)
6480        this.deleteLink(item.$source[0]);
6481    while (item.$target.length > 0)
6482        this.deleteLink(item.$target[0]);
6483
6484    delete this._pull[id];
6485	this._move_branch(item, item.parent, null);
6486
6487
6488    if (!silent) {
6489        this.callEvent("onAfterTaskDelete", [id, item]);
6490        this.refreshData();
6491    }
6492    return true;
6493};
6494
6495gantt.clearAll = function() {
6496    this._pull = {};
6497    this._branches = {};
6498    this._order = [];
6499    this._order_full = [];
6500    this._lpull = {};
6501
6502	this.refreshData();
6503
6504    this.callEvent("onClear", []);
6505};
6506
6507gantt.changeTaskId = function(oldid, newid) {
6508    var item = this._pull[newid] = this._pull[oldid];
6509    this._pull[newid].id = newid;
6510    delete this._pull[oldid];
6511    for (var id in this._pull) {
6512        if (this._pull[id].parent == oldid)
6513            this._pull[id].parent = newid;
6514    }
6515    if (this._lightbox_id == oldid)
6516        this._lightbox_id = newid;
6517    this._replace_branch_child(item.parent, oldid, newid);
6518
6519	this.callEvent("onTaskIdChange", [oldid, newid]);
6520};
6521
6522gantt._get_duration_unit = function(){
6523	return (gantt._get_line(this.config.duration_unit)*1000) || this.config.duration_unit;
6524};
6525
6526gantt._get_safe_type = function(type){
6527	for(var i in this.config.types){
6528		if(this.config.types[i] == type){
6529			return type;
6530		}
6531	}
6532	return gantt.config.types.task;
6533};
6534gantt._get_type_name = function(type_value){
6535	for(var i in this.config.types){
6536		if(this.config.types[i] == type_value){
6537			return i;
6538		}
6539	}
6540	return "task";
6541};
6542gantt.getWorkHours = function(date){
6543	return this._working_time_helper.get_working_hours(date);
6544};
6545
6546gantt.setWorkTime = function(config){
6547	this._working_time_helper.set_time(config);
6548};
6549
6550gantt.isWorkTime = function(date, unit){
6551	var helper = this._working_time_helper;
6552	return helper.is_working_unit(date, unit || this.config.duration_unit);
6553};
6554
6555gantt.getClosestWorkTime = function(config){
6556	var helper = this._working_time_helper;
6557	if(config instanceof Date){
6558		config = {
6559			date:config
6560		};
6561	}
6562	config.dir = config.dir || 'any';
6563	config.unit = config.unit || this.config.duration_unit;
6564	return helper.get_closest_worktime(config);
6565};
6566
6567gantt.calculateDuration = function(start_date, end_date){
6568	var helper = this._working_time_helper;
6569	return helper.get_work_units_between(start_date, end_date, this.config.duration_unit, this.config.duration_step);
6570};
6571gantt.calculateEndDate = function(start, duration, unit){
6572	var helper = this._working_time_helper;
6573	var mult = duration >= 0 ? 1 : -1;
6574	return helper.add_worktime(start, Math.abs(duration), this.config.duration_unit, mult*this.config.duration_step);
6575};
6576
6577gantt._init_task = function(task){
6578    if (!dhtmlx.defined(task.id) || this._pull[task.id])
6579        task.id = dhtmlx.uid();
6580
6581	if(task.start_date)
6582		task.start_date = gantt.date.parseDate(task.start_date, "xml_date");
6583	if(task.end_date)
6584		task.end_date = gantt.date.parseDate(task.end_date, "xml_date");
6585
6586
6587
6588	if(task.start_date){
6589		if(!task.end_date && task.duration){
6590			task.end_date = this.calculateEndDate(task.start_date, task.duration);
6591		}
6592	}
6593
6594	if(gantt.config.work_time && gantt.config.correct_work_time){
6595		if(task.start_date)
6596			task.start_date = gantt.getClosestWorkTime(task.start_date);
6597		if(task.end_date)
6598			task.end_date = gantt.getClosestWorkTime(task.end_date);
6599	}
6600	gantt._init_task_timing(task);
6601
6602    task.$source = [];
6603    task.$target = [];
6604    task.parent = task.parent || this.config.root_id;
6605    task.$open = dhtmlx.defined(task.open) ? task.open : false;
6606    task.$level = this._item_level(task);
6607    return task;
6608};
6609
6610gantt._init_task_timing = function(task){
6611	if(task.$rendered_type === undefined){
6612		task.$rendered_type = task.type;
6613	}else if(task.$rendered_type != task.type){
6614		delete task.$no_end;
6615		delete task.$no_start;
6616		task.$rendered_type = task.type;
6617	}
6618
6619	if((task.$no_end === undefined || task.$no_start === undefined) && task.type != this.config.types.milestone){
6620		if(task.type == this.config.types.project){
6621			//project duration is always defined by children duration
6622			task.$no_end = task.$no_start = true;
6623		}else{
6624			//tasks can have fixed duration, children duration(as projects), or one date fixed, and other defined by nested items
6625			task.$no_end = !(task.end_date || task.duration);
6626			task.$no_start = !task.start_date;
6627		}
6628	}
6629
6630	if(task.type == this.config.types.milestone){
6631		task.end_date = task.start_date;
6632	}
6633	if (task.start_date && task.end_date){
6634		task.duration = this.calculateDuration(task.start_date, task.end_date);
6635	}
6636	task.duration = task.duration || 0;
6637};
6638gantt._is_flex_task = function(task){
6639	return !!(task.$no_end || task.$no_start);
6640};
6641
6642gantt._update_parents = function(taskId, silent){
6643	if(!taskId) return;
6644
6645	var task = this.getTask(taskId);
6646
6647	while(!(task.$no_end || task.$no_start) && task.parent && this.isTaskExists(task.parent)){
6648		task = this.getTask(task.parent);
6649	}
6650
6651	if(task.$no_end){
6652		var max = 0;
6653		this.eachTask(function(child){
6654			if(child.end_date && +child.end_date > +max){
6655				max = new Date(child.end_date);
6656			}
6657		}, task.id);
6658
6659		if(max){
6660			task.end_date = max;
6661		}
6662	}
6663	if(task.$no_start){
6664		var min = Infinity;
6665		this.eachTask(function(child){
6666			if(child.start_date && +child.start_date < +min){
6667				min = new Date(child.start_date);
6668			}
6669		}, task.id);
6670
6671		if(min != Infinity){
6672			task.start_date = min;
6673		}
6674	}
6675
6676	if((task.$no_end || task.$no_start)){
6677		this._init_task_timing(task);
6678		if(!silent)
6679			this.refreshTask(task.id, true);
6680	}
6681	if(task.parent && this.isTaskExists(task.parent)){
6682		this._update_parents(task.parent, silent);
6683	}
6684};
6685gantt.isChildOf = function(child_id, parent_id){
6686	if(!this.isTaskExists(child_id))
6687		return false;
6688	if(parent_id === this.config.root_id)
6689		return this.isTaskExists(child_id);
6690
6691	var task = this.getTask(child_id);
6692
6693	while(task && this.isTaskExists(task.parent)){
6694		task = this.getTask(task.parent);
6695		if(task && task.id == parent_id)
6696			return true;
6697	}
6698	return false;
6699};
6700
6701gantt._get_closest_date = function(config){
6702	var date = config.date,
6703		steps = config.step,
6704		unit = config.unit;
6705
6706	var upper = gantt.date[unit + "_start"](new Date(this._min_date));
6707	while(+upper < +date){
6708		upper = gantt.date.add(upper, steps, unit);
6709	}
6710
6711	var lower = gantt.date.add(upper, -1*steps, unit);
6712	if(config.dir && config.dir == 'future')
6713		return upper;
6714	if(config.dir && config.dir == 'past')
6715		return lower;
6716
6717	if(Math.abs(date - lower) < Math.abs(upper - date)){
6718		return lower;
6719	}else{
6720		return upper;
6721	}
6722
6723};
6724
6725
6726gantt.attachEvent("onBeforeTaskUpdate", function(id, task){
6727	gantt._init_task_timing(task);
6728	return true;
6729});
6730gantt.attachEvent("onBeforeTaskAdd", function(id, task){
6731	gantt._init_task_timing(task);
6732	return true;
6733});
6734
6735gantt._item_level = function(item) {
6736    var level = 0;
6737    while (item.parent) {
6738        if (!dhtmlx.defined(this._pull[item.parent])) break;
6739        item = this._pull[item.parent];
6740        level++;
6741    }
6742    return level;
6743};
6744
6745
6746gantt.sort = function(field, desc, parent) {
6747    var render = !arguments[3];//4th argument to cancel redraw after sorting
6748
6749    if (!dhtmlx.defined(parent)) {
6750        parent = this.config.root_id;
6751    }
6752
6753    if (!dhtmlx.defined(field)) field = "order";
6754    var criteria = (typeof(field) == "string") ? (function(a, b) {
6755        var result = a[field] > b[field];
6756        if (desc) result = !result;
6757        return result ? 1 : -1;
6758    }) : field;
6759
6760
6761    var els = this._branches[parent];
6762    if (els){
6763        var temp = [];
6764        for (var i = els.length - 1; i >= 0; i--)
6765            temp[i] = this._pull[els[i]];
6766
6767        temp.sort(criteria);
6768
6769        for (var i = 0; i < temp.length; i++) {
6770            els[i] = temp[i].id;
6771            this.sort(field, desc, els[i], true);
6772        }
6773    }
6774
6775    if (render) {
6776		this.refreshData();
6777    }
6778};
6779
6780gantt.getNext = function(id) {
6781    for (var i = 0; i < this._order.length-1; i++) {
6782        if (this._order[i] == id)
6783            return this._order[i+1];
6784    }
6785    return null;
6786};
6787gantt.getPrev = function(id) {
6788    for (var i = 1; i < this._order.length; i++) {
6789        if (this._order[i] == id)
6790            return this._order[i-1];
6791    }
6792    return null;
6793};
6794
6795gantt._dp_init = function(dp) {
6796    dp.setTransactionMode("POST", true);
6797    dp.serverProcessor += (dp.serverProcessor.indexOf("?") != -1 ? "&" : "?") + "editing=true";
6798    dp._serverProcessor = dp.serverProcessor;
6799
6800    dp.styles = {
6801        updated:"gantt_updated",
6802        inserted:"gantt_inserted",
6803        deleted:"gantt_deleted",
6804        invalid:"gantt_invalid",
6805        error:"gantt_error",
6806        clear:""
6807    };
6808
6809    dp._methods=["_row_style","setCellTextStyle","_change_id","_delete_task"];
6810    this.attachEvent("onAfterTaskAdd", function(id, item) {
6811        dp._ganttMode = "tasks";
6812        dp.setUpdated(id,true,"inserted");
6813    });
6814    this.attachEvent("onAfterTaskUpdate", function(id, item) {
6815        dp._ganttMode = "tasks";
6816        dp.setUpdated(id,true);
6817    });
6818    this.attachEvent("onAfterTaskDelete", function(id, item) {
6819        dp._ganttMode = "tasks";
6820        dp.setUpdated(id,true,"deleted");
6821    });
6822
6823    this.attachEvent("onAfterLinkUpdate", function(id, item) {
6824        dp._ganttMode = "links";
6825        dp.setUpdated(id, true);
6826    });
6827    this.attachEvent("onAfterLinkAdd", function(id, item) {
6828        dp._ganttMode = "links";
6829        dp.setUpdated(id, true,"inserted");
6830    });
6831    this.attachEvent("onAfterLinkDelete", function(id, item) {
6832        dp._ganttMode = "links";
6833        dp.setUpdated(id, true,"deleted");
6834    });
6835    this.attachEvent("onRowDragEnd", function(id, target) {
6836        dp._ganttMode = "tasks";
6837        this.getTask(id).target = target;
6838        dp.setUpdated(id, true,"order");
6839    });
6840
6841    dp.attachEvent("onBeforeDataSending", function() {
6842        this.serverProcessor = this._serverProcessor + getUrlSymbol(this._serverProcessor) + "gantt_mode=" + this._ganttMode;
6843        return true;
6844    });
6845
6846    dp._getRowData=dhtmlx.bind(function(id, pref) {
6847        var task;
6848        if (dp._ganttMode == "tasks")
6849            task = this.isTaskExists(id) ? this.getTask(id) : { id: id };
6850        else
6851            task = this.isLinkExists(id) ? this.getLink(id) : { id: id };
6852
6853        var data = {};
6854        for (var key in task) {
6855            if (key.substr(0, 1) == "$") continue;
6856            var value = task[key];
6857            if (value instanceof Date)
6858                data[key] = this.templates.xml_format(value);
6859            else
6860                data[key] = value;
6861        }
6862		if(task.$no_start){
6863			task.start_date = "";
6864			task.duration = "";
6865		}
6866		if(task.$no_end){
6867			task.end_date = "";
6868			task.duration = "";
6869		}
6870        data[dp.action_param] = this.getUserData(id, dp.action_param);
6871        return data;
6872    }, this);
6873
6874    this._change_id = dhtmlx.bind(function(oldid, newid) {
6875        if (dp._ganttMode != "tasks")
6876            this.changeLinkId(oldid, newid);
6877        else
6878            this.changeTaskId(oldid, newid);
6879    }, this);
6880
6881    this._row_style = function(row_id, classname){
6882        if (dp._ganttMode != "tasks") return;
6883        var el = gantt.getTaskRowNode(row_id);
6884        if (!el) return;
6885        if (!classname) {
6886            var regexp = / (gantt_updated|gantt_inserted|gantt_deleted|gantt_invalid|gantt_error)/g;
6887            el.className = el.className.replace(regexp, "");
6888        } else
6889            el.className += " " + classname;
6890    };
6891
6892    // fake method for dataprocessor
6893    this._delete_task = function(row_id, node){};
6894
6895    this._dp = dp;
6896};
6897
6898gantt.getUserData = function(id, name) {
6899    if (!this.userdata) this.userdata = {};
6900    if (this.userdata[id] && this.userdata[id][name]) return this.userdata[id][name];
6901    return "";
6902};
6903gantt.setUserData = function(id, name, value) {
6904    if (!this.userdata) this.userdata = {};
6905    if (!this.userdata[id]) this.userdata[id] = {};
6906    this.userdata[id][name] = value;
6907};
6908
6909
6910gantt._init_link = function(link) {
6911    if (!dhtmlx.defined(link.id))
6912        link.id = dhtmlx.uid();
6913    return link;
6914};
6915
6916gantt._sync_links = function() {
6917    for (var id in this._pull) {
6918        this._pull[id].$source = [];
6919        this._pull[id].$target = [];
6920    }
6921    for (var id in this._lpull) {
6922        var link = this._lpull[id];
6923        if(this._pull[link.source])
6924            this._pull[link.source].$source.push(id);
6925        if(this._pull[link.target])
6926            this._pull[link.target].$target.push(id);
6927    }
6928};
6929
6930gantt.getLink = function(id) {
6931    dhtmlx.assert(this._lpull[id], "Link doesn't exist");
6932    return this._lpull[id];
6933};
6934
6935gantt.isLinkExists = function(id) {
6936    return dhtmlx.defined(this._lpull[id]);
6937};
6938
6939gantt.addLink = function(link) {
6940    link = this._init_link(link);
6941
6942    if (this.callEvent("onBeforeLinkAdd", [link.id, link])===false) return false;
6943
6944    this._lpull[link.id] = link;
6945    this._sync_links();
6946	this._render_link(link.id);
6947    this.callEvent("onAfterLinkAdd", [link.id, link]);
6948    return link.id;
6949};
6950
6951gantt.updateLink = function(id, data) {
6952    if (!dhtmlx.defined(data))
6953        data = this.getLink(id);
6954
6955    if (this.callEvent("onBeforeLinkUpdate", [id, data]) === false) return false;
6956
6957    this._lpull[id] = data;
6958    this._sync_links();
6959	this._render_link(id);
6960    this.callEvent("onAfterLinkUpdate", [id, data]);
6961    return true;
6962};
6963
6964gantt.deleteLink = function(id) {
6965    return this._deleteLink(id);
6966};
6967
6968gantt._deleteLink = function(id, silent) {
6969    var link = this.getLink(id);
6970    if (!silent && this.callEvent("onBeforeLinkDelete", [id, link])===false) return false;
6971
6972    delete this._lpull[id];
6973    this._sync_links();
6974    this.refreshLink(id);
6975    if (!silent) this.callEvent("onAfterLinkDelete", [id, link]);
6976    return true;
6977};
6978
6979gantt.changeLinkId = function(oldid, newid) {
6980    this._lpull[newid] = this._lpull[oldid];
6981    this._lpull[newid].id = newid;
6982    delete this._lpull[oldid];
6983
6984    this._sync_links();
6985	this.callEvent("onLinkIdChange", [oldid, newid]);
6986};
6987
6988
6989gantt.getChildren = function(id) {
6990    return dhtmlx.defined(this._branches[id]) ? this._branches[id] : [];
6991};
6992gantt.hasChild = function(id) {
6993    return dhtmlx.defined(this._branches[id]);
6994};
6995
6996
6997gantt.refreshData = function(){
6998	this._sync_order();
6999	this._render_data();
7000};
7001
7002
7003gantt._configure = function(col, data){
7004	for (var key in data)
7005		if (typeof col[key] == "undefined")
7006			col[key] = data[key];
7007};
7008gantt._init_skin = function(){
7009	if (!gantt.skin){
7010		var links = document.getElementsByTagName("link");
7011		for (var i = 0; i < links.length; i++) {
7012			var res = links[i].href.match("dhtmlxgantt_([a-z]+).css");
7013			if (res){
7014				gantt.skin = res[1];
7015				break;
7016			}
7017		}
7018	}
7019
7020	if (!gantt.skin) gantt.skin = "terrace";
7021	var skinset = gantt.skins[gantt.skin];
7022
7023	//apply skin related settings
7024	this._configure(gantt.config, skinset.config);
7025
7026	var config = gantt.config.columns;
7027	if (config[1] && typeof config[1].width == "undefined")
7028		config[1].width = skinset._second_column_width;
7029	if (config[2] && typeof config[2].width == "undefined")
7030		config[2].width = skinset._third_column_width;
7031	
7032	if (skinset._lightbox_template)
7033		gantt._lightbox_template = skinset._lightbox_template;
7034	
7035	gantt._init_skin = function(){};
7036};
7037gantt.skins = {};
7038
7039
7040gantt._lightbox_methods = {};
7041gantt._lightbox_template="<div class='dhx_cal_ltitle'><span class='dhx_mark'>&nbsp;</span><span class='dhx_time'></span><span class='dhx_title'></span></div><div class='dhx_cal_larea'></div>";
7042
7043gantt.showLightbox=function(id){
7044    if (!id || this.config.readonly) return;
7045    if (!this.callEvent("onBeforeLightbox",[id])) return;
7046
7047	var task = this.getTask(id);
7048
7049    var box = this.getLightbox(this._get_safe_type(task.type));
7050    this._center_lightbox(box);
7051    this.showCover();
7052    this._fill_lightbox(id,box);
7053    this.callEvent("onLightbox",[id]);
7054};
7055gantt._get_timepicker_step = function(){
7056	if(this.config.round_dnd_dates){
7057		var scale = gantt._tasks,
7058			step = (this._get_line(scale.unit) * scale.step)/60;//timepicker step is measured in minutes
7059		if(step >= 60*24){
7060			step = this.config.time_step;
7061		}
7062		return step;
7063	}
7064	return this.config.time_step;
7065};
7066gantt.getLabel = function(property, key) {
7067    var sections = this._get_typed_lightbox_config();
7068    for (var i=0; i<sections.length; i++) {
7069        if(sections[i].map_to == property) {
7070            var options = sections[i].options;
7071            for (var j=0; j<options.length; j++) {
7072                if(options[j].key == key) {
7073                    return options[j].label;
7074                }
7075            }
7076        }
7077    }
7078    return "";
7079};
7080
7081gantt.updateCollection = function(list_name, collection) {
7082	var collection = collection.slice(0);
7083	var list = gantt.serverList(list_name);
7084	if (!list) return false;
7085	list.splice(0, list.length);
7086	list.push.apply(list, collection || []);
7087	gantt.resetLightbox();
7088};
7089gantt.getLightboxType = function(){
7090	return this._get_safe_type(this._lightbox_type);
7091};
7092gantt.getLightbox = function(type){
7093	if(type === undefined)
7094		type = this.getLightboxType();
7095
7096    if (!this._lightbox || this.getLightboxType() != this._get_safe_type(type)){
7097		this._lightbox_type = this._get_safe_type(type);
7098        var d=document.createElement("DIV");
7099        d.className="dhx_cal_light";
7100
7101        var full_width = this._is_lightbox_timepicker();
7102        if (gantt.config.wide_form || full_width)
7103            d.className+=" dhx_cal_light_wide";
7104
7105        if (full_width) {
7106            gantt.config.wide_form = true;
7107            d.className+=" dhx_cal_light_full";
7108        }
7109
7110
7111        d.style.visibility="hidden";
7112        var html = this._lightbox_template;
7113
7114        var buttons = this.config.buttons_left;
7115        for (var i in buttons)
7116            html+="<div class='dhx_btn_set dhx_left_btn_set "+buttons[i]+"_set'><div dhx_button='1' class='"+buttons[i]+"'></div><div>"+this.locale.labels[buttons[i]]+"</div></div>";
7117
7118        buttons = this.config.buttons_right;
7119        for (var i in buttons)
7120            html+="<div class='dhx_btn_set dhx_right_btn_set "+buttons[i]+"_set' style='float:right;'><div dhx_button='1' class='"+buttons[i]+"'></div><div>"+this.locale.labels[buttons[i]]+"</div></div>";
7121
7122        html+="</div>";
7123        d.innerHTML=html;
7124
7125        if (gantt.config.drag_lightbox){
7126            d.firstChild.onmousedown = gantt._ready_to_dnd;
7127            d.firstChild.onselectstart = function(){ return false; };
7128            d.firstChild.style.cursor = "pointer";
7129            gantt._init_dnd_events();
7130
7131        }
7132
7133        document.body.insertBefore(d,document.body.firstChild);
7134        this._lightbox=d;
7135
7136        var sns = this._get_typed_lightbox_config(type);
7137        html = this._render_sections(sns);
7138
7139        var ds=d.getElementsByTagName("div");
7140        for (var i=0; i<ds.length; i++) {
7141            var t_ds = ds[i];
7142            if (t_ds.className == "dhx_cal_larea") {
7143                t_ds.innerHTML = html;
7144                break;
7145            }
7146        }
7147
7148        //sizes
7149        this.resizeLightbox();
7150
7151        this._init_lightbox_events(this);
7152        d.style.display="none";
7153        d.style.visibility="visible";
7154    }
7155    return this._lightbox;
7156};
7157
7158gantt._render_sections = function(sns) {
7159    var html="";
7160    for (var i=0; i < sns.length; i++) {
7161        var block=this.form_blocks[sns[i].type];
7162        if (!block) continue; //ignore incorrect blocks
7163        sns[i].id="area_"+dhtmlx.uid();
7164
7165		var display = sns[i].hidden ? " style='display:none'" : "";
7166        var button = "";
7167        if (sns[i].button){
7168            button = "<div class='dhx_custom_button' index='"+i+"'><div class='dhx_custom_button_"+sns[i].button+"'></div><div>"+this.locale.labels["button_"+sns[i].button]+"</div></div>";
7169        }
7170        if (this.config.wide_form){
7171            html+="<div class='dhx_wrap_section' " + display+">";
7172        }
7173        html+="<div id='"+sns[i].id+"' class='dhx_cal_lsection'>"+button+this.locale.labels["section_"+sns[i].name]+"</div>"+block.render.call(this,sns[i]);
7174        html+="</div>";
7175    }
7176    return html;
7177};
7178
7179
7180gantt.resizeLightbox=function(){
7181    var d = this._lightbox;
7182    if (!d) return;
7183
7184    var con = d.childNodes[1];
7185    con.style.height="0px";
7186    con.style.height=con.scrollHeight+"px";
7187    d.style.height=con.scrollHeight+this.config.lightbox_additional_height+"px";
7188    con.style.height=con.scrollHeight+"px"; //it is incredible , how ugly IE can be
7189
7190
7191};
7192
7193gantt._center_lightbox = function(box) {
7194    if (box){
7195        box.style.display="block";
7196
7197        var scroll_top = window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;
7198        var scroll_left = window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft;
7199
7200        var view_height = window.innerHeight||document.documentElement.clientHeight;
7201
7202        if(scroll_top) // if vertical scroll on window
7203            box.style.top=Math.round(scroll_top+Math.max((view_height-box.offsetHeight)/2, 0))+"px";
7204        else // vertical scroll on body
7205            box.style.top=Math.round(Math.max(((view_height-box.offsetHeight)/2), 0) + 9)+"px"; // +9 for compatibility with auto tests
7206
7207        // not quite accurate but used for compatibility reasons
7208        if(document.documentElement.scrollWidth > document.body.offsetWidth) // if horizontal scroll on the window
7209            box.style.left=Math.round(scroll_left+(document.body.offsetWidth-box.offsetWidth)/2)+"px";
7210        else // horizontal scroll on the body
7211            box.style.left=Math.round((document.body.offsetWidth-box.offsetWidth)/2)+"px";
7212    }
7213};
7214gantt.showCover = function(){
7215	if(this._cover) return;
7216
7217    this._cover=document.createElement("DIV");
7218    this._cover.className="dhx_cal_cover";
7219    var _document_height = ((document.height !== undefined) ? document.height : document.body.offsetHeight);
7220    var _scroll_height = ((document.documentElement) ? document.documentElement.scrollHeight : 0);
7221    this._cover.style.height = Math.max(_document_height, _scroll_height) + 'px';
7222    document.body.appendChild(this._cover);
7223};
7224
7225
7226gantt._init_lightbox_events = function(){
7227    gantt.lightbox_events = {};
7228
7229
7230    gantt.lightbox_events["dhx_save_btn"] = function(e) {
7231        gantt._save_lightbox();
7232    };
7233
7234
7235    gantt.lightbox_events["dhx_delete_btn"] = function(e) {
7236		if(!gantt.callEvent("onLightboxDelete", [gantt._lightbox_id]))
7237			return;
7238
7239        gantt.$click.buttons["delete"](gantt._lightbox_id);
7240    };
7241
7242
7243    gantt.lightbox_events["dhx_cancel_btn"] = function(e) {
7244        gantt._cancel_lightbox();
7245    };
7246
7247
7248    gantt.lightbox_events["default"] = function(e, src) {
7249        if (src.getAttribute("dhx_button")) {
7250            gantt.callEvent("onLightboxButton", [src.className, src, e]);
7251        } else {
7252            var index, block, sec;
7253            if (src.className.indexOf("dhx_custom_button") != -1) {
7254                if (src.className.indexOf("dhx_custom_button_") != -1) {
7255                    index = src.parentNode.getAttribute("index");
7256                    sec = src.parentNode.parentNode;
7257                } else {
7258                    index = src.getAttribute("index");
7259                    sec = src.parentNode;
7260                    src = src.firstChild;
7261                }
7262            }
7263
7264			var sections = gantt._get_typed_lightbox_config();
7265
7266            if (index) {
7267                block = gantt.form_blocks[sections[index].type];
7268                block.button_click(index, src, sec, sec.nextSibling);
7269            }
7270        }
7271    };
7272    dhtmlxEvent(gantt.getLightbox(), "click", function(e) {
7273        e = e || window.event;
7274        var src = e.target ? e.target : e.srcElement;
7275
7276        if (!src.className)
7277            src = src.previousSibling;
7278        if (src && src.className && src.className.indexOf("dhx_btn_set") === 0)
7279            src = src.firstChild;
7280        if (src && src.className) {
7281            var func = dhtmlx.defined(gantt.lightbox_events[src.className]) ? gantt.lightbox_events[src.className] : gantt.lightbox_events["default"];
7282            return func(e, src);
7283        }
7284        return false;
7285    });
7286
7287    gantt.getLightbox().onkeydown=function(e){
7288        switch((e||event).keyCode){
7289            case gantt.keys.edit_save:
7290                if ((e||event).shiftKey) return;
7291                gantt._save_lightbox();
7292                break;
7293            case gantt.keys.edit_cancel:
7294                gantt._cancel_lightbox();
7295                break;
7296            default:
7297                break;
7298        }
7299    };
7300};
7301
7302
7303gantt._cancel_lightbox=function(){
7304    this.callEvent("onLightboxCancel",[this._lightbox_id, this.$new]);
7305    this.hideLightbox();
7306};
7307
7308gantt._save_lightbox=function(){
7309    var task = this.getLightboxValues();
7310	if(!this.callEvent("onLightboxSave", [this._lightbox_id, task, !!task.$new]))
7311		return;
7312
7313    if (task.$new){
7314        this.addTask(task);
7315	}else{
7316		dhtmlx.mixin(this.getTask(task.id), task, true);
7317        this.updateTask(task.id);
7318	}
7319	this.refreshData();
7320
7321    // TODO: do we need any blockable events here to prevent closing lightbox?
7322    this.hideLightbox();
7323};
7324
7325gantt.getLightboxValues=function(){
7326    var task = dhtmlx.mixin({}, this.getTask(this._lightbox_id));
7327
7328    var sns = this._get_typed_lightbox_config();
7329    for (var i=0; i < sns.length; i++) {
7330        var node = document.getElementById(sns[i].id);
7331        node=(node?node.nextSibling:node);
7332        var block=this.form_blocks[sns[i].type];
7333        var res=block.get_value.call(this,node,task, sns[i]);
7334        if (sns[i].map_to!="auto")
7335            task[sns[i].map_to]=res;
7336    }
7337    return task;
7338};
7339
7340
7341gantt.hideLightbox=function(id){
7342    var box = this.getLightbox();
7343    if (box) box.style.display="none";
7344    this._lightbox_id=null;
7345
7346    this.hideCover();
7347    this.callEvent("onAfterLightbox",[]);
7348};
7349gantt.hideCover=function(){
7350    if (this._cover)
7351        this._cover.parentNode.removeChild(this._cover);
7352    this._cover=null;
7353};
7354
7355gantt.resetLightbox = function(){
7356    if (gantt._lightbox && !gantt._custom_lightbox)
7357        gantt._lightbox.parentNode.removeChild(gantt._lightbox);
7358    gantt._lightbox = null;
7359};
7360gantt._set_lightbox_values = function(data, box){
7361	var task = data;
7362	var s = box.getElementsByTagName("span");
7363	if (gantt.templates.lightbox_header) {
7364		s[1].innerHTML = "";
7365		s[2].innerHTML = gantt.templates.lightbox_header(task.start_date, task.end_date, task);
7366	} else {
7367		s[1].innerHTML = this.templates.task_time(task.start_date, task.end_date, task);
7368		s[2].innerHTML = (this.templates.task_text(task.start_date, task.end_date, task) || "").substr(0, 70); //IE6 fix
7369	}
7370
7371
7372	var sns = this._get_typed_lightbox_config(this.getLightboxType());
7373	for (var i = 0; i < sns.length; i++) {
7374		var section = sns[i];
7375
7376		if(!this.form_blocks[section.type]){
7377			continue;//skip incorrect sections, same check is done during rendering
7378		}
7379
7380
7381		var node = document.getElementById(section.id).nextSibling;
7382		var block = this.form_blocks[section.type];
7383		var value = dhtmlx.defined(task[section.map_to]) ? task[section.map_to] : section.default_value;
7384		block.set_value.call(this, node, value, task, section);
7385		if (section.focus)
7386			block.focus.call(this, node);
7387	}
7388	if(data.id)
7389		gantt._lightbox_id = data.id;
7390};
7391gantt._fill_lightbox = function(id, box) {
7392    var task = this.getTask(id);
7393    this._set_lightbox_values(task, box);
7394};
7395
7396
7397gantt.getLightboxSection = function(name){
7398    var config = this._get_typed_lightbox_config();
7399    var i =0;
7400    for (i; i < config.length; i++)
7401        if (config[i].name == name)
7402            break;
7403    var section = config[i];
7404    if (!this._lightbox)
7405        this.getLightbox();
7406    var header = document.getElementById(section.id);
7407    var node = header.nextSibling;
7408
7409    var result = {
7410        section: section,
7411        header: header,
7412        node: node,
7413        getValue:function(ev){
7414            return this.form_blocks[section.type].get_value(node, (ev||{}), section);
7415        },
7416        setValue:function(value, ev){
7417            return this.form_blocks[section.type].set_value(node, value, (ev||{}), section);
7418        }
7419    };
7420
7421    var handler = this._lightbox_methods["get_"+section.type+"_control"];
7422    return handler?handler(result):result;
7423};
7424
7425gantt._lightbox_methods.get_template_control = function(result) {
7426    result.control = result.node;
7427    return result;
7428};
7429gantt._lightbox_methods.get_select_control = function(result) {
7430    result.control = result.node.getElementsByTagName('select')[0];
7431    return result;
7432};
7433gantt._lightbox_methods.get_textarea_control = function(result) {
7434    result.control = result.node.getElementsByTagName('textarea')[0];
7435    return result;
7436};
7437gantt._lightbox_methods.get_time_control = function(result) {
7438    result.control = result.node.getElementsByTagName('select'); // array
7439    return result;
7440};
7441
7442
7443
7444
7445
7446gantt._init_dnd_events = function(){
7447    dhtmlxEvent(document.body, "mousemove", gantt._move_while_dnd);
7448    dhtmlxEvent(document.body, "mouseup", gantt._finish_dnd);
7449    gantt._init_dnd_events = function(){};
7450};
7451gantt._move_while_dnd = function(e){
7452    if (gantt._dnd_start_lb){
7453        if (!document.dhx_unselectable){
7454            document.body.className += " dhx_unselectable";
7455            document.dhx_unselectable = true;
7456        }
7457        var lb = gantt.getLightbox();
7458        var now = (e&&e.target)?[e.pageX, e.pageY]:[event.clientX, event.clientY];
7459        lb.style.top = gantt._lb_start[1]+now[1]-gantt._dnd_start_lb[1]+"px";
7460        lb.style.left = gantt._lb_start[0]+now[0]-gantt._dnd_start_lb[0]+"px";
7461    }
7462};
7463gantt._ready_to_dnd = function(e){
7464    var lb = gantt.getLightbox();
7465    gantt._lb_start = [parseInt(lb.style.left,10), parseInt(lb.style.top,10)];
7466    gantt._dnd_start_lb = (e&&e.target)?[e.pageX, e.pageY]:[event.clientX, event.clientY];
7467};
7468gantt._finish_dnd = function(){
7469    if (gantt._lb_start){
7470        gantt._lb_start = gantt._dnd_start_lb = false;
7471        document.body.className = document.body.className.replace(" dhx_unselectable","");
7472        document.dhx_unselectable = false;
7473    }
7474};
7475
7476
7477
7478
7479gantt._focus = function(node, select){
7480    if (node && node.focus){
7481        if (gantt.config.touch){
7482            //do not focus editor, to prevent auto-zoom
7483        } else {
7484            if (select && node.select) node.select();
7485            node.focus();
7486        }
7487    }
7488};
7489
7490
7491gantt.form_blocks={
7492    getTimePicker: function(sns, hidden) {
7493		var time_format = sns.time_format;
7494        if (!time_format) {
7495            // default order
7496            var time_format = ["%d", "%m", "%Y"];
7497			if(gantt._get_line(gantt._tasks.unit) < gantt._get_line("day")){
7498				time_format.push("%H:%i");
7499			}
7500        }
7501        // map: default order => real one
7502        sns._time_format_order = { size:0 };
7503
7504
7505        var cfg = this.config;
7506        var dt = this.date.date_part(new Date(gantt._min_date.valueOf()));
7507        var last = 24*60, first = 0;
7508        if(gantt.config.limit_time_select){
7509            last = 60*cfg.last_hour+1;
7510            first = 60*cfg.first_hour;
7511            dt.setHours(cfg.first_hour);
7512        }
7513        var html = "";
7514
7515        for (var p = 0; p < time_format.length; p++) {
7516            var time_option = time_format[p];
7517
7518            // adding spaces between selects
7519            if (p > 0) {
7520                html += " ";
7521            }
7522
7523			var options = '';
7524            switch (time_option) {
7525                case "%Y":
7526                    sns._time_format_order[2] = p;
7527                    sns._time_format_order.size++;
7528                    //year
7529                    var year = dt.getFullYear()-5; //maybe take from config?
7530                    for (var i=0; i < 10; i++)
7531						options+="<option value='"+(year+i)+"'>"+(year+i)+"</option>";
7532                    break;
7533                case "%m":
7534                    sns._time_format_order[1] = p;
7535                    sns._time_format_order.size++;
7536                    //month
7537                    for (var i=0; i < 12; i++)
7538						options+="<option value='"+i+"'>"+this.locale.date.month_full[i]+"</option>";
7539                    break;
7540                case "%d":
7541                    sns._time_format_order[0] = p;
7542                    sns._time_format_order.size++;
7543                    //days
7544                    for (var i=1; i < 32; i++)
7545						options+="<option value='"+i+"'>"+i+"</option>";
7546                    break;
7547                case "%H:%i":
7548                    var last = 24*60, first = 0;
7549                    sns._time_format_order[3] = p;
7550                    sns._time_format_order.size++;
7551                    //hours
7552                    var i = first;
7553                    var tdate = dt.getDate();
7554                    sns._time_values = [];
7555
7556                    while(i<last){
7557                        var time=this.templates.time_picker(dt);
7558						options+="<option value='"+i+"'>"+time+"</option>";
7559                        sns._time_values.push(i);
7560                        dt.setTime(dt.valueOf()+this._get_timepicker_step()*60*1000);
7561                        var diff = (dt.getDate()!=tdate)?1:0; // moved or not to the next day
7562                        i=diff*24*60+dt.getHours()*60+dt.getMinutes();
7563                    }
7564                    break;
7565                default:
7566                    break;
7567            }
7568
7569			if(options){
7570				var readonly = sns.readonly ? "disabled='disabled'" : "";
7571				var display = hidden ? " style='display:none'" : "";
7572				html += "<select "+readonly+display +">"+options+"</select>";
7573			}
7574        }
7575        return html;
7576    },
7577    _fill_lightbox_select: function (s,i,d,map,cfg) {
7578        s[i+map[0]].value=d.getDate();
7579        s[i+map[1]].value=d.getMonth();
7580        s[i+map[2]].value=d.getFullYear();
7581        if (dhtmlx.defined(map[3])) {
7582            var v = d.getHours()*60+ d.getMinutes();
7583            v = Math.round(v/gantt._get_timepicker_step())*gantt._get_timepicker_step();
7584            s[i+map[3]].value= v;
7585        }
7586    },
7587    template:{
7588        render: function(sns){
7589            var height=(sns.height||"30")+"px";
7590            return "<div class='dhx_cal_ltext dhx_cal_template' style='height:"+height+";'></div>";
7591        },
7592        set_value:function(node,value,ev,config){
7593            node.innerHTML = value||"";
7594        },
7595        get_value:function(node,ev,config){
7596            return node.innerHTML||"";
7597        },
7598        focus: function(node){
7599        }
7600    },
7601    textarea:{
7602        render:function(sns){
7603            var height=(sns.height||"130")+"px";
7604            return "<div class='dhx_cal_ltext' style='height:"+height+";'><textarea></textarea></div>";
7605        },
7606        set_value:function(node,value,ev){
7607            node.firstChild.value=value||"";
7608        },
7609        get_value:function(node,ev){
7610            return node.firstChild.value;
7611        },
7612        focus:function(node){
7613            var a=node.firstChild; gantt._focus(a, true);
7614        }
7615    },
7616    select:{
7617        render:function(sns){
7618            var height=(sns.height||"23")+"px";
7619            var html="<div class='dhx_cal_ltext' style='height:"+height+";'><select style='width:100%;'>";
7620            for (var i=0; i < sns.options.length; i++)
7621                html+="<option value='"+sns.options[i].key+"'>"+sns.options[i].label+"</option>";
7622            html+="</select></div>";
7623            return html;
7624        },
7625        set_value:function(node,value,ev,sns){
7626            var select = node.firstChild;
7627            if (!select._dhx_onchange && sns.onchange) {
7628                select.onchange = sns.onchange;
7629                select._dhx_onchange = true;
7630            }
7631            if (typeof value == "undefined")
7632                value = (select.options[0]||{}).value;
7633            select.value=value||"";
7634        },
7635        get_value:function(node,ev){
7636            return node.firstChild.value;
7637        },
7638        focus:function(node){
7639            var a=node.firstChild; gantt._focus(a, true);
7640        }
7641    },
7642    time:{
7643        render:function(sns) {
7644            var time = this.form_blocks.getTimePicker.call(this, sns);
7645			var parts = ["<div style='height:30px;padding-top:0px;font-size:inherit;text-align:center;' class='dhx_section_time'>"];
7646			parts.push(time);
7647
7648			if(sns.single_date){
7649				time = this.form_blocks.getTimePicker.call(this, sns, true);
7650				parts.push("<span></span>");
7651			}else{
7652				parts.push("<span style='font-weight:normal; font-size:10pt;'> &nbsp;&ndash;&nbsp; </span>");
7653			}
7654
7655			parts.push(time);
7656			parts.push("</div>");
7657            return parts.join('');
7658        },
7659        set_value:function(node,value,ev,config){
7660            var cfg = this.config;
7661            var s=node.getElementsByTagName("select");
7662
7663            var map = config._time_format_order;
7664            var map_size = config._time_format_size;
7665
7666            if(cfg.auto_end_date) {
7667                var _update_lightbox_select = function() {
7668                    var start_date = new Date(s[map[2]].value,s[map[1]].value,s[map[0]].value,0,0);
7669                    var end_date =  gantt.calculateEndDate(start_date, 1);
7670                    this.form_blocks._fill_lightbox_select(s,map.size, end_date,map,cfg);
7671                };
7672                for(var i=0; i<4; i++) {
7673                    s[i].onchange = _update_lightbox_select;
7674                }
7675            }
7676
7677            this.form_blocks._fill_lightbox_select(s,0,ev.start_date,map,cfg);
7678            this.form_blocks._fill_lightbox_select(s,map.size,ev.end_date,map,cfg);
7679        },
7680
7681        get_value:function(node, ev, config) {
7682            var s=node.getElementsByTagName("select");
7683            var map = config._time_format_order;
7684
7685            var hours = 0, minutes = 0;
7686            if (dhtmlx.defined(map[3])) {
7687                var time = parseInt(s[map[3]].value, 10);
7688                hours = Math.floor(time/60);
7689                minutes = time%60;
7690            }
7691            ev.start_date=new Date(s[map[2]].value,s[map[1]].value,s[map[0]].value,hours,minutes);
7692
7693            hours = minutes = 0;
7694            if (dhtmlx.defined(map[3])) {
7695                var time = parseInt(s[map.size+map[3]].value, 10);
7696                hours = Math.floor(time/60);
7697                minutes = time%60;
7698            }
7699            ev.end_date=new Date(s[map[2]+map.size].value,s[map[1]+map.size].value,s[map[0]+map.size].value,hours,minutes);
7700
7701            if (ev.end_date<=ev.start_date)
7702                ev.end_date=gantt.date.add(ev.start_date, gantt._get_timepicker_step(),"minute");
7703            return {
7704                start_date: new Date(ev.start_date),
7705                end_date: new Date(ev.end_date)
7706            };
7707        },
7708        focus:function(node){
7709            gantt._focus(node.getElementsByTagName("select")[0]);
7710        }
7711    },
7712    duration:{
7713        render:function(sns) {
7714            var time = this.form_blocks.getTimePicker.call(this, sns);
7715            time = "<div class='dhx_time_selects'>"+time+"</div>";
7716            var label = this.locale.labels[this.config.duration_unit + "s"];
7717
7718			var singleDate = sns.single_date ? ' style="display:none"' : "";
7719			var readonly = sns.readonly ? " disabled='disabled'" : "";
7720
7721            var duration = "<div class='dhx_gantt_duration' "+singleDate+">" +
7722				"<input type='button' class='dhx_gantt_duration_dec' value='-'"+readonly+">" +
7723				"<input type='text' value='5' class='dhx_gantt_duration_value'"+readonly+">" +
7724				"<input type='button' class='dhx_gantt_duration_inc' value='+'"+readonly+"> " + label + " <span></span>" +
7725				"</div>";
7726            var html = "<div style='height:30px;padding-top:0px;font-size:inherit;
7726' class='dhx_section_time'>"+time+" "+duration+"</div>";
7727            return html;
7728        },
7729        set_value:function(node,value,ev,config){
7730            var cfg = this.config;
7731            var s=node.getElementsByTagName("select");
7732	        var inps = node.getElementsByTagName("input");
7733
7734            var duration = inps[1];
7735            var btns=[inps[0],inps[2]];
7736            var endspan = node.getElementsByTagName("span")[0];
7737
7738            var map = config._time_format_order;
7739
7740            function _calc_date() {
7741                var start_date = gantt.form_blocks.duration._get_start_date.call(gantt, node ,config);
7742                var duration = gantt.form_blocks.duration._get_duration.call(gantt, node ,config);
7743                var end_date = gantt.calculateEndDate(start_date, duration);
7744
7745                endspan.innerHTML = gantt.templates.task_date(end_date);
7746            }
7747
7748            function _change_duration(step) {
7749                var value = duration.value;
7750                value = parseInt(value, 10);
7751                if (window.isNaN(value))
7752                    value = 0;
7753                value+=step;
7754                if (value < 1) value = 1;
7755                duration.value = value;
7756                _calc_date();
7757            }
7758
7759            btns[0].onclick = dhtmlx.bind(function() { _change_duration(-1*this.config.duration_step); }, this);
7760            btns[1].onclick = dhtmlx.bind(function() { _change_duration(1*this.config.duration_step); }, this);
7761            s[0].onchange = _calc_date;
7762            s[1].onchange = _calc_date;
7763            s[2].onchange = _calc_date;
7764            if (s[3]) s[3].onchange = _calc_date;
7765            duration.onkeydown = dhtmlx.bind(function(e) {
7766                e = e || window.event;
7767                // up
7768                var code = (e.charCode || e.keyCode || e.which);
7769
7770                if (code == 40) {
7771                    _change_duration(-1*this.config.duration_step);
7772                    return false;
7773                }
7774                // down
7775                if (code == 38) {
7776                    _change_duration(1*this.config.duration_step);
7777                    return false;
7778                }
7779                window.setTimeout(function(e) {
7780                    _calc_date();
7781                }, 1);
7782            }, this);
7783
7784            duration.onchange = dhtmlx.bind(function(e) { _calc_date(); }, this);
7785
7786            this.form_blocks._fill_lightbox_select(s,0,ev.start_date,map,cfg);
7787            
7788            var final_value;
7789
7790            if (!ev.end_date)
7791                final_value = ev.duration;
7792            else
7793                final_value = gantt.calculateDuration(ev.start_date, ev.end_date);
7794            final_value = Math.round(final_value);
7795            duration.value = final_value;
7796            _calc_date();
7797        },
7798
7799        _get_start_date: function(node, config) {
7800            var s=node.getElementsByTagName("select");
7801            var map = config._time_format_order;
7802            var hours = 0;
7803            var minutes = 0;
7804            if (dhtmlx.defined(map[3])) {
7805                var time = parseInt(s[map[3]].value, 10);
7806                hours = Math.floor(time/60);
7807                minutes = time%60;
7808            }
7809            return new Date(s[map[2]].value,s[map[1]].value,s[map[0]].value,hours,minutes);
7810        },
7811        _get_duration: function(node, config) {
7812            var duration = node.getElementsByTagName("input")[1];
7813            duration = parseInt(duration.value, 10);
7814            if (window.isNaN(duration)) duration = 1;
7815            if (duration < 0) duration *= -1;
7816            return duration;
7817        },
7818
7819        get_value:function(node, ev, config) {
7820            ev.start_date = this.form_blocks.duration._get_start_date(node, config);
7821            var duration = this.form_blocks.duration._get_duration(node, config);
7822
7823            ev.end_date = this.calculateEndDate(ev.start_date, duration);
7824            ev.duration = duration;
7825
7826            return {
7827                start_date: new Date(ev.start_date),
7828                end_date: new Date(ev.end_date)
7829            };
7830        },
7831        focus:function(node){
7832            gantt._focus(node.getElementsByTagName("select")[0]);
7833        }
7834    },
7835	typeselect : {
7836		render : function(sns){
7837			var types = gantt.config.types,
7838				locale = gantt.locale.labels,
7839				options = [];
7840			for(var i in types){
7841				options.push({key: types[i], label:locale["type_" + i]});
7842			}
7843			sns.options = options;
7844
7845			var oldOnChange = sns.onchange;
7846			sns.onchange = function(){
7847				var tId = gantt.getState().lightbox;
7848
7849				gantt.changeLightboxType(this.value);
7850				if(typeof oldOnChange == 'function'){
7851					oldOnChange.apply(this, arguments);
7852				}
7853			};
7854
7855			return gantt.form_blocks.select.render.apply(this, arguments);
7856		},
7857		set_value:function(){
7858			return gantt.form_blocks.select.set_value.apply(this, arguments);
7859		},
7860		get_value:function(){
7861			return gantt.form_blocks.select.get_value.apply(this, arguments);
7862		},
7863		focus:function(){
7864			return gantt.form_blocks.select.focus.apply(this, arguments);
7865		}
7866	},
7867	parent: {
7868		_filter : function(options, config, item_id){
7869			var filter = config.filter || function(){ return true;};
7870
7871			options = options.slice(0);
7872
7873			for(var i=0; i < options.length; i++){
7874				var task = options[i];
7875				if(task.id == item_id || gantt.isChildOf(task.id, item_id) || filter(task.id, task) === false){
7876					options.splice(i, 1);
7877					i--;
7878				}
7879			}
7880			return options;
7881		},
7882
7883		_display : function(config, item_id){
7884			var tasks = [],
7885				options = [];
7886			if(item_id){
7887				tasks = gantt.getTaskByTime();
7888				if(config.allow_root){
7889					tasks.unshift({id:gantt.config.root_id, text:config.root_label || ""});
7890				}
7891				tasks = this._filter(tasks, config, item_id);
7892				if(config.sort){
7893					tasks.sort(config.sort);
7894				}
7895			}
7896			var text = config.template || gantt.templates.task_text;
7897			for(var i = 0; i < tasks.length; i++){
7898				var label = text.apply(gantt, [tasks[i].start_date, tasks[i].end_date, tasks[i]]);
7899				if(label === undefined){
7900					label = "";
7901				}
7902				options.push({
7903					key: tasks[i].id,
7904					label: label
7905				});
7906			}
7907			config.options = options;
7908			config.map_to = config.map_to || "parent";
7909			return gantt.form_blocks.select.render.apply(this, arguments);
7910		},
7911		render : function(sns){
7912			return gantt.form_blocks.parent._display(sns, false);
7913		},
7914		set_value:function(node,value,ev,config){
7915			var tmpDom = document.createElement("div");
7916			tmpDom.innerHTML = gantt.form_blocks.parent._display(config, ev.id);
7917			var newOptions = tmpDom.removeChild(tmpDom.firstChild);
7918			node.onselect = null;
7919			node.parentNode.replaceChild(newOptions, node);
7920
7921			return gantt.form_blocks.select.set_value.apply(this, [newOptions,value,ev,config]);
7922		},
7923		get_value:function(){
7924			return gantt.form_blocks.select.get_value.apply(this, arguments);
7925		},
7926		focus:function(){
7927			return gantt.form_blocks.select.focus.apply(this, arguments);
7928		}
7929	}
7930};
7931
7932gantt._is_lightbox_timepicker = function() {
7933    var s = this._get_typed_lightbox_config();
7934    for (var i = 0; i < s.length; i++)
7935        if (s[i].name == "time" && s[i].type == "time")
7936            return true;
7937    return false;
7938};
7939
7940gantt._dhtmlx_confirm = function(message, title, callback, ok) {
7941    if (!message)
7942        return callback();
7943    var opts = { text: message };
7944    if (title)
7945        opts.title = title;
7946	if(ok){
7947		opts.ok = ok;
7948	}
7949    if (callback) {
7950        opts.callback = function(result) {
7951            if (result)
7952                callback();
7953        };
7954    }
7955    dhtmlx.confirm(opts);
7956};
7957
7958gantt._get_typed_lightbox_config = function(type){
7959	if(type === undefined){
7960		type = this.getLightboxType();
7961	}
7962
7963	var field = this._get_type_name(type);
7964
7965	if(gantt.config.lightbox[field+"_sections"]){
7966		return gantt.config.lightbox[field+"_sections"];
7967	}else{
7968		return gantt.config.lightbox.sections;
7969	}
7970};
7971
7972gantt._silent_redraw_lightbox = function(type){
7973	var oldType = this.getLightboxType();
7974
7975	if(this.getState().lightbox){
7976		var taskId = this.getState().lightbox;
7977		var formData = this.getLightboxValues(),
7978			task = dhtmlx.copy(this.getTask(taskId));
7979
7980		this.resetLightbox();
7981
7982		var updTask = dhtmlx.mixin(task, formData, true);
7983		var box = this.getLightbox(type ? type : undefined);
7984
7985		this._set_lightbox_values(updTask, box);
7986		this._center_lightbox(this.getLightbox());
7987		this.callEvent("onLightboxChange", [oldType, this.getLightboxType()]);
7988	}else{
7989		this.resetLightbox();
7990		this.getLightbox(type ? type : undefined);
7991	}
7992	this.callEvent("onLightboxChange", [oldType, this.getLightboxType()]);
7993};
7994/**
7995	* 	@desc: constructor, data processor object 
7996	*	@param: serverProcessorURL - url used for update
7997	*	@type: public
7998	*/
7999function dataProcessor(serverProcessorURL){
8000    this.serverProcessor = serverProcessorURL;
8001    this.action_param="!nativeeditor_status";
8002    
8003	this.object = null;
8004	this.updatedRows = []; //ids of updated rows
8005	
8006	this.autoUpdate = true;
8007	this.updateMode = "cell";
8008	this._tMode="GET"; 
8009	this.post_delim = "_";
8010	
8011    this._waitMode=0;
8012    this._in_progress={};//?
8013    this._invalid={};
8014    this.mandatoryFields=[];
8015    this.messages=[];
8016    
8017    this.styles={
8018    	updated:"font-weight:bold;",
8019    	inserted:"font-weight:bold;",
8020    	deleted:"text-decoration : line-through;",
8021    	invalid:"background-color:FFE0E0;",
8022    	invalid_cell:"border-bottom:2px solid red;",
8023    	error:"color:red;",
8024    	clear:"font-weight:normal;text-decoration:none;"
8025    };
8026    
8027    this.enableUTFencoding(true);
8028    dhtmlxEventable(this);
8029
8030    return this;
8031    }
8032
8033dataProcessor.prototype={
8034	/**
8035	* 	@desc: select GET or POST transaction model
8036	*	@param: mode - GET/POST
8037	*	@param: total - true/false - send records row by row or all at once (for grid only)
8038	*	@type: public
8039	*/
8040	setTransactionMode:function(mode,total){
8041        this._tMode=mode;
8042		this._tSend=total;
8043    },
8044    escape:function(data){
8045    	if (this._utf)
8046    		return encodeURIComponent(data);
8047    	else
8048        	return escape(data);
8049	},
8050    /**
8051	* 	@desc: allows to set escaping mode
8052	*	@param: true - utf based escaping, simple - use current page encoding
8053	*	@type: public
8054	*/	
8055	enableUTFencoding:function(mode){
8056        this._utf=convertStringToBoolean(mode);
8057    },
8058    /**
8059	* 	@desc: allows to define, which column may trigger update
8060	*	@param: val - array or list of true/false values
8061	*	@type: public
8062	*/
8063	setDataColumns:function(val){
8064		this._columns=(typeof val == "string")?val.split(","):val;
8065    },
8066    /**
8067	* 	@desc: get state of updating
8068	*	@returns:   true - all in sync with server, false - some items not updated yet.
8069	*	@type: public
8070	*/
8071	getSyncState:function(){
8072		return !this.updatedRows.length;
8073	},
8074	/**
8075	* 	@desc: enable/disable named field for data syncing, will use column ids for grid
8076	*	@param:   mode - true/false
8077	*	@type: public
8078	*/
8079	enableDataNames:function(mode){
8080		this._endnm=convertStringToBoolean(mode);
8081	},
8082	/**
8083	* 	@desc: enable/disable mode , when only changed fields and row id send to the server side, instead of all fields in default mode
8084	*	@param:   mode - true/false
8085	*	@type: public
8086	*/
8087	enablePartialDataSend:function(mode){
8088		this._changed=convertStringToBoolean(mode);
8089	},
8090	/**
8091	* 	@desc: set if rows should be send to server automaticaly
8092	*	@param: mode - "row" - based on row selection changed, "cell" - based on cell editing finished, "off" - manual data sending
8093	*	@type: public
8094	*/
8095	setUpdateMode:function(mode,dnd){
8096		this.autoUpdate = (mode=="cell");
8097		this.updateMode = mode;
8098		this.dnd=dnd;
8099	},
8100	ignore:function(code,master){
8101		this._silent_mode=true;
8102		code.call(master||window);
8103		this._silent_mode=false;
8104	},
8105	/**
8106	* 	@desc: mark row as updated/normal. check mandatory fields,initiate autoupdate (if turned on)
8107	*	@param: rowId - id of row to set update-status for
8108	*	@param: state - true for "updated", false for "not updated"
8109	*	@param: mode - update mode name
8110	*	@type: public
8111	*/
8112	setUpdated:function(rowId,state,mode){
8113		if (this._silent_mode) return;
8114		var ind=this.findRow(rowId);
8115		
8116		mode=mode||"updated";
8117		var existing = this.obj.getUserData(rowId,this.action_param);
8118		if (existing && mode == "updated") mode=existing;
8119		if (state){
8120			this.set_invalid(rowId,false); //clear previous error flag
8121			this.updatedRows[ind]=rowId;
8122			this.obj.setUserData(rowId,this.action_param,mode);
8123			if (this._in_progress[rowId]) 
8124				this._in_progress[rowId]="wait";
8125		} else{
8126			if (!this.is_invalid(rowId)){
8127				this.updatedRows.splice(ind,1);
8128				this.obj.setUserData(rowId,this.action_param,"");
8129			}
8130		}
8131
8132		//clear changed flag
8133		if (!state)
8134			this._clearUpdateFlag(rowId);
8135     			
8136		this.markRow(rowId,state,mode);
8137		if (state && this.autoUpdate) this.sendData(rowId);
8138	},
8139	_clearUpdateFlag:function(id){},
8140	markRow:function(id,state,mode){ 
8141		var str="";
8142		var invalid=this.is_invalid(id);
8143		if (invalid){
8144        	str=this.styles[invalid];
8145        	state=true;
8146    	}
8147		if (this.callEvent("onRowMark",[id,state,mode,invalid])){
8148			//default logic
8149			str=this.styles[state?mode:"clear"]+str;
8150			
8151        	this.obj[this._methods[0]](id,str);
8152
8153			if (invalid && invalid.details){
8154				str+=this.styles[invalid+"_cell"];
8155				for (var i=0; i < invalid.details.length; i++)
8156					if (invalid.details[i])
8157        				this.obj[this._methods[1]](id,i,str);
8158			}
8159		}
8160	},
8161	getState:function(id){
8162		return this.obj.getUserData(id,this.action_param);
8163	},
8164	is_invalid:function(id){
8165		return this._invalid[id];
8166	},
8167	set_invalid:function(id,mode,details){ 
8168		if (details) mode={value:mode, details:details, toString:function(){ return this.value.toString(); }};
8169		this._invalid[id]=mode;
8170	},
8171	/**
8172	* 	@desc: check mandatory fields and varify values of cells, initiate update (if specified)
8173	*	@param: rowId - id of row to set update-status for
8174	*	@type: public
8175	*/
8176	checkBeforeUpdate:function(rowId){ 
8177		return true;
8178	},
8179	/**
8180	* 	@desc: send row(s) values to server
8181	*	@param: rowId - id of row which data to send. If not specified, then all "updated" rows will be send
8182	*	@type: public
8183	*/
8184	sendData:function(rowId){
8185		if (this._waitMode && (this.obj.mytype=="tree" || this.obj._h2)) return;
8186		if (this.obj.editStop) this.obj.editStop();
8187	
8188		
8189		if(typeof rowId == "undefined" || this._tSend) return this.sendAllData();
8190		if (this._in_progress[rowId]) return false;
8191		
8192		this.messages=[];
8193		if (!this.checkBeforeUpdate(rowId) && this.callEvent("onValidationError",[rowId,this.messages])) return false;
8194		this._beforeSendData(this._getRowData(rowId),rowId);
8195    },
8196    _beforeSendData:function(data,rowId){
8197    	if (!this.callEvent("onBeforeUpdate",[rowId,this.getState(rowId),data])) return false;	
8198		this._sendData(data,rowId);
8199    },
8200    serialize:function(data, id){
8201    	if (typeof data == "string")
8202    		return data;
8203    	if (typeof id != "undefined")
8204    		return this.serialize_one(data,"");
8205    	else{
8206    		var stack = [];
8207    		var keys = [];
8208    		for (var key in data)
8209    			if (data.hasOwnProperty(key)){
8210    				stack.push(this.serialize_one(data[key],key+this.post_delim));
8211    				keys.push(key);
8212				}
8213    		stack.push("ids="+this.escape(keys.join(",")));
8214    		if (dhtmlx.security_key)
8215				stack.push("dhx_security="+dhtmlx.security_key);
8216    		return stack.join("&");
8217    	}
8218    },
8219    serialize_one:function(data, pref){
8220    	if (typeof data == "string")
8221    		return data;
8222    	var stack = [];
8223    	for (var key in data)
8224    		if (data.hasOwnProperty(key))
8225    			stack.push(this.escape((pref||"")+key)+"="+this.escape(data[key]));
8226		return stack.join("&");
8227    },
8228    _sendData:function(a1,rowId){
8229    	if (!a1) return; //nothing to send
8230		if (!this.callEvent("onBeforeDataSending",rowId?[rowId,this.getState(rowId),a1]:[null, null, a1])) return false;				
8231		
8232    	if (rowId)
8233			this._in_progress[rowId]=(new Date()).valueOf();
8234		var a2=new dtmlXMLLoaderObject(this.afterUpdate,this,true);
8235		
8236		var a3 = this.serverProcessor+(this._user?(getUrlSymbol(this.serverProcessor)+["dhx_user="+this._user,"dhx_version="+this.obj.getUserData(0,"version")].join("&")):"");
8237
8238		if (this._tMode!="POST")
8239        	a2.loadXML(a3+((a3.indexOf("?")!=-1)?"&":"?")+this.serialize(a1,rowId));
8240		else
8241        	a2.loadXML(a3,true,this.serialize(a1,rowId));
8242
8243		this._waitMode++;
8244    },
8245	sendAllData:function(){
8246		if (!this.updatedRows.length) return;			
8247
8248		this.messages=[]; var valid=true;
8249		for (var i=0; i<this.updatedRows.length; i++)
8250			valid&=this.checkBeforeUpdate(this.updatedRows[i]);
8251		if (!valid && !this.callEvent("onValidationError",["",this.messages])) return false;
8252	
8253		if (this._tSend) 
8254			this._sendData(this._getAllData());
8255		else
8256			for (var i=0; i<this.updatedRows.length; i++)
8257				if (!this._in_progress[this.updatedRows[i]]){
8258					if (this.is_invalid(this.updatedRows[i])) continue;
8259					this._beforeSendData(this._getRowData(this.updatedRows[i]),this.updatedRows[i]);
8260					if (this._waitMode && (this.obj.mytype=="tree" || this.obj._h2)) return; //block send all for tree
8261				}
8262	},
8263    
8264	
8265	
8266	
8267	
8268	
8269	
8270	
8271	_getAllData:function(rowId){
8272		var out={};
8273		var has_one = false;
8274		for(var i=0;i<this.updatedRows.length;i++){
8275			var id=this.updatedRows[i];
8276			if (this._in_progress[id] || this.is_invalid(id)) continue;
8277			if (!this.callEvent("onBeforeUpdate",[id,this.getState(id)])) continue;	
8278			out[id]=this._getRowData(id,id+this.post_delim);
8279			has_one = true;
8280			this._in_progress[id]=(new Date()).valueOf();
8281		}
8282		return has_one?out:null;
8283	},
8284	
8285	
8286	/**
8287	* 	@desc: specify column which value should be varified before sending to server
8288	*	@param: ind - column index (0 based)
8289	*	@param: verifFunction - function (object) which should verify cell value (if not specified, then value will be compared to empty string). Two arguments will be passed into it: value and column name
8290	*	@type: public
8291	*/
8292	setVerificator:function(ind,verifFunction){
8293		this.mandatoryFields[ind] = verifFunction||(function(value){return (value !== "");});
8294	},
8295	/**
8296	* 	@desc: remove column from list of those which should be verified
8297	*	@param: ind - column Index (0 based)
8298	*	@type: public
8299	*/
8300	clearVerificator:function(ind){
8301		this.mandatoryFields[ind] = false;
8302	},
8303	
8304	
8305	
8306	
8307	
8308	findRow:function(pattern){
8309		var i=0;
8310    	for(i=0;i<this.updatedRows.length;i++)
8311		    if(pattern==this.updatedRows[i]) break;
8312	    return i;
8313    },
8314
8315   
8316	
8317
8318
8319    
8320
8321
8322
8323
8324
8325	/**
8326	* 	@desc: define custom actions
8327	*	@param: name - name of action, same as value of action attribute
8328	*	@param: handler - custom function, which receives a XMl response content for action
8329	*	@type: private
8330	*/
8331	defineAction:function(name,handler){
8332        if (!this._uActions) this._uActions=[];
8333            this._uActions[name]=handler;
8334	},
8335
8336
8337
8338
8339	/**
8340*     @desc: used in combination with setOnBeforeUpdateHandler to create custom client-server transport system
8341*     @param: sid - id of item before update
8342*     @param: tid - id of item after up0ate
8343*     @param: action - action name
8344*     @type: public
8345*     @topic: 0
8346*/
8347	afterUpdateCallback:function(sid, tid, action, btag) {
8348		var marker = sid;
8349		var correct=(action!="error" && action!="invalid");
8350		if (!correct) this.set_invalid(sid,action);
8351		if ((this._uActions)&&(this._uActions[action])&&(!this._uActions[action](btag))) 
8352			return (delete this._in_progress[marker]);
8353			
8354		if (this._in_progress[marker]!="wait")
8355	    	this.setUpdated(sid, false);
8356	    	
8357	    var soid = sid;
8358	
8359	    switch (action) {
8360	    case "inserted":
8361	    case "insert":
8362	        if (tid != sid) {
8363	            this.obj[this._methods[2]](sid, tid);
8364	            sid = tid;
8365	        }
8366	        break;
8367	    case "delete":
8368	    case "deleted":
8369	    	this.obj.setUserData(sid, this.action_param, "true_deleted");
8370	        this.obj[this._methods[3]](sid);
8371	        delete this._in_progress[marker];
8372	        return this.callEvent("onAfterUpdate", [sid, action, tid, btag]);
8373	    }
8374	    
8375	    if (this._in_progress[marker]!="wait"){
8376	    	if (correct) this.obj.setUserData(sid, this.action_param,'');
8377	    	delete this._in_progress[marker];
8378    	} else {
8379    		delete this._in_progress[marker];
8380    		this.setUpdated(tid,true,this.obj.getUserData(sid,this.action_param));
8381		}
8382	    
8383	    this.callEvent("onAfterUpdate", [soid, action, tid, btag]);
8384	},
8385
8386	/**
8387	* 	@desc: response from server
8388	*	@param: xml - XMLLoader object with response XML
8389	*	@type: private
8390	*/
8391	afterUpdate:function(that,b,c,d,xml){
8392		xml.getXMLTopNode("data"); //fix incorrect content type in IE
8393		if (!xml.xmlDoc.responseXML) return;
8394		var atag=xml.doXPath("//data/action");
8395		for (var i=0; i<atag.length; i++){
8396        	var btag=atag[i];
8397			var action = btag.getAttribute("type");
8398			var sid = btag.getAttribute("sid");
8399			var tid = btag.getAttribute("tid");
8400			
8401			that.afterUpdateCallback(sid,tid,action,btag);
8402		}
8403		that.finalizeUpdate();
8404	},
8405	finalizeUpdate:function(){
8406		if (this._waitMode) this._waitMode--;
8407		
8408		if ((this.obj.mytype=="tree" || this.obj._h2) && this.updatedRows.length) 
8409			this.sendData();
8410		this.callEvent("onAfterUpdateFinish",[]);
8411		if (!this.updatedRows.length)
8412			this.callEvent("onFullSync",[]);
8413	},
8414
8415
8416
8417
8418	
8419	/**
8420	* 	@desc: initializes data-processor
8421	*	@param: anObj - dhtmlxGrid object to attach this data-processor to
8422	*	@type: public
8423	*/
8424	init:function(anObj){
8425		this.obj = anObj;
8426		if (this.obj._dp_init) 
8427			this.obj._dp_init(this);
8428	},
8429	
8430	
8431	setOnAfterUpdate:function(ev){
8432		this.attachEvent("onAfterUpdate",ev);
8433	},
8434	enableDebug:function(mode){
8435	},
8436	setOnBeforeUpdateHandler:function(func){  
8437		this.attachEvent("onBeforeDataSending",func);
8438	},
8439
8440
8441
8442	/*! starts autoupdate mode
8443		@param interval
8444			time interval for sending update requests
8445	*/
8446	setAutoUpdate: function(interval, user) {
8447		interval = interval || 2000;
8448		
8449		this._user = user || (new Date()).valueOf();
8450		this._need_update = false;
8451		this._loader = null;
8452		this._update_busy = false;
8453		
8454		this.attachEvent("onAfterUpdate",function(sid,action,tid,xml_node){
8455			this.afterAutoUpdate(sid, action, tid, xml_node);
8456		});
8457		this.attachEvent("onFullSync",function(){
8458			this.fullSync();
8459		});
8460		
8461		var self = this;
8462		window.setInterval(function(){
8463			self.loadUpdate();
8464		}, interval);
8465	},
8466
8467
8468	/*! process updating request answer
8469		if status == collision version is depricated
8470		set flag for autoupdating immidiatly
8471	*/
8472	afterAutoUpdate: function(sid, action, tid, xml_node) {
8473		if (action == 'collision') {
8474			this._need_update = true;
8475			return false;
8476		} else {
8477			return true;
8478		}
8479	},
8480
8481
8482	/*! callback function for onFillSync event
8483		call update function if it's need
8484	*/
8485	fullSync: function() {
8486		if (this._need_update === true) {
8487			this._need_update = false;
8488			this.loadUpdate();
8489		}
8490		return true;
8491	},
8492
8493
8494	/*! sends query to the server and call callback function
8495	*/
8496	getUpdates: function(url,callback){
8497		if (this._update_busy) 
8498			return false;
8499		else
8500			this._update_busy = true;
8501		
8502		this._loader = this._loader || new dtmlXMLLoaderObject(true);
8503		
8504		this._loader.async=true;
8505		this._loader.waitCall=callback;
8506		this._loader.loadXML(url);
8507	},
8508
8509
8510	/*! returns xml node value
8511		@param node
8512			xml node
8513	*/
8514	_v: function(node) {
8515		if (node.firstChild) return node.firstChild.nodeValue;
8516		return "";
8517	},
8518
8519
8520	/*! returns values array of xml nodes array
8521		@param arr
8522			array of xml nodes
8523	*/
8524	_a: function(arr) {
8525		var res = [];
8526		for (var i=0; i < arr.length; i++) {
8527			res[i]=this._v(arr[i]);
8528		}
8529		return res;
8530	},
8531
8532
8533	/*! loads updates and processes them
8534	*/
8535	loadUpdate: function(){
8536		var self = this;
8537		var version = this.obj.getUserData(0,"version");
8538		var url = this.serverProcessor+getUrlSymbol(this.serverProcessor)+["dhx_user="+this._user,"dhx_version="+version].join("&");
8539		url = url.replace("editing=true&","");
8540		this.getUpdates(url, function(){
8541			var vers = self._loader.doXPath("//userdata");
8542			self.obj.setUserData(0,"version",self._v(vers[0]));
8543			
8544			var upds = self._loader.doXPath("//update");
8545			if (upds.length){
8546				self._silent_mode = true;
8547				
8548				for (var i=0; i<upds.length; i++) {
8549					var status = upds[i].getAttribute('status');
8550					var id = upds[i].getAttribute('id');
8551					var parent = upds[i].getAttribute('parent');
8552					switch (status) {
8553						case 'inserted':
8554							self.callEvent("insertCallback",[upds[i], id, parent]);
8555							break;
8556						case 'updated':
8557							self.callEvent("updateCallback",[upds[i], id, parent]);
8558							break;
8559						case 'deleted':
8560							self.callEvent("deleteCallback",[upds[i], id, parent]);
8561							break;
8562					}
8563				}
8564				
8565				self._silent_mode = false;
8566			}
8567			
8568			self._update_busy = false;
8569			self = null;
8570		});
8571	}
8572
8573};
8574
8575
8576
8577/*
8578 	asserts will be removed in final code, so you can place them anythere
8579	without caring about performance impacts
8580*/
8581dhtmlx.assert = function(check, message){
8582    //jshint -W087
8583	if (!check){
8584		dhtmlx.message({ type:"error", text:message, expire:-1 });
8585		debugger;
8586	}
8587};
8588
8589//initial initialization
8590gantt.init = function(node, from, to){
8591	if(from && to){
8592		this.config.start_date = this._min_date = new Date(from);
8593		this.config.end_date = this._max_date = new Date(to);
8594	}
8595	this._init_skin();
8596	
8597    if (!this.config.scroll_size)
8598        this.config.scroll_size = this._detectScrollSize();
8599
8600
8601    this._reinit(node);
8602
8603    this.attachEvent("onLoadEnd", this.render);
8604    dhtmlxEvent(window, "resize", this._on_resize);
8605
8606
8607	//can be called only once
8608	this.init = function(node){ 
8609        if (this.$container)
8610            this.$container.innerHTML = "";
8611        this._reinit(node); 
8612    };
8613	this.callEvent("onGanttReady", []);
8614
8615};
8616
8617gantt._reinit = function(node){
8618    this._init_html_area(node);
8619    this._set_sizes();
8620
8621    this._task_area_pulls = {};
8622    this._task_area_renderers = {};
8623
8624    this._init_touch_events();
8625    this._init_templates();
8626    this._init_grid();
8627    this._init_tasks();
8628
8629    this.render();
8630
8631    this._set_scroll_events();
8632
8633    dhtmlxEvent(this.$container, "click", this._on_click);
8634    dhtmlxEvent(this.$container, "dblclick", this._on_dblclick);
8635    dhtmlxEvent(this.$container, "mousemove", this._on_mousemove);
8636    dhtmlxEvent(this.$container, "contextmenu", this._on_contextmenu);
8637};
8638
8639//renders initial html markup
8640gantt._init_html_area = function(node){
8641	if (typeof node == "string")
8642		this._obj = document.getElementById(node);
8643	else 
8644		this._obj = node;
8645	dhtmlx.assert(this._obj, "Invalid html container: "+node);
8646    var html = "<div class='gantt_container'><div class='gantt_grid'></div><div class='gantt_task'></div>";
8647    html += "<div class='gantt_ver_scroll'><div></div></div><div class='gantt_hor_scroll'><div></div></div></div>";
8648	this._obj.innerHTML = html;
8649	//store links for further reference
8650    this.$container = this._obj.firstChild;
8651    var childs = this.$container.childNodes;
8652	this.$grid = childs[0];
8653	this.$task = childs[1];
8654    this.$scroll_ver = childs[2];
8655    this.$scroll_hor = childs[3];
8656
8657    this.$grid.innerHTML = "<div class='gantt_grid_scale'></div><div class='gantt_grid_data'></div>";
8658    this.$grid_scale = this.$grid.childNodes[0];
8659    this.$grid_data = this.$grid.childNodes[1];
8660
8661	this.$task.innerHTML = "<div class='gantt_task_scale'></div><div class='gantt_data_area'><div class='gantt_task_bg'></div><div class='gantt_links_area'></div><div class='gantt_bars_area'></div></div>";
8662	this.$task_scale = this.$task.childNodes[0];
8663
8664	this.$task_data = this.$task.childNodes[1];
8665
8666	this.$task_bg = this.$task_data.childNodes[0];
8667	this.$task_links = this.$task_data.childNodes[1];
8668	this.$task_bars = this.$task_data.childNodes[2];
8669};
8670
8671gantt.$click={
8672    buttons:{
8673        "edit":function(id){
8674            gantt.showLightbox(id);
8675        },
8676        "delete":function(id){
8677            var question = gantt.locale.labels.confirm_deleting;
8678            var title = gantt.locale.labels.confirm_deleting_title;
8679
8680            gantt._dhtmlx_confirm(question, title, function(){
8681                gantt.deleteTask(id);
8682                gantt.hideLightbox();
8683            });
8684        }
8685    }
8686};
8687
8688gantt._calculate_content_height = function(){
8689	var scale_height = this.config.scale_height,
8690		rows_height = this._order.length*this.config.row_height,
8691		hor_scroll_height = this._scroll_hor ? this.config.scroll_size + 1 : 0;
8692
8693	if(!(this._is_grid_visible() || this._is_chart_visible())){
8694		return 0;
8695	}else{
8696		return scale_height + rows_height + 2 + hor_scroll_height;
8697	}
8698};
8699gantt._calculate_content_width = function(){
8700	var grid_width = this._get_grid_width(),
8701		chart_width = this._tasks ? this._tasks.full_width : 0,
8702		ver_scroll_width = this._scroll_ver ? this.config.scroll_size + 1 : 0;
8703
8704	if(!this._is_chart_visible()){
8705		chart_width = 0;
8706	}
8707	if(!this._is_grid_visible()){
8708		grid_width = 0;
8709	}
8710	return grid_width + chart_width + 1;
8711};
8712
8713gantt._get_resize_options = function(){
8714	var res = {x:false, y:false};
8715	if(this.config.autosize == "xy"){
8716		res.x = res.y = true;
8717	}else if(this.config.autosize == "y" || this.config.autosize === true){
8718		res.y = true;
8719	}else if(this.config.autosize == "x"){
8720		res.x = true;
8721	}
8722	return res;
8723};
8724//set sizes to top level html element
8725gantt._set_sizes = function(){
8726	var resize = this._get_resize_options();
8727	if(resize.y){
8728		this._obj.style.height = this._calculate_content_height() + 'px';
8729	}
8730	if(resize.x){
8731		this._obj.style.width = this._calculate_content_width() + 'px';
8732	}
8733
8734	this._y = this._obj.clientHeight;
8735
8736    if (this._y < 20) return;
8737
8738	//same height
8739	this.$grid.style.height = this.$task.style.height = Math.max(this._y - this.$scroll_hor.offsetHeight - 2, 0) +"px";
8740
8741	var dataHeight = Math.max((this._y - (this.config.scale_height||0) - this.$scroll_hor.offsetHeight - 2), 0);
8742    this.$grid_data.style.height = this.$task_data.style.height =  dataHeight + "px";
8743
8744	//share width
8745	var gridWidth = Math.max(this._get_grid_width()-1, 0);
8746	this.$grid.style.width =  gridWidth +"px";
8747	this.$grid.style.display = gridWidth === 0 ? 'none' : '';
8748
8749	this._x = this._obj.clientWidth;
8750	if (this._x < 20) return;
8751
8752    this.$grid_data.style.width = Math.max(this._get_grid_width()-1, 0) +"px";
8753	this.$task.style.width = Math.max(this._x - this._get_grid_width() - 2, 0) +"px";
8754};
8755
8756gantt.getScrollState=function(){
8757    return { x:this.$task.scrollLeft, y:this.$task_data.scrollTop };
8758};
8759gantt.scrollTo = function(left, top){
8760    if (left*1 == left)
8761        this.$task.scrollLeft = left;
8762    if(top*1 == top){
8763        this.$task_data.scrollTop = top;
8764		this.$grid_data.scrollTop = top;
8765	}
8766};
8767
8768gantt.showDate = function(date){
8769	var date_x = this.posFromDate(date);
8770	var scroll_to = Math.max(date_x - this.config.task_scroll_offset, 0);
8771	this.scrollTo(scroll_to);
8772};
8773gantt.showTask = function(id) {
8774	var el = this.getTaskNode(id);
8775	if(!el)
8776		return;
8777
8778	var left = Math.max(el.offsetLeft - this.config.task_scroll_offset, 0);
8779	var top = el.offsetTop - (this.$task_data.offsetHeight - this.config.row_height)/2;
8780	this.scrollTo(left, top);
8781};
8782
8783
8784//called after window resize
8785gantt._on_resize = gantt.setSizes = function(){
8786    gantt._set_sizes();
8787    gantt._scroll_resize();
8788};
8789
8790//renders self
8791gantt.render = function(){
8792	this._render_grid();	//grid.js
8793	this._render_tasks_scales();	//tasks.js
8794    this._scroll_resize();
8795    this._on_resize();
8796	this._render_data();
8797    if(this.config.initial_scroll){
8798		var id = (this._order[0] || this.config.root_id);
8799		if(id)
8800			this.showTask(id);
8801	}
8802
8803	this.callEvent("onGanttRender", []);
8804};
8805
8806
8807gantt._set_scroll_events = function(){
8808    dhtmlxEvent(this.$scroll_hor, "scroll", function() {
8809        if (gantt._touch_scroll_active) return;
8810        var left = gantt.$scroll_hor.scrollLeft;
8811        gantt.scrollTo(left);
8812    });
8813    dhtmlxEvent(this.$scroll_ver, "scroll", function() {
8814        if (gantt._touch_scroll_active) return;
8815        var top = gantt.$scroll_ver.scrollTop;
8816        gantt.$grid_data.scrollTop = top;
8817        gantt.scrollTo(null, top);
8818    });
8819    dhtmlxEvent(this.$task, "scroll", function() {
8820        var left = gantt.$task.scrollLeft,
8821			barLeft = gantt.$scroll_hor.scrollLeft;
8822		if(barLeft != left)
8823        	gantt.$scroll_hor.scrollLeft = left;
8824    });
8825    dhtmlxEvent(this.$task_data, "scroll", function() {
8826        var top = gantt.$task_data.scrollTop,
8827			barTop = gantt.$scroll_ver.scrollTop;
8828		if(barTop != top)
8829        	gantt.$scroll_ver.scrollTop = top;
8830    });
8831
8832    dhtmlxEvent(gantt.$container, "mousewheel", function(e){
8833		var res = gantt._get_resize_options();
8834
8835        if (e.wheelDeltaX){
8836			if(res.x) return true;//no horisontal scroll, must not block scrolling
8837
8838            var dir  = e.wheelDeltaX/-40;
8839            var left = gantt.$task.scrollLeft+dir*30;
8840            gantt.scrollTo(left, null);
8841            gantt.$scroll_hor.scrollTop = top;
8842        } else {
8843			if(res.y) return true;//no vertical scroll, must not block scrolling
8844
8845            var dir  = e.wheelDelta/-40;
8846            if (typeof e.wheelDelta == "undefined")
8847                dir = e.detail;
8848
8849            var top = gantt.$grid_data.scrollTop+dir*30;
8850            gantt.scrollTo(null, top);
8851            gantt.$scroll_ver.scrollTop = top;
8852        }
8853
8854        if (e.preventDefault)
8855            e.preventDefault();
8856        e.cancelBubble=true;
8857        return false;
8858    });
8859};
8860
8861
8862gantt._scroll_resize = function() {
8863    if (this._x < 20 || this._y < 20) return;
8864
8865    var grid_width = this._get_grid_width();
8866
8867    var task_width = this._x - grid_width;
8868    var task_height = this._y - this.config.scale_height;
8869
8870	var scroll_size = this.config.scroll_size + 1;//1px for inner content
8871
8872    var task_data_width = this.$task_data.offsetWidth - scroll_size;
8873    var task_data_height = this.config.row_height*this._order.length;
8874
8875	var resize = this._get_resize_options();
8876	var scroll_hor = this._scroll_hor = resize.x ? false : (task_data_width > task_width);
8877    var scroll_ver = this._scroll_ver = resize.y ? false : (task_data_height > task_height);
8878
8879    this.$scroll_hor.style.display = scroll_hor ? "block" : "none";
8880    this.$scroll_hor.style.height = (scroll_hor ? scroll_size : 0) + "px";
8881    this.$scroll_hor.style.width = (this._x - (scroll_ver ? scroll_size : 2)) + "px";
8882    this.$scroll_hor.firstChild.style.width = (task_data_width + grid_width + scroll_size + 2) + "px";
8883
8884    this.$scroll_ver.style.display = scroll_ver ? "block" : "none";
8885    this.$scroll_ver.style.width = (scroll_ver ? scroll_size : 0) + "px";
8886    this.$scroll_ver.style.height = (this._y - (scroll_hor ? scroll_size : 0) - this.config.scale_height) + "px";
8887    this.$scroll_ver.style.top = this.config.scale_height + "px";
8888    this.$scroll_ver.firstChild.style.height = (this.config.scale_height + task_data_height) + "px";
8889};
8890
8891gantt.locate = function(e) {
8892    var trg = gantt._get_target_node(e);
8893
8894    //ignore empty cells
8895    if (trg.className == "gantt_task_cell") return null;
8896
8897    var attribute = arguments[1] || this.config.task_attribute;
8898
8899    while (trg){
8900        if (trg.getAttribute){	//text nodes has not getAttribute
8901            var test = trg.getAttribute(attribute);
8902            if (test) return test;
8903        }
8904        trg=trg.parentNode;
8905    }
8906    return null;
8907};
8908gantt._get_target_node = function(e){
8909	var trg;
8910	if (e.tagName)
8911		trg = e;
8912	else {
8913		e=e||window.event;
8914		trg=e.target||e.srcElement;
8915	}
8916	return trg;
8917};
8918gantt._trim = function(str){
8919	var func = String.prototype.trim || function(){ return this.replace(/^\s+|\s+$/g, ""); };
8920	return func.apply(str);
8921};
8922
8923gantt._locate_css = function(e, classname, strict){
8924	if(strict === undefined)
8925		strict = true;
8926
8927	var trg = gantt._get_target_node(e);
8928	var css = '';
8929	var test = false;
8930	while (trg){
8931		css = trg.className;
8932
8933		if(css){
8934			var ind = css.indexOf(classname);
8935			if (ind >= 0){
8936				if (!strict)
8937					return trg;
8938
8939				//check that we have exact match
8940				var left = (ind === 0) || (!gantt._trim(css.charAt(ind - 1)));
8941				var right = ((ind + classname.length >= css.length)) || (!gantt._trim(css.charAt(ind + classname.length)));
8942
8943				if (left && right)
8944					return trg;
8945			}
8946		}
8947		
8948		trg=trg.parentNode;
8949	}
8950	return null;
8951};
8952gantt._locateHTML = function(e, attribute) {
8953	var trg = gantt._get_target_node(e);
8954    attribute = attribute || this.config.task_attribute;
8955
8956    while (trg){
8957        if (trg.getAttribute){	//text nodes has not getAttribute
8958            var test = trg.getAttribute(attribute);
8959            if (test) return trg;
8960        }
8961        trg=trg.parentNode;
8962    }
8963    return null;
8964};
8965
8966gantt.getTaskRowNode = function(id) {
8967    var els = this.$grid_data.childNodes;
8968    var attribute = this.config.task_attribute;
8969    for (var i = 0; i < els.length; i++) {
8970        if (els[i].getAttribute) {
8971            var value = els[i].getAttribute(attribute);
8972            if (value == id) return els[i];
8973        }
8974    }
8975    return null;
8976};
8977
8978gantt.getState = function(){
8979	return {
8980		drag_id : this._tasks_dnd.drag.id,
8981		drag_mode : this._tasks_dnd.drag.mode,
8982		drag_from_start : this._tasks_dnd.drag.left,
8983		selected_task : this._selected_task,
8984		min_date : new Date(this._min_date),
8985		max_date : new Date(this._max_date),
8986		lightbox : this._lightbox_id
8987	};
8988
8989};
8990
8991
8992gantt._checkTimeout = function(host, updPerSecond){
8993	if(!updPerSecond)
8994		return true;
8995	var timeout = 1000/updPerSecond;
8996	if(timeout < 1) return true;
8997
8998	if(host._on_timeout)
8999		return false;
9000
9001	setTimeout(function(){
9002		delete host._on_timeout;
9003	}, timeout);
9004
9005	host._on_timeout = true;
9006	return true;
9007};
9008
9009gantt.selectTask = function(id){
9010	if(!this.config.select_task)
9011		return false;
9012	if (id){
9013
9014		if(this._selected_task == id)
9015			return this._selected_task;
9016
9017		if(!this.callEvent("onBeforeTaskSelected", [id])){
9018			return false;
9019		}
9020
9021		this.unselectTask();
9022		this._selected_task = id;
9023
9024		this.refreshTask(id);
9025		this.callEvent("onTaskSelected", [id]);
9026	}
9027	return this._selected_task;
9028};
9029gantt.unselectTask = function(){
9030	var id = this._selected_task;
9031	if(!id)
9032		return;
9033	this._selected_task = null;
9034	this.refreshTask(id);
9035	this.callEvent("onTaskUnselected", [id]);
9036};
9037gantt.getSelectedId = function() {
9038    return dhtmlx.defined(this._selected_task) ? this._selected_task : null;
9039};
9040
9041gantt.changeLightboxType = function(type){
9042	if(this.getLightboxType() == type)
9043		return true;
9044	gantt._silent_redraw_lightbox(type);
9045};
9046
9047
9048
9049gantt.date={
9050	init:function(){
9051		var s = gantt.locale.date.month_short;
9052		var t = gantt.locale.date.month_short_hash = {};
9053		for (var i = 0; i < s.length; i++)
9054			t[s[i]]=i;
9055
9056		var s = gantt.locale.date.month_full;
9057		var t = gantt.locale.date.month_full_hash = {};
9058		for (var i = 0; i < s.length; i++)
9059			t[s[i]]=i;
9060	},
9061	date_part:function(date){
9062		date.setHours(0);
9063		date.setMinutes(0);
9064		date.setSeconds(0);
9065		date.setMilliseconds(0);
9066		if (date.getHours())
9067			date.setTime(date.getTime() + 60 * 60 * 1000 * (24 - date.getHours()));
9068		return date;
9069	},
9070	time_part:function(date){
9071		return (date.valueOf()/1000 - date.getTimezoneOffset()*60)%86400;
9072	},
9073	week_start:function(date){
9074		var shift=date.getDay();
9075		if (gantt.config.start_on_monday){
9076			if (shift===0) shift=6;
9077			else shift--;
9078		}
9079		return this.date_part(this.add(date,-1*shift,"day"));
9080	},
9081	month_start:function(date){
9082		date.setDate(1);
9083		return this.date_part(date);
9084	},
9085	year_start:function(date){
9086		date.setMonth(0);
9087		return this.month_start(date);
9088	},
9089	day_start:function(date){
9090		return this.date_part(date);
9091	},
9092	hour_start:function(date){
9093		var hour = date.getHours();
9094		this.day_start(date);
9095		date.setHours(hour);
9096		return date;
9097	},
9098	minute_start:function(date){
9099		var min = date.getMinutes();
9100		this.hour_start(date);
9101		date.setMinutes(min);
9102		return date;
9103	},
9104	_add_days:function(date, inc){
9105		var ndate = new Date(date.valueOf());
9106
9107		ndate.setDate(ndate.getDate() + inc);
9108		if (!date.getHours() && ndate.getHours()) //shift to yesterday
9109			ndate.setTime(ndate.getTime() + 60 * 60 * 1000 * (24 - ndate.getHours()));
9110		return ndate;
9111	},
9112
9113	add:function(date,inc,mode){
9114		/*jsl:ignore*/
9115		var ndate=new Date(date.valueOf());
9116		switch(mode){
9117			case "day":
9118				ndate = gantt.date._add_days(ndate, inc);
9119				break;
9120			case "week":
9121				ndate = gantt.date._add_days(ndate, inc * 7);
9122				break;
9123			case "month": ndate.setMonth(ndate.getMonth()+inc); break;
9124			case "year": ndate.setYear(ndate.getFullYear()+inc); break;
9125			case "hour": ndate.setHours(ndate.getHours()+inc); break;
9126			case "minute": ndate.setMinutes(ndate.getMinutes()+inc); break;
9127			default:
9128				return gantt.date["add_"+mode](date,inc,mode);
9129		}
9130		return ndate;
9131		/*jsl:end*/
9132	},
9133	to_fixed:function(num){
9134		if (num<10)	return "0"+num;
9135		return num;
9136	},
9137	copy:function(date){
9138		return new Date(date.valueOf());
9139	},
9140	date_to_str:function(format,utc){
9141		format=format.replace(/%[a-zA-Z]/g,function(a){
9142			switch(a){
9143				case "%d": return "\"+gantt.date.to_fixed(date.getDate())+\"";
9144				case "%m": return "\"+gantt.date.to_fixed((date.getMonth()+1))+\"";
9145				case "%j": return "\"+date.getDate()+\"";
9146				case "%n": return "\"+(date.getMonth()+1)+\"";
9147				case "%y": return "\"+gantt.date.to_fixed(date.getFullYear()%100)+\""; 
9148				case "%Y": return "\"+date.getFullYear()+\"";
9149				case "%D": return "\"+gantt.locale.date.day_short[date.getDay()]+\"";
9150				case "%l": return "\"+gantt.locale.date.day_full[date.getDay()]+\"";
9151				case "%M": return "\"+gantt.locale.date.month_short[date.getMonth()]+\"";
9152				case "%F": return "\"+gantt.locale.date.month_full[date.getMonth()]+\"";
9153				case "%h": return "\"+gantt.date.to_fixed((date.getHours()+11)%12+1)+\"";
9154				case "%g": return "\"+((date.getHours()+11)%12+1)+\"";
9155				case "%G": return "\"+date.getHours()+\"";
9156				case "%H": return "\"+gantt.date.to_fixed(date.getHours())+\"";
9157				case "%i": return "\"+gantt.date.to_fixed(date.getMinutes())+\"";
9158				case "%a": return "\"+(date.getHours()>11?\"pm\":\"am\")+\"";
9159				case "%A": return "\"+(date.getHours()>11?\"PM\":\"AM\")+\"";
9160				case "%s": return "\"+gantt.date.to_fixed(date.getSeconds())+\"";
9161				case "%W": return "\"+gantt.date.to_fixed(gantt.date.getISOWeek(date))+\"";
9162				default: return a;
9163			}
9164		});
9165		if (utc) format=format.replace(/date\.get/g,"date.getUTC");
9166		return new Function("date","return \""+format+"\";");
9167	},
9168	str_to_date:function(format,utc){
9169		var splt="var temp=date.match(/[a-zA-Z]+|[0-9]+/g);";
9170		var mask=format.match(/%[a-zA-Z]/g);
9171		for (var i=0; i<mask.length; i++){
9172			switch(mask[i]){
9173				case "%j":
9174				case "%d": splt+="set[2]=temp["+i+"]||1;";
9175					break;
9176				case "%n":
9177				case "%m": splt+="set[1]=(temp["+i+"]||1)-1;";
9178					break;
9179				case "%y": splt+="set[0]=temp["+i+"]*1+(temp["+i+"]>50?1900:2000);";
9180					break;
9181				case "%g":
9182				case "%G":
9183				case "%h": 
9184				case "%H":
9185							splt+="set[3]=temp["+i+"]||0;";
9186					break;
9187				case "%i":
9188							splt+="set[4]=temp["+i+"]||0;";
9189					break;
9190				case "%Y": splt+="set[0]=temp["+i+"]||0;";
9191					break;
9192				case "%a":					
9193				case "%A": splt+="set[3]=set[3]%12+((temp["+i+"]||'').toLowerCase()=='am'?0:12);";
9194					break;					
9195				case "%s": splt+="set[5]=temp["+i+"]||0;";
9196					break;
9197				case "%M": splt+="set[1]=gantt.locale.date.month_short_hash[temp["+i+"]]||0;";
9198					break;
9199				case "%F": splt+="set[1]=gantt.locale.date.month_full_hash[temp["+i+"]]||0;";
9200					break;
9201				default:
9202					break;
9203			}
9204		}
9205		var code ="set[0],set[1],set[2],set[3],set[4],set[5]";
9206		if (utc) code =" Date.UTC("+code+")";
9207		return new Function("date","var set=[0,0,1,0,0,0]; "+splt+" return new Date("+code+");");
9208	},
9209	getISOWeek: function(ndate) {
9210		if(!ndate) return false;
9211		var nday = ndate.getDay();
9212		if (nday === 0) {
9213			nday = 7;
9214		}
9215		var first_thursday = new Date(ndate.valueOf());
9216		first_thursday.setDate(ndate.getDate() + (4 - nday));
9217		var year_number = first_thursday.getFullYear(); // year of the first Thursday
9218		var ordinal_date = Math.round( (first_thursday.getTime() - new Date(year_number, 0, 1).getTime()) / 86400000); //ordinal date of the first Thursday - 1 (so not really ordinal date)
9219		var week_number = 1 + Math.floor( ordinal_date / 7);
9220		return week_number;
9221	},
9222	getUTCISOWeek: function(ndate){
9223		return this.getISOWeek(ndate);
9224	},
9225	convert_to_utc: function(date) {
9226		return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
9227	},
9228    parseDate: function(date, format) {
9229        if (typeof(date) == "string") {
9230            if (dhtmlx.defined(format)){
9231                if (typeof(format) == "string")
9232                    format = dhtmlx.defined(gantt.templates[format]) ? gantt.templates[format] : gantt.date.str_to_date(format);
9233                else
9234                    format = gantt.templates.xml_date;
9235            }
9236            date = format(date);
9237        }
9238        return date;
9239    }
9240};
9241/*
9242 %d - the day as a number with a leading zero ( 01 to 31 );
9243 %j - the day as a number without a leading zero ( 1 to 31 );
9244 %D - the day as an abbreviation ( Sun to Sat );
9245 %l - the day as a full name ( Sunday to Saturday );
9246 %W - the ISO-8601 week number of the year. Weeks start on Monday; 1)
9247 %m - the month as a number without a leading zero ( 1 to 12 );
9248 %n - the month as a number with a leading zero ( 01 to 12);
9249 %M - the month as an abbreviation ( Jan to Dec );
9250 %F - the month as a full name ( January to December );
9251 %y - the year as a two-digit number ( 00 to 99 );
9252 %Y - the year as a four-digit number ( 1900–9999 );
9253 %h - the hour based on the 12-hour clock ( 00 to 11 );
9254 %H - the hour based on the 24-hour clock ( 00 to 23 );
9255 %i - the minute as a number with a leading zero ( 00 to 59 );
9256 %s - the second as a number without a leading zero ( 00 to 59 ); 2)
9257 %a - displays am (for times from midnight until noon) and pm (for times from noon until midnight);
9258 %A - displays AM (for times from midnight until noon) and PM (for times from noon until midnight).
9259
9260 */
9261
9262if(!gantt.config) gantt.config = {};
9263if(!gantt.config) gantt.config = {};
9264if(!gantt.templates) gantt.templates = {};
9265
9266(function(){
9267
9268dhtmlx.mixin(gantt.config,
9269	{links : {
9270		"finish_to_start":"0",
9271		"start_to_start":"1",
9272		"finish_to_finish":"2",
9273		"start_to_finish":"3"
9274	},
9275	types : {
9276		'task':'task',
9277		'project':'project',
9278		'milestone':'milestone'
9279	},
9280	duration_unit : "day",
9281	work_time:false,
9282	correct_work_time:false,
9283	skip_off_time:false,
9284
9285	autosize:false,
9286
9287	show_links : true,
9288	show_task_cells : true,
9289	show_chart : true,
9290	show_grid : true,
9291	min_duration : 60*60*1000,
9292	xml_date : "%d-%m-%Y %H:%i",
9293	api_date : "%d-%m-%Y %H:%i",
9294	start_on_monday: true,
9295	server_utc : false,
9296	show_progress:true,
9297	fit_tasks : false,
9298	select_task:true,
9299
9300	readonly:false,
9301
9302	/*grid */
9303	date_grid: "%Y-%m-%d",
9304
9305	drag_links : true,
9306	drag_progress:true,
9307	drag_resize:true,
9308	drag_move:true,
9309	drag_mode:{
9310		"resize":"resize",
9311		"progress":"progress",
9312		"move":"move",
9313		"ignore":"ignore"
9314	},
9315	round_dnd_dates:true,
9316	link_wrapper_width:20,
9317	root_id:0,
9318
9319    autofit: true, // grid column automatic fit
9320	columns: [
9321		{name:"text", tree:true, width:'*' },
9322		{name:"start_date", align: "center" },
9323		{name:"duration", align: "center" },
9324		{name:"add", width:'44' }
9325	],
9326
9327	/*scale*/
9328	step: 1,
9329	scale_unit: "day",
9330	subscales : [
9331
9332	],
9333    time_step: 60,
9334    duration_step: 1,
9335	date_scale: "%d %M",
9336    task_date: "%d %F %Y",
9337    time_picker: "%H:%i",
9338    task_attribute: "task_id",
9339    link_attribute: "link_id",
9340    buttons_left: [
9341        "dhx_save_btn",
9342        "dhx_cancel_btn"
9343    ],
9344    buttons_right: [
9345        "dhx_delete_btn"
9346    ],
9347    lightbox: {
9348        sections: [
9349            {name: "description", height: 70, map_to: "text", type: "textarea", focus: true},
9350            {name: "time", height: 72, type: "duration", map_to: "auto"}
9351		],
9352		project_sections: [
9353			{name: "description", height: 70, map_to: "text", type: "textarea", focus: true},
9354			{name: "type", type: "typeselect", map_to: "type"},
9355			{name: "time", height: 72, type: "duration", readonly:true, map_to: "auto"}
9356		],
9357		milestone_sections: [
9358			{name: "description", height: 70, map_to: "text", type: "textarea", focus: true},
9359			{name: "type", type: "typeselect", map_to: "type"},
9360			{name: "time", height: 72, type: "duration", single_date:true, map_to: "auto"}
9361		]
9362    },
9363    drag_lightbox: true,
9364    sort: false,
9365    details_on_create: true,
9366	details_on_dblclick:true,
9367	initial_scroll : true,
9368	task_scroll_offset : 100,
9369
9370	task_height: "full",//number px of 'full' for row height
9371	min_column_width:70
9372});
9373gantt.keys={
9374    edit_save:13,
9375    edit_cancel:27
9376};
9377
9378gantt._init_template = function(name, initial){
9379	var registeredTemplates = this._reg_templates || {};
9380
9381	if(this.config[name] && registeredTemplates[name] != this.config[name]){
9382		if(!(initial && this.templates[name])){
9383			this.templates[name] = this.date.date_to_str(this.config[name]);
9384			registeredTemplates[name] = this.config[name];
9385		}
9386	}
9387	this._reg_templates = registeredTemplates;
9388};
9389gantt._init_templates = function(){
9390	var labels = gantt.locale.labels;
9391	labels.dhx_save_btn 	= labels.icon_save;
9392	labels.dhx_cancel_btn 	= labels.icon_cancel;
9393	labels.dhx_delete_btn 	= labels.icon_delete;
9394
9395
9396
9397	//build configuration based templates
9398	var d = this.date.date_to_str;
9399	var c = this.config;
9400	gantt._init_template("date_scale", true);
9401	gantt._init_template("date_grid", true);
9402	gantt._init_template("task_date", true);
9403
9404
9405
9406	dhtmlx.mixin(this.templates,{
9407		xml_date:this.date.str_to_date(c.xml_date,c.server_utc),
9408		xml_format:d(c.xml_date,c.server_utc),
9409		api_date:this.date.str_to_date(c.api_date),
9410		progress_text:function(start, end, task){return "";},
9411		grid_header_class : function(column, config){
9412			return "";
9413		},
9414
9415		task_text:function(start, end, task){
9416			return task.text;
9417		},
9418		task_class:function(start, end, task){return "";},
9419		grid_row_class:function(start, end, task){
9420			return "";
9421		},
9422		task_row_class:function(start, end, task){
9423			return "";
9424		},
9425		task_cell_class:function(item, date){return "";},
9426		scale_cell_class:function(date){return "";},
9427		scale_row_class:function(date){return "";},
9428
9429        grid_indent:function(item) {
9430            return "<div class='gantt_tree_indent'></div>";
9431        },
9432        grid_folder:function(item) {
9433            return "<div class='gantt_tree_icon gantt_folder_" + (item.$open ? "open" : "closed") + "'></div>";
9434        },
9435        grid_file:function(item) {
9436            return "<div class='gantt_tree_icon gantt_file'></div>";
9437        },
9438        grid_open:function(item) {
9439            return "<div class='gantt_tree_icon gantt_" + (item.$open ? "close" : "open") + "'></div>";
9440        },
9441        grid_blank:function(item) {
9442            return "<div class='gantt_tree_icon gantt_blank'></div>";
9443        },
9444
9445
9446        task_time:function(start,end,ev){
9447            return gantt.templates.task_date(start)+" - "+gantt.templates.task_date(end);
9448        },
9449        time_picker:d(c.time_picker),
9450		link_class : function(link){
9451			return "";
9452		},
9453		link_description : function(link){
9454			var from = gantt.getTask(link.source),
9455				to = gantt.getTask(link.target);
9456
9457			return "<b>" + from.text + "</b> &ndash;  <b>" + to.text+"</b>";
9458		},
9459
9460		drag_link : function(from, from_start, to, to_start) {
9461			from = gantt.getTask(from);
9462			var labels = gantt.locale.labels;
9463
9464			var text = "<b>" + from.text + "</b> " + (from_start ? labels.link_start : labels.link_end)+"<br/>";
9465			if(to){
9466				to = gantt.getTask(to);
9467				text += "<b> " + to.text + "</b> "+ (to_start ? labels.link_start : labels.link_end)+"<br/>";
9468			}
9469			return text;
9470		},
9471		drag_link_class: function(from, from_start, to, to_start) {
9472			var add = "";
9473
9474			if(from && to){
9475				var allowed = gantt.isLinkAllowed(from, to, from_start, to_start);
9476				add = " " + (allowed ? "gantt_link_allow" : "gantt_link_deny");
9477			}
9478
9479			return "gantt_link_tooltip" + add;
9480		}
9481    });
9482
9483	this.callEvent("onTemplatesReady",[]);
9484};
9485
9486})();
9487if (window.jQuery){
9488
9489(function( $ ){
9490
9491	var methods = [];
9492	$.fn.dhx_gantt = function(config){
9493		config = config || {};
9494		if (typeof(config) === 'string') {
9495			if (methods[config] ) {
9496				return methods[config].apply(this, []);
9497			}else {
9498				$.error('Method ' +  config + ' does not exist on jQuery.dhx_gantt');
9499			}
9500		} else {
9501			var views = [];
9502			this.each(function() {
9503				if (this && this.getAttribute){
9504					if (!this.getAttribute("dhxgantt")){
9505						for (var key in config)
9506							if (key!="data")
9507								gantt.config[key] = config[key];
9508
9509						gantt.init(this);
9510						if (config.data)
9511							gantt.parse(config.data);
9512
9513						views.push(gantt);
9514					}
9515				}
9516			});
9517
9518		
9519			if (views.length === 1) return views[0];
9520			return views;
9521		}
9522	};
9523
9524})(jQuery);
9525
9526}
9527
9528if (window.dhtmlx){
9529
9530	if (!dhtmlx.attaches)
9531		dhtmlx.attaches = {};
9532		
9533	dhtmlx.attaches.attachGantt=function(start, end){
9534		var obj = document.createElement("DIV");
9535		obj.id = "gantt_"+dhtmlx.uid();
9536		obj.style.width = "100%";
9537		obj.style.height = "100%";
9538		obj.cmp = "grid";
9539
9540		document.body.appendChild(obj);
9541		this.attachObject(obj.id);
9542		
9543		var that = this.vs[this.av];
9544		that.grid = gantt;
9545
9546		gantt.init(obj.id, start, end);
9547		obj.firstChild.style.border = "none";
9548		
9549		that.gridId = obj.id;
9550		that.gridObj = obj;
9551			
9552		var method_name="_viewRestore";
9553		return this.vs[this[method_name]()].grid;
9554	};
9555
9556}
9557gantt.locale = {
9558	date:{
9559		month_full:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
9559November", "December"],
9560		month_short:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
9561		day_full:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
9562		day_short:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
9563	},
9564	labels:{
9565		new_task:"New task",
9566		icon_save:"Save",
9567		icon_cancel:"Cancel",
9568		icon_details:"Details",
9569		icon_edit:"Edit",
9570		icon_delete:"Delete",
9571		confirm_closing:"",//Your changes will be lost, are your sure ?
9572		confirm_deleting:"Task will be deleted permanently, are you sure?",
9573        section_description:"Description",
9574        section_time:"Time period",
9575		section_type:"Type",
9576
9577        /* grid columns */
9578
9579        column_text : "Task name",
9580        column_start_date : "Start time",
9581        column_duration : "Duration",
9582        column_add : "",
9583
9584		/* link confirmation */
9585		link: "Link",
9586		confirm_link_deleting:"will be deleted",
9587		link_start: " (start)",
9588		link_end: " (end)",
9589
9590		type_task: "Task",
9591		type_project: "Project",
9592		type_milestone: "Milestone",
9593
9594        minutes: "Minutes",
9595        hours: "Hours",
9596        days: "Days",
9597        weeks: "Week",
9598        months: "Months",
9599        years: "Years"
9600	}
9601};
9602
9603
9604
9605
9606gantt.skins.skyblue = {
9607	config:{
9608		grid_width:350,
9609		row_height: 27,
9610		scale_height: 27,
9611		task_height: 24,
9612		link_line_width:1,
9613		link_arrow_size:8,
9614		lightbox_additional_height:75
9615	},
9616	_second_column_width:95,
9617	_third_column_width:80
9618};
9619gantt.skins.meadow = {
9620	config:{
9621		grid_width:350,
9622		row_height: 27,
9623		scale_height: 30,
9624		task_height:24,
9625		link_line_width:2,
9626		link_arrow_size:6,
9627		lightbox_additional_height:72
9628	},
9629	_second_column_width:95,
9630	_third_column_width:80
9631};
9632
9633gantt.skins.terrace = {
9634	config:{
9635		grid_width:360,
9636		row_height: 35,
9637		scale_height: 35,
9638		task_height: 24,
9639		link_line_width:2,
9640		link_arrow_size:6,
9641		lightbox_additional_height:75
9642	},
9643	_second_column_width:90,
9644	_third_column_width:70		
9645};
9646gantt.skins.broadway = {
9647	config:{
9648		grid_width:360,
9649		row_height: 35,
9650		scale_height: 35,
9651		task_height: 24,
9652		link_line_width:1,
9653		link_arrow_size:7,
9654		lightbox_additional_height:86
9655	},
9656	_second_column_width:90,
9657	_third_column_width:80,
9658
9659	_lightbox_template:"<div class='dhx_cal_ltitle'><span class='dhx_mark'>&nbsp;</span><span class='dhx_time'></span><span class='dhx_title'></span><div class='dhx_cancel_btn'></div></div><div class='dhx_cal_larea'></div>",
9660	_config_buttons_left: {},
9661	_config_buttons_right: {
9662		"dhx_delete_btn": "icon_delete",
9663		"dhx_save_btn": "icon_save"
9664	}
9665};
9666
9667
9668gantt.config.touch_drag = 50; //nearly immediate dnd
9669gantt.config.touch = true;
9670
9671gantt._init_touch_events = function(){
9672	if (this.config.touch != "force")
9673		this.config.touch = this.config.touch &&
9674			 ((navigator.userAgent.indexOf("Mobile")!=-1)    ||
9675				(navigator.userAgent.indexOf("iPad")!=-1)    ||
9676				(navigator.userAgent.indexOf("Android")!=-1) ||
9677				(navigator.userAgent.indexOf("Touch")!=-1));
9678
9679	if (this.config.touch){
9680		if (window.navigator.msPointerEnabled){
9681			this._touch_events(["MSPointerMove", "MSPointerDown", "MSPointerUp"], function(ev){
9682				if (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE ) return null;
9683				return ev;
9684			}, function(ev){
9685				return (!ev || ev.pointerType == ev.MSPOINTER_TYPE_MOUSE);
9686			});
9687		} else
9688			this._touch_events(["touchmove", "touchstart", "touchend"], function(ev){
9689				if (ev.touches && ev.touches.length > 1) return null;
9690				if (ev.touches[0])
9691					return { target:ev.target, pageX:ev.touches[0].pageX, pageY:ev.touches[0].pageY };
9692				else 
9693					return ev;
9694			}, function(){ return false; });
9695	}
9696};
9697
9698
9699//we can't use native scrolling, as we need to sync momentum between different parts
9700//so we will block native scroll and use the custom one
9701//in future we can add custom momentum
9702gantt._touch_events = function(names, accessor, ignore){
9703	//webkit on android need to be handled separately
9704	var dblclicktime = 0;
9705	var action_mode = false;
9706	var scroll_mode = false;
9707	var dblclick_timer = 0;
9708	var action_start = null;
9709	var scroll_state;
9710
9711	//touch move
9712	if (!this._gantt_touch_event_ready){
9713		this._gantt_touch_event_ready = 1;
9714		dhtmlxEvent(document.body, names[0], function(e){
9715			if (ignore(e)) return;
9716
9717			//ignore common and scrolling moves
9718			if (!action_mode) return;
9719
9720			var source = accessor(e);
9721			if (source && action_start){
9722				var dx = action_start.pageX - source.pageX;
9723				var dy = action_start.pageY - source.pageY;
9724				if (!scroll_mode && (Math.abs(dx) > 5 || Math.abs(dy) > 5)){
9725					gantt._touch_scroll_active = scroll_mode = true;
9726					dblclicktime = 0;
9727					scroll_state = gantt.getScrollState();
9728				}
9729
9730				if (scroll_mode){
9731					gantt.scrollTo(scroll_state.x + dx, scroll_state.y + dy);
9732				}
9733			}
9734			return block_action(e);
9735		});
9736	}
9737
9738
9739	//common helper, prevents event
9740	function block_action(e){
9741		if (e && e.preventDefault)
9742			e.preventDefault();
9743		(e||event).cancelBubble = true;
9744		return false;
9745	}
9746
9747	//block touch context menu in IE10
9748	dhtmlxEvent(this.$container, "contextmenu", function(e){
9749		if (action_mode)
9750			return block_action(e);
9751	});
9752
9753	//touch start
9754	dhtmlxEvent(this.$container, names[1], function(e){
9755		if (ignore(e)) return;
9756		if (e.touches && e.touches.length > 1){
9757			action_mode = false;
9758			return;
9759		}
9760
9761		action_mode = true;
9762		action_start = accessor(e);
9763
9764
9765
9766		//dbl-tap handling
9767		if (action_start && dblclicktime){
9768			var now = new Date();
9769			if ((now - dblclicktime) < 500 ){
9770				gantt._on_dblclick(action_start);
9771				block_action(e);
9772			} else
9773				dblclicktime = now;
9774		} else {
9775			dblclicktime = new Date();
9776		}
9777	});
9778	
9779	//touch end
9780	dhtmlxEvent(this.$container, names[2], function(e){
9781		if (ignore(e)) return;
9782		gantt._touch_scroll_active = action_mode = scroll_mode = false;
9783	});	
9784};;
9785/*
9786This software is allowed to use under GPL or you need to obtain Commercial or Enterise License 
9787 to use it in non-GPL project. Please contact [email protected] for details
9788*/
9789gantt._tooltip = {};
9790gantt._tooltip_class = "gantt_tooltip";
9791gantt.config.tooltip_timeout = 30;//,
9792	// timeout_to_hide: 50,
9793	// delta_x: 15,
9794	// delta_y: -20
9795
9796gantt._create_tooltip = function(){
9797	if (!this._tooltip_html){
9798		this._tooltip_html = document.createElement('div');
9799		this._tooltip_html.className = gantt._tooltip_class;
9800	}
9801	return this._tooltip_html;
9802};
9803
9804gantt._show_tooltip = function(text, pos) { 
9805	if (gantt.config.touch && !gantt.config.touch_tooltip) return;
9806
9807	var tip = this._create_tooltip();
9808
9809	tip.innerHTML = text;
9810	gantt.$task_data.appendChild(tip);
9811
9812	var width = tip.offsetWidth + 20;
9813	var height = tip.offsetHeight + 40;
9814	var max_height = this.$task.offsetHeight;
9815	var max_width = this.$task.offsetWidth;
9816	var scroll = this.getScrollState();
9817
9818	pos.x += scroll.x;
9819	pos.y += scroll.y;
9820
9821	pos.y = Math.min(Math.max(scroll.y, pos.y), scroll.y+max_height - height);
9822	pos.x = Math.min(Math.max(scroll.x, pos.x), scroll.x+max_width - width);
9823
9824	tip.style.left = pos.x + "px";
9825	tip.style.top  = pos.y + "px";
9826};
9827
9828gantt._hide_tooltip = function(){
9829	if (this._tooltip_html && this._tooltip_html.parentNode)	
9830		this._tooltip_html.parentNode.removeChild(this._tooltip_html);		
9831	this._tooltip_id = 0;
9832};
9833
9834gantt._is_tooltip = function(ev) {
9835	var node = ev.target || ev.srcElement;
9836	return gantt._is_node_child(node, function(node){
9837		return (node.className == this._tooltip_class);
9838	});
9839};
9840
9841gantt._is_task_line = function(ev){
9842	var node = ev.target || ev.srcElement;
9843	return gantt._is_node_child(node, function(node){
9844		return (node == this.$task_data);
9845	});
9846};
9847
9848gantt._is_node_child = function(node, condition){
9849	var res = false;
9850	while (node && !res) {
9851		res = condition.call(gantt, node);
9852		node = node.parentNode;
9853	}
9854	return res;
9855};
9856
9857gantt._tooltip_pos = function(ev) {
9858	if (ev.pageX || ev.pageY)
9859		var pos = {x:ev.pageX, y:ev.pageY};
9860	
9861	var d = _isIE ? document.documentElement : document.body;
9862	var pos = {
9863		x:ev.clientX + d.scrollLeft - d.clientLeft,
9864		y:ev.clientY + d.scrollTop - d.clientTop
9865	};
9866
9867	var box = gantt._get_position(gantt.$task);
9868	pos.x = pos.x - box.x;
9869	pos.y = pos.y - box.y;
9870	return pos;
9871};
9872
9873gantt.attachEvent("onMouseMove", function(event_id, ev) { // (gantt event_id, browser event)
9874	if(this.config.tooltip_timeout){
9875		//making events survive timeout in ie
9876		if(document.createEventObject && !document.createEvent)
9877			ev = document.createEventObject(ev);
9878
9879		clearTimeout(gantt._tooltip_ev_timer);
9880		gantt._tooltip_ev_timer = setTimeout(function(){
9881			gantt._init_tooltip(event_id, ev);
9882		}, gantt.config.tooltip_timeout);
9883
9884	}else{
9885		gantt._init_tooltip(event_id, ev);
9886	}
9887});
9888gantt._init_tooltip = function(event_id, ev){
9889	if (this._is_tooltip(ev)) return;
9890	if (event_id == this._tooltip_id && !this._is_task_line(ev)) return;
9891	if (!event_id)
9892		return this._hide_tooltip();
9893
9894	this._tooltip_id = event_id;
9895
9896	var task = this.getTask(event_id);
9897	var text = this.templates.tooltip_text(task.start_date, task.end_date, task);
9898	if (!text)
9899		this._hide_tooltip();
9900	this._show_tooltip(text, this._tooltip_pos(ev));
9901};
9902gantt.attachEvent("onMouseLeave", function(ev){
9903	if (gantt._is_tooltip(ev)) return;
9904	this._hide_tooltip();
9905});
9906
9907// gantt.attachEvent("onBeforeDrag", function() {
9908// 	gantt._tooltip.hide();
9909// 	return true;
9910// });
9911// gantt.attachEvent("onEventDeleted", function() {
9912// 	gantt._tooltip.hide();
9913// 	return true;
9914// });
9915
9916
9917/* Could be redifined */
9918gantt.templates.tooltip_date_format = gantt.date.date_to_str("%Y-%m-%d");
9919gantt.templates.tooltip_text = function(start, end, event) {
9920	return "<b>Task:</b> " + event.text + "<br/><b>Start date:</b> " + gantt.templates.tooltip_date_format(start) + "<br/><b>End date:</b> " + gantt.templates.tooltip_date_format(end);
9921};
9922;
9923/**
9924 * @license AngularJS v1.3.10
9925 * (c) 2010-2014 Google, Inc. http://angularjs.org
9926 * License: MIT
9927 */
9928!function(a,b,c){"use strict";/**
9929 * @ngdoc module
9930 * @name ngSanitize
9931 * @description
9932 *
9933 * # ngSanitize
9934 *
9935 * The `ngSanitize` module provides functionality to sanitize HTML.
9936 *
9937 *
9938 * <div doc-module-components="ngSanitize"></div>
9939 *
9940 * See {@link ngSanitize.$sanitize `$sanitize`} for usage.
9941 */
9942/*
9943 * HTML Parser By Misko Hevery ([email protected])
9944 * based on:  HTML Parser By John Resig (ejohn.org)
9945 * Original code by Erik Arvidsson, Mozilla Public License
9946 * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
9947 *
9948 * // Use like so:
9949 * htmlParser(htmlString, {
9950 *     start: function(tag, attrs, unary) {},
9951 *     end: function(tag) {},
9952 *     chars: function(text) {},
9953 *     comment: function(text) {}
9954 * });
9955 *
9956 */
9957/**
9958 * @ngdoc service
9959 * @name $sanitize
9960 * @kind function
9961 *
9962 * @description
9963 *   The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
9964 *   then serialized back to properly escaped html string. This means that no unsafe input can make
9965 *   it into the returned string, however, since our parser is more strict than a typical browser
9966 *   parser, it's possible that some obscure input, which would be recognized as valid HTML by a
9967 *   browser, won't make it through the sanitizer. The input may also contain SVG markup.
9968 *   The whitelist is configured using the functions `aHrefSanitizationWhitelist` and
9969 *   `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}.
9970 *
9971 * @param {string} html HTML input.
9972 * @returns {string} Sanitized HTML.
9973 *
9974 * @example
9975   <example module="sanitizeExample" deps="angular-sanitize.js">
9976   <file name="index.html">
9977     <script>
9978         angular.module('sanitizeExample', ['ngSanitize'])
9979           .controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
9980             $scope.snippet =
9981               '<p style="color:blue">an html\n' +
9982               '<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
9983               'snippet</p>';
9984             $scope.deliberatelyTrustDangerousSnippet = function() {
9985               return $sce.trustAsHtml($scope.snippet);
9986             };
9987           }]);
9988     </script>
9989     <div ng-controller="ExampleController">
9990        Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
9991       <table>
9992         <tr>
9993           <td>Directive</td>
9994           <td>How</td>
9995           <td>Source</td>
9996           <td>Rendered</td>
9997         </tr>
9998         <tr id="bind-html-with-sanitize">
9999           <td>ng-bind-html</td>
10000           <td>Automatically uses $sanitize</td>
10001           <td><pre>&lt;div ng-bind-html="snippet"&gt;<br/>&lt;/div&gt;</pre></td>
10002           <td><div ng-bind-html="snippet"></div></td>
10003         </tr>
10004         <tr id="bind-html-with-trust">
10005           <td>ng-bind-html</td>
10006           <td>Bypass $sanitize by explicitly trusting the dangerous value</td>
10007           <td>
10008           <pre>&lt;div ng-bind-html="deliberatelyTrustDangerousSnippet()"&gt;
10009&lt;/div&gt;</pre>
10010           </td>
10011           <td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
10012         </tr>
10013         <tr id="bind-default">
10014           <td>ng-bind</td>
10015           <td>Automatically escapes</td>
10016           <td><pre>&lt;div ng-bind="snippet"&gt;<br/>&lt;/div&gt;</pre></td>
10017           <td><div ng-bind="snippet"></div></td>
10018         </tr>
10019       </table>
10020       </div>
10021   </file>
10022   <file name="protractor.js" type="protractor">
10023     it('should sanitize the html snippet by default', function() {
10024       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
10025         toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
10026     });
10027
10028     it('should inline raw snippet if bound to a trusted value', function() {
10029       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
10030         toBe("<p style=\"color:blue\">an html\n" +
10031              "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
10032              "snippet</p>");
10033     });
10034
10035     it('should escape snippet without any filter', function() {
10036       expect(element(by.css('#bind-default div')).getInnerHtml()).
10037         toBe("&lt;p style=\"color:blue\"&gt;an html\n" +
10038              "&lt;em onmouseover=\"this.textContent='PWN3D!'\"&gt;click here&lt;/em&gt;\n" +
10039              "snippet&lt;/p&gt;");
10040     });
10041
10042     it('should update', function() {
10043       element(by.model('snippet')).clear();
10044       element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
10045       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
10046         toBe('new <b>text</b>');
10047       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
10048         'new <b onclick="alert(1)">text</b>');
10049       expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
10050         "new &lt;b onclick=\"alert(1)\"&gt;text&lt;/b&gt;");
10051     });
10052   </file>
10053   </example>
10054 */
10055function d(){this.$get=["$$sanitizeUri",function(a){return function(b){"undefined"!=typeof arguments[1]&&(arguments[1].version="taSanitize");var c=[];return g(b,l(c,function(b,c){return!/^unsafe/.test(a(b,c))})),c.join("")}}]}function e(a){var c=[],d=l(c,b.noop);return d.chars(a),c.join("")}function f(a){var b,c={},d=a.split(",");for(b=0;b<d.length;b++)c[d[b]]=!0;return c}/**
10056 * @example
10057 * htmlParser(htmlString, {
10058 *     start: function(tag, attrs, unary) {},
10059 *     end: function(tag) {},
10060 *     chars: function(text) {},
10061 *     comment: function(text) {}
10062 * });
10063 *
10064 * @param {string} html string
10065 * @param {object} handler
10066 */
10067function g(a,c){function d(a,d,f,g){if(d=b.lowercase(d),D[d])for(;k.last()&&E[k.last()];)e("",k.last());C[d]&&k.last()==d&&e("",d),g=z[d]||!!g,g||k.push(d);var i={};f.replace(p,function(a,b,c,d,e){var f=c||d||e||"";i[b]=h(f)}),c.start&&c.start(d,i,g)}function e(a,d){var e,f=0;if(d=b.lowercase(d))
10068// Find the closest opened tag of the same type
10069for(f=k.length-1;f>=0&&k[f]!=d;f--);if(f>=0){
10070// Close all the open elements, up the stack
10071for(e=k.length-1;e>=f;e--)c.end&&c.end(k[e]);
10072// Remove the open elements from the stack
10073k.length=f}}"string"!=typeof a&&(a=null===a||"undefined"==typeof a?"":""+a);var f,g,i,j,k=[],l=a;for(k.last=function(){return k[k.length-1]};a;){
10074// Make sure we're not in a script or style element
vendor: 5,731 bytes, lines 10075-10129
10075if(j="",g=!0,k.last()&&G[k.last()])a=a.replace(new RegExp("([^]*)<\\s*\\/\\s*"+k.last()+"[^>]*>","i"),function(a,b){return b=b.replace(s,"$1").replace(v,"$1"),c.chars&&c.chars(h(b)),""}),e("",k.last());else{
10076// White space
10077if(y.test(a)){if(i=a.match(y)){i[0];c.whitespace&&c.whitespace(i[0]),a=a.replace(i[0],""),g=!1}}else t.test(a)?(i=a.match(t),i&&(c.comment&&c.comment(i[1]),a=a.replace(i[0],""),g=!1)):u.test(a)?(i=a.match(u),i&&(a=a.replace(i[0],""),g=!1)):r.test(a)?(i=a.match(o),i&&(a=a.substring(i[0].length),i[0].replace(o,e),g=!1)):q.test(a)&&(i=a.match(n),i?(
10078// We only have a valid start-tag if there is a '>'.
10079i[4]&&(a=a.substring(i[0].length),i[0].replace(n,d)),g=!1):(
10080// no ending tag found --- this piece should be encoded as an entity.
10081j+="<",a=a.substring(1)));g&&(f=a.indexOf("<"),j+=f<0?a:a.substring(0,f),a=f<0?"":a.substring(f),c.chars&&c.chars(h(j)))}if(a==l)throw m("badparse","The sanitizer was unable to parse the following block of html: {0}",a);l=a}
10082// Clean up any remaining tags
10083e()}/**
10084 * decodes all entities into regular string
10085 * @param value
10086 * @returns {string} A string with decoded entities.
10087 */
10088function h(a){if(!a)return"";
10089// Note: IE8 does not preserve spaces at the start/end of innerHTML
10090// so we must capture them and reattach them afterward
10091var b=N.exec(a),c=b[1],d=b[3],e=b[2];
10092// innerText depends on styling as it doesn't display hidden elements.
10093// Therefore, it's better to use textContent not to cause unnecessary
10094// reflows. However, IE<9 don't support textContent so the innerText
10095// fallback is necessary.
10096return e&&(M.innerHTML=e.replace(/</g,"&lt;"),e="textContent"in M?M.textContent:M.innerText),c+e+d}/**
10097 * Escapes all potentially dangerous characters, so that the
10098 * resulting string can be safely inserted into attribute or
10099 * element text.
10100 * @param value
10101 * @returns {string} escaped text
10102 */
10103function i(a){return a.replace(/&/g,"&amp;").replace(w,function(a){var b=a.charCodeAt(0),c=a.charCodeAt(1);return"&#"+(1024*(b-55296)+(c-56320)+65536)+";"}).replace(x,function(a){
10104// unsafe chars are: \u0000-\u001f \u007f-\u009f \u00ad \u0600-\u0604 \u070f \u17b4 \u17b5 \u200c-\u200f \u2028-\u202f \u2060-\u206f \ufeff \ufff0-\uffff from jslint.com/lint.html
10105// decimal values are: 0-31, 127-159, 173, 1536-1540, 1807, 6068, 6069, 8204-8207, 8232-8239, 8288-8303, 65279, 65520-65535
10106var b=a.charCodeAt(0);
10107// if unsafe character encode
10108// if unsafe character encode
10109return b<=159||173==b||b>=1536&&b<=1540||1807==b||6068==b||6069==b||b>=8204&&b<=8207||b>=8232&&b<=8239||b>=8288&&b<=8303||65279==b||b>=65520&&b<=65535?"&#"+b+";":a}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}
10110// Custom logic for accepting certain style options only - textAngular
10111// Currently allows only the color, background-color, text-align, float, width and height attributes
10112// all other attributes should be easily done through classes.
10113function j(a){var c="",d=a.split(";");return b.forEach(d,function(a){var d=a.split(":");if(2==d.length){var e=O(b.lowercase(d[0])),a=O(b.lowercase(d[1]));(("color"===e||"background-color"===e)&&(a.match(/^rgb\([0-9%,\. ]*\)$/i)||a.match(/^rgba\([0-9%,\. ]*\)$/i)||a.match(/^hsl\([0-9%,\. ]*\)$/i)||a.match(/^hsla\([0-9%,\. ]*\)$/i)||a.match(/^#[0-9a-f]{3,6}$/i)||a.match(/^[a-z]*$/i))||"text-align"===e&&("left"===a||"right"===a||"center"===a||"justify"===a)||"text-decoration"===e&&("underline"===a||"line-through"===a)||"font-weight"===e&&"bold"===a||"font-style"===e&&"italic"===a||"float"===e&&("left"===a||"right"===a||"none"===a)||"vertical-align"===e&&("baseline"===a||"sub"===a||"super"===a||"test-top"===a||"text-bottom"===a||"middle"===a||"top"===a||"bottom"===a||a.match(/[0-9]*(px|em)/)||a.match(/[0-9]+?%/))||"font-size"===e&&("xx-small"===a||"x-small"===a||"small"===a||"medium"===a||"large"===a||"x-large"===a||"xx-large"===a||"larger"===a||"smaller"===a||a.match(/[0-9]*\.?[0-9]*(px|em|rem|mm|q|cm|in|pt|pc|%)/))||("width"===e||"height"===e)&&a.match(/[0-9\.]*(px|em|rem|%)/)||// Reference #520
10114"direction"===e&&a.match(/^ltr|rtl|initial|inherit$/))&&(c+=e+": "+a+";")}}),c}
10115// this function is used to manually allow specific attributes on specific tags with certain prerequisites
10116function k(a,b,c,d){
10117// catch the div placeholder for the iframe replacement
10118return!("img"!==a||!b["ta-insert-video"]||"ta-insert-video"!==c&&"allowfullscreen"!==c&&"frameborder"!==c&&("contenteditable"!==c||"false"!==d))}/**
10119 * create an HTML/XML writer which writes to buffer
10120 * @param {Array} buf use buf.jain('') to get out sanitized html string
10121 * @returns {object} in the form of {
10122 *     start: function(tag, attrs, unary) {},
10123 *     end: function(tag) {},
10124 *     chars: function(text) {},
10125 *     comment: function(text) {}
10126 * }
10127 */
10128function l(a,c){var d=!1,e=b.bind(a,a.push);return{start:function(a,f,g){a=b.lowercase(a),!d&&G[a]&&(d=a),d||H[a]!==!0||(e("<"),e(a),b.forEach(f,function(d,g){var h=b.lowercase(g),l="img"===a&&"src"===h||"background"===h;("style"===h&&""!==(d=j(d))||k(a,f,h,d)||L[h]===!0&&(I[h]!==!0||c(d,l)))&&(e(" "),e(g),e('="'),e(i(d)),e('"'))}),e(g?"/>":">"))},comment:function(a){e(a)},whitespace:function(a){e(i(a))},end:function(a){a=b.lowercase(a),d||H[a]!==!0||(e("</"),e(a),e(">")),a==d&&(d=!1)},chars:function(a){d||e(i(a))}}}var m=b.$$minErr("$sanitize"),n=/^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,o=/^<\/\s*([\w:-]+)[^>]*>/,p=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,q=/^</,r=/^<\//,s=/<!--(.*?)-->/g,t=/(^<!--.*?-->)/,u=/<!DOCTYPE([^>]*?)>/i,v=/<!\[CDATA\[(.*?)]]>/g,w=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
10129// Match everything outside of normal chars and " (quote character)�
vendor: 2,589 bytes, lines 10129-10130
10129
10130x=/([^\#-~| |!])/g,y=/^(\s+)/,z=f("area,br,col,hr,img,wbr,input"),A=f("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),B=f("rp,rt"),C=b.extend({},B,A),D=b.extend({},A,f("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")),E=b.extend({},B,f("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),F=f("animate,animateColor,animateMotion,animateTransform,circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,set,stop,svg,switch,text,title,tspan,use"),G=f("script,style"),H=b.extend({},z,D,E,C,F),I=f("background,cite,href,longdesc,src,usemap,xlink:href"),J=f("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,id,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,target,title,type,valign,value,vspace,width"),K=f("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,attributeName,attributeType,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan"),L=b.extend({},I,K,J),M=document.createElement("pre"),N=/^(\s*)([\s\S]*?)(\s*)$/,O=function(){
10130
10131// native trim is way faster: http://jsperf.com/angular-trim-test
10132// but IE doesn't have it... :-(
10133// TODO: we should move this into IE/ES5 polyfill
10134// native trim is way faster: http://jsperf.com/angular-trim-test
10135// but IE doesn't have it... :-(
10136// TODO: we should move this into IE/ES5 polyfill
10137return String.prototype.trim?function(a){return b.isString(a)?a.trim():a}:function(a){return b.isString(a)?a.replace(/^\s\s*/,"").replace(/\s\s*$/,""):a}}();
10138// define ngSanitize module and register $sanitize service
10139b.module("ngSanitize",[]).provider("$sanitize",d),/* global sanitizeText: false */
10140/**
10141 * @ngdoc filter
10142 * @name linky
10143 * @kind function
10144 *
10145 * @description
10146 * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and
10147 * plain email address links.
10148 *
10149 * Requires the {@link ngSanitize `ngSanitize`} module to be installed.
10150 *
10151 * @param {string} text Input text.
10152 * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in.
10153 * @returns {string} Html-linkified text.
10154 *
10155 * @usage
10156   <span ng-bind-html="linky_expression | linky"></span>
10157 *
10158 * @example
10159   <example module="linkyExample" deps="angular-sanitize.js">
10160     <file name="index.html">
10161       <script>
10162         angular.module('linkyExample', ['ngSanitize'])
10163           .controller('ExampleController', ['$scope', function($scope) {
10164             $scope.snippet =
10165               'Pretty text with some links:\n'+
10166               'http://angularjs.org/,\n'+
10167               'mailto:[email protected],\n'+
10168               '[email protected],\n'+
10169               'and one more: ftp://127.0.0.1/.';
10170             $scope.snippetWithTarget = 'http://angularjs.org/';
10171           }]);
10172       </script>
10173       <div ng-controller="ExampleController">
10174       Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
10175       <table>
10176         <tr>
10177           <td>Filter</td>
10178           <td>Source</td>
10179           <td>Rendered</td>
10180         </tr>
10181         <tr id="linky-filter">
10182           <td>linky filter</td>
10183           <td>
10184             <pre>&lt;div ng-bind-html="snippet | linky"&gt;<br>&lt;/div&gt;</pre>
10185           </td>
10186           <td>
10187             <div ng-bind-html="snippet | linky"></div>
10188           </td>
10189         </tr>
10190         <tr id="linky-target">
10191          <td>linky target</td>
10192          <td>
10193            <pre>&lt;div ng-bind-html="snippetWithTarget | linky:'_blank'"&gt;<br>&lt;/div&gt;</pre>
10194          </td>
10195          <td>
10196            <div ng-bind-html="snippetWithTarget | linky:'_blank'"></div>
10197          </td>
10198         </tr>
10199         <tr id="escaped-html">
10200           <td>no filter</td>
10201           <td><pre>&lt;div ng-bind="snippet"&gt;<br>&lt;/div&gt;</pre></td>
10202           <td><div ng-bind="snippet"></div></td>
10203         </tr>
10204       </table>
10205     </file>
10206     <file name="protractor.js" type="protractor">
10207       it('should linkify the snippet with urls', function() {
10208         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
10209             toBe('Pretty text with some links: http://angularjs.org/, [email protected], ' +
10210                  '[email protected], and one more: ftp://127.0.0.1/.');
10211         expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
10212       });
10213
10214       it('should not linkify snippet without the linky filter', function() {
10215         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
10216             toBe('Pretty text with some links: http://angularjs.org/, mailto:[email protected], ' +
10217                  '[email protected], and one more: ftp://127.0.0.1/.');
10218         expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
10219       });
10220
10221       it('should update', function() {
10222         element(by.model('snippet')).clear();
10223         element(by.model('snippet')).sendKeys('new http://link.');
10224         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
10225             toBe('new http://link.');
10226         expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
10227         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
10228             .toBe('new http://link.');
10229       });
10230
10231       it('should work with the target property', function() {
10232        expect(element(by.id('linky-target')).
10233            element(by.binding("snippetWithTarget | linky:'_blank'")).getText()).
10234            toBe('http://angularjs.org/');
10235        expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
10236       });
10237     </file>
10238   </example>
10239 */
10240b.module("ngSanitize").filter("linky",["$sanitize",function(a){var c=/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"”’]/,d=/^mailto:/;return function(f,g){function h(a){a&&n.push(e(a))}function i(a,c){n.push("<a "),b.isDefined(g)&&n.push('target="',g,'" '),n.push('href="',a.replace(/"/g,"&quot;"),'">'),h(c),n.push("</a>")}if(!f)return f;for(var j,k,l,m=f,n=[];j=m.match(c);)
10241// We can not end in these as they are sometimes found at the end of the sentence
10242k=j[0],
10243// if we did not match ftp/http/www/mailto then assume mailto
10244j[2]||j[4]||(k=(j[3]?"http://":"mailto:")+k),l=j.index,h(m.substr(0,l)),i(k,j[0].replace(d,"")),m=m.substring(l+j[0].length);return h(m),a(n.join(""))}}])}(window,window.angular);;
10245
10246// tests against the current jqLite/jquery implementation if this can be an element
10247function validElementString(string){
10248    try{
10249        return angular.element(string).length !== 0;
10250    }catch(any){
10251        return false;
10252    }
10253}
10254// setup the global contstant functions for setting up the toolbar
10255
10256// all tool definitions
10257var taTools = {};
10258/*
10259    A tool definition is an object with the following key/value parameters:
10260        action: [function(deferred, restoreSelection)]
10261                a function that is executed on clicking on the button - this will allways be executed using ng-click and will
10262                overwrite any ng-click value in the display attribute.
10263                The function is passed a deferred object ($q.defer()), if this is wanted to be used `return false;` from the action and
10264                manually call `deferred.resolve();` elsewhere to notify the editor that the action has finished.
10265                restoreSelection is only defined if the rangy library is included and it can be called as `restoreSelection()` to restore the users
10266                selection in the WYSIWYG editor.
10267        display: [string]?
10268                Optional, an HTML element to be displayed as the button. The `scope` of the button is the tool definition object with some additional functions
10269                If set this will cause buttontext and iconclass to be ignored
10270        class: [string]?
10271                Optional, if set will override the taOptions.classes.toolbarButton class.
10272        buttontext: [string]?
10273                if this is defined it will replace the contents of the element contained in the `display` element
10274        iconclass: [string]?
10275                if this is defined an icon (<i>) will be appended to the `display` element with this string as it's class
10276        tooltiptext: [string]?
10277                Optional, a plain text description of the action, used for the title attribute of the action button in the toolbar by default.
10278        activestate: [function(commonElement)]?
10279                this function is called on every caret movement, if it returns true then the class taOptions.classes.toolbarButtonActive
10280                will be applied to the `display` element, else the class will be removed
10281        disabled: [function()]?
10282                if this function returns true then the tool will have the class taOptions.classes.disabled applied to it, else it will be removed
10283    Other functions available on the scope are:
10284        name: [string]
10285                the name of the tool, this is the first parameter passed into taRegisterTool
10286        isDisabled: [function()]
10287                returns true if the tool is disabled, false if it isn't
10288        displayActiveToolClass: [function(boolean)]
10289                returns true if the tool is 'active' in the currently focussed toolbar
10290        onElementSelect: [Object]
10291                This object contains the following key/value pairs and is used to trigger the ta-element-select event
10292                element: [String]
10293                    an element name, will only trigger the onElementSelect action if the tagName of the element matches this string
10294                filter: [function(element)]?
10295                    an optional filter that returns a boolean, if true it will trigger the onElementSelect.
10296                action: [function(event, element, editorScope)]
10297                    the action that should be executed if the onElementSelect function runs
10298*/
10299// name and toolDefinition to add into the tools available to be added on the toolbar
10300function registerTextAngularTool(name, toolDefinition){
10301    if(!name || name === '' || taTools.hasOwnProperty(name)) throw('textAngular Error: A unique name is required for a Tool Definition');
10302    if(
10303        (toolDefinition.display && (toolDefinition.display === '' || !validElementString(toolDefinition.display))) ||
10304        (!toolDefinition.display && !toolDefinition.buttontext && !toolDefinition.iconclass)
10305    )
10306        throw('textAngular Error: Tool Definition for "' + name + '" does not have a valid display/iconclass/buttontext value');
10307    taTools[name] = toolDefinition;
10308}
10309
10310angular.module('textAngularSetup', [])
10311.constant('taRegisterTool', registerTextAngularTool)
10312.value('taTools', taTools)
10313// Here we set up the global display defaults, to set your own use a angular $provider#decorator.
10314.value('taOptions',  {
10315    //////////////////////////////////////////////////////////////////////////////////////
10316    // forceTextAngularSanitize
10317    // set false to allow the textAngular-sanitize provider to be replaced
10318    // with angular-sanitize or a custom provider.
10319    forceTextAngularSanitize: true,
10320    ///////////////////////////////////////////////////////////////////////////////////////
10321    // keyMappings
10322    // allow customizable keyMappings for specialized key boards or languages
10323    //
10324    // keyMappings provides key mappings that are attached to a given commandKeyCode.
10325    // To modify a specific keyboard binding, simply provide function which returns true
10326    // for the event you wish to map to.
10327    // Or to disable a specific keyboard binding, provide a function which returns false.
10328    // Note: 'RedoKey' and 'UndoKey' are internally bound to the redo and undo functionality.
10329    // At present, the following commandKeyCodes are in use:
10330    // 98, 'TabKey', 'ShiftTabKey', 105, 117, 'UndoKey', 'RedoKey'
10331    //
10332    // To map to an new commandKeyCode, add a new key mapping such as:
10333    // {commandKeyCode: 'CustomKey', testForKey: function (event) {
10334    //  if (event.keyCode=57 && event.ctrlKey && !event.shiftKey && !event.altKey) return true;
10335    // } }
10336    // to the keyMappings. This example maps ctrl+9 to 'CustomKey'
10337    // Then where taRegisterTool(...) is called, add a commandKeyCode: 'CustomKey' and your
10338    // tool will be bound to ctrl+9.
10339    //
10340    // To disble one of the already bound commandKeyCodes such as 'RedoKey' or 'UndoKey' add:
10341    // {commandKeyCode: 'RedoKey', testForKey: function (event) { return false; } },
10342    // {commandKeyCode: 'UndoKey', testForKey: function (event) { return false; } },
10343    // to disable them.
10344    //
10345    keyMappings : [],
10346    toolbar: [
10347        ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'pre', 'quote'],
10348        ['bold', 'italics', 'underline', 'strikeThrough', 'ul', 'ol', 'redo', 'undo', 'clear'],
10349        ['justifyLeft','justifyCenter','justifyRight','justifyFull','indent','outdent'],
10350        ['html', 'insertImage', 'insertLink', 'insertVideo', 'wordcount', 'charcount']
10351    ],
10352    classes: {
10353        focussed: "focussed",
10354        toolbar: "btn-toolbar",
10355        toolbarGroup: "btn-group",
10356        toolbarButton: "btn btn-default",
10357        toolbarButtonActive: "active",
10358        disabled: "disabled",
10359        textEditor: 'form-control',
10360        htmlEditor: 'form-control'
10361    },
10362    defaultTagAttributes : {
10363        a: {target:""}
10364    },
10365    setup: {
10366        // wysiwyg mode
10367        textEditorSetup: function($element){ /* Do some processing here */ },
10368        // raw html
10369        htmlEditorSetup: function($element){ /* Do some processing here */ }
10370    },
10371    defaultFileDropHandler:
10372        /* istanbul ignore next: untestable image processing */
10373        function(file, insertAction){
10374            var reader = new FileReader();
10375            if(file.type.substring(0, 5) === 'image'){
10376                reader.onload = function() {
10377                    if(reader.result !== '') insertAction('insertImage', reader.result, true);
10378                };
10379
vendor: 28,824 bytes, lines 10380-11036
10380                reader.readAsDataURL(file);
10381                // NOTE: For async procedures return a promise and resolve it when the editor should update the model.
10382                return true;
10383            }
10384            return false;
10385        }
10386})
10387
10388// This is the element selector string that is used to catch click events within a taBind, prevents the default and $emits a 'ta-element-select' event
10389// these are individually used in an angular.element().find() call. What can go here depends on whether you have full jQuery loaded or just jQLite with angularjs.
10390// div is only used as div.ta-insert-video caught in filter.
10391.value('taSelectableElements', ['a','img'])
10392
10393// This is an array of objects with the following options:
10394//				selector: <string> a jqLite or jQuery selector string
10395//				customAttribute: <string> an attribute to search for
10396//				renderLogic: <function(element)>
10397// Both or one of selector and customAttribute must be defined.
10398.value('taCustomRenderers', [
10399    {
10400        // Parse back out: '<div class="ta-insert-video" ta-insert-video src="' + urlLink + '" allowfullscreen="true" width="300" frameborder="0" height="250"></div>'
10401        // To correct video element. For now only support youtube
10402        selector: 'img',
10403        customAttribute: 'ta-insert-video',
10404        renderLogic: function(element){
10405            var iframe = angular.element('<iframe></iframe>');
10406            var attributes = element.prop("attributes");
10407            // loop through element attributes and apply them on iframe
10408            angular.forEach(attributes, function(attr) {
10409                iframe.attr(attr.name, attr.value);
10410            });
10411            iframe.attr('src', iframe.attr('ta-insert-video'));
10412            element.replaceWith(iframe);
10413        }
10414    }
10415])
10416
10417.value('taTranslations', {
10418    // moved to sub-elements
10419    //toggleHTML: "Toggle HTML",
10420    //insertImage: "Please enter a image URL to insert",
10421    //insertLink: "Please enter a URL to insert",
10422    //insertVideo: "Please enter a youtube URL to embed",
10423    html: {
10424        tooltip: 'Toggle html / Rich Text'
10425    },
10426    // tooltip for heading - might be worth splitting
10427    heading: {
10428        tooltip: 'Heading '
10429    },
10430    p: {
10431        tooltip: 'Paragraph'
10432    },
10433    pre: {
10434        tooltip: 'Preformatted text'
10435    },
10436    ul: {
10437        tooltip: 'Unordered List'
10438    },
10439    ol: {
10440        tooltip: 'Ordered List'
10441    },
10442    quote: {
10443        tooltip: 'Quote/unquote selection or paragraph'
10444    },
10445    undo: {
10446        tooltip: 'Undo'
10447    },
10448    redo: {
10449        tooltip: 'Redo'
10450    },
10451    bold: {
10452        tooltip: 'Bold'
10453    },
10454    italic: {
10455        tooltip: 'Italic'
10456    },
10457    underline: {
10458        tooltip: 'Underline'
10459    },
10460    strikeThrough:{
10461        tooltip: 'Strikethrough'
10462    },
10463    justifyLeft: {
10464        tooltip: 'Align text left'
10465    },
10466    justifyRight: {
10467        tooltip: 'Align text right'
10468    },
10469    justifyFull: {
10470        tooltip: 'Justify text'
10471    },
10472    justifyCenter: {
10473        tooltip: 'Center'
10474    },
10475    indent: {
10476        tooltip: 'Increase indent'
10477    },
10478    outdent: {
10479        tooltip: 'Decrease indent'
10480    },
10481    clear: {
10482        tooltip: 'Clear formatting'
10483    },
10484    insertImage: {
10485        dialogPrompt: 'Please enter an image URL to insert',
10486        tooltip: 'Insert image',
10487        hotkey: 'the - possibly language dependent hotkey ... for some future implementation'
10488    },
10489    insertVideo: {
10490        tooltip: 'Insert video',
10491        dialogPrompt: 'Please enter a youtube URL to embed'
10492    },
10493    insertLink: {
10494        tooltip: 'Insert / edit link',
10495        dialogPrompt: "Please enter a URL to insert"
10496    },
10497    editLink: {
10498        reLinkButton: {
10499            tooltip: "Relink"
10500        },
10501        unLinkButton: {
10502            tooltip: "Unlink"
10503        },
10504        targetToggle: {
10505            buttontext: "Open in New Window"
10506        }
10507    },
10508    wordcount: {
10509        tooltip: 'Display words Count'
10510    },
10511        charcount: {
10512        tooltip: 'Display characters Count'
10513    }
10514})
10515.factory('taToolFunctions', ['$window','taTranslations', function($window, taTranslations) {
10516    return {
10517        imgOnSelectAction: function(event, $element, editorScope){
10518            // setup the editor toolbar
10519            // Credit to the work at http://hackerwins.github.io/summernote/ for this editbar logic/display
10520            var finishEdit = function(){
10521                editorScope.updateTaBindtaTextElement();
10522                editorScope.hidePopover();
10523            };
10524            event.preventDefault();
10525            editorScope.displayElements.popover.css('width', '375px');
10526            var container = editorScope.displayElements.popoverContainer;
10527            container.empty();
10528            var buttonGroup = angular.element('<div class="btn-group" style="padding-right: 6px;">');
10529            var fullButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">100% </button>');
10530            fullButton.on('click', function(event){
10531                event.preventDefault();
10532                $element.css({
10533                    'width': '100%',
10534                    'height': ''
10535                });
10536                finishEdit();
10537            });
10538            var halfButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">50% </button>');
10539            halfButton.on('click', function(event){
10540                event.preventDefault();
10541                $element.css({
10542                    'width': '50%',
10543                    'height': ''
10544                });
10545                finishEdit();
10546            });
10547            var quartButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">25% </button>');
10548            quartButton.on('click', function(event){
10549                event.preventDefault();
10550                $element.css({
10551                    'width': '25%',
10552                    'height': ''
10553                });
10554                finishEdit();
10555            });
10556            var resetButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">Reset</button>');
10557            resetButton.on('click', function(event){
10558                event.preventDefault();
10559                $element.css({
10560                    width: '',
10561                    height: ''
10562                });
10563                finishEdit();
10564            });
10565            buttonGroup.append(fullButton);
10566            buttonGroup.append(halfButton);
10567            buttonGroup.append(quartButton);
10568            buttonGroup.append(resetButton);
10569            container.append(buttonGroup);
10570
10571            buttonGroup = angular.element('<div class="btn-group" style="padding-right: 6px;">');
10572            var floatLeft = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-align-left"></i></button>');
10573            floatLeft.on('click', function(event){
10574                event.preventDefault();
10575                // webkit
10576                $element.css('float', 'left');
10577                // firefox
10578                $element.css('cssFloat', 'left');
10579                // IE < 8
10580                $element.css('styleFloat', 'left');
10581                finishEdit();
10582            });
10583            var floatRight = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-align-right"></i></button>');
10584            floatRight.on('click', function(event){
10585                event.preventDefault();
10586                // webkit
10587                $element.css('float', 'right');
10588                // firefox
10589                $element.css('cssFloat', 'right');
10590                // IE < 8
10591                $element.css('styleFloat', 'right');
10592                finishEdit();
10593            });
10594            var floatNone = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-align-justify"></i></button>');
10595            floatNone.on('click', function(event){
10596                event.preventDefault();
10597                // webkit
10598                $element.css('float', '');
10599                // firefox
10600                $element.css('cssFloat', '');
10601                // IE < 8
10602                $element.css('styleFloat', '');
10603                finishEdit();
10604            });
10605            buttonGroup.append(floatLeft);
10606            buttonGroup.append(floatNone);
10607            buttonGroup.append(floatRight);
10608            container.append(buttonGroup);
10609
10610            buttonGroup = angular.element('<div class="btn-group">');
10611            var remove = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-trash-o"></i></button>');
10612            remove.on('click', function(event){
10613                event.preventDefault();
10614                $element.remove();
10615                finishEdit();
10616            });
10617            buttonGroup.append(remove);
10618            container.append(buttonGroup);
10619
10620            editorScope.showPopover($element);
10621            editorScope.showResizeOverlay($element);
10622        },
10623        aOnSelectAction: function(event, $element, editorScope){
10624            // setup the editor toolbar
10625            // Credit to the work at http://hackerwins.github.io/summernote/ for this editbar logic
10626            event.preventDefault();
10627            editorScope.displayElements.popover.css('width', '436px');
10628            var container = editorScope.displayElements.popoverContainer;
10629            container.empty();
10630            container.css('line-height', '28px');
10631            var link = angular.element('<a href="' + $element.attr('href') + '" target="_blank">' + $element.attr('href') + '</a>');
10632            link.css({
10633                'display': 'inline-block',
10634                'max-width': '200px',
10635                'overflow': 'hidden',
10636                'text-overflow': 'ellipsis',
10637                'white-space': 'nowrap',
10638                'vertical-align': 'middle'
10639            });
10640            container.append(link);
10641            var buttonGroup = angular.element('<div class="btn-group pull-right">');
10642            var reLinkButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" tabindex="-1" unselectable="on" title="' + taTranslations.editLink.reLinkButton.tooltip + '"><i class="fa fa-edit icon-edit"></i></button>');
10643            reLinkButton.on('click', function(event){
10644                event.preventDefault();
10645                var urlLink = $window.prompt(taTranslations.insertLink.dialogPrompt, $element.attr('href'));
10646                if(urlLink && urlLink !== '' && urlLink !== 'http://'){
10647                    $element.attr('href', urlLink);
10648                    editorScope.updateTaBindtaTextElement();
10649                }
10650                editorScope.hidePopover();
10651            });
10652            buttonGroup.append(reLinkButton);
10653            var unLinkButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" tabindex="-1" unselectable="on" title="' + taTranslations.editLink.unLinkButton.tooltip + '"><i class="fa fa-unlink icon-unlink"></i></button>');
10654            // directly before this click event is fired a digest is fired off whereby the reference to $element is orphaned off
10655            unLinkButton.on('click', function(event){
10656                event.preventDefault();
10657                $element.replaceWith($element.contents());
10658                editorScope.updateTaBindtaTextElement();
10659                editorScope.hidePopover();
10660            });
10661            buttonGroup.append(unLinkButton);
10662            var targetToggle = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" tabindex="-1" unselectable="on">' + taTranslations.editLink.targetToggle.buttontext + '</button>');
10663            if($element.attr('target') === '_blank'){
10664                targetToggle.addClass('active');
10665            }
10666            targetToggle.on('click', function(event){
10667                event.preventDefault();
10668                $element.attr('target', ($element.attr('target') === '_blank') ? '' : '_blank');
10669                targetToggle.toggleClass('active');
10670                editorScope.updateTaBindtaTextElement();
10671            });
10672            buttonGroup.append(targetToggle);
10673            container.append(buttonGroup);
10674            editorScope.showPopover($element);
10675        },
10676        extractYoutubeVideoId: function(url) {
10677            var re = /(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/i;
10678            var match = url.match(re);
10679            return (match && match[1]) || null;
10680        }
10681    };
10682}])
10683.run(['taRegisterTool', '$window', 'taTranslations', 'taSelection', 'taToolFunctions', '$sanitize', 'taOptions', '$log',
10684    function(taRegisterTool, $window, taTranslations, taSelection, taToolFunctions, $sanitize, taOptions, $log){
10685    // test for the version of $sanitize that is in use
10686    // You can disable this check by setting taOptions.textAngularSanitize == false
10687    var gv = {}; $sanitize('', gv);
10688    /* istanbul ignore next, throws error */
10689    if ((taOptions.forceTextAngularSanitize===true) && (gv.version !== 'taSanitize')) {
10690        throw angular.$$minErr('textAngular')("textAngularSetup", "The textAngular-sanitize provider has been replaced by another -- have you included angular-sanitize by mistake?");
10691    }
10692    taRegisterTool("html", {
10693        iconclass: 'fa fa-code',
10694        tooltiptext: taTranslations.html.tooltip,
10695        action: function(){
10696            this.$editor().switchView();
10697        },
10698        activeState: function(){
10699            return this.$editor().showHtml;
10700        }
10701    });
10702    // add the Header tools
10703    // convenience functions so that the loop works correctly
10704    var _retActiveStateFunction = function(q){
10705        return function(){ return this.$editor().queryFormatBlockState(q); };
10706    };
10707    var headerAction = function(){
10708        return this.$editor().wrapSelection("formatBlock", "<" + this.name.toUpperCase() +">");
10709    };
10710    angular.forEach(['h1','h2','h3','h4','h5','h6'], function(h){
10711        taRegisterTool(h.toLowerCase(), {
10712            buttontext: h.toUpperCase(),
10713            tooltiptext: taTranslations.heading.tooltip + h.charAt(1),
10714            action: headerAction,
10715            activeState: _retActiveStateFunction(h.toLowerCase())
10716        });
10717    });
10718    taRegisterTool('p', {
10719        buttontext: 'P',
10720        tooltiptext: taTranslations.p.tooltip,
10721        action: function(){
10722            return this.$editor().wrapSelection("formatBlock", "<P>");
10723        },
10724        activeState: function(){ return this.$editor().queryFormatBlockState('p'); }
10725    });
10726    // key: pre -> taTranslations[key].tooltip, taTranslations[key].buttontext
10727    taRegisterTool('pre', {
10728        buttontext: 'pre',
10729        tooltiptext: taTranslations.pre.tooltip,
10730        action: function(){
10731            return this.$editor().wrapSelection("formatBlock", "<PRE>");
10732        },
10733        activeState: function(){ return this.$editor().queryFormatBlockState('pre'); }
10734    });
10735    taRegisterTool('ul', {
10736        iconclass: 'fa fa-list-ul',
10737        tooltiptext: taTranslations.ul.tooltip,
10738        action: function(){
10739            return this.$editor().wrapSelection("insertUnorderedList", null);
10740        },
10741        activeState: function(){ return this.$editor().queryCommandState('insertUnorderedList'); }
10742    });
10743    taRegisterTool('ol', {
10744        iconclass: 'fa fa-list-ol',
10745        tooltiptext: taTranslations.ol.tooltip,
10746        action: function(){
10747            return this.$editor().wrapSelection("insertOrderedList", null);
10748        },
10749        activeState: function(){ return this.$editor().queryCommandState('insertOrderedList'); }
10750    });
10751    taRegisterTool('quote', {
10752        iconclass: 'fa fa-quote-right',
10753        tooltiptext: taTranslations.quote.tooltip,
10754        action: function(){
10755            return this.$editor().wrapSelection("formatBlock", "<BLOCKQUOTE>");
10756        },
10757        activeState: function(){ return this.$editor().queryFormatBlockState('blockquote'); }
10758    });
10759    taRegisterTool('undo', {
10760        iconclass: 'fa fa-undo',
10761        tooltiptext: taTranslations.undo.tooltip,
10762        action: function(){
10763            return this.$editor().wrapSelection("undo", null);
10764        }
10765    });
10766    taRegisterTool('redo', {
10767        iconclass: 'fa fa-repeat',
10768        tooltiptext: taTranslations.redo.tooltip,
10769        action: function(){
10770            return this.$editor().wrapSelection("redo", null);
10771        }
10772    });
10773    taRegisterTool('bold', {
10774        iconclass: 'fa fa-bold',
10775        tooltiptext: taTranslations.bold.tooltip,
10776        action: function(){
10777            return this.$editor().wrapSelection("bold", null);
10778        },
10779        activeState: function(){
10780            return this.$editor().queryCommandState('bold');
10781        },
10782        commandKeyCode: 98
10783    });
10784    taRegisterTool('justifyLeft', {
10785        iconclass: 'fa fa-align-left',
10786        tooltiptext: taTranslations.justifyLeft.tooltip,
10787        action: function(){
10788            return this.$editor().wrapSelection("justifyLeft", null);
10789        },
10790        activeState: function(commonElement){
10791            /* istanbul ignore next: */
10792            if (commonElement && commonElement.nodeName === '#document') return false;
10793            var result = false;
10794            if (commonElement) {
10795                // commonELement.css('text-align') can throw an error 'Cannot read property 'defaultView' of null' in rare conditions
10796                // so we do try catch here...
10797                try {
10798                    result =
10799                        commonElement.css('text-align') === 'left' ||
10800                        commonElement.attr('align') === 'left' ||
10801                        (
10802                            commonElement.css('text-align') !== 'right' &&
10803                            commonElement.css('text-align') !== 'center' &&
10804                            commonElement.css('text-align') !== 'justify' && !this.$editor().queryCommandState('justifyRight') && !this.$editor().queryCommandState('justifyCenter')
10805                        ) && !this.$editor().queryCommandState('justifyFull');
10806                } catch(e) {
10807                    /* istanbul ignore next: error handler */
10808                    //console.log(e);
10809                    result = false;
10810                }
10811            }
10812            result = result || this.$editor().queryCommandState('justifyLeft');
10813            return result;
10814        }
10815    });
10816    taRegisterTool('justifyRight', {
10817        iconclass: 'fa fa-align-right',
10818        tooltiptext: taTranslations.justifyRight.tooltip,
10819        action: function(){
10820            return this.$editor().wrapSelection("justifyRight", null);
10821        },
10822        activeState: function(commonElement){
10823            /* istanbul ignore next: */
10824            if (commonElement && commonElement.nodeName === '#document') return false;
10825            var result = false;
10826            if(commonElement) {
10827                // commonELement.css('text-align') can throw an error 'Cannot read property 'defaultView' of null' in rare conditions
10828                // so we do try catch here...
10829                try {
10830                    result = commonElement.css('text-align') === 'right';
10831                } catch(e) {
10832                    /* istanbul ignore next: error handler */
10833                    //console.log(e);
10834                    result = false;
10835                }
10836            }
10837            result = result || this.$editor().queryCommandState('justifyRight');
10838            return result;
10839        }
10840    });
10841    taRegisterTool('justifyFull', {
10842        iconclass: 'fa fa-align-justify',
10843        tooltiptext: taTranslations.justifyFull.tooltip,
10844        action: function(){
10845            return this.$editor().wrapSelection("justifyFull", null);
10846        },
10847        activeState: function(commonElement){
10848            var result = false;
10849            if(commonElement) {
10850                // commonELement.css('text-align') can throw an error 'Cannot read property 'defaultView' of null' in rare conditions
10851                // so we do try catch here...
10852                try {
10853                    result = commonElement.css('text-align') === 'justify';
10854                } catch(e) {
10855                    /* istanbul ignore next: error handler */
10856                    //console.log(e);
10857                    result = false;
10858                }
10859            }
10860            result = result || this.$editor().queryCommandState('justifyFull');
10861            return result;
10862        }
10863    });
10864    taRegisterTool('justifyCenter', {
10865        iconclass: 'fa fa-align-center',
10866        tooltiptext: taTranslations.justifyCenter.tooltip,
10867        action: function(){
10868            return this.$editor().wrapSelection("justifyCenter", null);
10869        },
10870        activeState: function(commonElement){
10871            /* istanbul ignore next: */
10872            if (commonElement && commonElement.nodeName === '#document') return false;
10873            var result = false;
10874            if(commonElement) {
10875                // commonELement.css('text-align') can throw an error 'Cannot read property 'defaultView' of null' in rare conditions
10876                // so we do try catch here...
10877                try {
10878                    result = commonElement.css('text-align') === 'center';
10879                } catch(e) {
10880                    /* istanbul ignore next: error handler */
10881                    //console.log(e);
10882                    result = false;
10883                }
10884
10885            }
10886            result = result || this.$editor().queryCommandState('justifyCenter');
10887            return result;
10888        }
10889    });
10890    taRegisterTool('indent', {
10891        iconclass: 'fa fa-indent',
10892        tooltiptext: taTranslations.indent.tooltip,
10893        action: function(){
10894            return this.$editor().wrapSelection("indent", null);
10895        },
10896        activeState: function(){
10897            return this.$editor().queryFormatBlockState('blockquote');
10898        },
10899        commandKeyCode: 'TabKey'
10900    });
10901    taRegisterTool('outdent', {
10902        iconclass: 'fa fa-outdent',
10903        tooltiptext: taTranslations.outdent.tooltip,
10904        action: function(){
10905            return this.$editor().wrapSelection("outdent", null);
10906        },
10907        activeState: function(){
10908            return false;
10909        },
10910        commandKeyCode: 'ShiftTabKey'
10911    });
10912    taRegisterTool('italics', {
10913        iconclass: 'fa fa-italic',
10914        tooltiptext: taTranslations.italic.tooltip,
10915        action: function(){
10916            return this.$editor().wrapSelection("italic", null);
10917        },
10918        activeState: function(){
10919            return this.$editor().queryCommandState('italic');
10920        },
10921        commandKeyCode: 105
10922    });
10923    taRegisterTool('underline', {
10924        iconclass: 'fa fa-underline',
10925        tooltiptext: taTranslations.underline.tooltip,
10926        action: function(){
10927            return this.$editor().wrapSelection("underline", null);
10928        },
10929        activeState: function(){
10930            return this.$editor().queryCommandState('underline');
10931        },
10932        commandKeyCode: 117
10933    });
10934    taRegisterTool('strikeThrough', {
10935        iconclass: 'fa fa-strikethrough',
10936        tooltiptext: taTranslations.strikeThrough.tooltip,
10937        action: function(){
10938            return this.$editor().wrapSelection("strikeThrough", null);
10939        },
10940        activeState: function(){
10941            return document.queryCommandState('strikeThrough');
10942        }
10943    });
10944    taRegisterTool('clear', {
10945        iconclass: 'fa fa-ban',
10946        tooltiptext: taTranslations.clear.tooltip,
10947        action: function(deferred, restoreSelection){
10948            var i, selectedElements, elementsSeen;
10949
10950            this.$editor().wrapSelection("removeFormat", null);
10951            var possibleNodes = angular.element(taSelection.getSelectionElement());
10952            selectedElements = taSelection.getAllSelectedElements();
10953            //$log.log('selectedElements:', selectedElements);
10954            // remove lists
10955            var removeListElements = function(list, pe){
10956                list = angular.element(list);
10957                var prevElement = pe;
10958                if (!pe) {
10959                    prevElement = list;
10960                }
10961                angular.forEach(list.children(), function(liElem){
10962                    if (liElem.tagName.toLowerCase() === 'ul' ||
10963                        liElem.tagName.toLowerCase() === 'ol') {
10964                        prevElement = removeListElements(liElem, prevElement);
10965                    } else {
10966                        var newElem = angular.element('<p></p>');
10967                        newElem.html(angular.element(liElem).html());
10968                        prevElement.after(newElem);
10969                        prevElement = newElem;
10970                    }
10971                });
10972                list.remove();
10973                return prevElement;
10974            };
10975
10976            angular.forEach(selectedElements, function(element) {
10977                if (element.nodeName.toLowerCase() === 'ul' ||
10978                    element.nodeName.toLowerCase() === 'ol') {
10979                    //console.log('removeListElements', element);
10980                    removeListElements(element);
10981                }
10982            });
10983
10984            angular.forEach(possibleNodes.find("ul"), removeListElements);
10985            angular.forEach(possibleNodes.find("ol"), removeListElements);
10986
10987            // clear out all class attributes. These do not seem to be cleared via removeFormat
10988            var $editor = this.$editor();
10989            var recursiveRemoveClass = function(node){
10990                node = angular.element(node);
10991                /* istanbul ignore next: this is not triggered in tests any longer since we now never select the whole displayELement */
10992                if(node[0] !== $editor.displayElements.text[0]) {
10993                    node.removeAttr('class');
10994                }
10995                angular.forEach(node.children(), recursiveRemoveClass);
10996            };
10997            angular.forEach(possibleNodes, recursiveRemoveClass);
10998            // check if in list. If not in list then use formatBlock option
10999            if(possibleNodes[0] && possibleNodes[0].tagName.toLowerCase() !== 'li' &&
11000                possibleNodes[0].tagName.toLowerCase() !== 'ol' &&
11001                possibleNodes[0].tagName.toLowerCase() !== 'ul' &&
11002                possibleNodes[0].getAttribute("contenteditable") !== "true") {
11003                this.$editor().wrapSelection("formatBlock", "default");
11004            }
11005            restoreSelection();
11006        }
11007    });
11008
11009        /* jshint -W099 */
11010    /****************************
11011     //  we don't use this code - since the previous way CLEAR is expected to work does not clear partially selected <li>
11012
11013     var removeListElement = function(listE){
11014                console.log(listE);
11015                var _list = listE.parentNode.childNodes;
11016                console.log('_list', _list);
11017                var _preLis = [], _postLis = [], _found = false;
11018                for (i = 0; i < _list.length; i++) {
11019                    if (_list[i] === listE) {
11020                        _found = true;
11021                    } else if (!_found) _preLis.push(_list[i]);
11022                    else _postLis.push(_list[i]);
11023                }
11024                var _parent = angular.element(listE.parentNode);
11025                var newElem = angular.element('<p></p>');
11026                newElem.html(angular.element(listE).html());
11027                if (_preLis.length === 0 || _postLis.length === 0) {
11028                    if (_postLis.length === 0) _parent.after(newElem);
11029                    else _parent[0].parentNode.insertBefore(newElem[0], _parent[0]);
11030
11031                    if (_preLis.length === 0 && _postLis.length === 0) _parent.remove();
11032                    else angular.element(listE).remove();
11033                } else {
11034                    var _firstList = angular.element('<' + _parent[0].tagName + '></' + _parent[0].tagName + '>');
11035                    var _secondList = angular.element('<' + _parent[0].tagName + '></' + _parent[0].tagName + '>');
11036                    for (i = 0; i < _preLis.length;
11036 i++) _firstList.append(angular.element(_preLis[i]));
11037                    for (i = 0; i < _postLis.length; i++) _secondList.append(angular.element(_postLis[i]));
11038                    _parent.after(_secondList);
11039                    _parent.after(newElem);
11040                    _parent.after(_firstList);
11041                    _parent.remove();
11042                }
11043                taSelection.setSelectionToElementEnd(newElem[0]);
11044            };
11045
11046     elementsSeen = [];
11047     if (selectedElements.length !==0) console.log(selectedElements);
11048     angular.forEach(selectedElements, function (element) {
11049                if (elementsSeen.indexOf(element) !== -1 || elementsSeen.indexOf(element.parentElement) !== -1) {
11050                    return;
11051                }
11052                elementsSeen.push(element);
11053                if (element.nodeName.toLowerCase() === 'li') {
11054                    console.log('removeListElement', element);
11055                    removeListElement(element);
11056                }
11057                else if (element.parentElement && element.parentElement.nodeName.toLowerCase() === 'li') {
11058                    console.log('removeListElement', element.parentElement);
11059                    elementsSeen.push(element.parentElement);
11060                    removeListElement(element.parentElement);
11061                }
11062            });
11063     **********************/
11064
11065    /**********************
11066     if(possibleNodes[0].tagName.toLowerCase() === 'li'){
11067                var _list = possibleNodes[0].parentNode.childNodes;
11068                var _preLis = [], _postLis = [], _found = false;
11069                for(i = 0; i < _list.length; i++){
11070                    if(_list[i] === possibleNodes[0]){
11071                        _found = true;
11072                    }else if(!_found) _preLis.push(_list[i]);
11073                    else _postLis.push(_list[i]);
11074                }
11075                var _parent = angular.element(possibleNodes[0].parentNode);
11076                var newElem = angular.element('<p></p>');
11077                newElem.html(angular.element(possibleNodes[0]).html());
11078                if(_preLis.length === 0 || _postLis.length === 0){
11079                    if(_postLis.length === 0) _parent.after(newElem);
11080                    else _parent[0].parentNode.insertBefore(newElem[0], _parent[0]);
11081
11082                    if(_preLis.length === 0 && _postLis.length === 0) _parent.remove();
11083                    else angular.element(possibleNodes[0]).remove();
11084                }else{
11085                    var _firstList = angular.element('<'+_parent[0].tagName+'></'+_parent[0].tagName+'>');
11086                    var _secondList = angular.element('<'+_parent[0].tagName+'></'+_parent[0].tagName+'>');
11087                    for(i = 0; i < _preLis.length; i++) _firstList.append(angular.element(_preLis[i]));
11088                    for(i = 0; i < _postLis.length; i++) _secondList.append(angular.element(_postLis[i]));
11089                    _parent.after(_secondList);
11090                    _parent.after(newElem);
11091                    _parent.after(_firstList);
11092                    _parent.remove();
11093                }
11094                taSelection.setSelectionToElementEnd(newElem[0]);
11095            }
11096     *******************/
11097
11098
11099    /* istanbul ignore next: if it's javascript don't worry - though probably should show some kind of error message */
11100    var blockJavascript = function (link) {
11101        if (link.toLowerCase().indexOf('javascript')!==-1) {
11102            return true;
11103        }
11104        return false;
11105    };
11106
11107    taRegisterTool('insertImage', {
11108        iconclass: 'fa fa-picture-o',
11109        tooltiptext: taTranslations.insertImage.tooltip,
11110        action: function(){
11111            var imageLink;
11112            imageLink = $window.prompt(taTranslations.insertImage.dialogPrompt, 'http://');
11113            if(imageLink && imageLink !== '' && imageLink !== 'http://'){
11114                /* istanbul ignore next: don't know how to test this... since it needs a dialogPrompt */
11115                // block javascript here
11116                if (!blockJavascript(imageLink)) {
11117                    if (taSelection.getSelectionElement().tagName && taSelection.getSelectionElement().tagName.toLowerCase() === 'a') {
11118                        // due to differences in implementation between FireFox and Chrome, we must move the
11119                        // insertion point past the <a> element, otherwise FireFox inserts inside the <a>
vendor: 7,407 bytes, lines 11120-11256
11120                        // With this change, both FireFox and Chrome behave the same way!
11121                        taSelection.setSelectionAfterElement(taSelection.getSelectionElement());
11122                    }
11123                    // In the past we used the simple statement:
11124                    //return this.$editor().wrapSelection('insertImage', imageLink, true);
11125                    //
11126                    // However on Firefox only, when the content is empty this is a problem
11127                    // See Issue #1201
11128                    // Investigation reveals that Firefox only inserts a <p> only!!!!
11129                    // So now we use insertHTML here and all is fine.
11130                    // NOTE: this is what 'insertImage' is supposed to do anyway!
11131                    var embed = '<img src="' + imageLink + '">';
11132                    return this.$editor().wrapSelection('insertHTML', embed, true);
11133                }
11134            }
11135        },
11136        onElementSelect: {
11137            element: 'img',
11138            action: taToolFunctions.imgOnSelectAction
11139        }
11140    });
11141    taRegisterTool('insertVideo', {
11142        iconclass: 'fa fa-youtube-play',
11143        tooltiptext: taTranslations.insertVideo.tooltip,
11144        action: function(){
11145            var urlPrompt;
11146            urlPrompt = $window.prompt(taTranslations.insertVideo.dialogPrompt, 'https://');
11147            // block javascript here
11148            /* istanbul ignore else: if it's javascript don't worry - though probably should show some kind of error message */
11149            if (!blockJavascript(urlPrompt)) {
11150
11151                if (urlPrompt && urlPrompt !== '' && urlPrompt !== 'https://') {
11152
11153                    videoId = taToolFunctions.extractYoutubeVideoId(urlPrompt);
11154
11155                    /* istanbul ignore else: if it's invalid don't worry - though probably should show some kind of error message */
11156                    if (videoId) {
11157                        // create the embed link
11158                        var urlLink = "https://www.youtube.com/embed/" + videoId;
11159                        // create the HTML
11160                        // for all options see: http://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api
11161                        // maxresdefault.jpg seems to be undefined on some.
11162                        var embed = '<img class="ta-insert-video" src="https://img.youtube.com/vi/' + videoId + '/hqdefault.jpg" ta-insert-video="' + urlLink + '" contenteditable="false" allowfullscreen="true" frameborder="0" />';
11163                        /* istanbul ignore next: don't know how to test this... since it needs a dialogPrompt */
11164                        if (taSelection.getSelectionElement().tagName && taSelection.getSelectionElement().tagName.toLowerCase() === 'a') {
11165                            // due to differences in implementation between FireFox and Chrome, we must move the
11166                            // insertion point past the <a> element, otherwise FireFox inserts inside the <a>
11167                            // With this change, both FireFox and Chrome behave the same way!
11168                            taSelection.setSelectionAfterElement(taSelection.getSelectionElement());
11169                        }
11170                        // insert
11171                        return this.$editor().wrapSelection('insertHTML', embed, true);
11172                    }
11173                }
11174            }
11175        },
11176        onElementSelect: {
11177            element: 'img',
11178            onlyWithAttrs: ['ta-insert-video'],
11179            action: taToolFunctions.imgOnSelectAction
11180        }
11181    });
11182    taRegisterTool('insertLink', {
11183        tooltiptext: taTranslations.insertLink.tooltip,
11184        iconclass: 'fa fa-link',
11185        action: function(){
11186            var urlLink;
11187            // if this link has already been set, we need to just edit the existing link
11188            /* istanbul ignore if: we do not test this */
11189            if (taSelection.getSelectionElement().tagName && taSelection.getSelectionElement().tagName.toLowerCase() === 'a') {
11190                urlLink = $window.prompt(taTranslations.insertLink.dialogPrompt, taSelection.getSelectionElement().href);
11191            } else {
11192                urlLink = $window.prompt(taTranslations.insertLink.dialogPrompt, 'http://');
11193            }
11194            if(urlLink && urlLink !== '' && urlLink !== 'http://'){
11195                // block javascript here
11196                /* istanbul ignore else: if it's javascript don't worry - though probably should show some kind of error message */
11197                if (!blockJavascript(urlLink)) {
11198                    return this.$editor().wrapSelection('createLink', urlLink, true);
11199                }
11200            }
11201        },
11202        activeState: function(commonElement){
11203            if(commonElement) return commonElement[0].tagName === 'A';
11204            return false;
11205        },
11206        onElementSelect: {
11207            element: 'a',
11208            action: taToolFunctions.aOnSelectAction
11209        }
11210    });
11211    taRegisterTool('wordcount', {
11212        display: '<div id="toolbarWC" style="display:block; min-width:100px;">Words: <span ng-bind="wordcount"></span></div>',
11213        disabled: true,
11214        wordcount: 0,
11215        activeState: function(){ // this fires on keyup
11216            var textElement = this.$editor().displayElements.text;
11217            /* istanbul ignore next: will default to '' when undefined */
11218            var workingHTML = textElement[0].innerHTML || '';
11219            var noOfWords = 0;
11220
11221            /* istanbul ignore if: will default to '' when undefined */
11222            if (workingHTML.replace(/\s*<[^>]*?>\s*/g, '') !== '') {
11223                if (workingHTML.trim() !== '') {
11224                    noOfWords = workingHTML.replace(/<\/?(b|i|em|strong|span|u|strikethrough|a|img|small|sub|sup|label)( [^>*?])?>/gi, '') // remove inline tags without adding spaces
11225                        .replace(/(<[^>]*?>\s*<[^>]*?>)/ig, ' ') // replace adjacent tags with possible space between with a space
11226                        .replace(/(<[^>]*?>)/ig, '') // remove any singular tags
11227                        .replace(/\s+/ig, ' ') // condense spacing
11228                        .match(/\S+/g).length; // count remaining non-space strings
11229                }
11230            }
11231
11232            //Set current scope
11233            this.wordcount = noOfWords;
11234            //Set editor scope
11235            this.$editor().wordcount = noOfWords;
11236
11237            return false;
11238        }
11239    });
11240    taRegisterTool('charcount', {
11241        display: '<div id="toolbarCC" style="display:block; min-width:120px;">Characters: <span ng-bind="charcount"></span></div>',
11242        disabled: true,
11243        charcount: 0,
11244        activeState: function(){ // this fires on keyup
11245            var textElement = this.$editor().displayElements.text;
11246            var sourceText = textElement[0].innerText || textElement[0].textContent; // to cover the non-jquery use case.
11247
11248            // Caculate number of chars
11249            var noOfChars = sourceText.replace(/(\r\n|\n|\r)/gm,"").replace(/^\s+/g,' ').replace(/\s+$/g, ' ').length;
11250            //Set current scope
11251            this.charcount = noOfChars;
11252            //Set editor scope
11253            this.$editor().charcount = noOfChars;
11254            return false;
11255        }
11256    });
vendor: 77,913 bytes, lines 11257-11798
11257}]);
11258;
11259/**
11260 * Rangy, a cross-browser JavaScript range and selection library
11261 * https://github.com/timdown/rangy
11262 *
11263 * Copyright 2015, Tim Down
11264 * Licensed under the MIT license.
11265 * Version: 1.3.0
11266 * Build date: 10 May 2015
11267 */
11268!function(a,b){"function"==typeof define&&define.amd?
11269// AMD. Register as an anonymous module.
11270define(a):"undefined"!=typeof module&&"object"==typeof exports?
11271// Node/CommonJS style
11272module.exports=a():
11273// No AMD or CommonJS support so we place Rangy in (probably) the global variable
11274b.rangy=a()}(function(){/*----------------------------------------------------------------------------------------------------------------*/
11275// Trio of functions taken from Peter Michaux's article:
11276// http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
11277function a(a,b){var c=typeof a[b];return c==u||!(c!=t||!a[b])||"unknown"==c}function b(a,b){return!(typeof a[b]!=t||!a[b])}function c(a,b){return typeof a[b]!=v}
11278// Creates a convenience function to save verbose repeated calls to tests functions
11279function d(a){return function(b,c){for(var d=c.length;d--;)if(!a(b,c[d]))return!1;return!0}}function e(a){return a&&A(a,z)&&C(a,y)}function f(a){return b(a,"body")?a.body:a.getElementsByTagName("body")[0]}function g(b){typeof console!=v&&a(console,"log")&&console.log(b)}function h(a,b){F&&b?alert(a):g(a)}function i(a){H.initialized=!0,H.supported=!1,h("Rangy is not supported in this environment. Reason: "+a,H.config.alertOnFail)}function j(a){h("Rangy warning: "+a,H.config.alertOnWarn)}function k(a){return a.message||a.description||String(a)}
11280// Initialization
11281function l(){if(F&&!H.initialized){var b,c=!1,d=!1;
11282// First, perform basic feature tests
11283a(document,"createRange")&&(b=document.createRange(),A(b,x)&&C(b,w)&&(c=!0));var h=f(document);if(!h||"body"!=h.nodeName.toLowerCase())return void i("No body element found");if(h&&a(h,"createTextRange")&&(b=h.createTextRange(),e(b)&&(d=!0)),!c&&!d)return void i("Neither Range nor TextRange are available");H.initialized=!0,H.features={implementsDomRange:c,implementsTextRange:d};
11284// Initialize modules
11285var j,l;for(var m in E)(j=E[m])instanceof p&&j.init(j,H);
11286// Call init listeners
11287for(var n=0,o=K.length;n<o;++n)try{K[n](H)}catch(a){l="Rangy init listener threw an exception. Continuing. Detail: "+k(a),g(l)}}}function m(a,b,c){c&&(a+=" in module "+c.name),H.warn("DEPRECATED: "+a+" is deprecated. Please use "+b+" instead.")}function n(a,b,c,d){a[b]=function(){return m(b,c,d),a[c].apply(a,G.toArray(arguments))}}function o(a){a=a||window,l();
11288// Notify listeners
11289for(var b=0,c=L.length;b<c;++b)L[b](a)}function p(a,b,c){this.name=a,this.dependencies=b,this.initialized=!1,this.supported=!1,this.initializer=c}function q(a,b,c){var d=new p(a,b,function(b){if(!b.initialized){b.initialized=!0;try{c(H,b),b.supported=!0}catch(b){var d="Module '"+a+"' failed to load: "+k(b);g(d),b.stack&&g(b.stack)}}});return E[a]=d,d}/*----------------------------------------------------------------------------------------------------------------*/
11290// Ensure rangy.rangePrototype and rangy.selectionPrototype are available immediately
11291function r(){}function s(){}var t="object",u="function",v="undefined",w=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],x=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],y=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],z=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],A=d(a),B=d(b),C=d(c),D=[].forEach?function(a,b){a.forEach(b)}:function(a,b){for(var c=0,d=a.length;c<d;++c)b(a[c],c)},E={},F=typeof window!=v&&typeof document!=v,G={isHostMethod:a,isHostObject:b,isHostProperty:c,areHostMethods:A,areHostObjects:B,areHostProperties:C,isTextRange:e,getBody:f,forEach:D},H={version:"1.3.0",initialized:!1,isBrowser:F,supported:!0,util:G,features:{},modules:E,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==v||rangyAutoInitialize}};H.fail=i,H.warn=j;
11292// Add utility extend() method
11293var I;({}).hasOwnProperty?(G.extend=I=function(a,b,c){var d,e;for(var f in b)b.hasOwnProperty(f)&&(d=a[f],e=b[f],c&&null!==d&&"object"==typeof d&&null!==e&&"object"==typeof e&&I(d,e,!0),a[f]=e);
11294// Special case for toString, which does not show up in for...in loops in IE <= 8
11295return b.hasOwnProperty("toString")&&(a.toString=b.toString),a},G.createOptions=function(a,b){var c={};return I(c,b),a&&I(c,a),c}):i("hasOwnProperty not supported"),
11296// Test whether we're in a browser and bail out if not
11297F||i("Rangy can only run in a browser"),
11298// Test whether Array.prototype.slice can be relied on for NodeLists and use an alternative toArray() if not
11299function(){var a;if(F){var b=document.createElement("div");b.appendChild(document.createElement("span"));var c=[].slice;try{1==c.call(b.childNodes,0)[0].nodeType&&(a=function(a){return c.call(a,0)})}catch(a){}}a||(a=function(a){for(var b=[],c=0,d=a.length;c<d;++c)b[c]=a[c];return b}),G.toArray=a}();
11300// Very simple event handler wrapper function that doesn't attempt to solve issues such as "this" handling or
11301// normalization of event properties
11302var J;F&&(a(document,"addEventListener")?J=function(a,b,c){a.addEventListener(b,c,!1)}:a(document,"attachEvent")?J=function(a,b,c){a.attachEvent("on"+b,c)}:i("Document does not have required addEventListener or attachEvent method"),G.addListener=J);var K=[];G.deprecationNotice=m,G.createAliasForDeprecatedMethod=n,
11303// Allow external scripts to initialize this library in case it's loaded after the document has loaded
11304H.init=l,
11305// Execute listener immediately if already initialized
11306H.addInitListener=function(a){H.initialized?a(H):K.push(a)};var L=[];H.addShimListener=function(a){L.push(a)},F&&(H.shim=H.createMissingNativeApi=o,n(H,"createMissingNativeApi","shim")),p.prototype={init:function(){for(var a,b,c=this.dependencies||[],d=0,e=c.length;d<e;++d){if(b=c[d],a=E[b],!(a&&a instanceof p))throw new Error("required module '"+b+"' not found");if(a.init(),!a.supported)throw new Error("required module '"+b+"' not supported")}
11307// Now run initializer
11308this.initializer(this)},fail:function(a){throw this.initialized=!0,this.supported=!1,new Error(a)},warn:function(a){H.warn("Module "+this.name+": "+a)},deprecationNotice:function(a,b){H.warn("DEPRECATED: "+a+" in module "+this.name+" is deprecated. Please use "+b+" instead")},createError:function(a){return new Error("Error in Rangy "+this.name+" module: "+a)}},H.createModule=function(a){
11309// Allow 2 or 3 arguments (second argument is an optional array of dependencies)
11310var b,c;2==arguments.length?(b=arguments[1],c=[]):(b=arguments[2],c=arguments[1]);var d=q(a,c,b);
11311// Initialize the module immediately if the core is already initialized
11312H.initialized&&H.supported&&d.init()},H.createCoreModule=function(a,b,c){q(a,b,c)},H.RangePrototype=r,H.rangePrototype=new r,H.selectionPrototype=new s,/*----------------------------------------------------------------------------------------------------------------*/
11313// DOM utility methods used by Rangy
11314H.createCoreModule("DomUtil",[],function(a,b){
11315// Opera 11 puts HTML elements in the null namespace, it seems, and IE 7 has undefined namespaceURI
11316function c(a){var b;return typeof a.namespaceURI==F||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"==b}function d(a){var b=a.parentNode;return 1==b.nodeType?b:null}function e(a){for(var b=0;a=a.previousSibling;)++b;return b}function f(a){switch(a.nodeType){case 7:case 10:return 0;case 3:case 8:return a.length;default:return a.childNodes.length}}function g(a,b){var c,d=[];for(c=a;c;c=c.parentNode)d.push(c);for(c=b;c;c=c.parentNode)if(K(d,c))return c;return null}function h(a,b,c){for(var d=c?b:b.parentNode;d;){if(d===a)return!0;d=d.parentNode}return!1}function i(a,b){return h(a,b,!0)}function j(a,b,c){for(var d,e=c?a:a.parentNode;e;){if(d=e.parentNode,d===b)return e;e=d}return null}function k(a){var b=a.nodeType;return 3==b||4==b||8==b}function l(a){if(!a)return!1;var b=a.nodeType;return 3==b||8==b}function m(a,b){var c=b.nextSibling,d=b.parentNode;return c?d.insertBefore(a,c):d.appendChild(a),a}
11317// Note that we cannot use splitText() because it is bugridden in IE 9.
11318function n(a,b,c){var d=a.cloneNode(!1);
11319// Preserve positions
11320if(d.deleteData(0,b),a.deleteData(b,a.length-b),m(d,a),c)for(var f,g=0;f=c[g++];)
11321// Handle case where position was inside the portion of node after the split point
11322f.node==a&&f.offset>b?(f.node=d,f.offset-=b):f.node==a.parentNode&&f.offset>e(a)&&++f.offset;return d}function o(a){if(9==a.nodeType)return a;if(typeof a.ownerDocument!=F)return a.ownerDocument;if(typeof a.document!=F)return a.document;if(a.parentNode)return o(a.parentNode);throw b.createError("getDocument: no document found for node")}function p(a){var c=o(a);if(typeof c.defaultView!=F)return c.defaultView;if(typeof c.parentWindow!=F)return c.parentWindow;throw b.createError("Cannot get a window object for node")}function q(a){if(typeof a.contentDocument!=F)return a.contentDocument;if(typeof a.contentWindow!=F)return a.contentWindow.document;throw b.createError("getIframeDocument: No Document object found for iframe element")}function r(a){if(typeof a.contentWindow!=F)return a.contentWindow;if(typeof a.contentDocument!=F)return a.contentDocument.defaultView;throw b.createError("getIframeWindow: No Window object found for iframe element")}
11323// This looks bad. Is it worth it?
11324function s(a){return a&&G.isHostMethod(a,"setTimeout")&&G.isHostObject(a,"document")}function t(a,b,c){var d;if(a?G.isHostProperty(a,"nodeType")?d=1==a.nodeType&&"iframe"==a.tagName.toLowerCase()?q(a):o(a):s(a)&&(d=a.document):d=document,!d)throw b.createError(c+"(): Parameter must be a Window object or DOM node");return d}function u(a){for(var b;b=a.parentNode;)a=b;return a}function v(a,c,d,f){
11325// See http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Comparing
11326var h,i,k,l,m;if(a==d)
11327// Case 1: nodes are the same
11328return c===f?0:c<f?-1:1;if(h=j(d,a,!0))
11329// Case 2: node C (container B or an ancestor) is a child node of A
11330return c<=e(h)?-1:1;if(h=j(a,d,!0))
11331// Case 3: node C (container A or an ancestor) is a child node of B
11332return e(h)<f?-1:1;if(i=g(a,d),!i)throw new Error("comparePoints error: nodes have no common ancestor");if(
11333// Case 4: containers are siblings or descendants of siblings
11334k=a===i?i:j(a,i,!0),l=d===i?i:j(d,i,!0),k===l)
11335// This shouldn't be possible
11336throw b.createError("comparePoints got to case 4 and childA and childB are the same!");for(m=i.firstChild;m;){if(m===k)return-1;if(m===l)return 1;m=m.nextSibling}}function w(a){var b;try{return b=a.parentNode,!1}catch(a){return!0}}/*----------------------------------------------------------------------------------------------------------------*/
11337function x(a){if(!a)return"[No node]";if(L&&w(a))return"[Broken node]";if(k(a))return'"'+a.data+'"';if(1==a.nodeType){var b=a.id?' id="'+a.id+'"':"";return"<"+a.nodeName+b+">[index:"+e(a)+",length:"+a.childNodes.length+"]["+(a.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return a.nodeName}function y(a){for(var b,c=o(a).createDocumentFragment();b=a.firstChild;)c.appendChild(b);return c}function z(a,b,c){var d=H(a),e=a.createElement("div");e.contentEditable=""+!!c,b&&(e.innerHTML=b);
11338// Insert the test element at the start of the body to prevent scrolling to the bottom in iOS (issue #292)
11339var f=d.firstChild;return f?d.insertBefore(e,f):d.appendChild(e),e}function A(a){return a.parentNode.removeChild(a)}function B(a){this.root=a,this._next=a}function C(a){return new B(a)}function D(a,b){this.node=a,this.offset=b}function E(a){this.code=this[a],this.codeName=a,this.message="DOMException: "+this.codeName}var F="undefined",G=a.util,H=G.getBody;
11340// Perform feature tests
11341G.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||b.fail("document missing a Node creation method"),G.isHostMethod(document,"getElementsByTagName")||b.fail("document missing getElementsByTagName method");var I=document.createElement("div");G.areHostMethods(I,["insertBefore","appendChild","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"]))||b.fail("Incomplete Element implementation"),
11342// innerHTML is required for Range's createContextualFragment method
11343G.isHostProperty(I,"innerHTML")||b.fail("Element is missing innerHTML property");var J=document.createTextNode("test");G.areHostMethods(J,["splitText","deleteData","insertData","appendData","cloneNode"]||!G.areHostObjects(I,["previousSibling","nextSibling","childNodes","parentNode"])||!G.areHostProperties(J,["data"]))||b.fail("Incomplete Text Node implementation");/*----------------------------------------------------------------------------------------------------------------*/
11344// Removed use of indexOf because of a bizarre bug in Opera that is thrown in one of the Acid3 tests. I haven't been
11345// able to replicate it outside of the test. The bug is that indexOf returns -1 when called on an Array that
11346// contains just the document as a single element and the value searched for is the document.
11347var K=/*Array.prototype.indexOf ?
11348            function(arr, val) {
11349                return arr.indexOf(val) > -1;
11350            }:*/
11351function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1},L=!1;!function(){var b=document.createElement("b");b.innerHTML="1";var c=b.firstChild;b.innerHTML="<br />",L=w(c),a.features.crashyTextNodes=L}();var M;typeof window.getComputedStyle!=F?M=function(a,b){return p(a).getComputedStyle(a,null)[b]}:typeof document.documentElement.currentStyle!=F?M=function(a,b){return a.currentStyle?a.currentStyle[b]:""}:b.fail("No means of obtaining computed style properties found"),B.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a,b,c=this._current=this._next;if(this._current)if(a=c.firstChild)this._next=a;else{for(b=null;c!==this.root&&!(b=c.nextSibling);)c=c.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=null}},D.prototype={equals:function(a){return!!a&&this.node===a.node&&this.offset==a.offset},inspect:function(){return"[DomPosition("+x(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},E.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},E.prototype.toString=function(){return this.message},a.dom={arrayContains:K,isHtmlNamespace:c,parentElement:d,getNodeIndex:e,getNodeLength:f,getCommonAncestor:g,isAncestorOf:h,isOrIsAncestorOf:i,getClosestAncestorIn:j,isCharacterDataNode:k,isTextOrCommentNode:l,insertAfter:m,splitDataNode:n,getDocument:o,getWindow:p,getIframeWindow:r,getIframeDocument:q,getBody:H,isWindow:s,getContentDocument:t,getRootContainer:u,comparePoints:v,isBrokenNode:w,inspectNode:x,getComputedStyleProperty:M,createTestElement:z,removeNode:A,fragmentFromNodeChildren:y,createIterator:C,DomPosition:D},a.DOMException=E}),/*----------------------------------------------------------------------------------------------------------------*/
11352// Pure JavaScript implementation of DOM Range
11353H.createCoreModule("DomRange",["DomUtil"],function(a,b){/*----------------------------------------------------------------------------------------------------------------*/
11354// Utility functions
11355function c(a,b){return 3!=a.nodeType&&(P(a,b.startContainer)||P(a,b.endContainer))}function d(a){return a.document||Q(a.startContainer)}function e(a){return W(a.startContainer)}function f(a){return new L(a.parentNode,O(a))}function g(a){return new L(a.parentNode,O(a)+1)}function h(a,b,c){var d=11==a.nodeType?a.firstChild:a;return N(b)?c==b.length?J.insertAfter(a,b):b.parentNode.insertBefore(a,0==c?b:S(b,c)):c>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]),d}function i(a,b,c){if(z(a),z(b),d(b)!=d(a))throw new M("WRONG_DOCUMENT_ERR");var e=R(a.startContainer,a.startOffset,b.endContainer,b.endOffset),f=R(a.endContainer,a.endOffset,b.startContainer,b.startOffset);return c?e<=0&&f>=0:e<0&&f>0}function j(a){for(var b,c,e,f=d(a.range).createDocumentFragment();c=a.next();){if(b=a.isPartiallySelectedSubtree(),c=c.cloneNode(!b),b&&(e=a.getSubtreeIterator(),c.appendChild(j(e)),e.detach()),10==c.nodeType)// DocumentType
11356throw new M("HIERARCHY_REQUEST_ERR");f.appendChild(c)}return f}function k(a,b,c){var d,e;c=c||{stop:!1};for(var f,g;f=a.next();)if(a.isPartiallySelectedSubtree()){if(b(f)===!1)return void(c.stop=!0);if(
11357// The node is partially selected by the Range, so we can use a new RangeIterator on the portion of
11358// the node selected by the Range.
11359g=a.getSubtreeIterator(),k(g,b,c),g.detach(),c.stop)return}else for(
11360// The whole node is selected, so we can use efficient DOM iteration to iterate over the node and its
11361// descendants
11362d=J.createIterator(f);e=d.next();)if(b(e)===!1)return void(c.stop=!0)}function l(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),l(b),b.detach()):a.remove()}function m(a){for(var b,c,e=d(a.range).createDocumentFragment();b=a.next();){if(a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),c=a.getSubtreeIterator(),b.appendChild(m(c)),c.detach()):a.remove(),10==b.nodeType)// DocumentType
11363throw new M("HIERARCHY_REQUEST_ERR");e.appendChild(b)}return e}function n(a,b,c){var d,e=!(!b||!b.length),f=!!c;e&&(d=new RegExp("^("+b.join("|")+")$"));var g=[];return k(new p(a,!1),function(b){if((!e||d.test(b.nodeType))&&(!f||c(b))){
11364// Don't include a boundary container if it is a character data node and the range does not contain any
11365// of its character data. See issue 190.
11366var h=a.startContainer;if(b!=h||!N(h)||a.startOffset!=h.length){var i=a.endContainer;b==i&&N(i)&&0==a.endOffset||g.push(b)}}}),g}function o(a){var b="undefined"==typeof a.getName?"Range":a.getName();return"["+b+"("+J.inspectNode(a.startContainer)+":"+a.startOffset+", "+J.inspectNode(a.endContainer)+":"+a.endOffset+")]"}/*----------------------------------------------------------------------------------------------------------------*/
11367// RangeIterator code partially borrows from IERange by Tim Ryan (http://github.com/timcameronryan/IERange)
11368function p(a,b){if(this.range=a,this.clonePartiallySelectedTextNodes=b,!a.collapsed){this.sc=a.startContainer,this.so=a.startOffset,this.ec=a.endContainer,this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&N(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==c||N(this.sc)?T(this.sc,c,!0):this.sc.childNodes[this.so],this._last=this.ec!==c||N(this.ec)?T(this.ec,c,!0):this.ec.childNodes[this.eo-1])}}function q(a){return function(b,c){for(var d,e=c?b:b.parentNode;e;){if(d=e.nodeType,V(a,d))return e;e=e.parentNode}return null}}function r(a,b){if(ea(a,b))throw new M("INVALID_NODE_TYPE_ERR")}function s(a,b){if(!V(b,a.nodeType))throw new M("INVALID_NODE_TYPE_ERR")}function t(a,b){if(b<0||b>(N(a)?a.length:a.childNodes.length))throw new M("INDEX_SIZE_ERR")}function u(a,b){if(ca(a,!0)!==ca(b,!0))throw new M("WRONG_DOCUMENT_ERR")}function v(a){if(da(a,!0))throw new M("NO_MODIFICATION_ALLOWED_ERR")}function w(a,b){if(!a)throw new M(b)}function x(a,b){return b<=(N(a)?a.length:a.childNodes.length)}function y(a){return!!a.startContainer&&!!a.endContainer&&!(X&&(J.isBrokenNode(a.startContainer)||J.isBrokenNode(a.endContainer)))&&W(a.startContainer)==W(a.endContainer)&&x(a.startContainer,a.startOffset)&&x(a.endContainer,a.endOffset)}function z(a){if(!y(a))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+a.inspect()+")")}function A(a,b){z(a);var c=a.startContainer,d=a.startOffset,e=a.endContainer,f=a.endOffset,g=c===e;N(e)&&f>0&&f<e.length&&S(e,f,b),N(c)&&d>0&&d<c.length&&(c=S(c,d,b),g?(f-=d,e=c):e==c.parentNode&&f>=O(c)&&f++,d=0),a.setStartAndEnd(c,d,e,f)}function B(a){z(a);var b=a.commonAncestorContainer.parentNode.cloneNode(!1);return b.appendChild(a.cloneContents()),b.innerHTML}function C(a){a.START_TO_START=ja,a.START_TO_END=ka,a.END_TO_END=la,a.END_TO_START=ma,a.NODE_BEFORE=na,a.NODE_AFTER=oa,a.NODE_BEFORE_AND_AFTER=pa,a.NODE_INSIDE=qa}function D(a){C(a),C(a.prototype)}function E(a,b){return function(){z(this);var c,d,e=this.startContainer,f=this.startOffset,h=this.commonAncestorContainer,i=new p(this,!0);e!==h&&(c=T(e,h,!0),d=g(c),e=d.node,f=d.offset),
11369// Check none of the range is read-only
11370k(i,v),i.reset();
11371// Remove the content
11372var j=a(i);
11373// Move to the new position
11374return i.detach(),b(this,e,f,e,f),j}}function F(b,d){function e(a,b){return function(c){s(c,Z),s(W(c),$);var d=(a?f:g)(c);(b?h:i)(this,d.node,d.offset)}}function h(a,b,c){var e=a.endContainer,f=a.endOffset;b===a.startContainer&&c===a.startOffset||(
11375// Check the root containers of the range and the new boundary, and also check whether the new boundary
11376// is after the current end. In either case, collapse the range to the new position
11377W(b)==W(e)&&1!=R(b,c,e,f)||(e=b,f=c),d(a,b,c,e,f))}function i(a,b,c){var e=a.startContainer,f=a.startOffset;b===a.endContainer&&c===a.endOffset||(
11378// Check the root containers of the range and the new boundary, and also check whether the new boundary
11379// is after the current end. In either case, collapse the range to the new position
11380W(b)==W(e)&&R(b,c,e,f)!=-1||(e=b,f=c),d(a,e,f,b,c))}
11381// Set up inheritance
11382var j=function(){};j.prototype=a.rangePrototype,b.prototype=new j,K.extend(b.prototype,{setStart:function(a,b){r(a,!0),t(a,b),h(this,a,b)},setEnd:function(a,b){r(a,!0),t(a,b),i(this,a,b)},/**
11383                 * Convenience method to set a range's start and end boundaries. Overloaded as follows:
11384                 * - Two parameters (node, offset) creates a collapsed range at that position
11385                 * - Three parameters (node, startOffset, endOffset) creates a range contained with node starting at
11386                 *   startOffset and ending at endOffset
11387                 * - Four parameters (startNode, startOffset, endNode, endOffset) creates a range starting at startOffset in
11388                 *   startNode and ending at endOffset in endNode
11389                 */
11390setStartAndEnd:function(){var a=arguments,b=a[0],c=a[1],e=b,f=c;switch(a.length){case 3:f=a[2];break;case 4:e=a[2],f=a[3]}d(this,b,c,e,f)},setBoundary:function(a,b,c){this["set"+(c?"Start":"End")](a,b)},setStartBefore:e(!0,!0),setStartAfter:e(!1,!0),setEndBefore:e(!0,!1),setEndAfter:e(!1,!1),collapse:function(a){z(this),a?d(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){r(a,!0),d(this,a,0,a,U(a))},selectNode:function(a){r(a,!1),s(a,Z);var b=f(a),c=g(a);d(this,b.node,b.offset,c.node,c.offset)},extractContents:E(m,d),deleteContents:E(l,d),canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);
11391// Check if the contents can be surrounded. Specifically, this means whether the range partially selects
11392// no non-text nodes.
11393var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},splitBoundaries:function(){A(this)},splitBoundariesPreservingPositions:function(a){A(this,a)},normalizeBoundaries:function(){z(this);var a,b=this.startContainer,c=this.startOffset,e=this.endContainer,f=this.endOffset,g=function(a){var b=a.nextSibling;b&&b.nodeType==a.nodeType&&(e=a,f=a.length,a.appendData(b.data),Y(b))},h=function(a){var d=a.previousSibling;if(d&&d.nodeType==a.nodeType){b=a;var g=a.length;if(c=d.length,a.insertData(0,d.data),Y(d),b==e)f+=c,e=b;else if(e==a.parentNode){var h=O(a);f==h?(e=a,f=g):f>h&&f--}}},i=!0;if(N(e))f==e.length?g(e):0==f&&(a=e.previousSibling,a&&a.nodeType==e.nodeType&&(f=a.length,b==e&&(i=!1),a.appendData(e.data),Y(e),e=a));else{if(f>0){var j=e.childNodes[f-1];j&&N(j)&&g(j)}i=!this.collapsed}if(i){if(N(b))0==c?h(b):c==b.length&&(a=b.nextSibling,a&&a.nodeType==b.nodeType&&(e==a&&(e=b,f+=b.length),b.appendData(a.data),Y(a)));else if(c<b.childNodes.length){var k=b.childNodes[c];k&&N(k)&&h(k)}}else b=e,c=f;d(this,b,c,e,f)},collapseToPoint:function(a,b){r(a,!0),t(a,b),this.setStartAndEnd(a,b)}}),D(b)}/*----------------------------------------------------------------------------------------------------------------*/
11394// Updates commonAncestorContainer and collapsed after boundary change
11395function G(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset,a.commonAncestorContainer=a.collapsed?a.startContainer:J.getCommonAncestor(a.startContainer,a.endContainer)}function H(a,b,c,d,e){a.startContainer=b,a.startOffset=c,a.endContainer=d,a.endOffset=e,a.document=J.getDocument(b),G(a)}function I(a){this.startContainer=a,this.startOffset=0,this.endContainer=a,this.endOffset=0,this.document=a,G(this)}var J=a.dom,K=a.util,L=J.DomPosition,M=a.DOMException,N=J.isCharacterDataNode,O=J.getNodeIndex,P=J.isOrIsAncestorOf,Q=J.getDocument,R=J.comparePoints,S=J.splitDataNode,T=J.getClosestAncestorIn,U=J.getNodeLength,V=J.arrayContains,W=J.getRootContainer,X=a.features.crashyTextNodes,Y=J.removeNode;p.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null,this._next=this._first},hasNext:function(){return!!this._next},next:function(){
11396// Move to next node
11397var a=this._current=this._next;
11398// Check for partially selected text nodes
11399return a&&(this._next=a!==this._last?a.nextSibling:null,N(a)&&this.clonePartiallySelectedTextNodes&&(a===this.ec&&(a=a.cloneNode(!0)).deleteData(this.eo,a.length-this.eo),this._current===this.sc&&(a=a.cloneNode(!0)).deleteData(0,this.so))),a},remove:function(){var a,b,c=this._current;!N(c)||c!==this.sc&&c!==this.ec?c.parentNode&&Y(c):(a=c===this.sc?this.so:0,b=c===this.ec?this.eo:c.length,a!=b&&c.deleteData(a,b-a))},
11400// Checks if the current node is partially selected
11401isPartiallySelectedSubtree:function(){var a=this._current;return c(a,this.range)},getSubtreeIterator:function(){var a;if(this.isSingleCharacterDataNode)a=this.range.cloneRange(),a.collapse(!1);else{a=new I(d(this.range));var b=this._current,c=b,e=0,f=b,g=U(b);P(b,this.sc)&&(c=this.sc,e=this.so),P(b,this.ec)&&(f=this.ec,g=this.eo),H(a,c,e,f,g)}return new p(a,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};/*----------------------------------------------------------------------------------------------------------------*/
11402var Z=[1,3,4,5,7,8,10],$=[2,9,11],_=[5,6,10,12],aa=[1,3,4,5,7,8,10,11],ba=[1,3,4,5,7,8],ca=q([9,11]),da=q(_),ea=q([6,10,12]),fa=document.createElement("style"),ga=!1;try{fa.innerHTML="<b>x</b>",ga=3==fa.firstChild.nodeType}catch(a){}a.features.htmlParsingConforms=ga;var ha=ga?
11403// Implementation as per HTML parsing spec, trusting in the browser's implementation of innerHTML. See
11404// discussion and base code for this implementation at issue 67.
11405// Spec: http://html5.org/specs/dom-parsing.html#extensions-to-the-range-interface
11406// Thanks to Aleks Williams.
11407function(a){
11408// "Let node the context object's start's node."
11409var b=this.startContainer,c=Q(b);
11410// "If the context object's start's node is null, raise an INVALID_STATE_ERR
11411// exception and abort these steps."
11412if(!b)throw new M("INVALID_STATE_ERR");
11413// "Let element be as follows, depending on node's interface:"
11414// Document, Document Fragment: null
11415var d=null;
11416// "If this raises an exception, then abort these steps. Otherwise, let new
11417// children be the nodes returned."
11418// "Let fragment be a new DocumentFragment."
11419// "Append all new children to fragment."
11420// "Return fragment."
11421// "Element: node"
11422// "If either element is null or element's ownerDocument is an HTML document
11423// and element's local name is "html" and element's namespace is the HTML
11424// namespace"
11425// "let element be a new Element with "body" as its local name and the HTML
11426// namespace as its namespace.""
11427// "If the node's document is an HTML document: Invoke the HTML fragment parsing algorithm."
11428// "If the node's document is an XML document: Invoke the XML fragment parsing algorithm."
11429// "In either case, the algorithm must be invoked with fragment as the input
11430// and element as the context element."
11431return 1==b.nodeType?d=b:N(b)&&(d=J.parentElement(b)),d=null===d||"HTML"==d.nodeName&&J.isHtmlNamespace(Q(d).documentElement)&&J.isHtmlNamespace(d)?c.createElement("body"):d.cloneNode(!1),d.innerHTML=a,J.fragmentFromNodeChildren(d)}:
11432// In this case, innerHTML cannot be trusted, so fall back to a simpler, non-conformant implementation that
11433// previous versions of Rangy used (with the exception of using a body element rather than a div)
11434function(a){var b=d(this),c=b.createElement("body");return c.innerHTML=a,J.fragmentFromNodeChildren(c)},ia=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],ja=0,ka=1,la=2,ma=3,na=0,oa=1,pa=2,qa=3;K.extend(a.rangePrototype,{compareBoundaryPoints:function(a,b){z(this),u(this.startContainer,b.startContainer);var c,d,e,f,g=a==ma||a==ja?"start":"end",h=a==ka||a==ja?"start":"end";return c=this[g+"Container"],d=this[g+"Offset"],e=b[h+"Container"],f=b[h+"Offset"],R(c,d,e,f)},insertNode:function(a){if(z(this),s(a,aa),v(this.startContainer),P(a,this.startContainer))throw new M("HIERARCHY_REQUEST_ERR");
11435// No check for whether the container of the start of the Range is of a type that does not allow
11436// children of the type of node: the browser's DOM implementation should do this for us when we attempt
11437// to add the node
11438var b=h(a,this.startContainer,this.startOffset);this.setStartBefore(b)},cloneContents:function(){z(this);var a,b;if(this.collapsed)return d(this).createDocumentFragment();if(this.startContainer===this.endContainer&&N(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=d(this).createDocumentFragment(),b.appendChild(a),b;var c=new p(this,!0);return a=j(c),c.detach(),a},canSurroundContents:function(){z(this),v(this.startContainer),v(this.endContainer);
11439// Check if the contents can be surrounded. Specifically, this means whether the range partially selects
11440// no non-text nodes.
11441var a=new p(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);return a.detach(),!b},surroundContents:function(a){if(s(a,ba),!this.canSurroundContents())throw new M("INVALID_STATE_ERR");
11442// Extract the contents
11443var b=this.extractContents();
11444// Clear the children of the node
11445if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);
11446// Insert the new node and add the extracted contents
11447h(a,this.startContainer,this.startOffset),a.appendChild(b),this.selectNode(a)},cloneRange:function(){z(this);for(var a,b=new I(d(this)),c=ia.length;c--;)a=ia[c],b[a]=this[a];return b},toString:function(){z(this);var a=this.startContainer;if(a===this.endContainer&&N(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],c=new p(this,!0);return k(c,function(a){
11448// Accept only text or CDATA nodes, not comments
114493!=a.nodeType&&4!=a.nodeType||b.push(a.data)}),c.detach(),b.join("")},
11450// The methods below are all non-standard. The following batch were introduced by Mozilla but have since
11451// been removed from Mozilla.
11452compareNode:function(a){z(this);var b=a.parentNode,c=O(a);if(!b)throw new M("NOT_FOUND_ERR");var d=this.comparePoint(b,c),e=this.comparePoint(b,c+1);return d<0?e>0?pa:na:e>0?oa:qa},comparePoint:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)<0?-1:R(a,b,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:ha,toHtml:function(){return B(this)},
11453// touchingIsIntersecting determines whether this method considers a node that borders a range intersects
11454// with it (as in WebKit) or not (as in Gecko pre-1.9, and the default)
11455intersectsNode:function(a,b){if(z(this),W(a)!=e(this))return!1;var c=a.parentNode,d=O(a);if(!c)return!0;var f=R(c,d,this.endContainer,this.endOffset),g=R(c,d+1,this.startContainer,this.startOffset);return b?f<=0&&g>=0:f<0&&g>0},isPointInRange:function(a,b){return z(this),w(a,"HIERARCHY_REQUEST_ERR"),u(a,this.startContainer),R(a,b,this.startContainer,this.startOffset)>=0&&R(a,b,this.endContainer,this.endOffset)<=0},
11456// The methods below are non-standard and invented by me.
11457// Sharing a boundary start-to-end or end-to-start does not count as intersection.
11458intersectsRange:function(a){return i(this,a,!1)},
11459// Sharing a boundary start-to-end or end-to-start does count as intersection.
11460intersectsOrTouchesRange:function(a){return i(this,a,!0)},intersection:function(a){if(this.intersectsRange(a)){var b=R(this.startContainer,this.startOffset,a.startContainer,a.startOffset),c=R(this.endContainer,this.endOffset,a.endContainer,a.endOffset),d=this.cloneRange();return b==-1&&d.setStart(a.startContainer,a.startOffset),1==c&&d.setEnd(a.endContainer,a.endOffset),d}return null},union:function(a){if(this.intersectsOrTouchesRange(a)){var b=this.cloneRange();return R(a.startContainer,a.startOffset,this.startContainer,this.startOffset)==-1&&b.setStart(a.startContainer,a.startOffset),1==R(a.endContainer,a.endOffset,this.endContainer,this.endOffset)&&b.setEnd(a.endContainer,a.endOffset),b}throw new M("Ranges do not intersect")},containsNode:function(a,b){return b?this.intersectsNode(a,!1):this.compareNode(a)==qa},containsNodeContents:function(a){return this.comparePoint(a,0)>=0&&this.comparePoint(a,U(a))<=0},containsRange:function(a){var b=this.intersection(a);return null!==b&&a.equals(b)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var c=b.getNodes([3]);if(c.length>0){b.setStart(c[0],0);var d=c.pop();return b.setEnd(d,d.length),this.containsRange(b)}return this.containsNodeContents(a)},getNodes:function(a,b){return z(this),n(this,a,b)},getDocument:function(){return d(this)},collapseBefore:function(a){this.setEndBefore(a),this.collapse(!1)},collapseAfter:function(a){this.setStartAfter(a),this.collapse(!0)},getBookmark:function(b){var c=d(this),e=a.createRange(c);b=b||J.getBody(c),e.selectNodeContents(b);var f=this.intersection(e),g=0,h=0;return f&&(e.setEnd(f.startContainer,f.startOffset),g=e.toString().length,h=g+f.toString().length),{start:g,end:h,containerNode:b}},moveToBookmark:function(a){var b=a.containerNode,c=0;this.setStart(b,0),this.collapse(!0);for(var d,e,f,g,h=[b],i=!1,j=!1;!j&&(d=h.pop());)if(3==d.nodeType)e=c+d.length,!i&&a.start>=c&&a.start<=e&&(this.setStart(d,a.start-c),i=!0),i&&a.end>=c&&a.end<=e&&(this.setEnd(d,a.end-c),j=!0),c=e;else for(g=d.childNodes,f=g.length;f--;)h.push(g[f])},getName:function(){return"DomRange"},equals:function(a){return I.rangesEqual(this,a)},isValid:function(){return y(this)},inspect:function(){return o(this)},detach:function(){}}),F(I,H),K.extend(I,{rangeProperties:ia,RangeIterator:p,copyComparisonConstants:D,createPrototypeRange:F,inspect:o,toHtml:B,getRangeDocument:d,rangesEqual:function(a,b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===b.endOffset}}),a.DomRange=I}),/*----------------------------------------------------------------------------------------------------------------*/
11461// Wrappers for the browser's native DOM Range and/or TextRange implementation
11462H.createCoreModule("WrappedRange",["DomRange"],function(a,b){var c,d,e=a.dom,f=a.util,g=e.DomPosition,h=a.DomRange,i=e.getBody,j=e.getContentDocument,k=e.isCharacterDataNode;if(/*----------------------------------------------------------------------------------------------------------------*/
11463a.features.implementsDomRange&&
11464// This is a wrapper around the browser's native DOM Range. It has two aims:
11465// - Provide workarounds for specific browser bugs
11466// - provide convenient extensions, which are inherited from Rangy's DomRange
11467!function(){function d(a){for(var b,c=m.length;c--;)b=m[c],a[b]=a.nativeRange[b];
11468// Fix for broken collapsed property in IE 9.
11469a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset}function g(a,b,c,d,e){var f=a.startContainer!==b||a.startOffset!=c,g=a.endContainer!==d||a.endOffset!=e,h=!a.equals(a.nativeRange);
11470// Always set both boundaries for the benefit of IE9 (see issue 35)
11471(f||g||h)&&(a.setEnd(d,e),a.setStart(b,c))}var k,l,m=h.rangeProperties;c=function(a){if(!a)throw b.createError("WrappedRange: Range must be specified");this.nativeRange=a,d(this)},h.createPrototypeRange(c,g),k=c.prototype,k.selectNode=function(a){this.nativeRange.selectNode(a),d(this)},k.cloneContents=function(){return this.nativeRange.cloneContents()},
11472// Due to a long-standing Firefox bug that I have not been able to find a reliable way to detect,
11473// insertNode() is never delegated to the native range.
11474k.surroundContents=function(a){this.nativeRange.surroundContents(a),d(this)},k.collapse=function(a){this.nativeRange.collapse(a),d(this)},k.cloneRange=function(){return new c(this.nativeRange.cloneRange())},k.refresh=function(){d(this)},k.toString=function(){return this.nativeRange.toString()};
11475// Create test range and node for feature detection
11476var n=document.createTextNode("test");i(document).appendChild(n);var o=document.createRange();/*--------------------------------------------------------------------------------------------------------*/
11477// Test for Firefox 2 bug that prevents moving the start of a Range to a point after its current end and
11478// correct for it
11479o.setStart(n,0),o.setEnd(n,0);try{o.setStart(n,1),k.setStart=function(a,b){this.nativeRange.setStart(a,b),d(this)},k.setEnd=function(a,b){this.nativeRange.setEnd(a,b),d(this)},l=function(a){return function(b){this.nativeRange[a](b),d(this)}}}catch(a){k.setStart=function(a,b){try{this.nativeRange.setStart(a,b)}catch(c){this.nativeRange.setEnd(a,b),this.nativeRange.setStart(a,b)}d(this)},k.setEnd=function(a,b){try{this.nativeRange.setEnd(a,b)}catch(c){this.nativeRange.setStart(a,b),this.nativeRange.setEnd(a,b)}d(this)},l=function(a,b){return function(c){try{this.nativeRange[a](c)}catch(d){this.nativeRange[b](c),this.nativeRange[a](c)}d(this)}}}k.setStartBefore=l("setStartBefore","setEndBefore"),k.setStartAfter=l("setStartAfter","setEndAfter"),k.setEndBefore=l("setEndBefore","setStartBefore"),k.setEndAfter=l("setEndAfter","setStartAfter"),/*--------------------------------------------------------------------------------------------------------*/
11480// Always use DOM4-compliant selectNodeContents implementation: it's simpler and less code than testing
11481// whether the native implementation can be trusted
11482k.selectNodeContents=function(a){this.setStartAndEnd(a,0,e.getNodeLength(a))},/*--------------------------------------------------------------------------------------------------------*/
11483// Test for and correct WebKit bug that has the behaviour of compareBoundaryPoints round the wrong way for
11484// constants START_TO_END and END_TO_START: https://bugs.webkit.org/show_bug.cgi?id=20738
11485o.selectNodeContents(n),o.setEnd(n,3);var p=document.createRange();p.selectNodeContents(n),p.setEnd(n,4),p.setStart(n,2),o.compareBoundaryPoints(o.START_TO_END,p)==-1&&1==o.compareBoundaryPoints(o.END_TO_START,p)?
11486// This is the wrong way round, so correct for it
11487k.compareBoundaryPoints=function(a,b){return b=b.nativeRange||b,a==b.START_TO_END?a=b.END_TO_START:a==b.END_TO_START&&(a=b.START_TO_END),this.nativeRange.compareBoundaryPoints(a,b)}:k.compareBoundaryPoints=function(a,b){return this.nativeRange.compareBoundaryPoints(a,b.nativeRange||b)};/*--------------------------------------------------------------------------------------------------------*/
11488// Test for IE deleteContents() and extractContents() bug and correct it. See issue 107.
11489var q=document.createElement("div");q.innerHTML="123";var r=q.firstChild,s=i(document);s.appendChild(q),o.setStart(r,1),o.setEnd(r,2),o.deleteContents(),"13"==r.data&&(
11490// Behaviour is correct per DOM4 Range so wrap the browser's implementation of deleteContents() and
11491// extractContents()
11492k.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},k.extractContents=function(){var a=this.nativeRange.extractContents();return d(this),a}),s.removeChild(q),s=null,/*--------------------------------------------------------------------------------------------------------*/
11493// Test for existence of createContextualFragment and delegate to it if it exists
11494f.isHostMethod(o,"createContextualFragment")&&(k.createContextualFragment=function(a){return this.nativeRange.createContextualFragment(a)}),/*--------------------------------------------------------------------------------------------------------*/
11495// Clean up
11496i(document).removeChild(n),k.getName=function(){return"WrappedRange"},a.WrappedRange=c,a.createNativeRange=function(a){return a=j(a,b,"createNativeRange"),a.createRange()}}(),a.features.implementsTextRange){/*
11497            This is a workaround for a bug where IE returns the wrong container element from the TextRange's parentElement()
11498            method. For example, in the following (where pipes denote the selection boundaries):
11499
11500            <ul id="ul"><li id="a">| a </li><li id="b"> b |</li></ul>
11501
11502            var range = document.selection.createRange();
11503            alert(range.parentElement().id); // Should alert "ul" but alerts "b"
11504
11505            This method returns the common ancestor node of the following:
11506            - the parentElement() of the textRange
11507            - the parentElement() of the textRange after calling collapse(true)
11508            - the parentElement() of the textRange after calling collapse(false)
11509            */
11510var l=function(a){var b=a.parentElement(),c=a.duplicate();c.collapse(!0);var d=c.parentElement();c=a.duplicate(),c.collapse(!1);var f=c.parentElement(),g=d==f?d:e.getCommonAncestor(d,f);return g==b?g:e.getCommonAncestor(b,g)},m=function(a){return 0==a.compareEndPoints("StartToEnd",a)},n=function(a,b,c,d,f){var h=a.duplicate();h.collapse(c);var i=h.parentElement();
11511// Deal with nodes that cannot "contain rich HTML markup". In practice, this means form inputs, images and
11512// similar. See http://msdn.microsoft.com/en-us/library/aa703950%28VS.85%29.aspx
11513if(
11514// Sometimes collapsing a TextRange that's at the start of a text node can move it into the previous node, so
11515// check for that
11516e.isOrIsAncestorOf(b,i)||(i=b),!i.canHaveHTML){var j=new g(i.parentNode,e.getNodeIndex(i));return{boundaryPosition:j,nodeInfo:{nodeIndex:j.offset,containerElement:j.node}}}var l=e.getDocument(i).createElement("span");
11517// Workaround for HTML5 Shiv's insane violation of document.createElement(). See Rangy issue 104 and HTML5
11518// Shiv issue 64: https://github.com/aFarkas/html5shiv/issues/64
11519l.parentNode&&e.removeNode(l);for(var m,n,o,p,q,r=c?"StartToStart":"StartToEnd",s=f&&f.containerElement==i?f.nodeIndex:0,t=i.childNodes.length,u=t,v=u;;){if(v==t?i.appendChild(l):i.insertBefore(l,i.childNodes[v]),h.moveToElementText(l),m=h.compareEndPoints(r,a),0==m||s==u)break;if(m==-1){if(u==s+1)
11520// We know the endth child node is after the range boundary, so we must be done.
11521break;s=v}else u=u==s+1?s:v;v=Math.floor((s+u)/2),i.removeChild(l)}if(
11522// We've now reached or gone past the boundary of the text range we're interested in
11523// so have identified the node we want
11524q=l.nextSibling,m==-1&&q&&k(q)){
11525// This is a character data node (text, comment, cdata). The working range is collapsed at the start of
11526// the node containing the text range's boundary, so we move the end of the working range to the
11527// boundary point and measure the length of its text to get the boundary's offset within the node.
11528h.setEndPoint(c?"EndToStart":"EndToEnd",a);var w;if(/[\r\n]/.test(q.data)){/*
11529                        For the particular case of a boundary within a text node containing rendered line breaks (within a
11530                        <pre> element, for example), we need a slightly complicated approach to get the boundary's offset in
11531                        IE. The facts:
11532
11533                        - Each line break is represented as \r in the text node's data/nodeValue properties
11534                        - Each line break is represented as \r\n in the TextRange's 'text' property
11535                        - The 'text' property of the TextRange does not contain trailing line breaks
11536
11537                        To get round the problem presented by the final fact above, we can use the fact that TextRange's
11538                        moveStart() and moveEnd() methods return the actual number of characters moved, which is not
11539                        necessarily the same as the number of characters it was instructed to move. The simplest approach is
11540                        to use this to store the characters moved when moving both the start and end of the range to the
11541                        start of the document body and subtracting the start offset from the end offset (the
11542                        "move-negative-gazillion" method). However, this is extremely slow when the document is large and
11543                        the range is near the end of it. Clearly doing the mirror image (i.e. moving the range boundaries to
11544                        the end of the document) has the same problem.
11545
11546                        Another approach that works is to use moveStart() to move the start boundary of the range up to the
11547                        end boundary one character at a time and incrementing a counter with the value returned by the
11548                        moveStart() call. However, the check for whether the start boundary has reached the end boundary is
11549                        expensive, so this method is slow (although unlike "move-negative-gazillion" is largely unaffected
11550                        by the location of the range within the document).
11551
11552                        The approach used below is a hybrid of the two methods above. It uses the fact that a string
11553                        containing the TextRange's 'text' property with each \r\n converted to a single \r character cannot
11554                        be longer than the text of the TextRange, so the start of the range is moved that length initially
11555                        and then a character at a time to make up for any trailing line breaks not contained in the 'text'
11556                        property. This has good performance in most situations compared to the previous two methods.
11557                        */
11558var x=h.duplicate(),y=x.text.replace(/\r\n/g,"\r").length;for(w=x.moveStart("character",y);(m=x.compareEndPoints("StartToEnd",x))==-1;)w++,x.moveStart("character",1)}else w=h.text.length;p=new g(q,w)}else
11559// If the boundary immediately follows a character data node and this is the end boundary, we should favour
11560// a position within that, and likewise for a start boundary preceding a character data node
11561n=(d||!c)&&l.previousSibling,o=(d||c)&&l.nextSibling,p=o&&k(o)?new g(o,0):n&&k(n)?new g(n,n.data.length):new g(i,e.getNodeIndex(l));
11562// Clean up
11563return e.removeNode(l),{boundaryPosition:p,nodeInfo:{nodeIndex:v,containerElement:i}}},o=function(a,b){var c,d,f,g,h=a.offset,j=e.getDocument(a.node),l=i(j).createTextRange(),m=k(a.node);
11564// Position the range immediately before the node containing the boundary
11565// Making the working element non-empty element persuades IE to consider the TextRange boundary to be within
11566// the element rather than immediately before or after it
11567// insertBefore is supposed to work like appendChild if the second parameter is null. However, a bug report
11568// for IERange suggests that it can crash the browser: http://code.google.com/p/ierange/issues/detail?id=12
11569// Clean up
11570// Move the working range to the text offset, if required
11571return m?(c=a.node,d=c.parentNode):(g=a.node.childNodes,c=h<g.length?g[h]:null,d=a.node),f=j.createElement("span"),f.innerHTML="&#feff;",c?d.insertBefore(f,c):d.appendChild(f),l.moveToElementText(f),l.collapse(!b),d.removeChild(f),m&&l[b?"moveStart":"moveEnd"]("character",h),l};/*------------------------------------------------------------------------------------------------------------*/
11572// This is a wrapper around a TextRange, providing full DOM Range functionality using rangy's DomRange as a
11573// prototype
11574d=function(a){this.textRange=a,this.refresh()},d.prototype=new h(document),d.prototype.refresh=function(){var a,b,c,d=l(this.textRange);m(this.textRange)?b=a=n(this.textRange,d,!0,!0).boundaryPosition:(c=n(this.textRange,d,!0,!1),a=c.boundaryPosition,
11575// An optimization used here is that if the start and end boundaries have the same parent element, the
11576// search scope for the end boundary can be limited to exclude the portion of the element that precedes
11577// the start boundary
11578b=n(this.textRange,d,!1,!1,c.nodeInfo).boundaryPosition),this.setStart(a.node,a.offset),this.setEnd(b.node,b.offset)},d.prototype.getName=function(){return"WrappedTextRange"},h.copyComparisonConstants(d);var p=function(a){if(a.collapsed)return o(new g(a.startContainer,a.startOffset),!0);var b=o(new g(a.startContainer,a.startOffset),!0),c=o(new g(a.endContainer,a.endOffset),!1),d=i(h.getRangeDocument(a)).createTextRange();return d.setEndPoint("StartToStart",b),d.setEndPoint("EndToEnd",c),d};
11579// IE 9 and above have both implementations and Rangy makes both available. The next few lines sets which
11580// implementation to use by default.
11581if(d.rangeToTextRange=p,d.prototype.toTextRange=function(){return p(this)},a.WrappedTextRange=d,!a.features.implementsDomRange||a.config.preferTextRange){
11582// Add WrappedTextRange as the Range property of the global object to allow expression like Range.END_TO_END to work
11583var q=function(a){return a("return this;")()}(Function);"undefined"==typeof q.Range&&(q.Range=d),a.createNativeRange=function(a){return a=j(a,b,"createNativeRange"),i(a).createTextRange()},a.WrappedRange=d}}a.createRange=function(c){return c=j(c,b,"createRange"),new a.WrappedRange(a.createNativeRange(c))},a.createRangyRange=function(a){return a=j(a,b,"createRangyRange"),new h(a)},f.createAliasForDeprecatedMethod(a,"createIframeRange","createRange"),f.createAliasForDeprecatedMethod(a,"createIframeRangyRange","createRangyRange"),a.addShimListener(function(b){var c=b.document;"undefined"==typeof c.createRange&&(c.createRange=function(){return a.createRange(c)}),c=b=null})}),/*----------------------------------------------------------------------------------------------------------------*/
11584// This module creates a selection object wrapper that conforms as closely as possible to the Selection specification
11585// in the HTML Editing spec (http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#selections)
11586H.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],function(a,b){
11587// Utility function to support direction parameters in the API that may be a string ("backward", "backwards",
11588// "forward" or "forwards") or a Boolean (true for backwards).
11589function c(a){return"string"==typeof a?/^backward(s)?$/i.test(a):!!a}function d(a,c){if(a){if(C.isWindow(a))return a;if(a instanceof r)return a.win;var d=C.getContentDocument(a,b,c);return C.getWindow(d)}return window}function e(a){return d(a,"getWinSelection").getSelection()}function f(a){return d(a,"getDocSelection").document.selection}function g(a){var b=!1;return a.anchorNode&&(b=1==C.comparePoints(a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset)),b}function h(a,b,c){var d=c?"end":"start",e=c?"start":"end";a.anchorNode=b[d+"Container"],a.anchorOffset=b[d+"Offset"],a.focusNode=b[e+"Container"],a.focusOffset=b[e+"Offset"]}function i(a){var b=a.nativeSelection;a.anchorNode=b.anchorNode,a.anchorOffset=b.anchorOffset,a.focusNode=b.focusNode,a.focusOffset=b.focusOffset}function j(a){a.anchorNode=a.focusNode=null,a.anchorOffset=a.focusOffset=0,a.rangeCount=0,a.isCollapsed=!0,a._ranges.length=0}function k(b){var c;return b instanceof F?(c=a.createNativeRange(b.getDocument()),c.setEnd(b.endContainer,b.endOffset),c.setStart(b.startContainer,b.startOffset)):b instanceof G?c=b.nativeRange:J.implementsDomRange&&b instanceof C.getWindow(b.startContainer).Range&&(c=b),c}function l(a){if(!a.length||1!=a[0].nodeType)return!1;for(var b=1,c=a.length;b<c;++b)if(!C.isAncestorOf(a[0],a[b]))return!1;return!0}function m(a){var c=a.getNodes();if(!l(c))throw b.createError("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return c[0]}
11590// Simple, quick test which only needs to distinguish between a TextRange and a ControlRange
11591function n(a){return!!a&&"undefined"!=typeof a.text}function o(a,b){
11592// Create a Range from the selected TextRange
11593var c=new G(b);a._ranges=[c],h(a,c,!1),a.rangeCount=1,a.isCollapsed=c.collapsed}function p(b){if(
11594// Update the wrapped selection based on what's now in the native selection
11595b._ranges.length=0,"None"==b.docSelection.type)j(b);else{var c=b.docSelection.createRange();if(n(c))
11596// This case (where the selection type is "Control" and calling createRange() on the selection returns
11597// a TextRange) can happen in IE 9. It happens, for example, when all elements in the selected
11598// ControlRange have been removed from the ControlRange and removed from the document.
11599o(b,c);else{b.rangeCount=c.length;for(var d,e=L(c.item(0)),f=0;f<b.rangeCount;++f)d=a.createRange(e),d.selectNode(c.item(f)),b._ranges.push(d);b.isCollapsed=1==b.rangeCount&&b._ranges[0].collapsed,h(b,b._ranges[b.rangeCount-1],!1)}}}function q(a,c){for(var d=a.docSelection.createRange(),e=m(c),f=L(d.item(0)),g=M(f).createControlRange(),h=0,i=d.length;h<i;++h)g.add(d.item(h));try{g.add(e)}catch(a){throw b.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}g.select(),
11600// Update the wrapped selection based on what's now in the native selection
11601p(a)}function r(a,b,c){this.nativeSelection=a,this.docSelection=b,this._ranges=[],this.win=c,this.refresh()}function s(a){a.win=a.anchorNode=a.focusNode=a._ranges=null,a.rangeCount=a.anchorOffset=a.focusOffset=0,a.detached=!0}function t(a,b){for(var c,d,e=ba.length;e--;)if(c=ba[e],d=c.selection,"deleteAll"==b)s(d);else if(c.win==a)return"delete"==b?(ba.splice(e,1),!0):d;return"deleteAll"==b&&(ba.length=0),null}function u(a,c){for(var d,e=L(c[0].startContainer),f=M(e).createControlRange(),g=0,h=c.length;g<h;++g){d=m(c[g]);try{f.add(d)}catch(a){throw b.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}f.select(),
11602// Update the wrapped selection based on what's now in the native selection
11603p(a)}function v(a,b){if(a.win.document!=L(b))throw new H("WRONG_DOCUMENT_ERR")}function w(b){return function(c,d){var e;this.rangeCount?(e=this.getRangeAt(0),e["set"+(b?"Start":"End")](c,d)):(e=a.createRange(this.win.document),e.setStartAndEnd(c,d)),this.setSingleRange(e,this.isBackward())}}function x(a){var b=[],c=new I(a.anchorNode,a.anchorOffset),d=new I(a.focusNode,a.focusOffset),e="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var f=0,g=a.rangeCount;f<g;++f)b[f]=F.inspect(a.getRangeAt(f));return"["+e+"(Ranges: "+b.join(", ")+")(anchor: "+c.inspect()+", focus: "+d.inspect()+"]"}a.config.checkSelectionRanges=!0;var y,z,A="boolean",B="number",C=a.dom,D=a.util,E=D.isHostMethod,F=a.DomRange,G=a.WrappedRange,H=a.DOMException,I=C.DomPosition,J=a.features,K="Control",L=C.getDocument,M=C.getBody,N=F.rangesEqual,O=E(window,"getSelection"),P=D.isHostObject(document,"selection");J.implementsWinGetSelection=O,J.implementsDocSelection=P;var Q=P&&(!O||a.config.preferTextRange);if(Q)y=f,a.isSelectionValid=function(a){var b=d(a,"isSelectionValid").document,c=b.selection;
11604// Check whether the selection TextRange is actually contained within the correct document
11605return"None"!=c.type||L(c.createRange().parentElement())==b};else{if(!O)return b.fail("Neither document.selection or window.getSelection() detected."),!1;y=e,a.isSelectionValid=function(){return!0}}a.getNativeSelection=y;var R=y();
11606// In Firefox, the selection is null in an iframe with display: none. See issue #138.
11607if(!R)return b.fail("Native selection was null (possibly issue 138?)"),!1;var S=a.createNativeRange(document),T=M(document),U=D.areHostProperties(R,["anchorNode","focusNode","anchorOffset","focusOffset"]);J.selectionHasAnchorAndFocus=U;
11608// Test for existence of native selection extend() method
11609var V=E(R,"extend");J.selectionHasExtend=V;
11610// Test if rangeCount exists
11611var W=typeof R.rangeCount==B;J.selectionHasRangeCount=W;var X=!1,Y=!0,Z=V?function(b,c){var d=F.getRangeDocument(c),e=a.createRange(d);e.collapseToPoint(c.endContainer,c.endOffset),b.addRange(k(e)),b.extend(c.startContainer,c.startOffset)}:null;D.areHostMethods(R,["addRange","getRangeAt","removeAllRanges"])&&typeof R.rangeCount==B&&J.implementsDomRange&&!function(){
11612// Previously an iframe was used but this caused problems in some circumstances in IE, so tests are
11613// performed on the current document's selection. See issue 109.
11614// Note also that if a selection previously existed, it is wiped and later restored by these tests. This
11615// will result in the selection direction begin reversed if the original selection was backwards and the
11616// browser does not support setting backwards selections (Internet Explorer, I'm looking at you).
11617var b=window.getSelection();if(b){for(var c=b.rangeCount,d=c>1,e=[],f=g(b),h=0;h<c;++h)e[h]=b.getRangeAt(h);
11618// Create some test elements
11619var i=C.createTestElement(document,"",!1),j=i.appendChild(document.createTextNode("   ")),k=document.createRange();
11620// Test whether the native selection is capable of supporting multiple ranges.
11621if(k.setStart(j,1),k.collapse(!0),b.removeAllRanges(),b.addRange(k),Y=1==b.rangeCount,b.removeAllRanges(),!d){
11622// Doing the original feature test here in Chrome 36 (and presumably later versions) prints a
11623// console error of "Discontiguous selection is not supported." that cannot be suppressed. There's
11624// nothing we can do about this while retaining the feature test so we have to resort to a browser
11625// sniff. I'm not happy about it. See
11626// https://code.google.com/p/chromium/issues/detail?id=399791
11627var l=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(l&&parseInt(l[1])>=36)X=!1;else{var m=k.cloneRange();k.setStart(j,0),m.setEnd(j,3),m.setStart(j,2),b.addRange(k),b.addRange(m),X=2==b.rangeCount}}for(
11628// Clean up
11629C.removeNode(i),b.removeAllRanges(),h=0;h<c;++h)0==h&&f?Z?Z(b,e[h]):(a.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),b.addRange(e[h])):b.addRange(e[h])}}(),J.selectionSupportsMultipleRanges=X,J.collapsedNonEditableSelectionsSupported=Y;
11630// ControlRanges
11631var $,_=!1;T&&E(T,"createControlRange")&&($=T.createControlRange(),D.areHostProperties($,["item","add"])&&(_=!0)),J.implementsControlRange=_,
11632// Selection collapsedness
11633z=U?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return!!a.rangeCount&&a.getRangeAt(a.rangeCount-1).collapsed};var aa;E(R,"getRangeAt")?
11634// try/catch is present because getRangeAt() must have thrown an error in some browser and some situation.
11635// Unfortunately, I didn't write a comment about the specifics and am now scared to take it out. Let that be a
11636// lesson to us all, especially me.
11637aa=function(a,b){try{return a.getRangeAt(b)}catch(a){return null}}:U&&(aa=function(b){var c=L(b.anchorNode),d=a.createRange(c);
11638// Handle the case when the selection was selected backwards (from the end to the start in the
11639// document)
11640return d.setStartAndEnd(b.anchorNode,b.anchorOffset,b.focusNode,b.focusOffset),d.collapsed!==this.isCollapsed&&d.setStartAndEnd(b.focusNode,b.focusOffset,b.anchorNode,b.anchorOffset),d}),r.prototype=a.selectionPrototype;var ba=[],ca=function(a){
11641// Check if the parameter is a Rangy Selection object
11642if(a&&a instanceof r)return a.refresh(),a;a=d(a,"getNativeSelection");var b=t(a),c=y(a),e=P?f(a):null;return b?(b.nativeSelection=c,b.docSelection=e,b.refresh()):(b=new r(c,e,a),ba.push({win:a,selection:b})),b};a.getSelection=ca,D.createAliasForDeprecatedMethod(a,"getIframeSelection","getSelection");var da=r.prototype;
11643// Selecting a range
11644if(!Q&&U&&D.areHostMethods(R,["removeAllRanges","addRange"])){da.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),j(this)};var ea=function(a,b){Z(a.nativeSelection,b),a.refresh()};W?da.addRange=function(b,d){if(_&&P&&this.docSelection.type==K)q(this,b);else if(c(d)&&V)ea(this,b);else{var e;X?e=this.rangeCount:(this.removeAllRanges(),e=0);
11645// Clone the native range so that changing the selected range does not affect the selection.
11646// This is contrary to the spec but is the only way to achieve consistency between browsers. See
11647// issue 80.
11648var f=k(b).cloneRange();try{this.nativeSelection.addRange(f)}catch(a){}if(
11649// Check whether adding the range was successful
11650this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==e+1){
11651// The range was added successfully
11652// Check whether the range that we added to the selection is reflected in the last range extracted from
11653// the selection
11654if(a.config.checkSelectionRanges){var g=aa(this.nativeSelection,this.rangeCount-1);g&&!N(g,b)&&(
11655// Happens in WebKit with, for example, a selection placed at the start of a text node
11656b=new G(g))}this._ranges[this.rangeCount-1]=b,h(this,b,ha(this.nativeSelection)),this.isCollapsed=z(this)}else
11657// The range was not added successfully. The simplest thing is to refresh
11658this.refresh()}}:da.addRange=function(a,b){c(b)&&V?ea(this,a):(this.nativeSelection.addRange(k(a)),this.refresh())},da.setRanges=function(a){if(_&&P&&a.length>1)u(this,a);else{this.removeAllRanges();for(var b=0,c=a.length;b<c;++b)this.addRange(a[b])}}}else{if(!(E(R,"empty")&&E(S,"select")&&_&&Q))return b.fail("No means of selecting a Range or TextRange was found"),!1;da.removeAllRanges=function(){
11659// Added try/catch as fix for issue #21
11660try{
11661// Check for empty() not working (issue #24)
11662if(this.docSelection.empty(),"None"!=this.docSelection.type){
11663// Work around failure to empty a control selection by instead selecting a TextRange and then
11664// calling empty()
11665var a;if(this.anchorNode)a=L(this.anchorNode);else if(this.docSelection.type==K){var b=this.docSelection.createRange();b.length&&(a=L(b.item(0)))}if(a){var c=M(a).createTextRange();c.select(),this.docSelection.empty()}}}catch(a){}j(this)},da.addRange=function(b){this.docSelection.type==K?q(this,b):(a.WrappedTextRange.rangeToTextRange(b).select(),this._ranges[0]=b,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,h(this,b,!1))},da.setRanges=function(a){this.removeAllRanges();var b=a.length;b>1?u(this,a):b&&this.addRange(a[0])}}da.getRangeAt=function(a){if(a<0||a>=this.rangeCount)throw new H("INDEX_SIZE_ERR");
11666// Clone the range to preserve selection-range independence. See issue 80.
11667return this._ranges[a].cloneRange()};var fa;if(Q)fa=function(b){var c;a.isSelectionValid(b.win)?c=b.docSelection.createRange():(c=M(b.win.document).createTextRange(),c.collapse(!0)),b.docSelection.type==K?p(b):n(c)?o(b,c):j(b)};else if(E(R,"getRangeAt")&&typeof R.rangeCount==B)fa=function(b){if(_&&P&&b.docSelection.type==K)p(b);else if(b._ranges.length=b.rangeCount=b.nativeSelection.rangeCount,b.rangeCount){for(var c=0,d=b.rangeCount;c<d;++c)b._ranges[c]=new a.WrappedRange(b.nativeSelection.getRangeAt(c));h(b,b._ranges[b.rangeCount-1],ha(b.nativeSelection)),b.isCollapsed=z(b)}else j(b)};else{if(!U||typeof R.isCollapsed!=A||typeof S.collapsed!=A||!J.implementsDomRange)return b.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;fa=function(a){var b,c=a.nativeSelection;c.anchorNode?(b=aa(c,0),a._ranges=[b],a.rangeCount=1,i(a),a.isCollapsed=z(a)):j(a)}}da.refresh=function(a){var b=a?this._ranges.slice(0):null,c=this.anchorNode,d=this.anchorOffset;if(fa(this),a){
11668// Check the range count first
11669var e=b.length;if(e!=this._ranges.length)return!0;
11670// Now check the direction. Checking the anchor position is the same is enough since we're checking all the
11671// ranges after this
11672if(this.anchorNode!=c||this.anchorOffset!=d)return!0;
11673// Finally, compare each range in turn
11674for(;e--;)if(!N(b[e],this._ranges[e]))return!0;return!1}};
11675// Removal of a single range
11676var ga=function(a,b){var c=a.getAllRanges();a.removeAllRanges();for(var d=0,e=c.length;d<e;++d)N(b,c[d])||a.addRange(c[d]);a.rangeCount||j(a)};_&&P?da.removeRange=function(a){if(this.docSelection.type==K){for(var b,c=this.docSelection.createRange(),d=m(a),e=L(c.item(0)),f=M(e).createControlRange(),g=!1,h=0,i=c.length;h<i;++h)b=c.item(h),b!==d||g?f.add(c.item(h)):g=!0;f.select(),
11677// Update the wrapped selection based on what's now in the native selection
11678p(this)}else ga(this,a)}:da.removeRange=function(a){ga(this,a)};
11679// Detecting if a selection is backward
11680var ha;!Q&&U&&J.implementsDomRange?(ha=g,da.isBackward=function(){return ha(this)}):ha=da.isBackward=function(){return!1},
11681// Create an alias for backwards compatibility. From 1.3, everything is "backward" rather than "backwards"
11682da.isBackwards=da.isBackward,
11683// Selection stringifier
11684// This is conformant to the old HTML5 selections draft spec but differs from WebKit and Mozilla's implementation.
11685// The current spec does not yet define this method.
11686da.toString=function(){for(var a=[],b=0,c=this.rangeCount;b<c;++b)a[b]=""+this._ranges[b];return a.join("")},
11687// No current browser conforms fully to the spec for this method, so Rangy's own method is always used
11688da.collapse=function(b,c){v(this,b);var d=a.createRange(b);d.collapseToPoint(b,c),this.setSingleRange(d),this.isCollapsed=!0},da.collapseToStart=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[0];this.collapse(a.startContainer,a.startOffset)},da.collapseToEnd=function(){if(!this.rangeCount)throw new H("INVALID_STATE_ERR");var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)},
11689// The spec is very specific on how selectAllChildren should be implemented and not all browsers implement it as
11690// specified so the native implementation is never used by Rangy.
11691da.selectAllChildren=function(b){v(this,b);var c=a.createRange(b);c.selectNodeContents(b),this.setSingleRange(c)},da.deleteFromDocument=function(){
11692// Sepcial behaviour required for IE's control selections
11693if(_&&P&&this.docSelection.type==K){for(var a,b=this.docSelection.createRange();b.length;)a=b.item(0),b.remove(a),C.removeNode(a);this.refresh()}else if(this.rangeCount){var c=this.getAllRanges();if(c.length){this.removeAllRanges();for(var d=0,e=c.length;d<e;++d)c[d].deleteContents();
11694// The spec says nothing about what the selection should contain after calling deleteContents on each
11695// range. Firefox moves the selection to where the final selected range was, so we emulate that
11696this.addRange(c[e-1])}}},
11697// The following are non-standard extensions
11698da.eachRange=function(a,b){for(var c=0,d=this._ranges.length;c<d;++c)if(a(this.getRangeAt(c)))return b},da.getAllRanges=function(){var a=[];return this.eachRange(function(b){a.push(b)}),a},da.setSingleRange=function(a,b){this.removeAllRanges(),this.addRange(a,b)},da.callMethodOnEachRange=function(a,b){var c=[];return this.eachRange(function(d){c.push(d[a].apply(d,b||[]))}),c},da.setStart=w(!0),da.setEnd=w(!1),
11699// Add select() method to Range prototype. Any existing selection will be removed.
11700a.rangePrototype.select=function(a){ca(this.getDocument()).setSingleRange(this,a)},da.changeEachRange=function(a){var b=[],c=this.isBackward();this.eachRange(function(c){a(c),b.push(c)}),this.removeAllRanges(),c&&1==b.length?this.addRange(b[0],"backward"):this.setRanges(b)},da.containsNode=function(a,b){return this.eachRange(function(c){return c.containsNode(a,b)},!0)||!1},da.getBookmark=function(a){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[a])}},da.moveToBookmark=function(b){for(var c,d,e=[],f=0;c=b.rangeBookmarks[f++];)d=a.createRange(this.win),d.moveToBookmark(c),e.push(d);b.backward?this.setSingleRange(e[0],"backward"):this.setRanges(e)},da.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},da.restoreRanges=function(a){this.removeAllRanges();for(var b,c=0;b=a.ranges[c];++c)this.addRange(b,a.backward&&0==c)},da.toHtml=function(){var a=[];return this.eachRange(function(b){a.push(F.toHtml(b))}),a.join("")},J.implementsTextRange&&(da.getNativeTextRange=function(){var c;if(c=this.docSelection){var d=c.createRange();if(n(d))return d;throw b.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return a.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw b.createError("getNativeTextRange: selection contains no range")}),da.getName=function(){return"WrappedSelection"},da.inspect=function(){return x(this)},da.detach=function(){t(this.win,"delete"),s(this)},r.detachAll=function(){t(null,"deleteAll")},r.inspect=x,r.isDirectionBackward=c,a.Selection=r,a.selectionPrototype=da,a.addShimListener(function(a){"undefined"==typeof a.getSelection&&(a.getSelection=function(){return ca(a)}),a=null})});/*----------------------------------------------------------------------------------------------------------------*/
11701// Wait for document to load before initializing
11702var M=!1,N=function(a){M||(M=!0,!H.initialized&&H.config.autoInitialize&&l())};
11703// Test whether the document has already been loaded and initialize immediately if so
11704// Add a fallback in case the DOMContentLoaded event isn't supported
11705return F&&("complete"==document.readyState?N():(a(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",N,!1),J(window,"load",N))),H},this),/**
11706 * Selection save and restore module for Rangy.
11707 * Saves and restores user selections using marker invisible elements in the DOM.
11708 *
11709 * Part of Rangy, a cross-browser JavaScript range and selection library
11710 * https://github.com/timdown/rangy
11711 *
11712 * Depends on Rangy core.
11713 *
11714 * Copyright 2015, Tim Down
11715 * Licensed under the MIT license.
11716 * Version: 1.3.0
11717 * Build date: 10 May 2015
11718 */
11719function(a,b){"function"==typeof define&&define.amd?
11720// AMD. Register as an anonymous module with a dependency on Rangy.
11721define(["./rangy-core"],a):"undefined"!=typeof module&&"object"==typeof exports?
11722// Node/CommonJS style
11723module.exports=a(require("rangy")):
11724// No AMD or CommonJS support so we use the rangy property of root (probably the global variable)
11725a(b.rangy)}(function(a){return a.createModule("SaveRestore",["WrappedRange"],function(a,b){function c(a,b){return(b||document).getElementById(a)}function d(a,b){var c,d="selectionBoundary_"+ +new Date+"_"+(""+Math.random()).slice(2),e=o.getDocument(a.startContainer),f=a.cloneRange();
11726// Create the marker element containing a single invisible character using DOM methods and insert it
11727return f.collapse(b),c=e.createElement("span"),c.id=d,c.style.lineHeight="0",c.style.display="none",c.className="rangySelectionBoundary",c.appendChild(e.createTextNode(r)),f.insertNode(c),c}function e(a,d,e,f){var g=c(e,a);g?(d[f?"setStartBefore":"setEndBefore"](g),p(g)):b.warn("Marker element has been removed. Cannot restore selection.")}function f(a,b){return b.compareBoundaryPoints(a.START_TO_START,a)}function g(b,c){var e,f,g=a.DomRange.getRangeDocument(b),h=b.toString(),i=q(c);return b.collapsed?(f=d(b,!1),{document:g,markerId:f.id,collapsed:!0}):(f=d(b,!1),e=d(b,!0),{document:g,startMarkerId:e.id,endMarkerId:f.id,collapsed:!1,backward:i,toString:function(){return"original text: '"+h+"', new text: '"+b.toString()+"'"}})}function h(d,f){var g=d.document;"undefined"==typeof f&&(f=!0);var h=a.createRange(g);if(d.collapsed){var i=c(d.markerId,g);if(i){i.style.display="inline";var j=i.previousSibling;
11728// Workaround for issue 17
11729j&&3==j.nodeType?(p(i),h.collapseToPoint(j,j.length)):(h.collapseBefore(i),p(i))}else b.warn("Marker element has been removed. Cannot restore selection.")}else e(g,h,d.startMarkerId,!0),e(g,h,d.endMarkerId,!1);return f&&h.normalizeBoundaries(),h}function i(b,d){var e,h,i=[],j=q(d);
11730// Order the ranges by position within the DOM, latest first, cloning the array to leave the original untouched
11731b=b.slice(0),b.sort(f);for(var k=0,l=b.length;k<l;++k)i[k]=g(b[k],j);
11732// Now that all the markers are in place and DOM manipulation over, adjust each range's boundaries to lie
11733// between its markers
11734for(k=l-1;k>=0;--k)e=b[k],h=a.DomRange.getRangeDocument(e),e.collapsed?e.collapseAfter(c(i[k].markerId,h)):(e.setEndBefore(c(i[k].endMarkerId,h)),e.setStartAfter(c(i[k].startMarkerId,h)));return i}function j(c){if(!a.isSelectionValid(c))return b.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus."),null;var d=a.getSelection(c),e=d.getAllRanges(),f=1==e.length&&d.isBackward(),g=i(e,f);
11735// Ensure current selection is unaffected
11736return f?d.setSingleRange(e[0],f):d.setRanges(e),{win:c,rangeInfos:g,restored:!1}}function k(a){for(var b=[],c=a.length,d=c-1;d>=0;d--)b[d]=h(a[d],!0);return b}function l(b,c){if(!b.restored){var d=b.rangeInfos,e=a.getSelection(b.win),f=k(d),g=d.length;1==g&&c&&a.features.selectionHasExtend&&d[0].backward?(e.removeAllRanges(),e.addRange(f[0],!0)):e.setRanges(f),b.restored=!0}}function m(a,b){var d=c(b,a);d&&p(d)}function n(a){for(var b,c=a.rangeInfos,d=0,e=c.length;d<e;++d)b=c[d],b.collapsed?m(a.doc,b.markerId):(m(a.doc,b.startMarkerId),m(a.doc,b.endMarkerId))}var o=a.dom,p=o.removeNode,q=a.Selection.isDirectionBackward,r="\ufeff";a.util.extend(a,{saveRange:g,restoreRange:h,saveRanges:i,restoreRanges:k,saveSelection:j,restoreSelection:l,removeMarkerElement:m,removeMarkers:n})}),a},this);;
11737(function (root, factory) {
11738  if (typeof define === 'function' && define.amd) {
11739    // AMD. Register as an anonymous module unless amdModuleId is set
11740    define('textAngular', ["rangy","rangy/lib/rangy-selectionsaverestore"], function (a0,b1) {
11741      return (root['textAngular.name'] = factory(a0,b1));
11742    });
11743  } else if (typeof exports === 'object') {
11744    // Node. Does not work with strict CommonJS, but
11745    // only CommonJS-like environments that support module.exports,
11746    // like Node.
11747    module.exports = factory(require("rangy"),require("rangy/lib/rangy-selectionsaverestore"));
11748  } else {
11749    root['textAngular'] = factory(rangy);
11750  }
11751}(this, function (rangy) {
11752
11753
11754// tests against the current jqLite/jquery implementation if this can be an element
11755function validElementString(string){
11756    try{
11757        return angular.element(string).length !== 0;
11758    }catch(any){
11759        return false;
11760    }
11761}
11762// setup the global contstant functions for setting up the toolbar
11763
11764// all tool definitions
11765var taTools = {};
11766/*
11767    A tool definition is an object with the following key/value parameters:
11768        action: [function(deferred, restoreSelection)]
11769                a function that is executed on clicking on the button - this will allways be executed using ng-click and will
11770                overwrite any ng-click value in the display attribute.
11771                The function is passed a deferred object ($q.defer()), if this is wanted to be used `return false;` from the action and
11772                manually call `deferred.resolve();` elsewhere to notify the editor that the action has finished.
11773                restoreSelection is only defined if the rangy library is included and it can be called as `restoreSelection()` to restore the users
11774                selection in the WYSIWYG editor.
11775        display: [string]?
11776                Optional, an HTML element to be displayed as the button. The `scope` of the button is the tool definition object with some additional functions
11777                If set this will cause buttontext and iconclass to be ignored
11778        class: [string]?
11779                Optional, if set will override the taOptions.classes.toolbarButton class.
11780        buttontext: [string]?
11781                if this is defined it will replace the contents of the element contained in the `display` element
11782        iconclass: [string]?
11783                if this is defined an icon (<i>) will be appended to the `display` element with this string as it's class
11784        tooltiptext: [string]?
11785                Optional, a plain text description of the action, used for the title attribute of the action button in the toolbar by default.
11786        activestate: [function(commonElement)]?
11787                this function is called on every caret movement, if it returns true then the class taOptions.classes.toolbarButtonActive
11788                will be applied to the `display` element, else the class will be removed
11789        disabled: [function()]?
11790                if this function returns true then the tool will have the class taOptions.classes.disabled applied to it, else it will be removed
11791    Other functions available on the scope are:
11792        name: [string]
11793                the name of the tool, this is the first parameter passed into taRegisterTool
11794        isDisabled: [function()]
11795                returns true if the tool is disabled, false if it isn't
11796        displayActiveToolClass: [function(boolean)]
11797                returns true if the tool is 'active' in the currently focussed toolbar
11798        onElementSelect: [Object]
11799                This object contains the following key/value pairs and is used to trigger the ta-element-select event
11800                element: [String]
11801                    an element name, will only trigger the onElementSelect action if the tagName of the element matches this string
11802                filter: [function(element)]?
11803                    an optional filter that returns a boolean, if true it will trigger the onElementSelect.
11804                action: [function(event, element, editorScope)]
11805                    the action that should be executed if the onElementSelect function runs
11806*/
11807// name and toolDefinition to add into the tools available to be added on the toolbar
11808function registerTextAngularTool(name, toolDefinition){
11809    if(!name || name === '' || taTools.hasOwnProperty(name)) throw('textAngular Error: A unique name is required for a Tool Definition');
11810    if(
11811        (toolDefinition.display && (toolDefinition.display === '' || !validElementString(toolDefinition.display))) ||
11812        (!toolDefinition.display && !toolDefinition.buttontext && !toolDefinition.iconclass)
11813    )
11814        throw('textAngular Error: Tool Definition for "' + name + '" does not have a valid display/iconclass/buttontext value');
11815    taTools[name] = toolDefinition;
11816}
11817
11818angular.module('textAngularSetup', [])
11819.constant('taRegisterTool', registerTextAngularTool)
11820.value('taTools', taTools)
11821// Here we set up the global display defaults, to set your own use a angular $provider#decorator.
11822.value('taOptions',  {
11823    //////////////////////////////////////////////////////////////////////////////////////
11824    // forceTextAngularSanitize
11825    // set false to allow the textAngular-sanitize provider to be replaced
11826    // with angular-sanitize or a custom provider.
11827    forceTextAngularSanitize: true,
11828    ///////////////////////////////////////////////////////////////////////////////////////
11829    // keyMappings
11830    // allow customizable keyMappings for specialized key boards or languages
11831    //
11832    // keyMappings provides key mappings that are attached to a given commandKeyCode.
11833    // To modify a specific keyboard binding, simply provide function which returns true
11834    // for the event you wish to map to.
11835    // Or to disable a specific keyboard binding, provide a function which returns false.
11836    // Note: 'RedoKey' and 'UndoKey' are internally bound to the redo and undo functionality.
11837    // At present, the following commandKeyCodes are in use:
11838    // 98, 'TabKey', 'ShiftTabKey', 105, 117, 'UndoKey', 'RedoKey'
11839    //
11840    // To map to an new commandKeyCode, add a new key mapping such as:
11841    // {commandKeyCode: 'CustomKey', testForKey: function (event) {
11842    //  if (event.keyCode=57 && event.ctrlKey && !event.shiftKey && !event.altKey) return true;
11843    // } }
11844    // to the keyMappings. This example maps ctrl+9 to 'CustomKey'
11845    // Then where taRegisterTool(...) is called, add a commandKeyCode: 'CustomKey' and your
11846    // tool will be bound to ctrl+9.
11847    //
11848    // To disble one of the already bound commandKeyCodes such as 'RedoKey' or 'UndoKey' add:
11849    // {commandKeyCode: 'RedoKey', testForKey: function (event) { return false; } },
11850    // {commandKeyCode: 'UndoKey', testForKey: function (event) { return false; } },
11851    // to disable them.
11852    //
11853    keyMappings : [],
11854    toolbar: [
11855        ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'pre', 'quote'],
11856        ['bold', 'italics', 'underline', 'strikeThrough', 'ul', 'ol', 'redo', 'undo', 'clear'],
11857        ['justifyLeft','justifyCenter','justifyRight','justifyFull','indent','outdent'],
11858        ['html', 'insertImage', 'insertLink', 'insertVideo', 'wordcount', 'charcount']
11859    ],
11860    classes: {
11861        focussed: "focussed",
11862        toolbar: "btn-toolbar",
11863        toolbarGroup: "btn-group",
11864        toolbarButton: "btn btn-default",
11865        toolbarButtonActive: "active",
11866        disabled: "disabled",
11867        textEditor: 'form-control',
11868        htmlEditor: 'form-control'
11869    },
11870    defaultTagAttributes : {
11871        a: {target:""}
11872    },
11873    setup: {
11874        // wysiwyg mode
11875        textEditorSetup: function($element){ /* Do some processing here */ },
11876        // raw html
11877        htmlEditorSetup: function($element){ /* Do some processing here */ }
11878    },
11879    defaultFileDropHandler:
11880        /* istanbul ignore next: untestable image processing */
11881        function(file, insertAction){
11882            var reader = new FileReader();
11883            if(file.type.substring(0, 5) === 'image'){
11884                reader.onload = function() {
11885                    if(reader.result !== '') insertAction('insertImage', reader.result, true);
11886                };
11887
vendor: 28,824 bytes, lines 11888-12544
11888                reader.readAsDataURL(file);
11889                // NOTE: For async procedures return a promise and resolve it when the editor should update the model.
11890                return true;
11891            }
11892            return false;
11893        }
11894})
11895
11896// This is the element selector string that is used to catch click events within a taBind, prevents the default and $emits a 'ta-element-select' event
11897// these are individually used in an angular.element().find() call. What can go here depends on whether you have full jQuery loaded or just jQLite with angularjs.
11898// div is only used as div.ta-insert-video caught in filter.
11899.value('taSelectableElements', ['a','img'])
11900
11901// This is an array of objects with the following options:
11902//				selector: <string> a jqLite or jQuery selector string
11903//				customAttribute: <string> an attribute to search for
11904//				renderLogic: <function(element)>
11905// Both or one of selector and customAttribute must be defined.
11906.value('taCustomRenderers', [
11907    {
11908        // Parse back out: '<div class="ta-insert-video" ta-insert-video src="' + urlLink + '" allowfullscreen="true" width="300" frameborder="0" height="250"></div>'
11909        // To correct video element. For now only support youtube
11910        selector: 'img',
11911        customAttribute: 'ta-insert-video',
11912        renderLogic: function(element){
11913            var iframe = angular.element('<iframe></iframe>');
11914            var attributes = element.prop("attributes");
11915            // loop through element attributes and apply them on iframe
11916            angular.forEach(attributes, function(attr) {
11917                iframe.attr(attr.name, attr.value);
11918            });
11919            iframe.attr('src', iframe.attr('ta-insert-video'));
11920            element.replaceWith(iframe);
11921        }
11922    }
11923])
11924
11925.value('taTranslations', {
11926    // moved to sub-elements
11927    //toggleHTML: "Toggle HTML",
11928    //insertImage: "Please enter a image URL to insert",
11929    //insertLink: "Please enter a URL to insert",
11930    //insertVideo: "Please enter a youtube URL to embed",
11931    html: {
11932        tooltip: 'Toggle html / Rich Text'
11933    },
11934    // tooltip for heading - might be worth splitting
11935    heading: {
11936        tooltip: 'Heading '
11937    },
11938    p: {
11939        tooltip: 'Paragraph'
11940    },
11941    pre: {
11942        tooltip: 'Preformatted text'
11943    },
11944    ul: {
11945        tooltip: 'Unordered List'
11946    },
11947    ol: {
11948        tooltip: 'Ordered List'
11949    },
11950    quote: {
11951        tooltip: 'Quote/unquote selection or paragraph'
11952    },
11953    undo: {
11954        tooltip: 'Undo'
11955    },
11956    redo: {
11957        tooltip: 'Redo'
11958    },
11959    bold: {
11960        tooltip: 'Bold'
11961    },
11962    italic: {
11963        tooltip: 'Italic'
11964    },
11965    underline: {
11966        tooltip: 'Underline'
11967    },
11968    strikeThrough:{
11969        tooltip: 'Strikethrough'
11970    },
11971    justifyLeft: {
11972        tooltip: 'Align text left'
11973    },
11974    justifyRight: {
11975        tooltip: 'Align text right'
11976    },
11977    justifyFull: {
11978        tooltip: 'Justify text'
11979    },
11980    justifyCenter: {
11981        tooltip: 'Center'
11982    },
11983    indent: {
11984        tooltip: 'Increase indent'
11985    },
11986    outdent: {
11987        tooltip: 'Decrease indent'
11988    },
11989    clear: {
11990        tooltip: 'Clear formatting'
11991    },
11992    insertImage: {
11993        dialogPrompt: 'Please enter an image URL to insert',
11994        tooltip: 'Insert image',
11995        hotkey: 'the - possibly language dependent hotkey ... for some future implementation'
11996    },
11997    insertVideo: {
11998        tooltip: 'Insert video',
11999        dialogPrompt: 'Please enter a youtube URL to embed'
12000    },
12001    insertLink: {
12002        tooltip: 'Insert / edit link',
12003        dialogPrompt: "Please enter a URL to insert"
12004    },
12005    editLink: {
12006        reLinkButton: {
12007            tooltip: "Relink"
12008        },
12009        unLinkButton: {
12010            tooltip: "Unlink"
12011        },
12012        targetToggle: {
12013            buttontext: "Open in New Window"
12014        }
12015    },
12016    wordcount: {
12017        tooltip: 'Display words Count'
12018    },
12019        charcount: {
12020        tooltip: 'Display characters Count'
12021    }
12022})
12023.factory('taToolFunctions', ['$window','taTranslations', function($window, taTranslations) {
12024    return {
12025        imgOnSelectAction: function(event, $element, editorScope){
12026            // setup the editor toolbar
12027            // Credit to the work at http://hackerwins.github.io/summernote/ for this editbar logic/display
12028            var finishEdit = function(){
12029                editorScope.updateTaBindtaTextElement();
12030                editorScope.hidePopover();
12031            };
12032            event.preventDefault();
12033            editorScope.displayElements.popover.css('width', '375px');
12034            var container = editorScope.displayElements.popoverContainer;
12035            container.empty();
12036            var buttonGroup = angular.element('<div class="btn-group" style="padding-right: 6px;">');
12037            var fullButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">100% </button>');
12038            fullButton.on('click', function(event){
12039                event.preventDefault();
12040                $element.css({
12041                    'width': '100%',
12042                    'height': ''
12043                });
12044                finishEdit();
12045            });
12046            var halfButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">50% </button>');
12047            halfButton.on('click', function(event){
12048                event.preventDefault();
12049                $element.css({
12050                    'width': '50%',
12051                    'height': ''
12052                });
12053                finishEdit();
12054            });
12055            var quartButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">25% </button>');
12056            quartButton.on('click', function(event){
12057                event.preventDefault();
12058                $element.css({
12059                    'width': '25%',
12060                    'height': ''
12061                });
12062                finishEdit();
12063            });
12064            var resetButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">Reset</button>');
12065            resetButton.on('click', function(event){
12066                event.preventDefault();
12067                $element.css({
12068                    width: '',
12069                    height: ''
12070                });
12071                finishEdit();
12072            });
12073            buttonGroup.append(fullButton);
12074            buttonGroup.append(halfButton);
12075            buttonGroup.append(quartButton);
12076            buttonGroup.append(resetButton);
12077            container.append(buttonGroup);
12078
12079            buttonGroup = angular.element('<div class="btn-group" style="padding-right: 6px;">');
12080            var floatLeft = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-align-left"></i></button>');
12081            floatLeft.on('click', function(event){
12082                event.preventDefault();
12083                // webkit
12084                $element.css('float', 'left');
12085                // firefox
12086                $element.css('cssFloat', 'left');
12087                // IE < 8
12088                $element.css('styleFloat', 'left');
12089                finishEdit();
12090            });
12091            var floatRight = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-align-right"></i></button>');
12092            floatRight.on('click', function(event){
12093                event.preventDefault();
12094                // webkit
12095                $element.css('float', 'right');
12096                // firefox
12097                $element.css('cssFloat', 'right');
12098                // IE < 8
12099                $element.css('styleFloat', 'right');
12100                finishEdit();
12101            });
12102            var floatNone = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-align-justify"></i></button>');
12103            floatNone.on('click', function(event){
12104                event.preventDefault();
12105                // webkit
12106                $element.css('float', '');
12107                // firefox
12108                $element.css('cssFloat', '');
12109                // IE < 8
12110                $element.css('styleFloat', '');
12111                finishEdit();
12112            });
12113            buttonGroup.append(floatLeft);
12114            buttonGroup.append(floatNone);
12115            buttonGroup.append(floatRight);
12116            container.append(buttonGroup);
12117
12118            buttonGroup = angular.element('<div class="btn-group">');
12119            var remove = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-trash-o"></i></button>');
12120            remove.on('click', function(event){
12121                event.preventDefault();
12122                $element.remove();
12123                finishEdit();
12124            });
12125            buttonGroup.append(remove);
12126            container.append(buttonGroup);
12127
12128            editorScope.showPopover($element);
12129            editorScope.showResizeOverlay($element);
12130        },
12131        aOnSelectAction: function(event, $element, editorScope){
12132            // setup the editor toolbar
12133            // Credit to the work at http://hackerwins.github.io/summernote/ for this editbar logic
12134            event.preventDefault();
12135            editorScope.displayElements.popover.css('width', '436px');
12136            var container = editorScope.displayElements.popoverContainer;
12137            container.empty();
12138            container.css('line-height', '28px');
12139            var link = angular.element('<a href="' + $element.attr('href') + '" target="_blank">' + $element.attr('href') + '</a>');
12140            link.css({
12141                'display': 'inline-block',
12142                'max-width': '200px',
12143                'overflow': 'hidden',
12144                'text-overflow': 'ellipsis',
12145                'white-space': 'nowrap',
12146                'vertical-align': 'middle'
12147            });
12148            container.append(link);
12149            var buttonGroup = angular.element('<div class="btn-group pull-right">');
12150            var reLinkButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" tabindex="-1" unselectable="on" title="' + taTranslations.editLink.reLinkButton.tooltip + '"><i class="fa fa-edit icon-edit"></i></button>');
12151            reLinkButton.on('click', function(event){
12152                event.preventDefault();
12153                var urlLink = $window.prompt(taTranslations.insertLink.dialogPrompt, $element.attr('href'));
12154                if(urlLink && urlLink !== '' && urlLink !== 'http://'){
12155                    $element.attr('href', urlLink);
12156                    editorScope.updateTaBindtaTextElement();
12157                }
12158                editorScope.hidePopover();
12159            });
12160            buttonGroup.append(reLinkButton);
12161            var unLinkButton = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" tabindex="-1" unselectable="on" title="' + taTranslations.editLink.unLinkButton.tooltip + '"><i class="fa fa-unlink icon-unlink"></i></button>');
12162            // directly before this click event is fired a digest is fired off whereby the reference to $element is orphaned off
12163            unLinkButton.on('click', function(event){
12164                event.preventDefault();
12165                $element.replaceWith($element.contents());
12166                editorScope.updateTaBindtaTextElement();
12167                editorScope.hidePopover();
12168            });
12169            buttonGroup.append(unLinkButton);
12170            var targetToggle = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" tabindex="-1" unselectable="on">' + taTranslations.editLink.targetToggle.buttontext + '</button>');
12171            if($element.attr('target') === '_blank'){
12172                targetToggle.addClass('active');
12173            }
12174            targetToggle.on('click', function(event){
12175                event.preventDefault();
12176                $element.attr('target', ($element.attr('target') === '_blank') ? '' : '_blank');
12177                targetToggle.toggleClass('active');
12178                editorScope.updateTaBindtaTextElement();
12179            });
12180            buttonGroup.append(targetToggle);
12181            container.append(buttonGroup);
12182            editorScope.showPopover($element);
12183        },
12184        extractYoutubeVideoId: function(url) {
12185            var re = /(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/i;
12186            var match = url.match(re);
12187            return (match && match[1]) || null;
12188        }
12189    };
12190}])
12191.run(['taRegisterTool', '$window', 'taTranslations', 'taSelection', 'taToolFunctions', '$sanitize', 'taOptions', '$log',
12192    function(taRegisterTool, $window, taTranslations, taSelection, taToolFunctions, $sanitize, taOptions, $log){
12193    // test for the version of $sanitize that is in use
12194    // You can disable this check by setting taOptions.textAngularSanitize == false
12195    var gv = {}; $sanitize('', gv);
12196    /* istanbul ignore next, throws error */
12197    if ((taOptions.forceTextAngularSanitize===true) && (gv.version !== 'taSanitize')) {
12198        throw angular.$$minErr('textAngular')("textAngularSetup", "The textAngular-sanitize provider has been replaced by another -- have you included angular-sanitize by mistake?");
12199    }
12200    taRegisterTool("html", {
12201        iconclass: 'fa fa-code',
12202        tooltiptext: taTranslations.html.tooltip,
12203        action: function(){
12204            this.$editor().switchView();
12205        },
12206        activeState: function(){
12207            return this.$editor().showHtml;
12208        }
12209    });
12210    // add the Header tools
12211    // convenience functions so that the loop works correctly
12212    var _retActiveStateFunction = function(q){
12213        return function(){ return this.$editor().queryFormatBlockState(q); };
12214    };
12215    var headerAction = function(){
12216        return this.$editor().wrapSelection("formatBlock", "<" + this.name.toUpperCase() +">");
12217    };
12218    angular.forEach(['h1','h2','h3','h4','h5','h6'], function(h){
12219        taRegisterTool(h.toLowerCase(), {
12220            buttontext: h.toUpperCase(),
12221            tooltiptext: taTranslations.heading.tooltip + h.charAt(1),
12222            action: headerAction,
12223            activeState: _retActiveStateFunction(h.toLowerCase())
12224        });
12225    });
12226    taRegisterTool('p', {
12227        buttontext: 'P',
12228        tooltiptext: taTranslations.p.tooltip,
12229        action: function(){
12230            return this.$editor().wrapSelection("formatBlock", "<P>");
12231        },
12232        activeState: function(){ return this.$editor().queryFormatBlockState('p'); }
12233    });
12234    // key: pre -> taTranslations[key].tooltip, taTranslations[key].buttontext
12235    taRegisterTool('pre', {
12236        buttontext: 'pre',
12237        tooltiptext: taTranslations.pre.tooltip,
12238        action: function(){
12239            return this.$editor().wrapSelection("formatBlock", "<PRE>");
12240        },
12241        activeState: function(){ return this.$editor().queryFormatBlockState('pre'); }
12242    });
12243    taRegisterTool('ul', {
12244        iconclass: 'fa fa-list-ul',
12245        tooltiptext: taTranslations.ul.tooltip,
12246        action: function(){
12247            return this.$editor().wrapSelection("insertUnorderedList", null);
12248        },
12249        activeState: function(){ return this.$editor().queryCommandState('insertUnorderedList'); }
12250    });
12251    taRegisterTool('ol', {
12252        iconclass: 'fa fa-list-ol',
12253        tooltiptext: taTranslations.ol.tooltip,
12254        action: function(){
12255            return this.$editor().wrapSelection("insertOrderedList", null);
12256        },
12257        activeState: function(){ return this.$editor().queryCommandState('insertOrderedList'); }
12258    });
12259    taRegisterTool('quote', {
12260        iconclass: 'fa fa-quote-right',
12261        tooltiptext: taTranslations.quote.tooltip,
12262        action: function(){
12263            return this.$editor().wrapSelection("formatBlock", "<BLOCKQUOTE>");
12264        },
12265        activeState: function(){ return this.$editor().queryFormatBlockState('blockquote'); }
12266    });
12267    taRegisterTool('undo', {
12268        iconclass: 'fa fa-undo',
12269        tooltiptext: taTranslations.undo.tooltip,
12270        action: function(){
12271            return this.$editor().wrapSelection("undo", null);
12272        }
12273    });
12274    taRegisterTool('redo', {
12275        iconclass: 'fa fa-repeat',
12276        tooltiptext: taTranslations.redo.tooltip,
12277        action: function(){
12278            return this.$editor().wrapSelection("redo", null);
12279        }
12280    });
12281    taRegisterTool('bold', {
12282        iconclass: 'fa fa-bold',
12283        tooltiptext: taTranslations.bold.tooltip,
12284        action: function(){
12285            return this.$editor().wrapSelection("bold", null);
12286        },
12287        activeState: function(){
12288            return this.$editor().queryCommandState('bold');
12289        },
12290        commandKeyCode: 98
12291    });
12292    taRegisterTool('justifyLeft', {
12293        iconclass: 'fa fa-align-left',
12294        tooltiptext: taTranslations.justifyLeft.tooltip,
12295        action: function(){
12296            return this.$editor().wrapSelection("justifyLeft", null);
12297        },
12298        activeState: function(commonElement){
12299            /* istanbul ignore next: */
12300            if (commonElement && commonElement.nodeName === '#document') return false;
12301            var result = false;
12302            if (commonElement) {
12303                // commonELement.css('text-align') can throw an error 'Cannot read property 'defaultView' of null' in rare conditions
12304                // so we do try catch here...
12305                try {
12306                    result =
12307                        commonElement.css('text-align') === 'left' ||
12308                        commonElement.attr('align') === 'left' ||
12309                        (
12310                            commonElement.css('text-align') !== 'right' &&
12311                            commonElement.css('text-align') !== 'center' &&
12312                            commonElement.css('text-align') !== 'justify' && !this.$editor().queryCommandState('justifyRight') && !this.$editor().queryCommandState('justifyCenter')
12313                        ) && !this.$editor().queryCommandState('justifyFull');
12314                } catch(e) {
12315                    /* istanbul ignore next: error handler */
12316                    //console.log(e);
12317                    result = false;
12318                }
12319            }
12320            result = result || this.$editor().queryCommandState('justifyLeft');
12321            return result;
12322        }
12323    });
12324    taRegisterTool('justifyRight', {
12325        iconclass: 'fa fa-align-right',
12326        tooltiptext: taTranslations.justifyRight.tooltip,
12327        action: function(){
12328            return this.$editor().wrapSelection("justifyRight", null);
12329        },
12330        activeState: function(commonElement){
12331            /* istanbul ignore next: */
12332            if (commonElement && commonElement.nodeName === '#document') return false;
12333            var result = false;
12334            if(commonElement) {
12335                // commonELement.css('text-align') can throw an error 'Cannot read property 'defaultView' of null' in rare conditions
12336                // so we do try catch here...
12337                try {
12338                    result = commonElement.css('text-align') === 'right';
12339                } catch(e) {
12340                    /* istanbul ignore next: error handler */
12341                    //console.log(e);
12342                    result = false;
12343                }
12344            }
12345            result = result || this.$editor().queryCommandState('justifyRight');
12346            return result;
12347        }
12348    });
12349    taRegisterTool('justifyFull', {
12350        iconclass: 'fa fa-align-justify',
12351        tooltiptext: taTranslations.justifyFull.tooltip,
12352        action: function(){
12353            return this.$editor().wrapSelection("justifyFull", null);
12354        },
12355        activeState: function(commonElement){
12356            var result = false;
12357            if(commonElement) {
12358                // commonELement.css('text-align') can throw an error 'Cannot read property 'defaultView' of null' in rare conditions
12359                // so we do try catch here...
12360                try {
12361                    result = commonElement.css('text-align') === 'justify';
12362                } catch(e) {
12363                    /* istanbul ignore next: error handler */
12364                    //console.log(e);
12365                    result = false;
12366                }
12367            }
12368            result = result || this.$editor().queryCommandState('justifyFull');
12369            return result;
12370        }
12371    });
12372    taRegisterTool('justifyCenter', {
12373        iconclass: 'fa fa-align-center',
12374        tooltiptext: taTranslations.justifyCenter.tooltip,
12375        action: function(){
12376            return this.$editor().wrapSelection("justifyCenter", null);
12377        },
12378        activeState: function(commonElement){
12379            /* istanbul ignore next: */
12380            if (commonElement && commonElement.nodeName === '#document') return false;
12381            var result = false;
12382            if(commonElement) {
12383                // commonELement.css('text-align') can throw an error 'Cannot read property 'defaultView' of null' in rare conditions
12384                // so we do try catch here...
12385                try {
12386                    result = commonElement.css('text-align') === 'center';
12387                } catch(e) {
12388                    /* istanbul ignore next: error handler */
12389                    //console.log(e);
12390                    result = false;
12391                }
12392
12393            }
12394            result = result || this.$editor().queryCommandState('justifyCenter');
12395            return result;
12396        }
12397    });
12398    taRegisterTool('indent', {
12399        iconclass: 'fa fa-indent',
12400        tooltiptext: taTranslations.indent.tooltip,
12401        action: function(){
12402            return this.$editor().wrapSelection("indent", null);
12403        },
12404        activeState: function(){
12405            return this.$editor().queryFormatBlockState('blockquote');
12406        },
12407        commandKeyCode: 'TabKey'
12408    });
12409    taRegisterTool('outdent', {
12410        iconclass: 'fa fa-outdent',
12411        tooltiptext: taTranslations.outdent.tooltip,
12412        action: function(){
12413            return this.$editor().wrapSelection("outdent", null);
12414        },
12415        activeState: function(){
12416            return false;
12417        },
12418        commandKeyCode: 'ShiftTabKey'
12419    });
12420    taRegisterTool('italics', {
12421        iconclass: 'fa fa-italic',
12422        tooltiptext: taTranslations.italic.tooltip,
12423        action: function(){
12424            return this.$editor().wrapSelection("italic", null);
12425        },
12426        activeState: function(){
12427            return this.$editor().queryCommandState('italic');
12428        },
12429        commandKeyCode: 105
12430    });
12431    taRegisterTool('underline', {
12432        iconclass: 'fa fa-underline',
12433        tooltiptext: taTranslations.underline.tooltip,
12434        action: function(){
12435            return this.$editor().wrapSelection("underline", null);
12436        },
12437        activeState: function(){
12438            return this.$editor().queryCommandState('underline');
12439        },
12440        commandKeyCode: 117
12441    });
12442    taRegisterTool('strikeThrough', {
12443        iconclass: 'fa fa-strikethrough',
12444        tooltiptext: taTranslations.strikeThrough.tooltip,
12445        action: function(){
12446            return this.$editor().wrapSelection("strikeThrough", null);
12447        },
12448        activeState: function(){
12449            return document.queryCommandState('strikeThrough');
12450        }
12451    });
12452    taRegisterTool('clear', {
12453        iconclass: 'fa fa-ban',
12454        tooltiptext: taTranslations.clear.tooltip,
12455        action: function(deferred, restoreSelection){
12456            var i, selectedElements, elementsSeen;
12457
12458            this.$editor().wrapSelection("removeFormat", null);
12459            var possibleNodes = angular.element(taSelection.getSelectionElement());
12460            selectedElements = taSelection.getAllSelectedElements();
12461            //$log.log('selectedElements:', selectedElements);
12462            // remove lists
12463            var removeListElements = function(list, pe){
12464                list = angular.element(list);
12465                var prevElement = pe;
12466                if (!pe) {
12467                    prevElement = list;
12468                }
12469                angular.forEach(list.children(), function(liElem){
12470                    if (liElem.tagName.toLowerCase() === 'ul' ||
12471                        liElem.tagName.toLowerCase() === 'ol') {
12472                        prevElement = removeListElements(liElem, prevElement);
12473                    } else {
12474                        var newElem = angular.element('<p></p>');
12475                        newElem.html(angular.element(liElem).html());
12476                        prevElement.after(newElem);
12477                        prevElement = newElem;
12478                    }
12479                });
12480                list.remove();
12481                return prevElement;
12482            };
12483
12484            angular.forEach(selectedElements, function(element) {
12485                if (element.nodeName.toLowerCase() === 'ul' ||
12486                    element.nodeName.toLowerCase() === 'ol') {
12487                    //console.log('removeListElements', element);
12488                    removeListElements(element);
12489                }
12490            });
12491
12492            angular.forEach(possibleNodes.find("ul"), removeListElements);
12493            angular.forEach(possibleNodes.find("ol"), removeListElements);
12494
12495            // clear out all class attributes. These do not seem to be cleared via removeFormat
12496            var $editor = this.$editor();
12497            var recursiveRemoveClass = function(node){
12498                node = angular.element(node);
12499                /* istanbul ignore next: this is not triggered in tests any longer since we now never select the whole displayELement */
12500                if(node[0] !== $editor.displayElements.text[0]) {
12501                    node.removeAttr('class');
12502                }
12503                angular.forEach(node.children(), recursiveRemoveClass);
12504            };
12505            angular.forEach(possibleNodes, recursiveRemoveClass);
12506            // check if in list. If not in list then use formatBlock option
12507            if(possibleNodes[0] && possibleNodes[0].tagName.toLowerCase() !== 'li' &&
12508                possibleNodes[0].tagName.toLowerCase() !== 'ol' &&
12509                possibleNodes[0].tagName.toLowerCase() !== 'ul' &&
12510                possibleNodes[0].getAttribute("contenteditable") !== "true") {
12511                this.$editor().wrapSelection("formatBlock", "default");
12512            }
12513            restoreSelection();
12514        }
12515    });
12516
12517        /* jshint -W099 */
12518    /****************************
12519     //  we don't use this code - since the previous way CLEAR is expected to work does not clear partially selected <li>
12520
12521     var removeListElement = function(listE){
12522                console.log(listE);
12523                var _list = listE.parentNode.childNodes;
12524                console.log('_list', _list);
12525                var _preLis = [], _postLis = [], _found = false;
12526                for (i = 0; i < _list.length; i++) {
12527                    if (_list[i] === listE) {
12528                        _found = true;
12529                    } else if (!_found) _preLis.push(_list[i]);
12530                    else _postLis.push(_list[i]);
12531                }
12532                var _parent = angular.element(listE.parentNode);
12533                var newElem = angular.element('<p></p>');
12534                newElem.html(angular.element(listE).html());
12535                if (_preLis.length === 0 || _postLis.length === 0) {
12536                    if (_postLis.length === 0) _parent.after(newElem);
12537                    else _parent[0].parentNode.insertBefore(newElem[0], _parent[0]);
12538
12539                    if (_preLis.length === 0 && _postLis.length === 0) _parent.remove();
12540                    else angular.element(listE).remove();
12541                } else {
12542                    var _firstList = angular.element('<' + _parent[0].tagName + '></' + _parent[0].tagName + '>');
12543                    var _secondList = angular.element('<' + _parent[0].tagName + '></' + _parent[0].tagName + '>');
12544                    for (i = 0; i < _preLis.length;
12544 i++) _firstList.append(angular.element(_preLis[i]));
12545                    for (i = 0; i < _postLis.length; i++) _secondList.append(angular.element(_postLis[i]));
12546                    _parent.after(_secondList);
12547                    _parent.after(newElem);
12548                    _parent.after(_firstList);
12549                    _parent.remove();
12550                }
12551                taSelection.setSelectionToElementEnd(newElem[0]);
12552            };
12553
12554     elementsSeen = [];
12555     if (selectedElements.length !==0) console.log(selectedElements);
12556     angular.forEach(selectedElements, function (element) {
12557                if (elementsSeen.indexOf(element) !== -1 || elementsSeen.indexOf(element.parentElement) !== -1) {
12558                    return;
12559                }
12560                elementsSeen.push(element);
12561                if (element.nodeName.toLowerCase() === 'li') {
12562                    console.log('removeListElement', element);
12563                    removeListElement(element);
12564                }
12565                else if (element.parentElement && element.parentElement.nodeName.toLowerCase() === 'li') {
12566                    console.log('removeListElement', element.parentElement);
12567                    elementsSeen.push(element.parentElement);
12568                    removeListElement(element.parentElement);
12569                }
12570            });
12571     **********************/
12572
12573    /**********************
12574     if(possibleNodes[0].tagName.toLowerCase() === 'li'){
12575                var _list = possibleNodes[0].parentNode.childNodes;
12576                var _preLis = [], _postLis = [], _found = false;
12577                for(i = 0; i < _list.length; i++){
12578                    if(_list[i] === possibleNodes[0]){
12579                        _found = true;
12580                    }else if(!_found) _preLis.push(_list[i]);
12581                    else _postLis.push(_list[i]);
12582                }
12583                var _parent = angular.element(possibleNodes[0].parentNode);
12584                var newElem = angular.element('<p></p>');
12585                newElem.html(angular.element(possibleNodes[0]).html());
12586                if(_preLis.length === 0 || _postLis.length === 0){
12587                    if(_postLis.length === 0) _parent.after(newElem);
12588                    else _parent[0].parentNode.insertBefore(newElem[0], _parent[0]);
12589
12590                    if(_preLis.length === 0 && _postLis.length === 0) _parent.remove();
12591                    else angular.element(possibleNodes[0]).remove();
12592                }else{
12593                    var _firstList = angular.element('<'+_parent[0].tagName+'></'+_parent[0].tagName+'>');
12594                    var _secondList = angular.element('<'+_parent[0].tagName+'></'+_parent[0].tagName+'>');
12595                    for(i = 0; i < _preLis.length; i++) _firstList.append(angular.element(_preLis[i]));
12596                    for(i = 0; i < _postLis.length; i++) _secondList.append(angular.element(_postLis[i]));
12597                    _parent.after(_secondList);
12598                    _parent.after(newElem);
12599                    _parent.after(_firstList);
12600                    _parent.remove();
12601                }
12602                taSelection.setSelectionToElementEnd(newElem[0]);
12603            }
12604     *******************/
12605
12606
12607    /* istanbul ignore next: if it's javascript don't worry - though probably should show some kind of error message */
12608    var blockJavascript = function (link) {
12609        if (link.toLowerCase().indexOf('javascript')!==-1) {
12610            return true;
12611        }
12612        return false;
12613    };
12614
12615    taRegisterTool('insertImage', {
12616        iconclass: 'fa fa-picture-o',
12617        tooltiptext: taTranslations.insertImage.tooltip,
12618        action: function(){
12619            var imageLink;
12620            imageLink = $window.prompt(taTranslations.insertImage.dialogPrompt, 'http://');
12621            if(imageLink && imageLink !== '' && imageLink !== 'http://'){
12622                /* istanbul ignore next: don't know how to test this... since it needs a dialogPrompt */
12623                // block javascript here
12624                if (!blockJavascript(imageLink)) {
12625                    if (taSelection.getSelectionElement().tagName && taSelection.getSelectionElement().tagName.toLowerCase() === 'a') {
12626                        // due to differences in implementation between FireFox and Chrome, we must move the
12627                        // insertion point past the <a> element, otherwise FireFox inserts inside the <a>
vendor: 7,407 bytes, lines 12628-12764
12628                        // With this change, both FireFox and Chrome behave the same way!
12629                        taSelection.setSelectionAfterElement(taSelection.getSelectionElement());
12630                    }
12631                    // In the past we used the simple statement:
12632                    //return this.$editor().wrapSelection('insertImage', imageLink, true);
12633                    //
12634                    // However on Firefox only, when the content is empty this is a problem
12635                    // See Issue #1201
12636                    // Investigation reveals that Firefox only inserts a <p> only!!!!
12637                    // So now we use insertHTML here and all is fine.
12638                    // NOTE: this is what 'insertImage' is supposed to do anyway!
12639                    var embed = '<img src="' + imageLink + '">';
12640                    return this.$editor().wrapSelection('insertHTML', embed, true);
12641                }
12642            }
12643        },
12644        onElementSelect: {
12645            element: 'img',
12646            action: taToolFunctions.imgOnSelectAction
12647        }
12648    });
12649    taRegisterTool('insertVideo', {
12650        iconclass: 'fa fa-youtube-play',
12651        tooltiptext: taTranslations.insertVideo.tooltip,
12652        action: function(){
12653            var urlPrompt;
12654            urlPrompt = $window.prompt(taTranslations.insertVideo.dialogPrompt, 'https://');
12655            // block javascript here
12656            /* istanbul ignore else: if it's javascript don't worry - though probably should show some kind of error message */
12657            if (!blockJavascript(urlPrompt)) {
12658
12659                if (urlPrompt && urlPrompt !== '' && urlPrompt !== 'https://') {
12660
12661                    videoId = taToolFunctions.extractYoutubeVideoId(urlPrompt);
12662
12663                    /* istanbul ignore else: if it's invalid don't worry - though probably should show some kind of error message */
12664                    if (videoId) {
12665                        // create the embed link
12666                        var urlLink = "https://www.youtube.com/embed/" + videoId;
12667                        // create the HTML
12668                        // for all options see: http://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api
12669                        // maxresdefault.jpg seems to be undefined on some.
12670                        var embed = '<img class="ta-insert-video" src="https://img.youtube.com/vi/' + videoId + '/hqdefault.jpg" ta-insert-video="' + urlLink + '" contenteditable="false" allowfullscreen="true" frameborder="0" />';
12671                        /* istanbul ignore next: don't know how to test this... since it needs a dialogPrompt */
12672                        if (taSelection.getSelectionElement().tagName && taSelection.getSelectionElement().tagName.toLowerCase() === 'a') {
12673                            // due to differences in implementation between FireFox and Chrome, we must move the
12674                            // insertion point past the <a> element, otherwise FireFox inserts inside the <a>
12675                            // With this change, both FireFox and Chrome behave the same way!
12676                            taSelection.setSelectionAfterElement(taSelection.getSelectionElement());
12677                        }
12678                        // insert
12679                        return this.$editor().wrapSelection('insertHTML', embed, true);
12680                    }
12681                }
12682            }
12683        },
12684        onElementSelect: {
12685            element: 'img',
12686            onlyWithAttrs: ['ta-insert-video'],
12687            action: taToolFunctions.imgOnSelectAction
12688        }
12689    });
12690    taRegisterTool('insertLink', {
12691        tooltiptext: taTranslations.insertLink.tooltip,
12692        iconclass: 'fa fa-link',
12693        action: function(){
12694            var urlLink;
12695            // if this link has already been set, we need to just edit the existing link
12696            /* istanbul ignore if: we do not test this */
12697            if (taSelection.getSelectionElement().tagName && taSelection.getSelectionElement().tagName.toLowerCase() === 'a') {
12698                urlLink = $window.prompt(taTranslations.insertLink.dialogPrompt, taSelection.getSelectionElement().href);
12699            } else {
12700                urlLink = $window.prompt(taTranslations.insertLink.dialogPrompt, 'http://');
12701            }
12702            if(urlLink && urlLink !== '' && urlLink !== 'http://'){
12703                // block javascript here
12704                /* istanbul ignore else: if it's javascript don't worry - though probably should show some kind of error message */
12705                if (!blockJavascript(urlLink)) {
12706                    return this.$editor().wrapSelection('createLink', urlLink, true);
12707                }
12708            }
12709        },
12710        activeState: function(commonElement){
12711            if(commonElement) return commonElement[0].tagName === 'A';
12712            return false;
12713        },
12714        onElementSelect: {
12715            element: 'a',
12716            action: taToolFunctions.aOnSelectAction
12717        }
12718    });
12719    taRegisterTool('wordcount', {
12720        display: '<div id="toolbarWC" style="display:block; min-width:100px;">Words: <span ng-bind="wordcount"></span></div>',
12721        disabled: true,
12722        wordcount: 0,
12723        activeState: function(){ // this fires on keyup
12724            var textElement = this.$editor().displayElements.text;
12725            /* istanbul ignore next: will default to '' when undefined */
12726            var workingHTML = textElement[0].innerHTML || '';
12727            var noOfWords = 0;
12728
12729            /* istanbul ignore if: will default to '' when undefined */
12730            if (workingHTML.replace(/\s*<[^>]*?>\s*/g, '') !== '') {
12731                if (workingHTML.trim() !== '') {
12732                    noOfWords = workingHTML.replace(/<\/?(b|i|em|strong|span|u|strikethrough|a|img|small|sub|sup|label)( [^>*?])?>/gi, '') // remove inline tags without adding spaces
12733                        .replace(/(<[^>]*?>\s*<[^>]*?>)/ig, ' ') // replace adjacent tags with possible space between with a space
12734                        .replace(/(<[^>]*?>)/ig, '') // remove any singular tags
12735                        .replace(/\s+/ig, ' ') // condense spacing
12736                        .match(/\S+/g).length; // count remaining non-space strings
12737                }
12738            }
12739
12740            //Set current scope
12741            this.wordcount = noOfWords;
12742            //Set editor scope
12743            this.$editor().wordcount = noOfWords;
12744
12745            return false;
12746        }
12747    });
12748    taRegisterTool('charcount', {
12749        display: '<div id="toolbarCC" style="display:block; min-width:120px;">Characters: <span ng-bind="charcount"></span></div>',
12750        disabled: true,
12751        charcount: 0,
12752        activeState: function(){ // this fires on keyup
12753            var textElement = this.$editor().displayElements.text;
12754            var sourceText = textElement[0].innerText || textElement[0].textContent; // to cover the non-jquery use case.
12755
12756            // Caculate number of chars
12757            var noOfChars = sourceText.replace(/(\r\n|\n|\r)/gm,"").replace(/^\s+/g,' ').replace(/\s+$/g, ' ').length;
12758            //Set current scope
12759            this.charcount = noOfChars;
12760            //Set editor scope
12761            this.$editor().charcount = noOfChars;
12762            return false;
12763        }
12764    });
vendor: 232,846 bytes, lines 12765-16941
12765}]);
12766
12767/*
12768@license textAngular
12769Author : Austin Anderson
12770License : 2013 MIT
12771Version 1.5.16
12772
12773See README.md or https://github.com/fraywing/textAngular/wiki for requirements and use.
12774*/
12775
12776/*
12777Commonjs package manager support (eg componentjs).
12778*/
12779
12780
12781"use strict";// NOTE: textAngularVersion must match the Gruntfile.js 'setVersion' task.... and have format v/d+./d+./d+
12782var textAngularVersion = 'v1.5.16';   // This is automatically updated during the build process to the current release!
12783
12784
12785// IE version detection - http://stackoverflow.com/questions/4169160/javascript-ie-detection-why-not-use-simple-conditional-comments
12786// We need this as IE sometimes plays funny tricks with the contenteditable.
12787// ----------------------------------------------------------
12788// If you're not in IE (or IE version is less than 5) then:
12789// ie === undefined
12790// If you're in IE (>=5) then you can determine which version:
12791// ie === 7; // IE7
12792// Thus, to detect IE:
12793// if (ie) {}
12794// And to detect the version:
12795// ie === 6 // IE6
12796// ie > 7 // IE8, IE9, IE10 ...
12797// ie < 9 // Anything less than IE9
12798// ----------------------------------------------------------
12799/* istanbul ignore next: untestable browser check */
12800var _browserDetect = {
12801	ie: (function(){
12802		var undef,
12803			v = 3,
12804			div = document.createElement('div'),
12805			all = div.getElementsByTagName('i');
12806
12807		while (
12808			div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
12809			all[0]
12810		);
12811
12812		return v > 4 ? v : undef;
12813	}()),
12814	webkit: /AppleWebKit\/([\d.]+)/i.test(navigator.userAgent),
12815	isFirefox: navigator.userAgent.toLowerCase().indexOf('firefox') > -1
12816};
12817
12818// Global to textAngular to measure performance where needed
12819/* istanbul ignore next: untestable browser check */
12820var performance = performance || {};
12821/* istanbul ignore next: untestable browser check */
12822performance.now = (function() {
12823	return performance.now       ||
12824		performance.mozNow    ||
12825		performance.msNow     ||
12826		performance.oNow      ||
12827		performance.webkitNow ||
12828		function() { return new Date().getTime(); };
12829})();
12830// usage is:
12831// var t0 = performance.now();
12832// doSomething();
12833// var t1 = performance.now();
12834// console.log('Took', (t1 - t0).toFixed(4), 'milliseconds to do something!');
12835//
12836
12837// turn html into pure text that shows visiblity
12838function stripHtmlToText(html)
12839{
12840	var tmp = document.createElement("DIV");
12841	tmp.innerHTML = html;
12842	var res = tmp.textContent || tmp.innerText || '';
12843	res.replace('\u200B', ''); // zero width space
12844	res = res.trim();
12845	return res;
12846}
12847// get html
12848function getDomFromHtml(html)
12849{
12850	var tmp = document.createElement("DIV");
12851	tmp.innerHTML = html;
12852	return tmp;
12853}
12854
12855
12856// Global to textAngular REGEXP vars for block and list elements.
12857
12858var BLOCKELEMENTS = /^(address|article|aside|audio|blockquote|canvas|center|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/i;
12859var LISTELEMENTS = /^(ul|li|ol)$/i;
12860// updated VALIDELEMENTS to include #text and span so that we can use nodeName instead of tagName
12861var VALIDELEMENTS = /^(#text|span|address|article|aside|audio|blockquote|canvas|center|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/i;
12862
12863
12864// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Compatibility
12865/* istanbul ignore next: trim shim for older browsers */
12866if (!String.prototype.trim) {
12867	String.prototype.trim = function () {
12868		return this.replace(/^\s+|\s+$/g, '');
12869	};
12870}
12871
12872/*
12873	Custom stylesheet for the placeholders rules.
12874	Credit to: http://davidwalsh.name/add-rules-stylesheets
12875*/
12876var sheet, addCSSRule, removeCSSRule, _addCSSRule, _removeCSSRule, _getRuleIndex;
12877/* istanbul ignore else: IE <8 test*/
12878if(_browserDetect.ie > 8 || _browserDetect.ie === undefined){
12879	var _sheets = document.styleSheets;
12880	/* istanbul ignore next: preference for stylesheet loaded externally */
12881	for(var i = 0; i < _sheets.length; i++){
12882		if(_sheets[i].media.length === 0 || _sheets[i].media.mediaText.match(/(all|screen)/ig)){
12883			if(_sheets[i].href){
12884				if(_sheets[i].href.match(/textangular\.(min\.|)css/ig)){
12885					sheet = _sheets[i];
12886					break;
12887				}
12888			}
12889		}
12890	}
12891	/* istanbul ignore next: preference for stylesheet loaded externally */
12892	if(!sheet){
12893		// this sheet is used for the placeholders later on.
12894		sheet = (function() {
12895			// Create the <style> tag
12896			var style = document.createElement("style");
12897			/* istanbul ignore else : WebKit hack :( */
12898			if(_browserDetect.webkit) style.appendChild(document.createTextNode(""));
12899
12900			// Add the <style> element to the page, add as first so the styles can be overridden by custom stylesheets
12901			document.getElementsByTagName('head')[0].appendChild(style);
12902
12903			return style.sheet;
12904		})();
12905	}
12906
12907	// use as: addCSSRule("header", "float: left");
12908	addCSSRule = function(selector, rules) {
12909		return _addCSSRule(sheet, selector, rules);
12910	};
12911	_addCSSRule = function(_sheet, selector, rules){
12912		var insertIndex;
12913		var insertedRule;
12914		// This order is important as IE 11 has both cssRules and rules but they have different lengths - cssRules is correct, rules gives an error in IE 11
12915		/* istanbul ignore next: browser catches */
12916		if(_sheet.cssRules) insertIndex = Math.max(_sheet.cssRules.length - 1, 0);
12917		else if(_sheet.rules) insertIndex = Math.max(_sheet.rules.length - 1, 0);
12918
12919		/* istanbul ignore else: untestable IE option */
12920		if(_sheet.insertRule) {
12921			_sheet.insertRule(selector + "{" + rules + "}", insertIndex);
12922		}
12923		else {
12924			_sheet.addRule(selector, rules, insertIndex);
12925		}
12926		/* istanbul ignore next: browser catches */
12927		if(sheet.rules) insertedRule = sheet.rules[insertIndex];
12928		else if(sheet.cssRules) insertedRule = sheet.cssRules[insertIndex];
12929		// return the inserted stylesheet rule
12930		return insertedRule;
12931	};
12932
12933	_getRuleIndex = function(rule, rules) {
12934		var i, ruleIndex;
12935		for (i=0; i < rules.length; i++) {
12936			/* istanbul ignore else: check for correct rule */
12937			if (rules[i].cssText === rule.cssText) {
12938				ruleIndex = i;
12939				break;
12940			}
12941		}
12942		return ruleIndex;
12943	};
12944
12945	removeCSSRule = function(rule){
12946		_removeCSSRule(sheet, rule);
12947	};
12948	/* istanbul ignore next: tests are browser specific */
12949	_removeCSSRule = function(sheet, rule){
12950		var rules = sheet.cssRules || sheet.rules;
12951		if(!rules || rules.length === 0) return;
12952		var ruleIndex = _getRuleIndex(rule, rules);
12953		if(sheet.removeRule){
12954			sheet.removeRule(ruleIndex);
12955		}else{
12956			sheet.deleteRule(ruleIndex);
12957		}
12958	};
12959}
12960
12961angular.module('textAngular.factories', [])
12962.factory('taBrowserTag', [function(){
12963    return function(tag){
12964        /* istanbul ignore next: ie specific test */
12965        if(!tag) return (_browserDetect.ie <= 8)? 'P' : 'p';
12966        else if(tag === '') return (_browserDetect.ie === undefined)? 'div' : (_browserDetect.ie <= 8)? 'P' : 'p';
12967        else return (_browserDetect.ie <= 8)? tag.toUpperCase() : tag;
12968    };
12969}]).factory('taApplyCustomRenderers', ['taCustomRenderers', 'taDOM', function(taCustomRenderers, taDOM){
12970    return function(val){
12971        var element = angular.element('<div></div>');
12972        element[0].innerHTML = val;
12973
12974        angular.forEach(taCustomRenderers, function(renderer){
12975            var elements = [];
12976            // get elements based on what is defined. If both defined do secondary filter in the forEach after using selector string
12977            if(renderer.selector && renderer.selector !== '')
12978                elements = element.find(renderer.selector);
12979            /* istanbul ignore else: shouldn't fire, if it does we're ignoring everything */
12980            else if(renderer.customAttribute && renderer.customAttribute !== '')
12981                elements = taDOM.getByAttribute(element, renderer.customAttribute);
12982            // process elements if any found
12983            angular.forEach(elements, function(_element){
12984                _element = angular.element(_element);
12985                if(renderer.selector && renderer.selector !== '' && renderer.customAttribute && renderer.customAttribute !== ''){
12986                    if(_element.attr(renderer.customAttribute) !== undefined) renderer.renderLogic(_element);
12987                } else renderer.renderLogic(_element);
12988            });
12989        });
12990
12991        return element[0].innerHTML;
12992    };
12993}]).factory('taFixChrome', function(){
12994    // get whaterever rubbish is inserted in chrome
12995    // should be passed an html string, returns an html string
12996    var taFixChrome = function(html, keepStyles){
12997        if(!html || !angular.isString(html) || html.length <= 0) return html;
12998        // grab all elements with a style attibute
12999        // a betterSpanMatch matches only a style=... with matching quotes
13000        // this captures the whole:
13001        // 'style="background-color: rgb(255, 255, 255);"'
13002        var betterSpanMatch = /style\s?=\s?(["'])(?:(?=(\\?))\2.)*?\1/ig;
13003        // where the original spanMatch = /<([^>\/]+?)style=("([^\"]+)"|'([^']+)')([^>]*)>/ig;
13004        // captures too much and includes the front tag!
13005        var spanMatch = /<([^>\/]+?)style=("([^\"]+)"|'([^']+)')([^>]*)>/ig;
13006        var appleConvertedSpaceMatch = /<span class="Apple-converted-space">([^<]+)<\/span>/ig;
13007        var match, styleVal, appleSpaceVal, newTag, finalHtml = '', lastIndex = 0;
13008        // remove all the Apple-converted-space spans and replace with the content of the span
13009        //console.log('before:', html);
13010        /* istanbul ignore next: apple-contereted-space span match */
13011        while(match = appleConvertedSpaceMatch.exec(html)){
13012            appleSpaceVal = match[1];
13013            appleSpaceVal = appleSpaceVal.replace(/&nbsp;/ig, ' ');
13014            finalHtml += html.substring(lastIndex, match.index) + appleSpaceVal;
13015            lastIndex = match.index + match[0].length;
13016        }
13017        /* istanbul ignore next: apple-contereted-space span has matched */
13018        if (lastIndex) {
13019            // modified....
13020            finalHtml += html.substring(lastIndex);
13021            html=finalHtml;
13022            finalHtml='';
13023            lastIndex=0;
13024        }
13025        /////////////////////////////////////////////////////////////
13026        //
13027        // Allow control of this modification
13028        // taKeepStyles: False - removes these modification
13029        //
13030        // taFixChrome removes the following styles:
13031        //    font-family: inherit;
13032        //    line-height: <number>
13033        //    color: inherit;
13034        //    color: rgb( <rgb-component>#{3} )
13035        //    background-color: rgb( <rgb-component>#{3} )
13036        //
13037        /////////////////////////////////////////////////////////////
13038        if (!keepStyles) {
13039            while (match = betterSpanMatch.exec(html)) {
13040                finalHtml += html.substring(lastIndex, match.index-1);
13041                styleVal = match[0];
13042                // test for chrome inserted junk
13043                match = /font-family: inherit;|line-height: 1.[0-9]{3,12};|color: inherit; line-height: 1.1;|color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);|background-color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);/gi.exec(styleVal);
13044                if (match) {
13045                    styleVal = styleVal.replace(/( |)font-family: inherit;|( |)line-height: 1.[0-9]{3,12};|( |)color: inherit;|( |)color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);|( |)background-color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);/ig, '');
13046                    //console.log(styleVal, styleVal.length);
13047                    if (styleVal.length > 8) {
13048                        finalHtml += ' ' + styleVal;
13049                    }
13050                } else {
13051                    finalHtml += ' ' + styleVal;
13052                }
13053                lastIndex = betterSpanMatch.lastIndex;
13054            }
13055            finalHtml += html.substring(lastIndex);
13056        }
13057        //console.log('final:', finalHtml);
13058        // only replace when something has changed, else we get focus problems on inserting lists
13059        if(lastIndex > 0){
13060            // replace all empty strings
13061            var fe = finalHtml.replace(/<span\s?>(.*?)<\/span>(<br(\/|)>|)/ig, '$1');
13062            return fe;
13063        } else return html;
13064    };
13065    return taFixChrome;
13066}).factory('taSanitize', ['$sanitize', function taSanitizeFactory($sanitize){
13067
13068    var convert_infos = [
13069        {
13070            property: 'font-weight',
13071            values: [ 'bold' ],
13072            tag: 'b'
13073        },
13074        {
13075            property: 'font-style',
13076            values: [ 'italic' ],
13077            tag: 'i'
13078        }
13079    ];
13080
13081    var styleMatch = [];
13082    for(var i = 0; i < convert_infos.length; i++){
13083        var _partialStyle = '(' + convert_infos[i].property + ':\\s*(';
13084        for(var j = 0; j < convert_infos[i].values.length; j++){
13085            /* istanbul ignore next: not needed to be tested yet */
13086            if(j > 0) _partialStyle += '|';
13087            _partialStyle += convert_infos[i].values[j];
13088        }
13089        _partialStyle += ');)';
13090        styleMatch.push(_partialStyle);
13091    }
13092    var styleRegexString = '(' + styleMatch.join('|') + ')';
13093
13094    function wrapNested(html, wrapTag) {
13095        var depth = 0;
13096        var lastIndex = 0;
13097        var match;
13098        var tagRegex = /<[^>]*>/ig;
13099        while(match = tagRegex.exec(html)){
13100            lastIndex = match.index;
13101            if(match[0].substr(1, 1) === '/'){
13102                if(depth === 0) break;
13103                else depth--;
13104            }else depth++;
13105        }
13106        return wrapTag +
13107            html.substring(0, lastIndex) +
13108            // get the start tags reversed - this is safe as we construct the strings with no content except the tags
13109            angular.element(wrapTag)[0].outerHTML.substring(wrapTag.length) +
13110            html.substring(lastIndex);
13111    }
13112
13113    function transformLegacyStyles(html){
13114        if(!html || !angular.isString(html) || html.length <= 0) return html;
13115        var i;
13116        var styleElementMatch = /<([^>\/]+?)style=("([^"]+)"|'([^']+)')([^>]*)>/ig;
13117        var match, subMatch, styleVal, newTag, lastNewTag = '', newHtml, finalHtml = '', lastIndex = 0;
13118        while(match = styleElementMatch.exec(html)){
13119            // one of the quoted values ' or "
13120            /* istanbul ignore next: quotations match */
13121            styleVal = match[3] || match[4];
13122            var styleRegex = new RegExp(styleRegexString, 'i');
13123            // test for style values to change
13124            if(angular.isString(styleVal) && styleRegex.test(styleVal)){
13125                // remove build tag list
13126                newTag = '';
13127                // init regex here for exec
13128                var styleRegexExec = new RegExp(styleRegexString, 'ig');
13129                // find relevand tags and build a string of them
13130                while(subMatch = styleRegexExec.exec(styleVal)){
13131                    for(i = 0; i < convert_infos.length; i++){
13132                        if(!!subMatch[(i*2) + 2]){
13133                            newTag += '<' + convert_infos[i].tag + '>';
13134                        }
13135                    }
13136                }
13137                // recursively find more legacy styles in html before this tag and after the previous match (if any)
13138                newHtml = transformLegacyStyles(html.substring(lastIndex, match.index));
13139                // build up html
13140                if(lastNewTag.length > 0){
13141                    finalHtml += wrapNested(newHtml, lastNewTag);
13142                }else finalHtml += newHtml;
13143                // grab the style val without the transformed values
13144                styleVal = styleVal.replace(new RegExp(styleRegexString, 'ig'), '');
13145                // build the html tag
13146                finalHtml += '<' + match[1].trim();
13147                if(styleVal.length > 0) finalHtml += ' style="' + styleVal + '"';
13148                finalHtml += match[5] + '>';
13149                // update the start index to after this tag
13150                lastIndex = match.index + match[0].length;
13151                lastNewTag = newTag;
13152            }
13153        }
13154        if(lastNewTag.length > 0){
13155            finalHtml += wrapNested(html.substring(lastIndex), lastNewTag);
13156        }
13157        else finalHtml += html.substring(lastIndex);
13158        return finalHtml;
13159    }
13160
13161    function transformLegacyAttributes(html){
13162        if(!html || !angular.isString(html) || html.length <= 0) return html;
13163        // replace all align='...' tags with text-align attributes
13164        var attrElementMatch = /<([^>\/]+?)align=("([^"]+)"|'([^']+)')([^>]*)>/ig;
13165        var match, finalHtml = '', lastIndex = 0;
13166        // match all attr tags
13167        while(match = attrElementMatch.exec(html)){
13168            // add all html before this tag
13169            finalHtml += html.substring(lastIndex, match.index);
13170            // record last index after this tag
13171            lastIndex = match.index + match[0].length;
13172            // construct tag without the align attribute
13173            var newTag = '<' + match[1] + match[5];
13174            // add the style attribute
13175            if(/style=("([^"]+)"|'([^']+)')/ig.test(newTag)){
13176                /* istanbul ignore next: quotations match */
13177                newTag = newTag.replace(/style=("([^"]+)"|'([^']+)')/i, 'style="$2$3 text-align:' + (match[3] || match[4]) + ';"');
13178            }else{
13179                /* istanbul ignore next: quotations match */
13180                newTag += ' style="text-align:' + (match[3] || match[4]) + ';"';
13181            }
13182            newTag += '>';
13183            // add to html
13184            finalHtml += newTag;
13185        }
13186        // return with remaining html
13187        return finalHtml + html.substring(lastIndex);
13188    }
13189
13190    // use precompiled regexp for speed
13191    var rsb1 = new RegExp(/<span id="selectionBoundary_\d+_\d+" class="rangySelectionBoundary">[^<>]+?<\/span>/ig);
13192    var rsb2 = new RegExp(/<span class="rangySelectionBoundary" id="selectionBoundary_\d+_\d+">[^<>]+?<\/span>/ig);
13193    var rsb3 = new RegExp(/<span id="selectionBoundary_\d+_\d+" class="rangySelectionBoundary">[^<>]+?<\/span>/ig);
13194
13195    return function taSanitize(unsafe, oldsafe, ignore){
13196        // unsafe html should NEVER built into a DOM object via angular.element. This allows XSS to be inserted and run.
13197        if ( !ignore ) {
13198            try {
13199                unsafe = transformLegacyStyles(unsafe);
13200            } catch (e) {
13201            }
13202        }
13203
13204        // unsafe and oldsafe should be valid HTML strings
13205        // any exceptions (lets say, color for example) should be made here but with great care
13206        // setup unsafe element for modification
13207        unsafe = transformLegacyAttributes(unsafe);
13208
13209        // we had an issue in the past, where we dumped a whole bunch of <span>'s into the content...
13210        // so we remove them here
13211        // IN A FUTURE release this can be removed after all have updated through release 1.5.9
13212        if (unsafe) {
13213            try {
13214                unsafe = unsafe.replace(rsb1, '');
13215                unsafe = unsafe.replace(rsb2, '');
13216                unsafe = unsafe.replace(rsb1, '');
13217                unsafe = unsafe.replace(rsb3, '');
13218            } catch (e) {
13219            }
13220        }
13221
13222        var safe;
13223        try {
13224            safe = $sanitize(unsafe);
13225            // do this afterwards, then the $sanitizer should still throw for bad markup
13226            if(ignore) safe = unsafe;
13227        } catch (e){
13228            safe = oldsafe || '';
13229        }
13230
13231        // Do processing for <pre> tags, removing tabs and return carriages outside of them
13232
13233        var _preTags = safe.match(/(<pre[^>]*>.*?<\/pre[^>]*>)/ig);
13234        var processedSafe = safe.replace(/(&#(9|10);)*/ig, '');
13235        var re = /<pre[^>]*>.*?<\/pre[^>]*>/ig;
13236        var index = 0;
13237        var lastIndex = 0;
13238        var origTag;
13239        safe = '';
13240        while((origTag = re.exec(processedSafe)) !== null && index < _preTags.length){
13241            safe += processedSafe.substring(lastIndex, origTag.index) + _preTags[index];
13242            lastIndex = origTag.index + origTag[0].length;
13243            index++;
13244        }
13245        return safe + processedSafe.substring(lastIndex);
13246    };
13247}]).factory('taToolExecuteAction', ['$q', '$log', function($q, $log){
13248    // this must be called on a toolScope or instance
13249    return function(editor){
13250        if(editor !== undefined) this.$editor = function(){ return editor; };
13251        var deferred = $q.defer(),
13252            promise = deferred.promise,
13253            _editor = this.$editor();
13254        // pass into the action the deferred function and also the function to reload the current selection if rangy available
13255        var result;
13256        try{
13257            result = this.action(deferred, _editor.startAction());
13258            // We set the .finally callback here to make sure it doesn't get executed before any other .then callback.
13259            promise['finally'](function(){
13260                _editor.endAction.call(_editor);
13261            });
13262        }catch(exc){
13263            $log.error(exc);
13264        }
13265        if(result || result === undefined){
13266            // if true or undefined is returned then the action has finished. Otherwise the deferred action will be resolved manually.
13267            deferred.resolve();
13268        }
13269    };
13270}]);
13271
13272angular.module('textAngular.DOM', ['textAngular.factories'])
13273.factory('taExecCommand', ['taSelection', 'taBrowserTag', '$document', function(taSelection, taBrowserTag, $document){
13274    var listToDefault = function(listElement, defaultWrap){
13275        var $target, i;
13276        // if all selected then we should remove the list
13277        // grab all li elements and convert to taDefaultWrap tags
13278        var children = listElement.find('li');
13279        for(i = children.length - 1; i >= 0; i--){
13280            $target = angular.element('<' + defaultWrap + '>' + children[i].innerHTML + '</' + defaultWrap + '>');
13281            listElement.after($target);
13282        }
13283        listElement.remove();
13284        taSelection.setSelectionToElementEnd($target[0]);
13285    };
13286    var listElementToSelfTag = function(list, listElement, selfTag, bDefault, defaultWrap){
13287        var $target, i;
13288        // if all selected then we should remove the list
13289        // grab all li elements
13290        var priorElement;
13291        var nextElement;
13292        var children = list.find('li');
13293        var foundIndex;
13294        for (i = 0; i<children.length; i++) {
13295            if (children[i].outerHTML === listElement[0].outerHTML) {
13296                // found it...
13297                foundIndex = i;
13298                if (i>0) {
13299                    priorElement = children[i-1];
13300                }
13301                if (i+1<children.length) {
13302                    nextElement = children[i+1];
13303                }
13304                break;
13305            }
13306        }
13307        //console.log('listElementToSelfTag', list, listElement, selfTag, bDefault, priorElement, nextElement);
13308        // un-list the listElement
13309        var html = '';
13310        if (bDefault) {
13311            html += '<' + defaultWrap + '>' + listElement[0].innerHTML + '</' + defaultWrap + '>';
13312        } else {
13313            html += '<' + taBrowserTag(selfTag) + '>';
13314            html += '<li>' + listElement[0].innerHTML + '</li>';
13315            html += '</' + taBrowserTag(selfTag) + '>';
13316        }
13317        $target = angular.element(html);
13318        //console.log('$target', $target[0]);
13319        if (!priorElement) {
13320            // this is the first the list, so we just remove it...
13321            listElement.remove();
13322            list.after(angular.element(list[0].outerHTML));
13323            list.after($target);
13324            list.remove();
13325            taSelection.setSelectionToElementEnd($target[0]);
13326            return;
13327        } else if (!nextElement) {
13328            // this is the last in the list, so we just remove it..
13329            listElement.remove();
13330            list.after($target);
13331            taSelection.setSelectionToElementEnd($target[0]);
13332        } else {
13333            var p = list.parent();
13334            // okay it was some where in the middle... so we need to break apart the list...
13335            var html1 = '';
13336            var listTag = list[0].nodeName.toLowerCase();
13337            html1 += '<' + listTag + '>';
13338            for(i = 0; i < foundIndex; i++){
13339                html1 += '<li>' + children[i].innerHTML + '</li>';
13340            }
13341            html1 += '</' + listTag + '>';
13342            var html2 = '';
13343            html2 += '<' + listTag + '>';
13344            for(i = foundIndex+1; i < children.length; i++){
13345                html2 += '<li>' + children[i].innerHTML + '</li>';
13346            }
13347            html2 += '</' + listTag + '>';
13348            //console.log(html1, $target[0], html2);
13349            list.after(angular.element(html2));
13350            list.after($target);
13351            list.after(angular.element(html1));
13352            list.remove();
13353            //console.log('parent ******XXX*****', p[0]);
13354            taSelection.setSelectionToElementEnd($target[0]);
13355        }
13356    };
13357    var listElementsToSelfTag = function(list, listElements, selfTag, bDefault, defaultWrap){
13358        var $target, i, j, p;
13359        // grab all li elements
13360        var priorElement;
13361        var afterElement;
13362        //console.log('list:', list, 'listElements:', listElements, 'selfTag:', selfTag, 'bDefault:', bDefault);
13363        var children = list.find('li');
13364        var foundIndexes = [];
13365        for (i = 0; i<children.length; i++) {
13366            for (j = 0; j<listElements.length; j++) {
13367                if (children[i].isEqualNode(listElements[j])) {
13368                    // found it...
13369                    foundIndexes[j] = i;
13370                }
13371            }
13372        }
13373        if (foundIndexes[0] > 0) {
13374            priorElement = children[foundIndexes[0] - 1];
13375        }
13376        if (foundIndexes[listElements.length-1] + 1 < children.length) {
13377            afterElement = children[foundIndexes[listElements.length-1] + 1];
13378        }
13379        //console.log('listElementsToSelfTag', list, listElements, selfTag, bDefault, !priorElement, !afterElement, foundIndexes[listElements.length-1], children.length);
13380        // un-list the listElements
13381        var html = '';
13382        if (bDefault) {
13383            for (j = 0; j < listElements.length; j++) {
13384                html += '<' + defaultWrap + '>' + listElements[j].innerHTML + '</' + defaultWrap + '>';
13385                listElements[j].remove();
13386            }
13387        } else {
13388            html += '<' + taBrowserTag(selfTag) + '>';
13389            for (j = 0; j < listElements.length; j++) {
13390                html += listElements[j].outerHTML;
13391                listElements[j].remove();
13392            }
13393            html += '</' + taBrowserTag(selfTag) + '>';
13394        }
13395        $target = angular.element(html);
13396        if (!priorElement) {
13397            // this is the first the list, so we just remove it...
13398            list.after(angular.element(list[0].outerHTML));
13399            list.after($target);
13400            list.remove();
13401            taSelection.setSelectionToElementEnd($target[0]);
13402            return;
13403        } else if (!afterElement) {
13404            // this is the last in the list, so we just remove it..
13405            list.after($target);
13406            taSelection.setSelectionToElementEnd($target[0]);
13407            return;
13408        } else {
13409            // okay it was some where in the middle... so we need to break apart the list...
13410            var html1 = '';
13411            var listTag = list[0].nodeName.toLowerCase();
13412            html1 += '<' + listTag + '>';
13413            for(i = 0; i < foundIndexes[0]; i++){
13414                html1 += '<li>' + children[i].innerHTML + '</li>';
13415            }
13416            html1 += '</' + listTag + '>';
13417            var html2 = '';
13418            html2 += '<' + listTag + '>';
13419            for(i = foundIndexes[listElements.length-1]+1; i < children.length; i++){
13420                html2 += '<li>' + children[i].innerHTML + '</li>';
13421            }
13422            html2 += '</' + listTag + '>';
13423            list.after(angular.element(html2));
13424            list.after($target);
13425            list.after(angular.element(html1));
13426            list.remove();
13427            //console.log('parent ******YYY*****', list.parent()[0]);
13428            taSelection.setSelectionToElementEnd($target[0]);
13429        }
13430    };
13431    var selectLi = function(liElement){
13432        if(/(<br(|\/)>)$/i.test(liElement.innerHTML.trim())) taSelection.setSelectionBeforeElement(angular.element(liElement).find("br")[0]);
13433        else taSelection.setSelectionToElementEnd(liElement);
13434    };
13435    var listToList = function(listElement, newListTag){
13436        var $target = angular.element('<' + newListTag + '>' + listElement[0].innerHTML + '</' + newListTag + '>');
13437        listElement.after($target);
13438        listElement.remove();
13439        selectLi($target.find('li')[0]);
13440    };
13441    var childElementsToList = function(elements, listElement, newListTag){
13442        var html = '';
13443        for(var i = 0; i < elements.length; i++){
13444            html += '<' + taBrowserTag('li') + '>' + elements[i].innerHTML + '</' + taBrowserTag('li') + '>';
13445        }
13446        var $target = angular.element('<' + newListTag + '>' + html + '</' + newListTag + '>');
13447        listElement.after($target);
13448        listElement.remove();
13449        selectLi($target.find('li')[0]);
13450    };
13451    var turnBlockIntoBlocks = function(element, options) {
13452        for(var i = 0; i<element.childNodes.length; i++) {
13453            var _n = element.childNodes[i];
13454            /* istanbul ignore next - more complex testing*/
13455            if (_n.tagName && _n.tagName.match(BLOCKELEMENTS)) {
13456                turnBlockIntoBlocks(_n, options);
13457            }
13458        }
13459        /* istanbul ignore next - very rare condition that we do not test*/
13460        if (element.parentNode === null) {
13461            // nothing left to do..
13462            return element;
13463        }
13464        /* istanbul ignore next - not sure have to test this */
13465        if (options === '<br>'){
13466            return element;
13467        }
13468        else {
13469            var $target = angular.element(options);
13470            $target[0].innerHTML = element.innerHTML;
13471            element.parentNode.insertBefore($target[0], element);
13472            element.parentNode.removeChild(element);
13473            return $target;
13474        }
13475    };
13476    return function(taDefaultWrap, topNode){
13477        // NOTE: here we are dealing with the html directly from the browser and not the html the user sees.
13478        // IF you want to modify the html the user sees, do it when the user does a switchView
13479        taDefaultWrap = taBrowserTag(taDefaultWrap);
13480        return function(command, showUI, options, defaultTagAttributes){
13481            var i, $target, html, _nodes, next, optionsTagName, selectedElement, ourSelection;
13482            var defaultWrapper = angular.element('<' + taDefaultWrap + '>');
13483            try{
13484                if (taSelection.getSelection) {
13485                    ourSelection = taSelection.getSelection();
13486                }
13487                selectedElement = taSelection.getSelectionElement();
13488                // special checks and fixes when we are selecting the whole container
13489                var __h, _innerNode;
13490                /* istanbul ignore next */
13491                if (selectedElement.tagName !== undefined) {
13492                    if (selectedElement.tagName.toLowerCase() === 'div' &&
13493                        /taTextElement.+/.test(selectedElement.id) &&
13494                        ourSelection && ourSelection.start &&
13495                        ourSelection.start.offset === 1 &&
13496                        ourSelection.end.offset === 1) {
13497                        // opps we are actually selecting the whole container!
13498                        //console.log('selecting whole container!');
13499                        __h = selectedElement.innerHTML;
13500                        if (/<br>/i.test(__h)) {
13501                            // Firefox adds <br>'s and so we remove the <br>
13502                            __h = __h.replace(/<br>/i, '&#8203;');  // no space-space
13503                        }
13504                        if (/<br\/>/i.test(__h)) {
13505                            // Firefox adds <br/>'s and so we remove the <br/>
13506                            __h = __h.replace(/<br\/>/i, '&#8203;');  // no space-space
13507                        }
13508                        // remove stacked up <span>'s
13509                        if (/<span>(<span>)+/i.test(__h)) {
13510                            __h = __.replace(/<span>(<span>)+/i, '<span>');
13511                        }
13512                        // remove stacked up </span>'s
13513                        if (/<\/span>(<\/span>)+/i.test(__h)) {
13514                            __h = __.replace(/<\/span>(<\/span>)+/i, '<\/span>');
13515                        }
13516                        if (/<span><\/span>/i.test(__h)) {
13517                            // if we end up with a <span></span> here we remove it...
13518                            __h = __h.replace(/<span><\/span>/i, '');
13519                        }
13520                        //console.log('inner whole container', selectedElement.childNodes);
13521                        _innerNode = '<div>' + __h + '</div>';
13522                        selectedElement.innerHTML = _innerNode;
13523                        taSelection.setSelectionToElementEnd(selectedElement.childNodes[0]);
13524                        selectedElement = taSelection.getSelectionElement();
13525                    } else if (selectedElement.tagName.toLowerCase() === 'span' &&
13526                        ourSelection && ourSelection.start &&
13527                        ourSelection.start.offset === 1 &&
13528                        ourSelection.end.offset === 1) {
13529                        // just a span -- this is a problem...
13530                        //console.log('selecting span!');
13531                        __h = selectedElement.innerHTML;
13532                        if (/<br>/i.test(__h)) {
13533                            // Firefox adds <br>'s and so we remove the <br>
13534                            __h = __h.replace(/<br>/i, '&#8203;');  // no space-space
13535                        }
13536                        if (/<br\/>/i.test(__h)) {
13537                            // Firefox adds <br/>'s and so we remove the <br/>
13538                            __h = __h.replace(/<br\/>/i, '&#8203;');  // no space-space
13539                        }
13540                        // remove stacked up <span>'s
13541                        if (/<span>(<span>)+/i.test(__h)) {
13542                            __h = __.replace(/<span>(<span>)+/i, '<span>');
13543                        }
13544                        // remove stacked up </span>'s
13545                        if (/<\/span>(<\/span>)+/i.test(__h)) {
13546                            __h = __.replace(/<\/span>(<\/span>)+/i, '<\/span>');
13547                        }
13548                        if (/<span><\/span>/i.test(__h)) {
13549                            // if we end up with a <span></span> here we remove it...
13550                            __h = __h.replace(/<span><\/span>/i, '');
13551                        }
13552                        //console.log('inner span', selectedElement.childNodes);
13553                        // we wrap this in a <div> because otherwise the browser get confused when we attempt to select the whole node
13554                        // and the focus is not set correctly no matter what we do
13555                        _innerNode = '<div>' + __h + '</div>';
13556                        selectedElement.innerHTML = _innerNode;
13557                        taSelection.setSelectionToElementEnd(selectedElement.childNodes[0]);
13558                        selectedElement = taSelection.getSelectionElement();
13559                        //console.log(selectedElement.innerHTML);
13560                    } else if (selectedElement.tagName.toLowerCase() === 'p' &&
13561                        ourSelection && ourSelection.start &&
13562                        ourSelection.start.offset === 1 &&
13563                        ourSelection.end.offset === 1) {
13564                        //console.log('p special');
13565                        // we need to remove the </br> that firefox adds!
13566                        __h = selectedElement.innerHTML;
13567                        if (/<br>/i.test(__h)) {
13568                            // Firefox adds <br>'s and so we remove the <br>
13569                            __h = __h.replace(/<br>/i, '&#8203;');  // no space-space
13570                            selectedElement.innerHTML = __h;
13571                        }
13572                    } else if (selectedElement.tagName.toLowerCase() === 'li' &&
13573                        ourSelection && ourSelection.start &&
13574                        ourSelection.start.offset === ourSelection.end.offset) {
13575                        // we need to remove the </br> that firefox adds!
13576                        __h = selectedElement.innerHTML;
13577                        if (/<br>/i.test(__h)) {
13578                            // Firefox adds <br>'s and so we remove the <br>
13579                            __h = __h.replace(/<br>/i, '');  // nothing
13580                            selectedElement.innerHTML = __h;
13581                        }
13582                    }
13583                }
13584            }catch(e){}
13585            //console.log('************** selectedElement:', selectedElement);
13586            /* istanbul ignore if: */
13587            if (!selectedElement){return;}
13588            var $selected = angular.element(selectedElement);
13589            var tagName = (selectedElement && selectedElement.tagName && selectedElement.tagName.toLowerCase()) ||
13590                /* istanbul ignore next: */ "";
13591            if(command.toLowerCase() === 'insertorderedlist' || command.toLowerCase() === 'insertunorderedlist'){
13592                var selfTag = taBrowserTag((command.toLowerCase() === 'insertorderedlist')? 'ol' : 'ul');
13593                var selectedElements = taSelection.getOnlySelectedElements();
13594                //console.log('PPPPPPPPPPPPP', tagName, selfTag, selectedElements, tagName.match(BLOCKELEMENTS), $selected.hasClass('ta-bind'), $selected.parent()[0].tagName);
13595                if (selectedElements.length>1 && (tagName === 'ol' ||  tagName === 'ul' )) {
13596                    return listElementsToSelfTag($selected, selectedElements, selfTag, selfTag===tagName, taDefaultWrap);
13597                }
13598                if(tagName === selfTag){
13599                    // if all selected then we should remove the list
13600                    // grab all li elements and convert to taDefaultWrap tags
13601                    //console.log('tagName===selfTag');
13602                    if ($selected[0].childNodes.length !== selectedElements.length && selectedElements.length===1) {
13603                        $selected = angular.element(selectedElements[0]);
13604                        return listElementToSelfTag($selected.parent(), $selected, selfTag, true, taDefaultWrap);
13605                    } else {
13606                        return listToDefault($selected, taDefaultWrap);
13607                    }
13608                }else if(tagName === 'li' &&
13609                    $selected.parent()[0].tagName.toLowerCase() === selfTag &&
13610                    $selected.parent().children().length === 1){
13611                    // catch for the previous statement if only one li exists
13612                    return listToDefault($selected.parent(), taDefaultWrap);
13613                }else if(tagName === 'li' &&
13614                    $selected.parent()[0].tagName.toLowerCase() !== selfTag &&
13615                    $selected.parent().children().length === 1){
13616                    // catch for the previous statement if only one li exists
13617                    return listToList($selected.parent(), selfTag);
13618                }else if(tagName.match(BLOCKELEMENTS) && !$selected.hasClass('ta-bind')){
13619                    // if it's one of those block elements we have to change the contents
13620                    // if it's a ol/ul we are changing from one to the other
13621                    if (selectedElements.length) {
13622                        if ($selected[0].childNodes.length !== selectedElements.length && selectedElements.length===1) {
13623                            //console.log('&&&&&&&&&&&&&&& --------- &&&&&&&&&&&&&&&&', selectedElements[0], $selected[0].childNodes);
13624                            $selected = angular.element(selectedElements[0]);
13625                            return listElementToSelfTag($selected.parent(), $selected, selfTag, selfTag===tagName, taDefaultWrap);
13626                        }
13627                    }
13628                    if(tagName === 'ol' || tagName === 'ul'){
13629                        // now if this is a set of selected elements... behave diferently
13630                        return listToList($selected, selfTag);
13631                    }else{
13632                        var childBlockElements = false;
13633                        angular.forEach($selected.children(), function(elem){
13634                            if(elem.tagName.match(BLOCKELEMENTS)) {
13635                                childBlockElements = true;
13636                            }
13637                        });
13638                        if(childBlockElements){
13639                            return childElementsToList($selected.children(), $selected, selfTag);
13640                        }else{
13641                            return childElementsToList([angular.element('<div>' + selectedElement.innerHTML + '</div>')[0]], $selected, selfTag);
13642                        }
13643                    }
13644                }else if(tagName.match(BLOCKELEMENTS)){
13645                    // if we get here then the contents of the ta-bind are selected
13646                    _nodes = taSelection.getOnlySelectedElements();
13647                    //console.log('_nodes', _nodes, tagName);
13648                    if(_nodes.length === 0){
13649                        // here is if there is only text in ta-bind ie <div ta-bind>test content</div>
13650                        $target = angular.element('<' + selfTag + '><li>' + selectedElement.innerHTML + '</li></' + selfTag + '>');
13651                        $selected.html('');
13652                        $selected.append($target);
13653                    }else if(_nodes.length === 1 && (_nodes[0].tagName.toLowerCase() === 'ol' || _nodes[0].tagName.toLowerCase() === 'ul')){
13654                        if(_nodes[0].tagName.toLowerCase() === selfTag){
13655                            // remove
13656                            return listToDefault(angular.element(_nodes[0]), taDefaultWrap);
13657                        }else{
13658                            return listToList(angular.element(_nodes[0]), selfTag);
13659                        }
13660                    }else{
13661                        html = '';
13662                        var $nodes = [];
13663                        for(i = 0; i < _nodes.length; i++){
13664                            /* istanbul ignore else: catch for real-world can't make it occur in testing */
13665                            if(_nodes[i].nodeType !== 3){
13666                                var $n = angular.element(_nodes[i]);
13667                                /* istanbul ignore if: browser check only, phantomjs doesn't return children nodes but chrome at least does */
13668                                if(_nodes[i].tagName.toLowerCase() === 'li') continue;
13669                                else if(_nodes[i].tagName.toLowerCase() === 'ol' || _nodes[i].tagName.toLowerCase() === 'ul'){
13670                                    html += $n[0].innerHTML; // if it's a list, add all it's children
13671                                }else if(_nodes[i].tagName.toLowerCase() === 'span' && (_nodes[i].childNodes[0].tagName.toLowerCase() === 'ol' || _nodes[i].childNodes[0].tagName.toLowerCase() === 'ul')){
13672                                    html += $n[0].childNodes[0].innerHTML; // if it's a list, add all it's children
13673                                }else{
13674                                    html += '<' + taBrowserTag('li') + '>' + $n[0].innerHTML + '</' + taBrowserTag('li') + '>';
13675                                }
13676                                $nodes.unshift($n);
13677                            }
13678                        }
13679                        //console.log('$nodes', $nodes);
13680                        $target = angular.element('<' + selfTag + '>' + html + '</' + selfTag + '>');
13681                        $nodes.pop().replaceWith($target);
13682                        angular.forEach($nodes, function($node){ $node.remove(); });
13683                    }
13684                    taSelection.setSelectionToElementEnd($target[0]);
13685                    return;
13686                }
13687            }else if(command.toLowerCase() === 'formatblock'){
13688                optionsTagName = options.toLowerCase().replace(/[<>]/ig, '');
13689                if(optionsTagName.trim() === 'default') {
13690                    optionsTagName = taDefaultWrap;
13691                    options = '<' + taDefaultWrap + '>';
13692                }
13693                if(tagName === 'li') {
13694                    $target = $selected.parent();
13695                }
13696                else {
13697                    $target = $selected;
13698                }
13699                // find the first blockElement
13700                while(!$target[0].tagName || !$target[0].tagName.match(BLOCKELEMENTS) && !$target.parent().attr('contenteditable')){
13701                    $target = $target.parent();
13702                    /* istanbul ignore next */
13703                    tagName = ($target[0].tagName || '').toLowerCase();
13704                }
13705                if(tagName === optionsTagName){
13706                    // $target is wrap element
13707                    _nodes = $target.children();
13708                    var hasBlock = false;
13709                    for(i = 0; i < _nodes.length; i++){
13710                        hasBlock = hasBlock || _nodes[i].tagName.match(BLOCKELEMENTS);
13711                    }
13712                    if(hasBlock){
13713                        $target.after(_nodes);
13714                        next = $target.next();
13715                        $target.remove();
13716                        $target = next;
13717                    }else{
13718                        defaultWrapper.append($target[0].childNodes);
13719                        $target.after(defaultWrapper);
13720                        $target.remove();
13721                        $target = defaultWrapper;
13722                    }
13723                }else if($target.parent()[0].tagName.toLowerCase() === optionsTagName &&
13724                    !$target.parent().hasClass('ta-bind')){
13725                    //unwrap logic for parent
13726                    var blockElement = $target.parent();
13727                    var contents = blockElement.contents();
13728                    for(i = 0; i < contents.length; i ++){
13729                        /* istanbul ignore next: can't test - some wierd thing with how phantomjs works */
13730                        if(blockElement.parent().hasClass('ta-bind') && contents[i].nodeType === 3){
13731                            defaultWrapper = angular.element('<' + taDefaultWrap + '>');
13732                            defaultWrapper[0].innerHTML = contents[i].outerHTML;
13733                            contents[i] = defaultWrapper[0];
13734                        }
13735                        blockElement.parent()[0].insertBefore(contents[i], blockElement[0]);
13736                    }
13737                    blockElement.remove();
13738                }else if(tagName.match(LISTELEMENTS)){
13739                    // wrapping a list element
13740                    $target.wrap(options);
13741                }else{
13742                    // default wrap behaviour
13743                    _nodes = taSelection.getOnlySelectedElements();
13744                    if(_nodes.length === 0) {
13745                        // no nodes at all....
13746                        _nodes = [$target[0]];
13747                    }
13748                    // find the parent block element if any of the nodes are inline or text
13749                    for(i = 0; i < _nodes.length; i++){
13750                        if(_nodes[i].nodeType === 3 || !_nodes[i].tagName.match(BLOCKELEMENTS)){
13751                            while(_nodes[i].nodeType === 3 || !_nodes[i].tagName || !_nodes[i].tagName.match(BLOCKELEMENTS)){
13752                                _nodes[i] = _nodes[i].parentNode;
13753                            }
13754                        }
13755                    }
13756                    // remove any duplicates from the array of _nodes!
13757                    _nodes = _nodes.filter(function(value, index, self) {
13758                        return self.indexOf(value) === index;
13759                    });
13760                    // remove all whole taTextElement if it is here... unless it is the only element!
13761                    if (_nodes.length>1) {
13762                        _nodes = _nodes.filter(function (value, index, self) {
13763                            return !(value.nodeName.toLowerCase() === 'div' && /^taTextElement/.test(value.id));
13764                        });
13765                    }
13766                    if(angular.element(_nodes[0]).hasClass('ta-bind')){
13767                        $target = angular.element(options);
13768                        $target[0].innerHTML = _nodes[0].innerHTML;
13769                        _nodes[0].innerHTML = $target[0].outerHTML;
13770                    }else if(optionsTagName === 'blockquote'){
13771                        // blockquotes wrap other block elements
13772                        html = '';
13773                        for(i = 0; i < _nodes.length; i++){
13774                            html += _nodes[i].outerHTML;
13775                        }
13776                        $target = angular.element(options);
13777                        $target[0].innerHTML = html;
13778                        _nodes[0].parentNode.insertBefore($target[0],_nodes[0]);
13779                        for(i = _nodes.length - 1; i >= 0; i--){
13780                            /* istanbul ignore else:  */
13781                            if (_nodes[i].parentNode) _nodes[i].parentNode.removeChild(_nodes[i]);
13782                        }
13783                    } else /* istanbul ignore next: not tested since identical to blockquote */
13784                    if (optionsTagName === 'pre' && taSelection.getStateShiftKey()) {
13785                        //console.log('shift pre', _nodes);
13786                        // pre wrap other block elements
13787                        html = '';
13788                        for (i = 0; i < _nodes.length; i++) {
13789                            html += _nodes[i].outerHTML;
13790                        }
13791                        $target = angular.element(options);
13792                        $target[0].innerHTML = html;
13793                        _nodes[0].parentNode.insertBefore($target[0], _nodes[0]);
13794                        for (i = _nodes.length - 1; i >= 0; i--) {
13795                            /* istanbul ignore else:  */
13796                            if (_nodes[i].parentNode) _nodes[i].parentNode.removeChild(_nodes[i]);
13797                        }
13798                    }
13799                    else {
13800                        //console.log(optionsTagName, _nodes);
13801                        // regular block elements replace other block elements
13802                        for (i = 0; i < _nodes.length; i++) {
13803                            var newBlock = turnBlockIntoBlocks(_nodes[i], options);
13804                            if (_nodes[i] === $target[0]) {
13805                                $target = angular.element(newBlock);
13806                            }
13807                        }
13808                    }
13809                }
13810                taSelection.setSelectionToElementEnd($target[0]);
13811                // looses focus when we have the whole container selected and no text!
13812                // refocus on the shown display element, this fixes a bug when using firefox
13813                $target[0].focus();
13814                return;
13815            }else if(command.toLowerCase() === 'createlink'){
13816                /* istanbul ignore next: firefox specific fix */
13817                if (tagName === 'a') {
13818                    // already a link!!! we are just replacing it...
13819                    taSelection.getSelectionElement().href = options;
13820                    return;
13821                }
13822                var tagBegin = '<a href="' + options + '" target="' +
13823                        (defaultTagAttributes.a.target ? defaultTagAttributes.a.target : '') +
13824                        '">',
13825                    tagEnd = '</a>',
13826                    _selection = taSelection.getSelection();
13827                if(_selection.collapsed){
13828                    //console.log('collapsed');
13829                    // insert text at selection, then select then just let normal exec-command run
13830                    taSelection.insertHtml(tagBegin + options + tagEnd, topNode);
13831                }else if(rangy.getSelection().getRangeAt(0).canSurroundContents()){
13832                    var node = angular.element(tagBegin + tagEnd)[0];
13833                    rangy.getSelection().getRangeAt(0).surroundContents(node);
13834                }
13835                return;
13836            }else if(command.toLowerCase() === 'inserthtml'){
13837                //console.log('inserthtml');
13838                taSelection.insertHtml(options, topNode);
13839                return;
13840            }
13841            try{
13842                $document[0].execCommand(command, showUI, options);
13843            }catch(e){}
13844        };
13845    };
13846}]).service('taSelection', ['$document', 'taDOM', '$log',
13847/* istanbul ignore next: all browser specifics and PhantomJS dosen't seem to support half of it */
13848function($document, taDOM, $log){
13849    // need to dereference the document else the calls don't work correctly
13850    var _document = $document[0];
13851    var bShiftState;
13852    var brException = function (element, offset) {
13853        /* check if selection is a BR element at the beginning of a container. If so, get
13854        * the parentNode instead.
13855        * offset should be zero in this case. Otherwise, return the original
13856        * element.
13857        */
13858        if (element.tagName && element.tagName.match(/^br$/i) && offset === 0 && !element.previousSibling) {
13859            return {
13860                element: element.parentNode,
13861                offset: 0
13862            };
13863        } else {
13864            return {
13865                element: element,
13866                offset: offset
13867            };
13868        }
13869    };
13870    var api = {
13871        getSelection: function(){
13872            var range;
13873            try {
13874                // catch any errors from rangy and ignore the issue
13875                range = rangy.getSelection().getRangeAt(0);
13876            } catch(e) {
13877                //console.info(e);
13878                return undefined;
13879            }
13880            var container = range.commonAncestorContainer;
13881            var selection = {
13882                start: brException(range.startContainer, range.startOffset),
13883                end: brException(range.endContainer, range.endOffset),
13884                collapsed: range.collapsed
13885            };
13886            // This has problems under Firefox.
13887            // On Firefox with
13888            // <p>Try me !</p>
13889            // <ul>
13890            // <li>line 1</li>
13891            // <li>line 2</li>
13892            // </ul>
13893            // <p>line 3</p>
13894            // <ul>
13895            // <li>line 4</li>
13896            // <li>line 5</li>
13897            // </ul>
13898            // <p>Hello textAngular</p>
13899            // WITH the cursor after the 3 on line 3, it gets the commonAncestorContainer as:
13900            // <TextNode textContent='line 3'>
13901            // AND Chrome gets the commonAncestorContainer as:
13902            // <p>line 3</p>
13903            //
13904            // Check if the container is a text node and return its parent if so
13905            // unless this is the whole taTextElement.  If so we return the textNode
13906            if (container.nodeType === 3) {
13907                if (container.parentNode.nodeName.toLowerCase() === 'div' &&
13908                    /^taTextElement/.test(container.parentNode.id)) {
13909                    // textNode where the parent is the whole <div>!!!
13910                    //console.log('textNode ***************** container:', container);
13911                } else {
13912                    container = container.parentNode;
13913                }
13914            }
13915            if (container.nodeName.toLowerCase() === 'div' &&
13916                /^taTextElement/.test(container.id)) {
13917                //console.log('*********taTextElement************');
13918                //console.log('commonAncestorContainer:', container);
13919                selection.start.element = container.childNodes[selection.start.offset];
13920                selection.end.element = container.childNodes[selection.end.offset];
13921                selection.container = container;
13922            } else {
13923                if (container.parentNode === selection.start.element ||
13924                    container.parentNode === selection.end.element) {
13925                    selection.container = container.parentNode;
13926                } else {
13927                    selection.container = container;
13928                }
13929            }
13930            //console.log('***selection container:', selection.container.nodeName, selection.start.offset, selection.container);
13931            return selection;
13932        },
13933        // if we use the LEFT_ARROW and we are at the special place <span>&#65279;</span> we move the cursor over by one...
13934        // Chrome and Firefox behave differently so so fix this for Firefox here.  No adjustment needed for Chrome.
13935        updateLeftArrowKey: function(element) {
13936            var range = rangy.getSelection().getRangeAt(0);
13937            if (range && range.collapsed) {
13938                var _nodes = api.getFlattenedDom(range);
13939                if (!_nodes.findIndex) return;
13940                var _node = range.startContainer;
13941                var indexStartContainer = _nodes.findIndex(function(element, index){
13942                    if (element.node===_node) return true;
13943                    var _indexp = element.parents.indexOf(_node);
13944                    return (_indexp !== -1);
13945                });
13946                var m;
13947                var nextNodeToRight;
13948                //console.log('indexStartContainer', indexStartContainer, _nodes.length, 'startContainer:', _node, _node === _nodes[indexStartContainer].node);
13949                _nodes.forEach(function (n, i) {
13950                    //console.log(i, n.node);
13951                    n.parents.forEach(function (nn, j){
13952                        //console.log(i, j, nn);
13953                    });
13954                });
13955                if (indexStartContainer+1 < _nodes.length) {
13956                    // we need the node just after this startContainer
13957                    // so we can check and see it this is a special place
13958                    nextNodeToRight = _nodes[indexStartContainer+1].node;
13959                    //console.log(nextNodeToRight, range.startContainer);
13960                }
13961                //console.log('updateLeftArrowKey', range.startOffset, range.startContainer.textContent);
13962                // this first section handles the case for Chrome browser
13963                // if the first character of the nextNode is a \ufeff we know that we are just before the special span...
13964                // and so we most left by one character
13965                if (nextNodeToRight && nextNodeToRight.textContent) {
13966                    m = /^\ufeff([^\ufeff]*)$/.exec(nextNodeToRight.textContent);
13967                    if (m) {
13968                        // we are before the special node with begins with a \ufeff character
13969                        //console.log('LEFT ...found it...', 'startOffset:', range.startOffset, m[0].length, m[1].length);
13970                        // no need to change anything in this case
13971                        return;
13972                    }
13973                }
13974                var nextNodeToLeft;
13975                if (indexStartContainer > 0) {
13976                    // we need the node just after this startContainer
13977                    // so we can check and see it this is a special place
13978                    nextNodeToLeft = _nodes[indexStartContainer-1].node;
13979                    //console.log(nextNodeToLeft, nextNodeToLeft);
13980                }
13981                if (range.startOffset === 0 && nextNodeToLeft) {
13982                    //console.log(nextNodeToLeft, range.startOffset, nextNodeToLeft.textContent);
13983                    m = /^\ufeff([^\ufeff]*)$/.exec(nextNodeToLeft.textContent);
13984                    if (m) {
13985                        //console.log('LEFT &&&&&&&&&&&&&&&&&&&...found it...&&&&&&&&&&&', nextNodeToLeft, m[0].length, m[1].length);
13986                        // move over to the left my one -- Firefox triggers this case
13987                        api.setSelectionToElementEnd(nextNodeToLeft);
13988                        return;
13989                    }
13990                }
13991            }
13992            return;
13993        },
13994        // if we use the RIGHT_ARROW and we are at the special place <span>&#65279;</span> we move the cursor over by one...
13995        updateRightArrowKey: function(element) {
13996            // we do not need to make any adjustments here, so we ignore all this code
13997            if (false) {
13998                var range = rangy.getSelection().getRangeAt(0);
13999                if (range && range.collapsed) {
14000                    var _nodes = api.getFlattenedDom(range);
14001                    if (!_nodes.findIndex) return;
14002                    var _node = range.startContainer;
14003                    var indexStartContainer = _nodes.findIndex(function (element, index) {
14004                        if (element.node === _node) return true;
14005                        var _indexp = element.parents.indexOf(_node);
14006                        return (_indexp !== -1);
14007                    });
14008                    var _sel;
14009                    var i;
14010                    var m;
14011
14012                    // if the last character is a \ufeff we know that we are just before the special span...
14013                    // and so we most right by one character
14014                    var indexFound = _nodes.findIndex(function (n, index) {
14015                        if (n.textContent) {
14016                            var m = /^\ufeff([^\ufeff]*)$/.exec(n.textContent);
14017                            if (m) {
14018                                return true;
14019                            } else {
14020                                return false;
14021                            }
14022                        } else {
14023                            return false;
14024                        }
14025                    });
14026                    if (indexFound === -1) {
14027                        return;
14028                    }
14029                    //console.log(indexFound, range.startContainer, range.startOffset);
14030                    _node = _nodes[indexStartContainer];
14031                    //console.log('indexStartContainer', indexStartContainer);
14032                    if (_node && _node.textContent) {
14033                        m = /^\ufeff([^\ufeff]*)$/.exec(_node.textContent);
14034                        if (m && range.startOffset - 1 === m[1].length) {
14035                            //console.log('RIGHT found it...&&&&&&&&&&&', range.startOffset);
14036                            // no need to make any adjustment
14037                            return;
14038                        }
14039                    }
14040                    //console.log(range.startOffset);
14041                    if (_nodes && range.startOffset === 0) {
14042                        indexStartContainer = _nodes.indexOf(range.startContainer);
14043                        if (indexStartContainer !== -1 && indexStartContainer > 0) {
14044                            _node = _nodes[indexStartContainer - 1];
14045                            if (_node.textContent) {
14046                                m = /\ufeff([^\ufeff]*)$/.exec(_node.textContent);
14047                                if (m && true || range.startOffset === m[1].length + 1) {
14048                                    //console.log('RIGHT &&&&&&&&&&&&&&&&&&&...found it...&&&&&&&&&&&', range.startOffset, m[1].length);
14049                                    // no need to make any adjustment
14050                                    return;
14051                                }
14052                            }
14053                        }
14054                    }
14055                }
14056            }
14057        },
14058        getFlattenedDom: function(range) {
14059            var parent = range.commonAncestorContainer.parentNode;
14060            if (!parent) {
14061                return range.commonAncestorContainer.childNodes;
14062            }
14063            var nodes = Array.prototype.slice.call(parent.childNodes); // converts NodeList to Array
14064            var indexStartContainer = nodes.indexOf(range.startContainer);
14065            // make sure that we have a big enough set of nodes
14066            if (indexStartContainer+1 < nodes.length && indexStartContainer > 0) {
14067                // we are good
14068                // we can go down one node or up one node
14069            } else {
14070                if (parent.parentNode) {
14071                    parent = parent.parentNode;
14072                }
14073            }
14074            // now walk the parent
14075            nodes = [];
14076            function addNodes(_set) {
14077                if (_set.node.childNodes.length) {
14078                    var childNodes = Array.prototype.slice.call(_set.node.childNodes); // converts NodeList to Array
14079                    childNodes.forEach(function(n) {
14080                        var _t = _set.parents.slice();
14081                        if (_t.slice(-1)[0]!==_set.node) {
14082                            _t.push(_set.node);
14083                        }
14084                        addNodes({parents: _t, node: n});
14085                    });
14086                } else {
14087                    nodes.push({parents: _set.parents, node: _set.node});
14088                }
14089            }
14090            addNodes({parents: [parent], node: parent});
14091            return nodes;
14092        },
14093        getOnlySelectedElements: function(){
14094            var range = rangy.getSelection().getRangeAt(0);
14095            var container = range.commonAncestorContainer;
14096            // Node.TEXT_NODE === 3
14097            // Node.ELEMENT_NODE === 1
14098            // Node.COMMENT_NODE === 8
14099            // Check if the container is a text node and return its parent if so
14100            container = container.nodeType === 3 ? container.parentNode : container;
14101            // get the nodes in the range that are ELEMENT_NODE and are children of the container
14102            // in this range...
14103            return range.getNodes([1], function(node){
14104                return node.parentNode === container;
14105            });
14106        },
14107        // this includes the container element if all children are selected
14108        getAllSelectedElements: function(){
14109            var range = rangy.getSelection().getRangeAt(0);
14110            var container = range.commonAncestorContainer;
14111            // Node.TEXT_NODE === 3
14112            // Node.ELEMENT_NODE === 1
14113            // Node.COMMENT_NODE === 8
14114            // Check if the container is a text node and return its parent if so
14115            container = container.nodeType === 3 ? container.parentNode : container;
14116            // get the nodes in the range that are ELEMENT_NODE and are children of the container
14117            // in this range...
14118            var selectedNodes = range.getNodes([1], function(node){
14119                return node.parentNode === container;
14120            });
14121            var innerHtml = container.innerHTML;
14122            // remove the junk that rangy has put down
14123            innerHtml = innerHtml.replace(/<span id=.selectionBoundary[^>]+>\ufeff?<\/span>/ig, '');
14124            //console.log(innerHtml);
14125            //console.log(range.toHtml());
14126            //console.log(innerHtml === range.toHtml());
14127            if (innerHtml === range.toHtml() &&
14128                // not the whole taTextElement
14129                (!(container.nodeName.toLowerCase() === 'div' &&  /^taTextElement/.test(container.id)))
14130            ) {
14131                var arr = [];
14132                for(var i = selectedNodes.length; i--; arr.unshift(selectedNodes[i]));
14133                selectedNodes = arr;
14134                selectedNodes.push(container);
14135                //$log.debug(selectedNodes);
14136            }
14137            return selectedNodes;
14138        },
14139        // Some basic selection functions
14140        getSelectionElement: function () {
14141            var s = api.getSelection();
14142            if (s) {
14143                return api.getSelection().container;
14144            } else {
14145                return undefined;
14146            }
14147        },
14148        setSelection: function(elStart, elEnd, start, end){
14149            var range = rangy.createRange();
14150
14151            range.setStart(elStart, start);
14152            range.setEnd(elEnd, end);
14153
14154            rangy.getSelection().setSingleRange(range);
14155        },
14156        setSelectionBeforeElement: function (el){
14157            var range = rangy.createRange();
14158
14159            range.selectNode(el);
14160            range.collapse(true);
14161
14162            rangy.getSelection().setSingleRange(range);
14163        },
14164        setSelectionAfterElement: function (el){
14165            var range = rangy.createRange();
14166
14167            range.selectNode(el);
14168            range.collapse(false);
14169
14170            rangy.getSelection().setSingleRange(range);
14171        },
14172        setSelectionToElementStart: function (el){
14173            var range = rangy.createRange();
14174
14175            range.selectNodeContents(el);
14176            range.collapse(true);
14177
14178            rangy.getSelection().setSingleRange(range);
14179        },
14180        setSelectionToElementEnd: function (el){
14181            var range = rangy.createRange();
14182
14183            range.selectNodeContents(el);
14184            range.collapse(false);
14185            if(el.childNodes && el.childNodes[el.childNodes.length - 1] && el.childNodes[el.childNodes.length - 1].nodeName === 'br'){
14186                range.startOffset = range.endOffset = range.startOffset - 1;
14187            }
14188            rangy.getSelection().setSingleRange(range);
14189        },
14190        setStateShiftKey: function(bS) {
14191            bShiftState = bS;
14192        },
14193        getStateShiftKey: function() {
14194            return bShiftState;
14195        },
14196        // from http://stackoverflow.com/questions/6690752/insert-html-at-caret-in-a-contenteditable-div
14197        // topNode is the contenteditable normally, all manipulation MUST be inside this.
14198        insertHtml: function(html, topNode){
14199            var parent, secondParent, _childI, nodes, i, lastNode, _tempFrag;
14200            var element = angular.element("<div>" + html + "</div>");
14201            var range = rangy.getSelection().getRangeAt(0);
14202            var frag = _document.createDocumentFragment();
14203            var children = element[0].childNodes;
14204            var isInline = true;
14205
14206            if(children.length > 0){
14207                // NOTE!! We need to do the following:
14208                // check for blockelements - if they exist then we have to split the current element in half (and all others up to the closest block element) and insert all children in-between.
14209                // If there are no block elements, or there is a mixture we need to create textNodes for the non wrapped text (we don't want them spans messing up the picture).
14210                nodes = [];
14211                for(_childI = 0; _childI < children.length; _childI++){
14212                    var _cnode = children[_childI];
14213                    if (_cnode.nodeName.toLowerCase() === 'p' &&
14214                        _cnode.innerHTML.trim() === '') { // empty p element
14215                        continue;
14216                    }
14217                    /****************
14218                     *  allow any text to be inserted...
14219                    if((   _cnode.nodeType === 3 &&
14220                           _cnode.nodeValue === '\ufeff'[0] &&
14221                           _cnode.nodeValue.trim() === '') // empty no-space space element
14222                        ) {
14223                        // no change to isInline
14224                        nodes.push(_cnode);
14225                        continue;
14226                    }
14227                    if(_cnode.nodeType === 3 &&
14228                         _cnode.nodeValue.trim() === '') { // empty text node
14229                        continue;
14230                    }
14231                    *****************/
14232                    isInline = isInline && !BLOCKELEMENTS.test(_cnode.nodeName);
14233                    nodes.push(_cnode);
14234                }
14235                for(var _n = 0; _n < nodes.length; _n++) {
14236                    lastNode = frag.appendChild(nodes[_n]);
14237                }
14238                if( !isInline &&
14239                    range.collapsed &&
14240                    /^(|<br(|\/)>)$/i.test(range.startContainer.innerHTML) ) {
14241                    range.selectNode(range.startContainer);
14242                }
14243            }else{
14244                isInline = true;
14245                // paste text of some sort
14246                lastNode = frag = _document.createTextNode(html);
14247            }
14248
14249            // Other Edge case - selected data spans multiple blocks.
14250            if(isInline){
14251                range.deleteContents();
14252            }else{ // not inline insert
14253                if(range.collapsed && range.startContainer !== topNode){
14254                    if(range.startContainer.innerHTML && range.startContainer.innerHTML.match(/^<[^>]*>$/i)){
14255                        // this log is to catch when innerHTML is something like `<img ...>`
14256                        parent = range.startContainer;
14257                        if(range.startOffset === 1){
14258                            // before single tag
14259                            range.setStartAfter(parent);
14260                            range.setEndAfter(parent);
14261                        }else{
14262                            // after single tag
14263                            range.setStartBefore(parent);
14264                            range.setEndBefore(parent);
14265                        }
14266                    }else{
14267                        // split element into 2 and insert block element in middle
14268                        if(range.startContainer.nodeType === 3 && range.startContainer.parentNode !== topNode){ // if text node
14269                            parent = range.startContainer.parentNode;
14270                            secondParent = parent.cloneNode();
14271                            // split the nodes into two lists - before and after, splitting the node with the selection into 2 text nodes.
14272                            taDOM.splitNodes(parent.childNodes, parent, secondParent, range.startContainer, range.startOffset);
14273
14274                            // Escape out of the inline tags like b
14275                            while(!VALIDELEMENTS.test(parent.nodeName)){
14276                                angular.element(parent).after(secondParent);
14277                                parent = parent.parentNode;
14278                                var _lastSecondParent = secondParent;
14279                                secondParent = parent.cloneNode();
14280                                // split the nodes into two lists - before and after, splitting the node with the selection into 2 text nodes.
14281                                taDOM.splitNodes(parent.childNodes, parent, secondParent, _lastSecondParent);
14282                            }
14283                        }else{
14284                            parent = range.startContainer;
14285                            secondParent = parent.cloneNode();
14286                            taDOM.splitNodes(parent.childNodes, parent, secondParent, undefined, undefined, range.startOffset);
14287                        }
14288
14289                        angular.element(parent).after(secondParent);
14290                        // put cursor to end of inserted content
14291                        //console.log('setStartAfter', parent);
14292                        range.setStartAfter(parent);
14293                        range.setEndAfter(parent);
14294
14295                        if(/^(|<br(|\/)>)$/i.test(parent.innerHTML.trim())){
14296                            range.setStartBefore(parent);
14297                            range.setEndBefore(parent);
14298                            angular.element(parent).remove();
14299                        }
14300                        if(/^(|<br(|\/)>)$/i.test(secondParent.innerHTML.trim())) angular.element(secondParent).remove();
14301                        if(parent.nodeName.toLowerCase() === 'li'){
14302                            _tempFrag = _document.createDocumentFragment();
14303                            for(i = 0; i < frag.childNodes.length; i++){
14304                                element = angular.element('<li>');
14305                                taDOM.transferChildNodes(frag.childNodes[i], element[0]);
14306                                taDOM.transferNodeAttributes(frag.childNodes[i], element[0]);
14307                                _tempFrag.appendChild(element[0]);
14308                            }
14309                            frag = _tempFrag;
14310                            if(lastNode){
14311                                lastNode = frag.childNodes[frag.childNodes.length - 1];
14312                                lastNode = lastNode.childNodes[lastNode.childNodes.length - 1];
14313                            }
14314                        }
14315                    }
14316                }else{
14317                    range.deleteContents();
14318                }
14319            }
14320
14321            range.insertNode(frag);
14322            if(lastNode){
14323                api.setSelectionToElementEnd(lastNode);
14324            }
14325        }
14326
14327        /* NOT FUNCTIONAL YET
14328         // under Firefox, we may have a selection that needs to be normalized
14329         isSelectionContainerWhole_taTextElement: function (){
14330         var range = rangy.getSelection().getRangeAt(0);
14331         var container = range.commonAncestorContainer;
14332         if (container.nodeName.toLowerCase() === 'div' &&
14333         /^taTextElement/.test(container.id)) {
14334         // container is the whole taTextElement
14335         return true;
14336         }
14337         return false;
14338         },
14339         setNormalizedSelection: function (){
14340         var range = rangy.getSelection().getRangeAt(0);
14341         var container = range.commonAncestorContainer;
14342         console.log(range);
14343         console.log(container.childNodes);
14344         if (range.collapsed) {
14345         // we know what to do...
14346         console.log(container.childNodes[range.startOffset]);
14347         api.setSelectionToElementStart(container.childNodes[range.startOffset]);
14348         }
14349         },
14350         */
14351    };
14352    return api;
14353}]).service('taDOM', function(){
14354    var taDOM = {
14355        // recursive function that returns an array of angular.elements that have the passed attribute set on them
14356        getByAttribute: function(element, attribute){
14357            var resultingElements = [];
14358            var childNodes = element.children();
14359            if(childNodes.length){
14360                angular.forEach(childNodes, function(child){
14361                    resultingElements = resultingElements.concat(taDOM.getByAttribute(angular.element(child), attribute));
14362                });
14363            }
14364            if(element.attr(attribute) !== undefined) resultingElements.push(element);
14365            return resultingElements;
14366        },
14367
14368        transferChildNodes: function(source, target){
14369            // clear out target
14370            target.innerHTML = '';
14371            while(source.childNodes.length > 0) target.appendChild(source.childNodes[0]);
14372            return target;
14373        },
14374
14375        splitNodes: function(nodes, target1, target2, splitNode, subSplitIndex, splitIndex){
14376            if(!splitNode && isNaN(splitIndex)) throw new Error('taDOM.splitNodes requires a splitNode or splitIndex');
14377            var startNodes = document.createDocumentFragment();
14378            var endNodes = document.createDocumentFragment();
14379            var index = 0;
14380
14381            while(nodes.length > 0 && (isNaN(splitIndex) || splitIndex !== index) && nodes[0] !== splitNode){
14382                startNodes.appendChild(nodes[0]); // this removes from the nodes array (if proper childNodes object.
14383                index++;
14384            }
14385
14386            if(!isNaN(subSplitIndex) && subSplitIndex >= 0 && nodes[0]){
14387                startNodes.appendChild(document.createTextNode(nodes[0].nodeValue.substring(0, subSplitIndex)));
14388                nodes[0].nodeValue = nodes[0].nodeValue.substring(subSplitIndex);
14389            }
14390            while(nodes.length > 0) endNodes.appendChild(nodes[0]);
14391
14392            taDOM.transferChildNodes(startNodes, target1);
14393            taDOM.transferChildNodes(endNodes, target2);
14394        },
14395
14396        transferNodeAttributes: function(source, target){
14397            for(var i = 0; i < source.attributes.length; i++) target.setAttribute(source.attributes[i].name, source.attributes[i].value);
14398            return target;
14399        }
14400    };
14401    return taDOM;
14402});
14403
14404angular.module('textAngular.validators', [])
14405.directive('taMaxText', function(){
14406    return {
14407        restrict: 'A',
14408        require: 'ngModel',
14409        link: function(scope, elem, attrs, ctrl){
14410            var max = parseInt(scope.$eval(attrs.taMaxText));
14411            if (isNaN(max)){
14412                throw('Max text must be an integer');
14413            }
14414            attrs.$observe('taMaxText', function(value){
14415                max = parseInt(value);
14416                if (isNaN(max)){
14417                    throw('Max text must be an integer');
14418                }
14419                if (ctrl.$dirty){
14420                    ctrl.$validate();
14421                }
14422            });
14423            ctrl.$validators.taMaxText = function(viewValue){
14424                var source = angular.element('<div/>');
14425                source.html(viewValue);
14426                return source.text().length <= max;
14427            };
14428        }
14429    };
14430}).directive('taMinText', function(){
14431    return {
14432        restrict: 'A',
14433        require: 'ngModel',
14434        link: function(scope, elem, attrs, ctrl){
14435            var min = parseInt(scope.$eval(attrs.taMinText));
14436            if (isNaN(min)){
14437                throw('Min text must be an integer');
14438            }
14439            attrs.$observe('taMinText', function(value){
14440                min = parseInt(value);
14441                if (isNaN(min)){
14442                    throw('Min text must be an integer');
14443                }
14444                if (ctrl.$dirty){
14445                    ctrl.$validate();
14446                }
14447            });
14448            ctrl.$validators.taMinText = function(viewValue){
14449                var source = angular.element('<div/>');
14450                source.html(viewValue);
14451                return !source.text().length || source.text().length >= min;
14452            };
14453        }
14454    };
14455});
14456angular.module('textAngular.taBind', ['textAngular.factories', 'textAngular.DOM'])
14457.service('_taBlankTest', [function(){
14458    return function(_blankVal){
14459        // we radically restructure this code.
14460        // what was here before was incredibly fragile.
14461        // What we do now is to check that the html is non-blank visually
14462        // which we check by looking at html->text
14463        if(!_blankVal) return true;
14464        // find first non-tag match - ie start of string or after tag that is not whitespace
14465        // var t0 = performance.now();
14466        // Takes a small fraction of a mSec to do this...
14467        var _text_ = stripHtmlToText(_blankVal);
14468        // var t1 = performance.now();
14469        // console.log('Took', (t1 - t0).toFixed(4), 'milliseconds to generate:');
14470        if (_text_=== '') {
14471            // img generates a visible item so it is not blank!
14472            if (/<img[^>]+>/.test(_blankVal)) {
14473                return false;
14474            }
14475            return true;
14476        } else {
14477            return false;
14478        }
14479    };
14480}])
14481.directive('taButton', [function(){
14482    return {
14483        link: function(scope, element, attrs){
14484            element.attr('unselectable', 'on');
14485            element.on('mousedown', function(e, eventData){
14486                /* istanbul ignore else: this is for catching the jqLite testing*/
14487                if(eventData) angular.extend(e, eventData);
14488                // this prevents focusout from firing on the editor when clicking toolbar buttons
14489                e.preventDefault();
14490                return false;
14491            });
14492        }
14493    };
14494}])
14495.directive('taBind', [
14496        'taSanitize', '$timeout', '$document', 'taFixChrome', 'taBrowserTag',
14497        'taSelection', 'taSelectableElements', 'taApplyCustomRenderers', 'taOptions',
14498        '_taBlankTest', '$parse', 'taDOM', 'textAngularManager',
14499        function(
14500            taSanitize, $timeout, $document, taFixChrome, taBrowserTag,
14501            taSelection, taSelectableElements, taApplyCustomRenderers, taOptions,
14502            _taBlankTest, $parse, taDOM, textAngularManager){
14503    // Uses for this are textarea or input with ng-model and ta-bind='text'
14504    // OR any non-form element with contenteditable="contenteditable" ta-bind="html|text" ng-model
14505    return {
14506        priority: 2, // So we override validators correctly
14507        require: ['ngModel','?ngModelOptions'],
14508        link: function(scope, element, attrs, controller){
14509            var ngModel = controller[0];
14510            var ngModelOptions = controller[1] || {};
14511            // the option to use taBind on an input or textarea is required as it will sanitize all input into it correctly.
14512            var _isContentEditable = element.attr('contenteditable') !== undefined && element.attr('contenteditable');
14513            var _isInputFriendly = _isContentEditable || element[0].tagName.toLowerCase() === 'textarea' || element[0].tagName.toLowerCase() === 'input';
14514            var _isReadonly = false;
14515            var _focussed = false;
14516            var _skipRender = false;
14517            var _disableSanitizer = attrs.taUnsafeSanitizer || taOptions.disableSanitizer;
14518            var _keepStyles = attrs.taKeepStyles || taOptions.keepStyles;
14519            var _lastKey;
14520            // see http://www.javascripter.net/faq/keycodes.htm for good information
14521            // NOTE Mute On|Off 173 (Opera MSIE Safari Chrome) 181 (Firefox)
14522            // BLOCKED_KEYS are special keys...
14523            // Tab, pause/break, CapsLock, Esc, Page Up, End, Home,
14524            // Left arrow, Up arrow, Right arrow, Down arrow, Insert, Delete,
14525            // f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12
14526            // NumLock, ScrollLock
14527            var BLOCKED_KEYS = /^(9|19|20|27|33|34|35|36|37|38|39|40|45|112|113|114|115|116|117|118|119|120|121|122|123|144|145)$/i;
14528            // UNDO_TRIGGER_KEYS - spaces, enter, delete, backspace, all punctuation
14529            // Backspace, Enter, Space, Delete, (; :) (Firefox), (= +) (Firefox),
14530            // Numpad +, Numpad -, (; :), (= +),
14531            // (, <), (- _), (. >), (/ ?), (` ~), ([ {), (\ |), (] }), (' ")
14532            // NOTE - Firefox: 173 = (- _) -- adding this to UNDO_TRIGGER_KEYS
14533            var UNDO_TRIGGER_KEYS = /^(8|13|32|46|59|61|107|109|173|186|187|188|189|190|191|192|219|220|221|222)$/i;
14534            var _pasteHandler;
14535
14536            // defaults to the paragraph element, but we need the line-break or it doesn't allow you to type into the empty element
14537            // non IE is '<p><br/></p>', ie is '<p></p>' as for once IE gets it correct...
14538            var _defaultVal, _defaultTest;
14539
14540            var _CTRL_KEY = 0x0001;
14541            var _META_KEY = 0x0002;
14542            var _ALT_KEY = 0x0004;
14543            var _SHIFT_KEY = 0x0008;
14544            // KEYCODEs we use
14545            var _ENTER_KEYCODE = 13;
14546            var _SHIFT_KEYCODE = 16;
14547            var _TAB_KEYCODE = 9;
14548            var _LEFT_ARROW_KEYCODE = 37;
14549            var _RIGHT_ARROW_KEYCODE = 39;
14550            // map events to special keys...
14551            // mappings is an array of maps from events to specialKeys as declared in textAngularSetup
14552            var _keyMappings = [
14553                //		ctrl/command + z
14554                {
14555                    specialKey: 'UndoKey',
14556                    forbiddenModifiers: _ALT_KEY + _SHIFT_KEY,
14557                    mustHaveModifiers: [_META_KEY + _CTRL_KEY],
14558                    keyCode: 90
14559                },
14560                //		ctrl/command + shift + z
14561                {
14562                    specialKey: 'RedoKey',
14563                    forbiddenModifiers: _ALT_KEY,
14564                    mustHaveModifiers: [_META_KEY + _CTRL_KEY, _SHIFT_KEY],
14565                    keyCode: 90
14566                },
14567                //		ctrl/command + y
14568                {
14569                    specialKey: 'RedoKey',
14570                    forbiddenModifiers: _ALT_KEY + _SHIFT_KEY,
14571                    mustHaveModifiers: [_META_KEY + _CTRL_KEY],
14572                    keyCode: 89
14573                },
14574                //		TabKey
14575                {
14576                    specialKey: 'TabKey',
14577                    forbiddenModifiers: _META_KEY + _SHIFT_KEY + _ALT_KEY + _CTRL_KEY,
14578                    mustHaveModifiers: [],
14579                    keyCode: _TAB_KEYCODE
14580                },
14581                //		shift + TabKey
14582                {
14583                    specialKey: 'ShiftTabKey',
14584                    forbiddenModifiers: _META_KEY + _ALT_KEY + _CTRL_KEY,
14585                    mustHaveModifiers: [_SHIFT_KEY],
14586                    keyCode: _TAB_KEYCODE
14587                }
14588            ];
14589            function _mapKeys(event) {
14590                var specialKey;
14591                _keyMappings.forEach(function (map){
14592                    if (map.keyCode === event.keyCode) {
14593                        var netModifiers = (event.metaKey ? _META_KEY: 0) +
14594                            (event.ctrlKey ? _CTRL_KEY: 0) +
14595                            (event.shiftKey ? _SHIFT_KEY: 0) +
14596                            (event.altKey ? _ALT_KEY: 0);
14597                        if (map.forbiddenModifiers & netModifiers) return;
14598                        if (map.mustHaveModifiers.every(function (modifier) { return netModifiers & modifier; })){
14599                            specialKey = map.specialKey;
14600                        }
14601                    }
14602                });
14603                return specialKey;
14604            }
14605
14606            // set the default to be a paragraph value
14607            if(attrs.taDefaultWrap === undefined) attrs.taDefaultWrap = 'p';
14608            /* istanbul ignore next: ie specific test */
14609            if(attrs.taDefaultWrap === ''){
14610                _defaultVal = '';
14611                _defaultTest = (_browserDetect.ie === undefined)? '<div><br></div>' : (_browserDetect.ie >= 11)? '<p><br></p>' : (_browserDetect.ie <= 8)? '<P>&nbsp;</P>' : '<p>&nbsp;</p>';
14612            }else{
14613                _defaultVal = (_browserDetect.ie === undefined || _browserDetect.ie >= 11)?
14614                    (attrs.taDefaultWrap.toLowerCase() === 'br' ? '<BR><BR>' : '<' + attrs.taDefaultWrap + '><br></' + attrs.taDefaultWrap + '>') :
14615                    (_browserDetect.ie <= 8)?
14616                        '<' + attrs.taDefaultWrap.toUpperCase() + '></' + attrs.taDefaultWrap.toUpperCase() + '>' :
14617                        '<' + attrs.taDefaultWrap + '></' + attrs.taDefaultWrap + '>';
14618                _defaultTest = (_browserDetect.ie === undefined || _browserDetect.ie >= 11)?
14619                    (attrs.taDefaultWrap.toLowerCase() === 'br' ? '<br><br>' : '<' + attrs.taDefaultWrap + '><br></' + attrs.taDefaultWrap + '>') :
14620                    (_browserDetect.ie <= 8)?
14621                        '<' + attrs.taDefaultWrap.toUpperCase() + '>&nbsp;</' + attrs.taDefaultWrap.toUpperCase() + '>' :
14622                        '<' + attrs.taDefaultWrap + '>&nbsp;</' + attrs.taDefaultWrap + '>';
14623            }
14624
14625            /* istanbul ignore else */
14626            if(!ngModelOptions.$options) ngModelOptions.$options = {}; // ng-model-options support
14627
14628            var _ensureContentWrapped = function(value) {
14629                if (_taBlankTest(value)) return value;
14630                var domTest = angular.element("<div>" + value + "</div>");
14631                //console.log('domTest.children().length():', domTest.children().length);
14632                //console.log('_ensureContentWrapped', domTest.children());
14633                //console.log(value, attrs.taDefaultWrap);
14634                if (domTest.children().length === 0) {
14635                    // if we have a <br> and the attrs.taDefaultWrap is a <p> we need to remove the <br>
14636                    //value = value.replace(/<br>/i, '');
14637                    value = "<" + attrs.taDefaultWrap + ">" + value + "</" + attrs.taDefaultWrap + ">";
14638                } else {
14639                    var _children = domTest[0].childNodes;
14640                    var i;
14641                    var _foundBlockElement = false;
14642                    for (i = 0; i < _children.length; i++) {
14643                        if (_foundBlockElement = _children[i].nodeName.toLowerCase().match(BLOCKELEMENTS)) break;
14644                    }
14645                    if (!_foundBlockElement) {
14646                        value = "<" + attrs.taDefaultWrap + ">" + value + "</" + attrs.taDefaultWrap + ">";
14647                    }
14648                    else{
14649                        value = "";
14650                        for(i = 0; i < _children.length; i++){
14651                            var node = _children[i];
14652                            var nodeName = node.nodeName.toLowerCase();
14653                            //console.log('node#:', i, 'name:', nodeName);
14654                            if(nodeName === '#comment') {
14655                                value += '<!--' + node.nodeValue + '-->';
14656                            } else if(nodeName === '#text') {
14657                                // determine if this is all whitespace, if so, we will leave it as it is.
14658                                // otherwise, we will wrap it as it is
14659                                var text = node.textContent;
14660                                if (!text.trim()) {
14661                                    // just whitespace
14662                                    value += text;
14663                                } else {
14664                                    // not pure white space so wrap in <p>...</p> or whatever attrs.taDefaultWrap is set to.
14665                                    value += "<" + attrs.taDefaultWrap + ">" + text + "</" + attrs.taDefaultWrap + ">";
14666                                }
14667                            } else if(!nodeName.match(BLOCKELEMENTS)){
14668                                /* istanbul ignore  next: Doesn't seem to trigger on tests */
14669                                var _subVal = (node.outerHTML || node.nodeValue);
14670                                /* istanbul ignore else: Doesn't seem to trigger on tests, is tested though */
14671                                if(_subVal.trim() !== '')
14672                                    value += "<" + attrs.taDefaultWrap + ">" + _subVal + "</" + attrs.taDefaultWrap + ">";
14673                                else value += _subVal;
14674                            } else {
14675                                value += node.outerHTML;
14676                            }
14677                            //console.log(value);
14678                        }
14679                    }
14680                }
14681                //console.log(value);
14682                return value;
14683            };
14684
14685            if(attrs.taPaste) {
14686                _pasteHandler = $parse(attrs.taPaste);
14687            }
14688
14689            element.addClass('ta-bind');
14690
14691            var _undoKeyupTimeout;
14692
14693            scope['$undoManager' + (attrs.id || '')] = ngModel.$undoManager = {
14694                _stack: [],
14695                _index: 0,
14696                _max: 1000,
14697                push: function(value){
14698                    if((typeof value === "undefined" || value === null) ||
14699                        ((typeof this.current() !== "undefined" && this.current() !== null) && value === this.current())) return value;
14700                    if(this._index < this._stack.length - 1){
14701                        this._stack = this._stack.slice(0,this._index+1);
14702                    }
14703                    this._stack.push(value);
14704                    if(_undoKeyupTimeout) $timeout.cancel(_undoKeyupTimeout);
14705                    if(this._stack.length > this._max) this._stack.shift();
14706                    this._index = this._stack.length - 1;
14707                    return value;
14708                },
14709                undo: function(){
14710                    return this.setToIndex(this._index-1);
14711                },
14712                redo: function(){
14713                    return this.setToIndex(this._index+1);
14714                },
14715                setToIndex: function(index){
14716                    if(index < 0 || index > this._stack.length - 1){
14717                        return undefined;
14718                    }
14719                    this._index = index;
14720                    return this.current();
14721                },
14722                current: function(){
14723                    return this._stack[this._index];
14724                }
14725            };
14726
14727            // in here we are undoing the converts used elsewhere to prevent the < > and & being displayed when they shouldn't in the code.
14728            var _compileHtml = function(){
14729                if(_isContentEditable) {
14730                    return element[0].innerHTML;
14731                }
14732                if(_isInputFriendly) {
14733                    return element.val();
14734                }
14735                throw ('textAngular Error: attempting to update non-editable taBind');
14736            };
14737
14738            var selectorClickHandler = function(event){
14739                // emit the element-select event, pass the element
14740                scope.$emit('ta-element-select', this);
14741                event.preventDefault();
14742                return false;
14743            };
14744
14745            //used for updating when inserting wrapped elements
14746            var _reApplyOnSelectorHandlers = scope['reApplyOnSelectorHandlers' + (attrs.id || '')] = function(){
14747                /* istanbul ignore else */
14748                if(!_isReadonly) angular.forEach(taSelectableElements, function(selector){
14749                    // check we don't apply the handler twice
14750                    element.find(selector)
14751                        .off('click', selectorClickHandler)
14752                        .on('click', selectorClickHandler);
14753                });
14754            };
14755
14756            var _setViewValue = function(_val, triggerUndo, skipRender){
14757                _skipRender = skipRender || false;
14758                if(typeof triggerUndo === "undefined" || triggerUndo === null) triggerUndo = true && _isContentEditable; // if not contentEditable then the native undo/redo is fine
14759                if(typeof _val === "undefined" || _val === null) _val = _compileHtml();
14760                if(_taBlankTest(_val)){
14761                    // this avoids us from tripping the ng-pristine flag if we click in and out with out typing
14762                    if(ngModel.$viewValue !== '') ngModel.$setViewValue('');
14763                    if(triggerUndo && ngModel.$undoManager.current() !== '') ngModel.$undoManager.push('');
14764                }else{
14765                    _reApplyOnSelectorHandlers();
14766                    if(ngModel.$viewValue !== _val){
14767                        ngModel.$setViewValue(_val);
14768                        if(triggerUndo) ngModel.$undoManager.push(_val);
14769                    }
14770                }
14771                ngModel.$render();
14772            };
14773
14774            var _setInnerHTML = function(newval){
14775                element[0].innerHTML = newval;
14776            };
14777
14778            var _redoUndoTimeout;
14779            var _undo = scope['$undoTaBind' + (attrs.id || '')] = function(){
14780                /* istanbul ignore else: can't really test it due to all changes being ignored as well in readonly */
14781                if(!_isReadonly && _isContentEditable){
14782                    var content = ngModel.$undoManager.undo();
14783                    if(typeof content !== "undefined" && content !== null){
14784                        _setInnerHTML(content);
14785                        _setViewValue(content, false);
14786                        if(_redoUndoTimeout) $timeout.cancel(_redoUndoTimeout);
14787                        _redoUndoTimeout = $timeout(function(){
14788                            element[0].focus();
14789                            taSelection.setSelectionToElementEnd(element[0]);
14790                        }, 1);
14791                    }
14792                }
14793            };
14794
14795            var _redo = scope['$redoTaBind' + (attrs.id || '')] = function(){
14796                /* istanbul ignore else: can't really test it due to all changes being ignored as well in readonly */
14797                if(!_isReadonly && _isContentEditable){
14798                    var content = ngModel.$undoManager.redo();
14799                    if(typeof content !== "undefined" && content !== null){
14800                        _setInnerHTML(content);
14801                        _setViewValue(content, false);
14802                        /* istanbul ignore next */
14803                        if(_redoUndoTimeout) $timeout.cancel(_redoUndoTimeout);
14804                        _redoUndoTimeout = $timeout(function(){
14805                            element[0].focus();
14806                            taSelection.setSelectionToElementEnd(element[0]);
14807                        }, 1);
14808                    }
14809                }
14810            };
14811
14812            //used for updating when inserting wrapped elements
14813            scope['updateTaBind' + (attrs.id || '')] = function(){
14814                if(!_isReadonly) _setViewValue(undefined, undefined, true);
14815            };
14816
14817            // catch DOM XSS via taSanitize
14818            // Sanitizing both ways is identical
14819            var _sanitize = function(unsafe){
14820                return (ngModel.$oldViewValue = taSanitize(taFixChrome(unsafe, _keepStyles), ngModel.$oldViewValue, _disableSanitizer));
14821            };
14822
14823            // trigger the validation calls
14824            if(element.attr('required')) ngModel.$validators.required = function(modelValue, viewValue) {
14825                return !_taBlankTest(modelValue || viewValue);
14826            };
14827            // parsers trigger from the above keyup function or any other time that the viewValue is updated and parses it for storage in the ngModel
14828            ngModel.$parsers.push(_sanitize);
14829            ngModel.$parsers.unshift(_ensureContentWrapped);
14830            // because textAngular is bi-directional (which is awesome) we need to also sanitize values going in from the server
14831            ngModel.$formatters.push(_sanitize);
14832            ngModel.$formatters.unshift(_ensureContentWrapped);
14833            ngModel.$formatters.unshift(function(value){
14834                return ngModel.$undoManager.push(value || '');
14835            });
14836
14837            //this code is used to update the models when data is entered/deleted
14838            if(_isInputFriendly){
14839                scope.events = {};
14840                if(!_isContentEditable){
14841                    // if a textarea or input just add in change and blur handlers, everything else is done by angulars input directive
14842                    element.on('change blur', scope.events.change = scope.events.blur = function(){
14843                        if(!_isReadonly) ngModel.$setViewValue(_compileHtml());
14844                    });
14845
14846                    element.on('keydown', scope.events.keydown = function(event, eventData){
14847                        /* istanbul ignore else: this is for catching the jqLite testing*/
14848                        if(eventData) angular.extend(event, eventData);
14849                        // Reference to http://stackoverflow.com/questions/6140632/how-to-handle-tab-in-textarea
14850                        /* istanbul ignore else: otherwise normal functionality */
14851                        if(event.keyCode === _TAB_KEYCODE){ // tab was pressed
14852                            // get caret position/selection
14853                            var start = this.selectionStart;
14854                            var end = this.selectionEnd;
14855
14856                            var value = element.val();
14857                            if(event.shiftKey){
14858                                // find \t
14859                                var _linebreak = value.lastIndexOf('\n', start), _tab = value.lastIndexOf('\t', start);
14860                                if(_tab !== -1 && _tab >= _linebreak){
14861                                    // set textarea value to: text before caret + tab + text after caret
14862                                    element.val(value.substring(0, _tab) + value.substring(_tab + 1));
14863
14864                                    // put caret at right position again (add one for the tab)
14865                                    this.selectionStart = this.selectionEnd = start - 1;
14866                                }
14867                            }else{
14868                                // set textarea value to: text before caret + tab + text after caret
14869                                element.val(value.substring(0, start) + "\t" + value.substring(end));
14870
14871                                // put caret at right position again (add one for the tab)
14872                                this.selectionStart = this.selectionEnd = start + 1;
14873                            }
14874                            // prevent the focus lose
14875                            event.preventDefault();
14876                        }
14877                    });
14878
14879                    var _repeat = function(string, n){
14880                        var result = '';
14881                        for(var _n = 0; _n < n; _n++) result += string;
14882                        return result;
14883                    };
14884
14885                    // add a forEach function that will work on a NodeList, etc..
14886                    var forEach = function (array, callback, scope) {
14887                        for (var i= 0; i<array.length; i++) {
14888                            callback.call(scope, i, array[i]);
14889                        }
14890                    };
14891
14892                    // handle <ul> or <ol> nodes
14893                    var recursiveListFormat = function(listNode, tablevel){
14894                        var _html = '';
14895                        var _subnodes = listNode.childNodes;
14896                        tablevel++;
14897                        // tab out and add the <ul> or <ol> html piece
14898                        _html += _repeat('\t', tablevel-1) + listNode.outerHTML.substring(0, 4);
14899                        forEach(_subnodes, function (index, node) {
14900                            /* istanbul ignore next: browser catch */
14901                            var nodeName = node.nodeName.toLowerCase();
14902                            if (nodeName === '#comment') {
14903                                _html += '<!--' + node.nodeValue + '-->';
14904                                return;
14905                            }
14906                            if (nodeName === '#text') {
14907                                _html += node.textContent;
14908                                return;
14909                            }
14910                            /* istanbul ignore next: not tested, and this was original code -- so not wanting to possibly cause an issue, leaving it... */
14911                            if(!node.outerHTML) {
14912                                // no html to add
14913                                return;
14914                            }
14915                            if(nodeName === 'ul' || nodeName === 'ol') {
14916                                _html += '\n' + recursiveListFormat(node, tablevel);
14917                            }
14918                            else {
14919                                // no reformatting within this subnode, so just do the tabing...
14920                                _html += '\n' + _repeat('\t', tablevel) + node.outerHTML;
14921                            }
14922                        });
14923                        // now add on the </ol> or </ul> piece
14924                        _html += '\n' + _repeat('\t', tablevel-1) + listNode.outerHTML.substring(listNode.outerHTML.lastIndexOf('<'));
14925                        return _html;
14926                    };
14927                    // handle formating of something like:
14928                    // <ol><!--First comment-->
14929                    //  <li>Test Line 1<!--comment test list 1--></li>
14930                    //    <ul><!--comment ul-->
14931                    //      <li>Nested Line 1</li>
14932                    //        <!--comment between nested lines--><li>Nested Line 2</li>
14933                    //    </ul>
14934                    //  <li>Test Line 3</li>
14935                    // </ol>
14936                    ngModel.$formatters.unshift(function(htmlValue){
14937                        // tabulate the HTML so it looks nicer
14938                        //
14939                        // first get a list of the nodes...
14940                        // we do this by using the element parser...
14941                        //
14942                        // doing this -- which is simpiler -- breaks our tests...
14943                        //var _nodes=angular.element(htmlValue);
14944                        var _nodes = angular.element('<div>' + htmlValue + '</div>')[0].childNodes;
14945                        if(_nodes.length > 0){
14946                            // do the reformatting of the layout...
14947                            htmlValue = '';
14948                            forEach(_nodes, function (index, node) {
14949                                var nodeName = node.nodeName.toLowerCase();
14950                                if (nodeName === '#comment') {
14951                                    htmlValue += '<!--' + node.nodeValue + '-->';
14952                                    return;
14953                                }
14954                                if (nodeName === '#text') {
14955                                    htmlValue += node.textContent;
14956                                    return;
14957                                }
14958                                /* istanbul ignore next: not tested, and this was original code -- so not wanting to possibly cause an issue, leaving it... */
14959                                if(!node.outerHTML)
14960                                {
14961                                    // nothing to format!
14962                                    return;
14963                                }
14964                                if(htmlValue.length > 0) {
14965                                    // we aready have some content, so drop to a new line
14966                                    htmlValue += '\n';
14967                                }
14968                                if(nodeName === 'ul' || nodeName === 'ol') {
14969                                    // okay a set of list stuff we want to reformat in a nested way
14970                                    htmlValue += '' + recursiveListFormat(node, 0);
14971                                }
14972                                else {
14973                                    // just use the original without any additional formating
14974                                    htmlValue += '' + node.outerHTML;
14975                                }
14976                            });
14977                        }
14978                        return htmlValue;
14979                    });
14980                }else{
14981                    // all the code specific to contenteditable divs
14982                    var _processingPaste = false;
14983                    /* istanbul ignore next: phantom js cannot test this for some reason */
14984                    var processpaste = function(text) {
14985                       var _isOneNote = text!==undefined? text.match(/content=["']*OneNote.File/i): false;
14986                        /* istanbul ignore else: don't care if nothing pasted */
14987                        //console.log(text);
14988                        if(text && text.trim().length){
14989                            // test paste from word/microsoft product
14990                            if(text.match(/class=["']*Mso(Normal|List)/i) || text.match(/content=["']*Word.Document/i) || text.match(/content=["']*OneNote.File/i)){
14991                                var textFragment = text.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/i);
14992                                if(!textFragment) textFragment = text;
14993                                else textFragment = textFragment[1];
14994                                textFragment = textFragment.replace(/<o:p>[\s\S]*?<\/o:p>/ig, '').replace(/class=(["']|)MsoNormal(["']|)/ig, '');
14995                                var dom = angular.element("<div>" + textFragment + "</div>");
14996                                var targetDom = angular.element("<div></div>");
14997                                var _list = {
14998                                    element: null,
14999                                    lastIndent: [],
15000                                    lastLi: null,
15001                                    isUl: false
15002                                };
15003                                _list.lastIndent.peek = function(){
15004                                    var n = this.length;
15005                                    if (n>0) return this[n-1];
15006                                };
15007                                var _resetList = function(isUl){
15008                                    _list.isUl = isUl;
15009                                    _list.element = angular.element(isUl ? "<ul>" : "<ol>");
15010                                    _list.lastIndent = [];
15011                                    _list.lastIndent.peek = function(){
15012                                        var n = this.length;
15013                                        if (n>0) return this[n-1];
15014                                    };
15015                                    _list.lastLevelMatch = null;
15016                                };
15017                                for(var i = 0; i <= dom[0].childNodes.length; i++){
15018                                    if(!dom[0].childNodes[i] || dom[0].childNodes[i].nodeName === "#text"){
15019                                        continue;
15020                                    } else {
15021                                        var tagName = dom[0].childNodes[i].tagName.toLowerCase();
15022                                        if(tagName !== 'p' &&
15023                                            tagName !== 'ul' &&
15024                                            tagName !== 'h1' &&
15025                                            tagName !== 'h2' &&
15026                                            tagName !== 'h3' &&
15027                                            tagName !== 'h4' &&
15028                                            tagName !== 'h5' &&
15029                                            tagName !== 'h6' &&
15030                                            tagName !== 'table'){
15031                                            continue;
15032                                        }
15033                                    }
15034                                    var el = angular.element(dom[0].childNodes[i]);
15035                                    var _listMatch = (el.attr('class') || '').match(/MsoList(Bullet|Number|Paragraph)(CxSp(First|Middle|Last)|)/i);
15036
15037                                    if(_listMatch){
15038                                        if(el[0].childNodes.length < 2 || el[0].childNodes[1].childNodes.length < 1){
15039                                            continue;
15040                                        }
15041                                        var isUl = _listMatch[1].toLowerCase() === 'bullet' || (_listMatch[1].toLowerCase() !== 'number' && !(/^[^0-9a-z<]*[0-9a-z]+[^0-9a-z<>]</i.test(el[0].childNodes[1].innerHTML) || /^[^0-9a-z<]*[0-9a-z]+[^0-9a-z<>]</i.test(el[0].childNodes[1].childNodes[0].innerHTML)));
15042                                        var _indentMatch = (el.attr('style') || '').match(/margin-left:([\-\.0-9]*)/i);
15043                                        var indent = parseFloat((_indentMatch)?_indentMatch[1]:0);
15044                                        var _levelMatch = (el.attr('style') || '').match(/mso-list:l([0-9]+) level([0-9]+) lfo[0-9+]($|;)/i);
15045                                        // prefers the mso-list syntax
15046
15047                                        if(_levelMatch && _levelMatch[2]) indent = parseInt(_levelMatch[2]);
15048
15049                                        if ((_levelMatch && (!_list.lastLevelMatch || _levelMatch[1] !== _list.lastLevelMatch[1])) || !_listMatch[3] || _listMatch[3].toLowerCase() === 'first' || (_list.lastIndent.peek() === null) || (_list.isUl !== isUl && _list.lastIndent.peek() === indent)) {
15050                                            _resetList(isUl);
15051                                            targetDom.append(_list.element);
15052                                        } else if (_list.lastIndent.peek() != null && _list.lastIndent.peek() < indent){
15053                                            _list.element = angular.element(isUl ? '<ul>' : '<ol>');
15054                                            _list.lastLi.append(_list.element);
15055                                        } else if (_list.lastIndent.peek() != null && _list.lastIndent.peek() > indent){
15056                                            while(_list.lastIndent.peek() != null && _list.lastIndent.peek() > indent){
15057                                                if(_list.element.parent()[0].tagName.toLowerCase() === 'li'){
15058                                                    _list.element = _list.element.parent();
15059                                                    continue;
15060                                                }else if(/[uo]l/i.test(_list.element.parent()[0].tagName.toLowerCase())){
15061                                                    _list.element = _list.element.parent();
15062                                                }else{ // else it's it should be a sibling
15063                                                    break;
15064                                                }
15065                                                _list.lastIndent.pop();
15066                                            }
15067                                            _list.isUl = _list.element[0].tagName.toLowerCase() === 'ul';
15068                                            if (isUl !== _list.isUl) {
15069                                                _resetList(isUl);
15070                                                targetDom.append(_list.element);
15071                                            }
15072                                        }
15073
15074                                        _list.lastLevelMatch = _levelMatch;
15075                                        if(indent !== _list.lastIndent.peek()) _list.lastIndent.push(indent);
15076                                        _list.lastLi = angular.element('<li>');
15077                                        _list.element.append(_list.lastLi);
15078                                        _list.lastLi.html(el.html().replace(/<!(--|)\[if !supportLists\](--|)>[\s\S]*?<!(--|)\[endif\](--|)>/ig, ''));
15079                                        el.remove();
15080                                    }else{
15081                                        _resetList(false);
15082                                        targetDom.append(el);
15083                                    }
15084                                }
15085                                var _unwrapElement = function(node){
15086                                    node = angular.element(node);
15087                                    for(var _n = node[0].childNodes.length - 1; _n >= 0; _n--) node.after(node[0].childNodes[_n]);
15088                                    node.remove();
15089                                };
15090
15091                                angular.forEach(targetDom.find('span'), function(node){
15092                                    node.removeAttribute('lang');
15093                                    if(node.attributes.length <= 0) _unwrapElement(node);
15094                                });
15095                                angular.forEach(targetDom.find('font'), _unwrapElement);
15096
15097                                text = targetDom.html();
15098                                if(_isOneNote){
15099                                    text = targetDom.html() || dom.html();
15100                                }
15101                                // LF characters instead of spaces in some spots and they are replaced by '/n', so we need to just swap them to spaces
15102                                text = text.replace(/\n/g, ' ');
15103                            }else{
15104                                // remove unnecessary chrome insert
15105                                text = text.replace(/<(|\/)meta[^>]*?>/ig, '');
15106                                if(text.match(/<[^>]*?(ta-bind)[^>]*?>/)){
15107                                    // entire text-angular or ta-bind has been pasted, REMOVE AT ONCE!!
15108                                    if(text.match(/<[^>]*?(text-angular)[^>]*?>/)){
15109                                        var _el = angular.element('<div>' + text + '</div>');
15110                                        _el.find('textarea').remove();
15111                                        for(var _b = 0; _b < binds.length; _b++){
15112                                            var _target = binds[_b][0].parentNode.parentNode;
15113                                            for(var _c = 0; _c < binds[_b][0].childNodes.length; _c++){
15114                                                _target.parentNode.insertBefore(binds[_b][0].childNodes[_c], _target);
15115                                            }
15116                                            _target.parentNode.removeChild(_target);
15117                                        }
15118                                        text = _el.html().replace('<br class="Apple-interchange-newline">', '');
15119                                    }
15120                                }else if(text.match(/^<span/)){
15121                                    // in case of pasting only a span - chrome paste, remove them. THis is just some wierd formatting
15122                                    // if we remove the '<span class="Apple-converted-space"> </span>' here we destroy the spacing
15123                                    // on paste from even ourselves!
15124                                    if (!text.match(/<span class=(\"Apple-converted-space\"|\'Apple-converted-space\')>.<\/span>/ig)) {
15125                                        text = text.replace(/<(|\/)span[^>]*?>/ig, '');
15126                                    }
15127                                }
15128                                // Webkit on Apple tags
15129                                text = text.replace(/<br class="Apple-interchange-newline"[^>]*?>/ig, '').replace(/<span class="Apple-converted-space">( |&nbsp;)<\/span>/ig, '&nbsp;');
15130                            }
15131
15132                            if (/<li(\s.*)?>/i.test(text) && /(<ul(\s.*)?>|<ol(\s.*)?>).*<li(\s.*)?>/i.test(text) === false) {
15133                                // insert missing parent of li element
15134                                text = text.replace(/<li(\s.*)?>.*<\/li(\s.*)?>/i, '<ul>$&</ul>');
15135                            }
15136
15137                            // parse whitespace from plaintext input, starting with preceding spaces that get stripped on paste
15138                            text = text.replace(/^[ |\u00A0]+/gm, function (match) {
15139                                var result = '';
15140                                for (var i = 0; i < match.length; i++) {
15141                                    result += '&nbsp;';
15142                                }
15143                                return result;
15144                            }).replace(/\n|\r\n|\r/g, '<br />').replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;');
15145
15146                            if(_pasteHandler) text = _pasteHandler(scope, {$html: text}) || text;
15147
15148                            // turn span vertical-align:super into <sup></sup>
15149                            text = text.replace(/<span style=("|')([^<]*?)vertical-align\s*:\s*super;?([^>]*?)("|')>([^<]+?)<\/span>/g, "<sup style='$2$3'>$5</sup>");
15150
15151                            text = taSanitize(text, '', _disableSanitizer);
15152                            //console.log('DONE\n', text);
15153
15154                            taSelection.insertHtml(text, element[0]);
15155                            $timeout(function(){
15156                                ngModel.$setViewValue(_compileHtml());
15157                                _processingPaste = false;
15158                                element.removeClass('processing-paste');
15159                            }, 0);
15160                        }else{
15161                            _processingPaste = false;
15162                            element.removeClass('processing-paste');
15163                        }
15164                    };
15165
15166                    element.on('paste', scope.events.paste = function(e, eventData){
15167                        /* istanbul ignore else: this is for catching the jqLite testing*/
15168                        if(eventData) angular.extend(e, eventData);
15169                        if(_isReadonly || _processingPaste){
15170                            e.stopPropagation();
15171                            e.preventDefault();
15172                            return false;
15173                        }
15174
15175                        // Code adapted from http://stackoverflow.com/questions/2176861/javascript-get-clipboard-data-on-paste-event-cross-browser/6804718#6804718
15176                        _processingPaste = true;
15177                        element.addClass('processing-paste');
15178                        var pastedContent;
15179                        var clipboardData = (e.originalEvent || e).clipboardData;
15180                        /* istanbul ignore next: Handle legacy IE paste */
15181                        if ( !clipboardData && window.clipboardData && window.clipboardData.getData ){
15182                            pastedContent = window.clipboardData.getData("Text");
15183                            processpaste(pastedContent);
15184                            e.stopPropagation();
15185                            e.preventDefault();
15186                            return false;
15187                        }
15188                        if (clipboardData && clipboardData.getData && clipboardData.types.length > 0) {// Webkit - get data from clipboard, put into editdiv, cleanup, then cancel event
15189                            var _types = "";
15190                            for(var _t = 0; _t < clipboardData.types.length; _t++){
15191                                _types += " " + clipboardData.types[_t];
15192                            }
15193                            /* istanbul ignore next: browser tests */
15194                            if (/text\/html/i.test(_types)) {
15195                                pastedContent = clipboardData.getData('text/html');
15196                            } else if (/text\/plain/i.test(_types)) {
15197                                pastedContent = clipboardData.getData('text/plain');
15198                            }
15199                            processpaste(pastedContent);
15200                            e.stopPropagation();
15201                            e.preventDefault();
15202                            return false;
15203                        } else {// Everything else - empty editdiv and allow browser to paste content into it, then cleanup
15204                            var _savedSelection = rangy.saveSelection(),
15205                                _tempDiv = angular.element('<div class="ta-hidden-input" contenteditable="true"></div>');
15206                            $document.find('body').append(_tempDiv);
15207                            _tempDiv[0].focus();
15208                            $timeout(function(){
15209                                // restore selection
15210                                rangy.restoreSelection(_savedSelection);
15211                                processpaste(_tempDiv[0].innerHTML);
15212                                element[0].focus();
15213                                _tempDiv.remove();
15214                            }, 0);
15215                        }
15216                    });
15217                    element.on('cut', scope.events.cut = function(e){
15218                        // timeout to next is needed as otherwise the paste/cut event has not finished actually changing the display
15219                        if(!_isReadonly) $timeout(function(){
15220                            ngModel.$setViewValue(_compileHtml());
15221                        }, 0);
15222                        else e.preventDefault();
15223                    });
15224
15225                    element.on('keydown', scope.events.keydown = function(event, eventData){
15226                        /* istanbul ignore else: this is for catching the jqLite testing*/
15227                        if(eventData) angular.extend(event, eventData);
15228                        if (event.keyCode === _SHIFT_KEYCODE) {
15229                            taSelection.setStateShiftKey(true);
15230                        } else {
15231                            taSelection.setStateShiftKey(false);
15232                        }
15233                        event.specialKey = _mapKeys(event);
15234                        var userSpecialKey;
15235                        /* istanbul ignore next: difficult to test */
15236                        taOptions.keyMappings.forEach(function (mapping) {
15237                            if (event.specialKey === mapping.commandKeyCode) {
15238                                // taOptions has remapped this binding... so
15239                                // we disable our own
15240                                event.specialKey = undefined;
15241                            }
15242                            if (mapping.testForKey(event)) {
15243                                userSpecialKey = mapping.commandKeyCode;
15244                            }
15245                            if ((mapping.commandKeyCode === 'UndoKey') || (mapping.commandKeyCode === 'RedoKey')) {
15246                                // this is necessary to fully stop the propagation.
15247                                if (!mapping.enablePropagation) {
15248                                    event.preventDefault();
15249                                }
15250                            }
15251                        });
15252                        /* istanbul ignore next: difficult to test */
15253                        if (typeof userSpecialKey !== 'undefined') {
15254                            event.specialKey = userSpecialKey;
15255                        }
15256                        /* istanbul ignore next: difficult to test as can't seem to select */
15257                        if ((typeof event.specialKey !== 'undefined') && (
15258                                event.specialKey !== 'UndoKey' || event.specialKey !== 'RedoKey'
15259                            )) {
15260                            event.preventDefault();
15261                            textAngularManager.sendKeyCommand(scope, event);
15262                        }
15263                        /* istanbul ignore else: readonly check */
15264                        if(!_isReadonly){
15265                            if (event.specialKey==='UndoKey') {
15266                                _undo();
15267                                event.preventDefault();
15268                            }
15269                            if (event.specialKey==='RedoKey') {
15270                                _redo();
15271                                event.preventDefault();
15272                            }
15273                            /* istanbul ignore next: difficult to test as can't seem to select */
15274                            if(event.keyCode === _ENTER_KEYCODE && !event.shiftKey && !event.ctrlKey && !event.metaKey && !event.altKey)
15275                            {
15276                                var contains = function(a, obj) {
15277                                    for (var i = 0; i < a.length; i++) {
15278                                        if (a[i] === obj) {
15279                                            return true;
15280                                        }
15281                                    }
15282                                    return false;
15283                                };
15284                                var $selection;
15285                                var selection = taSelection.getSelectionElement();
15286                                // shifted to nodeName here from tagName since it is more widely supported see: http://stackoverflow.com/questions/4878484/difference-between-tagname-and-nodename
15287                                if(!selection.nodeName.match(VALIDELEMENTS)) return;
15288                                var _new = angular.element(_defaultVal);
15289                                // if we are in the last element of a blockquote, or ul or ol and the element is blank
15290                                // we need to pull the element outside of the said type
15291                                var moveOutsideElements = ['blockquote', 'ul', 'ol'];
15292                                if (contains(moveOutsideElements, selection.parentNode.tagName.toLowerCase())) {
15293                                    if (/^<br(|\/)>$/i.test(selection.innerHTML.trim()) && !selection.nextSibling) {
15294                                        // if last element is blank, pull element outside.
15295                                        $selection = angular.element(selection);
15296                                        var _parent = $selection.parent();
15297                                        _parent.after(_new);
15298                                        $selection.remove();
15299                                        if (_parent.children().length === 0) _parent.remove();
15300                                        taSelection.setSelectionToElementStart(_new[0]);
15301                                        event.preventDefault();
15302                                    }
15303                                    if (/^<[^>]+><br(|\/)><\/[^>]+>$/i.test(selection.innerHTML.trim())) {
15304                                        $selection = angular.element(selection);
15305                                        $selection.after(_new);
15306                                        $selection.remove();
15307                                        taSelection.setSelectionToElementStart(_new[0]);
15308                                        event.preventDefault();
15309                                    }
15310                                }
15311                            }
15312                        }
15313                    });
15314                    var _keyupTimeout;
15315                    element.on('keyup', scope.events.keyup = function(event, eventData){
15316                        /* istanbul ignore else: this is for catching the jqLite testing*/
15317                        if(eventData) angular.extend(event, eventData);
15318                        taSelection.setStateShiftKey(false);	// clear the ShiftKey state
15319                        /* istanbul ignore next: FF specific bug fix */
15320                        if (event.keyCode === _TAB_KEYCODE) {
15321                            var _selection = taSelection.getSelection();
15322                            if(_selection.start.element === element[0] && element.children().length) taSelection.setSelectionToElementStart(element.children()[0]);
15323                            return;
15324                        }
15325                        // we do this here during the 'keyup' so that the browser has already moved the slection by one character...
15326                        if (event.keyCode === _LEFT_ARROW_KEYCODE && !event.shiftKey) {
15327                            taSelection.updateLeftArrowKey(element);
15328                        }
15329                        // we do this here during the 'keyup' so that the browser has already moved the slection by one character...
15330                        if (event.keyCode === _RIGHT_ARROW_KEYCODE && !event.shiftKey) {
15331                            taSelection.updateRightArrowKey(element);
15332                        }
15333                        if(_undoKeyupTimeout) $timeout.cancel(_undoKeyupTimeout);
15334                        if(!_isReadonly && !BLOCKED_KEYS.test(event.keyCode)){
15335                            /* istanbul ignore next: Ignore any _ENTER_KEYCODE that has ctrlKey, metaKey or alKey */
15336                            if (event.keyCode === _ENTER_KEYCODE && (event.ctrlKey || event.metaKey || event.altKey)) {
15337                                // we ignore any ENTER_	KEYCODE that is anything but plain or a shift one...
15338                            } else {
15339                                // if enter - insert new taDefaultWrap, if shift+enter insert <br/>
15340                                if(_defaultVal !== '' && _defaultVal !== '<BR><BR>' && event.keyCode === _ENTER_KEYCODE && !event.ctrlKey && !event.metaKey && !event.altKey){
15341                                    var selection = taSelection.getSelectionElement();
15342                                    while(!selection.nodeName.match(VALIDELEMENTS) && selection !== element[0]){
15343                                        selection = selection.parentNode;
15344                                    }
15345                                    if(!event.shiftKey){
15346                                        // new paragraph, br should be caught correctly
15347                                        // shifted to nodeName here from tagName since it is more widely supported see: http://stackoverflow.com/questions/4878484/difference-between-tagname-and-nodename
15348                                        //console.log('Enter', selection.nodeName, attrs.taDefaultWrap, selection.innerHTML.trim());
15349                                        if(selection.tagName.toLowerCase() !==
15350                                            attrs.taDefaultWrap &&
15351                                            selection.nodeName.toLowerCase() !== 'li' &&
15352                                            (selection.innerHTML.trim() === '' || selection.innerHTML.trim() === '<br>')
15353                                        ) {
15354                                            // Chrome starts with a <div><br></div> after an EnterKey
15355                                            // so we replace this with the _defaultVal
15356                                            var _new = angular.element(_defaultVal);
15357                                            angular.element(selection).replaceWith(_new);
15358                                            taSelection.setSelectionToElementStart(_new[0]);
15359                                        }
15360                                    } else {
15361                                        // shift + Enter
15362                                        var tagName = selection.tagName.toLowerCase();
15363                                        //console.log('Shift+Enter', selection.tagName, attrs.taDefaultWrap, selection.innerHTML.trim());
15364                                        // For an LI: We see: LI p ....<br><br>
15365                                        // For a P: We see: P p ....<br><br>
15366                                        // on Safari, the browser ignores the Shift+Enter and acts just as an Enter Key
15367                                        // For an LI: We see: LI p <br>
15368                                        // For a P: We see: P p <br>
15369                                        if((tagName === attrs.taDefaultWrap ||
15370                                            tagName === 'li' ||
15371                                            tagName === 'pre' ||
15372                                            tagName === 'div') &&
15373                                            !/.+<br><br>/.test(selection.innerHTML.trim())) {
15374                                            var ps = selection.previousSibling;
15375                                            //console.log('wrong....', ps);
15376                                            // we need to remove this selection and fix the previousSibling up...
15377                                            if (ps) {
15378                                                ps.innerHTML = ps.innerHTML + '<br><br>';
15379                                                angular.element(selection).remove();
15380                                                taSelection.setSelectionToElementEnd(ps);
15381                                            }
15382                                        }
15383                                    }
15384                                }
15385                                var val = _compileHtml();
15386                                if(_defaultVal !== '' && (val.trim() === '' || val.trim() === '<br>')){
15387                                    _setInnerHTML(_defaultVal);
15388                                    taSelection.setSelectionToElementStart(element.children()[0]);
15389                                }else if(val.substring(0, 1) !== '<' && attrs.taDefaultWrap !== ''){
15390                                    /* we no longer do this, since there can be comments here and white space
15391                                     var _savedSelection = rangy.saveSelection();
15392                                     val = _compileHtml();
15393                                     val = "<" + attrs.taDefaultWrap + ">" + val + "</" + attrs.taDefaultWrap + ">";
15394                                     _setInnerHTML(val);
15395                                     rangy.restoreSelection(_savedSelection);
15396                                     */
15397                                }
15398                                var triggerUndo = _lastKey !== event.keyCode && UNDO_TRIGGER_KEYS.test(event.keyCode);
15399                                if(_keyupTimeout) $timeout.cancel(_keyupTimeout);
15400                                _keyupTimeout = $timeout(function() {
15401                                    _setViewValue(val, triggerUndo, true);
15402                                }, ngModelOptions.$options.debounce || 400);
15403                                if(!triggerUndo) _undoKeyupTimeout = $timeout(function(){ ngModel.$undoManager.push(val); }, 250);
15404                                _lastKey = event.keyCode;
15405                            }
15406                        }
15407                    });
15408
15409                    // when there is a change from a spelling correction in the browser, the only
15410                    // change that is seen is a 'input' and the $watch('html') sees nothing... So
15411                    // we added this element.on('input') to catch this change and call the _setViewValue()
15412                    // so the ngModel is updated and all works as it should.
15413                    var _inputTimeout;
15414                    element.on('input', function() {
15415                        if (_compileHtml() !== ngModel.$viewValue) {
15416                            // we wait a time now to allow the natural $watch('html') to handle this change
15417                            // and then after a 1 second delay, if there is still a difference we will do the
15418                            // _setViewValue() call.
15419                            /* istanbul ignore if: can't test */
15420                            if(_inputTimeout) $timeout.cancel(_inputTimeout);
15421                            /* istanbul ignore next: cant' test? */
15422                            _inputTimeout = $timeout(function() {
15423                                var _savedSelection = rangy.saveSelection();
15424                                var _val = _compileHtml();
15425                                if (_val !== ngModel.$viewValue) {
15426                                    //console.log('_setViewValue');
15427                                    //console.log('old:', ngModel.$viewValue);
15428                                    //console.log('new:', _val);
15429                                    _setViewValue(_val, true);
15430                                }
15431                                // if the savedSelection marker is gone at this point, we cannot restore the selection!!!
15432                                //console.log('rangy.restoreSelection', ngModel.$viewValue.length, _savedSelection);
15433                                if (ngModel.$viewValue.length !== 0) {
15434                                    rangy.restoreSelection(_savedSelection);
15435                                }
15436                            }, 1000);
15437                        }
15438                    });
15439
15440                    element.on('blur', scope.events.blur = function(){
15441                        _focussed = false;
15442                        /* istanbul ignore else: if readonly don't update model */
15443                        if(!_isReadonly){
15444                            _setViewValue(undefined, undefined, true);
15445                        }else{
15446                            _skipRender = true; // don't redo the whole thing, just check the placeholder logic
15447                            ngModel.$render();
15448                        }
15449                    });
15450
15451                    // Placeholders not supported on ie 8 and below
15452                    if(attrs.placeholder && (_browserDetect.ie > 8 || _browserDetect.ie === undefined)){
15453                        var rule;
15454                        if(attrs.id) rule = addCSSRule('#' + attrs.id + '.placeholder-text:before', 'content: "' + attrs.placeholder + '"');
15455                        else throw('textAngular Error: An unique ID is required for placeholders to work');
15456
15457                        scope.$on('$destroy', function(){
15458                            removeCSSRule(rule);
15459                        });
15460                    }
15461
15462                    element.on('focus', scope.events.focus = function(){
15463                        _focussed = true;
15464                        element.removeClass('placeholder-text');
15465                        _reApplyOnSelectorHandlers();
15466                    });
15467
15468                    element.on('mouseup', scope.events.mouseup = function(){
15469                        var _selection = taSelection.getSelection();
15470                        if(_selection && _selection.start.element === element[0] && element.children().length) taSelection.setSelectionToElementStart(element.children()[0]);
15471                    });
15472
15473                    // prevent propagation on mousedown in editor, see #206
15474                    element.on('mousedown', scope.events.mousedown = function(event, eventData){
15475                        /* istanbul ignore else: this is for catching the jqLite testing*/
15476                        if(eventData) angular.extend(event, eventData);
15477                        event.stopPropagation();
15478                    });
15479                }
15480            }
15481
15482            var fileDropHandler = function(event, eventData){
15483                /* istanbul ignore else: this is for catching the jqLite testing*/
15484                if(eventData) angular.extend(event, eventData);
15485                // emit the drop event, pass the element, preventing should be done elsewhere
15486                if(!dropFired && !_isReadonly){
15487                    dropFired = true;
15488                    var dataTransfer;
15489                    if(event.originalEvent) dataTransfer = event.originalEvent.dataTransfer;
15490                    else dataTransfer = event.dataTransfer;
15491                    scope.$emit('ta-drop-event', this, event, dataTransfer);
15492                    $timeout(function(){
15493                        dropFired = false;
15494                        _setViewValue(undefined, undefined, true);
15495                    }, 100);
15496                }
15497            };
15498
15499            var _renderTimeout;
15500            var _renderInProgress = false;
15501            // changes to the model variable from outside the html/text inputs
15502            ngModel.$render = function(){
15503                /* istanbul ignore if: Catches rogue renders, hard to replicate in tests */
15504                if(_renderInProgress) return;
15505                else _renderInProgress = true;
15506                // catch model being null or undefined
15507                var val = ngModel.$viewValue || '';
15508                // if the editor isn't focused it needs to be updated, otherwise it's receiving user input
15509                if(!_skipRender){
15510                    /* istanbul ignore else: in other cases we don't care */
15511                    if(_isContentEditable && _focussed){
15512                        // update while focussed
15513                        element.removeClass('placeholder-text');
15514                        /* istanbul ignore next: don't know how to test this */
15515                        if(_renderTimeout) $timeout.cancel(_renderTimeout);
15516                        _renderTimeout = $timeout(function(){
15517                            /* istanbul ignore if: Can't be bothered testing this... */
15518                            if(!_focussed){
15519                                element[0].focus();
15520                                taSelection.setSelectionToElementEnd(element.children()[element.children().length - 1]);
15521                            }
15522                            _renderTimeout = undefined;
15523                        }, 1);
15524                    }
15525                    if(_isContentEditable){
15526                        // WYSIWYG Mode
15527                        if(attrs.placeholder){
15528                            if(val === ''){
15529                                // blank
15530                                _setInnerHTML(_defaultVal);
15531                            }else{
15532                                // not-blank
15533                                _setInnerHTML(val);
15534                            }
15535                        }else{
15536                            _setInnerHTML((val === '') ? _defaultVal : val);
15537                        }
15538                        // if in WYSIWYG and readOnly we kill the use of links by clicking
15539                        if(!_isReadonly){
15540                            _reApplyOnSelectorHandlers();
15541                            element.on('drop', fileDropHandler);
15542                        }else{
15543                            element.off('drop', fileDropHandler);
15544                        }
15545                    }else if(element[0].tagName.toLowerCase() !== 'textarea' && element[0].tagName.toLowerCase() !== 'input'){
15546                        // make sure the end user can SEE the html code as a display. This is a read-only display element
15547                        _setInnerHTML(taApplyCustomRenderers(val));
15548                    }else{
15549                        // only for input and textarea inputs
15550                        element.val(val);
15551                    }
15552                }
15553                if(_isContentEditable && attrs.placeholder){
15554                    if(val === ''){
15555                        if(_focussed) element.removeClass('placeholder-text');
15556                        else element.addClass('placeholder-text');
15557                    }else{
15558                        element.removeClass('placeholder-text');
15559                    }
15560                }
15561                _renderInProgress = _skipRender = false;
15562            };
15563
15564            if(attrs.taReadonly){
15565                //set initial value
15566                _isReadonly = scope.$eval(attrs.taReadonly);
15567                if(_isReadonly){
15568                    element.addClass('ta-readonly');
15569                    // we changed to readOnly mode (taReadonly='true')
15570                    if(element[0].tagName.toLowerCase() === 'textarea' || element[0].tagName.toLowerCase() === 'input'){
15571                        element.attr('disabled', 'disabled');
15572                    }
15573                    if(element.attr('contenteditable') !== undefined && element.attr('contenteditable')){
15574                        element.removeAttr('contenteditable');
15575                    }
15576                }else{
15577                    element.removeClass('ta-readonly');
15578                    // we changed to NOT readOnly mode (taReadonly='false')
15579                    if(element[0].tagName.toLowerCase() === 'textarea' || element[0].tagName.toLowerCase() === 'input'){
15580                        element.removeAttr('disabled');
15581                    }else if(_isContentEditable){
15582                        element.attr('contenteditable', 'true');
15583                    }
15584                }
15585                // taReadonly only has an effect if the taBind element is an input or textarea or has contenteditable='true' on it.
15586                // Otherwise it is readonly by default
15587                scope.$watch(attrs.taReadonly, function(newVal, oldVal){
15588                    if(oldVal === newVal) return;
15589                    if(newVal){
15590                        element.addClass('ta-readonly');
15591                        // we changed to readOnly mode (taReadonly='true')
15592                        if(element[0].tagName.toLowerCase() === 'textarea' || element[0].tagName.toLowerCase() === 'input'){
15593                            element.attr('disabled', 'disabled');
15594                        }
15595                        if(element.attr('contenteditable') !== undefined && element.attr('contenteditable')){
15596                            element.removeAttr('contenteditable');
15597                        }
15598                        // turn ON selector click handlers
15599                        angular.forEach(taSelectableElements, function(selector){
15600                            element.find(selector).on('click', selectorClickHandler);
15601                        });
15602                        element.off('drop', fileDropHandler);
15603                    }else{
15604                        element.removeClass('ta-readonly');
15605                        // we changed to NOT readOnly mode (taReadonly='false')
15606                        if(element[0].tagName.toLowerCase() === 'textarea' || element[0].tagName.toLowerCase() === 'input'){
15607                            element.removeAttr('disabled');
15608                        }else if(_isContentEditable){
15609                            element.attr('contenteditable', 'true');
15610                        }
15611                        // remove the selector click handlers
15612                        angular.forEach(taSelectableElements, function(selector){
15613                            element.find(selector).off('click', selectorClickHandler);
15614                        });
15615                        element.on('drop', fileDropHandler);
15616                    }
15617                    _isReadonly = newVal;
15618                });
15619            }
15620
15621            // Initialise the selectableElements
15622            // if in WYSIWYG and readOnly we kill the use of links by clicking
15623            if(_isContentEditable && !_isReadonly){
15624                angular.forEach(taSelectableElements, function(selector){
15625                    element.find(selector).on('click', selectorClickHandler);
15626                });
15627                element.on('drop', fileDropHandler);
15628            }
15629        }
15630    };
15631}]);
15632
15633// this global var is used to prevent multiple fires of the drop event. Needs to be global to the textAngular file.
15634var dropFired = false;
15635var textAngular = angular.module("textAngular", ['ngSanitize', 'textAngularSetup', 'textAngular.factories', 'textAngular.DOM', 'textAngular.validators', 'textAngular.taBind']); //This makes ngSanitize required
15636
15637textAngular.config([function(){
15638    // clear taTools variable. Just catches testing and any other time that this config may run multiple times...
15639    angular.forEach(taTools, function(value, key){ delete taTools[key];	});
15640}]);
15641
15642textAngular.directive("textAngular", [
15643    '$compile', '$timeout', 'taOptions', 'taSelection', 'taExecCommand',
15644    'textAngularManager', '$document', '$animate', '$log', '$q', '$parse',
15645    function($compile, $timeout, taOptions, taSelection, taExecCommand,
15646        textAngularManager, $document, $animate, $log, $q, $parse){
15647        return {
15648            require: '?ngModel',
15649            scope: {},
15650            restrict: "EA",
15651            priority: 2, // So we override validators correctly
15652            link: function(scope, element, attrs, ngModel){
15653                // all these vars should not be accessable outside this directive
15654                var _keydown, _keyup, _keypress, _mouseup, _focusin, _focusout,
15655                    _originalContents, _editorFunctions,
15656                    _serial = (attrs.serial) ? attrs.serial : Math.floor(Math.random() * 10000000000000000),
15657                    _taExecCommand, _resizeMouseDown, _updateSelectedStylesTimeout;
15658                var _resizeTimeout;
15659
15660                scope._name = (attrs.name) ? attrs.name : 'textAngularEditor' + _serial;
15661
15662                var oneEvent = function(_element, event, action){
15663                    $timeout(function(){
15664                        _element.one(event, action);
15665                    }, 100);
15666                };
15667                _taExecCommand = taExecCommand(attrs.taDefaultWrap);
15668                // get the settings from the defaults and add our specific functions that need to be on the scope
15669                angular.extend(scope, angular.copy(taOptions), {
15670                    // wraps the selection in the provided tag / execCommand function. Should only be called in WYSIWYG mode.
15671                    wrapSelection: function(command, opt, isSelectableElementTool){
15672                        // we restore the saved selection that was saved when focus was lost
15673                        /* NOT FUNCTIONAL YET */
15674                        /* textAngularManager.restoreFocusSelection(scope._name, scope); */
15675                        if(command.toLowerCase() === "undo"){
15676                            scope['$undoTaBindtaTextElement' + _serial]();
15677                        }else if(command.toLowerCase() === "redo"){
15678                            scope['$redoTaBindtaTextElement' + _serial]();
15679                        }else{
15680                            // catch errors like FF erroring when you try to force an undo with nothing done
15681                            _taExecCommand(command, false, opt, scope.defaultTagAttributes);
15682                            if(isSelectableElementTool){
15683                                // re-apply the selectable tool events
15684                                scope['reApplyOnSelectorHandlerstaTextElement' + _serial]();
15685                            }
15686                            // refocus on the shown display element, this fixes a display bug when using :focus styles to outline the box.
15687                            // You still have focus on the text/html input it just doesn't show up
15688                            scope.displayElements.text[0].focus();
15689                        }
15690                    },
15691                    showHtml: scope.$eval(attrs.taShowHtml) || false
15692                });
15693                // setup the options from the optional attributes
15694                if(attrs.taFocussedClass)			scope.classes.focussed = attrs.taFocussedClass;
15695                if(attrs.taTextEditorClass)			scope.classes.textEditor = attrs.taTextEditorClass;
15696                if(attrs.taHtmlEditorClass)			scope.classes.htmlEditor = attrs.taHtmlEditorClass;
15697                if(attrs.taDefaultTagAttributes){
15698                    try	{
15699                        //	TODO: This should use angular.merge to enhance functionality once angular 1.4 is required
15700                        angular.extend(scope.defaultTagAttributes, angular.fromJson(attrs.taDefaultTagAttributes));
15701                    } catch (error) {
15702                        $log.error(error);
15703                    }
15704                }
15705                // optional setup functions
15706                if(attrs.taTextEditorSetup)			scope.setup.textEditorSetup = scope.$parent.$eval(attrs.taTextEditorSetup);
15707                if(attrs.taHtmlEditorSetup)			scope.setup.htmlEditorSetup = scope.$parent.$eval(attrs.taHtmlEditorSetup);
15708                // optional fileDropHandler function
15709                if(attrs.taFileDrop)				scope.fileDropHandler = scope.$parent.$eval(attrs.taFileDrop);
15710                else								scope.fileDropHandler = scope.defaultFileDropHandler;
15711
15712                _originalContents = element[0].innerHTML;
15713                // clear the original content
15714                element[0].innerHTML = '';
15715
15716                // Setup the HTML elements as variable references for use later
15717                scope.displayElements = {
15718                    // we still need the hidden input even with a textarea as the textarea may have invalid/old input in it,
15719                    // wheras the input will ALLWAYS have the correct value.
15720                    forminput: angular.element("<input type='hidden' tabindex='-1' style='display: none;'>"),
15721                    html: angular.element("<textarea></textarea>"),
15722                    text: angular.element("<div></div>"),
15723                    // other toolbased elements
15724                    scrollWindow: angular.element("<div class='ta-scroll-window'></div>"),
15725                    popover: angular.element('<div class="popover fade bottom" style="max-width: none; width: 305px;"></div>'),
15726                    popoverArrow: angular.element('<div class="arrow"></div>'),
15727                    popoverContainer: angular.element('<div class="popover-content"></div>'),
15728                    resize: {
15729                        overlay: angular.element('<div class="ta-resizer-handle-overlay"></div>'),
15730                        background: angular.element('<div class="ta-resizer-handle-background"></div>'),
15731                        anchors: [
15732                            angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-tl"></div>'),
15733                            angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-tr"></div>'),
15734                            angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-bl"></div>'),
15735                            angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-br"></div>')
15736                        ],
15737                        info: angular.element('<div class="ta-resizer-handle-info"></div>')
15738                    }
15739                };
15740
15741                // Setup the popover
15742                scope.displayElements.popover.append(scope.displayElements.popoverArrow);
15743                scope.displayElements.popover.append(scope.displayElements.popoverContainer);
15744                scope.displayElements.scrollWindow.append(scope.displayElements.popover);
15745
15746                scope.displayElements.popover.on('mousedown', function(e, eventData){
15747                    /* istanbul ignore else: this is for catching the jqLite testing*/
15748                    if(eventData) angular.extend(e, eventData);
15749                    // this prevents focusout from firing on the editor when clicking anything in the popover
15750                    e.preventDefault();
15751                    return false;
15752                });
15753
15754                /* istanbul ignore next: popover resize and scroll events handled */
15755                scope.handlePopoverEvents = function() {
15756                    if (scope.displayElements.popover.css('display')==='block') {
15757                        if(_resizeTimeout) $timeout.cancel(_resizeTimeout);
15758                        _resizeTimeout = $timeout(function() {
15759                            //console.log('resize', scope.displayElements.popover.css('display'));
15760                            scope.reflowPopover(scope.resizeElement);
15761                            scope.reflowResizeOverlay(scope.resizeElement);
15762                        }, 100);
15763                    }
15764                };
15765
15766                /* istanbul ignore next: browser resize check */
15767                angular.element(window).on('resize', scope.handlePopoverEvents);
15768
15769                /* istanbul ignore next: browser scroll check */
15770                angular.element(window).on('scroll', scope.handlePopoverEvents);
15771
15772                // we want to know if a given node has a scrollbar!
15773                // credit to lotif on http://stackoverflow.com/questions/4880381/check-whether-html-element-has-scrollbars
15774                var isScrollable = function(node) {
15775                    var cs;
15776                    var _notScrollable = {
15777                        vertical: false,
15778                        horizontal: false,
15779                    };
15780                    try {
15781                        cs = window.getComputedStyle(node);
15782                        if (cs === null) {
15783                            return _notScrollable;
15784                        }
15785                    } catch (e) {
15786                        /* istanbul ignore next: error handler */
15787                        return _notScrollable;
15788                    }
15789                    var overflowY = cs['overflow-y'];
15790                    var overflowX = cs['overflow-x'];
15791                    return {
15792                        vertical: (overflowY === 'scroll' || overflowY === 'auto') &&
15793                                    /* istanbul ignore next: not tested */
15794                                    node.scrollHeight > node.clientHeight,
15795                        horizontal: (overflowX === 'scroll' || overflowX === 'auto') &&
15796                                    /* istanbul ignore next: not tested */
15797                                    node.scrollWidth > node.clientWidth,
15798                    };
15799                };
15800
15801                // getScrollTop
15802                //
15803                // we structure this so that it can climb the parents of the _el and when it finds
15804                // one with scrollbars, it adds an EventListener, so that no matter how the
15805                // DOM is structured in the user APP, if there is a scrollbar not as part of the
15806                // ta-scroll-window, we will still capture the 'scroll' events...
15807                // and handle the scroll event properly and do the resize, etc.
15808                //
15809                scope.getScrollTop = function (_el, bAddListener) {
15810                    var scrollTop = _el.scrollTop;
15811                    if (typeof scrollTop === 'undefined') {
15812                        scrollTop = 0;
15813                    }
15814                    /* istanbul ignore next: triggered only if has scrollbar */
15815                    if (bAddListener && isScrollable(_el).vertical) {
15816                        // remove element eventListener
15817                        _el.removeEventListener('scroll', scope._scrollListener, false);
15818                        _el.addEventListener('scroll', scope._scrollListener, false);
15819                    }
15820                    /* istanbul ignore next: triggered only if has scrollbar and scrolled */
15821                    if (scrollTop !== 0) {
15822                        return { node:_el.nodeName, top:scrollTop };
15823                    }
15824                    /* istanbul ignore else: catches only if no scroll */
15825                    if (_el.parentNode) {
15826                        return scope.getScrollTop(_el.parentNode, bAddListener);
15827                    } else {
15828                        return { node:'<none>', top:0 };
15829                    }
15830                };
15831
15832                // define the popover show and hide functions
15833                scope.showPopover = function(_el){
15834                    scope.getScrollTop(scope.displayElements.scrollWindow[0], true);
15835                    scope.displayElements.popover.css('display', 'block');
15836                    // we must use a $timeout here, or the css change to the
15837                    // displayElements.resize.overlay will not take!!!
15838                    // WHY???
15839                    $timeout(function() {
15840                        scope.displayElements.resize.overlay.css('display', 'block');
15841                    });
15842                    scope.resizeElement = _el;
15843                    scope.reflowPopover(_el);
15844                    $animate.addClass(scope.displayElements.popover, 'in');
15845                    oneEvent($document.find('body'), 'click keyup', function(){scope.hidePopover();});
15846                };
15847
15848                /* istanbul ignore next: browser scroll event handler */
15849                scope._scrollListener = function (e, eventData){
15850                    scope.handlePopoverEvents();
15851                };
15852
15853                scope.reflowPopover = function(_el){
15854                    var scrollTop = scope.getScrollTop(scope.displayElements.scrollWindow[0], false);
15855                    var spaceAboveImage = _el[0].offsetTop-scrollTop.top;
15856                    //var spaceBelowImage = scope.displayElements.text[0].offsetHeight - _el[0].offsetHeight - spaceAboveImage;
15857                    //console.log(spaceAboveImage, spaceBelowImage);
15858
15859                    /* istanbul ignore if: catches only if near bottom of editor */
15860                    if(spaceAboveImage < 51) {
15861                        scope.displayElements.popover.css('top', _el[0].offsetTop + _el[0].offsetHeight + scope.displayElements.scrollWindow[0].scrollTop + 'px');
15862                        scope.displayElements.popover.removeClass('top').addClass('bottom');
15863                    } else {
15864                        scope.displayElements.popover.css('top', _el[0].offsetTop - 54 + scope.displayElements.scrollWindow[0].scrollTop + 'px');
15865                        scope.displayElements.popover.removeClass('bottom').addClass('top');
15866                    }
15867                    var _maxLeft = scope.displayElements.text[0].offsetWidth - scope.displayElements.popover[0].offsetWidth;
15868                    var _targetLeft = _el[0].offsetLeft + (_el[0].offsetWidth / 2.0) - (scope.displayElements.popover[0].offsetWidth / 2.0);
15869                    var _rleft = Math.max(0, Math.min(_maxLeft, _targetLeft));
15870                    var _marginLeft = (Math.min(_targetLeft, (Math.max(0, _targetLeft - _maxLeft))) - 11);
15871                    _rleft += window.scrollX;
15872                    _marginLeft -= window.scrollX;
15873                    scope.displayElements.popover.css('left', _rleft + 'px');
15874                    scope.displayElements.popoverArrow.css('margin-left', _marginLeft + 'px');
15875                };
15876                scope.hidePopover = function(){
15877                    scope.displayElements.popover.css('display', 'none');
15878                    scope.displayElements.popoverContainer.attr('style', '');
15879                    scope.displayElements.popoverContainer.attr('class', 'popover-content');
15880                    scope.displayElements.popover.removeClass('in');
15881                    scope.displayElements.resize.overlay.css('display', 'none');
15882                };
15883
15884                // setup the resize overlay
15885                scope.displayElements.resize.overlay.append(scope.displayElements.resize.background);
15886                angular.forEach(scope.displayElements.resize.anchors, function(anchor){ scope.displayElements.resize.overlay.append(anchor);});
15887                scope.displayElements.resize.overlay.append(scope.displayElements.resize.info);
15888                scope.displayElements.scrollWindow.append(scope.displayElements.resize.overlay);
15889
15890                // A click event on the resize.background will now shift the focus to the editor
15891                /* istanbul ignore next: click on the resize.background to focus back to editor */
15892                scope.displayElements.resize.background.on('click', function(e) {
15893                    scope.displayElements.text[0].focus();
15894                });
15895
15896                // define the show and hide events
15897                scope.reflowResizeOverlay = function(_el){
15898                    _el = angular.element(_el)[0];
15899                    scope.displayElements.resize.overlay.css({
15900                        'display': 'block',
15901                        'left': _el.offsetLeft - 5 + 'px',
15902                        'top': _el.offsetTop - 5 + 'px',
15903                        'width': _el.offsetWidth + 10 + 'px',
15904                        'height': _el.offsetHeight + 10 + 'px'
15905                    });
15906                    scope.displayElements.resize.info.text(_el.offsetWidth + ' x ' + _el.offsetHeight);
15907                };
15908                /* istanbul ignore next: pretty sure phantomjs won't test this */
15909                scope.showResizeOverlay = function(_el){
15910                    var _body = $document.find('body');
15911                    _resizeMouseDown = function(event){
15912                        var startPosition = {
15913                            width: parseInt(_el.attr('width')),
15914                            height: parseInt(_el.attr('height')),
15915                            x: event.clientX,
15916                            y: event.clientY
15917                        };
15918                        if(startPosition.width === undefined || isNaN(startPosition.width)) startPosition.width = _el[0].offsetWidth;
15919                        if(startPosition.height === undefined || isNaN(startPosition.height)) startPosition.height = _el[0].offsetHeight;
15920                        scope.hidePopover();
15921                        var ratio = startPosition.height / startPosition.width;
15922                        var mousemove = function(event){
15923                            // calculate new size
15924                            var pos = {
15925                                x: Math.max(0, startPosition.width + (event.clientX - startPosition.x)),
15926                                y: Math.max(0, startPosition.height + (event.clientY - startPosition.y))
15927                            };
15928
15929                            // DEFAULT: the aspect ratio is not locked unless the Shift key is pressed.
15930                            //
15931                            // attribute: ta-resize-force-aspect-ratio -- locks resize into maintaing the aspect ratio
15932                            var bForceAspectRatio = (attrs.taResizeForceAspectRatio !== undefined);
15933                            // attribute: ta-resize-maintain-aspect-ratio=true causes the space ratio to remain locked
15934                            // unless the Shift key is pressed
15935                            var bFlipKeyBinding = attrs.taResizeMaintainAspectRatio;
15936                            var bKeepRatio =  bForceAspectRatio || (bFlipKeyBinding && !event.shiftKey);
15937                            if(bKeepRatio) {
15938                                var newRatio = pos.y / pos.x;
15939                                pos.x = ratio > newRatio ? pos.x : pos.y / ratio;
15940                                pos.y = ratio > newRatio ? pos.x * ratio : pos.y;
15941                            }
15942                            var el = angular.element(_el);
15943                            function roundedMaxVal(val) {
15944                                return Math.round(Math.max(0, val));
15945                            }
15946                            el.css('height', roundedMaxVal(pos.y) + 'px');
15947                            el.css('width', roundedMaxVal(pos.x) + 'px');
15948
15949                            // reflow the popover tooltip
15950                            scope.reflowResizeOverlay(_el);
15951                        };
15952                        _body.on('mousemove', mousemove);
15953                        oneEvent(_body, 'mouseup', function(event){
15954                            event.preventDefault();
15955                            event.stopPropagation();
15956                            _body.off('mousemove', mousemove);
15957                            // at this point, we need to force the model to update! since the css has changed!
15958                            // this fixes bug: #862 - we now hide the popover -- as this seems more consitent.
15959                            // there are still issues under firefox, the window does not repaint. -- not sure
15960                            // how best to resolve this, but clicking anywhere works.
15961                            scope.$apply(function (){
15962                                scope.hidePopover();
15963                                scope.updateTaBindtaTextElement();
15964                            }, 100);
15965                        });
15966                        event.stopPropagation();
15967                        event.preventDefault();
15968                    };
15969
15970                    scope.displayElements.resize.anchors[3].off('mousedown');
15971                    scope.displayElements.resize.anchors[3].on('mousedown', _resizeMouseDown);
15972
15973                    scope.reflowResizeOverlay(_el);
15974                    oneEvent(_body, 'click', function(){scope.hideResizeOverlay();});
15975                };
15976                /* istanbul ignore next: pretty sure phantomjs won't test this */
15977                scope.hideResizeOverlay = function(){
15978                    scope.displayElements.resize.anchors[3].off('mousedown', _resizeMouseDown);
15979                    scope.displayElements.resize.overlay.css('display', 'none');
15980                };
15981
15982                // allow for insertion of custom directives on the textarea and div
15983                scope.setup.htmlEditorSetup(scope.displayElements.html);
15984                scope.setup.textEditorSetup(scope.displayElements.text);
15985                scope.displayElements.html.attr({
15986                    'id': 'taHtmlElement' + _serial,
15987                    'ng-show': 'showHtml',
15988                    'ta-bind': 'ta-bind',
15989                    'ng-model': 'html',
15990                    'ng-model-options': element.attr('ng-model-options')
15991                });
15992                scope.displayElements.text.attr({
15993                    'id': 'taTextElement' + _serial,
15994                    'contentEditable': 'true',
15995                    'ta-bind': 'ta-bind',
15996                    'ng-model': 'html',
15997                    'ng-model-options': element.attr('ng-model-options')
15998                });
15999                scope.displayElements.scrollWindow.attr({'ng-hide': 'showHtml'});
16000                if(attrs.taDefaultWrap) {
16001                    // taDefaultWrap is only applied to the text and not the html view
16002                    scope.displayElements.text.attr('ta-default-wrap', attrs.taDefaultWrap);
16003                }
16004
16005                if(attrs.taUnsafeSanitizer){
16006                    scope.displayElements.text.attr('ta-unsafe-sanitizer', attrs.taUnsafeSanitizer);
16007                    scope.displayElements.html.attr('ta-unsafe-sanitizer', attrs.taUnsafeSanitizer);
16008                }
16009
16010                if(attrs.taKeepStyles){
16011                    scope.displayElements.text.attr('ta-keep-styles', attrs.taKeepStyles);
16012                    scope.displayElements.html.attr('ta-keep-styles', attrs.taKeepStyles);
16013                }
16014
16015                // add the main elements to the origional element
16016                scope.displayElements.scrollWindow.append(scope.displayElements.text);
16017                element.append(scope.displayElements.scrollWindow);
16018                element.append(scope.displayElements.html);
16019
16020                scope.displayElements.forminput.attr('name', scope._name);
16021                element.append(scope.displayElements.forminput);
16022
16023                if(attrs.tabindex){
16024                    element.removeAttr('tabindex');
16025                    scope.displayElements.text.attr('tabindex', attrs.tabindex);
16026                    scope.displayElements.html.attr('tabindex', attrs.tabindex);
16027                }
16028
16029                if (attrs.placeholder) {
16030                    scope.displayElements.text.attr('placeholder', attrs.placeholder);
16031                    scope.displayElements.html.attr('placeholder', attrs.placeholder);
16032                }
16033
16034                if(attrs.taDisabled){
16035                    scope.displayElements.text.attr('ta-readonly', 'disabled');
16036                    scope.displayElements.html.attr('ta-readonly', 'disabled');
16037                    scope.disabled = scope.$parent.$eval(attrs.taDisabled);
16038                    scope.$parent.$watch(attrs.taDisabled, function(newVal){
16039                        scope.disabled = newVal;
16040                        if(scope.disabled){
16041                            element.addClass(scope.classes.disabled);
16042                        }else{
16043                            element.removeClass(scope.classes.disabled);
16044                        }
16045                    });
16046                }
16047
16048                if(attrs.taPaste){
16049                    scope._pasteHandler = function(_html){
16050                        return $parse(attrs.taPaste)(scope.$parent, {$html: _html});
16051                    };
16052                    scope.displayElements.text.attr('ta-paste', '_pasteHandler($html)');
16053                }
16054
16055                // compile the scope with the text and html elements only - if we do this with the main element it causes a compile loop
16056                $compile(scope.displayElements.scrollWindow)(scope);
16057                $compile(scope.displayElements.html)(scope);
16058
16059                scope.updateTaBindtaTextElement = scope['updateTaBindtaTextElement' + _serial];
16060                scope.updateTaBindtaHtmlElement = scope['updateTaBindtaHtmlElement' + _serial];
16061
16062                // add the classes manually last
16063                element.addClass("ta-root");
16064                scope.displayElements.scrollWindow.addClass("ta-text ta-editor " + scope.classes.textEditor);
16065                scope.displayElements.html.addClass("ta-html ta-editor " + scope.classes.htmlEditor);
16066
16067                var testAndSet = function(choice, beforeState) {
16068                    /* istanbul ignore next: this is only here because of a bug in rangy where rangy.saveSelection() has cleared the state */
16069                    if (beforeState !== $document[0].queryCommandState(choice)) {
16070                        $document[0].execCommand(choice, false, null);
16071                    }
16072                };
16073                // used in the toolbar actions
16074                scope._actionRunning = false;
16075                var _savedSelection = false;
16076                scope.startAction = function(){
16077                    var _beforeStateBold = false;
16078                    var _beforeStateItalic = false;
16079                    var _beforeStateUnderline = false;
16080                    var _beforeStateStrikethough = false;
16081                    scope._actionRunning = true;
16082                    _beforeStateBold = $document[0].queryCommandState('bold');
16083                    _beforeStateItalic = $document[0].queryCommandState('italic');
16084                    _beforeStateUnderline = $document[0].queryCommandState('underline');
16085                    _beforeStateStrikethough = $document[0].queryCommandState('strikeThrough');
16086                    //console.log('B', _beforeStateBold, 'I', _beforeStateItalic, '_', _beforeStateUnderline, 'S', _beforeStateStrikethough);
16087                    // if rangy library is loaded return a function to reload the current selection
16088                    _savedSelection = rangy.saveSelection();
16089                    // rangy.saveSelection() clear the state of bold, italic, underline, strikethrough
16090                    // so we reset them here....!!!
16091                    // this fixes bugs #423, #1129, #1105, #693 which are actually rangy bugs!
16092                    testAndSet('bold', _beforeStateBold);
16093                    testAndSet('italic', _beforeStateItalic);
16094                    testAndSet('underline', _beforeStateUnderline);
16095                    testAndSet('strikeThrough', _beforeStateStrikethough);
16096                    //console.log('B', $document[0].queryCommandState('bold'), 'I', $document[0].queryCommandState('italic'), '_', $document[0].queryCommandState('underline'), 'S', $document[0].queryCommandState('strikeThrough') );
16097                    return function(){
16098                        if(_savedSelection) rangy.restoreSelection(_savedSelection);
16099                        // perhaps if we restore the selections here, we would do better overall???
16100                        // BUT what we do above does well in 90% of the cases...
16101                    };
16102                };
16103                scope.endAction = function(){
16104                    scope._actionRunning = false;
16105                    if(_savedSelection){
16106                        if(scope.showHtml){
16107                            scope.displayElements.html[0].focus();
16108                        }else{
16109                            scope.displayElements.text[0].focus();
16110                        }
16111                        // rangy.restoreSelection(_savedSelection);
16112                        rangy.removeMarkers(_savedSelection);
16113                    }
16114                    _savedSelection = false;
16115                    scope.updateSelectedStyles();
16116                    // only update if in text or WYSIWYG mode
16117                    if(!scope.showHtml) scope['updateTaBindtaTextElement' + _serial]();
16118                };
16119
16120                // note that focusout > focusin is called everytime we click a button - except bad support: http://www.quirksmode.org/dom/events/blurfocus.html
16121                // cascades to displayElements.text and displayElements.html automatically.
16122                _focusin = function(e){
16123                    scope.focussed = true;
16124                    element.addClass(scope.classes.focussed);
16125/*******  NOT FUNCTIONAL YET
16126                    if (e.target.id === 'taTextElement' + _serial) {
16127                        console.log('_focusin taTextElement');
16128                        // we only do this if NOT focussed
16129                        textAngularManager.restoreFocusSelection(scope._name);
16130                    }
16131*******/
16132                    _editorFunctions.focus();
16133                    element.triggerHandler('focus');
16134                    // we call editorScope.updateSelectedStyles() here because we want the toolbar to be focussed
16135                    // as soon as we have focus.  Otherwise this only happens on mousedown or keydown etc...
16136                    /* istanbul ignore else: don't run if already running */
16137                    if(scope.updateSelectedStyles && !scope._bUpdateSelectedStyles){
16138                        // we don't set editorScope._bUpdateSelectedStyles here, because we do not want the
16139                        // updateSelectedStyles() to run twice which it will do after 200 msec if we have
16140                        // set editorScope._bUpdateSelectedStyles
16141                        //
16142                        // WOW, normally I would do a scope.$apply here, but this causes ERRORs when doing tests!
16143                        $timeout(function () {
16144                            scope.updateSelectedStyles();
16145                        }, 0);
16146                    }
16147                };
16148                scope.displayElements.html.on('focus', _focusin);
16149                scope.displayElements.text.on('focus', _focusin);
16150                _focusout = function(e){
16151                    /****************** NOT FUNCTIONAL YET
16152                    try {
16153                        var _s = rangy.getSelection();
16154                        if (_s) {
16155                            // we save the selection when we loose focus so that if do a wrapSelection, the
16156                            // apropriate selection in the editor is restored before action.
16157                            var _savedFocusRange = rangy.saveRange(_s.getRangeAt(0));
16158                            textAngularManager.saveFocusSelection(scope._name, _savedFocusRange);
16159                        }
16160                    } catch(error) { }
16161                    *****************/
16162                    // if we are NOT runnig an action and have NOT focussed again on the text etc then fire the blur events
16163                    if(!scope._actionRunning &&
16164                        $document[0].activeElement !== scope.displayElements.html[0] &&
16165                        $document[0].activeElement !== scope.displayElements.text[0])
16166                    {
16167                        element.removeClass(scope.classes.focussed);
16168                        _editorFunctions.unfocus();
16169                        // to prevent multiple apply error defer to next seems to work.
16170                        $timeout(function(){
16171                            scope._bUpdateSelectedStyles = false;
16172                            element.triggerHandler('blur');
16173                            scope.focussed = false;
16174                        }, 0);
16175                    }
16176                    e.preventDefault();
16177                    return false;
16178                };
16179                scope.displayElements.html.on('blur', _focusout);
16180                scope.displayElements.text.on('blur', _focusout);
16181
16182                scope.displayElements.text.on('paste', function(event){
16183                    element.triggerHandler('paste', event);
16184                });
16185
16186                // Setup the default toolbar tools, this way allows the user to add new tools like plugins.
16187                // This is on the editor for future proofing if we find a better way to do this.
16188                scope.queryFormatBlockState = function(command){
16189                    // $document[0].queryCommandValue('formatBlock') errors in Firefox if we call this when focussed on the textarea
16190                    return !scope.showHtml && command.toLowerCase() === $document[0].queryCommandValue('formatBlock').toLowerCase();
16191                };
16192                scope.queryCommandState = function(command){
16193                    // $document[0].queryCommandValue('formatBlock') errors in Firefox if we call this when focussed on the textarea
16194                    return (!scope.showHtml) ? $document[0].queryCommandState(command) : '';
16195                };
16196                scope.switchView = function(){
16197                    scope.showHtml = !scope.showHtml;
16198                    $animate.enabled(false, scope.displayElements.html);
16199                    $animate.enabled(false, scope.displayElements.text);
16200                    //Show the HTML view
16201                    /* istanbul ignore next: ngModel exists check */
16202/* THIS is not the correct thing to do, here....
16203   The ngModel is correct, but it is not formatted as the user as done it...
16204                    var _model;
16205                    if (ngModel) {
16206                        _model = ngModel.$viewValue;
16207                    } else {
16208                        _model = scope.html;
16209                    }
16210                    var _html = scope.displayElements.html[0].value;
16211                    if (getDomFromHtml(_html).childElementCount !== getDomFromHtml(_model).childElementCount) {
16212                        // the model and the html do not agree
16213                        // they can get out of sync and when they do, we correct that here...
16214                        scope.displayElements.html.val(_model);
16215                    }
16216*/
16217                    if(scope.showHtml){
16218                        //defer until the element is visible
16219                        $timeout(function(){
16220                            $animate.enabled(true, scope.displayElements.html);
16221                            $animate.enabled(true, scope.displayElements.text);
16222                            // [0] dereferences the DOM object from the angular.element
16223                            return scope.displayElements.html[0].focus();
16224                        }, 100);
16225                    }else{
16226                        //Show the WYSIWYG view
16227                        //defer until the element is visible
16228                        $timeout(function(){
16229                            $animate.enabled(true, scope.displayElements.html);
16230                            $animate.enabled(true, scope.displayElements.text);
16231                            // [0] dereferences the DOM object from the angular.element
16232                            return scope.displayElements.text[0].focus();
16233                        }, 100);
16234                    }
16235                };
16236
16237                // changes to the model variable from outside the html/text inputs
16238                // if no ngModel, then the only input is from inside text-angular
16239                if(attrs.ngModel){
16240                    var _firstRun = true;
16241                    ngModel.$render = function(){
16242                        if(_firstRun){
16243                            // we need this firstRun to set the originalContents otherwise it gets overrided by the setting of ngModel to undefined from NaN
16244                            _firstRun = false;
16245                            // if view value is null or undefined initially and there was original content, set to the original content
16246                            var _initialValue = scope.$parent.$eval(attrs.ngModel);
16247                            if((_initialValue === undefined || _initialValue === null) && (_originalContents && _originalContents !== '')){
16248                                // on passing through to taBind it will be sanitised
16249                                ngModel.$setViewValue(_originalContents);
16250                            }
16251                        }
16252                        scope.displayElements.forminput.val(ngModel.$viewValue);
16253                        // if the editors aren't focused they need to be updated, otherwise they are doing the updating
16254                        scope.html = ngModel.$viewValue || '';
16255                    };
16256                    // trigger the validation calls
16257                    if(element.attr('required')) ngModel.$validators.required = function(modelValue, viewValue) {
16258                        var value = modelValue || viewValue;
16259                        return !(!value || value.trim() === '');
16260                    };
16261                }else{
16262                    // if no ngModel then update from the contents of the origional html.
16263                    scope.displayElements.forminput.val(_originalContents);
16264                    scope.html = _originalContents;
16265                }
16266
16267                // changes from taBind back up to here
16268                scope.$watch('html', function(newValue, oldValue){
16269                    if(newValue !== oldValue){
16270                        if(attrs.ngModel && ngModel.$viewValue !== newValue) {
16271                            ngModel.$setViewValue(newValue);
16272                        }
16273                        scope.displayElements.forminput.val(newValue);
16274                    }
16275                });
16276
16277                if(attrs.taTargetToolbars) {
16278                    _editorFunctions = textAngularManager.registerEditor(scope._name, scope, attrs.taTargetToolbars.split(','));
16279                }
16280                else{
16281                    var _toolbar = angular.element('<div text-angular-toolbar name="textAngularToolbar' + _serial + '">');
16282                    // passthrough init of toolbar options
16283                    if(attrs.taToolbar)						_toolbar.attr('ta-toolbar', attrs.taToolbar);
16284                    if(attrs.taToolbarClass)				_toolbar.attr('ta-toolbar-class', attrs.taToolbarClass);
16285                    if(attrs.taToolbarGroupClass)			_toolbar.attr('ta-toolbar-group-class', attrs.taToolbarGroupClass);
16286                    if(attrs.taToolbarButtonClass)			_toolbar.attr('ta-toolbar-button-class', attrs.taToolbarButtonClass);
16287                    if(attrs.taToolbarActiveButtonClass)	_toolbar.attr('ta-toolbar-active-button-class', attrs.taToolbarActiveButtonClass);
16288                    if(attrs.taFocussedClass)				_toolbar.attr('ta-focussed-class', attrs.taFocussedClass);
16289
16290                    element.prepend(_toolbar);
16291                    $compile(_toolbar)(scope.$parent);
16292                    _editorFunctions = textAngularManager.registerEditor(scope._name, scope, ['textAngularToolbar' + _serial]);
16293                }
16294
16295                scope.$on('$destroy', function(){
16296                    textAngularManager.unregisterEditor(scope._name);
16297                    angular.element(window).off('blur');
16298                    angular.element(window).off('resize', scope.handlePopoverEvents);
16299                    angular.element(window).off('scroll', scope.handlePopoverEvents);
16300                });
16301
16302                // catch element select event and pass to toolbar tools
16303                scope.$on('ta-element-select', function(event, element){
16304                    if(_editorFunctions.triggerElementSelect(event, element)){
16305                        scope['reApplyOnSelectorHandlerstaTextElement' + _serial]();
16306                    }
16307                });
16308
16309/******************* no working fully
16310                var distanceFromPoint = function (px, py, x, y) {
16311                    return Math.sqrt((px-x)*(px-x)+(py-y)*(py-y));
16312                };
16313                // because each object is a rectangle and we have a single point,
16314                // we need to give priority if the point is inside the rectangle
16315                var getPositionDistance = function(el, x, y) {
16316                    var range = document.createRange();
16317                    range.selectNode(el);
16318                    var rect = range.getBoundingClientRect();
16319                    console.log(el, rect);
16320                    range.detach();
16321                    var bcr = rect;
16322                    // top left
16323                    var d1 = distanceFromPoint(bcr.left, bcr.top, x, y);
16324                    // bottom left
16325                    var d2 = distanceFromPoint(bcr.left, bcr.bottom, x, y);
16326                    // top right
16327                    var d3 = distanceFromPoint(bcr.right, bcr.top, x, y);
16328                    // bottom right
16329                    var d4 = distanceFromPoint(bcr.right, bcr.bottom, x, y);
16330                    return Math.min(d1, d2, d3, d4);
16331                };
16332                var findClosest = function(el, minElement, maxDistance, x, y) {
16333                    var _d=0;
16334                    for (var i = 0; i < el.childNodes.length; i++) {
16335                        var _n = el.childNodes[i];
16336                        if (!_n.childNodes.length) {
16337                            _d = getPositionDistance(_n, x, y);
16338                            //console.log(_n, _n.childNodes, _d);
16339                            if (_d < maxDistance) {
16340                                maxDistance = _d;
16341                                minElement = _n;
16342                            }
16343                        }
16344                        var res = findClosest(_n, minElement, maxDistance, x, y);
16345                        if (res.max < maxDistance) {
16346                            maxDistance = res.max;
16347                            minElement = res.min;
16348                        }
16349                    }
16350                    return { max: maxDistance, min: minElement };
16351                };
16352                var getClosestElement = function (el, x, y) {
16353                    return findClosest(el, null, 12341234124, x, y);
16354                };
16355****************/
16356
16357                scope.$on('ta-drop-event', function(event, element, dropEvent, dataTransfer){
16358                    if(dataTransfer && dataTransfer.files && dataTransfer.files.length > 0){
16359                        scope.displayElements.text[0].focus();
16360                        // we must set the location of the drop!
16361                        //console.log(dropEvent.clientX, dropEvent.clientY, dropEvent.target);
16362                        taSelection.setSelectionToElementEnd(dropEvent.target);
16363                        angular.forEach(dataTransfer.files, function(file){
16364                            // taking advantage of boolean execution, if the fileDropHandler returns true, nothing else after it is executed
16365                            // If it is false then execute the defaultFileDropHandler if the fileDropHandler is NOT the default one
16366                            // Once one of these has been executed wrap the result as a promise, if undefined or variable update the taBind, else we should wait for the promise
16367                            try{
16368                                $q.when(scope.fileDropHandler(file, scope.wrapSelection) ||
16369                                    (scope.fileDropHandler !== scope.defaultFileDropHandler &&
16370                                    $q.when(scope.defaultFileDropHandler(file, scope.wrapSelection)))).then(function(){
16371                                        scope['updateTaBindtaTextElement' + _serial]();
16372                                    });
16373                            }catch(error){
16374                                $log.error(error);
16375                            }
16376                        });
16377                        dropEvent.preventDefault();
16378                        dropEvent.stopPropagation();
16379                    /* istanbul ignore else, the updates if moved text */
16380                    }else{
16381                        $timeout(function(){
16382                            scope['updateTaBindtaTextElement' + _serial]();
16383                        }, 0);
16384                    }
16385                });
16386
16387                // the following is for applying the active states to the tools that support it
16388                scope._bUpdateSelectedStyles = false;
16389                /* istanbul ignore next: browser window/tab leave check */
16390                angular.element(window).on('blur', function(){
16391                    scope._bUpdateSelectedStyles = false;
16392                    scope.focussed = false;
16393                });
16394                // loop through all the tools polling their activeState function if it exists
16395                scope.updateSelectedStyles = function(){
16396                    var _selection;
16397                    /* istanbul ignore next: This check is to ensure multiple timeouts don't exist */
16398                    if(_updateSelectedStylesTimeout) $timeout.cancel(_updateSelectedStylesTimeout);
16399                    // test if the common element ISN'T the root ta-text node
16400                    if((_selection = taSelection.getSelectionElement()) !== undefined && _selection.parentNode !== scope.displayElements.text[0]){
16401                        _editorFunctions.updateSelectedStyles(angular.element(_selection));
16402                    }else _editorFunctions.updateSelectedStyles();
16403                    // used to update the active state when a key is held down, ie the left arrow
16404                    /* istanbul ignore else: browser only check */
16405                    if(scope._bUpdateSelectedStyles) _updateSelectedStylesTimeout = $timeout(scope.updateSelectedStyles, 200);
16406                };
16407                // start updating on keydown
16408                _keydown = function(){
16409                    /* istanbul ignore next: ie catch */
16410                    if(!scope.focussed){
16411                        scope._bUpdateSelectedStyles = false;
16412                        return;
16413                    }
16414                    /* istanbul ignore else: don't run if already running */
16415                    if(!scope._bUpdateSelectedStyles){
16416                        scope._bUpdateSelectedStyles = true;
16417                        scope.$apply(function(){
16418                            scope.updateSelectedStyles();
16419                        });
16420                    }
16421                };
16422                scope.displayElements.html.on('keydown', _keydown);
16423                scope.displayElements.text.on('keydown', _keydown);
16424                // stop updating on key up and update the display/model
16425                _keyup = function(){
16426                    scope._bUpdateSelectedStyles = false;
16427                };
16428                scope.displayElements.html.on('keyup', _keyup);
16429                scope.displayElements.text.on('keyup', _keyup);
16430                // stop updating on key up and update the display/model
16431                _keypress = function(event, eventData){
16432                    // bug fix for Firefox.  If we are selecting a <a> already, any characters will
16433                    // be added within the <a> which is bad!
16434                    /* istanbul ignore next: don't see how to test this... */
16435                    if (taSelection.getSelection) {
16436                        var _selection = taSelection.getSelection();
16437                        // in a weird case (can't reproduce) taSelection.getSelectionElement() can be undefined!!
16438                        // this comes from range.commonAncestorContainer;
16439                        // so I check for this here which fixes the error case
16440                        if (taSelection.getSelectionElement() && taSelection.getSelectionElement().nodeName.toLowerCase() === 'a') {
16441                            // check and see if we are at the edge of the <a>
16442                            if (_selection.start.element.nodeType === 3 &&
16443                                _selection.start.element.textContent.length === _selection.end.offset) {
16444                                // we are at the end of the <a>!!!
16445                                // so move the selection to after the <a>!!
16446                                taSelection.setSelectionAfterElement(taSelection.getSelectionElement());
16447                            }
16448                            if (_selection.start.element.nodeType === 3 &&
16449                                _selection.start.offset === 0) {
16450                                // we are at the start of the <a>!!!
16451                                // so move the selection before the <a>!!
16452                                taSelection.setSelectionBeforeElement(taSelection.getSelectionElement());
16453                            }
16454                        }
16455                    }
16456                    /* istanbul ignore else: this is for catching the jqLite testing*/
16457                    if(eventData) angular.extend(event, eventData);
16458                    scope.$apply(function(){
16459                        if(_editorFunctions.sendKeyCommand(event)){
16460                            /* istanbul ignore else: don't run if already running */
16461                            if(!scope._bUpdateSelectedStyles){
16462                                scope.updateSelectedStyles();
16463                            }
16464                            event.preventDefault();
16465                            return false;
16466                        }
16467                    });
16468                };
16469                scope.displayElements.html.on('keypress', _keypress);
16470                scope.displayElements.text.on('keypress', _keypress);
16471                // update the toolbar active states when we click somewhere in the text/html boxed
16472                _mouseup = function(){
16473                    // ensure only one execution of updateSelectedStyles()
16474                    scope._bUpdateSelectedStyles = false;
16475                    // for some reason, unless we do a $timeout here, after a _mouseup when the line is
16476                    // highlighted, and instead use a scope.$apply(function(){ scope.updateSelectedStyles(); });
16477                    // doesn't work properly, so we replaced this with:
16478                    /* istanbul ignore next: not tested  */
16479                    $timeout(function() { scope.updateSelectedStyles(); }, 0);
16480                };
16481                scope.displayElements.html.on('mouseup', _mouseup);
16482                scope.displayElements.text.on('mouseup', _mouseup);
16483            }
16484        };
16485    }
16486]);
16487textAngular.service('textAngularManager', ['taToolExecuteAction', 'taTools', 'taRegisterTool', '$interval', '$rootScope', '$log',
16488    function(taToolExecuteAction, taTools, taRegisterTool, $interval, $rootScope, $log){
16489    // this service is used to manage all textAngular editors and toolbars.
16490    // All publicly published functions that modify/need to access the toolbar or editor scopes should be in here
16491    // these contain references to all the editors and toolbars that have been initialised in this app
16492    var toolbars = {}, editors = {};
16493    // we touch the time any change occurs through register of an editor or tool so that we
16494    // in the future will fire and event to trigger an updateSelection
16495    var timeRecentModification = 0;
16496    var updateStyles = function(selectedElement){
16497        angular.forEach(editors, function(editor) {
16498            editor.editorFunctions.updateSelectedStyles(selectedElement);
16499        });
16500    };
16501    var triggerInterval = 50;
16502    var triggerIntervalTimer;
16503    var setupTriggerUpdateStyles = function() {
16504        timeRecentModification = Date.now();
16505        /* istanbul ignore next: setup a one time updateStyles() */
16506        triggerIntervalTimer = $interval(function() {
16507            updateStyles();
16508            triggerIntervalTimer = undefined;
16509        }, triggerInterval, 1); // only trigger once
16510    };
16511    /* istanbul ignore next: make sure clean up on destroy */
16512    $rootScope.$on('destroy', function() {
16513        if (triggerIntervalTimer) {
16514            $interval.cancel(triggerIntervalTimer);
16515            triggerIntervalTimer = undefined;
16516        }
16517    });
16518    var touchModification = function() {
16519        if (Math.abs(Date.now() - timeRecentModification) > triggerInterval) {
16520            // we have already triggered the updateStyles a long time back... so setup it again...
16521            setupTriggerUpdateStyles();
16522        }
16523    };
16524    // when we focus into a toolbar, we need to set the TOOLBAR's $parent to be the toolbars it's linked to.
16525    // We also need to set the tools to be updated to be the toolbars...
16526    return {
16527        // register an editor and the toolbars that it is affected by
16528        registerEditor: function(editorName, editorScope, targetToolbars){
16529            // NOTE: name === editorScope._name
16530            // targetToolbars is an [] of 'toolbar name's
16531            // targetToolbars are optional, we don't require a toolbar to function
16532            if(!editorName || editorName === '') throw('textAngular Error: An editor requires a name');
16533            if(!editorScope) throw('textAngular Error: An editor requires a scope');
16534            if(editors[editorName]) throw('textAngular Error: An Editor with name "' + editorName + '" already exists');
16535            editors[editorName] = {
16536                scope: editorScope,
16537                toolbars: targetToolbars,
16538                // toolbarScopes used by this editor
16539                toolbarScopes: [],
16540                _registerToolbarScope: function(toolbarScope){
16541                    // add to the list late
16542                    if(this.toolbars.indexOf(toolbarScope.name) >= 0) {
16543                        // if this toolbarScope is being used by this editor we add it as one of the scopes
16544                        this.toolbarScopes.push(toolbarScope);
16545                    }
16546                },
16547                // this is a suite of functions the editor should use to update all it's linked toolbars
16548                editorFunctions: {
16549                    disable: function(){
16550                        // disable all linked toolbars
16551                        angular.forEach(editors[editorName].toolbarScopes, function(toolbarScope){
16552                            toolbarScope.disabled = true;
16553                        });
16554                    },
16555                    enable: function(){
16556                        // enable all linked toolbars
16557                        angular.forEach(editors[editorName].toolbarScopes, function(toolbarScope){
16558                            toolbarScope.disabled = false;
16559                        });
16560                    },
16561                    focus: function(){
16562                        // this should be called when the editor is focussed
16563                        angular.forEach(editors[editorName].toolbarScopes, function(toolbarScope){
16564                            toolbarScope._parent = editorScope;
16565                            toolbarScope.disabled = false;
16566                            toolbarScope.focussed = true;
16567                        });
16568                        editorScope.focussed = true;
16569                    },
16570                    unfocus: function(){
16571                        // this should be called when the editor becomes unfocussed
16572                        angular.forEach(editors[editorName].toolbarScopes, function(toolbarScope){
16573                            toolbarScope.disabled = true;
16574                            toolbarScope.focussed = false;
16575                        });
16576                        editorScope.focussed = false;
16577                    },
16578                    updateSelectedStyles: function(selectedElement){
16579                        // update the active state of all buttons on liked toolbars
16580                        angular.forEach(editors[editorName].toolbarScopes, function(toolbarScope){
16581                            angular.forEach(toolbarScope.tools, function(toolScope){
16582                                if(toolScope.activeState){
16583                                    toolbarScope._parent = editorScope;
16584                                    // selectedElement may be undefined if nothing selected
16585                                    toolScope.active = toolScope.activeState(selectedElement);
16586                                }
16587                            });
16588                        });
16589                    },
16590                    sendKeyCommand: function(event){
16591                        // we return true if we applied an action, false otherwise
16592                        var result = false;
16593                        if(event.ctrlKey || event.metaKey || event.specialKey) angular.forEach(taTools, function(tool, name){
16594                            if(tool.commandKeyCode && (tool.commandKeyCode === event.which || tool.commandKeyCode === event.specialKey)){
16595                                for(var _t = 0; _t < editors[editorName].toolbarScopes.length; _t++){
16596                                    if(editors[editorName].toolbarScopes[_t].tools[name] !== undefined){
16597                                        taToolExecuteAction.call(editors[editorName].toolbarScopes[_t].tools[name], editorScope);
16598                                        result = true;
16599                                        break;
16600                                    }
16601                                }
16602                            }
16603                        });
16604                        return result;
16605                    },
16606                    triggerElementSelect: function(event, element){
16607                        // search through the taTools to see if a match for the tag is made.
16608                        // if there is, see if the tool is on a registered toolbar and not disabled.
16609                        // NOTE: This can trigger on MULTIPLE tools simultaneously.
16610                        var elementHasAttrs = function(_element, attrs){
16611                            var result = true;
16612                            for(var i = 0; i < attrs.length; i++) result = result && _element.attr(attrs[i]);
16613                            return result;
16614                        };
16615                        var workerTools = [];
16616                        var unfilteredTools = {};
16617                        var result = false;
16618                        element = angular.element(element);
16619                        // get all valid tools by element name, keep track if one matches the
16620                        var onlyWithAttrsFilter = false;
16621                        angular.forEach(taTools, function(tool, name){
16622                            if(
16623                                tool.onElementSelect &&
16624                                tool.onElementSelect.element &&
16625                                tool.onElementSelect.element.toLowerCase() === element[0].tagName.toLowerCase() &&
16626                                (!tool.onElementSelect.filter || tool.onElementSelect.filter(element))
16627                            ){
16628                                // this should only end up true if the element matches the only attributes
16629                                onlyWithAttrsFilter = onlyWithAttrsFilter ||
16630                                    (angular.isArray(tool.onElementSelect.onlyWithAttrs) && elementHasAttrs(element, tool.onElementSelect.onlyWithAttrs));
16631                                if(!tool.onElementSelect.onlyWithAttrs || elementHasAttrs(element, tool.onElementSelect.onlyWithAttrs)) unfilteredTools[name] = tool;
16632                            }
16633                        });
16634                        // if we matched attributes to filter on, then filter, else continue
16635                        if(onlyWithAttrsFilter){
16636                            angular.forEach(unfilteredTools, function(tool, name){
16637                                if(tool.onElementSelect.onlyWithAttrs && elementHasAttrs(element, tool.onElementSelect.onlyWithAttrs)) workerTools.push({'name': name, 'tool': tool});
16638                            });
16639                            // sort most specific (most attrs to find) first
16640                            workerTools.sort(function(a,b){
16641                                return b.tool.onElementSelect.onlyWithAttrs.length - a.tool.onElementSelect.onlyWithAttrs.length;
16642                            });
16643                        }else{
16644                            angular.forEach(unfilteredTools, function(tool, name){
16645                                workerTools.push({'name': name, 'tool': tool});
16646                            });
16647                        }
16648                        // Run the actions on the first visible filtered tool only
16649                        if(workerTools.length > 0){
16650                            for(var _i = 0; _i < workerTools.length; _i++){
16651                                var tool = workerTools[_i].tool;
16652                                var name = workerTools[_i].name;
16653                                for(var _t = 0; _t < editors[editorName].toolbarScopes.length; _t++){
16654                                    if(editors[editorName].toolbarScopes[_t].tools[name] !== undefined){
16655                                        tool.onElementSelect.action.call(editors[editorName].toolbarScopes[_t].tools[name], event, element, editorScope);
16656                                        result = true;
16657                                        break;
16658                                    }
16659                                }
16660                                if(result) break;
16661                            }
16662                        }
16663                        return result;
16664                    }
16665                }
16666            };
16667            angular.forEach(targetToolbars, function(_name){
16668                if(toolbars[_name]) {
16669                    editors[editorName].toolbarScopes.push(toolbars[_name]);
16670                }
16671                // if it doesn't exist it may not have been compiled yet and it will be added later
16672            });
16673            touchModification();
16674            return editors[editorName].editorFunctions;
16675        },
16676        // retrieve editor by name, largely used by testing suites only
16677        retrieveEditor: function(name){
16678            return editors[name];
16679        },
16680        unregisterEditor: function(name){
16681            delete editors[name];
16682            touchModification();
16683        },
16684        // registers a toolbar such that it can be linked to editors
16685        registerToolbar: function(toolbarScope){
16686            if(!toolbarScope) throw('textAngular Error: A toolbar requires a scope');
16687            if(!toolbarScope.name || toolbarScope.name === '') throw('textAngular Error: A toolbar requires a name');
16688            if(toolbars[toolbarScope.name]) throw('textAngular Error: A toolbar with name "' + toolbarScope.name + '" already exists');
16689            toolbars[toolbarScope.name] = toolbarScope;
16690            // walk all the editors and connect this toolbarScope to the editors.... if we need to.  This way, it does
16691            // not matter if we register the editors after the toolbars or not
16692            // Note the editor will ignore this toolbarScope if it is not connected to it...
16693            angular.forEach(editors, function(_editor){
16694                _editor._registerToolbarScope(toolbarScope);
16695            });
16696            touchModification();
16697        },
16698        // retrieve toolbar by name, largely used by testing suites only
16699        retrieveToolbar: function(name){
16700            return toolbars[name];
16701        },
16702        // retrieve toolbars by editor name, largely used by testing suites only
16703        retrieveToolbarsViaEditor: function(name){
16704            var result = [], _this = this;
16705            angular.forEach(this.retrieveEditor(name).toolbars, function(name){
16706                result.push(_this.retrieveToolbar(name));
16707            });
16708            return result;
16709        },
16710        unregisterToolbar: function(name){
16711            delete toolbars[name];
16712            touchModification();
16713        },
16714        // functions for updating the toolbar buttons display
16715        updateToolsDisplay: function(newTaTools){
16716            // pass a partial struct of the taTools, this allows us to update the tools on the fly, will not change the defaults.
16717            var _this = this;
16718            angular.forEach(newTaTools, function(_newTool, key){
16719                _this.updateToolDisplay(key, _newTool);
16720            });
16721        },
16722        // this function resets all toolbars to their default tool definitions
16723        resetToolsDisplay: function(){
16724            var _this = this;
16725            angular.forEach(taTools, function(_newTool, key){
16726                _this.resetToolDisplay(key);
16727            });
16728            touchModification();
16729        },
16730        // update a tool on all toolbars
16731        updateToolDisplay: function(toolKey, _newTool){
16732            var _this = this;
16733            angular.forEach(toolbars, function(toolbarScope, toolbarKey){
16734                _this.updateToolbarToolDisplay(toolbarKey, toolKey, _newTool);
16735            });
16736            touchModification();
16737        },
16738        // resets a tool to the default/starting state on all toolbars
16739        resetToolDisplay: function(toolKey){
16740            var _this = this;
16741            angular.forEach(toolbars, function(toolbarScope, toolbarKey){
16742                _this.resetToolbarToolDisplay(toolbarKey, toolKey);
16743            });
16744            touchModification();
16745        },
16746        // update a tool on a specific toolbar
16747        updateToolbarToolDisplay: function(toolbarKey, toolKey, _newTool){
16748            if(toolbars[toolbarKey]) toolbars[toolbarKey].updateToolDisplay(toolKey, _newTool);
16749            else throw('textAngular Error: No Toolbar with name "' + toolbarKey + '" exists');
16750        },
16751        // reset a tool on a specific toolbar to it's default starting value
16752        resetToolbarToolDisplay: function(toolbarKey, toolKey){
16753            if(toolbars[toolbarKey]) toolbars[toolbarKey].updateToolDisplay(toolKey, taTools[toolKey], true);
16754            else throw('textAngular Error: No Toolbar with name "' + toolbarKey + '" exists');
16755        },
16756        // removes a tool from all toolbars and it's definition
16757        removeTool: function(toolKey){
16758            delete taTools[toolKey];
16759            angular.forEach(toolbars, function(toolbarScope){
16760                delete toolbarScope.tools[toolKey];
16761                for(var i = 0; i < toolbarScope.toolbar.length; i++){
16762                    var toolbarIndex;
16763                    for(var j = 0; j < toolbarScope.toolbar[i].length; j++){
16764                        if(toolbarScope.toolbar[i][j] === toolKey){
16765                            toolbarIndex = {
16766                                group: i,
16767                                index: j
16768                            };
16769                            break;
16770                        }
16771                        if(toolbarIndex !== undefined) break;
16772                    }
16773                    if(toolbarIndex !== undefined){
16774                        toolbarScope.toolbar[toolbarIndex.group].slice(toolbarIndex.index, 1);
16775                        toolbarScope._$element.children().eq(toolbarIndex.group).children().eq(toolbarIndex.index).remove();
16776                    }
16777                }
16778            });
16779            touchModification();
16780        },
16781        // toolkey, toolDefinition are required. If group is not specified will pick the last group, if index isnt defined will append to group
16782        addTool: function(toolKey, toolDefinition, group, index){
16783            taRegisterTool(toolKey, toolDefinition);
16784            angular.forEach(toolbars, function(toolbarScope){
16785                toolbarScope.addTool(toolKey, toolDefinition, group, index);
16786            });
16787            touchModification();
16788        },
16789        // adds a Tool but only to one toolbar not all
16790        addToolToToolbar: function(toolKey, toolDefinition, toolbarKey, group, index){
16791            taRegisterTool(toolKey, toolDefinition);
16792            toolbars[toolbarKey].addTool(toolKey, toolDefinition, group, index);
16793            touchModification();
16794        },
16795        // this is used when externally the html of an editor has been changed and textAngular needs to be notified to update the model.
16796        // this will call a $digest if not already happening
16797        refreshEditor: function(name){
16798            if(editors[name]){
16799                editors[name].scope.updateTaBindtaTextElement();
16800                /* istanbul ignore else: phase catch */
16801                if(!editors[name].scope.$$phase) editors[name].scope.$digest();
16802            }else throw('textAngular Error: No Editor with name "' + name + '" exists');
16803            touchModification();
16804        },
16805        // this is used by taBind to send a key command in response to a special key event
16806        sendKeyCommand: function(scope, event){
16807            var _editor = editors[scope._name];
16808            /* istanbul ignore else: if nothing to do, do nothing */
16809            if (_editor && _editor.editorFunctions.sendKeyCommand(event)) {
16810                /* istanbul ignore else: don't run if already running */
16811                if(!scope._bUpdateSelectedStyles){
16812                    scope.updateSelectedStyles();
16813                }
16814                event.preventDefault();
16815                return false;
16816            }
16817        },
16818        //
16819        // When a toolbar and tools are created, it isn't until there is a key event or mouse event
16820        // that the updateSelectedStyles() is called behind the scenes.
16821        // This function forces an update through the existing editors to help the application make sure
16822        // the inital state is correct.
16823        //
16824        updateStyles: updateStyles,
16825        // return the current version of textAngular in use to the user
16826        getVersion: function () { return textAngularVersion; },
16827        // for testing
16828        getToolbarScopes: function () {
16829            var tmp=[];
16830            angular.forEach(editors, function (_editor) {
16831                tmp = tmp.concat(_editor.toolbarScopes);
16832            });
16833            return tmp;
16834        }
16835/********************** not functional yet
16836        // save the selection ('range') for the given editor
16837        saveFocusSelection: function (name, range) {
16838            editors[name].savedFocusRange = range;
16839        },
16840        // restore the saved selection from when the focus was lost
16841        restoreFocusSelection: function(name, scope) {
16842            // we only do this if NOT focussed and saved...
16843            if (editors[name].savedFocusRange && !scope.focussed) {
16844                try {
16845                    var _r = rangy.restoreRange(editors[name].savedFocusRange);
16846                    var _sel = rangy.getSelection();
16847                    _sel.addRange(_r);
16848                } catch(e) {}
16849            }
16850        }
16851*************/
16852    };
16853}]);
16854textAngular.directive('textAngularToolbar', [
16855    '$compile', 'textAngularManager', 'taOptions', 'taTools', 'taToolExecuteAction', '$window',
16856    function($compile, textAngularManager, taOptions, taTools, taToolExecuteAction, $window){
16857        return {
16858            scope: {
16859                name: '@' // a name IS required
16860            },
16861            restrict: "EA",
16862            link: function(scope, element, attrs){
16863                if(!scope.name || scope.name === '') throw('textAngular Error: A toolbar requires a name');
16864                angular.extend(scope, angular.copy(taOptions));
16865                if(attrs.taToolbar)						scope.toolbar = scope.$parent.$eval(attrs.taToolbar);
16866                if(attrs.taToolbarClass)				scope.classes.toolbar = attrs.taToolbarClass;
16867                if(attrs.taToolbarGroupClass)			scope.classes.toolbarGroup = attrs.taToolbarGroupClass;
16868                if(attrs.taToolbarButtonClass)			scope.classes.toolbarButton = attrs.taToolbarButtonClass;
16869                if(attrs.taToolbarActiveButtonClass)	scope.classes.toolbarButtonActive = attrs.taToolbarActiveButtonClass;
16870                if(attrs.taFocussedClass)				scope.classes.focussed = attrs.taFocussedClass;
16871
16872                scope.disabled = true;
16873                scope.focussed = false;
16874                scope._$element = element;
16875                element[0].innerHTML = '';
16876                element.addClass("ta-toolbar " + scope.classes.toolbar);
16877
16878                scope.$watch('focussed', function(){
16879                    if(scope.focussed) element.addClass(scope.classes.focussed);
16880                    else element.removeClass(scope.classes.focussed);
16881                });
16882
16883                var setupToolElement = function(toolDefinition, toolScope){
16884                    var toolElement;
16885                    if(toolDefinition && toolDefinition.display){
16886                        toolElement = angular.element(toolDefinition.display);
16887                    }
16888                    else toolElement = angular.element("<button type='button'>");
16889
16890                    if(toolDefinition && toolDefinition["class"]) toolElement.addClass(toolDefinition["class"]);
16891                    else toolElement.addClass(scope.classes.toolbarButton);
16892
16893                    toolElement.attr('name', toolScope.name);
16894                    // important to not take focus from the main text/html entry
16895                    toolElement.attr('ta-button', 'ta-button');
16896                    toolElement.attr('ng-disabled', 'isDisabled()');
16897                    toolElement.attr('tabindex', '-1');
16898                    toolElement.attr('ng-click', 'executeAction()');
16899                    toolElement.attr('ng-class', 'displayActiveToolClass(active)');
16900
16901                    if (toolDefinition && toolDefinition.tooltiptext) {
16902                        toolElement.attr('title', toolDefinition.tooltiptext);
16903                    }
16904                    if(toolDefinition && !toolDefinition.display && !toolScope._display){
16905                        // first clear out the current contents if any
16906                        toolElement[0].innerHTML = '';
16907                        // add the buttonText
16908                        if(toolDefinition.buttontext) toolElement[0].innerHTML = toolDefinition.buttontext;
16909                        // add the icon to the front of the button if there is content
16910                        if(toolDefinition.iconclass){
16911                            var icon = angular.element('<i>'), content = toolElement[0].innerHTML;
16912                            icon.addClass(toolDefinition.iconclass);
16913                            toolElement[0].innerHTML = '';
16914                            toolElement.append(icon);
16915                            if(content && content !== '') toolElement.append('&nbsp;' + content);
16916                        }
16917                    }
16918
16919                    toolScope._lastToolDefinition = angular.copy(toolDefinition);
16920
16921                    return $compile(toolElement)(toolScope);
16922                };
16923
16924                // Keep a reference for updating the active states later
16925                scope.tools = {};
16926                // create the tools in the toolbar
16927                // default functions and values to prevent errors in testing and on init
16928                scope._parent = {
16929                    disabled: true,
16930                    showHtml: false,
16931                    queryFormatBlockState: function(){ return false; },
16932                    queryCommandState: function(){ return false; }
16933                };
16934                var defaultChildScope = {
16935                    $window: $window,
16936                    $editor: function(){
16937                        // dynamically gets the editor as it is set
16938                        return scope._parent;
16939                    },
16940                    isDisabled: function(){
16941                        // view selection button is always enabled since it doesn not depend on a 
16941selction!
16942                        if (this.name === 'html' && scope._parent.startAction) {
16943                            return false;
16944                        }
16945                        // to set your own disabled logic set a function or boolean on the tool called 'disabled'
16946                        return ( // this bracket is important as without it it just returns the first bracket and ignores the rest
16947                            // when the button's disabled function/value evaluates to true
16948                            (typeof this.$eval('disabled') !== 'function' && this.$eval('disabled')) || this.$eval('disabled()') ||
16949                            // all buttons except the HTML Switch button should be disabled in the showHtml (RAW html) mode
16950                            (this.name !== 'html' && this.$editor().showHtml) ||
16951                            // if the toolbar is disabled
16952                            this.$parent.disabled ||
16953                            // if the current editor is disabled
16954                            this.$editor().disabled
16955                        );
16956                    },
16957                    displayActiveToolClass: function(active){
16958                        return (active)? scope.classes.toolbarButtonActive : '';
16959                    },
16960                    executeAction: taToolExecuteAction
16961                };
16962
16963                angular.forEach(scope.toolbar, function(group){
16964                    // setup the toolbar group
16965                    var groupElement = angular.element("<div>");
16966                    groupElement.addClass(scope.classes.toolbarGroup);
16967                    angular.forEach(group, function(tool){
16968                        // init and add the tools to the group
16969                        // a tool name (key name from taTools struct)
16970                        //creates a child scope of the main angularText scope and then extends the childScope with the functions of this particular tool
16971                        // reference to the scope and element kept
16972                        scope.tools[tool] = angular.extend(scope.$new(true), taTools[tool], defaultChildScope, {name: tool});
16973                        scope.tools[tool].$element = setupToolElement(taTools[tool], scope.tools[tool]);
16974                        // append the tool compiled with the childScope to the group element
16975                        groupElement.append(scope.tools[tool].$element);
16976                    });
16977                    // append the group to the toolbar
16978                    element.append(groupElement);
16979                });
16980
16981                // update a tool
16982                // if a value is set to null, remove from the display
16983                // when forceNew is set to true it will ignore all previous settings, used to reset to taTools definition
16984                // to reset to defaults pass in taTools[key] as _newTool and forceNew as true, ie `updateToolDisplay(key, taTools[key], true);`
16985                scope.updateToolDisplay = function(key, _newTool, forceNew){
16986                    var toolInstance = scope.tools[key];
16987                    if(toolInstance){
16988                        // get the last toolDefinition, then override with the new definition
16989                        if(toolInstance._lastToolDefinition && !forceNew) _newTool = angular.extend({}, toolInstance._lastToolDefinition, _newTool);
16990                        if(_newTool.buttontext === null && _newTool.iconclass === null && _newTool.display === null)
16991                            throw('textAngular Error: Tool Definition for updating "' + key + '" does not have a valid display/iconclass/buttontext value');
16992
16993                        // if tool is defined on this toolbar, update/redo the tool
16994                        if(_newTool.buttontext === null){
16995                            delete _newTool.buttontext;
16996                        }
16997                        if(_newTool.iconclass === null){
16998                            delete _newTool.iconclass;
16999                        }
17000                        if(_newTool.display === null){
17001                            delete _newTool.display;
17002                        }
17003
17004                        var toolElement = setupToolElement(_newTool, toolInstance);
17005                        toolInstance.$element.replaceWith(toolElement);
17006                        toolInstance.$element = toolElement;
17007                    }
17008                };
17009
17010                // we assume here that all values passed are valid and correct
17011                scope.addTool = function(key, _newTool, groupIndex, index){
17012                    scope.tools[key] = angular.extend(scope.$new(true), taTools[key], defaultChildScope, {name: key});
17013                    scope.tools[key].$element = setupToolElement(taTools[key], scope.tools[key]);
17014                    var group;
17015                    if(groupIndex === undefined) groupIndex = scope.toolbar.length - 1;
17016                    group = angular.element(element.children()[groupIndex]);
17017
17018                    if(index === undefined){
17019                        group.append(scope.tools[key].$element);
17020                        scope.toolbar[groupIndex][scope.toolbar[groupIndex].length - 1] = key;
17021                    }else{
17022                        group.children().eq(index).after(scope.tools[key].$element);
17023                        scope.toolbar[groupIndex][index] = key;
17024                    }
17025                };
17026
17027                textAngularManager.registerToolbar(scope);
17028
17029                scope.$on('$destroy', function(){
17030                    textAngularManager.unregisterToolbar(scope.name);
17031                });
17032            }
17033        };
17034    }
17035]);
17036textAngular.directive('textAngularVersion', ['textAngularManager',
17037    function(textAngularManager) {
17038        var version = textAngularManager.getVersion();
17039        return {
17040            restrict: "EA",
17041            link: function (scope, element, attrs) {
17042                element.html(version);
17043            }
17044        };
17045    }
17046]);
17047
17048return textAngular.name;
17049
17050}));
17051;
17052"use strict";
17053/*
17054@license textAngular
17055Author : Austin Anderson
17056License : 2013 MIT
17057Version 1.5.16
17058See README.md or https://github.com/fraywing/textAngular/wiki for requirements and use.
17059*/
17060function stripHtmlToText(n){var t=document.createElement("DIV"),i;return t.innerHTML=n,i=t.textContent||t.innerText||"",i.replace("​",""),i.trim()}function getDomFromHtml(n){var t=document.createElement("DIV");return t.innerHTML=n,t}var textAngularVersion="v1.5.16",_browserDetect={ie:function(){for(var i,n=3,t=document.createElement("div"),r=t.getElementsByTagName("i");t.innerHTML="<!--[if gt IE "+ ++n+"]><i><\/i><![endif]-->",r[0];);return n>4?n:i}
17060(),webkit:/AppleWebKit\/([\d.]+)/i.test(navigator.userAgent),isFirefox:navigator.userAgent.toLowerCase().indexOf("firefox")>-1},performance=performance||{},sheet,addCSSRule,removeCSSRule,_addCSSRule,_removeCSSRule,_getRuleIndex,_sheets,i,dropFired,textAngular;performance.now=function(){return performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow||function(){return(new Date).getTime()}}();var BLOCKELEMENTS=/^(address|article|aside|audio|blockquote|canvas|center|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/i,LISTELEMENTS=/^(ul|li|ol)$/i,VALIDELEMENTS=/^(#text|span|address|article|aside|audio|blockquote|canvas|center|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/i;if(String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),_browserDetect.ie>8||_browserDetect.ie===undefined){for(_sheets=document.styleSheets,i=0;i<_sheets.length;i++)if((_sheets[i].media.length===0||_sheets[i].media.mediaText.match(/(all|screen)/ig))&&_sheets[i].href&&_sheets[i].href.match(/textangular\.(min\.|)css/ig)){sheet=_sheets[i];break}sheet||(sheet=function(){var n=document.createElement("style");return _browserDetect.webkit&&n.appendChild(document.createTextNode("")),document.getElementsByTagName("head")[0].appendChild(n),n.sheet}());addCSSRule=function(n,t){return _addCSSRule(sheet,n,t)};_addCSSRule=function(n,t,i){var r,u;return n.cssRules?r=Math.max(n.cssRules.length-1,0):n.rules&&(r=Math.max(n.rules.length-1,0)),n.insertRule?n.insertRule(t+"{"+i+"}",r):n.addRule(t,i,r),sheet.rules?u=sheet.rules[r]:sheet.cssRules&&(u=sheet.cssRules[r]),u};_getRuleIndex=function(n,t){for(var r,i=0;i<t.length;i++)if(t[i].cssText===n.cssText){r=i;break}return r};removeCSSRule=function(n){_removeCSSRule(sheet,n)};_removeCSSRule=function(n,t){var i=n.cssRules||n.rules,r;i&&i.length!==0&&(r=_getRuleIndex(t,i),n.removeRule?n.removeRule(r):n.deleteRule(r))}}angular.module("textAngular.factories",[]).factory("taBrowserTag",[function(){return function(n){return n?n===""?_browserDetect.ie===undefined?"div":_browserDetect.ie<=8?"P":"p":_browserDetect.ie<=8?n.toUpperCase():n:_browserDetect.ie<=8?"P":"p"}}]).factory("taApplyCustomRenderers",["taCustomRenderers","taDOM",function(n,t){return function(i){var r=angular.element("<div><\/div>");return r[0].innerHTML=i,angular.forEach(n,function(n){var i=[];n.selector&&n.selector!==""?i=r.find(n.selector):n.customAttribute&&n.customAttribute!==""&&(i=t.getByAttribute(r,n.customAttribute));angular.forEach(i,function(t){t=angular.element(t);n.selector&&n.selector!==""&&n.customAttribute&&n.customAttribute!==""?t.attr(n.customAttribute)!==undefined&&n.renderLogic(t):n.renderLogic(t)})}),r[0].innerHTML}}]).factory("taFixChrome",function(){return function(n,t){if(!n||!angular.isString(n)||n.length<=0)return n;for(var o=/style\s?=\s?(["'])(?:(?=(\\?))\2.)*?\1/ig,s=/<span class="Apple-converted-space">([^<]+)<\/span>/ig,i,f,e,r="",u=0;i=s.exec(n);)e=i[1],e=e.replace(/&nbsp;/ig," "),r+=n.substring(u,i.index)+e,u=i.index+i[0].length;if(u&&(r+=n.substring(u),n=r,r="",u=0),!t){while(i=o.exec(n))r+=n.substring(u,i.index-1),f=i[0],i=/font-family: inherit;|line-height: 1.[0-9]{3,12};|color: inherit; line-height: 1.1;|color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);|background-color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);/gi.exec(f),i?(f=f.replace(/( |)font-family: inherit;|( |)line-height: 1.[0-9]{3,12};|( |)color: inherit;|( |)color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);|( |)background-color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);/ig,""),f.length>8&&(r+=" "+f)):r+=" "+f,u=o.lastIndex;r+=n.substring(u)}return u>0?r.replace(/<span\s?>(.*?)<\/span>(<br(\/|)>|)/ig,"$1"):n}}).factory("taSanitize",["$sanitize",function(n){function o(n,t){for(var i=0,r=0,u,f=/<[^>]*>/ig;u=f.exec(n);)if(r=u.index,u[0].substr(1,1)==="/")if(i===0)break;else i--;else i++;return t+n.substring(0,r)+angular.element(t)[0].outerHTML.substring(t.length)+n.substring(r)}function s(n){var y,p;if(!n||!angular.isString(n)||n.length<=0)return n;for(var u,w=/<([^>\/]+?)style=("([^"]+)"|'([^']+)')([^>]*)>/ig,i,v,r,l,e="",a,h="",c=0;i=w.exec(n);)if(r=i[3]||i[4],y=new RegExp(f,"i"),angular.isString(r)&&y.test(r)){for(l="",p=new RegExp(f,"ig");v=p.exec(r);)for(u=0;
17060u<t.length;u++)!v[u*2+2]||(l+="<"+t[u].tag+">");a=s(n.substring(c,i.index));h+=e.length>0?o(a,e):a;r=r.replace(new RegExp(f,"ig"),"");h+="<"+i[1].trim();r.length>0&&(h+=' style="'+r+'"');h+=i[5]+">";c=i.index+i[0].length;e=l}return h+(e.length>0?o(n.substring(c),e):n.substring(c))}function c(n){var i;if(!n||!angular.isString(n)||n.length<=0)return n;for(var f=/<([^>\/]+?)align=("([^"]+)"|'([^']+)')([^>]*)>/ig,t,r="",u=0;t=f.exec(n);)r+=n.substring(u,t.index),u=t.index+t[0].length,i="<"+t[1]+t[5],/style=("([^"]+)"|'([^']+)')/ig.test(i)?i=i.replace(/style=("([^"]+)"|'([^']+)')/i,'style="$2$3 text-align:'+(t[3]||t[4])+';"'):i+=' style="text-align:'+(t[3]||t[4])+';"',i+=">",r+=i;return r+n.substring(u)}for(var r,u,f,t=[{property:"font-weight",values:["bold"],tag:"b"},{property:"font-style",values:["italic"],tag:"i"}],e=[],i=0;i<t.length;i++){for(r="("+t[i].property+":\\s*(",u=0;u<t[i].values.length;u++)u>0&&(r+="|"),r+=t[i].values[u];r+=");)";e.push(r)}f="("+e.join("|")+")";var h=new RegExp(/<span id="selectionBoundary_\d+_\d+" class="rangySelectionBoundary">[^<>]+?<\/span>/ig),l=new RegExp(/<span class="rangySelectionBoundary" id="selectionBoundary_\d+_\d+">[^<>]+?<\/span>/ig),a=new RegExp(/<span id="selectionBoundary_\d+_\d+" class="rangySelectionBoundary">[^<>]+?<\/span>/ig);return function(t,i,r){var u;if(!r)try{t=s(t)}catch(w){}if(t=c(t),t)try{t=t.replace(h,"");t=t.replace(l,"");t=t.replace(h,"");t=t.replace(a,"")}catch(w){}try{u=n(t);r&&(u=t)}catch(w){u=i||""}var y=u.match(/(<pre[^>]*>.*?<\/pre[^>]*>)/ig),e=u.replace(/(&#(9|10);)*/ig,""),p=/<pre[^>]*>.*?<\/pre[^>]*>/ig,o=0,v=0,f;for(u="";(f=p.exec(e))!==null&&o<y.length;)u+=e.substring(v,f.index)+y[o],v=f.index+f[0].length,o++;return u+e.substring(v)}}]).factory("taToolExecuteAction",["$q","$log",function(n,t){return function(i){i!==undefined&&(this.$editor=function(){return i});var r=n.defer(),e=r.promise,u=this.$editor(),f;try{f=this.action(r,u.startAction());e["finally"](function(){u.endAction.call(u)})}catch(o){t.error(o)}(f||f===undefined)&&r.resolve()}}]);angular.module("textAngular.DOM",["textAngular.factories"]).factory("taExecCommand",["taSelection","taBrowserTag","$document",function(n,t,i){var r=function(t,i){for(var u,f=t.find("li"),r=f.length-1;r>=0;r--)u=angular.element("<"+i+">"+f[r].innerHTML+"<\/"+i+">"),t.after(u);t.remove();n.setSelectionToElementEnd(u[0])},f=function(i,r,u,f,e){for(var h,p,w,s=i.find("li"),y,c,l,o=0;o<s.length;o++)if(s[o].outerHTML===r[0].outerHTML){y=o;o>0&&(p=s[o-1]);o+1<s.length&&(w=s[o+1]);break}if(c="",f?c+="<"+e+">"+r[0].innerHTML+"<\/"+e+">":(c+="<"+t(u)+">",c+="<li>"+r[0].innerHTML+"<\/li>",c+="<\/"+t(u)+">"),h=angular.element(c),p)if(w){var b=i.parent(),a="",v=i[0].nodeName.toLowerCase();for(a+="<"+v+">",o=0;o<y;o++)a+="<li>"+s[o].innerHTML+"<\/li>";for(a+="<\/"+v+">",l="",l+="<"+v+">",o=y+1;o<s.length;o++)l+="<li>"+s[o].innerHTML+"<\/li>";l+="<\/"+v+">";i.after(angular.element(l));i.after(h);i.after(angular.element(a));i.remove();n.setSelectionToElementEnd(h[0])}else r.remove(),i.after(h),n.setSelectionToElementEnd(h[0]);else{r.remove();i.after(angular.element(i[0].outerHTML));i.after(h);i.remove();n.setSelectionToElementEnd(h[0]);return}},h=function(i,r,u,f,e){for(var c,o,w,b,h=i.find("li"),l=[],a,v,y,p,s=0;s<h.length;s++)for(o=0;o<r.length;o++)h[s].isEqualNode(r[o])&&(l[o]=s);if(l[0]>0&&(w=h[l[0]-1]),l[r.length-1]+1<h.length&&(b=h[l[r.length-1]+1]),a="",f)for(o=0;o<r.length;o++)a+="<"+e+">"+r[o].innerHTML+"<\/"+e+">",r[o].remove();else{for(a+="<"+t(u)+">",o=0;o<r.length;o++)a+=r[o].outerHTML,r[o].remove();a+="<\/"+t(u)+">"}if(c=angular.element(a),w)if(b){for(v="",y=i[0].nodeName.toLowerCase(),v+="<"+y+">",s=0;s<l[0];s++)v+="<li>"+h[s].innerHTML+"<\/li>";for(v+="<\/"+y+">",p="",p+="<"+y+">",s=l[r.length-1]+1;s<h.length;s++)p+="<li>"+h[s].innerHTML+"<\/li>";p+="<\/"+y+">";i.after(angular.element(p));i.after(c);i.after(angular.element(v));i.remove();n.setSelectionToElementEnd(c[0])}else{i.after(c);n.setSelectionToElementEnd(c[0]);return}else{i.after(angular.element(i[0].outerHTML));i.after(c);i.remove();n.setSelectionToElementEnd(c[0]);return}},e=function(t){/(<br(|\/)>)$/i.test(t.innerHTML.trim())?n.setSelectionBeforeElement(angular.element(t).find("br")[0]):n.setSelectionToElementEnd(t)},u=function(n,t){var i=angular.element("<"+t+">"+n[0].innerHTML+"<\/"+t+">");n.after(i);n.remove();e(i.find("li")[0])},o=function(n,i,r){for(var f,o="",u=0;u<n.length;u++)o+="<"+t("li")+">
17060"+n[u].innerHTML+"<\/"+t("li")+">";f=angular.element("<"+r+">"+o+"<\/"+r+">");i.after(f);i.remove();e(f.find("li")[0])},s=function(n,t){for(var r,u,i=0;i<n.childNodes.length;i++)r=n.childNodes[i],r.tagName&&r.tagName.match(BLOCKELEMENTS)&&s(r,t);return n.parentNode===null?n:t==="<br>"?n:(u=angular.element(t),u[0].innerHTML=n.innerHTML,n.parentNode.insertBefore(u[0],n),n.parentNode.removeChild(n),u)};return function(e,c){return e=t(e),function(l,a,v,y){var w,k,ut,p,pt,ft,g,tt,et=angular.element("<"+e+">"),b,ct,d,it,nt,rt,yt,lt,ht,at,ot,st,wt,vt,dt;try{n.getSelection&&(tt=n.getSelection());g=n.getSelectionElement();g.tagName!==undefined&&(g.tagName.toLowerCase()==="div"&&/taTextElement.+/.test(g.id)&&tt&&tt.start&&tt.start.offset===1&&tt.end.offset===1?(b=g.innerHTML,/<br>/i.test(b)&&(b=b.replace(/<br>/i,"&#8203;")),/<br\/>/i.test(b)&&(b=b.replace(/<br\/>/i,"&#8203;")),/<span>(<span>)+/i.test(b)&&(b=__.replace(/<span>(<span>)+/i,"<span>")),/<\/span>(<\/span>)+/i.test(b)&&(b=__.replace(/<\/span>(<\/span>)+/i,"<\/span>")),/<span><\/span>/i.test(b)&&(b=b.replace(/<span><\/span>/i,"")),ct="<div>"+b+"<\/div>",g.innerHTML=ct,n.setSelectionToElementEnd(g.childNodes[0]),g=n.getSelectionElement()):g.tagName.toLowerCase()==="span"&&tt&&tt.start&&tt.start.offset===1&&tt.end.offset===1?(b=g.innerHTML,/<br>/i.test(b)&&(b=b.replace(/<br>/i,"&#8203;")),/<br\/>/i.test(b)&&(b=b.replace(/<br\/>/i,"&#8203;")),/<span>(<span>)+/i.test(b)&&(b=__.replace(/<span>(<span>)+/i,"<span>")),/<\/span>(<\/span>)+/i.test(b)&&(b=__.replace(/<\/span>(<\/span>)+/i,"<\/span>")),/<span><\/span>/i.test(b)&&(b=b.replace(/<span><\/span>/i,"")),ct="<div>"+b+"<\/div>",g.innerHTML=ct,n.setSelectionToElementEnd(g.childNodes[0]),g=n.getSelectionElement()):g.tagName.toLowerCase()==="p"&&tt&&tt.start&&tt.start.offset===1&&tt.end.offset===1?(b=g.innerHTML,/<br>/i.test(b)&&(b=b.replace(/<br>/i,"&#8203;"),g.innerHTML=b)):g.tagName.toLowerCase()==="li"&&tt&&tt.start&&tt.start.offset===tt.end.offset&&(b=g.innerHTML,/<br>/i.test(b)&&(b=b.replace(/<br>/i,""),g.innerHTML=b)))}catch(ni){}if(g){if(d=angular.element(g),it=g&&g.tagName&&g.tagName.toLowerCase()||"",l.toLowerCase()==="insertorderedlist"||l.toLowerCase()==="insertunorderedlist"){if(nt=t(l.toLowerCase()==="insertorderedlist"?"ol":"ul"),rt=n.getOnlySelectedElements(),rt.length>1&&(it==="ol"||it==="ul"))return h(d,rt,nt,nt===it,e);if(it===nt)return d[0].childNodes.length!==rt.length&&rt.length===1?(d=angular.element(rt[0]),f(d.parent(),d,nt,!0,e)):r(d,e);if(it==="li"&&d.parent()[0].tagName.toLowerCase()===nt&&d.parent().children().length===1)return r(d.parent(),e);if(it==="li"&&d.parent()[0].tagName.toLowerCase()!==nt&&d.parent().children().length===1)return u(d.parent(),nt);if(it.match(BLOCKELEMENTS)&&!d.hasClass("ta-bind"))return rt.length&&d[0].childNodes.length!==rt.length&&rt.length===1?(d=angular.element(rt[0]),f(d.parent(),d,nt,nt===it,e)):it==="ol"||it==="ul"?u(d,nt):(yt=!1,angular.forEach(d.children(),function(n){n.tagName.match(BLOCKELEMENTS)&&(yt=!0)}),yt?o(d.children(),d,nt):o([angular.element("<div>"+g.innerHTML+"<\/div>")[0]],d,nt));if(it.match(BLOCKELEMENTS)){if(p=n.getOnlySelectedElements(),p.length===0)k=angular.element("<"+nt+"><li>"+g.innerHTML+"<\/li><\/"+nt+">"),d.html(""),d.append(k);else{if(p.length===1&&(p[0].tagName.toLowerCase()==="ol"||p[0].tagName.toLowerCase()==="ul"))return p[0].tagName.toLowerCase()===nt?r(angular.element(p[0]),e):u(angular.element(p[0]),nt);for(ut="",lt=[],w=0;w<p.length;w++)if(p[w].nodeType!==3){if(ht=angular.element(p[w]),p[w].tagName.toLowerCase()==="li")continue;else ut+=p[w].tagName.toLowerCase()==="ol"||p[w].tagName.toLowerCase()==="ul"?ht[0].innerHTML:p[w].tagName.toLowerCase()==="span"&&(p[w].childNodes[0].tagName.toLowerCase()==="ol"||p[w].childNodes[0].tagName.toLowerCase()==="ul")?ht[0].childNodes[0].innerHTML:"<"+t("li")+">"+ht[0].innerHTML+"<\/"+t("li")+">";lt.unshift(ht)}k=angular.element("<"+nt+">"+ut+"<\/"+nt+">");lt.pop().replaceWith(k);angular.forEach(lt,function(n){n.remove()})}n.setSelectionToElementEnd(k[0]);return}}else{if(l.toLowerCase()==="formatblock"){for(ft=v.toLowerCase().replace(/[<>]/ig,""),ft.trim()==="default"&&(ft=e,v="<"+e+">"),k=it==="li"?d.parent():d;!k[0].tagName||!k[0].tagName.match(BLOCKELEMENTS)&&!k.parent().attr("contenteditable");)k=k.parent(),it=(k[0].tagName||"").toLowerCase();if(it===ft){for(p=k.children(),at=!1,w=0;w<p.length;w++)at=at||p[w].tagName.match(BLOCKELEMENTS);at?(k.after(p),pt=k.next(),k.remove(),k=pt):(et.append(k[0].childNodes),k.after(et),k.remove(),k=et)}else if(k.parent()[0].tagName.toLowerCase()!==ft||k.parent().hasClass("ta-bind"))if(it.match(LISTELEMENTS))k.wrap(v);else{for(p=n.getOnlySelectedElements(),p.length===0&&(p=[k[0]]),w=0;w<p.length;w++)if(p[w].nodeType===3||!p[w].tagName.match(BLOCKELEMENTS))while(p[w].nodeType===3||!p[w].tagName||!p[w].tagName.match(BLOCKELEMENTS))p[w]=p[w].parentNode;if(p=p.filter(function(n,t,i){return i.indexOf(n)===t}),p.length>1&&(p=p.filter(function(n){return!(n.nodeName.toLowerCase()==="div"&&/^taTextElement/.test(n.id))})),angular.element(p[0]).hasClass("ta-bind"))k=angular.element(v),k[0].innerHTML=p[0].innerHTML,p[0].innerHTML=k[0].outerHTML;else if(ft==="blockquote"){for(ut="",w=0;w<p.length;w++)ut+=p[w].outerHTML;for(k=angular.element(v),k[0].innerHTML=ut,p[0].parentNode.insertBefore(k[0],p[0]),w=p.length-1;w>=0;w--)p[w].parentNode&&p[w].parentNode.removeChild(p[w])}else if(ft==="pre"&&n.getStateShiftKey()){for(ut="",w=0;w<p.length;w++)ut+=p[w].outerHTML;for(k=angular.element(v),k[0].innerHTML=ut,p[0].parentNode.insertBefore(k[0],p[0]),w=p.length-1;w>=0;w--)p[w].parentNode&&p[w].parentNode.removeChild(p[w])}else for(w=0;w<p.length;w++)wt=s(p[w],v),p[w]===k[0]&&(k=angular.element(wt))}else{for(ot=k.parent(),st=ot.contents(),w=0;w<st.length;w++)ot.parent().hasClass("ta-bind")&&st[w].nodeType===3&&(et=angular.element("<"+e+">"),et[0].innerHTML=st[w].outerHTML,st[w]=et[0]),ot.parent()[0].insertBefore(st[w],ot[0]);ot.remove()}n.setSelectionToElementEnd(k[0]);k[0].focus();return}if(l.toLowerCase()==="createlink"){if(vt=encodeURI(v),it==="a"){n.getSelectionElement().href=vt;return}var bt='<a href="'+vt+'" target="'+(y.a.target?y.a.target:"")+'">',kt="<\/a>",gt=n.getSelection();gt.collapsed?n.insertHtml(bt+vt+kt,c):rangy.getSelection().getRangeAt(0).canSurroundContents()&&(dt=angular.element(bt+kt)[0],rangy.getSelection().getRangeAt(0).surroundContents(dt));return}if(l.toLowerCase()==="inserthtml"){n.insertHtml(v,c);return}}try{i[0].execCommand(l,a,v)}catch(ni){}}}}}]).service("taSelection",["$document","taDOM","$log",function(n,t){var r=n[0],u,f=function(n,t){return n.tagName&&n.tagName.match(/^br$/i)&&t===0&&!n.previousSibling?{element:n.parentNode,offset:0}:{element:n,offset:t}},i={getSelection:function(){var i,n,t;try{i=rangy.getSelection().getRangeAt(0)}catch(r){return undefined}return n=i.commonAncestorContainer,t={start:f(i.startContainer,i.startOffset),end:f(i.endContainer,i.endOffset),collapsed:i.collapsed},n.nodeType===3&&(n.parentNode.nodeName.toLowerCase()==="div"&&/^taTextElement/.test(n.parentNode.id)||(n=n.parentNode)),n.nodeName.toLowerCase()==="div"&&/^taTextElement/.test(n.id)?(t.start.element=n.childNodes[t.start.offset],t.end.element=n.childNodes[t.end.offset],t.container=n):t.container=n.parentNode===t.start.element||n.parentNode===t.end.element?n.parentNode:n,t},updateLeftArrowKey:function(){var t=rangy.getSelection().getRangeAt(0),n,o,r,u,f,e;if(t&&t.collapsed){if(n=i.getFlattenedDom(t),!n.findIndex)return;if(o=t.startContainer,r=n.findIndex(function(n){if(n.node===o)return!0;var t=n.parents.indexOf(o);return t!==-1}
17060),n.forEach(function(n){n.parents.forEach(function(){})}),r+1<n.length&&(f=n[r+1].node),f&&f.textContent&&(u=/^\ufeff([^\ufeff]*)$/.exec(f.textContent),u))return;if(r>0&&(e=n[r-1].node),t.startOffset===0&&e&&(u=/^\ufeff([^\ufeff]*)$/.exec(e.textContent),u)){i.setSelectionToElementEnd(e);return}}return},updateRightArrowKey:function(){var n,r;if(!1&&(n=rangy.getSelection().getRangeAt(0),n&&n.collapsed)){if(r=i.getFlattenedDom(n),!r.findIndex)return;var t=n.startContainer,f=r.findIndex(function(n){if(n.node===t)return!0;var i=n.parents.indexOf(t);return i!==-1}),u,e=r.findIndex(function(n){if(n.textContent){var t=/^\ufeff([^\ufeff]*)$/.exec(n.textContent);return t?!0:!1}return!1});if(e===-1)return;if(t=r[f],t&&t.textContent&&(u=/^\ufeff([^\ufeff]*)$/.exec(t.textContent),u&&n.startOffset-1===u[1].length))return;if(r&&n.startOffset===0&&(f=r.indexOf(n.startContainer),f!==-1&&f>0&&(t=r[f-1],t.textContent&&(u=/\ufeff([^\ufeff]*)$/.exec(t.textContent),u&&!0||n.startOffset===u[1].length+1))))return}},getFlattenedDom:function(n){function u(n){if(n.node.childNodes.length){var t=Array.prototype.slice.call(n.node.childNodes);t.forEach(function(t){var i=n.parents.slice();i.slice(-1)[0]!==n.node&&i.push(n.node);u({parents:i,node:t})})}else i.push({parents:n.parents,node:n.node})}var t=n.commonAncestorContainer.parentNode,i,r;return t?(i=Array.prototype.slice.call(t.childNodes),r=i.indexOf(n.startContainer),r+1<i.length&&r>0||t.parentNode&&(t=t.parentNode),i=[],u({parents:[t],node:t}),i):n.commonAncestorContainer.childNodes},getOnlySelectedElements:function(){var t=rangy.getSelection().getRangeAt(0),n=t.commonAncestorContainer;return n=n.nodeType===3?n.parentNode:n,t.getNodes([1],function(t){return t.parentNode===n})},getAllSelectedElements:function(){var r=rangy.getSelection().getRangeAt(0),n=r.commonAncestorContainer,t,i,u,f;if(n=n.nodeType===3?n.parentNode:n,t=r.getNodes([1],function(t){return t.parentNode===n}),i=n.innerHTML,i=i.replace(/<span id=.selectionBoundary[^>]+>\ufeff?<\/span>/ig,""),i===r.toHtml()&&!(n.nodeName.toLowerCase()==="div"&&/^taTextElement/.test(n.id))){for(u=[],f=t.length;f--;u.unshift(t[f]));t=u;t.push(n)}return t},getSelectionElement:function(){var n=i.getSelection();return n?i.getSelection().container:undefined},setSelection:function(n,t,i,r){var u=rangy.createRange();u.setStart(n,i);u.setEnd(t,r);rangy.getSelection().setSingleRange(u)},setSelectionBeforeElement:function(n){var t=rangy.createRange();t.selectNode(n);t.collapse(!0);rangy.getSelection().setSingleRange(t)},setSelectionAfterElement:function(n){var t=rangy.createRange();t.selectNode(n);t.collapse(!1);rangy.getSelection().setSingleRange(t)},setSelectionToElementStart:function(n){var t=rangy.createRange();t.selectNodeContents(n);t.collapse(!0);rangy.getSelection().setSingleRange(t)},setSelectionToElementEnd:function(n){var t=rangy.createRange();t.selectNodeContents(n);t.collapse(!1);n.childNodes&&n.childNodes[n.childNodes.length-1]&&n.childNodes[n.childNodes.length-1].nodeName==="br"&&(t.startOffset=t.endOffset=t.startOffset-1);rangy.getSelection().setSingleRange(t)},setStateShiftKey:function(n){u=n},getStateShiftKey:function(){return u},insertHtml:function(n,u){var f,o,y,p,c,s,b,l=angular.element("<div>"+n+"<\/div>"),e=rangy.getSelection().getRangeAt(0),h=r.createDocumentFragment(),k=l[0].childNodes,a=!0,v,w,d;if(k.length>0){for(p=[],y=0;y<k.length;y++)(v=k[y],v.nodeName.toLowerCase()!=="p"||v.innerHTML.trim()!=="")&&(a=a&&!BLOCKELEMENTS.test(v.nodeName),p.push(v));for(w=0;w<p.length;w++)s=h.appendChild(p[w]);!a&&e.collapsed&&/^(|<br(|\/)>)$/i.test(e.startContainer.innerHTML)&&e.selectNode(e.startContainer)}else a=!0,s=h=r.createTextNode(n);if(a)e.deleteContents();else if(e.collapsed&&e.startContainer!==u)if(e.startContainer.innerHTML&&e.startContainer.innerHTML.match(/^<[^>]*>$/i))f=e.startContainer,e.startOffset===1?(e.setStartAfter(f),e.setEndAfter(f)):(e.setStartBefore(f),e.setEndBefore(f));else{if(e.startContainer.nodeType===3&&e.startContainer.parentNode!==u)for(f=e.startContainer.parentNode,o=f.cloneNode(),t.splitNodes(f.childNodes,f,o,e.startContainer,e.startOffset);!VALIDELEMENTS.test(f.nodeName);)angular.element(f).after(o),f=f.parentNode,d=o,o=f.cloneNode(),t.splitNodes(f.childNodes,f,o,d);else f=e.startContainer,o=f.cloneNode(),t.splitNodes(f.childNodes,f,o,undefined,undefined,e.startOffset);if(angular.element(f).after(o),e.setStartAfter(f),e.setEndAfter(f),/^(|<br(|\/)>)$/i.test(f.innerHTML.trim())&&(e.setStartBefore(f),e.setEndBefore(f),angular.element(f).remove()),/^(|<br(|\/)>)$/i.test(o.innerHTML.trim())&&angular.element(o).remove(),f.nodeName.toLowerCase()==="li"){for(b=r.createDocumentFragment(),c=0;c<h.childNodes.length;c++)l=angular.element("<li>"),t.transferChildNodes(h.childNodes[c],l[0]),t.transferNodeAttributes(h.childNodes[c],l[0]),b.appendChild(l[0]);h=b;s&&(s=h.childNodes[h.childNodes.length-1],s=s.childNodes[s.childNodes.length-1])}}else e.deleteContents();
17060e.insertNode(h);s&&i.setSelectionToElementEnd(s)}};return i}]).service("taDOM",function(){var n={getByAttribute:function(t,i){var r=[],u=t.children();return u.length&&angular.forEach(u,function(t){r=r.concat(n.getByAttribute(angular.element(t),i))}),t.attr(i)!==undefined&&r.push(t),r},transferChildNodes:function(n,t){for(t.innerHTML="";n.childNodes.length>0;)t.appendChild(n.childNodes[0]);return t},splitNodes:function(t,i,r,u,f,e){if(!u&&isNaN(e))throw new Error("taDOM.splitNodes requires a splitNode or splitIndex");for(var o=document.createDocumentFragment(),s=document.createDocumentFragment(),h=0;t.length>0&&(isNaN(e)||e!==h)&&t[0]!==u;)o.appendChild(t[0]),h++;for(!isNaN(f)&&f>=0&&t[0]&&(o.appendChild(document.createTextNode(t[0].nodeValue.substring(0,f))),t[0].nodeValue=t[0].nodeValue.substring(f));t.length>0;)s.appendChild(t[0]);n.transferChildNodes(o,i);n.transferChildNodes(s,r)},transferNodeAttributes:function(n,t){for(var i=0;i<n.attributes.length;i++)t.setAttribute(n.attributes[i].name,n.attributes[i].value);return t}};return n});angular.module("textAngular.validators",[]).directive("taMaxText",function(){return{restrict:"A",require:"ngModel",link:function(n,t,i,r){var u=parseInt(n.$eval(i.taMaxText));if(isNaN(u))throw"Max text must be an integer";i.$observe("taMaxText",function(n){if(u=parseInt(n),isNaN(u))throw"Max text must be an integer";r.$dirty&&r.$validate()});r.$validators.taMaxText=function(n){var t=angular.element("<div/>");return t.html(n),t.text().length<=u}}}}).directive("taMinText",function(){return{restrict:"A",require:"ngModel",link:function(n,t,i,r){var u=parseInt(n.$eval(i.taMinText));if(isNaN(u))throw"Min text must be an integer";i.$observe("taMinText",function(n){if(u=parseInt(n),isNaN(u))throw"Min text must be an integer";r.$dirty&&r.$validate()});r.$validators.taMinText=function(n){var t=angular.element("<div/>");return t.html(n),!t.text().length||t.text().length>=u}}}});angular.module("textAngular.taBind",["textAngular.factories","textAngular.DOM"]).service("_taBlankTest",["taSanitize",function(n){return function(t){if(!t)return!0;var i=stripHtmlToText(n(t));return i===""?/<img[^>]+>/.test(t)?!1:!0:!1}}]).directive("taButton",[function(){return{link:function(n,t){t.attr("unselectable","on");t.on("mousedown",function(n,t){return t&&angular.extend(n,t),n.preventDefault(),!1})}}}]).directive("taBind",["taSanitize","$timeout","$document","taFixChrome","taBrowserTag","taSelection","taSelectableElements","taApplyCustomRenderers","taOptions","_taBlankTest","$parse","taDOM","textAngularManager",function(n,t,i,r,u,f,e,o,s,h,c,l,a){return{priority:2,require:["ngModel","?ngModelOptions"],link:function(u,l,v,y){function ki(n){var t;return bi.forEach(function(i){if(i.keyCode===n.keyCode){var r=(n.metaKey?it:0)+(n.ctrlKey?tt:0)+(n.shiftKey?ut:0)+(n.altKey?rt:0);if(i.forbiddenModifiers&r)return;i.mustHaveModifiers.every(function(n){return r&n})&&(t=i.specialKey)}}),t}var p=y[0],wt=y[1]||{},b=l.attr("contenteditable")!==undefined&&l.attr("contenteditable"),ui=b||l[0].tagName.toLowerCase()==="textarea"||l[0].tagName.toLowerCase()==="input",w=!1,ot=!1,lt=!1,fi=v.taUnsafeSanitizer||s.disableSanitizer,li=v.taKeepStyles||s.keepStyles,ei,ai=/^(9|19|20|27|33|34|35|36|37|38|39|40|45|112|113|114|115|116|117|118|119|120|121|122|123|144|145)$/i,vi=/^(8|13|32|46|59|61|107|109|173|186|187|188|189|190|191|192|219|220|221|222)$/i,bt,k,oi,tt=1,it=2,rt=4,ut=8,kt=13,yi=16,at=9,pi=37,wi=39,bi=[{specialKey:"UndoKey",forbiddenModifiers:rt+ut,mustHaveModifiers:[it+tt],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:rt,mustHaveModifiers:[it+tt,ut],keyCode:90},{specialKey:"RedoKey",forbiddenModifiers:rt+ut,mustHaveModifiers:[it+tt],keyCode:89},{specialKey:"TabKey",forbiddenModifiers:it+ut+rt+tt,mustHaveModifiers:[],keyCode:at},{specialKey:"ShiftTabKey",forbiddenModifiers:it+rt+tt,mustHaveModifiers:[ut],keyCode:at}],dt,st,ni,ct,vt,ii,ri,ci,et,yt,pt;v.taDefaultWrap===undefined&&(v.taDefaultWrap="p");v.taDefaultWrap===""?(k="",oi=_browserDetect.ie===undefined?"<div><br><\/div>":_browserDetect.ie>=11?"<p><br><\/p>":_browserDetect.ie<=8?"<P>&nbsp;<\/P>":"<p>&nbsp;<\/p>"):(k=_browserDetect.ie===undefined||_browserDetect.ie>
17060=11?v.taDefaultWrap.toLowerCase()==="br"?"<BR><BR>":"<"+v.taDefaultWrap+"><br><\/"+v.taDefaultWrap+">":_browserDetect.ie<=8?"<"+v.taDefaultWrap.toUpperCase()+"><\/"+v.taDefaultWrap.toUpperCase()+">":"<"+v.taDefaultWrap+"><\/"+v.taDefaultWrap+">",oi=_browserDetect.ie===undefined||_browserDetect.ie>=11?v.taDefaultWrap.toLowerCase()==="br"?"<br><br>":"<"+v.taDefaultWrap+"><br><\/"+v.taDefaultWrap+">":_browserDetect.ie<=8?"<"+v.taDefaultWrap.toUpperCase()+">&nbsp;<\/"+v.taDefaultWrap.toUpperCase()+">":"<"+v.taDefaultWrap+">&nbsp;<\/"+v.taDefaultWrap+">");wt.$options||(wt.$options={});dt=function(t){var s,c,u,i,l,r,f,e,o;if(h(t))return t;if(s=n(t),s!==t&&(t=s),c=angular.element("<div>"+t+"<\/div>"),c.children().length===0)t="<"+v.taDefaultWrap+">"+t+"<\/"+v.taDefaultWrap+">";else{for(u=c[0].childNodes,l=!1,i=0;i<u.length;i++)if(l=u[i].nodeName.toLowerCase().match(BLOCKELEMENTS))break;if(l)for(t="",i=0;i<u.length;i++)r=u[i],f=r.nodeName.toLowerCase(),f==="#comment"?t+="<!--"+r.nodeValue+"-->":f==="#text"?(e=r.textContent,t+=e.trim()?"<"+v.taDefaultWrap+">"+e+"<\/"+v.taDefaultWrap+">":e):f.match(BLOCKELEMENTS)?t+=r.outerHTML:(o=r.outerHTML||r.nodeValue,t+=o.trim()!==""?"<"+v.taDefaultWrap+">"+o+"<\/"+v.taDefaultWrap+">":o);else t="<"+v.taDefaultWrap+">"+t+"<\/"+v.taDefaultWrap+">"}return t};v.taPaste&&(bt=c(v.taPaste));l.addClass("ta-bind");u["$undoManager"+(v.id||"")]=p.$undoManager={_stack:[],_index:0,_max:1e3,push:function(n){return typeof n=="undefined"||n===null||typeof this.current()!="undefined"&&this.current()!==null&&n===this.current()?n:(this._index<this._stack.length-1&&(this._stack=this._stack.slice(0,this._index+1)),this._stack.push(n),st&&t.cancel(st),this._stack.length>this._max&&this._stack.shift(),this._index=this._stack.length-1,n)},undo:function(){return this.setToIndex(this._index-1)},redo:function(){return this.setToIndex(this._index+1)},setToIndex:function(n){return n<0||n>this._stack.length-1?undefined:(this._index=n,this.current())},current:function(){return this._stack[this._index]}};var d=function(){if(b)return l[0].innerHTML;if(ui)return l.val();throw"textAngular Error: attempting to update non-editable taBind";},ht=function(n){return u.$emit("ta-element-select",this),n.preventDefault(),!1},gt=u["reApplyOnSelectorHandlers"+(v.id||"")]=function(){w||angular.forEach(e,function(n){l.find(n).off("click",ht).on("click",ht)})},g=function(n,t,i){lt=i||!1;(typeof t=="undefined"||t===null)&&(t=!0&&b);(typeof n=="undefined"||n===null)&&(n=d());h(n)?(p.$viewValue!==""&&p.$setViewValue(""),t&&p.$undoManager.current()!==""&&p.$undoManager.push("")):(gt(),p.$viewValue!==n&&(p.$setViewValue(n),t&&p.$undoManager.push(n)));p.$render()},nt=function(n){l[0].innerHTML=n},ft,di=u["$undoTaBind"+(v.id||"")]=function(){if(!w&&b){var n=p.$undoManager.undo();typeof n!="undefined"&&n!==null&&(nt(n),g(n,!1),ft&&t.cancel(ft),ft=t(function(){l[0].focus();f.setSelectionToElementEnd(l[0])},1))}},gi=u["$redoTaBind"+(v.id||"")]=function(){if(!w&&b){var n=p.$undoManager.redo();typeof n!="undefined"&&n!==null&&(nt(n),g(n,!1),ft&&t.cancel(ft),ft=t(function(){l[0].focus();f.setSelectionToElementEnd(l[0])},1))}};if(u["updateTaBind"+(v.id||"")]=function(){w||g(undefined,undefined,!0)},ni=function(t){return p.$oldViewValue=n(r(t,li),p.$oldViewValue,fi)},l.attr("required")&&(p.$validators.required=function(n,t){return!h(n||t)}),p.$parsers.push(ni),p.$parsers.unshift(dt),p.$formatters.push(ni),p.$formatters.unshift(dt),p.$formatters.unshift(function(n){return p.$undoManager.push(n||"")}),ui)if(u.events={},b){ct=!1;vt=function(i){var ft=i!==undefined?i.match(/content=["']*OneNote.File/i):!1,s,nt,c,o,e,y,it,rt,b,g,tt;if(i&&i.trim().length){if(i.match(/class=["']*Mso(Normal|List)/i)||i.match(/content=["']*Word.Document/i)||i.match(/content=["']*OneNote.File/i)){s=i.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/i);s=s?s[1]:i;s=s.replace(/<o:p>[\s\S]*?<\/o:p>/ig,"").replace(/class=(["']|)MsoNormal(["']|)/ig,"");var v=angular.element("<div>"+s+"<\/div>"),h=angular.element("<div><\/div>"),r={element:null,lastIndent:[],lastLi:null,isUl:!1};for(r.lastIndent.peek=function(){var n=this.length;if(n>0)return this[n-1]},nt=function(n){r.isUl=n;r.element=angular.element(n?"<ul>":"<ol>");r.lastIndent=[];r.lastIndent.peek=function(){var n=this.length;if(n>0)return this[n-1]};r.lastLevelMatch=null},c=0;c<=v[0].childNodes.length;c++){if(v[0].childNodes[c]&&v[0].childNodes[c].nodeName!=="#text"){if(o=v[0].childNodes[c].tagName.toLowerCase(),o!=="p"&&o!=="ul"&&o!=="h1"&&o!=="h2"&&o!=="h3"&&o!=="h4"&&o!=="h5"&&o!=="h6"&&o!=="table")continue}else continue;if(e=angular.element(v[0].childNodes[c]),y=(e.attr("class")||"").match(/MsoList(Bullet|Number|Paragraph)(CxSp(First|Middle|Last)|)/i),y){if(e[0].childNodes.length<2||e[0].childNodes[1].childNodes.length<1)continue;var k=y[1].toLowerCase()==="bullet"||y[1].toLowerCase()!=="number"&&!(/^[^0-9a-z<]*[0-9a-z]+[^
170600-9a-z<>]</i.test(e[0].childNodes[1].innerHTML)||/^[^0-9a-z<]*[0-9a-z]+[^0-9a-z<>]</i.test(e[0].childNodes[1].childNodes[0].innerHTML)),ut=(e.attr("style")||"").match(/margin-left:([\-\.0-9]*)/i),a=parseFloat(ut?ut[1]:0),w=(e.attr("style")||"").match(/mso-list:l([0-9]+) level([0-9]+) lfo[0-9+]($|;)/i);if(w&&w[2]&&(a=parseInt(w[2])),(!w||r.lastLevelMatch&&w[1]===r.lastLevelMatch[1])&&y[3]&&y[3].toLowerCase()!=="first"&&r.lastIndent.peek()!==null&&(r.isUl===k||r.lastIndent.peek()!==a)){if(r.lastIndent.peek()!=null&&r.lastIndent.peek()<a)r.element=angular.element(k?"<ul>":"<ol>"),r.lastLi.append(r.element);else if(r.lastIndent.peek()!=null&&r.lastIndent.peek()>a){while(r.lastIndent.peek()!=null&&r.lastIndent.peek()>a){if(r.element.parent()[0].tagName.toLowerCase()==="li"){r.element=r.element.parent();continue}else if(/[uo]l/i.test(r.element.parent()[0].tagName.toLowerCase()))r.element=r.element.parent();else break;r.lastIndent.pop()}r.isUl=r.element[0].tagName.toLowerCase()==="ul";k!==r.isUl&&(nt(k),h.append(r.element))}}else nt(k),h.append(r.element);r.lastLevelMatch=w;a!==r.lastIndent.peek()&&r.lastIndent.push(a);r.lastLi=angular.element("<li>");r.element.append(r.lastLi);r.lastLi.html(e.html().replace(/<!(--|)\[if !supportLists\](--|)>[\s\S]*?<!(--|)\[endif\](--|)>/ig,""));e.remove()}else nt(!1),h.append(e)}it=function(n){n=angular.element(n);for(var t=n[0].childNodes.length-1;t>=0;t--)n.after(n[0].childNodes[t]);n.remove()};angular.forEach(h.find("span"),function(n){n.removeAttribute("lang");n.attributes.length<=0&&it(n)});angular.forEach(h.find("font"),it);i=h.html();ft&&(i=h.html()||v.html());i=i.replace(/\n/g," ")}else{if(i=i.replace(/<(|\/)meta[^>]*?>/ig,""),i.match(/<[^>]*?(ta-bind)[^>]*?>/)){if(i.match(/<[^>]*?(text-angular)[^>]*?>/)){for(rt=angular.element("<div>"+i+"<\/div>"),rt.find("textarea").remove(),b=0;b<binds.length;b++){for(g=binds[b][0].parentNode.parentNode,tt=0;tt<binds[b][0].childNodes.length;tt++)g.parentNode.insertBefore(binds[b][0].childNodes[tt],g);g.parentNode.removeChild(g)}i=rt.html().replace('<br class="Apple-interchange-newline">',"")}}else i.match(/^<span/)&&(i.match(/<span class=(\"Apple-converted-space\"|\'Apple-converted-space\')>.<\/span>/ig)||(i=i.replace(/<(|\/)span[^>]*?>/ig,"")));i=i.replace(/<br class="Apple-interchange-newline"[^>]*?>/ig,"").replace(/<span class="Apple-converted-space">( |&nbsp;)<\/span>/ig,"&nbsp;")}/<li(\s.*)?>/i.test(i)&&/(<ul(\s.*)?>|<ol(\s.*)?>).*<li(\s.*)?>/i.test(i)===!1&&(i=i.replace(/<li(\s.*)?>.*<\/li(\s.*)?>/i,"<ul>$&<\/ul>"));i=i.replace(/^[ |\u00A0]+/gm,function(n){for(var t="",i=0;i<n.length;i++)t+="&nbsp;";return t}).replace(/\n|\r\n|\r/g,"<br />").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;");bt&&(i=bt(u,{$html:i})||i);i=i.replace(/<span style=("|')([^<]*?)vertical-align\s*:\s*super;?([^>]*?)("|')>([^<]+?)<\/span>/g,"<sup style='$2$3'>$5<\/sup>");i=n(i,"",fi);f.insertHtml(i,l[0]);t(function(){p.$setViewValue(d());ct=!1;l.removeClass("processing-paste")},0)}else ct=!1,l.removeClass("processing-paste")};l.on("paste",u.events.paste=function(n,r){var f,u,o,s,h,e;if(r&&angular.extend(n,r),w||ct)return n.stopPropagation(),n.preventDefault(),!1;if(ct=!0,l.addClass("processing-paste"),u=(n.originalEvent||n).clipboardData,!u&&window.clipboardData&&window.clipboardData.getData)return f=window.clipboardData.getData("Text"),vt(f),n.stopPropagation(),n.preventDefault(),!1;if(u&&u.getData&&u.types.length>0){for(o="",s=0;s<u.types.length;s++)o+=" "+u.types[s];return/text\/html/i.test(o)?f=u.getData("text/html"):/text\/plain/i.test(o)&&(f=u.getData("text/plain")),vt(f),n.stopPropagation(),n.preventDefault(),!1}h=rangy.saveSelection();e=angular.element('<div class="ta-hidden-input" contenteditable="true"><\/div>');i.find("body").append(e);e[0].focus();t(function(){rangy.restoreSelection(h);vt(e[0].innerHTML);l[0].focus();e.remove()},0)});l.on("cut",u.events.cut=function(n){w?n.preventDefault():t(function(){p.$setViewValue(d())},0)});l.on("keydown",u.events.keydown=function(n,t){var h,c,r,i,e,l,o;if(t&&angular.extend(n,t),n.keyCode===yi?f.setStateShiftKey(!0):f.setStateShiftKey(!1),n.specialKey=ki(n),s.keyMappings.forEac
17060h(function(t){n.specialKey===t.commandKeyCode&&(n.specialKey=undefined);t.testForKey(n)&&(h=t.commandKeyCode);(t.commandKeyCode==="UndoKey"||t.commandKeyCode==="RedoKey")&&(t.enablePropagation||n.preventDefault())}),typeof h!="undefined"&&(n.specialKey=h),typeof n.specialKey!="undefined"&&(n.specialKey!=="UndoKey"||n.specialKey!=="RedoKey")&&(n.preventDefault(),a.sendKeyCommand(u,n)),!w&&(n.specialKey==="UndoKey"&&(di(),n.preventDefault()),n.specialKey==="RedoKey"&&(gi(),n.preventDefault()),n.keyCode===kt&&!n.shiftKey&&!n.ctrlKey&&!n.metaKey&&!n.altKey)){if(c=function(n,t){for(var i=0;i<n.length;i++)if(n[i]===t)return!0;return!1},i=f.getSelectionElement(),!i.nodeName.match(VALIDELEMENTS))return;e=angular.element(k);l=["blockquote","ul","ol"];c(l,i.parentNode.tagName.toLowerCase())&&(/^<br(|\/)>$/i.test(i.innerHTML.trim())&&!i.nextSibling&&(r=angular.element(i),o=r.parent(),o.after(e),r.remove(),o.children().length===0&&o.remove(),f.setSelectionToElementStart(e[0]),n.preventDefault()),/^<[^>]+><br(|\/)><\/[^>]+>$/i.test(i.innerHTML.trim())&&(r=angular.element(i),r.after(e),r.remove(),f.setSelectionToElementStart(e[0]),n.preventDefault()))}});l.on("keyup",u.events.keyup=function(n,i){var c,r,s,e,o,u,h;if(i&&angular.extend(n,i),f.setStateShiftKey(!1),n.keyCode===at){c=f.getSelection();c.start.element===l[0]&&l.children().length&&f.setSelectionToElementStart(l.children()[0]);return}if(n.keyCode!==pi||n.shiftKey||f.updateLeftArrowKey(l),n.keyCode!==wi||n.shiftKey||f.updateRightArrowKey(l),st&&t.cancel(st),!w&&!ai.test(n.keyCode)&&(n.keyCode!==kt||!(n.ctrlKey||n.metaKey||n.altKey))){if(k!==""&&k!=="<BR><BR>"&&n.keyCode===kt&&!n.ctrlKey&&!n.metaKey&&!n.altKey){for(r=f.getSelectionElement();!r.nodeName.match(VALIDELEMENTS)&&r!==l[0];)r=r.parentNode;n.shiftKey?(e=r.tagName.toLowerCase(),e!==v.taDefaultWrap&&e!=="li"&&e!=="pre"&&e!=="div"||/.+<br><br>/.test(r.innerHTML.trim())||(o=r.previousSibling,o&&(o.innerHTML=o.innerHTML+"<br><br>",angular.element(r).remove(),f.setSelectionToElementEnd(o)))):r.tagName.toLowerCase()!==v.taDefaultWrap&&r.nodeName.toLowerCase()!=="li"&&(r.innerHTML.trim()===""||r.innerHTML.trim()==="<br>")&&(s=angular.element(k),angular.element(r).replaceWith(s),f.setSelectionToElementStart(s[0]))}u=d();k!==""&&(u.trim()===""||u.trim()==="<br>")?(nt(k),f.setSelectionToElementStart(l.children()[0])):u.substring(0,1)!=="<"&&v.taDefaultWrap!=="";h=ei!==n.keyCode&&vi.test(n.keyCode);ii&&t.cancel(ii);ii=t(function(){g(u,h,!0)},wt.$options.debounce||400);
17060h||(st=t(function(){p.$undoManager.push(u)},250));ei=n.keyCode}});l.on("input",function(){d()!==p.$viewValue&&(ri&&t.cancel(ri),ri=t(function(){var t=rangy.saveSelection(),n=d();n!==p.$viewValue&&g(n,!0);p.$viewValue.length!==0&&rangy.restoreSelection(t)},1e3))});l.on("blur",u.events.blur=function(){ot=!1;w?(lt=!0,p.$render()):g(undefined,undefined,!0)});if(v.placeholder&&(_browserDetect.ie>8||_browserDetect.ie===undefined)){if(v.id)ci=addCSSRule("#"+v.id+".placeholder-text:before",'content: "'+v.placeholder+'"');else throw"textAngular Error: An unique ID is required for placeholders to work";u.$on("$destroy",function(){removeCSSRule(ci)})}l.on("focus",u.events.focus=function(){ot=!0;l.removeClass("placeholder-text");gt()});l.on("mouseup",u.events.mouseup=function(){var n=f.getSelection();n&&n.start.element===l[0]&&l.children().length&&f.setSelectionToElementStart(l.children()[0])});l.on("mousedown",u.events.mousedown=function(n,t){t&&angular.extend(n,t);n.stopPropagation()})}else{l.on("change blur",u.events.change=u.events.blur=function(){w||p.$setViewValue(d())});l.on("keydown",u.events.keydown=function(n,t){var f,u;if(t&&angular.extend(n,t),n.keyCode===at){var r=this.selectionStart,e=this.selectionEnd,i=l.val();n.shiftKey?(f=i.lastIndexOf("\n",r),u=i.lastIndexOf("\t",r),u!==-1&&u>=f&&(l.val(i.substring(0,u)+i.substring(u+1)),this.selectionStart=this.selectionEnd=r-1)):(l.val(i.substring(0,r)+"\t"+i.substring(e)),this.selectionStart=this.selectionEnd=r+1);n.preventDefault()}});var ti=function(n,t){for(var i="",r=0;r<t;r++)i+=n;return i},si=function(n,t,i){for(var r=0;r<n.length;r++)t.call(i,r,n[r])},hi=function(n,t){var i="",r=n.childNodes;return t++,i+=ti("\t",t-1)+n.outerHTML.substring(0,4),si(r,function(n,r){var u=r.nodeName.toLowerCase();if(u==="#comment"){i+="<!--"+r.nodeValue+"-->";return}if(u==="#text"){i+=r.textContent;return}r.outerHTML&&(i+=u==="ul"||u==="ol"?"\n"+hi(r,t):"\n"+ti("\t",t)+r.outerHTML)}),i+="\n"+ti("\t",t-1)+n.outerHTML.substring(n.outerHTML.lastIndexOf("<"))};p.$formatters.unshift(function(n){var t=angular.element("<div>"+n+"<\/div>")[0].childNodes;return t.length>0&&(n="",si(t,function(t,i){var r=i.nodeName.toLowerCase();if(r==="#comment"){n+="<!--"+i.nodeValue+"-->";return}if(r==="#text"){n+=i.textContent;return}i.outerHTML&&(n.length>0&&(n+="\n"),n+=r==="ul"||r==="ol"?""+hi(i,0):""+i.outerHTML)})),n})}if(et=function(n,i){if(i&&angular.extend(n,i),!dropFired&&!w){dropFired=!0;var r;r=n.originalEvent?n.originalEvent.dataTransfer:n.dataTransfer;u.$emit("ta-drop-event",this,n,r);t(function(){dropFired=!1;g(undefined,undefined,!0)},100)}},pt=!1,p.$render=function(){if(!pt){pt=!0;var n=p.$viewValue||"";if(!lt)if(b&&ot&&(l.removeClass("placeholder-text"),yt&&t.cancel(yt),yt=t(function(){ot||(l[0].focus(),f.setSelectionToElementEnd(l.children()[l.children().length-1]));yt=undefined},1)),b)if(v.placeholder?n===""?nt(k):nt(n):nt(n===""?k:n),w)l.off("drop",et);else{gt();l.on("drop",et)}else l[0].tagName.toLowerCase()!=="textarea"&&l[0].tagName.toLowerCase()!=="input"?nt(o(n)):l.val(n);b&&v.placeholder&&(n===""?ot?l.removeClass("placeholder-text"):l.addClass("placeholder-text"):l.removeClass("placeholder-text"));pt=lt=!1}},v.taReadonly&&(w=u.$eval(v.taReadonly),w?(l.addClass("ta-readonly"),(l[0].tagName.toLowerCase()==="textarea"||l[0].tagName.toLowerCase()==="input")&&l.attr("disabled","disabled"),l.attr("contenteditable")!==undefined&&l.attr("contenteditable")&&l.removeAttr("contenteditable")):(l.removeClass("ta-readonly"),l[0].tagName.toLowerCase()==="textarea"||l[0].tagName.toLowerCase()==="input"?l.removeAttr("disabled"):b&&l.attr("contenteditable","true")),u.$watch(v.taReadonly,function(n,t){if(t!==n){if(n)l.addClass("ta-readonly"),(l[0].tagName.toLowerCase()==="textarea"||l[0].tagName.toLowerCase()==="input")&&l.attr("disabled","disabled"),l.attr("contenteditable")!==undefined&&l.attr("contenteditable")&&l.removeAttr("contenteditable"),angular.forEach(e,function(n){l.find(n).on("click",ht)}),l.off("drop",et);else{l.removeClass("ta-readonly");l[0].tagName.toLowerCase()==="textarea"||l[0].tagName.toLowerCase()==="input"?l.removeAttr("disabled"):b&&l.attr("contenteditable","true");angular.forEach(e,function(n){l.find(n).off("click",ht)});l.on("drop",et)}w=n}})),b&&!w){angular.forEach(e,function(n){l.find(n).on("click",ht)});l.on("drop",et)}}}}]);dropFired=!1;textAngular=angular.module("textAngular",["ngSanitize","textAngularSetup","textAngular.factories","textAngular.DOM","textAngular.validators","textAngular.taBind"]);textAngular.config([function(){angular.forEach(taTools,function(n,t){delete taTools[t]})}]);textAngular.directive("textAngular",["$compile","$timeout","taOptions","taSelection","taExecCommand","textAngularManager","$document","$animate","$log","$q","$parse",function(n,t,i,r,u,f,e,o,s,h,c){return{require:"?ngModel",scope:{},restrict:"EA",priority:2,link:function(l,a,v,y){var tt,it,rt,ut,ft,et,d,b,p=v.serial?v.serial:Math.floor(Math.random()*10000000000000000),lt,ot,st,ht,nt,at,g,k,ct,w;if(l._name=v.name?v.name:"textAngularEditor"+p,nt=function(n,i,r){t(function(){n.one(i,r)},100)},lt=u(v.taDefaultWrap),angular.extend(l,angular.copy(i),{wrapSelection:function(n,t,i){n.toLowerCase()==="undo"?l["$undoTaBindtaTextElement"+p]():n.toLowerCase()==="redo"?l["$redoTaBindtaTextElement"+p]():(lt(n,!1,t,l.defaultTagAttributes),i&&l["reApplyOnSelectorHandlerstaTextElement"+p](),l.displayElements.text[0].focus())},showHtml:l.$eval(v.taShowHtml)||!1}),v.taFocussedClass&&(l.classes.focussed=v.taFocussedClass),v.taTextEditorClass&&(l.classes.textEditor=v.taTextEditorClass),v.taHtmlEditorClass&&(l.classes.htmlEditor=v.taHtmlEditorClass),v.taDefaultTagAttributes)try{angular.extend(l.defaultTagAttributes,angular.fromJson(v.taDefaultTagAttributes))}catch(vt){s.error(vt)}v.taTextEditorSetup&&(l.setup.textEditorSetup=l.$parent.$eval(v.taTextEditorSetup));v.taHtmlEditorSetup&&(l.setup.htmlEditorSetup=l.$parent.$eval(v.taHtmlEditorSetup));l.fileDropHandler=v.taFileDrop?l.$parent.$eval(v.taFileDrop):l.defaultFileDropHandler;d=a[0].innerHTML;a[0].innerHTML="";l.displayElements={forminput:angular.element("<input type='hidden' tabindex='-1' style='display: none;'>"),html:angular.element("<textarea><\/textarea>"),text:angular.element("<div><\/div>"),scrollWindow:angular.element("<div class='ta-scroll-window'><\/div>"),popover:angular.element('<div class="popover fade bottom" style="max-width: none; width: 305px;"><\/div>'),popoverArrow:angular.element('<div class="arrow"><\/div>'),popoverContainer:angular.element('<div class="popover-content"><\/div>'),resize:{overlay:angular.element('<div class="ta-resizer-handle-overlay"><\/div>'),background:angular.element('<div class="ta-resizer-handle-background"><\/div>'),anchors:[angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-tl"><\/div>'),angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-tr"><\/div>'),angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-bl"><\/div>'),angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-br"><\/div>')],info:angular.element('<div class="ta-resizer-handle-info"><\/div>')}};l.displayElements.popover.append(l.displayElements.popoverArrow);l.displayElements.popover.append(l.displayElements.popoverContainer);l.displayElements.scrollWindow.append(l.displayElements.popover);l.displayElements.popover.on("mousedown",function(n,t){return t&&angular.extend(n,t),n.preventDefault(),!1});l.handlePopoverEvents=function(){l.displayElements.popover.css("display")==="block"&&(ht&&t.cancel(ht),ht=t(function(){l.reflowPopover(l.resizeElement);l.reflowResizeOverlay(l.resizeElement)},100))};angular.element(window).on("resize",l.handlePopoverEvents);angular.element(window).on("scroll",l.handlePopoverEvents);at=function(n){var t,u={vertical:!1,horizontal:!1},i,r;try{if(t=window.getComputedStyle(n),t===null)return u}catch(f){return u}return i=t["overflow-y"],r=t["overflow-x"],{vertical:(i==="scroll"||i==="auto")&&n.scrollHeight>n.clientHeight,horizontal:(r==="scroll"||r==="auto")&&n.scrollWidth>n.clientWidth}};l.getScrollTop=function(n,t){var i=n.scrollTop;return(typeof i=="undefined"&&(i=0),t&&at(n).vertical&&(n.removeEventListener("scroll",l._scrollListener,!1),n.addEventListener("scroll",l._scrollListener,!1)),i!==0)?{node:n.nodeName,top:i}:n.parentNode?l.getScrollTop(n.parentNode,t):{node:"<none>",top:0}};l.showPopover=function(n){l.getScrollTop(l.displayElements.scrollWindow[0],!0);l.displayElements.popover.css("display","block");t(function(){l.displayElements.resize.overlay.css("display","block")});l.resizeElement=n;l.reflowPopover(n);o.addClass(l.displayElements.popover,"in");nt(e.find("body"),"click keyup",function(){l.hidePopover()})};l._scrollListener=function(){l.handlePopoverEvents()};l.reflowPopover=function(n){var f=l.getScrollTop(l.displayElements.scrollWindow[0],!1),e=n[0].offsetTop-f.top;e<51?(l.displayElements.popover.css("top",n[0].offsetTop+n[0].offsetHeight+l.displayElements.scrollWindow[0].scrollTop+"px"),l.displayElements.popover.removeClass("top").addClass("bottom")):(l.displayElements.popover.css("top",n[0].offsetTop-54+l.displayElements.scrollWindow[0].scrollTop+"px"),l.displayElements.popover.removeClass("bottom").addClass("top"));var i=l.displayElements.text[0].offsetWidth-l.displayElements.popover[0].offsetWidth,t=n[0].offsetLeft+n[0].offsetWidth/2-l.displayElements.popover[0].offsetWidth/2,r=Math.max(0,Math.min(i,t)),u=Math.min(t,Math.max(0,t-i))-11;r+=window.scrollX;u-=window.scrollX;l.displayElements.popover.css("left",r+"px");l.displayElements.popoverArrow.css("margin-left",u+"px")};l.hidePopover=function(){l.displayElements.popover.css("display","none");l.displayElements.popoverContainer.attr("style","");l.displayElements.popoverContainer.attr("class","popover-content");l.displayElements.popover.removeClass("in");l.displayElements.resize.overlay.css("display","none")};l.displayElements.resize.overlay.append(l.displayElements.resize.background);angular.forEach(l.displayElements.resize.anchors,function(n){l.displayElements.resize.overlay.append(n)});l.displayElements.resize.overlay.append(l.displayElements.resize.info);l.displayElements.scrollWindow.append(l.displayElements.resize.overlay);l.displayElements.resize.background.on("click",function(){l.displayElements.text[0].focus()});l.reflowResizeOverlay=function(n){n=angular.element(n)[0];l.displayElements.resize.overlay.css({display:"block",left:n.offsetLeft-5+"px",top:n.offsetTop-5+"px",width:n.offsetWidth+10+"px",height:n.offsetHeight+10+"px"});l.displayElements.resize.info.text(n.offsetWidth+" x "+n.offsetHeight)};l.showResizeOverlay=function(n){var t=e.find("body");ot=function(i){var r={width:parseInt(n.attr("width")),height:parseInt(n.attr("height")),x:i.clientX,y:i.clientY},u,f;(r.width===undefined||isNaN(r.width))&&(r.width=n[0].offsetWidth);(r.height===undefined||isNaN(r.height))&&(r.height=n[0].offsetHeight);l.hidePopover();u=r.height/r.width;f=function(t){function o(n){return Math.round(Math.max(0,n))}var i={x:Math.max(0,r.width+(t.clientX-r.x)),y:Math.max(0,r.height+(t.clientY-r.y))},s=v.taResizeForceAspectRatio!==undefined,h=v.taResizeMaintainAspectRatio,c=s||h&&!t.shiftKey,f,e;c&&(f=i.y/i.x,i.x=u>f?i.x:i.y/u,i.y=u>f?i.x*u:i.y);e=angular.element(n);e.css("height",o(i.y)+"px");e.css("width",o(i.x)+"px");l.reflowResizeOverlay(n)};t.on("mousemove",f);nt(t,"mouseup",function(n){n.preventDefault();n.stopPropagation();t.off("mousemove",f);l.$apply(function(){l.hidePopover();l.updateTaBindtaTextElement()},100)});i.stopPropagation();i.preventDefault()};l.displayElements.resize.anchors[3].off("mousedown");l.displayElements.resize.anchors[3].on("mousedown",ot);l.reflowResizeOverlay(n);nt(t,"click",function(){l.hideResizeOverlay()})};l.hideResizeOverlay=function(){l.displayElements.resize.anchors[3].off("mousedown",ot);l.displayElements.resize.overlay.css("display","none")};l.setup.htmlEditorSetup(l.displayElements.html);l.setup.textEditorSetup(l.displayElements.text);
17060l.displayElements.html.attr({id:"taHtmlElement"+p,"ng-show":"showHtml","ta-bind":"ta-bind","ng-model":"html","ng-model-options":a.attr("ng-model-options")});l.displayElements.text.attr({id:"taTextElement"+p,contentEditable:"true","ta-bind":"ta-bind","ng-model":"html","ng-model-options":a.attr("ng-model-options")});l.displayElements.scrollWindow.attr({"ng-hide":"showHtml"});v.taDefaultWrap&&l.displayElements.text.attr("ta-default-wrap",v.taDefaultWrap);v.taUnsafeSanitizer&&(l.displayElements.text.attr("ta-unsafe-sanitizer",v.taUnsafeSanitizer),l.displayElements.html.attr("ta-unsafe-sanitizer",v.taUnsafeSanitizer));v.taKeepStyles&&(l.displayElements.text.attr("ta-keep-styles",v.taKeepStyles),l.displayElements.html.attr("ta-keep-styles",v.taKeepStyles));l.displayElements.scrollWindow.append(l.displayElements.text);a.append(l.displayElements.scrollWindow);a.append(l.displayElements.html);l.displayElements.forminput.attr("name",l._name);a.append(l.displayElements.forminput);v.tabindex&&(a.removeAttr("tabindex"),l.displayElements.text.attr("tabindex",v.tabindex),l.displayElements.html.attr("tabindex",v.tabindex));v.placeholder&&(l.displayElements.text.attr("placeholder",v.placeholder),l.displayElements.html.attr("placeholder",v.placeholder));v.taDisabled&&(l.displayElements.text.attr("ta-readonly","disabled"),l.displayElements.html.attr("ta-readonly","disabled"),l.disabled=l.$parent.$eval(v.taDisabled),l.$parent.$watch(v.taDisabled,function(n){l.disabled=n;l.disabled?a.addClass(l.classes.disabled):a.removeClass(l.classes.disabled)}));v.taPaste&&(l._pasteHandler=function(n){return c(v.taPaste)(l.$parent,{$html:n})},l.displayElements.text.attr("ta-paste","_pasteHandler($html)"));n(l.displayElements.scrollWindow)(l);n(l.displayElements.html)(l);l.updateTaBindtaTextElement=l["updateTaBindtaTextElement"+p];l.updateTaBindtaHtmlElement=l["updateTaBindtaHtmlElement"+p];a.addClass("ta-root");l.displayElements.scrollWindow.addClass("ta-text ta-editor "+l.classes.textEditor);l.displayElements.html.addClass("ta-html ta-editor "+l.classes.htmlEditor);g=function(n,t){t!==e[0].queryCommandState(n)&&e[0].execCommand(n,!1,null)};l._actionRunning=!1;k=!1;l.startAction=function(){var n=!1,t=!1,i=!1,r=!1;return l._actionRunning=!0,n=e[0].queryCommandState("bold"),t=e[0].queryCommandState("italic"),i=e[0].queryCommandState("underline"),r=e[0].queryCommandState("strikeThrough"),k=rangy.saveSelection(),g("bold",n),g("italic",t),g("underline",i),g("strikeThrough",r),function(){k&&rangy.restoreSelection(k)}};l.endAction=function(){l._actionRunning=!1;k&&(l.showHtml?l.displayElements.html[0].focus():l.displayElements.text[0].focus(),rangy.removeMarkers(k));k=!1;l.updateSelectedStyles();l.showHtml||l["updateTaBindtaTextElement"+p]()};ft=function(){l.focussed=!0;a.addClass(l.classes.focussed);b.focus();a.triggerHandler("focus");l.updateSelectedStyles&&!l._bUpdateSelectedStyles&&t(function(){l.updateSelectedStyles()},0)};l.displayElements.html.on("focus",ft);l.displayElements.text.on("focus",ft);et=function(n){return l._actionRunning||e[0].activeElement===l.displayElements.html[0]||e[0].activeElement===l.displayElements.text[0]||(a.removeClass(l.classes.focussed),b.unfocus(),t(function(){l._bUpdateSelectedStyles=!1;a.triggerHandler("blur");l.focussed=!1},0)),n.preventDefault(),!1};l.displayElements.html.on("blur",et);l.displayElements.text.on("blur",et);l.displayElements.text.on("paste",function(n){a.triggerHandler("paste",n)});l.queryFormatBlockState=function(n){return!l.showHtml&&n.toLowerCase()===e[0].queryCommandValue("formatBlock").toLowerCase()};l.queryCommandState=function(n){return l.showHtml?"":e[0].queryCommandState(n)};l.switchView=function(){l.showHtml=!l.showHtml;o.enabled(!1,l.displayElements.html);o.enabled(!1,l.displayElements.text);l.showHtml?t(function(){return o.enabled(!0,l.displayElements.html),o.enabled(!0,l.displayElements.text),l.displayElements.html[0].focus()},100):t(function(){return o.enabled(!0,l.displayElements.html),o.enabled(!0,l.displayElements.text),l.displayElements.text[0].focus()},100)};v.ngModel?(ct=!0,y.$render=function(){if(ct){ct=!1;var n=l.$parent.$eval(v.ngModel);(n===undefined||n===null)&&d&&d!==""&&y.$setViewValue(d)}l.displayElements.forminput.val(y.$viewValue);l.html=y.$viewValue||""},a.attr("required")&&(y.$validators.required=function(n,t){var i=n||t;return!(!i||i.trim()==="")})):(l.displayElements.forminput.val(d),l.html=d);l.$watch("html",function(n,t){n!==t&&(v.ngModel&&y.$viewValue!==n&&y.$setViewValue(n),l.displayElements.forminput.val(n))});
17060v.taTargetToolbars?b=f.registerEditor(l._name,l,v.taTargetToolbars.split(",")):(w=angular.element('<div text-angular-toolbar name="textAngularToolbar'+p+'">'),v.taToolbar&&w.attr("ta-toolbar",v.taToolbar),v.taToolbarClass&&w.attr("ta-toolbar-class",v.taToolbarClass),v.taToolbarGroupClass&&w.attr("ta-toolbar-group-class",v.taToolbarGroupClass),v.taToolbarButtonClass&&w.attr("ta-toolbar-button-class",v.taToolbarButtonClass),v.taToolbarActiveButtonClass&&w.attr("ta-toolbar-active-button-class",v.taToolbarActiveButtonClass),v.taFocussedClass&&w.attr("ta-focussed-class",v.taFocussedClass),a.prepend(w),n(w)(l.$parent),b=f.registerEditor(l._name,l,["textAngularToolbar"+p]));l.$on("$destroy",function(){f.unregisterEditor(l._name);angular.element(window).off("blur");angular.element(window).off("resize",l.handlePopoverEvents);angular.element(window).off("scroll",l.handlePopoverEvents)});l.$on("ta-element-select",function(n,t){b.triggerElementSelect(n,t)&&l["reApplyOnSelectorHandlerstaTextElement"+p]()});l.$on("ta-drop-event",function(n,i,u,f){f&&f.files&&f.files.length>0?(l.displayElements.text[0].focus(),r.setSelectionToElementEnd(u.target),angular.forEach(f.files,function(n){try{h.when(l.fileDropHandler(n,l.wrapSelection)||l.fileDropHandler!==l.defaultFileDropHandler&&h.when(l.defaultFileDropHandler(n,l.wrapSelection))).then(function(){l["updateTaBindtaTextElement"+p]()})}catch(t){s.error(t)}}),u.preventDefault(),u.stopPropagation()):t(function(){l["updateTaBindtaTextElement"+p]()},0)});
17060l._bUpdateSelectedStyles=!1;angular.element(window).on("blur",function(){l._bUpdateSelectedStyles=!1;l.focussed=!1});l.updateSelectedStyles=function(){var n;st&&t.cancel(st);(n=r.getSelectionElement())!==undefined&&n.parentNode!==l.displayElements.text[0]?b.updateSelectedStyles(angular.element(n)):b.updateSelectedStyles();l._bUpdateSelectedStyles&&(st=t(l.updateSelectedStyles,200))};tt=function(){if(!l.focussed){l._bUpdateSelectedStyles=!1;return}l._bUpdateSelectedStyles||(l._bUpdateSelectedStyles=!0,l.$apply(function(){l.updateSelectedStyles()}))};l.displayElements.html.on("keydown",tt);l.displayElements.text.on("keydown",tt);it=function(){l._bUpdateSelectedStyles=!1};l.displayElements.html.on("keyup",it);l.displayElements.text.on("keyup",it);rt=function(n,t){if(r.getSelection){var i=r.getSelection();r.getSelectionElement()&&r.getSelectionElement().nodeName.toLowerCase()==="a"&&(i.start.element.nodeType===3&&i.start.element.textContent.length===i.end.offset&&r.setSelectionAfterElement(r.getSelectionElement()),i.start.element.nodeType===3&&i.start.offset===0&&r.setSelectionBeforeElement(r.getSelectionElement()))}t&&angular.extend(n,t);l.$apply(function(){if(b.sendKeyCommand(n))return l._bUpdateSelectedStyles||l.updateSelectedStyles(),n.preventDefault(),!1})};l.displayElements.html.on("keypress",rt);l.displayElements.text.on("keypress",rt);ut=function(){l._bUpdateSelectedStyles=!1;t(function(){l.updateSelectedStyles()},0)};l.displayElements.html.on("mouseup",ut);l.displayElements.text.on("mouseup",ut)}}}]);textAngular.service("textAngularManager",["taToolExecuteAction","taTools","taRegisterTool","$interval","$rootScope","$log",function(n,t,i,r,u){var e={},f={},h=0,c=function(n){angular.forEach(f,function(t){t.editorFunctions.updateSelectedStyles(n)})},l=50,s,a=function(){h=Date.now();s=r(function(){c();s=undefined},l,1)},o;return u.$on("destroy",function(){s&&(r.cancel(s),s=undefined)}),o=function(){Math.abs(Date.now()-h)>l&&a()}
17060,{registerEditor:function(i,r,u){if(!i||i==="")throw"textAngular Error: An editor requires a name";if(!r)throw"textAngular Error: An editor requires a scope";if(f[i])throw'textAngular Error: An Editor with name "'+i+'" already exists';return f[i]={scope:r,toolbars:u,toolbarScopes:[],_registerToolbarScope:function(n){this.toolbars.indexOf(n.name)>=0&&this.toolbarScopes.push(n)},editorFunctions:{disable:function(){angular.forEach(f[i].toolbarScopes,function(n){n.disabled=!0})},enable:function(){angular.forEach(f[i].toolbarScopes,function(n){n.disabled=!1})},focus:function(){angular.forEach(f[i].toolbarScopes,function(n){n._parent=r;n.disabled=!1;n.focussed=!0});r.focussed=!0},unfocus:function(){angular.forEach(f[i].toolbarScopes,function(n){n.disabled=!0;n.focussed=!1});r.focussed=!1},updateSelectedStyles:function(n){angular.forEach(f[i].toolbarScopes,function(t){angular.forEach(t.tools,function(i){i.activeState&&(t._parent=r,i.active=i.activeState(n))})})},sendKeyCommand:function(u){var e=!1;return(u.ctrlKey||u.metaKey||u.specialKey)&&angular.forEach(t,function(t,o){if(t.commandKeyCode&&(t.commandKeyCode===u.which||t.commandKeyCode===u.specialKey))for(var s=0;s<f[i].toolbarScopes.length;s++)if(f[i].toolbarScopes[s].tools[o]!==undefined){n.call(f[i].toolbarScopes[s].tools[o],r);e=!0;break}}),e},triggerElementSelect:function(n,u){var c=function(n,t){for(var i=!0,r=0;r<t.length;r++)i=i&&n.attr(t[r]);return i},e=[],l={},a=!1,h,o,y,v,s;if(u=angular.element(u),h=!1,angular.forEach(t,function(n,t){n.onElementSelect&&n.onElementSelect.element&&n.onElementSelect.element.toLowerCase()===u[0].tagName.toLowerCase()&&(!n.onElementSelect.filter||n.onElementSelect.filter(u))&&(h=h||angular.isArray(n.onElementSelect.onlyWithAttrs)&&c(u,n.onElementSelect.onlyWithAttrs),(!n.onElementSelect.onlyWithAttrs||c(u,n.onElementSelect.onlyWithAttrs))&&(l[t]=n))}),h?(angular.forEach(l,function(n,t){n.onElementSelect.onlyWithAttrs&&c(u,n.onElementSelect.onlyWithAttrs)&&e.push({name:t,tool:n})}),e.sort(function(n,t){return t.tool.onElementSelect.onlyWithAttrs.length-n.tool.onElementSelect.onlyWithAttrs.length})):angular.forEach(l,function(n,t){e.push({name:t,tool:n})}),e.length>0)for(o=0;o<e.length;o++){for(y=e[o].tool,v=e[o].name,s=0;s<f[i].toolbarScopes.length;s++)if(f[i].toolbarScopes[s].tools[v]!==undefined){y.onElementSelect.action.call(f[i].toolbarScopes[s].tools[v],n,u,r);a=!0;break}if(a)break}return a}}},angular.forEach(u,function(n){e[n]&&f[i].toolbarScopes.push(e[n])}),o(),f[i].editorFunctions},retrieveEditor:function(n){return f[n]},unregisterEditor:function(n){delete f[n];o()},registerToolbar:function(n){if(!n)throw"textAngular Error: A toolbar requires a scope";if(!n.name||n.name==="")throw"textAngular Error: A toolbar requires a name";if(e[n.name])throw'textAngular Error: A toolbar with name "'+n.name+'" already exists';e[n.name]=n;angular.forEach(f,function(t){t._registerToolbarScope(n)});o()},retrieveToolbar:function(n){return e[n]},retrieveToolbarsViaEditor:function(n){var t=[],i=this;return angular.forEach(this.retrieveEditor(n).toolbars,function(n){t.push(i.retrieveToolbar(n))}),t},unregisterToolbar:function(n){delete e[n];o()},updateToolsDisplay:function(n){var t=this;angular.forEach(n,function(n,i){t.updateToolDisplay(i,n)})},resetToolsDisplay:function(){var n=this;angular.forEach(t,function(t,i){n.resetToolDisplay(i)});o()},updateToolDisplay:function(n,t){var i=this;angular.forEach(e,function(r,u){i.updateToolbarToolDisplay(u,n,t)});o()},resetToolDisplay:function(n){var t=this;angular.forEach(e,function(i,r){t.resetToolbarToolDisplay(r,n)});o()},updateToolbarToolDisplay:function(n,t,i){if(e[n])e[n].updateToolDisplay(t,i);else throw'textAngular Error: No Toolbar with name "'+n+'" exists';},resetToolbarToolDisplay:function(n,i){if(e[n])e[n].updateToolDisplay(i,t[i],!0);else throw'textAngular Error: No Toolbar with name "'+n+'" exists';},removeTool:function(n){delete t[n];angular.forEach(e,function(t){var r,i,u;for(delete t.tools[n],r=0;r<t.toolbar.length;r++){for(u=0;u<t.toolbar[r].length;u++){if(t.toolbar[r][u]===n){i={group:r,index:u};break}
17060if(i!==undefined)break}i!==undefined&&(t.toolbar[i.group].slice(i.index,1),t._$element.children().eq(i.group).children().eq(i.index).remove())}});o()},addTool:function(n,t,r,u){i(n,t);angular.forEach(e,function(i){i.addTool(n,t,r,u)});o()},addToolToToolbar:function(n,t,r,u,f){i(n,t);e[r].addTool(n,t,u,f);o()},refreshEditor:function(n){if(f[n])f[n].scope.updateTaBindtaTextElement(),f[n].scope.$$phase||f[n].scope.$digest();else throw'textAngular Error: No Editor with name "'+n+'" exists';o()},sendKeyCommand:function(n,t){var i=f[n._name];if(i&&i.editorFunctions.sendKeyCommand(t))return n._bUpdateSelectedStyles||n.updateSelectedStyles(),t.preventDefault(),!1},updateStyles:c,getVersion:function(){return textAngularVersion},getToolbarScopes:function(){var n=[];return angular.forEach(f,function(t){n=n.concat(t.toolbarScopes)}),n}}}]);textAngular.directive("textAngularToolbar",["$compile","textAngularManager","taOptions","taTools","taToolExecuteAction","$window",function(n,t,i,r,u,f){return{scope:{name:"@"},restrict:"EA",link:function(e,o,s){var h,c;if(!e.name||e.name==="")throw"textAngular Error: A toolbar requires a name";angular.extend(e,angular.copy(i));s.taToolbar&&(e.toolbar=e.$parent.$eval(s.taToolbar));s.taToolbarClass&&(e.classes.toolbar=s.taToolbarClass);s.taToolbarGroupClass&&(e.classes.toolbarGroup=s.taToolbarGroupClass);s.taToolbarButtonClass&&(e.classes.toolbarButton=s.taToolbarButtonClass);s.taToolbarActiveButtonClass&&(e.classes.toolbarButtonActive=s.taToolbarActiveButtonClass);s.taFocussedClass&&(e.classes.focussed=s.taFocussedClass);e.disabled=!0;e.focussed=!1;e._$element=o;o[0].innerHTML="";o.addClass("ta-toolbar "+e.classes.toolbar);e.$watch("focussed",function(){e.focussed?o.addClass(e.classes.focussed):o.removeClass(e.classes.focussed)});h=function(t,i){var r,f,u;return r=t&&t.display?angular.element(t.display):angular.element("<button type='button'>"),t&&t["class"]?r.addClass(t["class"]):r.addClass(e.classes.toolbarButton),r.attr("name",i.name),r.attr("ta-button","ta-button"),r.attr("ng-disabled","isDisabled()"),r.attr("tabindex","-1"),r.attr("ng-click","executeAction()"),r.attr("ng-class","displayActiveToolClass(active)"),t&&t.tooltiptext&&r.attr("title",t.tooltiptext),!t||t.display||i._display||(r[0].innerHTML="",t.buttontext&&(r[0].innerHTML=t.buttontext),t.iconclass&&(f=angular.element("<i>"),u=r[0].innerHTML,f.addClass(t.iconclass),r[0].innerHTML="",r.append(f),u&&u!==""&&r.append("&nbsp;"+u))),i._lastToolDefinition=angular.copy(t),n(r)(i)};e.tools={};e._parent={disabled:!0,showHtml:!1,queryFormatBlockState:function(){return!1},queryCommandState:function(){return!1}};c={$window:f,$editor:function(){return e._parent},isDisabled:function(){return this.name==="html"&&e._parent.startAction?!1:typeof this.$eval("disabled")!="function"&&this.$eval("disabled")||this.$eval("disabled()")||this.name!=="html"&&this.$editor().showHtml||this.$parent.disabled||this.$editor().disabled},displayActiveToolClass:function(n){return n?e.classes.toolbarButtonActive:""},executeAction:u};angular.forEach(e.toolbar,function(n){var t=angular.element("<div>");t.addClass(e.classes.toolbarGroup);angular.forEach(n,function(n){e.tools[n]=angular.extend(e.$new(!0),r[n],c,{name:n});e.tools[n].$element=h(r[n],e.tools[n]);t.append(e.tools[n].$element)});o.append(t)});e.updateToolDisplay=function(n,t,i){var r=e.tools[n],u;if(r){if(r._lastToolDefinition&&!i&&(t=angular.extend({},r._lastToolDefinition,t)),t.buttontext===null&&t.iconclass===null&&t.display===null)throw'textAngular Error: Tool Definition for updating "'+n+'" does not have a valid display/iconclass/buttontext value';t.buttontext===null&&delete t.buttontext;t.iconclass===null&&delete t.iconclass;t.display===null&&delete t.display;u=h(t,r);r.$element.replaceWith(u);r.$element=u}};e.addTool=function(n,t,i,u){e.tools[n]=angular.extend(e.$new(!0),r[n],c,{name:n});e.tools[n].$element=h(r[n],e.tools[n]);var f;i===undefined&&(i=e.toolbar.length-1);f=angular.element(o.children()[i]);u===undefined?(f.append(e.tools[n].$element),e.toolbar[i][e.toolbar[i].length-1]=n):(f.children().eq(u).after(e.tools[n].$element),e.toolbar[i][u]=n)};t.registerToolbar(e);e.$on("$destroy",function(){t.unregisterToolbar(e.name)}
17060)}}}]);textAngular.directive("textAngularVersion",["textAngularManager",function(n){var t=n.getVersion();return{restrict:"EA",link:function(n,i){i.html(t)}}}]);
17061/* =========================================================
17062 * bootstrap-tabdrop.js
17063 * http://www.eyecon.ro/bootstrap-tabdrop
17064 * =========================================================
17065 * Copyright 2012 Stefan Petre
17066 *
17067 * Licensed under the Apache License, Version 2.0 (the "License");
17068 * you may not use this file except in compliance with the License.
17069 * You may obtain a copy of the License at
17070 *
17071 * http://www.apache.org/licenses/LICENSE-2.0
17072 *
17073 * Unless required by applicable law or agreed to in writing, software
17074 * distributed under the License is distributed on an "AS IS" BASIS,
17075 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17076 * See the License for the specific language governing permissions and
17077 * limitations under the License.
17078 * ========================================================= */
17079
17080!function( $ ) {
17081
17082	var WinReszier = (function(){
17083		var registered = [];
17084		var inited = false;
17085		var timer;
17086		var resize = function(ev) {
17087			clearTimeout(timer);
17088			timer = setTimeout(notify, 100);
17089		};
17090		var notify = function() {
17091			for(var i=0, cnt=registered.length; i<cnt; i++) {
17092				registered[i].apply();
17093			}
17094		};
17095		return {
17096			register: function(fn) {
17097				registered.push(fn);
17098				if (inited === false) {
17099					$(window).bind('resize', resize);
17100					inited = true;
17101				}
17102			},
17103			unregister: function(fn) {
17104				for(var i=0, cnt=registered.length; i<cnt; i++) {
17105					if (registered[i] == fn) {
17106						delete registered[i];
17107						break;
17108					}
17109				}
17110			}
17111		}
17112	}());
17113
17114	var TabDrop = function(element, options) {
17115		this.element = $(element);
17116		this.dropdown = $('<li class="dropdown hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown">'+options.text+' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>')
17117							.appendTo(this.element);
17118		if (this.element.parent().is('.tabs-below')) {
17119			this.dropdown.addClass('dropup');
17120		}
17121		WinReszier.register($.proxy(this.layout, this));
17122		this.layout();
17123	};
17124
17125	TabDrop.prototype = {
17126		constructor: TabDrop,
17127
17128		layout: function() {
17129			var collection = [];
17130			this.dropdown.removeClass('hide');
17131			this.element
17132				.append(this.dropdown.find('li'))
17133				.find('>li')
17134				.not('.tabdrop').not('.second-level-item').not('.third-level-item')
17135				.each(function(){
17136					if(this.offsetTop > 0) {
17137						collection.push(this);
17138					}
17139				});
17140			if (collection.length > 0) {
17141				collection = $(collection);
17142				this.dropdown
17143					.find('ul')
17144					.empty()
17145					.append(collection);
17146				if (this.dropdown.find('.active').length == 1) {
17147					this.dropdown.addClass('active');
17148				} else {
17149					this.dropdown.removeClass('active');
17150				}
17151			} else {
17152				this.dropdown.addClass('hide');
17153			}
17154		}
17155	}
17156
17157	$.fn.tabdrop = function ( option ) {
17158		return this.each(function () {
17159			var $this = $(this),
17160				data = $this.data('tabdrop'),
17161				options = typeof option === 'object' && option;
17162			if (!data)  {
17163				$this.data('tabdrop', (data = new TabDrop(this, $.extend({}, $.fn.tabdrop.defaults,options))));
17164			}
17165			if (typeof option == 'string') {
17166				data[option]();
17167			}
17168		})
17169	};
17170
17171	$.fn.tabdrop.defaults = {
17172		text: '<i class="icon-align-justify"></i>'
17173	};
17174
17175	$.fn.tabdrop.Constructor = TabDrop;
17176
17177}( window.jQuery );;
17178/*!
17179 * classie - class helper functions
17180 * from bonzo https://github.com/ded/bonzo
17181 * 
17182 * classie.has( elem, 'my-class' ) -> true/false
17183 * classie.add( elem, 'my-new-class' )
17184 * classie.remove( elem, 'my-unwanted-class' )
17185 * classie.toggle( elem, 'my-class' )
17186 */
17187
17188/*jshint browser: true, strict: true, undef: true */
17189
17190( function( window ) {
17191
17192'use strict';
17193
17194// class helper functions from bonzo https://github.com/ded/bonzo
17195
17196function classReg( className ) {
17197  return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
17198}
17199
17200// classList support for class management
17201// altho to be fair, the api sucks because it won't accept multiple classes at once
17202var hasClass, addClass, removeClass;
17203
17204if ( 'classList' in document.documentElement ) {
17205  hasClass = function( elem, c ) {
17206    return elem.classList.contains( c );
17207  };
17208  addClass = function( elem, c ) {
17209    elem.classList.add( c );
17210  };
17211  removeClass = function( elem, c ) {
17212    elem.classList.remove( c );
17213  };
17214}
17215else {
17216  hasClass = function( elem, c ) {
17217    return classReg( c ).test( elem.className );
17218  };
17219  addClass = function( elem, c ) {
17220    if ( !hasClass( elem, c ) ) {
17221      elem.className = elem.className + ' ' + c;
17222    }
17223  };
17224  removeClass = function( elem, c ) {
17225    elem.className = elem.className.replace( classReg( c ), ' ' );
17226  };
17227}
17228
17229function toggleClass( elem, c ) {
17230  var fn = hasClass( elem, c ) ? removeClass : addClass;
17231  fn( elem, c );
17232}
17233
17234window.classie = {
17235  // full names
17236  hasClass: hasClass,
17237  addClass: addClass,
17238  removeClass: removeClass,
17239  toggleClass: toggleClass,
17240  // short names
17241  has: hasClass,
17242  add: addClass,
17243  remove: removeClass,
17244  toggle: toggleClass
17245};
17246
17247})( window );;
17248/*!
17249 *
17250 * Small scripts needed for browser detection ,navigations or tooltips
17251 * 
17252 */
17253 
17254 $.support.transition = false
17255 
17256// Add ie10 class for the html tag in IE10
17257if (/*@cc_on!@*/false) {
17258    document.documentElement.className+=' ie' + document.documentMode;
17259}
17260
17261// Add ie11 class for the html tag in IE11
17262if(navigator.userAgent.match(/Trident.*rv:11\./)) {
17263	jQuery('html').addClass('ie11');
17264}
17265
17266// IE bug for buttons
17267$(window).on("load", function () { 
17268	if (!!navigator.userAgent.match(/Trident\/7\./)){
17269		$(function() {
17270			$('button.close').wrapInner('<span></span>');
17271			$('.btn:not(.left):not(.right):not(.go2first):not(.go2last):not(.prev):not(.next)').wrapInner('<span></span>');
17272			$('.btn:not(.left):not(.right) span.caret').each(function() {
17273				$(this).appendTo($(this).parent().parent());
17274			});
17275		});
17276	};
17277});
17278
17279
17280//detect if touchscreen or not
17281document.documentElement.className += (("ontouchstart" in document.documentElement) ? ' touch' : ' no-touch');	
17282
17283
17284//Disable bootstrap transitions
17285$(function () {
17286    $.support.transition = false
17287});
17288
17289
17290//----------------- Tooltips
17291//add "tooltip-error" class
17292$('.tooltip-error-trig').tooltip({
17293	template: '<div class="tooltip tooltip-error"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
17294})
17295
17296// Tooltip title - add data-html="true" to the html tag that activates the tooltip
17297$('[data-toggle=tooltip]').tooltip({
17298	//selector: "[rel=tooltip]"
17299	html: true
17300})
17301//----------------- /Tooltips
17302
17303
17304
17305//----------------- Popover
17306$('[data-toggle=popover]:not([data-container=body])').on('shown.bs.popover', function () {
17307	$('.popover').css('top',parseInt($('.popover').css('top')) + 38 + 'px')
17308})
17309
17310$(function () {
17311	$('[data-toggle="popover"]').popover({
17312        html : true
17313	})
17314})
17315//----------------- /Popover
17316
17317
17318
17319//----------------- Select field
17320$(".select-wrapper select:not([multiple])").each(function(){
17321	$(this).after("<span class='holder'></span>");
17322});
17323$(".select-wrapper select:not([multiple])").change(function(){
17324	var selectedOption = $(this).find(":selected").text();
17325	$(this).next(".holder").text(selectedOption);
17326}).trigger('change'); 
17327
17328// Pressed
17329$(".select-wrapper select:not([multiple])").focus(function(){
17330	$(this).parent().addClass("activeState");
17331}).blur(function(){
17332	$(this).parent().removeClass("activeState");
17333}).change(function(){
17334	$(this).parent().removeClass("activeState");
17335}) 
17336//----------------- /Select field
17337
17338
17339
17340//---------------- Clear Search Field
17341$(function(){
17342	    $.fn.clearField = function () {
17343	        var _this = $(this);
17344	        var _parent = $(this).parent();
17345	        var _trigger = $('<span class="clear-search"></span>');
17346
17347	        _parent.append(_trigger);
17348
17349	        _trigger.click(function(){
17350	        	_this.val("");
17351	        	_trigger.removeClass('show').parent().removeClass('typing');
17352	        });
17353
17354	        _this.on('keyup', function(){
17355	        	if (_this.val() !== "") {
17356	        		if (!_trigger.hasClass('show')) { _trigger.addClass('show').parent().addClass('typing'); }
17357	        	} else {_trigger.removeClass('show').parent().removeClass('typing');}
17358	        });
17359	    };
17360
17361	$('.search-group .form-control').each(function(){
17362		$(this).clearField();
17363	});
17364	
17365	// Hover state
17366	$('.search-group').hover(
17367		function(){ $(this).addClass('hover') },
17368		function(){ $(this).removeClass('hover') }
17369	)
17370});
17371
17372
17373		
17374		
17375//----------------- Customized radio/checkbox elements - Focus state
17376$(".checkbox input[type='checkbox']").focus(function(){
17377	$(this).parent().addClass("focusState");
17378	}).blur(function(){
17379		$(this).parent().removeClass("focusState");
17380	})   
17381$(".radio input[type='radio']").focus(function(){
17382	$(this).parent().addClass("focusState");
17383	}).blur(function(){
17384		$(this).parent().removeClass("focusState");
17385	})   
17386//----------------- /Customized radio/checkbox elements - Focus state
17387
17388
17389
17390//----------------- Tables
17391// pressed state on the head of the table
17392$(function(){
17393	$('.table-active thead th, .table-active thead td, .table-sorter thead th, .table-sorter thead td').mousedown(function(){
17394		$(this).addClass('pressed');
17395	})
17396	.mouseup(function(){
17397		$(this).removeClass('pressed');
17398	});
17399});
17400
17401
17402// pressed state on the row in the body of the table
17403$(function(){
17404	$('.table-active tbody th, .table-active tbody td, .table-sorter tbody th, .table-sorter tbody td').mousedown(function(){
17405		$(this).parent().addClass('pressed');
17406	})
17407	.mouseup(function(){
17408		$(this).parent().removeClass('pressed');
17409	});
17410});
17411
17412// active on body
17413$('.table-active tbody tr, .table-sorter tbody tr').click(function() {
17414	$('.table-active tbody tr, .table-sorter tbody tr').removeClass('active');
17415	$(this).addClass('active');
17416}); 
17417//----------------- /Tables
17418
17419
17420
17421//----------------- Vertical menu
17422// add an additional class if one of the child elemnt is active 
17423$('.sidenav .inner-scroll > .nav').on('activate.bs.scrollspy', function () {
17424	if ($('.nav .nav > li').hasClass('active')) {
17425		$('.sidenav .inner-scroll > .nav > li.active').addClass('active-child')
17426	}
17427	else {
17428		$('.sidenav .inner-scroll > .nav > li').removeClass('active-child')
17429	}
17430});
17431
17432$('.sidenav .inner-scroll > .nav > li:not(.show-nav) > a').click(function() {
17433	$('.sidenav .inner-scroll > .nav > li').removeClass('active');
17434	$(this).parent().addClass('active');
17435	$('.sidenav .inner-scroll > .nav > li').removeClass('active-child');
17436	$('.sidenav .inner-scroll > .nav .nav > li').removeClass('active');
17437}); 
17438
17439$('.sidenav .inner-scroll > .nav .nav > li > a').click(function() {
17440	$('.sidenav .inner-scroll > .nav .nav > li').removeClass('active');
17441	$(this).parent().addClass('active');
17442	$(this).parent().parent().parent().addClass('active-child');
17443});
17444
17445
17446//----------------- Show/Hide vertical menu - Multiple levels
17447if ($('body.bs-body-class-js').length > 0) {
17448	var menuLeftMultiLvl = document.getElementById( 'cbp-spmenu-multiLvl' ),
17449		contentRightMultiLvl = document.getElementById( 'contentPushRight-multiLvl' ),
17450		showLeftPushMultiLvl = document.getElementById( 'showLeftPush-multiLvl' ),
17451		body = document.body;
17452
17453	showLeftPushMultiLvl.onclick = function() {
17454		classie.toggle( this, 'active' );
17455		classie.toggle( body, 'cbp-spmenu-push-toright' );
17456		classie.toggle( menuLeftMultiLvl, 'cbp-spmenu-open' );
17457		$(contentRightMultiLvl).toggleClass('col-md-12');
17458		disableOther( 'showLeftPush-multiLvl' );
17459	};
17460}
17461
17462	function disableOther( button ) {
17463		if( button !== 'showLeftPush2' ) {
17464			classie.toggle( showLeftPushMultiLvl, 'disabled' );
17465		}
17466	} 
17467
17468// ----------------- Show/Hide vertical menu - Multiple levels - primary
17469if ($('body.bs-body-class-js').length > 0) {
17470	var menuLeftMultiLvlPrimary = document.getElementById( 'cbp-spmenu-multiLvl-primary' ),
17471		contentRightMultiLvlPrimary = document.getElementById( 'contentPushRight-multiLvl-primary' ),
17472		showLeftPushMultiLvlPrimary = document.getElementById( 'showLeftPush-multiLvl-primary' ),
17473		body = document.body;
17474
17475	showLeftPushMultiLvlPrimary.onclick = function() {
17476		classie.toggle( this, 'active' );
17477		classie.toggle( body, 'cbp-spmenu-push-toright' );
17478		classie.toggle( menuLeftMultiLvlPrimary, 'cbp-spmenu-open' );
17479		$(contentRightMultiLvlPrimary).toggleClass('col-md-12');
17480		disableOther( 'showLeftPush-multiLvl-primary' );
17481	};
17482}
17483
17484	function disableOther( button ) {
17485		if( button !== 'showLeftPush2' ) {
17486			classie.toggle( showLeftPushMultiLvlPrimary, 'disabled' );
17487		}
17488	} 
17489
17490	
17491//----------------- Show/Hide vertical menu - Sigle level
17492if ($('body.bs-body-class-js').length > 0) {
17493	var menuLeftOneLvl = document.getElementById( 'cbp-spmenu-oneLvl' ),
17494		contentRightOneLvl = document.getElementById( 'contentPushRight-oneLvl' ),
17495		showLeftPushOneLvl = document.getElementById( 'showLeftPush-oneLvl' ),
17496		body = document.body;
17497
17498	showLeftPushOneLvl.onclick = function() {
17499		classie.toggle( this, 'active' );
17500		classie.toggle( body, 'cbp-spmenu-push-toright' );
17501		classie.toggle( menuLeftOneLvl, 'cbp-spmenu-open' );
17502		$(contentRightOneLvl).toggleClass('col-md-12');
17503		disableOther( 'showLeftPush-oneLvl' );
17504	};
17505}
17506
17507	function disableOther( button ) {
17508		if( button !== 'showLeftPush2' ) {
17509			classie.toggle( showLeftPushOneLvl, 'disabled' );
17510		}
17511	}	
17512	
17513//----------------- Show/Hide vertical menu - Sigle level - primary
17514if ($('body.bs-body-class-js').length > 0) {
17515	var menuLeftOneLvlPrimary = document.getElementById( 'cbp-spmenu-oneLvl-primary' ),
17516		contentRightOneLvlPrimary = document.getElementById( 'contentPushRight-oneLvl-primary' ),
17517		showLeftPushOneLvlPrimary = document.getElementById( 'showLeftPush-oneLvl-primary' ),
17518		body = document.body;
17519
17520	showLeftPushOneLvlPrimary.onclick = function() {
17521		classie.toggle( this, 'active' );
17522		classie.toggle( body, 'cbp-spmenu-push-toright' );
17523		classie.toggle( menuLeftOneLvlPrimary, 'cbp-spmenu-open' );
17524		$(contentRightOneLvlPrimary).toggleClass('col-md-12');
17525		disableOther( 'showLeftPush-oneLvl-primary' );
17526	};
17527}
17528
17529	function disableOther( button ) {
17530		if( button !== 'showLeftPush2' ) {
17531			classie.toggle( showLeftPushOneLvlPrimary, 'disabled' );
17532		}
17533	}
17534//----------------- /Vertical menu 
17535
17536
17537
17538//----------------- Tabs
17539// Enable Tabdrop - add dropdown when you have more tabs that can fit in one row
17540$('.nav.nav-tabs').tabdrop('layout');
17541
17542// add pressed state class
17543$('.nav-tabs:not(.navbar-nav) > li > a').on('mousedown', function(e){ 
17544	$(this).addClass("pressed");
17545	});
17546$('.nav-tabs:not(.navbar-nav) > li > a').on('mouseup', function(e){ 
17547	$(this).removeClass("pressed");
17548	});
17549//----------------- /Tabs
17550
17551
17552
17553//----------------- Wizard
17554// add class on parent div width the number of childs, used for the each item width
17555$(".wizard > ul").each(function(){
17556	var count = $(this).children().size();
17557	$(this).parent().addClass('childs-' + count);
17558});
17559
17560// add pressed state class
17561$( ".wizard > ul > li:not(.active)" )
17562.mouseup(function() {
17563	$(this).removeClass("pressed");
17564})
17565.mousedown(function() {
17566	$(this).addClass("pressed");
17567});
17568
17569//----------------- /Wizard
17570
17571
17572
17573//----------------- Attach button
17574$("input[type='file'].input-btn-attach").change(function () {
17575    if ($("input[type='file'].input-btn-attach").val() == "") {
17576        return;
17577    }
17578    
17579	// your ajax submit
17580	$("input[type='file'].input-btn-attach").addClass("file-attached");	
17581});
17582//----------------- /Attach button
17583
17584
17585
17586//---------------- Navigation
17587// Enable Tabdrop - add dropdown when you have more tabs that can fit in one row
17588$('.navbar-nav').tabdrop('layout');
17589
17590// Toggle class to display burger menu animation 
17591$('.navbar.navbar-default .navbar-toggle').click(function () {
17592    $('.navbar.navbar-default').toggleClass('close-navigation');
17593});
17594
17595$(window).on("load", function () { 
17596	// move second level in the hierarchy
17597	//var nav = ('.navbar-collapse');
17598	//$(nav).each(function(){		
17599		//$(this).find('.first-level > .active.first-level-item > .second-level.in').clone().appendTo($(this));
17600	//});
17601	
17602	// Dropdown caret
17603	if ($(this).parent().children('.second-level > .second-level-item > a').hasClass('active')){
17604		$(this).siblings('.second-level').addClass('in');
17605		$(this).parent().addClass('open');
17606	} else {
17607		$(this).siblings('.second-level').removeClass('in');
17608		$(this).parent().removeClass('open');
17609	}
17610	
17611	// Hover state
17612	$('.navbar .dropdown-toggle:not(:first-child)').hover(
17613		function(){ $(this).parent().addClass('hoverState') },
17614		function(){ $(this).parent().removeClass('hoverState') }
17615	)
17616	
17617	// navbar-form - focus state
17618	$(".navbar-form .search-group input[type='text']").focus(function(){
17619		$(this).parent().addClass("focus");
17620	}).blur(function(){
17621		$(this).parent().removeClass("focus");
17622	})
17623});
17624
17625
17626;
17627/**
17628 * @license
17629 * Lodash <https://lodash.com/>
17630 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
17631 * Released under MIT license <https://lodash.com/license>
17632 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
17633 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
17634 */
17635(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function e(n,t){for(var r=null==n?0:n.length;r--&&t(n[r],r,n)!==!1;);return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return!1;
17636return!0}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!!(null==n?0:n.length)&&y(n,t,0)>-1}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);
17637return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n){return n.split("")}function _(n){return n.match($t)||[]}function v(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,!1}),e}function g(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function y(n,t,r){return t===t?Z(n,t,r):g(n,b,r)}function d(n,t,r,e){
17638for(var u=r-1,i=n.length;++u<i;)if(e(n[u],t))return u;return-1}function b(n){return n!==n}function w(n,t){var r=null==n?0:n.length;return r?k(n,t)/r:Cn}function m(n){return function(t){return null==t?X:t[n]}}function x(n){return function(t){return null==n?X:n[t]}}function j(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=!1,n):t(r,n,u,i)}),r}function A(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}function k(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);
vendor: 3,819 bytes, lines 17638-17642
17638i!==X&&(r=r===X?i:r+i);
17639}return r}function O(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function I(n,t){return c(t,function(t){return[t,n[t]]})}function R(n){return n?n.slice(0,H(n)+1).replace(Lt,""):n}function z(n){return function(t){return n(t)}}function E(n,t){return c(t,function(t){return n[t]})}function S(n,t){return n.has(t)}function W(n,t){for(var r=-1,e=n.length;++r<e&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function C(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;
17640return e}function U(n){return"\\"+Yr[n]}function B(n,t){return null==n?X:n[t]}function T(n){return Nr.test(n)}function $(n){return Pr.test(n)}function D(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function M(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function F(n,t){return function(r){return n(t(r))}}function N(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==cn||(n[r]=cn,i[u++]=r)}return i}function P(n){var t=-1,r=Array(n.size);
17641return n.forEach(function(n){r[++t]=n}),r}function q(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function Z(n,t,r){for(var e=r-1,u=n.length;++e<u;)if(n[e]===t)return e;return-1}function K(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}function V(n){return T(n)?J(n):_e(n)}function G(n){return T(n)?Y(n):p(n)}function H(n){for(var t=n.length;t--&&Ct.test(n.charAt(t)););return t}function J(n){for(var t=Mr.lastIndex=0;Mr.test(n);)++t;return t}function Y(n){return n.match(Mr)||[];
17642}function Q(n){return n.match(Fr)||[]}var X,nn="4.17.21",tn=200,rn="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",en="Expected a function",un="Invalid `variable` option passed into `_.template`",on="__lodash_hash_undefined__",fn=500,cn="__lodash_placeholder__",an=1,ln=2,sn=4,hn=1,pn=2,_n=1,vn=2,gn=4,yn=8,dn=16,bn=32,wn=64,mn=128,xn=256,jn=512,An=30,kn="...",On=800,In=16,Rn=1,zn=2,En=3,Sn=1/0,Wn=9007199254740991,Ln=1.7976931348623157e308,Cn=NaN,Un=4294967295,Bn=Un-1,Tn=Un>>>1,$n=[["ary",mn],["bind",_n],["bindKey",vn],["curry",yn],["curryRight",dn],["flip",jn],["partial",bn],["partialRight",wn],["rearg",xn]],Dn="[object Arguments]",Mn="[object Array]",Fn="[object AsyncFunction]",Nn="[object Boolean]",Pn="[object Date]",qn="[object DOMException]",Zn="[object Error]",Kn="[object Function]",Vn="[object GeneratorFunction]",Gn="[object Map]",Hn="[object Number]",Jn="[object Null]",Yn="[object Object]",Qn="[object Promise]",Xn="[object Proxy]",nt="[object RegExp]",tt="[object Set]",rt="[object String]",et="[object Symbol]",ut="[object Undefined]",it="[object WeakMap]",ot="[object WeakSet]",ft="[object ArrayBuffer]",ct="[object DataView]",at="[object Float32Array]",lt="[object Float64Array]",st="[object Int8Array]",ht="[object Int16Array]",pt="[object Int32Array]",_t="[object Uint8Array]",vt="[object Uint8ClampedArray]",gt="[object Uint16Array]",yt="[object Uint32Array]",dt=/\b__p \+= '';/g,bt=/\b(__p \+=) '' \+/g,wt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,xt=/[&<>"']/g,jt=RegExp(mt.source),At=RegExp(xt.source),kt=/<%-([\s\S]+?)%>/g,Ot=/<%([\s\S]+?)%>/g,It=/<%=([\s\S]+?)%>/g,Rt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zt=/^\w*$/,Et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,St=/[\\^$.*+?()[\]{}|]/g,Wt=RegExp(St.source),Lt=/^\s+/,Ct=/\s/,Ut=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Bt=/\{\n\/\* \[wrapped with (.+)\] \*/,Tt=/,? & /,$t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dt=/[()=,{}\[\]\/\s]/,Mt=/\\(\\)?/g,Ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nt=/\w*$/,Pt=/^[-+]0x[0-9a-f]+$/i,qt=/^0b[01]+$/i,Zt=/^\[object .+?Constructor\]$/,Kt=/^0o[0-7]+$/i,Vt=/^(?:0|[1-9]\d*)$/,Gt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u01
vendor: 5,184 bytes, lines 17642-17648
176427f]/g,Ht=/($^)/,Jt=/['\n\r\u2028\u2029\\]/g,Yt="\\ud800-\\udfff",Qt="\\u0300-\\u036f",Xt="\\ufe20-\\ufe2f",nr="\\u20d0-\\u20ff",tr=Qt+Xt+nr,rr="\\u2700-\\u27bf",er="a-z\\xdf-\\xf6\\xf8-\\xff",ur="\\xac\\xb1\\xd7\\xf7",ir="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",or="\\u2000-\\u206f",fr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",cr="A-Z\\xc0-\\xd6\\xd8-\\xde",ar="\\ufe0e\\ufe0f",lr=ur+ir+or+fr,sr="['\u2019]",hr="["+Yt+"]",pr="["+lr+"]",_r="["+tr+"]",vr="\\d+",gr="["+rr+"]",yr="["+er+"]",dr="[^"+Yt+lr+vr+rr+er+cr+"]",br="\\ud83c[\\udffb-\\udfff]",wr="(?:"+_r+"|"+br+")",mr="[^"+Yt+"]",xr="(?:\\ud83c[\\udde6-\\uddff]){2}",jr="[\\ud800-\\udbff][\\udc00-\\udfff]",Ar="["+cr+"]",kr="\\u200d",Or="(?:"+yr+"|"+dr+")",Ir="(?:"+Ar+"|"+dr+")",Rr="(?:"+sr+"(?:d|ll|m|re|s|t|ve))?",zr="(?:"+sr+"(?:D|LL|M|RE|S|T|VE))?",Er=wr+"?",Sr="["+ar+"]?",Wr="(?:"+kr+"(?:"+[mr,xr,jr].join("|")+")"+Sr+Er+")*",Lr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Cr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ur=Sr+Er+Wr,Br="(?:"+[gr,xr,jr].join("|")+")"+Ur,Tr="(?:"+[mr+_r+"?",_r,xr,jr,hr].join("|")+")",$r=RegExp(sr,"g"),Dr=RegExp(_r,"g"),Mr=RegExp(br+"(?="+br+")|"+Tr+Ur,"g"),Fr=RegExp([Ar+"?"+yr+"+"+Rr+"(?="+[pr,Ar,"$"].join("|")+")",Ir+"+"+zr+"(?="+[pr,Ar+Or,"$"].join("|")+")",Ar+"?"+Or+"+"+Rr,Ar+"+"+zr,Cr,Lr,vr,Br].join("|"),"g"),Nr=RegExp("["+kr+Yt+tr+ar+"]"),Pr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,qr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Zr=-1,Kr={};
17643Kr[at]=Kr[lt]=Kr[st]=Kr[ht]=Kr[pt]=Kr[_t]=Kr[vt]=Kr[gt]=Kr[yt]=!0,Kr[Dn]=Kr[Mn]=Kr[ft]=Kr[Nn]=Kr[ct]=Kr[Pn]=Kr[Zn]=Kr[Kn]=Kr[Gn]=Kr[Hn]=Kr[Yn]=Kr[nt]=Kr[tt]=Kr[rt]=Kr[it]=!1;var Vr={};Vr[Dn]=Vr[Mn]=Vr[ft]=Vr[ct]=Vr[Nn]=Vr[Pn]=Vr[at]=Vr[lt]=Vr[st]=Vr[ht]=Vr[pt]=Vr[Gn]=Vr[Hn]=Vr[Yn]=Vr[nt]=Vr[tt]=Vr[rt]=Vr[et]=Vr[_t]=Vr[vt]=Vr[gt]=Vr[yt]=!0,Vr[Zn]=Vr[Kn]=Vr[it]=!1;var Gr={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a",
17644"\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae",
17645"\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g",
17646"\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O",
17647"\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w",
17648"\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"},Hr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Jr={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Yr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Qr=parseFloat,Xr=parseInt,ne="object"==typeof global&&global&&global.Object===Object&&global,te="object"==typeof self&&self&&self.Object===Object&&self,re=ne||te||Function("return this")(),ee="object"==typeof exports&&exports&&!exports.nodeType&&exports,ue=ee&&"object"==typeof module&&module&&!module.nodeType&&module,ie=ue&&ue.exports===ee,oe
vendor: 4,879 bytes, lines 17648-17658
17648=ie&&ne.process,fe=function(){
17649try{var n=ue&&ue.require&&ue.require("util").types;return n?n:oe&&oe.binding&&oe.binding("util")}catch(n){}}(),ce=fe&&fe.isArrayBuffer,ae=fe&&fe.isDate,le=fe&&fe.isMap,se=fe&&fe.isRegExp,he=fe&&fe.isSet,pe=fe&&fe.isTypedArray,_e=m("length"),ve=x(Gr),ge=x(Hr),ye=x(Jr),de=function p(x){function Z(n){if(cc(n)&&!bh(n)&&!(n instanceof Ct)){if(n instanceof Y)return n;if(bl.call(n,"__wrapped__"))return eo(n)}return new Y(n)}function J(){}function Y(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,
17650this.__index__=0,this.__values__=X}function Ct(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Un,this.__views__=[]}function $t(){var n=new Ct(this.__wrapped__);return n.__actions__=Tu(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Tu(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Tu(this.__views__),n}function Yt(){if(this.__filtered__){var n=new Ct(this);n.__dir__=-1,
17651n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n}function Qt(){var n=this.__wrapped__.value(),t=this.__dir__,r=bh(n),e=t<0,u=r?n.length:0,i=Oi(0,u,this.__views__),o=i.start,f=i.end,c=f-o,a=e?f:o-1,l=this.__iteratees__,s=l.length,h=0,p=Hl(c,this.__takeCount__);if(!r||!e&&u==c&&p==c)return wu(n,this.__actions__);var _=[];n:for(;c--&&h<p;){a+=t;for(var v=-1,g=n[a];++v<s;){var y=l[v],d=y.iteratee,b=y.type,w=d(g);if(b==zn)g=w;else if(!w){if(b==Rn)continue n;break n}}_[h++]=g}return _}function Xt(n){
17652var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function nr(){this.__data__=is?is(null):{},this.size=0}function tr(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}function rr(n){var t=this.__data__;if(is){var r=t[n];return r===on?X:r}return bl.call(t,n)?t[n]:X}function er(n){var t=this.__data__;return is?t[n]!==X:bl.call(t,n)}function ur(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=is&&t===X?on:t,this}function ir(n){
17653var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function or(){this.__data__=[],this.size=0}function fr(n){var t=this.__data__,r=Wr(t,n);return!(r<0)&&(r==t.length-1?t.pop():Ll.call(t,r,1),--this.size,!0)}function cr(n){var t=this.__data__,r=Wr(t,n);return r<0?X:t[r][1]}function ar(n){return Wr(this.__data__,n)>-1}function lr(n,t){var r=this.__data__,e=Wr(r,n);return e<0?(++this.size,r.push([n,t])):r[e][1]=t,this}function sr(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){
17654var e=n[t];this.set(e[0],e[1])}}function hr(){this.size=0,this.__data__={hash:new Xt,map:new(ts||ir),string:new Xt}}function pr(n){var t=xi(this,n).delete(n);return this.size-=t?1:0,t}function _r(n){return xi(this,n).get(n)}function vr(n){return xi(this,n).has(n)}function gr(n,t){var r=xi(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this}function yr(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new sr;++t<r;)this.add(n[t])}function dr(n){return this.__data__.set(n,on),this}function br(n){
17655return this.__data__.has(n)}function wr(n){this.size=(this.__data__=new ir(n)).size}function mr(){this.__data__=new ir,this.size=0}function xr(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r}function jr(n){return this.__data__.get(n)}function Ar(n){return this.__data__.has(n)}function kr(n,t){var r=this.__data__;if(r instanceof ir){var e=r.__data__;if(!ts||e.length<tn-1)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new sr(e)}return r.set(n,t),this.size=r.size,this}function Or(n,t){
17656var r=bh(n),e=!r&&dh(n),u=!r&&!e&&mh(n),i=!r&&!e&&!u&&Oh(n),o=r||e||u||i,f=o?O(n.length,hl):[],c=f.length;for(var a in n)!t&&!bl.call(n,a)||o&&("length"==a||u&&("offset"==a||"parent"==a)||i&&("buffer"==a||"byteLength"==a||"byteOffset"==a)||Ci(a,c))||f.push(a);return f}function Ir(n){var t=n.length;return t?n[tu(0,t-1)]:X}function Rr(n,t){return Xi(Tu(n),Mr(t,0,n.length))}function zr(n){return Xi(Tu(n))}function Er(n,t,r){(r===X||Gf(n[t],r))&&(r!==X||t in n)||Br(n,t,r)}function Sr(n,t,r){var e=n[t];
17657bl.call(n,t)&&Gf(e,r)&&(r!==X||t in n)||Br(n,t,r)}function Wr(n,t){for(var r=n.length;r--;)if(Gf(n[r][0],t))return r;return-1}function Lr(n,t,r,e){return ys(n,function(n,u,i){t(e,n,r(n),i)}),e}function Cr(n,t){return n&&$u(t,Pc(t),n)}function Ur(n,t){return n&&$u(t,qc(t),n)}function Br(n,t,r){"__proto__"==t&&Tl?Tl(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function Tr(n,t){for(var r=-1,e=t.length,u=il(e),i=null==n;++r<e;)u[r]=i?X:Mc(n,t[r]);return u}function Mr(n,t,r){return n===n&&(r!==X&&(n=n<=r?n:r),
17658t!==X&&(n=n>=t?n:t)),n}function Fr(n,t,e,u,i,o){var f,c=t&an,a=t&ln,l=t&sn;if(e&&(f=i?e(n,u,i,o):e(n)),f!==X)return f;if(!fc(n))return n;var s=bh(n);if(s){if(f=zi(n),!c)return Tu(n,f)}else{var h=zs(n),p=h==Kn||h==Vn;
vendor: 8,030 bytes, lines 17658-17673
17658if(mh(n))return Iu(n,c);if(h==Yn||h==Dn||p&&!i){if(f=a||p?{}:Ei(n),!c)return a?Mu(n,Ur(f,n)):Du(n,Cr(f,n))}else{if(!Vr[h])return i?n:{};f=Si(n,h,c)}}o||(o=new wr);var _=o.get(n);if(_)return _;o.set(n,f),kh(n)?n.forEach(function(r){f.add(Fr(r,t,e,r,n,o))}):jh(n)&&n.forEach(function(r,u){
17659f.set(u,Fr(r,t,e,u,n,o))});var v=l?a?di:yi:a?qc:Pc,g=s?X:v(n);return r(g||n,function(r,u){g&&(u=r,r=n[u]),Sr(f,u,Fr(r,t,e,u,n,o))}),f}function Nr(n){var t=Pc(n);return function(r){return Pr(r,n,t)}}function Pr(n,t,r){var e=r.length;if(null==n)return!e;for(n=ll(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===X&&!(u in n)||!i(o))return!1}return!0}function Gr(n,t,r){if("function"!=typeof n)throw new pl(en);return Ws(function(){n.apply(X,r)},t)}function Hr(n,t,r,e){var u=-1,i=o,a=!0,l=n.length,s=[],h=t.length;
17660if(!l)return s;r&&(t=c(t,z(r))),e?(i=f,a=!1):t.length>=tn&&(i=S,a=!1,t=new yr(t));n:for(;++u<l;){var p=n[u],_=null==r?p:r(p);if(p=e||0!==p?p:0,a&&_===_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else i(t,_,e)||s.push(p)}return s}function Jr(n,t){var r=!0;return ys(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Yr(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(f===X?o===o&&!bc(o):r(o,f)))var f=o,c=i}return c}function ne(n,t,r,e){var u=n.length;for(r=kc(r),r<0&&(r=-r>u?0:u+r),
17661e=e===X||e>u?u:kc(e),e<0&&(e+=u),e=r>e?0:Oc(e);r<e;)n[r++]=t;return n}function te(n,t){var r=[];return ys(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function ee(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=Li),u||(u=[]);++i<o;){var f=n[i];t>0&&r(f)?t>1?ee(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f)}return u}function ue(n,t){return n&&bs(n,t,Pc)}function oe(n,t){return n&&ws(n,t,Pc)}function fe(n,t){return i(t,function(t){return uc(n[t])})}function _e(n,t){t=ku(t,n);for(var r=0,e=t.length;null!=n&&r<e;)n=n[no(t[r++])];
17662return r&&r==e?n:X}function de(n,t,r){var e=t(n);return bh(n)?e:a(e,r(n))}function we(n){return null==n?n===X?ut:Jn:Bl&&Bl in ll(n)?ki(n):Ki(n)}function me(n,t){return n>t}function xe(n,t){return null!=n&&bl.call(n,t)}function je(n,t){return null!=n&&t in ll(n)}function Ae(n,t,r){return n>=Hl(t,r)&&n<Gl(t,r)}function ke(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=il(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,z(t))),s=Hl(p.length,s),l[a]=!r&&(t||u>=120&&p.length>=120)?new yr(a&&p):X}p=n[0];
17663var _=-1,v=l[0];n:for(;++_<u&&h.length<s;){var g=p[_],y=t?t(g):g;if(g=r||0!==g?g:0,!(v?S(v,y):e(h,y,r))){for(a=i;--a;){var d=l[a];if(!(d?S(d,y):e(n[a],y,r)))continue n}v&&v.push(y),h.push(g)}}return h}function Oe(n,t,r,e){return ue(n,function(n,u,i){t(e,r(n),u,i)}),e}function Ie(t,r,e){r=ku(r,t),t=Gi(t,r);var u=null==t?t:t[no(jo(r))];return null==u?X:n(u,t,e)}function Re(n){return cc(n)&&we(n)==Dn}function ze(n){return cc(n)&&we(n)==ft}function Ee(n){return cc(n)&&we(n)==Pn}function Se(n,t,r,e,u){
17664return n===t||(null==n||null==t||!cc(n)&&!cc(t)?n!==n&&t!==t:We(n,t,r,e,Se,u))}function We(n,t,r,e,u,i){var o=bh(n),f=bh(t),c=o?Mn:zs(n),a=f?Mn:zs(t);c=c==Dn?Yn:c,a=a==Dn?Yn:a;var l=c==Yn,s=a==Yn,h=c==a;if(h&&mh(n)){if(!mh(t))return!1;o=!0,l=!1}if(h&&!l)return i||(i=new wr),o||Oh(n)?pi(n,t,r,e,u,i):_i(n,t,c,r,e,u,i);if(!(r&hn)){var p=l&&bl.call(n,"__wrapped__"),_=s&&bl.call(t,"__wrapped__");if(p||_){var v=p?n.value():n,g=_?t.value():t;return i||(i=new wr),u(v,g,r,e,i)}}return!!h&&(i||(i=new wr),vi(n,t,r,e,u,i));
17665}function Le(n){return cc(n)&&zs(n)==Gn}function Ce(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=ll(n);u--;){var f=r[u];if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++u<i;){f=r[u];var c=f[0],a=n[c],l=f[1];if(o&&f[2]){if(a===X&&!(c in n))return!1}else{var s=new wr;if(e)var h=e(a,l,c,n,t,s);if(!(h===X?Se(l,a,hn|pn,e,s):h))return!1}}return!0}function Ue(n){return!(!fc(n)||Di(n))&&(uc(n)?kl:Zt).test(to(n))}function Be(n){return cc(n)&&we(n)==nt}function Te(n){return cc(n)&&zs(n)==tt;
17666}function $e(n){return cc(n)&&oc(n.length)&&!!Kr[we(n)]}function De(n){return"function"==typeof n?n:null==n?La:"object"==typeof n?bh(n)?Ze(n[0],n[1]):qe(n):Fa(n)}function Me(n){if(!Mi(n))return Vl(n);var t=[];for(var r in ll(n))bl.call(n,r)&&"constructor"!=r&&t.push(r);return t}function Fe(n){if(!fc(n))return Zi(n);var t=Mi(n),r=[];for(var e in n)("constructor"!=e||!t&&bl.call(n,e))&&r.push(e);return r}function Ne(n,t){return n<t}function Pe(n,t){var r=-1,e=Hf(n)?il(n.length):[];return ys(n,function(n,u,i){
17667e[++r]=t(n,u,i)}),e}function qe(n){var t=ji(n);return 1==t.length&&t[0][2]?Ni(t[0][0],t[0][1]):function(r){return r===n||Ce(r,n,t)}}function Ze(n,t){return Bi(n)&&Fi(t)?Ni(no(n),t):function(r){var e=Mc(r,n);return e===X&&e===t?Nc(r,n):Se(t,e,hn|pn)}}function Ke(n,t,r,e,u){n!==t&&bs(t,function(i,o){if(u||(u=new wr),fc(i))Ve(n,t,o,r,Ke,e,u);else{var f=e?e(Ji(n,o),i,o+"",n,t,u):X;f===X&&(f=i),Er(n,o,f)}},qc)}function Ve(n,t,r,e,u,i,o){var f=Ji(n,r),c=Ji(t,r),a=o.get(c);if(a)return Er(n,r,a),X;var l=i?i(f,c,r+"",n,t,o):X,s=l===X;
17668if(s){var h=bh(c),p=!h&&mh(c),_=!h&&!p&&Oh(c);l=c,h||p||_?bh(f)?l=f:Jf(f)?l=Tu(f):p?(s=!1,l=Iu(c,!0)):_?(s=!1,l=Wu(c,!0)):l=[]:gc(c)||dh(c)?(l=f,dh(f)?l=Rc(f):fc(f)&&!uc(f)||(l=Ei(c))):s=!1}s&&(o.set(c,l),u(l,c,e,i,o),o.delete(c)),Er(n,r,l)}function Ge(n,t){var r=n.length;if(r)return t+=t<0?r:0,Ci(t,r)?n[t]:X}function He(n,t,r){t=t.length?c(t,function(n){return bh(n)?function(t){return _e(t,1===n.length?n[0]:n)}:n}):[La];var e=-1;return t=c(t,z(mi())),A(Pe(n,function(n,r,u){return{criteria:c(t,function(t){
17669return t(n)}),index:++e,value:n}}),function(n,t){return Cu(n,t,r)})}function Je(n,t){return Ye(n,t,function(t,r){return Nc(n,r)})}function Ye(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=_e(n,o);r(f,o)&&fu(i,ku(o,n),f)}return i}function Qe(n){return function(t){return _e(t,n)}}function Xe(n,t,r,e){var u=e?d:y,i=-1,o=t.length,f=n;for(n===t&&(t=Tu(t)),r&&(f=c(n,z(r)));++i<o;)for(var a=0,l=t[i],s=r?r(l):l;(a=u(f,s,a,e))>-1;)f!==n&&Ll.call(f,a,1),Ll.call(n,a,1);return n}function nu(n,t){for(var r=n?t.length:0,e=r-1;r--;){
17670var u=t[r];if(r==e||u!==i){var i=u;Ci(u)?Ll.call(n,u,1):yu(n,u)}}return n}function tu(n,t){return n+Nl(Ql()*(t-n+1))}function ru(n,t,r,e){for(var u=-1,i=Gl(Fl((t-n)/(r||1)),0),o=il(i);i--;)o[e?i:++u]=n,n+=r;return o}function eu(n,t){var r="";if(!n||t<1||t>Wn)return r;do t%2&&(r+=n),t=Nl(t/2),t&&(n+=n);while(t);return r}function uu(n,t){return Ls(Vi(n,t,La),n+"")}function iu(n){return Ir(ra(n))}function ou(n,t){var r=ra(n);return Xi(r,Mr(t,0,r.length))}function fu(n,t,r,e){if(!fc(n))return n;t=ku(t,n);
17671for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++u<i;){var c=no(t[u]),a=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return n;if(u!=o){var l=f[c];a=e?e(l,c,f):X,a===X&&(a=fc(l)?l:Ci(t[u+1])?[]:{})}Sr(f,c,a),f=f[c]}return n}function cu(n){return Xi(ra(n))}function au(n,t,r){var e=-1,u=n.length;t<0&&(t=-t>u?0:u+t),r=r>u?u:r,r<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var i=il(u);++e<u;)i[e]=n[e+t];return i}function lu(n,t){var r;return ys(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function su(n,t,r){
17672var e=0,u=null==n?e:n.length;if("number"==typeof t&&t===t&&u<=Tn){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!bc(o)&&(r?o<=t:o<t)?e=i+1:u=i}return u}return hu(n,t,La,r)}function hu(n,t,r,e){var u=0,i=null==n?0:n.length;if(0===i)return 0;t=r(t);for(var o=t!==t,f=null===t,c=bc(t),a=t===X;u<i;){var l=Nl((u+i)/2),s=r(n[l]),h=s!==X,p=null===s,_=s===s,v=bc(s);if(o)var g=e||_;else g=a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):!p&&!v&&(e?s<=t:s<t);g?u=l+1:i=l}return Hl(i,Bn)}function pu(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){
17673var o=n[r],f=t?t(o):o;if(!r||!Gf(f,c)){var c=f;i[u++]=0===o?0:o}}return i}function _u(n){return"number"==typeof n?n:bc(n)?Cn:+n}function vu(n){if("string"==typeof n)return n;if(bh(n))return c(n,vu)+"";if(bc(n))return vs?vs.call(n):"";var t=n+"";return"0"==t&&1/n==-Sn?"-0":t}function gu(n,t,r){var e=-1,u=o,i=n.length,c=!0,a=[],l=a;if(r)c=!1,u=f;else if(i>=tn){var s=t?null:ks(n);if(s)return P(s);c=!1,u=S,l=new yr}else l=t?[]:a;n:for(;++e<i;){var h=n[e],p=t?t(h):h;if(h=r||0!==h?h:0,c&&p===p){for(var _=l.length;_--;
vendor: 4,635 bytes, lines 17673-17682
17673)if(l[_]===p)continue n;
17674t&&l.push(p),a.push(h)}else u(l,p,r)||(l!==a&&l.push(p),a.push(h))}return a}function yu(n,t){return t=ku(t,n),n=Gi(n,t),null==n||delete n[no(jo(t))]}function du(n,t,r,e){return fu(n,t,r(_e(n,t)),e)}function bu(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?au(n,e?0:i,e?i+1:u):au(n,e?i+1:0,e?u:i)}function wu(n,t){var r=n;return r instanceof Ct&&(r=r.value()),l(t,function(n,t){return t.func.apply(t.thisArg,a([n],t.args))},r)}function mu(n,t,r){var e=n.length;if(e<2)return e?gu(n[0]):[];
17675for(var u=-1,i=il(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=Hr(i[u]||o,n[f],t,r));return gu(ee(i,1),t,r)}function xu(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e<u;){r(o,n[e],e<i?t[e]:X)}return o}function ju(n){return Jf(n)?n:[]}function Au(n){return"function"==typeof n?n:La}function ku(n,t){return bh(n)?n:Bi(n,t)?[n]:Cs(Ec(n))}function Ou(n,t,r){var e=n.length;return r=r===X?e:r,!t&&r>=e?n:au(n,t,r)}function Iu(n,t){if(t)return n.slice();var r=n.length,e=zl?zl(r):new n.constructor(r);
17676return n.copy(e),e}function Ru(n){var t=new n.constructor(n.byteLength);return new Rl(t).set(new Rl(n)),t}function zu(n,t){return new n.constructor(t?Ru(n.buffer):n.buffer,n.byteOffset,n.byteLength)}function Eu(n){var t=new n.constructor(n.source,Nt.exec(n));return t.lastIndex=n.lastIndex,t}function Su(n){return _s?ll(_s.call(n)):{}}function Wu(n,t){return new n.constructor(t?Ru(n.buffer):n.buffer,n.byteOffset,n.length)}function Lu(n,t){if(n!==t){var r=n!==X,e=null===n,u=n===n,i=bc(n),o=t!==X,f=null===t,c=t===t,a=bc(t);
17677if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n<t||a&&r&&u&&!e&&!i||f&&r&&u||!o&&u||!c)return-1}return 0}function Cu(n,t,r){for(var e=-1,u=n.criteria,i=t.criteria,o=u.length,f=r.length;++e<o;){var c=Lu(u[e],i[e]);if(c){if(e>=f)return c;return c*("desc"==r[e]?-1:1)}}return n.index-t.index}function Uu(n,t,r,e){for(var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=Gl(i-o,0),l=il(c+a),s=!e;++f<c;)l[f]=t[f];for(;++u<o;)(s||u<i)&&(l[r[u]]=n[u]);for(;a--;)l[f++]=n[u++];return l;
17678}function Bu(n,t,r,e){for(var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=Gl(i-f,0),s=il(l+a),h=!e;++u<l;)s[u]=n[u];for(var p=u;++c<a;)s[p+c]=t[c];for(;++o<f;)(h||u<i)&&(s[p+r[o]]=n[u++]);return s}function Tu(n,t){var r=-1,e=n.length;for(t||(t=il(e));++r<e;)t[r]=n[r];return t}function $u(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var f=t[i],c=e?e(r[f],n[f],f,r,n):X;c===X&&(c=n[f]),u?Br(r,f,c):Sr(r,f,c)}return r}function Du(n,t){return $u(n,Is(n),t)}function Mu(n,t){return $u(n,Rs(n),t);
17679}function Fu(n,r){return function(e,u){var i=bh(e)?t:Lr,o=r?r():{};return i(e,n,mi(u,2),o)}}function Nu(n){return uu(function(t,r){var e=-1,u=r.length,i=u>1?r[u-1]:X,o=u>2?r[2]:X;for(i=n.length>3&&"function"==typeof i?(u--,i):X,o&&Ui(r[0],r[1],o)&&(i=u<3?X:i,u=1),t=ll(t);++e<u;){var f=r[e];f&&n(t,f,e,i)}return t})}function Pu(n,t){return function(r,e){if(null==r)return r;if(!Hf(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=ll(r);(t?i--:++i<u)&&e(o[i],i,o)!==!1;);return r}}function qu(n){return function(t,r,e){
17680for(var u=-1,i=ll(t),o=e(t),f=o.length;f--;){var c=o[n?f:++u];if(r(i[c],c,i)===!1)break}return t}}function Zu(n,t,r){function e(){return(this&&this!==re&&this instanceof e?i:n).apply(u?r:this,arguments)}var u=t&_n,i=Gu(n);return e}function Ku(n){return function(t){t=Ec(t);var r=T(t)?G(t):X,e=r?r[0]:t.charAt(0),u=r?Ou(r,1).join(""):t.slice(1);return e[n]()+u}}function Vu(n){return function(t){return l(Ra(ca(t).replace($r,"")),n,"")}}function Gu(n){return function(){var t=arguments;switch(t.length){
17681case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=gs(n.prototype),e=n.apply(r,t);return fc(e)?e:r}}function Hu(t,r,e){function u(){for(var o=arguments.length,f=il(o),c=o,a=wi(u);c--;)f[c]=arguments[c];var l=o<3&&f[0]!==a&&f[o-1]!==a?[]:N(f,a);
17682return o-=l.length,o<e?oi(t,r,Qu,u.placeholder,X,f,l,X,X,e-o):n(this&&this!==re&&this instanceof u?i:t,this,f)}var i=Gu(t);return u}function Ju(n){return function(t,r,e){var u=ll(t);if(!Hf(t)){var i=mi(r,3);t=Pc(t),r=function(n){return i(u[n],n,u)}}var o=n(t,r,e);return o>-1?u[i?t[o]:o]:X}}function Yu(n){return gi(function(t){var r=t.length,e=r,u=Y.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if("function"!=typeof i)throw new pl(en);if(u&&!o&&"wrapper"==bi(i))var o=new Y([],!0)}for(e=o?e:r;
vendor: 37,147 bytes, lines 17682-17753
17682++e<r;){
17683i=t[e];var f=bi(i),c="wrapper"==f?Os(i):X;o=c&&$i(c[0])&&c[1]==(mn|yn|bn|xn)&&!c[4].length&&1==c[9]?o[bi(c[0])].apply(o,c[3]):1==i.length&&$i(i)?o[f]():o.thru(i)}return function(){var n=arguments,e=n[0];if(o&&1==n.length&&bh(e))return o.plant(e).value();for(var u=0,i=r?t[u].apply(this,n):e;++u<r;)i=t[u].call(this,i);return i}})}function Qu(n,t,r,e,u,i,o,f,c,a){function l(){for(var y=arguments.length,d=il(y),b=y;b--;)d[b]=arguments[b];if(_)var w=wi(l),m=C(d,w);if(e&&(d=Uu(d,e,u,_)),i&&(d=Bu(d,i,o,_)),
17684y-=m,_&&y<a){return oi(n,t,Qu,l.placeholder,r,d,N(d,w),f,c,a-y)}var x=h?r:this,j=p?x[n]:n;return y=d.length,f?d=Hi(d,f):v&&y>1&&d.reverse(),s&&c<y&&(d.length=c),this&&this!==re&&this instanceof l&&(j=g||Gu(j)),j.apply(x,d)}var s=t&mn,h=t&_n,p=t&vn,_=t&(yn|dn),v=t&jn,g=p?X:Gu(n);return l}function Xu(n,t){return function(r,e){return Oe(r,n,t(e),{})}}function ni(n,t){return function(r,e){var u;if(r===X&&e===X)return t;if(r!==X&&(u=r),e!==X){if(u===X)return e;"string"==typeof r||"string"==typeof e?(r=vu(r),
17685e=vu(e)):(r=_u(r),e=_u(e)),u=n(r,e)}return u}}function ti(t){return gi(function(r){return r=c(r,z(mi())),uu(function(e){var u=this;return t(r,function(t){return n(t,u,e)})})})}function ri(n,t){t=t===X?" ":vu(t);var r=t.length;if(r<2)return r?eu(t,n):t;var e=eu(t,Fl(n/V(t)));return T(t)?Ou(G(e),0,n).join(""):e.slice(0,n)}function ei(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=il(l+c),h=this&&this!==re&&this instanceof i?f:t;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++r];
17686return n(h,o?e:this,s)}var o=r&_n,f=Gu(t);return i}function ui(n){return function(t,r,e){return e&&"number"!=typeof e&&Ui(t,r,e)&&(r=e=X),t=Ac(t),r===X?(r=t,t=0):r=Ac(r),e=e===X?t<r?1:-1:Ac(e),ru(t,r,e,n)}}function ii(n){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=Ic(t),r=Ic(r)),n(t,r)}}function oi(n,t,r,e,u,i,o,f,c,a){var l=t&yn,s=l?o:X,h=l?X:o,p=l?i:X,_=l?X:i;t|=l?bn:wn,t&=~(l?wn:bn),t&gn||(t&=~(_n|vn));var v=[n,t,u,p,s,_,h,f,c,a],g=r.apply(X,v);return $i(n)&&Ss(g,v),g.placeholder=e,
17687Yi(g,n,t)}function fi(n){var t=al[n];return function(n,r){if(n=Ic(n),r=null==r?0:Hl(kc(r),292),r&&Zl(n)){var e=(Ec(n)+"e").split("e");return e=(Ec(t(e[0]+"e"+(+e[1]+r)))+"e").split("e"),+(e[0]+"e"+(+e[1]-r))}return t(n)}}function ci(n){return function(t){var r=zs(t);return r==Gn?M(t):r==tt?q(t):I(t,n(t))}}function ai(n,t,r,e,u,i,o,f){var c=t&vn;if(!c&&"function"!=typeof n)throw new pl(en);var a=e?e.length:0;if(a||(t&=~(bn|wn),e=u=X),o=o===X?o:Gl(kc(o),0),f=f===X?f:kc(f),a-=u?u.length:0,t&wn){var l=e,s=u;
17688e=u=X}var h=c?X:Os(n),p=[n,t,r,e,u,l,s,i,o,f];if(h&&qi(p,h),n=p[0],t=p[1],r=p[2],e=p[3],u=p[4],f=p[9]=p[9]===X?c?0:n.length:Gl(p[9]-a,0),!f&&t&(yn|dn)&&(t&=~(yn|dn)),t&&t!=_n)_=t==yn||t==dn?Hu(n,t,f):t!=bn&&t!=(_n|bn)||u.length?Qu.apply(X,p):ei(n,t,r,e);else var _=Zu(n,t,r);return Yi((h?ms:Ss)(_,p),n,t)}function li(n,t,r,e){return n===X||Gf(n,gl[r])&&!bl.call(e,r)?t:n}function si(n,t,r,e,u,i){return fc(n)&&fc(t)&&(i.set(t,n),Ke(n,t,X,si,i),i.delete(t)),n}function hi(n){return gc(n)?X:n}function pi(n,t,r,e,u,i){
17689var o=r&hn,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return!1;var a=i.get(n),l=i.get(t);if(a&&l)return a==t&&l==n;var s=-1,p=!0,_=r&pn?new yr:X;for(i.set(n,t),i.set(t,n);++s<f;){var v=n[s],g=t[s];if(e)var y=o?e(g,v,s,t,n,i):e(v,g,s,n,t,i);if(y!==X){if(y)continue;p=!1;break}if(_){if(!h(t,function(n,t){if(!S(_,t)&&(v===n||u(v,n,r,e,i)))return _.push(t)})){p=!1;break}}else if(v!==g&&!u(v,g,r,e,i)){p=!1;break}}return i.delete(n),i.delete(t),p}function _i(n,t,r,e,u,i,o){switch(r){case ct:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;
17690n=n.buffer,t=t.buffer;case ft:return!(n.byteLength!=t.byteLength||!i(new Rl(n),new Rl(t)));case Nn:case Pn:case Hn:return Gf(+n,+t);case Zn:return n.name==t.name&&n.message==t.message;case nt:case rt:return n==t+"";case Gn:var f=M;case tt:var c=e&hn;if(f||(f=P),n.size!=t.size&&!c)return!1;var a=o.get(n);if(a)return a==t;e|=pn,o.set(n,t);var l=pi(f(n),f(t),e,u,i,o);return o.delete(n),l;case et:if(_s)return _s.call(n)==_s.call(t)}return!1}function vi(n,t,r,e,u,i){var o=r&hn,f=yi(n),c=f.length;if(c!=yi(t).length&&!o)return!1;
17691for(var a=c;a--;){var l=f[a];if(!(o?l in t:bl.call(t,l)))return!1}var s=i.get(n),h=i.get(t);if(s&&h)return s==t&&h==n;var p=!0;i.set(n,t),i.set(t,n);for(var _=o;++a<c;){l=f[a];var v=n[l],g=t[l];if(e)var y=o?e(g,v,l,t,n,i):e(v,g,l,n,t,i);if(!(y===X?v===g||u(v,g,r,e,i):y)){p=!1;break}_||(_="constructor"==l)}if(p&&!_){var d=n.constructor,b=t.constructor;d!=b&&"constructor"in n&&"constructor"in t&&!("function"==typeof d&&d instanceof d&&"function"==typeof b&&b instanceof b)&&(p=!1)}return i.delete(n),
17692i.delete(t),p}function gi(n){return Ls(Vi(n,X,_o),n+"")}function yi(n){return de(n,Pc,Is)}function di(n){return de(n,qc,Rs)}function bi(n){for(var t=n.name+"",r=fs[t],e=bl.call(fs,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function wi(n){return(bl.call(Z,"placeholder")?Z:n).placeholder}function mi(){var n=Z.iteratee||Ca;return n=n===Ca?De:n,arguments.length?n(arguments[0],arguments[1]):n}function xi(n,t){var r=n.__data__;return Ti(t)?r["string"==typeof t?"string":"hash"]:r.map;
17693}function ji(n){for(var t=Pc(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,Fi(u)]}return t}function Ai(n,t){var r=B(n,t);return Ue(r)?r:X}function ki(n){var t=bl.call(n,Bl),r=n[Bl];try{n[Bl]=X;var e=!0}catch(n){}var u=xl.call(n);return e&&(t?n[Bl]=r:delete n[Bl]),u}function Oi(n,t,r){for(var e=-1,u=r.length;++e<u;){var i=r[e],o=i.size;switch(i.type){case"drop":n+=o;break;case"dropRight":t-=o;break;case"take":t=Hl(t,n+o);break;case"takeRight":n=Gl(n,t-o)}}return{start:n,end:t}}function Ii(n){var t=n.match(Bt);
17694return t?t[1].split(Tt):[]}function Ri(n,t,r){t=ku(t,n);for(var e=-1,u=t.length,i=!1;++e<u;){var o=no(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:(u=null==n?0:n.length,!!u&&oc(u)&&Ci(o,u)&&(bh(n)||dh(n)))}function zi(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&bl.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Ei(n){return"function"!=typeof n.constructor||Mi(n)?{}:gs(El(n))}function Si(n,t,r){var e=n.constructor;switch(t){case ft:return Ru(n);
17695case Nn:case Pn:return new e(+n);case ct:return zu(n,r);case at:case lt:case st:case ht:case pt:case _t:case vt:case gt:case yt:return Wu(n,r);case Gn:return new e;case Hn:case rt:return new e(n);case nt:return Eu(n);case tt:return new e;case et:return Su(n)}}function Wi(n,t){var r=t.length;if(!r)return n;var e=r-1;return t[e]=(r>1?"& ":"")+t[e],t=t.join(r>2?", ":" "),n.replace(Ut,"{\n/* [wrapped with "+t+"] */\n")}function Li(n){return bh(n)||dh(n)||!!(Cl&&n&&n[Cl])}function Ci(n,t){var r=typeof n;
17696return t=null==t?Wn:t,!!t&&("number"==r||"symbol"!=r&&Vt.test(n))&&n>-1&&n%1==0&&n<t}function Ui(n,t,r){if(!fc(r))return!1;var e=typeof t;return!!("number"==e?Hf(r)&&Ci(t,r.length):"string"==e&&t in r)&&Gf(r[t],n)}function Bi(n,t){if(bh(n))return!1;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!bc(n))||(zt.test(n)||!Rt.test(n)||null!=t&&n in ll(t))}function Ti(n){var t=typeof n;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==n:null===n}function $i(n){
17697var t=bi(n),r=Z[t];if("function"!=typeof r||!(t in Ct.prototype))return!1;if(n===r)return!0;var e=Os(r);return!!e&&n===e[0]}function Di(n){return!!ml&&ml in n}function Mi(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||gl)}function Fi(n){return n===n&&!fc(n)}function Ni(n,t){return function(r){return null!=r&&(r[n]===t&&(t!==X||n in ll(r)))}}function Pi(n){var t=Cf(n,function(n){return r.size===fn&&r.clear(),n}),r=t.cache;return t}function qi(n,t){var r=n[1],e=t[1],u=r|e,i=u<(_n|vn|mn),o=e==mn&&r==yn||e==mn&&r==xn&&n[7].length<=t[8]||e==(mn|xn)&&t[7].length<=t[8]&&r==yn;
17698if(!i&&!o)return n;e&_n&&(n[2]=t[2],u|=r&_n?0:gn);var f=t[3];if(f){var c=n[3];n[3]=c?Uu(c,f,t[4]):f,n[4]=c?N(n[3],cn):t[4]}return f=t[5],f&&(c=n[5],n[5]=c?Bu(c,f,t[6]):f,n[6]=c?N(n[5],cn):t[6]),f=t[7],f&&(n[7]=f),e&mn&&(n[8]=null==n[8]?t[8]:Hl(n[8],t[8])),null==n[9]&&(n[9]=t[9]),n[0]=t[0],n[1]=u,n}function Zi(n){var t=[];if(null!=n)for(var r in ll(n))t.push(r);return t}function Ki(n){return xl.call(n)}function Vi(t,r,e){return r=Gl(r===X?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=Gl(u.length-r,0),f=il(o);++i<o;)f[i]=u[r+i];
17699i=-1;for(var c=il(r+1);++i<r;)c[i]=u[i];return c[r]=e(f),n(t,this,c)}}function Gi(n,t){return t.length<2?n:_e(n,au(t,0,-1))}function Hi(n,t){for(var r=n.length,e=Hl(t.length,r),u=Tu(n);e--;){var i=t[e];n[e]=Ci(i,r)?u[i]:X}return n}function Ji(n,t){if(("constructor"!==t||"function"!=typeof n[t])&&"__proto__"!=t)return n[t]}function Yi(n,t,r){var e=t+"";return Ls(n,Wi(e,ro(Ii(e),r)))}function Qi(n){var t=0,r=0;return function(){var e=Jl(),u=In-(e-r);if(r=e,u>0){if(++t>=On)return arguments[0]}else t=0;
17700return n.apply(X,arguments)}}function Xi(n,t){var r=-1,e=n.length,u=e-1;for(t=t===X?e:t;++r<t;){var i=tu(r,u),o=n[i];n[i]=n[r],n[r]=o}return n.length=t,n}function no(n){if("string"==typeof n||bc(n))return n;var t=n+"";return"0"==t&&1/n==-Sn?"-0":t}function to(n){if(null!=n){try{return dl.call(n)}catch(n){}try{return n+""}catch(n){}}return""}function ro(n,t){return r($n,function(r){var e="_."+r[0];t&r[1]&&!o(n,e)&&n.push(e)}),n.sort()}function eo(n){if(n instanceof Ct)return n.clone();var t=new Y(n.__wrapped__,n.__chain__);
17701return t.__actions__=Tu(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function uo(n,t,r){t=(r?Ui(n,t,r):t===X)?1:Gl(kc(t),0);var e=null==n?0:n.length;if(!e||t<1)return[];for(var u=0,i=0,o=il(Fl(e/t));u<e;)o[i++]=au(n,u,u+=t);return o}function io(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){var i=n[t];i&&(u[e++]=i)}return u}function oo(){var n=arguments.length;if(!n)return[];for(var t=il(n-1),r=arguments[0],e=n;e--;)t[e-1]=arguments[e];return a(bh(r)?Tu(r):[r],ee(t,1));
17702}function fo(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),au(n,t<0?0:t,e)):[]}function co(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),t=e-t,au(n,0,t<0?0:t)):[]}function ao(n,t){return n&&n.length?bu(n,mi(t,3),!0,!0):[]}function lo(n,t){return n&&n.length?bu(n,mi(t,3),!0):[]}function so(n,t,r,e){var u=null==n?0:n.length;return u?(r&&"number"!=typeof r&&Ui(n,t,r)&&(r=0,e=u),ne(n,t,r,e)):[]}function ho(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:kc(r);
17703return u<0&&(u=Gl(e+u,0)),g(n,mi(t,3),u)}function po(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==X&&(u=kc(r),u=r<0?Gl(e+u,0):Hl(u,e-1)),g(n,mi(t,3),u,!0)}function _o(n){return(null==n?0:n.length)?ee(n,1):[]}function vo(n){return(null==n?0:n.length)?ee(n,Sn):[]}function go(n,t){return(null==n?0:n.length)?(t=t===X?1:kc(t),ee(n,t)):[]}function yo(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e}function bo(n){return n&&n.length?n[0]:X}function wo(n,t,r){
17704var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:kc(r);return u<0&&(u=Gl(e+u,0)),y(n,t,u)}function mo(n){return(null==n?0:n.length)?au(n,0,-1):[]}function xo(n,t){return null==n?"":Kl.call(n,t)}function jo(n){var t=null==n?0:n.length;return t?n[t-1]:X}function Ao(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;return r!==X&&(u=kc(r),u=u<0?Gl(e+u,0):Hl(u,e-1)),t===t?K(n,t,u):g(n,b,u,!0)}function ko(n,t){return n&&n.length?Ge(n,kc(t)):X}function Oo(n,t){return n&&n.length&&t&&t.length?Xe(n,t):n;
17705}function Io(n,t,r){return n&&n.length&&t&&t.length?Xe(n,t,mi(r,2)):n}function Ro(n,t,r){return n&&n.length&&t&&t.length?Xe(n,t,X,r):n}function zo(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=mi(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),u.push(e))}return nu(n,u),r}function Eo(n){return null==n?n:Xl.call(n)}function So(n,t,r){var e=null==n?0:n.length;return e?(r&&"number"!=typeof r&&Ui(n,t,r)?(t=0,r=e):(t=null==t?0:kc(t),r=r===X?e:kc(r)),au(n,t,r)):[]}function Wo(n,t){
17706return su(n,t)}function Lo(n,t,r){return hu(n,t,mi(r,2))}function Co(n,t){var r=null==n?0:n.length;if(r){var e=su(n,t);if(e<r&&Gf(n[e],t))return e}return-1}function Uo(n,t){return su(n,t,!0)}function Bo(n,t,r){return hu(n,t,mi(r,2),!0)}function To(n,t){if(null==n?0:n.length){var r=su(n,t,!0)-1;if(Gf(n[r],t))return r}return-1}function $o(n){return n&&n.length?pu(n):[]}function Do(n,t){return n&&n.length?pu(n,mi(t,2)):[]}function Mo(n){var t=null==n?0:n.length;return t?au(n,1,t):[]}function Fo(n,t,r){
17707return n&&n.length?(t=r||t===X?1:kc(t),au(n,0,t<0?0:t)):[]}function No(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),t=e-t,au(n,t<0?0:t,e)):[]}function Po(n,t){return n&&n.length?bu(n,mi(t,3),!1,!0):[]}function qo(n,t){return n&&n.length?bu(n,mi(t,3)):[]}function Zo(n){return n&&n.length?gu(n):[]}function Ko(n,t){return n&&n.length?gu(n,mi(t,2)):[]}function Vo(n,t){return t="function"==typeof t?t:X,n&&n.length?gu(n,X,t):[]}function Go(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){
17708if(Jf(n))return t=Gl(n.length,t),!0}),O(t,function(t){return c(n,m(t))})}function Ho(t,r){if(!t||!t.length)return[];var e=Go(t);return null==r?e:c(e,function(t){return n(r,X,t)})}function Jo(n,t){return xu(n||[],t||[],Sr)}function Yo(n,t){return xu(n||[],t||[],fu)}function Qo(n){var t=Z(n);return t.__chain__=!0,t}function Xo(n,t){return t(n),n}function nf(n,t){return t(n)}function tf(){return Qo(this)}function rf(){return new Y(this.value(),this.__chain__)}function ef(){this.__values__===X&&(this.__values__=jc(this.value()));
17709var n=this.__index__>=this.__values__.length;return{done:n,value:n?X:this.__values__[this.__index__++]}}function uf(){return this}function of(n){for(var t,r=this;r instanceof J;){var e=eo(r);e.__index__=0,e.__values__=X,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t}function ff(){var n=this.__wrapped__;if(n instanceof Ct){var t=n;return this.__actions__.length&&(t=new Ct(this)),t=t.reverse(),t.__actions__.push({func:nf,args:[Eo],thisArg:X}),new Y(t,this.__chain__)}return this.thru(Eo);
17710}function cf(){return wu(this.__wrapped__,this.__actions__)}function af(n,t,r){var e=bh(n)?u:Jr;return r&&Ui(n,t,r)&&(t=X),e(n,mi(t,3))}function lf(n,t){return(bh(n)?i:te)(n,mi(t,3))}function sf(n,t){return ee(yf(n,t),1)}function hf(n,t){return ee(yf(n,t),Sn)}function pf(n,t,r){return r=r===X?1:kc(r),ee(yf(n,t),r)}function _f(n,t){return(bh(n)?r:ys)(n,mi(t,3))}function vf(n,t){return(bh(n)?e:ds)(n,mi(t,3))}function gf(n,t,r,e){n=Hf(n)?n:ra(n),r=r&&!e?kc(r):0;var u=n.length;return r<0&&(r=Gl(u+r,0)),
17711dc(n)?r<=u&&n.indexOf(t,r)>-1:!!u&&y(n,t,r)>-1}function yf(n,t){return(bh(n)?c:Pe)(n,mi(t,3))}function df(n,t,r,e){return null==n?[]:(bh(t)||(t=null==t?[]:[t]),r=e?X:r,bh(r)||(r=null==r?[]:[r]),He(n,t,r))}function bf(n,t,r){var e=bh(n)?l:j,u=arguments.length<3;return e(n,mi(t,4),r,u,ys)}function wf(n,t,r){var e=bh(n)?s:j,u=arguments.length<3;return e(n,mi(t,4),r,u,ds)}function mf(n,t){return(bh(n)?i:te)(n,Uf(mi(t,3)))}function xf(n){return(bh(n)?Ir:iu)(n)}function jf(n,t,r){return t=(r?Ui(n,t,r):t===X)?1:kc(t),
17712(bh(n)?Rr:ou)(n,t)}function Af(n){return(bh(n)?zr:cu)(n)}function kf(n){if(null==n)return 0;if(Hf(n))return dc(n)?V(n):n.length;var t=zs(n);return t==Gn||t==tt?n.size:Me(n).length}function Of(n,t,r){var e=bh(n)?h:lu;return r&&Ui(n,t,r)&&(t=X),e(n,mi(t,3))}function If(n,t){if("function"!=typeof t)throw new pl(en);return n=kc(n),function(){if(--n<1)return t.apply(this,arguments)}}function Rf(n,t,r){return t=r?X:t,t=n&&null==t?n.length:t,ai(n,mn,X,X,X,X,t)}function zf(n,t){var r;if("function"!=typeof t)throw new pl(en);
17713return n=kc(n),function(){return--n>0&&(r=t.apply(this,arguments)),n<=1&&(t=X),r}}function Ef(n,t,r){t=r?X:t;var e=ai(n,yn,X,X,X,X,X,t);return e.placeholder=Ef.placeholder,e}function Sf(n,t,r){t=r?X:t;var e=ai(n,dn,X,X,X,X,X,t);return e.placeholder=Sf.placeholder,e}function Wf(n,t,r){function e(t){var r=h,e=p;return h=p=X,d=t,v=n.apply(e,r)}function u(n){return d=n,g=Ws(f,t),b?e(n):v}function i(n){var r=n-y,e=n-d,u=t-r;return w?Hl(u,_-e):u}function o(n){var r=n-y,e=n-d;return y===X||r>=t||r<0||w&&e>=_;
17714}function f(){var n=fh();return o(n)?c(n):(g=Ws(f,i(n)),X)}function c(n){return g=X,m&&h?e(n):(h=p=X,v)}function a(){g!==X&&As(g),d=0,h=y=p=g=X}function l(){return g===X?v:c(fh())}function s(){var n=fh(),r=o(n);if(h=arguments,p=this,y=n,r){if(g===X)return u(y);if(w)return As(g),g=Ws(f,t),e(y)}return g===X&&(g=Ws(f,t)),v}var h,p,_,v,g,y,d=0,b=!1,w=!1,m=!0;if("function"!=typeof n)throw new pl(en);return t=Ic(t)||0,fc(r)&&(b=!!r.leading,w="maxWait"in r,_=w?Gl(Ic(r.maxWait)||0,t):_,m="trailing"in r?!!r.trailing:m),
17715s.cancel=a,s.flush=l,s}function Lf(n){return ai(n,jn)}function Cf(n,t){if("function"!=typeof n||null!=t&&"function"!=typeof t)throw new pl(en);var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;if(i.has(u))return i.get(u);var o=n.apply(this,e);return r.cache=i.set(u,o)||i,o};return r.cache=new(Cf.Cache||sr),r}function Uf(n){if("function"!=typeof n)throw new pl(en);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:
17716return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function Bf(n){return zf(2,n)}function Tf(n,t){if("function"!=typeof n)throw new pl(en);return t=t===X?t:kc(t),uu(n,t)}function $f(t,r){if("function"!=typeof t)throw new pl(en);return r=null==r?0:Gl(kc(r),0),uu(function(e){var u=e[r],i=Ou(e,0,r);return u&&a(i,u),n(t,this,i)})}function Df(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new pl(en);return fc(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),
17717Wf(n,t,{leading:e,maxWait:t,trailing:u})}function Mf(n){return Rf(n,1)}function Ff(n,t){return ph(Au(t),n)}function Nf(){if(!arguments.length)return[];var n=arguments[0];return bh(n)?n:[n]}function Pf(n){return Fr(n,sn)}function qf(n,t){return t="function"==typeof t?t:X,Fr(n,sn,t)}function Zf(n){return Fr(n,an|sn)}function Kf(n,t){return t="function"==typeof t?t:X,Fr(n,an|sn,t)}function Vf(n,t){return null==t||Pr(n,t,Pc(t))}function Gf(n,t){return n===t||n!==n&&t!==t}function Hf(n){return null!=n&&oc(n.length)&&!uc(n);
17718}function Jf(n){return cc(n)&&Hf(n)}function Yf(n){return n===!0||n===!1||cc(n)&&we(n)==Nn}function Qf(n){return cc(n)&&1===n.nodeType&&!gc(n)}function Xf(n){if(null==n)return!0;if(Hf(n)&&(bh(n)||"string"==typeof n||"function"==typeof n.splice||mh(n)||Oh(n)||dh(n)))return!n.length;var t=zs(n);if(t==Gn||t==tt)return!n.size;if(Mi(n))return!Me(n).length;for(var r in n)if(bl.call(n,r))return!1;return!0}function nc(n,t){return Se(n,t)}function tc(n,t,r){r="function"==typeof r?r:X;var e=r?r(n,t):X;return e===X?Se(n,t,X,r):!!e;
17719}function rc(n){if(!cc(n))return!1;var t=we(n);return t==Zn||t==qn||"string"==typeof n.message&&"string"==typeof n.name&&!gc(n)}function ec(n){return"number"==typeof n&&Zl(n)}function uc(n){if(!fc(n))return!1;var t=we(n);return t==Kn||t==Vn||t==Fn||t==Xn}function ic(n){return"number"==typeof n&&n==kc(n)}function oc(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=Wn}function fc(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function cc(n){return null!=n&&"object"==typeof n}function ac(n,t){
17720return n===t||Ce(n,t,ji(t))}function lc(n,t,r){return r="function"==typeof r?r:X,Ce(n,t,ji(t),r)}function sc(n){return vc(n)&&n!=+n}function hc(n){if(Es(n))throw new fl(rn);return Ue(n)}function pc(n){return null===n}function _c(n){return null==n}function vc(n){return"number"==typeof n||cc(n)&&we(n)==Hn}function gc(n){if(!cc(n)||we(n)!=Yn)return!1;var t=El(n);if(null===t)return!0;var r=bl.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&dl.call(r)==jl}function yc(n){
17721return ic(n)&&n>=-Wn&&n<=Wn}function dc(n){return"string"==typeof n||!bh(n)&&cc(n)&&we(n)==rt}function bc(n){return"symbol"==typeof n||cc(n)&&we(n)==et}function wc(n){return n===X}function mc(n){return cc(n)&&zs(n)==it}function xc(n){return cc(n)&&we(n)==ot}function jc(n){if(!n)return[];if(Hf(n))return dc(n)?G(n):Tu(n);if(Ul&&n[Ul])return D(n[Ul]());var t=zs(n);return(t==Gn?M:t==tt?P:ra)(n)}function Ac(n){if(!n)return 0===n?n:0;if(n=Ic(n),n===Sn||n===-Sn){return(n<0?-1:1)*Ln}return n===n?n:0}function kc(n){
17722var t=Ac(n),r=t%1;return t===t?r?t-r:t:0}function Oc(n){return n?Mr(kc(n),0,Un):0}function Ic(n){if("number"==typeof n)return n;if(bc(n))return Cn;if(fc(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=fc(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=R(n);var r=qt.test(n);return r||Kt.test(n)?Xr(n.slice(2),r?2:8):Pt.test(n)?Cn:+n}function Rc(n){return $u(n,qc(n))}function zc(n){return n?Mr(kc(n),-Wn,Wn):0===n?n:0}function Ec(n){return null==n?"":vu(n)}function Sc(n,t){var r=gs(n);return null==t?r:Cr(r,t);
17723}function Wc(n,t){return v(n,mi(t,3),ue)}function Lc(n,t){return v(n,mi(t,3),oe)}function Cc(n,t){return null==n?n:bs(n,mi(t,3),qc)}function Uc(n,t){return null==n?n:ws(n,mi(t,3),qc)}function Bc(n,t){return n&&ue(n,mi(t,3))}function Tc(n,t){return n&&oe(n,mi(t,3))}function $c(n){return null==n?[]:fe(n,Pc(n))}function Dc(n){return null==n?[]:fe(n,qc(n))}function Mc(n,t,r){var e=null==n?X:_e(n,t);return e===X?r:e}function Fc(n,t){return null!=n&&Ri(n,t,xe)}function Nc(n,t){return null!=n&&Ri(n,t,je);
17724}function Pc(n){return Hf(n)?Or(n):Me(n)}function qc(n){return Hf(n)?Or(n,!0):Fe(n)}function Zc(n,t){var r={};return t=mi(t,3),ue(n,function(n,e,u){Br(r,t(n,e,u),n)}),r}function Kc(n,t){var r={};return t=mi(t,3),ue(n,function(n,e,u){Br(r,e,t(n,e,u))}),r}function Vc(n,t){return Gc(n,Uf(mi(t)))}function Gc(n,t){if(null==n)return{};var r=c(di(n),function(n){return[n]});return t=mi(t),Ye(n,r,function(n,r){return t(n,r[0])})}function Hc(n,t,r){t=ku(t,n);var e=-1,u=t.length;for(u||(u=1,n=X);++e<u;){var i=null==n?X:n[no(t[e])];
17725i===X&&(e=u,i=r),n=uc(i)?i.call(n):i}return n}function Jc(n,t,r){return null==n?n:fu(n,t,r)}function Yc(n,t,r,e){return e="function"==typeof e?e:X,null==n?n:fu(n,t,r,e)}function Qc(n,t,e){var u=bh(n),i=u||mh(n)||Oh(n);if(t=mi(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:fc(n)&&uc(o)?gs(El(n)):{}}return(i?r:ue)(n,function(n,r,u){return t(e,n,r,u)}),e}function Xc(n,t){return null==n||yu(n,t)}function na(n,t,r){return null==n?n:du(n,t,Au(r))}function ta(n,t,r,e){return e="function"==typeof e?e:X,
17726null==n?n:du(n,t,Au(r),e)}function ra(n){return null==n?[]:E(n,Pc(n))}function ea(n){return null==n?[]:E(n,qc(n))}function ua(n,t,r){return r===X&&(r=t,t=X),r!==X&&(r=Ic(r),r=r===r?r:0),t!==X&&(t=Ic(t),t=t===t?t:0),Mr(Ic(n),t,r)}function ia(n,t,r){return t=Ac(t),r===X?(r=t,t=0):r=Ac(r),n=Ic(n),Ae(n,t,r)}function oa(n,t,r){if(r&&"boolean"!=typeof r&&Ui(n,t,r)&&(t=r=X),r===X&&("boolean"==typeof t?(r=t,t=X):"boolean"==typeof n&&(r=n,n=X)),n===X&&t===X?(n=0,t=1):(n=Ac(n),t===X?(t=n,n=0):t=Ac(t)),n>t){
17727var e=n;n=t,t=e}if(r||n%1||t%1){var u=Ql();return Hl(n+u*(t-n+Qr("1e-"+((u+"").length-1))),t)}return tu(n,t)}function fa(n){return Qh(Ec(n).toLowerCase())}function ca(n){return n=Ec(n),n&&n.replace(Gt,ve).replace(Dr,"")}function aa(n,t,r){n=Ec(n),t=vu(t);var e=n.length;r=r===X?e:Mr(kc(r),0,e);var u=r;return r-=t.length,r>=0&&n.slice(r,u)==t}function la(n){return n=Ec(n),n&&At.test(n)?n.replace(xt,ge):n}function sa(n){return n=Ec(n),n&&Wt.test(n)?n.replace(St,"\\$&"):n}function ha(n,t,r){n=Ec(n),t=kc(t);
17728var e=t?V(n):0;if(!t||e>=t)return n;var u=(t-e)/2;return ri(Nl(u),r)+n+ri(Fl(u),r)}function pa(n,t,r){n=Ec(n),t=kc(t);var e=t?V(n):0;return t&&e<t?n+ri(t-e,r):n}function _a(n,t,r){n=Ec(n),t=kc(t);var e=t?V(n):0;return t&&e<t?ri(t-e,r)+n:n}function va(n,t,r){return r||null==t?t=0:t&&(t=+t),Yl(Ec(n).replace(Lt,""),t||0)}function ga(n,t,r){return t=(r?Ui(n,t,r):t===X)?1:kc(t),eu(Ec(n),t)}function ya(){var n=arguments,t=Ec(n[0]);return n.length<3?t:t.replace(n[1],n[2])}function da(n,t,r){return r&&"number"!=typeof r&&Ui(n,t,r)&&(t=r=X),
17729(r=r===X?Un:r>>>0)?(n=Ec(n),n&&("string"==typeof t||null!=t&&!Ah(t))&&(t=vu(t),!t&&T(n))?Ou(G(n),0,r):n.split(t,r)):[]}function ba(n,t,r){return n=Ec(n),r=null==r?0:Mr(kc(r),0,n.length),t=vu(t),n.slice(r,r+t.length)==t}function wa(n,t,r){var e=Z.templateSettings;r&&Ui(n,t,r)&&(t=X),n=Ec(n),t=Sh({},t,e,li);var u,i,o=Sh({},t.imports,e.imports,li),f=Pc(o),c=E(o,f),a=0,l=t.interpolate||Ht,s="__p += '",h=sl((t.escape||Ht).source+"|"+l.source+"|"+(l===It?Ft:Ht).source+"|"+(t.evaluate||Ht).source+"|$","g"),p="//# sourceURL="+(bl.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zr+"]")+"\n";
17730n.replace(h,function(t,r,e,o,f,c){return e||(e=o),s+=n.slice(a,c).replace(Jt,U),r&&(u=!0,s+="' +\n__e("+r+") +\n'"),f&&(i=!0,s+="';\n"+f+";\n__p += '"),e&&(s+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),a=c+t.length,t}),s+="';\n";var _=bl.call(t,"variable")&&t.variable;if(_){if(Dt.test(_))throw new fl(un)}else s="with (obj) {\n"+s+"\n}\n";s=(i?s.replace(dt,""):s).replace(bt,"$1").replace(wt,"$1;"),s="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+s+"return __p\n}";
17731var v=Xh(function(){return cl(f,p+"return "+s).apply(X,c)});if(v.source=s,rc(v))throw v;return v}function ma(n){return Ec(n).toLowerCase()}function xa(n){return Ec(n).toUpperCase()}function ja(n,t,r){if(n=Ec(n),n&&(r||t===X))return R(n);if(!n||!(t=vu(t)))return n;var e=G(n),u=G(t);return Ou(e,W(e,u),L(e,u)+1).join("")}function Aa(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.slice(0,H(n)+1);if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,0,L(e,G(t))+1).join("")}function ka(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.replace(Lt,"");
17732if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,W(e,G(t))).join("")}function Oa(n,t){var r=An,e=kn;if(fc(t)){var u="separator"in t?t.separator:u;r="length"in t?kc(t.length):r,e="omission"in t?vu(t.omission):e}n=Ec(n);var i=n.length;if(T(n)){var o=G(n);i=o.length}if(r>=i)return n;var f=r-V(e);if(f<1)return e;var c=o?Ou(o,0,f).join(""):n.slice(0,f);if(u===X)return c+e;if(o&&(f+=c.length-f),Ah(u)){if(n.slice(f).search(u)){var a,l=c;for(u.global||(u=sl(u.source,Ec(Nt.exec(u))+"g")),u.lastIndex=0;a=u.exec(l);)var s=a.index;
17733c=c.slice(0,s===X?f:s)}}else if(n.indexOf(vu(u),f)!=f){var h=c.lastIndexOf(u);h>-1&&(c=c.slice(0,h))}return c+e}function Ia(n){return n=Ec(n),n&&jt.test(n)?n.replace(mt,ye):n}function Ra(n,t,r){return n=Ec(n),t=r?X:t,t===X?$(n)?Q(n):_(n):n.match(t)||[]}function za(t){var r=null==t?0:t.length,e=mi();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new pl(en);return[e(n[0]),n[1]]}):[],uu(function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}})}function Ea(n){
17734return Nr(Fr(n,an))}function Sa(n){return function(){return n}}function Wa(n,t){return null==n||n!==n?t:n}function La(n){return n}function Ca(n){return De("function"==typeof n?n:Fr(n,an))}function Ua(n){return qe(Fr(n,an))}function Ba(n,t){return Ze(n,Fr(t,an))}function Ta(n,t,e){var u=Pc(t),i=fe(t,u);null!=e||fc(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=fe(t,Pc(t)));var o=!(fc(e)&&"chain"in e&&!e.chain),f=uc(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;
17735if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Tu(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function $a(){return re._===this&&(re._=Al),this}function Da(){}function Ma(n){return n=kc(n),uu(function(t){return Ge(t,n)})}function Fa(n){return Bi(n)?m(no(n)):Qe(n)}function Na(n){return function(t){return null==n?X:_e(n,t)}}function Pa(){return[]}function qa(){return!1}function Za(){return{}}function Ka(){return"";
17736}function Va(){return!0}function Ga(n,t){if(n=kc(n),n<1||n>Wn)return[];var r=Un,e=Hl(n,Un);t=mi(t),n-=Un;for(var u=O(e,t);++r<n;)t(r);return u}function Ha(n){return bh(n)?c(n,no):bc(n)?[n]:Tu(Cs(Ec(n)))}function Ja(n){var t=++wl;return Ec(n)+t}function Ya(n){return n&&n.length?Yr(n,La,me):X}function Qa(n,t){return n&&n.length?Yr(n,mi(t,2),me):X}function Xa(n){return w(n,La)}function nl(n,t){return w(n,mi(t,2))}function tl(n){return n&&n.length?Yr(n,La,Ne):X}function rl(n,t){return n&&n.length?Yr(n,mi(t,2),Ne):X;
17737}function el(n){return n&&n.length?k(n,La):0}function ul(n,t){return n&&n.length?k(n,mi(t,2)):0}x=null==x?re:be.defaults(re.Object(),x,be.pick(re,qr));var il=x.Array,ol=x.Date,fl=x.Error,cl=x.Function,al=x.Math,ll=x.Object,sl=x.RegExp,hl=x.String,pl=x.TypeError,_l=il.prototype,vl=cl.prototype,gl=ll.prototype,yl=x["__core-js_shared__"],dl=vl.toString,bl=gl.hasOwnProperty,wl=0,ml=function(){var n=/[^.]+$/.exec(yl&&yl.keys&&yl.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),xl=gl.toString,jl=dl.call(ll),Al=re._,kl=sl("^"+dl.call(bl).replace(St,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ol=ie?x.Buffer:X,Il=x.Symbol,Rl=x.Uint8Array,zl=Ol?Ol.allocUnsafe:X,El=F(ll.getPrototypeOf,ll),Sl=ll.create,Wl=gl.propertyIsEnumerable,Ll=_l.splice,Cl=Il?Il.isConcatSpreadable:X,Ul=Il?Il.iterator:X,Bl=Il?Il.toStringTag:X,Tl=function(){
17738try{var n=Ai(ll,"defineProperty");return n({},"",{}),n}catch(n){}}(),$l=x.clearTimeout!==re.clearTimeout&&x.clearTimeout,Dl=ol&&ol.now!==re.Date.now&&ol.now,Ml=x.setTimeout!==re.setTimeout&&x.setTimeout,Fl=al.ceil,Nl=al.floor,Pl=ll.getOwnPropertySymbols,ql=Ol?Ol.isBuffer:X,Zl=x.isFinite,Kl=_l.join,Vl=F(ll.keys,ll),Gl=al.max,Hl=al.min,Jl=ol.now,Yl=x.parseInt,Ql=al.random,Xl=_l.reverse,ns=Ai(x,"DataView"),ts=Ai(x,"Map"),rs=Ai(x,"Promise"),es=Ai(x,"Set"),us=Ai(x,"WeakMap"),is=Ai(ll,"create"),os=us&&new us,fs={},cs=to(ns),as=to(ts),ls=to(rs),ss=to(es),hs=to(us),ps=Il?Il.prototype:X,_s=ps?ps.valueOf:X,vs=ps?ps.toString:X,gs=function(){
17739function n(){}return function(t){if(!fc(t))return{};if(Sl)return Sl(t);n.prototype=t;var r=new n;return n.prototype=X,r}}();Z.templateSettings={escape:kt,evaluate:Ot,interpolate:It,variable:"",imports:{_:Z}},Z.prototype=J.prototype,Z.prototype.constructor=Z,Y.prototype=gs(J.prototype),Y.prototype.constructor=Y,Ct.prototype=gs(J.prototype),Ct.prototype.constructor=Ct,Xt.prototype.clear=nr,Xt.prototype.delete=tr,Xt.prototype.get=rr,Xt.prototype.has=er,Xt.prototype.set=ur,ir.prototype.clear=or,ir.prototype.delete=fr,
17740ir.prototype.get=cr,ir.prototype.has=ar,ir.prototype.set=lr,sr.prototype.clear=hr,sr.prototype.delete=pr,sr.prototype.get=_r,sr.prototype.has=vr,sr.prototype.set=gr,yr.prototype.add=yr.prototype.push=dr,yr.prototype.has=br,wr.prototype.clear=mr,wr.prototype.delete=xr,wr.prototype.get=jr,wr.prototype.has=Ar,wr.prototype.set=kr;var ys=Pu(ue),ds=Pu(oe,!0),bs=qu(),ws=qu(!0),ms=os?function(n,t){return os.set(n,t),n}:La,xs=Tl?function(n,t){return Tl(n,"toString",{configurable:!0,enumerable:!1,value:Sa(t),
17741writable:!0})}:La,js=uu,As=$l||function(n){return re.clearTimeout(n)},ks=es&&1/P(new es([,-0]))[1]==Sn?function(n){return new es(n)}:Da,Os=os?function(n){return os.get(n)}:Da,Is=Pl?function(n){return null==n?[]:(n=ll(n),i(Pl(n),function(t){return Wl.call(n,t)}))}:Pa,Rs=Pl?function(n){for(var t=[];n;)a(t,Is(n)),n=El(n);return t}:Pa,zs=we;(ns&&zs(new ns(new ArrayBuffer(1)))!=ct||ts&&zs(new ts)!=Gn||rs&&zs(rs.resolve())!=Qn||es&&zs(new es)!=tt||us&&zs(new us)!=it)&&(zs=function(n){var t=we(n),r=t==Yn?n.constructor:X,e=r?to(r):"";
17742if(e)switch(e){case cs:return ct;case as:return Gn;case ls:return Qn;case ss:return tt;case hs:return it}return t});var Es=yl?uc:qa,Ss=Qi(ms),Ws=Ml||function(n,t){return re.setTimeout(n,t)},Ls=Qi(xs),Cs=Pi(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(Et,function(n,r,e,u){t.push(e?u.replace(Mt,"$1"):r||n)}),t}),Us=uu(function(n,t){return Jf(n)?Hr(n,ee(t,1,Jf,!0)):[]}),Bs=uu(function(n,t){var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),mi(r,2)):[]}),Ts=uu(function(n,t){
17743var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),X,r):[]}),$s=uu(function(n){var t=c(n,ju);return t.length&&t[0]===n[0]?ke(t):[]}),Ds=uu(function(n){var t=jo(n),r=c(n,ju);return t===jo(r)?t=X:r.pop(),r.length&&r[0]===n[0]?ke(r,mi(t,2)):[]}),Ms=uu(function(n){var t=jo(n),r=c(n,ju);return t="function"==typeof t?t:X,t&&r.pop(),r.length&&r[0]===n[0]?ke(r,X,t):[]}),Fs=uu(Oo),Ns=gi(function(n,t){var r=null==n?0:n.length,e=Tr(n,t);return nu(n,c(t,function(n){return Ci(n,r)?+n:n}).sort(Lu)),e}),Ps=uu(function(n){
17744return gu(ee(n,1,Jf,!0))}),qs=uu(function(n){var t=jo(n);return Jf(t)&&(t=X),gu(ee(n,1,Jf,!0),mi(t,2))}),Zs=uu(function(n){var t=jo(n);return t="function"==typeof t?t:X,gu(ee(n,1,Jf,!0),X,t)}),Ks=uu(function(n,t){return Jf(n)?Hr(n,t):[]}),Vs=uu(function(n){return mu(i(n,Jf))}),Gs=uu(function(n){var t=jo(n);return Jf(t)&&(t=X),mu(i(n,Jf),mi(t,2))}),Hs=uu(function(n){var t=jo(n);return t="function"==typeof t?t:X,mu(i(n,Jf),X,t)}),Js=uu(Go),Ys=uu(function(n){var t=n.length,r=t>1?n[t-1]:X;return r="function"==typeof r?(n.pop(),
17745r):X,Ho(n,r)}),Qs=gi(function(n){var t=n.length,r=t?n[0]:0,e=this.__wrapped__,u=function(t){return Tr(t,n)};return!(t>1||this.__actions__.length)&&e instanceof Ct&&Ci(r)?(e=e.slice(r,+r+(t?1:0)),e.__actions__.push({func:nf,args:[u],thisArg:X}),new Y(e,this.__chain__).thru(function(n){return t&&!n.length&&n.push(X),n})):this.thru(u)}),Xs=Fu(function(n,t,r){bl.call(n,r)?++n[r]:Br(n,r,1)}),nh=Ju(ho),th=Ju(po),rh=Fu(function(n,t,r){bl.call(n,r)?n[r].push(t):Br(n,r,[t])}),eh=uu(function(t,r,e){var u=-1,i="function"==typeof r,o=Hf(t)?il(t.length):[];
17746return ys(t,function(t){o[++u]=i?n(r,t,e):Ie(t,r,e)}),o}),uh=Fu(function(n,t,r){Br(n,r,t)}),ih=Fu(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),oh=uu(function(n,t){if(null==n)return[];var r=t.length;return r>1&&Ui(n,t[0],t[1])?t=[]:r>2&&Ui(t[0],t[1],t[2])&&(t=[t[0]]),He(n,ee(t,1),[])}),fh=Dl||function(){return re.Date.now()},ch=uu(function(n,t,r){var e=_n;if(r.length){var u=N(r,wi(ch));e|=bn}return ai(n,e,t,r,u)}),ah=uu(function(n,t,r){var e=_n|vn;if(r.length){var u=N(r,wi(ah));e|=bn;
17747}return ai(t,e,n,r,u)}),lh=uu(function(n,t){return Gr(n,1,t)}),sh=uu(function(n,t,r){return Gr(n,Ic(t)||0,r)});Cf.Cache=sr;var hh=js(function(t,r){r=1==r.length&&bh(r[0])?c(r[0],z(mi())):c(ee(r,1),z(mi()));var e=r.length;return uu(function(u){for(var i=-1,o=Hl(u.length,e);++i<o;)u[i]=r[i].call(this,u[i]);return n(t,this,u)})}),ph=uu(function(n,t){return ai(n,bn,X,t,N(t,wi(ph)))}),_h=uu(function(n,t){return ai(n,wn,X,t,N(t,wi(_h)))}),vh=gi(function(n,t){return ai(n,xn,X,X,X,t)}),gh=ii(me),yh=ii(function(n,t){
17748return n>=t}),dh=Re(function(){return arguments}())?Re:function(n){return cc(n)&&bl.call(n,"callee")&&!Wl.call(n,"callee")},bh=il.isArray,wh=ce?z(ce):ze,mh=ql||qa,xh=ae?z(ae):Ee,jh=le?z(le):Le,Ah=se?z(se):Be,kh=he?z(he):Te,Oh=pe?z(pe):$e,Ih=ii(Ne),Rh=ii(function(n,t){return n<=t}),zh=Nu(function(n,t){if(Mi(t)||Hf(t))return $u(t,Pc(t),n),X;for(var r in t)bl.call(t,r)&&Sr(n,r,t[r])}),Eh=Nu(function(n,t){$u(t,qc(t),n)}),Sh=Nu(function(n,t,r,e){$u(t,qc(t),n,e)}),Wh=Nu(function(n,t,r,e){$u(t,Pc(t),n,e);
17749}),Lh=gi(Tr),Ch=uu(function(n,t){n=ll(n);var r=-1,e=t.length,u=e>2?t[2]:X;for(u&&Ui(t[0],t[1],u)&&(e=1);++r<e;)for(var i=t[r],o=qc(i),f=-1,c=o.length;++f<c;){var a=o[f],l=n[a];(l===X||Gf(l,gl[a])&&!bl.call(n,a))&&(n[a]=i[a])}return n}),Uh=uu(function(t){return t.push(X,si),n(Mh,X,t)}),Bh=Xu(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=xl.call(t)),n[t]=r},Sa(La)),Th=Xu(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=xl.call(t)),bl.call(n,t)?n[t].push(r):n[t]=[r]},mi),$h=uu(Ie),Dh=Nu(function(n,t,r){
17750Ke(n,t,r)}),Mh=Nu(function(n,t,r,e){Ke(n,t,r,e)}),Fh=gi(function(n,t){var r={};if(null==n)return r;var e=!1;t=c(t,function(t){return t=ku(t,n),e||(e=t.length>1),t}),$u(n,di(n),r),e&&(r=Fr(r,an|ln|sn,hi));for(var u=t.length;u--;)yu(r,t[u]);return r}),Nh=gi(function(n,t){return null==n?{}:Je(n,t)}),Ph=ci(Pc),qh=ci(qc),Zh=Vu(function(n,t,r){return t=t.toLowerCase(),n+(r?fa(t):t)}),Kh=Vu(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Vh=Vu(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),Gh=Ku("toLowerCase"),Hh=Vu(function(n,t,r){
17751return n+(r?"_":"")+t.toLowerCase()}),Jh=Vu(function(n,t,r){return n+(r?" ":"")+Qh(t)}),Yh=Vu(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),Qh=Ku("toUpperCase"),Xh=uu(function(t,r){try{return n(t,X,r)}catch(n){return rc(n)?n:new fl(n)}}),np=gi(function(n,t){return r(t,function(t){t=no(t),Br(n,t,ch(n[t],n))}),n}),tp=Yu(),rp=Yu(!0),ep=uu(function(n,t){return function(r){return Ie(r,n,t)}}),up=uu(function(n,t){return function(r){return Ie(n,r,t)}}),ip=ti(c),op=ti(u),fp=ti(h),cp=ui(),ap=ui(!0),lp=ni(function(n,t){
17752return n+t},0),sp=fi("ceil"),hp=ni(function(n,t){return n/t},1),pp=fi("floor"),_p=ni(function(n,t){return n*t},1),vp=fi("round"),gp=ni(function(n,t){return n-t},0);return Z.after=If,Z.ary=Rf,Z.assign=zh,Z.assignIn=Eh,Z.assignInWith=Sh,Z.assignWith=Wh,Z.at=Lh,Z.before=zf,Z.bind=ch,Z.bindAll=np,Z.bindKey=ah,Z.castArray=Nf,Z.chain=Qo,Z.chunk=uo,Z.compact=io,Z.concat=oo,Z.cond=za,Z.conforms=Ea,Z.constant=Sa,Z.countBy=Xs,Z.create=Sc,Z.curry=Ef,Z.curryRight=Sf,Z.debounce=Wf,Z.defaults=Ch,Z.defaultsDeep=Uh,
17753Z.defer=lh,Z.delay=sh,Z.difference=Us,Z.differenceBy=Bs,Z.differenceWith=Ts,Z.drop=fo,Z.dropRight=co,Z.dropRightWhile=a
vendor: 4,525 bytes, lines 17753-17762
17753o,Z.dropWhile=lo,Z.fill=so,Z.filter=lf,Z.flatMap=sf,Z.flatMapDeep=hf,Z.flatMapDepth=pf,Z.flatten=_o,Z.flattenDeep=vo,Z.flattenDepth=go,Z.flip=Lf,Z.flow=tp,Z.flowRight=rp,Z.fromPairs=yo,Z.functions=$c,Z.functionsIn=Dc,Z.groupBy=rh,Z.initial=mo,Z.intersection=$s,Z.intersectionBy=Ds,Z.intersectionWith=Ms,Z.invert=Bh,Z.invertBy=Th,Z.invokeMap=eh,Z.iteratee=Ca,Z.keyBy=uh,Z.keys=Pc,Z.keysIn=qc,
17754Z.map=yf,Z.mapKeys=Zc,Z.mapValues=Kc,Z.matches=Ua,Z.matchesProperty=Ba,Z.memoize=Cf,Z.merge=Dh,Z.mergeWith=Mh,Z.method=ep,Z.methodOf=up,Z.mixin=Ta,Z.negate=Uf,Z.nthArg=Ma,Z.omit=Fh,Z.omitBy=Vc,Z.once=Bf,Z.orderBy=df,Z.over=ip,Z.overArgs=hh,Z.overEvery=op,Z.overSome=fp,Z.partial=ph,Z.partialRight=_h,Z.partition=ih,Z.pick=Nh,Z.pickBy=Gc,Z.property=Fa,Z.propertyOf=Na,Z.pull=Fs,Z.pullAll=Oo,Z.pullAllBy=Io,Z.pullAllWith=Ro,Z.pullAt=Ns,Z.range=cp,Z.rangeRight=ap,Z.rearg=vh,Z.reject=mf,Z.remove=zo,Z.rest=Tf,
17755Z.reverse=Eo,Z.sampleSize=jf,Z.set=Jc,Z.setWith=Yc,Z.shuffle=Af,Z.slice=So,Z.sortBy=oh,Z.sortedUniq=$o,Z.sortedUniqBy=Do,Z.split=da,Z.spread=$f,Z.tail=Mo,Z.take=Fo,Z.takeRight=No,Z.takeRightWhile=Po,Z.takeWhile=qo,Z.tap=Xo,Z.throttle=Df,Z.thru=nf,Z.toArray=jc,Z.toPairs=Ph,Z.toPairsIn=qh,Z.toPath=Ha,Z.toPlainObject=Rc,Z.transform=Qc,Z.unary=Mf,Z.union=Ps,Z.unionBy=qs,Z.unionWith=Zs,Z.uniq=Zo,Z.uniqBy=Ko,Z.uniqWith=Vo,Z.unset=Xc,Z.unzip=Go,Z.unzipWith=Ho,Z.update=na,Z.updateWith=ta,Z.values=ra,Z.valuesIn=ea,
17756Z.without=Ks,Z.words=Ra,Z.wrap=Ff,Z.xor=Vs,Z.xorBy=Gs,Z.xorWith=Hs,Z.zip=Js,Z.zipObject=Jo,Z.zipObjectDeep=Yo,Z.zipWith=Ys,Z.entries=Ph,Z.entriesIn=qh,Z.extend=Eh,Z.extendWith=Sh,Ta(Z,Z),Z.add=lp,Z.attempt=Xh,Z.camelCase=Zh,Z.capitalize=fa,Z.ceil=sp,Z.clamp=ua,Z.clone=Pf,Z.cloneDeep=Zf,Z.cloneDeepWith=Kf,Z.cloneWith=qf,Z.conformsTo=Vf,Z.deburr=ca,Z.defaultTo=Wa,Z.divide=hp,Z.endsWith=aa,Z.eq=Gf,Z.escape=la,Z.escapeRegExp=sa,Z.every=af,Z.find=nh,Z.findIndex=ho,Z.findKey=Wc,Z.findLast=th,Z.findLastIndex=po,
17757Z.findLastKey=Lc,Z.floor=pp,Z.forEach=_f,Z.forEachRight=vf,Z.forIn=Cc,Z.forInRight=Uc,Z.forOwn=Bc,Z.forOwnRight=Tc,Z.get=Mc,Z.gt=gh,Z.gte=yh,Z.has=Fc,Z.hasIn=Nc,Z.head=bo,Z.identity=La,Z.includes=gf,Z.indexOf=wo,Z.inRange=ia,Z.invoke=$h,Z.isArguments=dh,Z.isArray=bh,Z.isArrayBuffer=wh,Z.isArrayLike=Hf,Z.isArrayLikeObject=Jf,Z.isBoolean=Yf,Z.isBuffer=mh,Z.isDate=xh,Z.isElement=Qf,Z.isEmpty=Xf,Z.isEqual=nc,Z.isEqualWith=tc,Z.isError=rc,Z.isFinite=ec,Z.isFunction=uc,Z.isInteger=ic,Z.isLength=oc,Z.isMap=jh,
17758Z.isMatch=ac,Z.isMatchWith=lc,Z.isNaN=sc,Z.isNative=hc,Z.isNil=_c,Z.isNull=pc,Z.isNumber=vc,Z.isObject=fc,Z.isObjectLike=cc,Z.isPlainObject=gc,Z.isRegExp=Ah,Z.isSafeInteger=yc,Z.isSet=kh,Z.isString=dc,Z.isSymbol=bc,Z.isTypedArray=Oh,Z.isUndefined=wc,Z.isWeakMap=mc,Z.isWeakSet=xc,Z.join=xo,Z.kebabCase=Kh,Z.last=jo,Z.lastIndexOf=Ao,Z.lowerCase=Vh,Z.lowerFirst=Gh,Z.lt=Ih,Z.lte=Rh,Z.max=Ya,Z.maxBy=Qa,Z.mean=Xa,Z.meanBy=nl,Z.min=tl,Z.minBy=rl,Z.stubArray=Pa,Z.stubFalse=qa,Z.stubObject=Za,Z.stubString=Ka,
17759Z.stubTrue=Va,Z.multiply=_p,Z.nth=ko,Z.noConflict=$a,Z.noop=Da,Z.now=fh,Z.pad=ha,Z.padEnd=pa,Z.padStart=_a,Z.parseInt=va,Z.random=oa,Z.reduce=bf,Z.reduceRight=wf,Z.repeat=ga,Z.replace=ya,Z.result=Hc,Z.round=vp,Z.runInContext=p,Z.sample=xf,Z.size=kf,Z.snakeCase=Hh,Z.some=Of,Z.sortedIndex=Wo,Z.sortedIndexBy=Lo,Z.sortedIndexOf=Co,Z.sortedLastIndex=Uo,Z.sortedLastIndexBy=Bo,Z.sortedLastIndexOf=To,Z.startCase=Jh,Z.startsWith=ba,Z.subtract=gp,Z.sum=el,Z.sumBy=ul,Z.template=wa,Z.times=Ga,Z.toFinite=Ac,Z.toInteger=kc,
17760Z.toLength=Oc,Z.toLower=ma,Z.toNumber=Ic,Z.toSafeInteger=zc,Z.toString=Ec,Z.toUpper=xa,Z.trim=ja,Z.trimEnd=Aa,Z.trimStart=ka,Z.truncate=Oa,Z.unescape=Ia,Z.uniqueId=Ja,Z.upperCase=Yh,Z.upperFirst=Qh,Z.each=_f,Z.eachRight=vf,Z.first=bo,Ta(Z,function(){var n={};return ue(Z,function(t,r){bl.call(Z.prototype,r)||(n[r]=t)}),n}(),{chain:!1}),Z.VERSION=nn,r(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){Z[n].placeholder=Z}),r(["drop","take"],function(n,t){Ct.prototype[n]=function(r){
17761r=r===X?1:Gl(kc(r),0);var e=this.__filtered__&&!t?new Ct(this):this.clone();return e.__filtered__?e.__takeCount__=Hl(r,e.__takeCount__):e.__views__.push({size:Hl(r,Un),type:n+(e.__dir__<0?"Right":"")}),e},Ct.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=r==Rn||r==En;Ct.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:mi(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){
17762var r="take"+(t?"Right":"");
vendor: 2,529 bytes, lines 17762-17766
17762Ct.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Ct.prototype[n]=function(){return this.__filtered__?new Ct(this):this[r](1)}}),Ct.prototype.compact=function(){return this.filter(La)},Ct.prototype.find=function(n){return this.filter(n).head()},Ct.prototype.findLast=function(n){return this.reverse().find(n)},Ct.prototype.invokeMap=uu(function(n,t){return"function"==typeof n?new Ct(this):this.map(function(r){
17763return Ie(r,n,t)})}),Ct.prototype.reject=function(n){return this.filter(Uf(mi(n)))},Ct.prototype.slice=function(n,t){n=kc(n);var r=this;return r.__filtered__&&(n>0||t<0)?new Ct(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==X&&(t=kc(t),r=t<0?r.dropRight(-t):r.take(t-n)),r)},Ct.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ct.prototype.toArray=function(){return this.take(Un)},ue(Ct.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=Z[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);
17764u&&(Z.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,f=t instanceof Ct,c=o[0],l=f||bh(t),s=function(n){var t=u.apply(Z,a([n],o));return e&&h?t[0]:t};l&&r&&"function"==typeof c&&1!=c.length&&(f=l=!1);var h=this.__chain__,p=!!this.__actions__.length,_=i&&!h,v=f&&!p;if(!i&&l){t=v?t:new Ct(this);var g=n.apply(t,o);return g.__actions__.push({func:nf,args:[s],thisArg:X}),new Y(g,h)}return _&&v?n.apply(this,o):(g=this.thru(s),_?e?g.value()[0]:g.value():g)})}),r(["pop","push","shift","sort","splice","unshift"],function(n){
17765var t=_l[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);Z.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(bh(u)?u:[],n)}return this[r](function(r){return t.apply(bh(r)?r:[],n)})}}),ue(Ct.prototype,function(n,t){var r=Z[t];if(r){var e=r.name+"";bl.call(fs,e)||(fs[e]=[]),fs[e].push({name:t,func:r})}}),fs[Qu(X,vn).name]=[{name:"wrapper",func:X}],Ct.prototype.clone=$t,Ct.prototype.reverse=Yt,Ct.prototype.value=Qt,Z.prototype.at=Qs,
17766Z.prototype.chain=tf,Z.prototype.commit=rf,Z.prototype.next=ef,Z.prototype.plant=of,Z.prototype.reverse=ff,Z.prototype.toJSON=Z.prototype.valueOf=Z.prototype.value=cf,Z.prototype.first=Z.prototype.head,Ul&&(Z.prototype[Ul]=uf),Z},be=de();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(re._=be,define(function(){return be})):ue?((ue.exports=be)._=be,ee._=be):re._=be}).call(this);;

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