(function(c,b){function a(a,b){var f=a.nodeName.toLowerCase();if("area"===f){var f=a.parentNode,h=f.name;if(!a.href||!h||"map"!==f.nodeName.toLowerCase())return!1;f=c("img[usemap=#"+h+"]")[0];return!!f&&d(f)}return(/input|select|textarea|button|object/.test(f)?!a.disabled:"a"==f?a.href||b:b)&&d(a)}function d(a){return!c(a).parents().andSelf().filter(function(){return"hidden"===c.curCSS(this,"visibility")||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};c.ui.version||(c.extend(c.ui,{version:"1.8.23",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return"number"===typeof a?this.each(function(){var f=
this;setTimeout(function(){c(f).focus();b&&b.call(f)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==b)return this.css("zIndex",a);if(this.length)for(var a=c(this[0]),g;a.length&&a[0]!==document;){g=a.css("position");if("absolute"===g||"relative"===g||"fixed"===g)if(g=parseInt(a.css("zIndex"),10),!isNaN(g)&&0!==g)return g;a=a.parent()}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),c("<a>").outerWidth(1).jquery||c.each(["Width","Height"],function(a,g){function f(a,b,e,f){c.each(d,function(){b-=parseFloat(c.curCSS(a,"padding"+this,!0))||0;e&&(b-=parseFloat(c.curCSS(a,"border"+this+"Width",!0))||0);f&&(b-=parseFloat(c.curCSS(a,"margin"+this,!0))||0)});return b}var d="Width"===g?["Left","Right"]:["Top","Bottom"],i=g.toLowerCase(),l={innerWidth:c.fn.innerWidth,
innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+g]=function(a){return a===b?l["inner"+g].call(this):this.each(function(){c(this).css(i,f(this,a)+"px")})};c.fn["outer"+g]=function(a,b){return"number"!==typeof a?l["outer"+g].call(this,a):this.each(function(){c(this).css(i,f(this,a,!0,b)+"px")})}}),c.extend(c.expr[":"],{data:c.expr.createPseudo?c.expr.createPseudo(function(a){return function(b){return!!c.data(b,a)}}):function(a,b,f){return!!c.data(a,
f[3])},focusable:function(b){return a(b,!isNaN(c.attr(b,"tabindex")))},tabbable:function(b){var g=c.attr(b,"tabindex"),f=isNaN(g);return(f||0<=g)&&a(b,!f)}}),c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));b.offsetHeight;c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=100===b.offsetHeight;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"}),c.curCSS||(c.curCSS=c.css),c.extend(c.ui,{plugin:{add:function(a,
b,f){var a=c.ui[a].prototype,d;for(d in f){a.plugins[d]=a.plugins[d]||[];a.plugins[d].push([b,f[d]])}},call:function(a,c,b){if((c=a.plugins[c])&&a.element[0].parentNode)for(var d=0;d<c.length;d++)a.options[c[d][0]]&&c[d][1].apply(a.element,b)}},contains:function(a,c){return document.compareDocumentPosition?a.compareDocumentPosition(c)&16:a!==c&&a.contains(c)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;var f=b&&b==="left"?"scrollLeft":"scrollTop",d=false;if(a[f]>0)return true;
a[f]=1;d=a[f]>0;a[f]=0;return d},isOverAxis:function(a,c,b){return a>c&&a<c+b},isOver:function(a,b,d,h,i,l){return c.ui.isOverAxis(a,d,i)&&c.ui.isOverAxis(b,h,l)}}))})(jQuery);
(function(c,b){if(c.cleanData){var a=c.cleanData;c.cleanData=function(b){for(var d=0,f;null!=(f=b[d]);d++)try{c(f).triggerHandler("remove")}catch(h){}a(b)}}else{var d=c.fn.remove;c.fn.remove=function(a,b){return this.each(function(){b||(!a||c.filter(a,[this]).length)&&c("*",this).add([this]).each(function(){try{c(this).triggerHandler("remove")}catch(a){}});return d.call(c(this),a,b)})}}c.widget=function(a,b,d){var h=a.split(".")[0],i,a=a.split(".")[1];i=h+"-"+a;d||(d=b,b=c.Widget);c.expr[":"][i]=
function(b){return!!c.data(b,a)};c[h]=c[h]||{};c[h][a]=function(a,b){arguments.length&&this._createWidget(a,b)};b=new b;b.options=c.extend(!0,{},b.options);c[h][a].prototype=c.extend(!0,b,{namespace:h,widgetName:a,widgetEventPrefix:c[h][a].prototype.widgetEventPrefix||a,widgetBaseClass:i},d);c.widget.bridge(a,c[h][a])};c.widget.bridge=function(a,d){c.fn[a]=function(f){var h="string"===typeof f,i=Array.prototype.slice.call(arguments,1),l=this,f=!h&&i.length?c.extend.apply(null,[!0,f].concat(i)):f;
if(h&&"_"===f.charAt(0))return l;h?this.each(function(){var d=c.data(this,a),g=d&&c.isFunction(d[f])?d[f].apply(d,i):d;if(g!==d&&g!==b)return l=g,!1}):this.each(function(){var b=c.data(this,a);b?b.option(f||{})._init():c.data(this,a,new d(f,this))});return l}};c.Widget=function(a,b){arguments.length&&this._createWidget(a,b)};c.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(a,b){c.data(b,this.widgetName,this);this.element=c(b);this.options=c.extend(!0,
{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return c.metadata&&c.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,d){var f=a;if(0===arguments.length)return c.extend({},this.options);if("string"===typeof a){if(d===b)return this.options[a];f={};f[a]=d}this._setOptions(f);return this},_setOptions:function(a){var b=this;c.each(a,function(a,c){b._setOption(a,c)});return this},_setOption:function(a,b){this.options[a]=b;"disabled"===a&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
b);return this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(a,b,d){var h,i=this.options[a],d=d||{},b=c.Event(b);b.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();b.target=this.element[0];if(a=b.originalEvent)for(h in a)h in b||(b[h]=a[h]);this.element.trigger(b,d);return!(c.isFunction(i)&&!1===i.call(this.element[0],b,d)||b.isDefaultPrevented())}}})(jQuery);
(function(c){var b=!1;c(document).mouseup(function(){b=!1});c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(!0===c.data(b.target,a.widgetName+".preventClickEvent"))return c.removeData(b.target,a.widgetName+".preventClickEvent"),b.stopImmediatePropagation(),!1});this.started=!1},_mouseDestroy:function(){this.element.unbind("."+
this.widgetName);this._mouseMoveDelegate&&c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(a){if(!b){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var d=this,e=1==a.which,g="string"==typeof this.options.cancel&&a.target.nodeName?c(a.target).closest(this.options.cancel).length:!1;if(!e||g||!this._mouseCapture(a))return!0;this.mouseDelayMet=!this.options.delay;this.mouseDelayMet||(this._mouseDelayTimer=
setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)&&(this._mouseStarted=!1!==this._mouseStart(a),!this._mouseStarted))return a.preventDefault(),!0;!0===c.data(a.target,this.widgetName+".preventClickEvent")&&c.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(a){return d._mouseMove(a)};this._mouseUpDelegate=function(a){return d._mouseUp(a)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+
this.widgetName,this._mouseUpDelegate);a.preventDefault();return b=!0}},_mouseMove:function(a){if(c.browser.msie&&!(9<=document.documentMode)&&!a.button)return this._mouseUp(a);if(this._mouseStarted)return this._mouseDrag(a),a.preventDefault();this._mouseDistanceMet(a)&&this._mouseDelayMet(a)&&((this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,a))?this._mouseDrag(a):this._mouseUp(a));return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+
this.widgetName,this._mouseUpDelegate);this._mouseStarted&&(this._mouseStarted=!1,a.target==this._mouseDownEvent.target&&c.data(a.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(a));return!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);
(function(c){c.ui=c.ui||{};var b=/left|center|right/,a=/top|center|bottom/,d,e=c.fn.position,g=c.fn.offset;c.fn.position=function(f){if(!f||!f.of)return e.apply(this,arguments);var f=c.extend({},f),g=c(f.of),i=g[0],l=(f.collision||"flip").split(" "),m=f.offset?f.offset.split(" "):[0,0],j,o,k;9===i.nodeType?(j=g.width(),o=g.height(),k={top:0,left:0}):i.setTimeout?(j=g.width(),o=g.height(),k={top:g.scrollTop(),left:g.scrollLeft()}):i.preventDefault?(f.at="left top",j=o=0,k={top:f.of.pageY,left:f.of.pageX}):
(j=g.outerWidth(),o=g.outerHeight(),k=g.offset());c.each(["my","at"],function(){var c=(f[this]||"").split(" ");c.length===1&&(c=b.test(c[0])?c.concat(["center"]):a.test(c[0])?["center"].concat(c):["center","center"]);c[0]=b.test(c[0])?c[0]:"center";c[1]=a.test(c[1])?c[1]:"center";f[this]=c});1===l.length&&(l[1]=l[0]);m[0]=parseInt(m[0],10)||0;1===m.length&&(m[1]=m[0]);m[1]=parseInt(m[1],10)||0;"right"===f.at[0]?k.left+=j:"center"===f.at[0]&&(k.left+=j/2);"bottom"===f.at[1]?k.top+=o:"center"===f.at[1]&&
(k.top+=o/2);k.left+=m[0];k.top+=m[1];return this.each(function(){var a=c(this),b=a.outerWidth(),g=a.outerHeight(),e=parseInt(c.curCSS(this,"marginLeft",true))||0,h=parseInt(c.curCSS(this,"marginTop",true))||0,i=b+e+(parseInt(c.curCSS(this,"marginRight",true))||0),q=g+h+(parseInt(c.curCSS(this,"marginBottom",true))||0),n=c.extend({},k),p;if(f.my[0]==="right")n.left=n.left-b;else if(f.my[0]==="center")n.left=n.left-b/2;if(f.my[1]==="bottom")n.top=n.top-g;else if(f.my[1]==="center")n.top=n.top-g/2;
if(!d){n.left=Math.round(n.left);n.top=Math.round(n.top)}p={left:n.left-e,top:n.top-h};c.each(["left","top"],function(a,d){if(c.ui.position[l[a]])c.ui.position[l[a]][d](n,{targetWidth:j,targetHeight:o,elemWidth:b,elemHeight:g,collisionPosition:p,collisionWidth:i,collisionHeight:q,offset:m,my:f.my,at:f.at})});c.fn.bgiframe&&a.bgiframe();a.offset(c.extend(n,{using:f.using}))})};c.ui.position={fit:{left:function(a,b){var d=c(window),d=b.collisionPosition.left+b.collisionWidth-d.width()-d.scrollLeft();
a.left=0<d?a.left-d:Math.max(a.left-b.collisionPosition.left,a.left)},top:function(a,b){var d=c(window),d=b.collisionPosition.top+b.collisionHeight-d.height()-d.scrollTop();a.top=0<d?a.top-d:Math.max(a.top-b.collisionPosition.top,a.top)}},flip:{left:function(a,b){if("center"!==b.at[0]){var d=c(window),d=b.collisionPosition.left+b.collisionWidth-d.width()-d.scrollLeft(),g="left"===b.my[0]?-b.elemWidth:"right"===b.my[0]?b.elemWidth:0,e="left"===b.at[0]?b.targetWidth:-b.targetWidth,j=-2*b.offset[0];
a.left+=0>b.collisionPosition.left?g+e+j:0<d?g+e+j:0}},top:function(a,b){if("center"!==b.at[1]){var d=c(window),d=b.collisionPosition.top+b.collisionHeight-d.height()-d.scrollTop(),g="top"===b.my[1]?-b.elemHeight:"bottom"===b.my[1]?b.elemHeight:0,e="top"===b.at[1]?b.targetHeight:-b.targetHeight,j=-2*b.offset[1];a.top+=0>b.collisionPosition.top?g+e+j:0<d?g+e+j:0}}}};c.offset.setOffset||(c.offset.setOffset=function(a,b){/static/.test(c.curCSS(a,"position"))&&(a.style.position="relative");var d=c(a),
g=d.offset(),e=parseInt(c.curCSS(a,"top",!0),10)||0,j=parseInt(c.curCSS(a,"left",!0),10)||0,g={top:b.top-g.top+e,left:b.left-g.left+j};"using"in b?b.using.call(a,g):d.css(g)},c.fn.offset=function(a){var b=this[0];return!b||!b.ownerDocument?null:a?c.isFunction(a)?this.each(function(b){c(this).offset(a.call(this,b,c(this).offset()))}):this.each(function(){c.offset.setOffset(this,a)}):g.call(this)});c.curCSS||(c.curCSS=c.css);(function(){var a=document.getElementsByTagName("body")[0],b=document.createElement("div"),
g,e;g=document.createElement(a?"div":"body");e={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};a&&c.extend(e,{position:"absolute",left:"-1000px",top:"-1000px"});for(var m in e)g.style[m]=e[m];g.appendChild(b);e=a||document.documentElement;e.insertBefore(g,e.firstChild);b.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;";b=c(b).offset(function(a,b){return b}).offset();g.innerHTML="";e.removeChild(g);a=b.top+b.left+(a?2E3:
0);d=a>21&&a<22})()})(jQuery);
(function(c){c.widget("ui.sortable",c.ui.mouse,{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},_create:function(){var b=this.options;this.containerCache={};this.element.addClass("ui-sortable");
this.refresh();this.floating=this.items.length?"x"===b.axis||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1;this.offset=this.element.offset();this._mouseInit();this.ready=!0},destroy:function(){c.Widget.prototype.destroy.call(this);this.element.removeClass("ui-sortable ui-sortable-disabled");this._mouseDestroy();for(var b=this.items.length-1;0<=b;b--)this.items[b].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,
a){"disabled"===b?(this.options[b]=a,this.widget()[a?"addClass":"removeClass"]("ui-sortable-disabled")):c.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,a){var d=this;if(this.reverting||this.options.disabled||"static"==this.options.type)return!1;this._refreshItems(b);var e=null,g=this;c(b.target).parents().each(function(){if(c.data(this,d.widgetName+"-item")==g)return e=c(this),!1});c.data(b.target,d.widgetName+"-item")==g&&(e=c(b.target));if(!e)return!1;if(this.options.handle&&
!a){var f=!1;c(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(f=!0)});if(!f)return!1}this.currentItem=e;this._removeCurrentsFromItems();return!0},_mouseStart:function(b,a,d){a=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(b);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-
this.margins.left};c.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};
this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();a.containment&&this._setContainment();a.cursor&&(c("body").css("cursor")&&(this._storedCursor=c("body").css("cursor")),c("body").css("cursor",a.cursor));a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity));a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex));this.scrollParent[0]!=
document&&"HTML"!=this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset());this._trigger("start",b,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(d=this.containers.length-1;0<=d;d--)this.containers[d]._trigger("activate",b,this._uiHash(this));c.ui.ddmanager&&(c.ui.ddmanager.current=this);c.ui.ddmanager&&!a.dropBehaviour&&c.ui.ddmanager.prepareOffsets(this,b);this.dragging=!0;this.helper.addClass("ui-sortable-helper");this._mouseDrag(b);
return!0},_mouseDrag:function(b){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var a=this.options,d=!1;this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop+a.scrollSpeed:b.pageY-this.overflowOffset.top<
a.scrollSensitivity&&(this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-b.pageX<a.scrollSensitivity)?this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft+a.scrollSpeed:b.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft-a.scrollSpeed):(b.pageY-c(document).scrollTop()<a.scrollSensitivity?d=c(document).scrollTop(c(document).scrollTop()-
a.scrollSpeed):c(window).height()-(b.pageY-c(document).scrollTop())<a.scrollSensitivity&&(d=c(document).scrollTop(c(document).scrollTop()+a.scrollSpeed)),b.pageX-c(document).scrollLeft()<a.scrollSensitivity?d=c(document).scrollLeft(c(document).scrollLeft()-a.scrollSpeed):c(window).width()-(b.pageX-c(document).scrollLeft())<a.scrollSensitivity&&(d=c(document).scrollLeft(c(document).scrollLeft()+a.scrollSpeed)));!1!==d&&(c.ui.ddmanager&&!a.dropBehaviour)&&c.ui.ddmanager.prepareOffsets(this,b)}this.positionAbs=
this._convertPositionTo("absolute");if(!this.options.axis||"y"!=this.options.axis)this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||"x"!=this.options.axis)this.helper[0].style.top=this.position.top+"px";for(a=this.items.length-1;0<=a;a--){var d=this.items[a],e=d.item[0],g=this._intersectsWithPointer(d);if(g&&e!=this.currentItem[0]&&this.placeholder[1==g?"next":"prev"]()[0]!=e&&!c.ui.contains(this.placeholder[0],e)&&("semi-dynamic"==this.options.type?!c.ui.contains(this.element[0],
e):1)){this.direction=1==g?"down":"up";if("pointer"==this.options.tolerance||this._intersectsWithSides(d))this._rearrange(b,d);else break;this._trigger("change",b,this._uiHash());break}}this._contactContainers(b);c.ui.ddmanager&&c.ui.ddmanager.drag(this,b);this._trigger("sort",b,this._uiHash());this.lastPositionAbs=this.positionAbs;return!1},_mouseStop:function(b,a){if(b){c.ui.ddmanager&&!this.options.dropBehaviour&&c.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();
d.reverting=!0;c(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,a);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null});"original"==this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):
this.currentItem.show();for(var b=this.containers.length-1;0<=b;b--)this.containers[b]._trigger("deactivate",null,this._uiHash(this)),this.containers[b].containerCache.over&&(this.containers[b]._trigger("out",null,this._uiHash(this)),this.containers[b].containerCache.over=0)}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(),c.extend(this,
{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?c(this.domPosition.prev).after(this.currentItem):c(this.domPosition.parent).prepend(this.currentItem));return this},serialize:function(b){var a=this._getItemsAsjQuery(b&&b.connected),d=[],b=b||{};c(a).each(function(){var a=(c(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);a&&d.push((b.key||a[1]+"[]")+"="+(b.key&&b.expression?a[1]:a[2]))});!d.length&&b.key&&d.push(b.key+"=");return d.join("&")},
toArray:function(b){var a=this._getItemsAsjQuery(b&&b.connected),d=[],b=b||{};a.each(function(){d.push(c(b.item||this).attr(b.attribute||"id")||"")});return d},_intersectsWith:function(b){var a=this.positionAbs.left,c=a+this.helperProportions.width,e=this.positionAbs.top,g=e+this.helperProportions.height,f=b.left,h=f+b.width,i=b.top,l=i+b.height,m=this.offset.click.top,j=this.offset.click.left;return"pointer"==this.options.tolerance||this.options.forcePointerForContainers||"pointer"!=this.options.tolerance&&
this.helperProportions[this.floating?"width":"height"]>b[this.floating?"width":"height"]?e+m>i&&e+m<l&&a+j>f&&a+j<h:f<a+this.helperProportions.width/2&&c-this.helperProportions.width/2<h&&i<e+this.helperProportions.height/2&&g-this.helperProportions.height/2<l},_intersectsWithPointer:function(b){var a="x"===this.options.axis||c.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top,b.height),b="y"===this.options.axis||c.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left,b.width),
a=a&&b,b=this._getDragVerticalDirection(),d=this._getDragHorizontalDirection();return!a?!1:this.floating?d&&"right"==d||"down"==b?2:1:b&&("down"==b?2:1)},_intersectsWithSides:function(b){var a=c.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top+b.height/2,b.height),b=c.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left+b.width/2,b.width),d=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();return this.floating&&e?"right"==e&&b||"left"==e&&!b:d&&("down"==
d&&a||"up"==d&&!a)},_getDragVerticalDirection:function(){var b=this.positionAbs.top-this.lastPositionAbs.top;return 0!=b&&(0<b?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return 0!=b&&(0<b?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions();return this},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var a=[],
d=[],e=this._connectWith();if(e&&b)for(b=e.length-1;0<=b;b--)for(var g=c(e[b]),f=g.length-1;0<=f;f--){var h=c.data(g[f],this.widgetName);h&&(h!=this&&!h.options.disabled)&&d.push([c.isFunction(h.options.items)?h.options.items.call(h.element):c(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}d.push([c.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):c(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),
this]);for(b=d.length-1;0<=b;b--)d[b][0].each(function(){a.push(this)});return c(a)},_removeCurrentsFromItems:function(){for(var b=this.currentItem.find(":data("+this.widgetName+"-item)"),a=0;a<this.items.length;a++)for(var c=0;c<b.length;c++)b[c]==this.items[a].item[0]&&this.items.splice(a,1)},_refreshItems:function(b){this.items=[];this.containers=[this];var a=this.items,d=[[c.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):c(this.options.items,
this.element),this]],e=this._connectWith();if(e&&this.ready)for(var g=e.length-1;0<=g;g--)for(var f=c(e[g]),h=f.length-1;0<=h;h--){var i=c.data(f[h],this.widgetName);i&&(i!=this&&!i.options.disabled)&&(d.push([c.isFunction(i.options.items)?i.options.items.call(i.element[0],b,{item:this.currentItem}):c(i.options.items,i.element),i]),this.containers.push(i))}for(g=d.length-1;0<=g;g--){b=d[g][1];e=d[g][0];h=0;for(f=e.length;h<f;h++)i=c(e[h]),i.data(this.widgetName+"-item",b),a.push({item:i,instance:b,
width:0,height:0,left:0,top:0})}},refreshPositions:function(b){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var a=this.items.length-1;0<=a;a--){var d=this.items[a];if(!(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])){var e=this.options.toleranceElement?c(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());e=e.offset();d.left=e.left;d.top=e.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);
else for(a=this.containers.length-1;0<=a;a--)e=this.containers[a].element.offset(),this.containers[a].containerCache.left=e.left,this.containers[a].containerCache.top=e.top,this.containers[a].containerCache.width=this.containers[a].element.outerWidth(),this.containers[a].containerCache.height=this.containers[a].element.outerHeight();return this},_createPlaceholder:function(b){var a=b||this,d=a.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=
c(document.createElement(a.currentItem[0].nodeName)).addClass(e||a.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];e||(b.style.visibility="hidden");return b},update:function(b,c){if(!e||d.forcePlaceholderSize)c.height()||c.height(a.currentItem.innerHeight()-parseInt(a.currentItem.css("paddingTop")||0,10)-parseInt(a.currentItem.css("paddingBottom")||0,10)),c.width()||c.width(a.currentItem.innerWidth()-parseInt(a.currentItem.css("paddingLeft")||0,10)-parseInt(a.currentItem.css("paddingRight")||
0,10))}}}a.placeholder=c(d.placeholder.element.call(a.element,a.currentItem));a.currentItem.after(a.placeholder);d.placeholder.update(a,a.placeholder)},_contactContainers:function(b){for(var a=null,d=null,e=this.containers.length-1;0<=e;e--)if(!c.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!a||!c.ui.contains(this.containers[e].element[0],a.element[0]))a=this.containers[e],d=e}else this.containers[e].containerCache.over&&
(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0);if(a)if(1===this.containers.length)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){for(var a=1E4,e=null,g=this.positionAbs[this.containers[d].floating?"left":"top"],f=this.items.length-1;0<=f;f--)if(c.ui.contains(this.containers[d].element[0],this.items[f].item[0])){var h=this.containers[d].floating?
this.items[f].item.offset().left:this.items[f].item.offset().top;Math.abs(h-g)<a&&(a=Math.abs(h-g),e=this.items[f],this.direction=0<h-g?"down":"up")}if(e||this.options.dropOnEmpty)this.currentContainer=this.containers[d],e?this._rearrange(b,e,null,!0):this._rearrange(b,null,this.containers[d].element,!0),this._trigger("change",b,this._uiHash()),this.containers[d]._trigger("change",b,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",
b,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(b){var a=this.options,b=c.isFunction(a.helper)?c(a.helper.apply(this.element[0],[b,this.currentItem])):"clone"==a.helper?this.currentItem.clone():this.currentItem;b.parents("body").length||c("parent"!=a.appendTo?a.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0]);b[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")});(""==b[0].style.width||a.forceHelperSize)&&b.width(this.currentItem.width());(""==b[0].style.height||a.forceHelperSize)&&b.height(this.currentItem.height());return b},_adjustOffsetFromHelper:function(b){"string"==typeof b&&(b=b.split(" "));c.isArray(b)&&(b={left:+b[0],top:+b[1]||0});"left"in b&&(this.offset.click.left=b.left+this.margins.left);"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left);
"top"in b&&(this.offset.click.top=b.top+this.margins.top);"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();"absolute"==this.cssPosition&&(this.scrollParent[0]!=document&&c.ui.contains(this.scrollParent[0],this.offsetParent[0]))&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&
"html"==this.offsetParent[0].tagName.toLowerCase()&&c.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"==this.cssPosition){var b=this.currentItem.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,
left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;"parent"==b.containment&&(b.containment=this.helper[0].parentNode);if("document"==b.containment||"window"==b.containment)this.containment=[0-this.offset.relative.left-this.offset.parent.left,
0-this.offset.relative.top-this.offset.parent.top,c("document"==b.containment?document:window).width()-this.helperProportions.width-this.margins.left,(c("document"==b.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)){var a=c(b.containment)[0],b=c(b.containment).offset(),d="hidden"!=c(a).css("overflow");this.containment=[b.left+(parseInt(c(a).css("borderLeftWidth"),10)||
0)+(parseInt(c(a).css("paddingLeft"),10)||0)-this.margins.left,b.top+(parseInt(c(a).css("borderTopWidth"),10)||0)+(parseInt(c(a).css("paddingTop"),10)||0)-this.margins.top,b.left+(d?Math.max(a.scrollWidth,a.offsetWidth):a.offsetWidth)-(parseInt(c(a).css("borderLeftWidth"),10)||0)-(parseInt(c(a).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,b.top+(d?Math.max(a.scrollHeight,a.offsetHeight):a.offsetHeight)-(parseInt(c(a).css("borderTopWidth"),10)||0)-(parseInt(c(a).css("paddingBottom"),
10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(b,a){a||(a=this.position);var d="absolute"==b?1:-1,e="absolute"==this.cssPosition&&!(this.scrollParent[0]!=document&&c.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(e[0].tagName);return{top:a.top+this.offset.relative.top*d+this.offset.parent.top*d-(c.browser.safari&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollTop():
g?0:e.scrollTop())*d),left:a.left+this.offset.relative.left*d+this.offset.parent.left*d-(c.browser.safari&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():g?0:e.scrollLeft())*d)}},_generatePosition:function(b){var a=this.options,d="absolute"==this.cssPosition&&!(this.scrollParent[0]!=document&&c.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName);"relative"==this.cssPosition&&!(this.scrollParent[0]!=
document&&this.scrollParent[0]!=this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var g=b.pageX,f=b.pageY;if(this.originalPosition&&(this.containment&&(b.pageX-this.offset.click.left<this.containment[0]&&(g=this.containment[0]+this.offset.click.left),b.pageY-this.offset.click.top<this.containment[1]&&(f=this.containment[1]+this.offset.click.top),b.pageX-this.offset.click.left>this.containment[2]&&(g=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&
(f=this.containment[3]+this.offset.click.top)),a.grid))f=this.originalPageY+Math.round((f-this.originalPageY)/a.grid[1])*a.grid[1],f=this.containment?!(f-this.offset.click.top<this.containment[1]||f-this.offset.click.top>this.containment[3])?f:!(f-this.offset.click.top<this.containment[1])?f-a.grid[1]:f+a.grid[1]:f,g=this.originalPageX+Math.round((g-this.originalPageX)/a.grid[0])*a.grid[0],g=this.containment?!(g-this.offset.click.left<this.containment[0]||g-this.offset.click.left>this.containment[2])?
g:!(g-this.offset.click.left<this.containment[0])?g-a.grid[0]:g+a.grid[0]:g;return{top:f-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(c.browser.safari&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:g-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(c.browser.safari&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_rearrange:function(b,
a,c,e){c?c[0].appendChild(this.placeholder[0]):a.item[0].parentNode.insertBefore(this.placeholder[0],"down"==this.direction?a.item[0]:a.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var g=this,f=this.counter;window.setTimeout(function(){f==g.counter&&g.refreshPositions(!e)},0)},_clear:function(b,a){this.reverting=!1;var d=[];!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var e in this._storedCSS)if("auto"==
this._storedCSS[e]||"static"==this._storedCSS[e])this._storedCSS[e]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!a&&d.push(function(a){this._trigger("receive",a,this._uiHash(this.fromOutside))});(this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!a&&d.push(function(a){this._trigger("update",a,this._uiHash())});if(!c.ui.contains(this.element[0],
this.currentItem[0])){a||d.push(function(a){this._trigger("remove",a,this._uiHash())});for(e=this.containers.length-1;0<=e;e--)c.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!a&&(d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[e])),d.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[e])))}for(e=this.containers.length-1;0<=e;e--)a||d.push(function(a){return function(b){a._trigger("deactivate",
b,this._uiHash(this))}}.call(this,this.containers[e])),this.containers[e].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[e])),this.containers[e].containerCache.over=0);this._storedCursor&&c("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);this._storedZIndex&&this.helper.css("zIndex","auto"==this._storedZIndex?"":this._storedZIndex);this.dragging=!1;if(this.cancelHelperRemoval){if(!a){this._trigger("beforeStop",
b,this._uiHash());for(e=0;e<d.length;e++)d[e].call(this,b);this._trigger("stop",b,this._uiHash())}return this.fromOutside=!1}a||this._trigger("beforeStop",b,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!a){for(e=0;e<d.length;e++)d[e].call(this,b);this._trigger("stop",b,this._uiHash())}this.fromOutside=!1;return!0},_trigger:function(){!1===c.Widget.prototype._trigger.apply(this,arguments)&&
this.cancel()},_uiHash:function(b){var a=b||this;return{helper:a.helper,placeholder:a.placeholder||c([]),position:a.position,originalPosition:a.originalPosition,offset:a.positionAbs,item:a.currentItem,sender:b?b.element:null}}});c.extend(c.ui.sortable,{version:"1.8.23"})})(jQuery);
(function(c){var b=0;c.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,e;this.isMultiLine=this.element.is("textarea");this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(b){if(!a.options.disabled&&
!a.element.propAttr("readOnly")){e=!1;var d=c.ui.keyCode;switch(b.keyCode){case d.PAGE_UP:a._move("previousPage",b);break;case d.PAGE_DOWN:a._move("nextPage",b);break;case d.UP:a._keyEvent("previous",b);break;case d.DOWN:a._keyEvent("next",b);break;case d.ENTER:case d.NUMPAD_ENTER:a.menu.active&&(e=!0,b.preventDefault());case d.TAB:if(!a.menu.active)break;a.menu.select(b);break;case d.ESCAPE:a.element.val(a.term);a.close(b);break;default:clearTimeout(a.searching),a.searching=setTimeout(function(){a.term!=
a.element.val()&&(a.selectedItem=null,a.search(null,b))},a.options.delay)}}}).bind("keypress.autocomplete",function(a){e&&(e=!1,a.preventDefault())}).bind("focus.autocomplete",function(){a.options.disabled||(a.selectedItem=null,a.previous=a.element.val())}).bind("blur.autocomplete",function(b){a.options.disabled||(clearTimeout(a.searching),a.closing=setTimeout(function(){a.close(b);a._change(b)},150))});this._initSource();this.menu=c("<ul></ul>").addClass("ui-autocomplete").appendTo(c(this.options.appendTo||
"body",b)[0]).mousedown(function(b){var d=a.menu.element[0];c(b.target).closest(".ui-menu-item").length||setTimeout(function(){c(document).one("mousedown",function(b){b.target!==a.element[0]&&(b.target!==d&&!c.ui.contains(d,b.target))&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(b,c){var d=c.item.data("item.autocomplete");!1!==a._trigger("focus",b,{item:d})&&/^key/.test(b.originalEvent.type)&&a.element.val(d.value)},selected:function(c,e){var h=e.item.data("item.autocomplete"),
i=a.previous;a.element[0]!==b.activeElement&&(a.element.focus(),a.previous=i,setTimeout(function(){a.previous=i;a.selectedItem=h},1));!1!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");c.fn.bgiframe&&this.menu.element.bgiframe();a.beforeunloadHandler=function(){a.element.removeAttr("autocomplete")};
c(window).bind("beforeunload",a.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();c(window).unbind("beforeunload",this.beforeunloadHandler);c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);"source"===a&&this._initSource();"appendTo"===a&&this.menu.element.appendTo(c(b||
"body",this.element[0].ownerDocument)[0]);"disabled"===a&&(b&&this.xhr)&&this.xhr.abort()},_initSource:function(){var a=this,b,e;c.isArray(this.options.source)?(b=this.options.source,this.source=function(a,e){e(c.ui.autocomplete.filter(b,a.term))}):"string"===typeof this.options.source?(e=this.options.source,this.source=function(b,d){a.xhr&&a.xhr.abort();a.xhr=c.ajax({url:e,data:b,dataType:"json",success:function(a){d(a)},error:function(){d([])}})}):this.source=this.options.source},search:function(a,
b){a=null!=a?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(!1!==this._trigger("search",b))return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this._response())},_response:function(){var a=this,c=++b;return function(e){c===b&&a.__response(e);a.pending--;a.pending||a.element.removeClass("ui-autocomplete-loading")}},__response:function(a){!this.options.disabled&&
a&&a.length?(a=this._normalize(a),this._suggest(a),this._trigger("open")):this.close()},close:function(a){clearTimeout(this.closing);this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.deactivate(),this._trigger("close",a))},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){return a.length&&a[0].label&&a[0].value?a:c.map(a,function(a){return"string"===typeof a?{label:a,value:a}:c.extend({label:a.label||
a.value,value:a.value||a.label},a)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(c.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new c.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(a,b){var e=
this;c.each(b,function(b,c){e._renderItem(a,c)})},_renderItem:function(a,b){return c("<li></li>").data("item.autocomplete",b).append(c("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a))this.element.val(this.term),this.menu.deactivate();else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element},_keyEvent:function(a,b){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(a,
b),b.preventDefault()}});c.extend(c.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(a,b){var e=RegExp(c.ui.autocomplete.escapeRegex(b),"i");return c.grep(a,function(a){return e.test(a.label||a.value||a)})}})})(jQuery);
(function(c){c.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){c(a.target).closest(".ui-menu-item a").length&&(a.preventDefault(),b.select(a))});this.refresh()},refresh:function(){var b=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
-1).mouseenter(function(a){b.activate(a,c(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(b,a){this.deactivate();if(this.hasScroll()){var c=a.offset().top-this.element.offset().top,e=this.element.scrollTop(),g=this.element.height();0>c?this.element.scrollTop(e+c):c>=g&&this.element.scrollTop(e+c-g+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",b,{item:a})},deactivate:function(){this.active&&
(this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null)},next:function(b){this.move("next",".ui-menu-item:first",b)},previous:function(b){this.move("prev",".ui-menu-item:last",b)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(b,a,c){this.active?(b=this.active[b+"All"](".ui-menu-item").eq(0),b.length?this.activate(c,
b):this.activate(c,this.element.children(a))):this.activate(c,this.element.children(a))},nextPage:function(b){if(this.hasScroll())if(!this.active||this.last())this.activate(b,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=c(this).offset().top-a-d+c(this).height();return 10>b&&-10<b});e.length||(e=this.element.children(".ui-menu-item:last"));this.activate(b,e)}else this.activate(b,
this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll())if(!this.active||this.first())this.activate(b,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=c(this).offset().top-a+d-c(this).height();return 10>b&&-10<b});e.length||(e=this.element.children(".ui-menu-item:first"));this.activate(b,e)}else this.activate(b,
this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[c.fn.prop?"prop":"attr"]("scrollHeight")},select:function(b){this._trigger("selected",b,{item:this.active})}})})(jQuery);
