YUI.add("sortable",function(a,e){var o=function(){o.superclass.constructor.apply(this,arguments)},r="currentNode",n="opacityNode",d="container",i="id",s="zIndex",g="opacity",l="parentNode",u="nodes",h="node";a.extend(o,a.Base,{delegate:null,drop:null,initializer:function(){var e="sortable-"+a.guid(),t={container:this.get(d),nodes:this.get(u),target:!0,invalid:this.get("invalid"),dragConfig:{groups:[e]}};this.get("handles")&&(t.handles=this.get("handles")),t=new a.DD.Delegate(t),this.set(i,e),t.dd.plug(a.Plugin.DDProxy,{moveOnEnd:!1,cloneNode:!0}),this.drop=new a.DD.Drop({node:this.get(d),bubbleTarget:t,groups:t.dd.get("groups")}),this.drop.on("drop:enter",a.bind(this._onDropEnter,this)),t.on({"drag:start":a.bind(this._onDragStart,this),"drag:end":a.bind(this._onDragEnd,this),"drag:over":a.bind(this._onDragOver,this),"drag:drag":a.bind(this._onDrag,this)}),this.delegate=t,o.reg(this,e)},_up:null,_y:null,_onDrag:function(e){e.pageY<this._y?this._up=!0:e.pageY>this._y&&(this._up=!1),this._y=e.pageY},_onDropEnter:function(e){var t=e.drop.get(h),e=e.drag.get(h);t.test(this.get(u))||e.get(l).compareTo(t)||t.append(e)},_onDragOver:function(e){if(e.drop.get(h).test(this.get(u))&&e.drag.get(h)!==e.drop.get(h)&&!e.drag.get(h).contains(e.drop.get(h))){var t,r,o,n=!1,s=this.get("moveType").toLowerCase();switch(s=(n=e.drag.get(h).get(l).contains(e.drop.get(h))?!0:n)&&"move"===s?"insert":s){case"insert":r=this._up?"before":"after",o=e.drop.get(h),a.Sortable._test(o,this.get(d))?o.append(e.drag.get(h)):o.insert(e.drag.get(h),r);break;case"swap":a.DD.DDM.swapNode(e.drag,e.drop);break;case"move":case"copy":if(!(r=a.Sortable.getSortable(e.drop.get(h).get(l))))return;a.DD.DDM.getDrop(e.drag.get(h)).addToGroup(r.get(i)),n?a.DD.DDM.swapNode(e.drag,e.drop):("copy"===this.get("moveType")&&((t=(o=e.drag.get(h)).cloneNode(!0)).set(i,""),e.drag.set(h,t),r.delegate.createDrop(t,[r.get(i)]),o.setStyles({top:"",left:""})),e.drop.get(h).insert(e.drag.get(h),"before"))}this.fire(s,{same:n,drag:e.drag,drop:e.drop}),this.fire("moved",{same:n,drag:e.drag,drop:e.drop})}},_onDragStart:function(){var e=this.delegate,t=e.get("lastNode");t&&t.getDOMNode()&&t.setStyle(s,""),e.get(this.get(n)).setStyle(g,this.get(g)),e.get(r).setStyle(s,"999")},_onDragEnd:function(){this.delegate.get(this.get(n)).setStyle(g,1),this.delegate.get(r).setStyle(s,""),this.delegate.get(r).setStyles({top:"",left:""}),this.sync()},plug:function(e,t){return e&&"sort"===e.NAME.substring(0,4).toLowerCase()?this.constructor.superclass.plug.call(this,e,t):this.delegate.dd.plug(e,t),this},sync:function(){return this.delegate.syncTargets(),this},destructor:function(){this.drop.destroy(),this.delegate.destroy(),o.unreg(this,this.get(i))},join:function(e,t){if(!(e instanceof a.Sortable))return a.error("Sortable: join needs a Sortable Instance"),this;t="_join_"+(t=(t=t||"full").toLowerCase());return this[t]&&this[t](e),this},_join_none:function(e){this.delegate.dd.removeFromGroup(e.get(i)),e.delegate.dd.removeFromGroup(this.get(i))},_join_full:function(e){this.delegate.dd.addToGroup(e.get(i)),e.delegate.dd.addToGroup(this.get(i))},_join_outer:function(e){this.delegate.dd.addToGroup(e.get(i))},_join_inner:function(e){e.delegate.dd.addToGroup(this.get(i))},getOrdering:function(t){var r=[];return a.Lang.isFunction(t)||(t=function(e){return e}),a.one(this.get(d)).all(this.get(u)).each(function(e){r.push(t(e))}),r}},{NAME:"sortable",ATTRS:{handles:{value:!1},container:{value:"body"},nodes:{value:".dd-draggable"},opacity:{value:".75"},opacityNode:{value:"currentNode"},id:{value:null},moveType:{value:"insert"},invalid:{value:""}},_sortables:{},_test:function(e,t){t=t instanceof a.Node?t===e:e.test(t);return t},getSortable:function(t){var e,r=null;return(e=(t=a.one(t)).get(i))&&a.Sortable._sortables[e]?a.Sortable._sortables[e]:(a.Object.each(a.Sortable._sortables,function(e){a.Sortable._test(t,e.get(d))&&(r=e)}),r)},reg:function(e,t){t=t||e.get(i),a.Sortable._sortables[t]=e},unreg:function(r,e){(e=e||r.get(i))&&a.Sortable._sortables[e]?delete a.Sortable._sortables[e]:a.Object.each(a.Sortable._sortables,function(e,t){e===r&&delete o._sortables[t]})}}),a.Sortable=o},"patched-v3.18.3",{requires:["dd-delegate","dd-drop-plugin","dd-proxy"]});