text: jui.defineUI("ui.button",["jquery","util.base"],function(a,b){var c=function(b,c,d){this.data={index:0,value:"",elem:null},this.ui=b,this.element=c,this.options=a.extend({index:0,value:""},d),this._setting=function(b,c,d){function e(b,c){var d=a(c).attr("value"),e=a(c).text();g.data={index:b,value:d,text:e},a(c).addClass(h)}function f(b){a(b).removeClass(h)}var g=this,h="active",i=this.options.index,j=this.options.value;a(g.element).children(".btn").each(function(g){"event"==b?c.currentTarget==this?e(g,this):f(this):"init"==b&&("value"==d?j==a(this).attr("value")?e(g,this):f(this):i==g?e(g,this):f(this))})},this.init=function(){var b=this;this.ui.addEvent(a(b.element).children(".btn"),"click",function(c){return!a(c.currentTarget).hasClass("disabled")&&(b._setting("event",c),b.ui.emit("click",[b.data,c]),b.ui.emit("change",[b.data,c]),void c.preventDefault())}),""!=this.options.value?this._setting("init",this.options.value,"value"):this._setting("init",this.options.index,"index")}},d=function(){this.data=[],this.options=a.extend({index:[],value:[]},this.options),this._setting=function(b,c,d){function e(b,c){var d=a(c).attr("value"),e=a(c).text();h.data[b]={index:b,value:d,text:e},a(c).addClass(i)}function f(b,c){h.data[b]=null,a(c).removeClass(i)}function g(a,b){for(var c=0;c<a.length;c++)if(a[c]==b)return!0;return!1}var h=this,i="active",j=this.options.index,k=this.options.value;a(h.element).children(".btn").each(function(h){"init"==b?"value"==d?g(k,a(this).attr("value"))?e(h,this):f(h,this):g(j,h)?e(h,this):f(h,this):c.currentTarget==this&&(a(this).hasClass("active")?f(h,this):e(h,this))})}},e=function(){var e={};this.init=function(){var a=this,b=this.options;"radio"==b.type?(e[b.type]=new c(a,this.root,a.options),e[b.type].init()):"check"==b.type&&(d.prototype=new c(a,this.root,a.options),e[b.type]=new d,e[b.type].init())},this.setIndex=function(a){var b=e[this.options.type];b.options.index=a,b._setting("init",null,"index"),this.emit("change",[b.data])},this.setValue=function(a){var b=e[this.options.type];b.options.value=a,b._setting("init",null,"value"),this.emit("change",[b.data])},this.getData=function(){return e[this.options.type].data},this.getValue=function(){var a=this.getData();if(b.typeCheck("array",a)){for(var c=[],d=0;d<a.length;d++)c[d]=null!=a[d]?a[d].value:a[d];return c}return a.value},this.reload=function(){e[this.options.type]._setting("init")},this.enable=function(b){b?a(this.root).find(".btn").removeClass("disabled"):a(this.root).find(".btn").addClass("disabled")}};return e.setup=function(){return{type:"radio",index:0,value:""}},e}),jui.defineUI("ui.combo",["jquery","util.base"],function(a,b){var c=function(){for(var a=jui.get("ui.combo"),b=0;b<a.length;b++)for(var c=a[b],d=0;d<c.length;d++)"open"==c[d].type&&c[d].fold()};a(function(){document.addEventListener("click",function(a){c()})});var d=function(){function d(b,c){var d=j.root,f=j.text,g=j.drop,h=g.children("li");h.each(function(g){var h=e(this),i=a(h).attr("value"),j=a(h).text();i||(i=j,a(h).attr("value",i)),("index"==b&&c==g||"value"==b&&c==i)&&(k={index:g,value:i,text:j},d.attr("value",i),f.html(j),d.select&&d.select[0]&&(d.select[0].selectedIndex=g))}),0==h.length&&(k=null)}function e(b){return a(b).children("a").length>0?a(b).children("a")[0]:b}function f(a){a.options.keydown&&(l=a.options.index,g(a),a.addEvent(window,"keydown",function(b){if("fold"!=a.type){var c=j.drop.children("li");return 38==b.which?(l<1?l=c.length-1:l--,g(a,function(){l--,g(a)}),!1):40==b.which?(l<c.length-1?l++:l=0,g(a,function(){l++,g(a)}),!1):void(13==b.which&&c.eq(l).trigger("click"))}}))}function g(a,b){var c=j.drop.children("li"),d=c.eq(l);c.removeClass("active"),""!=d.val()||""!=d.html()?(d.addClass("active"),a.options.height>0&&j.drop.scrollTop(l*d.outerHeight())):"function"==typeof b&&b()}function h(c){if(b.isTouch){var d=j.root;if(d.select&&d.select[0]){var e=d.select;e.empty()}else{var e=a("<select></select>").css({position:"absolute",opacity:.01});d.find("ul").after(e),c.addEvent(e,"change",function(b){var d=a(b.currentTarget).find("option:selected").data("elem");c.addTrigger(d,"touchstart")}),d.select=e}d.find("ul > li").each(function(b,c){var d=a(c).data("value"),f=a(c).text();e.append(a("<option></option>").val(d).text(f).data("elem",c))})}}function i(){var b=0;return j.drop.children("li").each(function(c){var d=e(this);b=Math.max(b,a(d).outerWidth())}),b}var j=null,k=null,l=-1;this.init=function(){var d=this,g=this.options,h=a(this.root),i=h.children(".btn").not(".toggle"),l=h.children(".toggle"),m=h.children(".btn"),n=h.children("ul");n.insertAfter(i),g.width>0&&(i.outerWidth(g.width-l.outerWidth()+1),i.css({"overflow-x":"hidden","overflow-y":"hidden","white-space":"nowrap"})),g.height>0&&n.css({"overflow-x":"hidden","overflow-y":"auto","max-height":g.height}),this.addEvent(m,"click",function(a){if(b.isTouch)h.select.focus();else{if("open"==d.type)return;c(),d.open(a)}return!1}),this.addEvent(n,"click","li:not(.divider)",function(b){c();var f=e(this),g=a(f).attr("value"),j=a(f).text();k={value:g,text:j,element:f},i.html(j),h.attr("value",g),d.emit("click",[k,b]),d.emit("change",[k,b]),b.preventDefault()}),j={root:h,text:i,drop:n,toggle:l},this.type="fold",this.reload(),f(this)},this.setIndex=function(a){d("index",a),this.emit("change",[k])},this.setValue=function(a){d("value",a),this.emit("change",[k])},this.getData=function(){return k},this.getValue=function(){return null!=k?k.value:null},this.getText=function(){return null!=k?k.text:null},this.open=function(a){if(j.toggle.addClass("active"),j.drop.outerWidth(j.root.outerWidth()-1),"top"==this.options.position){var b=j.drop.outerHeight();j.drop.animate({top:"-"+b,height:"toggle"},100)}else j.drop.slideDown(100);if(this.options.flex){var c=i();c>j.drop.outerWidth()&&j.drop.outerWidth(i()+50)}this.emit("open",a),this.type="open"},this.fold=function(){j.drop.hide(),j.toggle.removeClass("active"),"top"==this.options.position&&j.drop.css("top",0),this.emit("fold"),this.type="fold"},this.reload=function(){""!=this.options.value?d("value",this.options.value):d("index",this.options.index),h(this),this.emit("reload",k)}};return d.setup=function(){return{index:0,value:"",width:0,height:100,keydown:!1,position:"bottom",flex:!0}},d}),jui.defineUI("ui.datepicker",["jquery","util.base"],function(a,b){function c(a){return a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0),a}var e=function(){function e(a){a.addEvent(t.children(".prev"),"click",function(b){a.prev(b)}),a.addEvent(t.children(".next"),"click",function(b){a.next(b)}),a.addEvent(t.children(".prev-year"),"click",function(b){a.prev(b,!0)}),a.addEvent(t.children(".next-year"),"click",function(b){a.next(b,!0)})}function f(a,b){var d=a.options;if("daily"==d.type){var e=p<10?"0"+p:p,f=b<10?"0"+b:b;r=new Date(o+"/"+e+"/"+f)}else if("monthly"==d.type){var e=b<10?"0"+b:b;r=new Date(o+"/"+e+"/01")}else"yearly"==d.type&&(r=new Date(b+"/01/01"));r=c(r)}function g(a){var b=a.options,d=null;if("daily"==b.type){var e=p<10?"0"+p:p;d=new Date(o+"/"+e+"/01")}else"monthly"==b.type?d=new Date(o+"/01/01"):"yearly"==b.type&&(d=new Date);return c(d)}function h(b,c){function d(a){return"daily"==e.type?(a+1)%7==0:(a+1)%3==0}var e=b.options,g=[],h=[];if(s={},b.tpl.date)for(var i=0;i<c.objs.length;i++)h.push(b.tpl.date({type:c.objs[i].type,date:c.objs[i].no,day:h.length})),d(i)&&(g.push("<tr>"+h.join("")+"</tr>"),h=[]);else for(var i=0;i<c.objs.length;i++)h.push(c.nums[i]),d(i)&&(g.push(b.tpl.dates({dates:h})),h=[]);var j=a(g.join(""));return j.find("td").each(function(d){a(this).addClass(c.objs[d].type),b.addEvent(this,"click",function(e){"none"!=c.objs[d].type&&(u.find("td").removeClass("active"),a(this).addClass("active"),f(b,c.objs[d].no),b.emit("select",[b.getFormat(),e]))}),"none"!=c.objs[d].type&&(s[c.objs[d].no]=this)}),j}function i(a,b){if(2==b)return a%100==0||a%4!=0&&a%400!=0?28:29;var c=[31,0,31,30,31,30,31,31,30,31,30,31];return c[b-1]}function j(a,b,c){var d=[],e=[],f=1,g=new Date,h=new Date(b+"-"+(c<10?"0"+c:c)).getDay(),j=i(b,c),k=0,l=1==c?b-1:b,m=1==c?12:c-1,n=i(l,m);v&&v.getFullYear()==b&&v.getMonth()+1==c&&(k=v.getDate()),w&&w.getFullYear()==b&&w.getMonth()+1==c&&(j=w.getDate());for(var o=0;o<h;o++)e[o]=n-h+(o+1),d[o]={type:"none",no:e[o]};for(var o=h;o<42;o++)if(k<=f&&f<=j){var p="";g.getMonth()+1==c&&g.getDate()==f&&(p="now"),null!=r&&r.getFullYear()==b&&r.getMonth()+1==c&&r.getDate()==f&&(p="active"),e[o]=f,d[o]={type:p,no:e[o]},f++}else e[o]=f-j,d[o]={type:"none",no:e[o]},f++;return{objs:d,nums:e}}function k(a){for(var b=[],c=[],d=new Date,e=1;e<=12;e++){var f="";d.getFullYear()==a&&d.getMonth()+1==e&&(f="now"),null!=r&&r.getFullYear()==a&&r.getMonth()+1==e&&(f="active"),c.push(e),b.push({type:f,no:e})}return{objs:b,nums:c}}function l(a){for(var b=[],c=[],d=a-4,e=new Date,f=d;f<d+12;f++){var g="";e.getFullYear()==f&&(g="now"),null!=r&&r.getFullYear()==f&&(g="active"),c.push(f),b.push({type:g,no:f})}return{objs:b,nums:c}}function n(a,b,c){if(v){var d=v.getFullYear(),e=v.getMonth()+1,f=v.getDate();if(a<d||a==d&&b<e)return[d,e,f]}if(w){var g=w.getFullYear(),h=w.getMonth()+1,i=w.getDate();if(a>g||a==g&&b>h)return[g,h,i]}return[a,b,c]}var o=null,p=null,q=null,r=null,s={},t=null,u=null,v=null,w=null;this.init=function(){var c=this.options;t=a(this.root).children(".head"),u=a(this.root).children(".body"),v=b.typeCheck("date",c.minDate)?c.minDate:null,w=b.typeCheck("date",c.maxDate)?c.maxDate:null,"daily"==c.type&&(c.date<v?c.date=v:c.date<v&&(c.date=w),v&&w&&w<v&&(v=null,w=null)),e(this),this.select(c.date)},this.page=function(a,c){if(0!=arguments.length){var d=this.options;"daily"==d.type?(o=a,p=c,u.find("tr:not(:first-child)").remove(),u.append(h(this,j(this,o,p)))):"monthly"==d.type?(o=a,u.find("tr").remove(),u.append(h(this,k(o)))):"yearly"==d.type&&(o=a,u.find("tr").remove(),u.append(h(this,l(o)))),t.children(".title").html(b.dateFormat(g(this),d.titleFormat))}},this.prev=function(a,b){var c=this.options;if("daily"==c.type){if(b)var d=o-1,e=p;else var d=1==p?o-1:o,e=1==p?12:p-1;if(v&&v.getFullYear()==o&&v.getMonth()+1==p)return;this.page(d,e)}else"monthly"==c.type?this.page(o-1):"yearly"==c.type&&this.page(o-12);this.emit("prev",[a])},this.next=function(a,b){var c=this.options;if("daily"==c.type){if(b)var d=o+1,e=p;else var d=12==p?o+1:o,e=12==p?1:p+1;if(w&&w.getFullYear()==o&&w.getMonth()+1==p)return;this.page(d,e)}else"monthly"==c.type?this.page(o+1):"yearly"==c.type&&this.page(o+12);this.emit("next",[a])},this.select=function(){var a=this.options,c=arguments;if(0==c.length)y=o,m=p,d=q;else if(3==c.length)y=c[0],m=c[1],d=c[2];else if(1==c.length){var e=b.typeCheck("date",c[0])?c[0]:new Date(c[0]);y=e.getFullYear(),m=e.getMonth()+1,d=e.getDate()}if("daily"==a.type){if(v||w){var f=n(y,m,d);this.page(f[0],f[1]),this.addTrigger(s[f[2]],"click")}this.page(y,m),this.addTrigger(s[d],"click")}else"monthly"==a.type?(this.page(y),this.addTrigger(s[m],"click")):"yearly"==a.type&&(this.page(y),this.addTrigger(s[y],"click"))},this.addTime=function(a){r=new Date(this.getTime()+a),this.select(this.getTime())},this.getDate=function(){return r},this.getTime=function(){return r.getTime()},this.getFormat=function(a){return b.dateFormat(r,"string"==typeof a?a:this.options.format)},this.reload=function(){var a=this.options;v=b.typeCheck("date",a.minDate)?a.minDate:null,w=b.typeCheck("date",a.maxDate)?a.maxDate:null,"daily"==a.type&&(v&&a.date<v?a.date=v:w&&a.date>w&&(a.date=w)),this.select(),this.emit("reload")}};return e.setup=function(){var a=c(new Date);return{type:"daily",titleFormat:"yyyy.MM",format:"yyyy-MM-dd",date:a,animate:!1,minDate:null,maxDate:null}},e}),jui.defineUI("ui.colorpicker",["jquery","util.base","util.color"],function(a,b,c){var d=function(){function d(a){var b=null;if("hex"==a)b=c.rgb(N.val()),O.val(b.r),P.val(b.g),Q.val(b.b);else if("rgb"==a)N.val(c.format({r:parseInt(O.val(),10),g:parseInt(P.val(),10),b:parseInt(Q.val(),10)},"hex")),b=c.rgb(N.val());else{var d=q.getColor("hex");N.val(d),b=c.rgb(N.val()),O.val(b.r),P.val(b.g),Q.val(b.b)}b.a=i(),C.css("background-color",c.format(b,"hex")),G.val(Math.floor(100*b.a)+"%"),q.emit("change",[c.format(b,"hex"),b])}function e(a){var b=v.offset(),c=v.width(),e=v.height(),f=a.clientX-b.left,g=a.clientY-b.top;f<0?f=0:f>c&&(f=c),g<0?g=0:g>e&&(g=e),y.css({left:f-5,top:g-5}).data("pos",{x:f,y:g}),d()}function f(a){for(var b,d,e=0;e<R.length;e++)if(R[e].start>=a){b=R[e-1],d=R[e];break}if(b&&d){var f=c.scale().domain(b.rgb,d.rgb);return f((a-b.start)/(d.start-b.start),"hex")}return null}function g(a){var b=D.offset().left,c=b+D.width(),e=l(a).clientX;s=e<b?0:e>c?100:(e-b)/(c-b)*100;var g=u.width()*(s/100);z.css({left:g-Math.ceil(z.width()/2)+"px"}).data("pos",{x:g});var h=f(s/100);v.css("background-color",h),d()}function h(a){var b=E.offset().left,c=b+E.width(),e=l(a).clientX;s=e<b?0:e>c?100:(e-b)/(c-b)*100;var f=E.width()*(s/100);H.css({left:f-Math.ceil(H.width()/2)+"px"}).data("pos",{x:f}),d()}function i(){var a=H.data("pos")||{x:0},b=Math.round(a.x/E.width()*100)/100;return b}function j(){var a=y.data("pos")||{x:0,y:0},b=z.data("pos")||{x:0},d=v.width(),e=v.height(),f=b.x/u.width()*360,g=a.x/d,h=(e-a.y)/e,j=c.HSVtoRGB(f,g,h);return j.a=i(),j}function k(b,c){var b=b?b:"div",d=a("<"+b+" />");return"object"==typeof c&&d.attr(c),d}function l(a){return b.isTouch?a.originalEvent.touches[0]:a}function m(a){var b=a.which,c=!1;return 37!=b&&39!=b&&8!=b&&46!=b&&9!=b||(c=!0),!(!c&&(b<48||b>57))}function n(a){var b=O.val(),d=P.val(),e=Q.val();""!=b&&""!=d&&""!=e&&(parseInt(b)>255?O.val(255):O.val(parseInt(b)),parseInt(d)>255?P.val(255):P.val(parseInt(d)),parseInt(e)>255?Q.val(255):Q.val(parseInt(e)),o(c.format({r:parseInt(O.val()),g:parseInt(P.val()),b:parseInt(Q.val())},"hex"),"rgb"))}function o(a,b){var e=a||q.options.color,f=c.rgb(e);v.css("background-color",e);var g=c.RGBtoHSV(f.r,f.g,f.b),h=v.width()*g.s,i=v.height()*(1-g.v);y.css({left:h-5,top:i-5}).data("pos",{x:h,y:i});var j=u.width()*(g.h/360);z.css({left:j-7.5}).data("pos",{x:j});var k=E.width()*(f.a||0);H.css({left:k-7.5}).data("pos",{x:k}),d(b)}function p(){q.addEvent(v,"mousedown",function(a){v.data("isDown",!0),e(a)}),q.addEvent(v,"mouseup",function(a){v.data("isDown",!1)}),q.addEvent(z,"mousedown",function(a){a.preventDefault(),u.data("isDown",!0)}),q.addEvent(H,"mousedown",function(a){a.preventDefault(),E.data("isDown",!0)}),q.addEvent(D,"mousedown",function(a){u.data("isDown",!0),g(a)}),q.addEvent(F,"mousedown",function(a){E.data("isDown",!0),h(a)}),q.addEvent(N,"keydown",function(a){if(a.which<65||a.which>70)return m(a)}),q.addEvent(N,"keyup",function(b){var c=a(this).val();"#"==c.charAt(0)&&7==c.length&&o(c,"hex")}),q.addEvent(O,"keydown",m),q.addEvent(O,"keyup",n),q.addEvent(P,"keydown",m),q.addEvent(P,"keyup",n),q.addEvent(Q,"keydown",m),q.addEvent(Q,"keyup",n),q.addEvent(document,"mouseup",function(a){v.data("isDown",!1),u.data("isDown",!1),E.data("isDown",!1)}),q.addEvent(document,"mousemove",function(a){v.data("isDown")&&e(a),u.data("isDown")&&g(a),E.data("isDown")&&h(a)})}var q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R=[{rgb:"#ff0000",start:0},{rgb:"#ffff00",start:.17},{rgb:"#00ff00",start:.33},{rgb:"#00ffff",start:.5},{rgb:"#0000ff",start:.67},{rgb:"#ff00ff",start:.83},{rgb:"#ff0000",start:1}];this.init=function(){q=this,r=this.options,t=a(this.root),v=k("div",{"class":"color"}),y=k("div",{"class":"drag-pointer"}),w=k("div",{"class":"value"}),x=k("div",{"class":"saturation"}),A=k("div",{"class":"control"}),B=k("div",{"class":"empty"}),C=k("div",{"class":"color"}),u=k("div",{"class":"hue"}),D=k("div",{"class":"container"}),z=k("div",{"class":"drag-bar"}),E=k("div",{"class":"opacity"}),F=k("div",{"class":"container"}),G=k("input",{"class":"input",type:"text",disabled:!0}),H=k("div",{"class":"drag-bar2"}),I=k("div",{"class":"information"}),J=k("div",{"class":"title"}).html("HEX"),K=k("div",{"class":"title"}).html("R"),L=k("div",{"class":"title"}).html("G"),M=k("div",{"class":"title"}).html("B"),N=k("input",{"class":"input",type:"text",maxlength:7}),O=k("input",{"class":"input",type:"text",maxlength:3}),P=k("input",{"class":"input",type:"text",maxlength:3}),Q=k("input",{"class":"input",type:"text",maxlength:3}),w.html(y),x.html(w),v.html(x),D.html(z),u.html(D),F.html(H),E.html(F),A.append(u),A.append(E),A.append(G),A.append(B),A.append(C),I.append(N),I.append(O),I.append(P),I.append(Q),I.append(J),I.append(K),I.append(L),I.append(M),t.html(v),t.append(A),t.append(I),p(),o()},this.setColor=function(a){if("object"==typeof a){if(!a.r||!a.g||!a.b)return;o(c.format(a,"hex"))}else if("string"==typeof a){if("#"!=a.charAt(0))return;o(a)}},this.getColor=function(a){var b=j();return a?("hex"==a&&b.a<1&&(a="rgb"),c.format(b,a)):b}};return d.setup=function(){return{type:"full",color:"#FF0000"}},d}),jui.defineUI("ui.dropdown",["jquery"],function(a){var b=function(){var a=c();null!=a&&a.hide()},c=function(){for(var a=jui.get("ui.dropdown"),b=0;b<a.length;b++)for(var c=a[b],d=0;d<c.length;d++)if("show"==c[d].type)return c[d];return null};a(function(){document.addEventListener("click",function(a){var c=a.target.tagName;"LI"!=c&&"INPUT"!=c&&"A"!=c&&"BUTTON"!=c&&"I"!=c&&b()}),window.addEventListener("keydown",function(a){var b=c();null!=b&&b.wheel(a.which,function(){a.preventDefault()})})});var d=function(){function c(c){function d(a){var b=0;return f.each(function(c){a==this&&(b=c)}),b}var f=a(e.menu).find("li");f.off("click").off("hover"),c.addEvent(f,"click",function(e){if(!(a(this).hasClass("divider")||a(this).hasClass("title")||a(this).hasClass("disabled"))){var f=d(this),g=a(this).text(),h=a(this).attr("value");c.emit("change",[{index:f,value:h,text:g},e]),c.options.close&&b(),"A"==e.target.tagName&&e.preventDefault()}}),c.addEvent(f,"hover",function(a){f.removeClass("active")})}function d(a,b){var c=e.menu.find("li"),d=c.eq(f);c.removeClass("active"),""!=d.val()||""!=d.html()?(d.addClass("active"),a.options.height>0&&e.menu.scrollTop(f*d.outerHeight())):"function"==typeof b&&b()}var e=null,f=-1;this.init=function(){var b=this.options,d=a(this.root),f=d.find("ul"),g=d.find(".anchor");f=0==f.length?d:f,e={root:d,menu:f,anchor:g},e.root.outerWidth(e.menu.outerWidth()),b.width>0&&f.outerWidth(b.width),b.height>0&&f.css({maxHeight:b.height,overflow:"auto"}),b.left>0&&d.css("left",b.left),b.top>0&&d.css("top",b.top),f.css({display:"block"}),d.css({position:"absolute",display:"none"}),b.nodes.length>0?this.update(b.nodes):c(this),this.type="hide"},this.update=function(b){if(this.tpl.node){a(e.menu).empty();for(var d=0;d<b.length;d++)a(e.menu).append(this.tpl.node(b[d]));c(this)}},this.hide=function(){e.root.hide(),this.emit("hide"),this.type="hide"},this.show=function(a,c){b(),e.root.show(),e.anchor.length>0&&e.root.css("margin-top","10px"),2==arguments.length&&this.move(a,c),this.emit("show"),this.type="show"},this.move=function(a,b){e.root.css("left",a),e.root.css("top",b)},this.wheel=function(a,b){if(this.options.keydown){var c=this,g=e.menu.find("li");if(9==a)return void this.hide();38!=a&&a!=-1||(f<1?f=g.length-1:f--,d(this,function(){f--,d(c)}),b&&b()),40!=a&&1!=a||(f<g.length-1?f++:f=0,d(c,function(){f++,d(c)}),b&&b()),13!=a&&0!=a&&a||(c.addTrigger(g.eq(f),"click"),f=-1,b&&b())}},this.reload=function(){this.init(),this.emit("reload")}};return d.setup=function(){return{close:!0,keydown:!1,left:0,top:0,width:0,height:0,nodes:[]}},d}),jui.defineUI("ui.modal",["jquery","util.base"],function(a,b){var c=0;b.resize(function(){if(c!=a(window).width()){for(var b=jui.get("ui.modal"),d=0;d<b.length;d++)for(var e=b[d],f=0;f<e.length;f++)"show"==e[f].type&&e[f].resize();c=a(window).width()}},300);var d=function(){function b(b){h={position:a(b.root).css("position"),left:a(b.root).css("left"),top:a(b.root).css("top"),"z-index":a(b.root).css("z-index"),display:a(b.root).css("display")},i={position:a(b.options.target).css("position")}}function c(b){return"body"==b?null:a(b).hasClass("msgbox")||a(b).hasClass("window")?"absolute":"relative"}function d(b){var d=b.options.target,e="body"==d?window:d,f="body"==d?"fixed":"absolute",g=c(d),h=a(d).scrollLeft(),i=a(e).width()/2-a(b.root).width()/2+a(d).scrollLeft(),j=a(e).height()/2-a(b.root).height()/2,k=h>0?a(d).outerWidth()+h:"100%",l=a(d).outerHeight();if(null!=g){var m=a(e)[0].scrollHeight;l=m>l?m:l,j+=a(e).scrollTop()}else{var m=a(window).outerHeight();l=l>m?l:m}return{x:i,y:j,pos:f,tPos:g,w:k,h:l}}function e(b,c,d){var e=b.timestamp;null==f[e]&&(f[e]=a("<div id='MODAL_"+b.timestamp+"'></div>").css({position:"absolute",width:c,height:d,left:0,top:0,opacity:b.options.opacity,"background-color":b.options.color,"z-index":j+b.options.index-1}),a(b.options.target).append(f[e]),a(b.root).insertAfter(f[e]),b.addEvent(f[e],"click",function(a){return b.options.autoHide&&b.hide(),!1}))}var f={},g=null,h=null,i=null,j=5e3;this.init=function(){b(this),this.options.clone||a(this.root).hide(),this.type="hide"},this.hide=function(){var b=this.options,c=this.timestamp;b.clone&&(g.remove(),g=null),a(b.target).css("position",i.position),a(this.root).css(h),f[c]&&(f[c].remove(),delete f[c]),this.type="hide"},this.show=function(){var b=this.options,c=d(this);b.clone&&(g=a(this.root).clone(),g.insertAfter(a(this.root))),a(this.root).appendTo(b.target),this.resize(),a(b.target).css("position",c.tPos),a(this.root).show(),e(this,c.w,c.h),this.type="show"},this.resize=function(){var b=d(this),c=this.timestamp;a(this.root).css({position:b.pos,left:b.x,top:b.y,"z-index":j+this.options.index}),null!=f[c]&&f[c].height(b.h)}};return d.setup=function(){return{color:"black",opacity:.4,target:"body",index:0,clone:!1,autoHide:!0}},d}),jui.defineUI("ui.notify",["jquery"],function(a){var b=12,c=function(){var c=null,d=null;this.init=function(){var e=this.options,f="object"==typeof e.padding?b:e.padding,g={top:{top:f,bottom:"auto",left:f,right:f},"top-right":{top:f,bottom:"auto",left:"auto",right:f},"top-left":{top:f,bottom:"auto",left:f,right:"auto"},bottom:{top:"auto",bottom:f,left:f,right:f},"bottom-right":{top:"auto",bottom:f,left:"auto",right:f},"bottom-left":{top:"auto",bottom:f,left:f,right:f}};return d=g[e.position],"object"==typeof e.padding&&(d=a.extend(d,e.padding)),"body"!=this.selector&&a(this.selector).css("position","relative"),c=a("<div></div>").css(a.extend({position:"absolute","z-index":3e3},d)),a(this.root).append(c),this},this.add=function(e,f){function g(){null!=m&&(m.animate({opacity:0},j.hideDuration,j.hideEasing),m.slideUp(j.hideEasing,function(){i.emit("hide",[e]),m.remove(),m=null}))}function h(){return j.position.indexOf("top-")!=-1}var i=this,j=this.options,k=isNaN(f)?j.timeout:f,l=a(this.root).scrollTop(),m=a(this.tpl.item(e)).css({"margin-bottom":j.distance});"top"!=j.position&&"bottom"!=j.position||m.outerWidth(c.width()-3*("object"==typeof j.padding&&j.padding.right?j.padding.right:b)),h()?(c.css("top",l+d.top),c.prepend(m)):(c.css("bottom",-(l-d.bottom)),c.append(m));var n=m.css("opacity");m.css({opacity:0}).animate({opacity:n},j.showDuration,j.showEasing,function(){i.emit("show",[e])}),this.addEvent(m,"click",function(a){return i.emit("select",[e,a]),g(),!1}),k>0&&setTimeout(g,k)},this.reset=function(){c.empty()}};return c.setup=function(){return{position:"top-right",padding:b,distance:5,timeout:3e3,showDuration:500,hideDuration:500,showEasing:"swing",hideEasing:"linear"}},c}),jui.defineUI("ui.paging",["jquery"],function(a){var b=function(){function b(b){b.addEvent(a(b.root).find(".prev"),"click",function(a){return b.prev(),!1}),b.addEvent(a(b.root).find(".next"),"click",function(a){return b.next(),!1})}function c(b){b.addEvent(h.find(".page"),"click",function(c){var d=parseInt(a(c.currentTarget).text());return b.page(d),!1})}function d(b,c){var d=h.find(".page");d.each(function(b){a(this).text()==c?a(this).addClass("active"):a(this).removeClass("active")})}function e(a,e){var i=[],j=g<a.options.screenCount?g:a.options.screenCount,k=e-Math.ceil(j/2)+1,k=k<1?1:k;if(f=e>g?g:e,f=e<1?1:e,g<k+j){for(var l=g-j+1;l<g+1;l++)i.push(l);f>g&&(f=g)}else for(var l=k;l<k+j;l++)i.push(l);h.html(a.tpl.pages({pages:i,lastPage:g})),b(a),c(a),d(a,f)}var f=1,g=1,h=null;this.init=function(){var b=this;this.options;return h=a(b.root).find(".list"),h=0==h.length?a(b.root):h,this.reload(),this},this.reload=function(a){var a=a?a:this.options.count;f=1,g=Math.ceil(a/this.options.pageCount),e(this,f),this.emit("reload")},this.page=function(a){return a?(e(this,a),void this.emit("page",[f])):f},this.next=function(){this.page(f+1)},this.prev=function(){this.page(f-1)},this.first=function(){this.page(1)},this.last=function(){this.page(g)}};return b.setup=function(){return{count:0,pageCount:10,screenCount:5}},b}),jui.defineUI("ui.tooltip",["jquery"],function(a){var b=function(){function b(b,d){f=a(b.tpl.item({timestamp:b.timestamp,position:b.options.position,color:b.options.color,message:d})),b.options.width&&f.css("max-width",b.options.width),b.options.align&&f.css("text-align",b.options.align),a("body").append(f),c(b)}function c(b){var c=a(b.root).offset(),d=a(b.root).outerWidth(),e=a(b.root).outerHeight(),h=f.outerWidth(),i=f.outerHeight(),j=0,k=0,l=b.options.position;"left"==l?(j=c.left-h,k=c.top-(i-e)/2):"right"==l?(j=c.left+d,k=c.top-(i-e)/2):"bottom"==l?(j=c.left-h/2+d/2,k=c.top+e):(j=c.left-h/2+d/2,k=c.top-i),g={x:j<1?1:j,y:k<1?1:k}}function d(a,b){clearTimeout(i),null!=f&&(f.remove(),f=null,g={}),null!=i&&(a.emit("hide",[b]),i=null)}function e(a,c){f&&d(a,c);var e=a.options.title?a.options.title:h;""!=e&&(b(a,e),f.css({left:g.x,top:g.y}))}var f=null,g={},h="",i=null;this.init=function(){var b=this,c=this.options;h=a(this.root).attr("title"),a(this.root).removeAttr("title"),a(this.root).off(c.showType).off(c.hideType),this.addEvent(this.root,c.showType,function(a){return null==i?i=setTimeout(function(){e(b,a),null!=f&&b.emit("show",[f.get(0),a])},c.delay):c.showType==c.hideType&&d(b,a),!1}),c.showType!=c.hideType&&this.addEvent(this.root,c.hideType,function(a){return d(b,a),!1})},this.update=function(a){h=a,null!=f&&f.find(".message").html(h)}};return b.setup=function(){return{color:"null",position:"top",width:150,align:"left",delay:0,showType:"mouseover",hideType:"mouseout",title:"",tpl:{item:"<div class='tooltip <!= position !>' <! if(color != null) { !>style='background-color: <!= color !>'<! } !>><div class='anchor'></div><div class='message'><!= message !></div></div>"}}},b}),jui.defineUI("ui.layout",["jquery","util.base"],function(a,b){var c=function(){function b(b,c,d,e){b.mousedown(function(f){b.data("mousedown",!0);var g=b.clone();b.data("shadow",g),b.after(g),d.call(this,f),g.css("opacity",.3),a(document).on("mousemove",c),a(document).on("mouseup",function h(d){a(document).off("mousemove",c),a(document).off("mouseup",h),e.call(this,d),b.data("mousedown",!1),g.remove(),a("body :not(.resize)").css({"user-select":""})}),a("body :not(.resize)").css({"user-select":"none"})})}function c(a){var c,d;c=e[a],d=c.resizer,d.css({cursor:h[a]}),d.data("event")||("top"==a?b(d,function(a){if(d.data("mousedown")){var b=a.clientY-d.data("current"),c=f.top.min,e=f.top.max;c<=b&&b<e&&d.css({top:b+"px"})}},function(a){var b=d.position().top;d.data("current",a.clientY-b)},function(a){var b=d.position().top,c=(d.height(),b),f=b+d.height()+"px",g=e.top.height();e.top.height(c);var h=g-c,i=e.center.height()+h;e.center.css({top:f}).height(i),e.left.css({top:f}).height(i),e.left.resizer.css({top:f}).height(i),e.right.css({top:f}).height(i),e.right.resizer.css({top:f}).height(i)}):"bottom"==a?b(d,function(a){if(d.data("mousedown")){var b=a.clientY-d.data("current"),e=f.bottom.min,g=f.bottom.max,h=c.position().top-(b+f.barSize),i=h+c.height();e<=i&&i<=g&&d.css({top:b+"px"})}},function(a){var b=d.position().top;d.data("current",a.clientY-b)},function(a){var b=d.position().top+d.height(),c=(e.root.height(),parseFloat(e.bottom.position().top)-b);e.bottom.css({top:b+"px"}),e.bottom.height(e.bottom.height()+c);var f=e.center.height()-c;e.center.height(f),e.left.height(f),e.left.resizer.height(f),e.right.height(f),e.right.resizer.height(f)}):"left"==a?b(d,function(a){if(d.data("mousedown")){var b=a.clientX-d.data("current"),c=f.left.min,e=f.left.max;c<=b&&b<e&&d.css({left:b+"px"})}},function(a){var b=d.position().left;d.data("left",b).data("current",a.clientX-b)},function(a){if(d.data("mousedown")){var b=d.position().left,c=d.data("left"),g=c-b;e.left.css({width:b+"px"}),e.center.css({left:b+f.barSize+"px"}),e.center.width(e.center.width()+g)}}):"right"==a&&b(d,function(a){if(d.data("mousedown")){var b=a.clientX-d.data("current"),g=f.right.min,h=f.right.max,i=e.left.width()+e.left.resizer.width(),j=e.center.width(),k=c.width()-(b-(i+j));g<=k&&k<h&&d.css({left:b+"px"})}},function(a){var b=d.position().left;d.data("left",b).data("current",a.clientX-b)},function(a){if(d.data("mousedown")){var b=d.position().left,c=d.data("left"),f=c-b;e.right.css({left:b+d.width()+"px",width:e.right.width()+f+"px"}),e.center.width(e.center.width()-f)}}),d.data("event",!0))}function d(b){for(var d=0,h=g.length;d<h;d++){var i=e[g[d]];i&&(e.root.append(i),"center"!=g[d]&&f[g[d]].resize&&(i.resizer||(i.resizer=a("<div class='resize "+g[d]+"' />")),e.root.append(i.resizer),c(g[d])))}b.resize()}var e=null,f={},g=["top","left","right","bottom","center"],h={top:"n-resize",bottom:"n-resize",right:"e-resize",left:"e-resize"};this.init=function(){var b,c,g,h,i,j,k=this,l=this.options;return b=a(this.root).css("position","relative"),null!=l.width&&b.outerWidth(l.width),null!=l.height&&b.outerHeight(l.height),c=l.top.el?a(l.top.el):b.find("> .top"),0==c.length&&(c=null),g=l.left.el?a(l.left.el):b.find("> .left"),0==g.length&&(g=null),h=l.right.el?a(l.right.el):b.find("> .right"),0==h.length&&(h=null),i=l.bottom.el?a(l.bottom.el):b.find("> .bottom"),0==i.length&&(i=null),j=l.center.el?a(l.center.el):b.find("> .center"),0==j.length&&(j=null),e={root:b,top:c,left:g,right:h,bottom:i,center:j},f=l,d(this),a(window).on("resize",function(a){k.resize()}),this},this.resize=function(){var a=null,b=null,c=0,d=0,f=0;a=e.top,b=this.options.top,a&&(a.css({position:"absolute",top:"0px",left:"0px",width:"100%",height:b.size||b.min}),c=a.height(),b.resize?(a.resizer.css({position:"absolute",top:c,left:"0px",width:"100%",background:this.options.barColor,height:this.options.barSize}),c+=this.options.barSize):a.resizer&&a.resizer.remove()),a=e.bottom,b=this.options.bottom;var g=e.root.height();if(a){a.css({position:"absolute",left:"0px",width:"100%",height:b.size||b.min});var h=c-a.height()+c;b.resize?(a.resizer.css({position:"absolute",top:h,left:"0px",width:"100%",background:this.options.barColor,height:this.options.barSize}),h+=this.options.barSize):a.resizer&&a.resizer.remove(),a.css("top",h+"px")}a=e.left,b=this.options.left;var i=g;e.top&&(i-=e.top.height(),e.top.resizer&&(i-=e.top.resizer.height())),e.bottom&&(i-=e.bottom.height(),e.bottom.resizer&&(i-=e.bottom.resizer.height())),a&&(a.css({position:"absolute",top:c,left:"0px",height:i,width:b.size||b.min,"max-width":"100%",overflow:"auto"}),d=a.width(),b.resize?(a.resizer.css({position:"absolute",top:c,height:a.height(),left:d,background:this.options.barColor,width:this.options.barSize}),d+=this.options.barSize):a.resizer&&a.resizer.remove()),a=e.right,b=this.options.right;var j=e.root.width(),k=j;e.left&&(k-=e.left.width(),e.left.resizer&&(k-=e.left.resizer.width())),a&&(a.css({position:"absolute",top:c,height:i,width:b.size||b.min,"max-width":"100%"}),b.resize?(a.resizer.css({position:"absolute",top:c,height:a.height(),background:this.options.barColor,width:this.options.barSize}),f+=this.options.barSize):a.resizer&&a.resizer.remove(),k-=e.right.width(),e.right.resizer&&(k-=e.right.resizer.width()),a.resizer.css({left:d+k+"px"}),a.css({left:d+k+a.resizer.width()+"px"})),a=e.center,b=this.options.center,a&&a.css({position:"absolute",top:c,height:i,left:d,width:k,overflow:"auto"})}};return c.setup=function(){return{barColor:"#d6d6d6",barSize:3,width:null,height:null,top:{el:null,size:null,min:50,max:200,resize:!0},left:{
  el:null,size:null,min:50,max:200,resize:!0},right:{el:null,size:null,min:50,max:200,resize:!0},bottom:{el:null,size:null,min:50,max:200,resize:!0},center:{el:null}}},c}),jui.defineUI("ui.accordion",["jquery","util.base"],function(a,b){var c=function(){function c(b){g.each(function(c){b==c?(a(this).addClass("active"),e.options.multipanel?a(this).next(".content").show():h.insertAfter(this).show()):(a(this).removeClass("active"),e.options.multipanel&&a(this).next(".content").hide())})}function d(b){g.each(function(d){b.addEvent(this,"click",function(e){a(this).hasClass("active")&&b.options.autoFold?(a(this).removeClass("active"),b.options.multipanel?a(this).next(".content").hide():h.hide(),b.emit("fold",[d,e])):(c(d),b.emit("open",[d,e]))})})}var e,f=0,g=null,h=null;this.init=function(){e=this;var f=this.options;if(g=a(this.root).find(".title"),h=a(this.root).find(".content"),null==f.index)for(var i=0;i<g.length;i++)a(g[i]).hasClass("active")&&(f.index=i);b.typeCheck("integer",f.index)?c(f.index):h.hide(),d(this),this.emit("init")},this.activeIndex=function(){return f}};return c.setup=function(){return{index:null,autoFold:!1,multipanel:!1}},c}),jui.defineUI("ui.switch",["jquery","util.base"],function(a,b){var c=function(){function b(b,c){var d=a(b).find("."+c);return d.length||(d=a("<div />").addClass(c)),d}this.init=function(){var c=this,d=this.options,e=b(this.root,"left"),f=b(this.root,"right"),g=b(this.root,"area"),h=b(this.root,"bar"),i=b(this.root,"handle");h.html(e),h.append(f),g.html(h),a(this.root).html(g).append(i),this.addEvent(this.root,d.toggleEvent,function(a){c.toggle()}),d.checked&&a(this.root).addClass("on")},this.getValue=function(){return a(this.root).hasClass("on")},this.setValue=function(b){a(this.root).toggleClass("on",!!b),this.emit("change",[b])},this.toggle=function(){this.setValue(!this.getValue())}};return c.setup=function(){return{checked:!1,toggleEvent:"click"}},c}),jui.defineUI("ui.slider",["jquery","util.base","util.math"],function(a,b,c){var d=function(){function d(){return x.options.min}function e(){return x.options.max}function f(){return x.options.step}function g(){return x.options.type}function h(){return"double"==g()}function i(){return"single"==g()}function j(){return 0!=B.data("progress")&&x.options.progress}function k(){return 0!=B.data("tooltip")&&x.options.tooltip}function l(a){return"from"==a?H:J}function m(a){return"from"==a?I:K}function n(a){return"to"==a?E:D}function o(a){return b.isTouch?a.originalEvent.touches[0]:a}function p(a,b){return a[0].style[b]}function q(){if(i())y?G.height(p(D,"bottom")).css({bottom:0}):G.width(p(D,"left"));else if(y){var a=parseFloat(p(E,"bottom").replace("%","")),b=parseFloat(p(D,"bottom").replace("%",""));G.height(a-b+"%").css({bottom:b+"%"})}else{var a=parseFloat(p(E,"left").replace("%","")),b=parseFloat(p(D,"left").replace("%",""));G.width(a-b+"%").css({left:b+"%"})}}function r(a,b){if(h())if("from"==b)if(y){var c=parseFloat(p(E,"bottom").replace("%",""));a>=c&&(a=c)}else{var c=parseFloat(p(E,"left").replace("%",""));a>=c&&(a=c)}else if("to"==b)if(y){var d=parseFloat(p(D,"bottom").replace("%",""));a<=d&&(a=d)}else{var d=parseFloat(p(D,"left").replace("%",""));a<=d&&(a=d)}return a}function s(a,c){var f=u(a/100);f<d()&&(f=d()),f>e()&&(f=e()),a=(f-d())/(e()-d())*100,a=r(a,c),f=u(a/100);var g=a+"%",h=n(c);if(y?h.css({bottom:g}):h.css({left:g}),q(),k()){var i=l(c),j=m(c);if(b.typeCheck("function",x.options.format)&&(f=x.options.format.call(x,f)),j.html(f),y)i.css({bottom:C.height()*(a/100),"margin-bottom":-1*(i.height()/2)});else{i.css({left:g,"margin-left":-1*(i.width()/2)});var o=C.width()*(a/100),p=o+i.width()/2,s=o-i.width()/2;p>=C.width()?i.css({left:C.width()-i.width()+h.width()/2,"margin-left":0}).addClass("last"):s<=0?i.css({left:-h.width()/2,"margin-left":0}).addClass("first"):i.removeClass("first last")}i.show()}"from"==c?z!=f&&(x.emit("change",[{type:c,from:f,to:x.getToValue()}]),z=f):"to"==c&&A!=f&&(x.emit("change",[{type:c,from:x.getFromValue(),to:f}]),A=f)}function t(b,c){var d,e,f,g=void 0;"vertical"==x.options.orient?(d=C.offset().top-a("body").scrollTop(),e=d+C.height(),f=o(b).clientY,g=f<=d?100:f>=e?0:(e-f)/(e-d)*100):(d=C.offset().left,e=d+C.width(),f=o(b).clientX,g=f<d?0:f>e?100:(f-d)/(e-d)*100),s(g,c)}function u(a){"undefined"==typeof a&&(a=y?parseFloat(D.css("bottom"))/C.height():parseFloat(D.css("left"))/C.width());var b=d(),g=e(),h=b+(g-b)*a,i=f(),j=c.remain(h,i);return h=c.minus(h,j),j>c.div(i,2)&&(h=c.plus(h,i)),h}function v(){B.addClass(x.options.orient),C=a("<div class='track' />"),F=a("<div class='tooltip-track' />"),G=a("<div class='progress' />"),j()||G.hide(),D=a("<div class='handle from' />"),C.html(G),C.append(D),h()&&(E=a("<div class='handle to' />"),C.append(E));var b=y?"right":"top";H=a('<div class="tooltip '+b+'"><div class="message" /></div>').hide(),I=H.find(".message"),J=a('<div class="tooltip '+b+'"><div class="message" /></div>').hide(),K=J.find(".message"),F.html(H),F.append(J),B.html(C),B.append(F),k()&&B.addClass("has-tooltip")}function w(){x.addEvent(D,"mousedown",function(b){D.data("select",!0),a("body").addClass("slider-cursor")}),h()&&x.addEvent(E,"mousedown",function(b){E.data("select",!0),a("body").addClass("slider-cursor")}),x.addEvent(C,"mousedown",function(b){a("body").addClass("slider-cursor"),"single"==x.options.type&&(D.data("select",!0),t(b,"from"))}),x.addEvent("body","mouseup",function(b){D.data("select",!1),"double"==x.options.type&&E.data("select",!1),a("body").removeClass("slider-cursor")}),x.addEvent("body","mousemove",function(a){D.data("select")?t(a,"from"):"double"==x.options.type&&E.data("select")&&t(a,"to")})}var x,y,z,A,B,C,D,E,F,G,H,I,J,K;this.init=function(){x=this,B=a(this.root),y="vertical"==this.options.orient,v(),w(),this.setFromValue(),this.setToValue()},this.setFromValue=function(a){var b=a||B.data("from")||this.options.from,c=(b-d())/(e()-d())*100;s(c,"from")},this.setToValue=function(a){if(h()){var b=a||B.data("to")||this.options.to,c=(b-d())/(e()-d())*100;s(c,"to")}},this.getFromValue=function(){return u()},this.getToValue=function(){var a;return h()?(a=y?parseFloat(E.css("bottom"))/C.height():parseFloat(E.css("left"))/C.width(),u(a)):u()}};return d.setup=function(){return{type:"single",orient:"horizontal",min:0,max:10,step:1,from:0,to:10,tooltip:!0,format:null,progress:!0}},d}),jui.defineUI("ui.progress",["jquery","util.base"],function(a,b){var c=function(){function b(){return l.options.min}function c(){return l.options.max}function d(){return l.options.orient}function e(){return l.options.type}function f(){return l.options.animated}function g(){return l.options.striped}function h(){return l.options.value}function i(a){"vertical"==d()?o.height(a+"%"):o.width(a+"%")}function j(){var a;return a="vertical"==d()?o.css("height"):o.css("width")}function k(){m.addClass(d()).addClass(e()),n=m.find(".area"),o=m.find(".bar"),0==n.length&&(n=a("<div class='area' />"),m.html(n)),0==o.length&&(o=a("<div class='bar' />"),n.html(o)),l.setValue(),l.setStriped(),l.setAnimated()}var l,m,n,o;this.init=function(){l=this,m=a(this.root),k()},this.setAnimated=function(a){"undefined"==typeof a?o.toggleClass("animated",f()):o.toggleClass("animated",a)},this.setStriped=function(a){"undefined"==typeof a?o.toggleClass("striped",g()):o.toggleClass("striped",a)},this.setValue=function(a){var a="undefined"==typeof a?h():a,d=(a-b())/(c()-b())*100;i(d)},this.getValue=function(){return b()+(c()-b())*(parseFloat(j().replace("%",""))/100)}};return c.setup=function(){return{type:"",orient:"horizontal",min:0,max:100,value:0,striped:!1,animated:!1}},c}),jui.defineUI("ui.autocomplete",["jquery","util.base","ui.dropdown"],function(a,b,c){var d=function(){function b(b,d){if(0==d.length)return void(f&&f.hide());f&&a(f.root).remove();var e=a(b.root).offset(),h=a(b.tpl.words({words:d}));a("body").append(h),f=c(h,{keydown:!0,width:a(b.root).outerWidth(),left:e.left,top:e.top+a(b.root).outerHeight(),event:{change:function(c,d){a(g).val(c.text),b.emit("change",[c.text,d])}}}),f.show()}function d(a){var b=[];if(""!=a)for(var c=0;c<h.length;c++){var d=h[c],e=h[c].toLowerCase(),f=a.toLowerCase();e.indexOf(f)!=-1&&b.push(d)}return b}function e(c){c.addEvent(g,"keyup",function(e){if(38!=e.which&&40!=e.which&&13!=e.which)return i=d(a(this).val()),b(c,i),!1})}var f=null,g=null,h=[],i=[];this.init=function(){var b=this.options;g=null==b.target?this.root:a(this.root).find(b.target),e(this),this.update(b.words)},this.update=function(a){h=a},this.close=function(){f&&f.hide()},this.list=function(){return i}};return d.setup=function(){return{target:null,words:[]}},d}),jui.defineUI("ui.tab",["jquery","util.base","ui.dropdown"],function(a,b,c){var d=function(){function b(b){var c=a(b.root).children("li");c.removeClass("active")}function d(b,c){var d=a(c).offset();a(c).addClass("checked"),k.show(d.left,d.top+a(b.root).height())}function e(b){var c=a(b.root).children("li"),d=c.eq(m);d.removeClass("checked")}function f(c,d){b(c);var e=a(c.root).children("li"),f=e.eq(d).addClass("active");l.appendTo(f),g(c.options.target,f[0])}function g(b,c,d){var e=a(c).find("[href*=#]").attr("href");a(b).children("*").each(function(b){var c=this;"#"+c.id==e?a(c).show():a(c).hide()})}function h(b){a(b.root).children("li").each(function(c){a(this).hasClass("menu")&&(m=c),b.addEvent(this,["click","contextmenu"],function(e){if(a(this).hasClass("disabled"))return!1;var h=a.trim(a(this).text()),i=a(this).val();if(c!=m){if(c!=n){var j=[{index:c,text:h,value:i},e];""!=b.options.target&&g(b.options.target,this),n=c,b.emit("change",j),b.emit("click",j),f(b,c)}}else b.emit("menu",[{index:c,text:h},e]),"show"!=k.type&&d(b,this);return!1})}),j(b),i(b)}function i(b){if(b.options.drag){var c=a(b.root).children("li"),d=null,e=null,f=null,g=null;c.each(function(h){b.addEvent(this,"mousedown",function(c){return d=a(this),e=d.clone().css("opacity","0.5"),f=h,b.emit("dragstart",[f,c]),!1}),b.addEvent(this,"mousemove",function(a){null!=f&&(g=h,f>g?0==g?e.insertBefore(c.eq(0)):e.insertAfter(c.eq(g-1)):g==c.length-1?e.insertAfter(c.eq(g)):e.insertBefore(c.eq(g+1)),d.hide())})}),b.addEvent(b.root,"mouseup",function(a){null!=d&&d.show(),null!=e&&e.remove(),null!=f&&null!=g&&(b.move(f,g),b.emit("dragend",[g,a])),f=null,g=null})}}function j(b){var c=a(b.root).children("li"),d=c.filter(".active"),e=c.eq(n),g=1==d.length?d:e;(g.hasClass("disabled")||0==g.length)&&(g=c.eq(0),n=0),l.appendTo(g),f(b,c.index(g))}var k=null,l=null,m=-1,n=0;this.init=function(){var b=this,d=this.options;if(n=d.index,l=a("<div class='anchor'></div>"),d.nodes.length>0?this.update(d.nodes):h(this),this.tpl.menu){var f=a(this.tpl.menu());a("body").append(f),k=c(f,{event:{change:function(a,c){e(b),b.emit("changemenu",[a,c])},hide:function(){e(b)}}})}return this},this.update=function(b){if(this.tpl.node){a(this.root).empty();for(var c=0;c<b.length;c++)a(this.root).append(this.tpl.node(b[c]));h(this)}},this.insert=function(b,c){if(this.tpl.node){var d=this.tpl.node(c),e=a(this.root).children("li");b==e.length?a(d).insertAfter(e.eq(b-1)):a(d).insertBefore(e.eq(b)),h(this)}},this.append=function(b){if(this.tpl.node){var c=this.tpl.node(b);m!=-1?(a(c).insertBefore(a(this.root).find(".menu")),m++):a(this.root).append(c),h(this)}},this.prepend=function(b){this.tpl.node&&(a(this.root).prepend(this.tpl.node(b)),h(this))},this.remove=function(b){a(this.root).children("li").eq(b).remove(),h(this)},this.move=function(b,c){if(b!=c){var d=a(this.root).children("li"),e=d.eq(b);b>c?0==c?e.insertBefore(d.eq(0)):e.insertAfter(d.eq(c-1)):c==d.length-1?e.insertAfter(d.eq(c)):e.insertBefore(d.eq(c+1)),n=c,h(this)}},this.show=function(b){if(b!=m&&b!=n){var c=a(this.root).children("li").eq(b);c.hasClass("disabled")||(n=b,this.emit("change",[{index:b,text:a.trim(c.text()),value:c.val()}]),f(this,b))}},this.enable=function(b){if(b!=m&&b!=n){var c=a(this.root).children("li").eq(b);c.removeClass("disabled")}},this.disable=function(b){if(b!=m&&b!=n){var c=a(this.root).children("li").eq(b);c.addClass("disabled")}},this.activeIndex=function(){return n}};return d.setup=function(){return{target:"",index:0,drag:!1,nodes:[]}},d}),jui.define("ui.tree.node",["jquery"],function(a){var b=function(b,c){function d(a){i.nodenum=isNaN(a)?i.nodenum:a,i.parent&&(null==i.parent.index?i.index=""+i.nodenum:i.index=i.parent.index+"."+i.nodenum),i.parent&&"string"==typeof i.index&&(i.depth=i.index.split(".").length),i.children.length>0&&e(i)}function e(a){for(var b=a.children,c=0;c<b.length;c++)b[c].reload(c),b[c].children.length>0&&e(b[c])}function f(){if(!c)return i.element;try{var b=a(c(a.extend({node:{index:i.index,data:i.data,depth:i.depth}},i.data))).get(0)}catch(d){console.log(d)}return b}function g(b){a(b.element).remove();for(var c=0;c<b.children.length;c++){var d=b.children[c];d.children.length>0?g(d):a(d.element).remove()}}function h(a){for(var b=0;b<a.children.length;b++){var c=a.children[b];c.reload(b),c.children.length>0&&h(c)}}var i=this;this.data=b,this.element=null,this.index=null,this.nodenum=null,this.parent=null,this.children=[],this.depth=0,this.type="open",this.reload=function(b,c){if(d(b),null!=this.element){var e=f();c?a(e).insertAfter(this.element):a(this.parent.element).children("ul").append(e),a(this.element).remove(),this.element=e}else this.element=f()},this.reloadChildrens=function(){h(this)},this.destroy=function(){null!=this.parent?this.parent.removeChild(this.index):(g(this),a(this.element).remove())},this.isLeaf=function(){return 0==this.children.length},this.fold=function(){a(this.element).children("ul").hide(),this.type="fold"},this.open=function(){a(this.element).children("ul").show(),this.type="open"},this.appendChild=function(b){a(this.element).children("ul").append(b.element),this.children.push(b)},this.insertChild=function(b,c){0==b?0==this.children.length?a(this.element).children("ul").append(c.element):a(c.element).insertBefore(this.children[0].element):a(c.element).insertAfter(this.children[b-1].element);var d=this.children.splice(0,b);d.push(c),this.children=d.concat(this.children),h(this)},this.removeChild=function(a){for(var b=0;b<this.children.length;b++){var c=this.children[b];c.index==a&&(this.children.splice(b,1),g(c))}h(this)},this.lastChild=function(){return this.children.length>0?this.children[this.children.length-1]:null},this.lastChildLeaf=function(a){var b=a?a:this.lastChild();return b.isLeaf()?b:this.lastChildLeaf(b.lastChild())}};return b}),jui.define("ui.tree.base",["jquery","util.base","ui.tree.node"],function(a,b,c){var d=function(a){function d(a,b,d){var e=new c(a,o.node);return e.parent=d?d:null,e.reload(b),e}function e(a,b){var c=b.children;if(c.length>0)for(var d=0;d<c.length;d++)a.push(c[d]),c[d].children.length>0&&e(a,c[d])}function f(a,b){if(!b)return null;var c=a.shift();return void 0==c?b:f(a,b.children[c])}function g(a,b){var c=p.getIndexList(a),e=l.getNodeParent(a),f=c[c.length-1],g=d(b,f,e);return e.insertChild(f,g),g}function h(a){if(null==m)m=d(a),n.tree.append(m.element);else{var b=d(a,m.children.length,m);m.appendChild(b)}return b}function i(a,b){var c=l.getNode(a),e=d(b,c.children.length,c);return c.appendChild(e),e}function j(a,b){for(var c=[];;){var d=b.parent;if(!d)break;c.push(d),b=d}for(var e=0;e<c.length;e++)if(a==c[e])return!0;return!1}function k(a,b){var c=p.getParentIndex(b);return null!=c&&(a==c||k(a,c))}var l=this,m=null,n=a.$obj,o=a.$tpl,p=b.index();this.appendNode=function(){var a=arguments[0],b=arguments[1];return b?i(a,b):h(a)},this.insertNode=function(a,b){return 0==m.children.length&&0==parseInt(a)?this.appendNode(b):g(a,b)},this.updateNode=function(a,b){var c=this.getNode(a);for(var d in b)c.data[d]=b[d];return c.reload(c.nodenum,!0),c.reloadChildrens(),c},this.removeNode=function(a){this.getNode(a).destroy()},this.removeNodes=function(){var a=m.children;if(a.length>0){var b=a.pop();b.parent=null,b.destroy(),this.removeNodes()}},this.openNode=function(a){null==a?this.getRoot().open():this.getNode(a).open()},this.foldNode=function(a){null==a?this.getRoot().fold():this.getNode(a).fold()},this.openNodeAll=function(a){for(var b=this.getNodeAll(a),c=0;c<b.length;c++)b[c].open();null==a&&this.getRoot().open()},this.foldNodeAll=function(a){for(var b=this.getNodeAll(a),c=0;c<b.length;c++)b[c].fold();null==a&&this.getRoot().fold()},this.moveNode=function(a,b){if(a!=b&&!k(a,b)){var c=this.getNode(a),d=this.getNodeParent(b),e=p.getIndexList(b),f=e[e.length-1];if(!j(c,d)){c.parent.children.splice(c.nodenum,1),c.parent.reloadChildrens(),c.parent=d;var g=d.children.splice(0,f);g.push(c),d.children=g.concat(d.children),d.reloadChildrens()}}},this.getNode=function(a){if(null==a)return m.children;var b=m.children;if(p.isIndexDepth(a)){var c=p.getIndexList(a);return f(c,b[c.shift()])}return b[a]?b[a]:null},this.getNodeAll=function(a){for(var b=[],c=null==a?m.children:[this.getNode(a)],d=0;d<c.length;d++)c[d]&&(b.push(c[d]),c[d].children.length>0&&e(b,c[d]));return b},this.getNodeParent=function(a){var b=p.getIndexList(a);return 1==b.length?m:2==b.length?this.getNode(b[0]):b.length>2?(b.pop(),this.getNode(b.join("."))):void 0},this.getRoot=function(){return m}};return d}),jui.defineUI("ui.tree",["util.base","ui.tree.base"],function(a,b){var c=function(){function c(a,b){for(var c=0;c<b.length;c++){var d=b[c];$(d.element).removeClass("open fold leaf last"),d.parent&&d.isLeaf()?$(d.element).addClass("leaf"):"open"==d.type?($(d.element).addClass("open"),d.open()):($(d.element).addClass("fold"),d.fold()),d.parent?d.parent.lastChild()==d&&$(d.element).addClass("last"):$(d.element).addClass("root"),$(d.element).children("i:first-child").remove(),$(d.element).prepend($("<i></i>"))}}function d(a,b,c){if(null==b)if(a.options.rootHide){for(var d=a.uit.getRoot().children,e=0;e<d.length;e++)c(d[e].index);k(a,!1)}else c(b),k(a,!0);else c(b),k(a,!1)}function e(a,b){for(var c=0;c<b.length;c++)!function(b){var c=$(b.element);a.addEvent(c.children("i:first-child"),"click",function(c){"open"==b.type?a.fold(b.index,c):a.open(b.index,c),c.stopPropagation()}),a.addEvent(c.children("a,span,div")[0],"click",function(d){c.hasClass("disabled")||c.attr("disabled")||(a.emit("select",[b,d]),a.emit("change",[b,d]),d.stopPropagation())})}(b[c])}function f(a,b){if(a.options.drag){var c=a.uit.getRoot();b||(l.start=null,l.end=null,l.clone=null),$(c.element).find("li.hover").removeClass("hover")}}function g(a,b){if(a.options.drag){for(var c=a.uit.getRoot(),d=0;d<b.length;d++)!function(b){$(b.element).off("mousedown").off("mouseup"),a.addEvent(b.element,"mousedown",function(c){if("I"!=c.target.tagName)return null==l.start&&a.emit("dragstart",[b,c])!==!1&&(l.start=b.index),!1}),a.addEvent(b.element,"mouseup",function(c){if("I"!=c.target.tagName){if(a.options.dragChild!==!1&&l.start&&l.start!=b.index){var d=b.lastChild(),e=d?n.getNextIndex(d.index):b.index+".0";a.emit("dragend",[a.get(b.index),c])!==!1&&a.move(l.start,e)}return f(a),!1}}),a.addEvent(b.element,"mouseover",function(c){if("I"!=c.target.tagName)return a.options.dragChild!==!1&&l.start&&l.start!=b.index&&a.emit("dragover",[b,c])!==!1&&(f(a,!0),$(b.element).addClass("hover")),!1}),a.addEvent(c.element,"mouseup",function(b){if("I"!=b.target.tagName){if(a.options.dragChild!==!1&&l.start){var d=""+c.children.length;a.move(l.start,d),a.emit("dragend",[a.get(d),b])}return f(a),!1}})}(b[d]);a.addEvent("body","mouseup",function(b){return l.start&&l.end&&(a.move(l.start,l.end),a.emit("dragend",[a.get(l.end),b])),f(a),!1})}}function h(a){if(a.options.drag){$(a.root).find(".drag").remove();for(var b=a.listAll(),c=0;c<b.length;c++){var d=b[c],e=$(d.element).position();e.top>0&&j(a,d,e)}}}function i(a){if(a.options.drag)for(var b=a.listAll(),c=0;c<b.length;c++){var d=b[c],e=$(d.element).position();e.top>0&&d.parent&&d.parent.lastChild()==d&&(e.top=e.top+$(d.element).outerHeight(),j(a,d,e,!0))}}function j(a,b,c,d){if(a.options.drag){var e=d?n.getNextIndex(b.index):b.index,g=$("<div class='drag'></div>").attr("data-index",e).css(c).outerWidth($(b.element).outerWidth());$(a.root).append(g),a.addEvent(g,"mouseover",function(b){l.start&&(l.end=e,g.addClass("on"),f(a,!0))}),a.addEvent(g,"mouseout",function(a){l.start&&g.removeClass("on")})}}function k(a,b){var d=a.listAll();c(a,d),e(a,d),g(a,d),h(a),i(a),b&&(c(a,[a.uit.getRoot()]),e(a,[a.uit.getRoot()]))}var l={start:null,end:null,clone:null},m=null,n=a.index();this.init=function(){var a=this.options;if(this.uit=new b({$obj:{tree:$(this.root)},$tpl:this.tpl}),!a.root)throw new Error("JUI_CRITICAL_ERROR: root data is required");if(this.uit.appendNode(a.root),k(this,!0),a.rootHide){var c=this.uit.getRoot();$(c.element).css("padding-left","0px"),$(c.element).children("*:not(ul)").hide()}a.rootFold&&this.fold()},this.update=function(b,c){var d=1==arguments.length?arguments[0]:arguments[1],b=2==arguments.length?arguments[0]:null;if(null!=b)this.uit.updateNode(b,d);else{var e=a.index();this.uit.removeNodes();for(var f=0;f<d.length;f++){var g=e.getParentIndex(d[f].index);null==g?this.uit.appendNode(d[f].data):this.uit.appendNode(g,d[f].data)}}k(this)},this.append=function(){var a=1==arguments.length?arguments[0]:arguments[1],b=2==arguments.length?arguments[0]:null;a=void 0==a.length?[a]:a;for(var c=0;c<a.length;c++)null!=b?this.uit.appendNode(b,a[c]):this.uit.appendNode(a[c]);k(this)},this.insert=function(a,b){for(var c=void 0==b.length?[b]:b,d=0;d<c.length;d++)this.uit.insertNode(a,c[d]);k(this)},this.select=function(a){var b=null==a?this.uit.getRoot():this.get(a);return $(this.root).find("li").removeClass("active"),$(b.element).addClass("active"),m=a,b},this.unselect=function(){if(null!=m){var a=this.get(m);return $(a.element).removeClass("active"),m=null,a}},this.remove=function(a){this.uit.removeNode(a),k(this)},this.reset=function(){this.uit.removeNodes(),k(this)},this.move=function(a,b){this.uit.moveNode(a,b),k(this)},this.open=function(a,b){if(null!=a||!this.options.rootHide){var c=null==a;this.uit.openNode(a),k(this,c),this.emit("open",[c?this.uit.getRoot():this.get(a),b])}},this.fold=function(a,b){if(null!=a||!this.options.rootHide){var c=null==a;this.uit.foldNode(a),k(this,c),this.emit("fold",[c?this.uit.getRoot():this.get(a),b])}},this.openAll=function(a){var b=this,c=null==a;d(this,a,function(a){b.uit.openNodeAll(a)}),this.emit("openall",[c?this.uit.getRoot():this.get(a)])},this.foldAll=function(a){var b=this,c=null==a;d(this,a,function(a){b.uit.foldNodeAll(a)}),this.emit("foldall",[c?this.uit.getRoot():this.get(a)])},this.list=function(){return this.uit.getNode()},this.listAll=function(){return this.uit.getNodeAll()},this.listParents=function(a){function b(a){null!=a.index&&(d.push(a),null!=a.parent&&b(a.parent))}var c=this.get(a),d=[];return c.parent&&b(c.parent),d.reverse()},this.get=function(a){return null==a?null:this.uit.getNode(a)},this.getAll=function(a){return null==a?null:this.uit.getNodeAll(a)},this.activeIndex=function(){return m}};return c.setup=function(){return{root:null,rootHide:!1,rootFold:!1,drag:!1,dragChild:!0}},c}),jui.defineUI("ui.window",["jquery","util.base","ui.modal"],function(a,b,c){var d=function(){function b(){var a=h.$foot.length<1?5:h.$foot.outerHeight();h.$body.outerHeight(h.$root.outerHeight()-h.$head.outerHeight()-a)}var d=null,e=null,f={},g={},h={},i=null;this.init=function(){var j=this,k=this.options,l=a(this.root),m=a(this.root).children(".head"),n=a(this.root).children(".body"),o=a(this.root).children(".foot");if(k.modal&&(k.move=!1,k.resize=!1),d=k.layerIndex,h={$root:l,$head:m,$body:n,$foot:o},l.css(a.extend({position:"absolute"},k)).appendTo(a("body")),k.move&&this.addEvent(m,"mousedown",function(a){e=l,f.check=!0,f.disX=a.pageX-e.offset().left,f.disY=a.pageY-e.offset().top}),k.resize&&(l.append("<i class='icon-resize resize'></i>"),this.addEvent(l.children(".resize"),"mousedown",function(a){return e=l,g.check=!0,g.disX=e.width()+e.offset().left,g.disWidth=e.width(),g.disY=e.height()+e.offset().top,g.disHeight=e.height(),!1})),k.modal||j.addEvent(l,"mousedown",function(a){l.css("z-index",++d),a.stopPropagation()}),this.addEvent(m.find(".close"),"click",function(a){return j.hide(),!1}),this.addEvent("body","mousemove",function(c){if(f.check){var d=c.pageX-f.disX,h=c.pageY-f.disY;a(e).css({left:d+"px",top:h+"px"})}if(g.check){var i=c.pageX-g.disX,j=c.pageY-g.disY;e.width(g.disWidth+i),e.height(g.disHeight+j),b()}}),this.addEvent("body","mouseup",function(a){f.check&&j.emit("move",a),g.check&&j.emit("resize",a),f.check=!1,g.check=!1}),this.type="hide",l.hide(),k.modal){var p=k.modalIndex>0?{index:k.modalIndex}:{};i=c(j.root,a.extend({autoHide:!1},p))}},this.hide=function(){i?i.hide():h.$root.hide(),this.emit("hide"),this.type="hide"},this.show=function(a,c){i?i.show():h.$root.show(),(a||c)&&this.move(a,c),this.emit("show"),this.type="show",b()},this.move=function(a,b){h.$root.css("left",a),h.$root.css("top",b)},this.update=function(a){h.$body.empty().html(a)},this.setTitle=function(a){h.$head.find(".title").empty().html(a)},this.setSize=function(a,c){h.$root.width(a),h.$root.height(c),b()},this.resize=function(){b()},this.resizeModal=function(){i&&i.resize()}};return d.setup=function(){return{width:400,height:300,left:"auto",top:"auto",right:"auto",bottom:"auto",modal:!1,move:!0,resize:!0,modalIndex:0,layerIndex:2e3,animate:!1}},d}),jui.defineUI("ui.property",["jquery","util.base"],function(a,b){var c=function(){function c(a){var b=jui.getAll(),c=0;for(len=b.length;c<len&&b[c][0]!=a;c++);jui.remove(c)}function d(a){for(var b=0,c=i.length;b<c;b++)a.call(h,i[b],b)}function e(a,b,c){var d;return function(){var e=arguments,f=function(){d=null,a.apply(c,e)};clearTimeout(d),d=setTimeout(f,b)}}var f,g,h,i=[],j={};this.init=function(){h=this,f=a(this.root),g=a("<div class='property-table' />").css({position:"relative"}),f.append(g),this.loadItems(this.options.items)},this.loadItems=function(a){i=b.clone(a),this.initProperty(),this.emit("load.items")},this.initProperty=function(){g.empty(),d(function(a,b){g.append(this.renderItem(a,b))})},this.addItem=function(a){b.typeCheck("array",a)||(a=[a]),i=i.concat(a),this.initProperty()},this.removeItem=function(a){for(var b=[],c=0,d=i.length;c<d;c++){var e=i[c];e.key!=a.key&&e.title!=a.title||b.push(e)}i=b},this.getGroupList=function(){var b=[];return g.find(".property-header-item").each(function(){var c=a(this).data("item");b.push({name:c.title,id:a(this).attr("id")})}),b},this.collapsed=function(a){var b=f.find("#"+a);b.addClass("collapsed").removeClass("expanded"),b.find(".expand-btn i").removeClass("icon-minus").addClass("icon-plus");for(var c=b.next();c.length&&!c.hasClass("property-header-item");)c.hide(),c=c.next()},this.expanded=function(a){var b=f.find("#"+a);b.removeClass("collapsed").addClass("expanded"),b.find(".expand-btn i").removeClass("icon-plus").addClass("icon-minus");for(var c=b.next();c.length&&!c.hasClass("property-header-item");)c.show(),c=c.next()},this.renderItem=function(c,d){var e=a("<div class='property-item' />").attr("data-index",d);if("group"==c.type){e.addClass("property-header-item expanded"),e.attr("id","property-header-item-"+d),e.data("item",c);var f=a("<div class='property-header' />").html(c.title);c.description&&f.append("<small class='description'>"+c.description+"</small>"),f.append("<a class='expand-btn'><i class='icon-minus' ></i></a>"),e.on("click",function(b){a(this).hasClass("collapsed")?h.expanded(e.attr("id")):h.collapsed(e.attr("id"))}),e.append(f)}else{(b.typeCheck("array",c.value)||c.vertical)&&e.addClass("vertical"),e.attr("data-key",c.key);var f=a("<div class='property-title'  />").html(c.title),g=a("<div class='property-render'  />"),i=this.render(e,c);g.append(a("<div class='item' />").html(i)),c.description&&g.append("<div class='description' >"+c.description+"</div>"),e.append(f),e.append(g)}return e},this.render=function(a,b){var c=b.type||"text",d=b.render||j[c]||j.defaultRenderer;return d(a,b)},this.getValue=function(a){return a?this.getItem(a).value:this.getAllValue()},this.getDefaultValue=function(){for(var a={},b=0,c=this.options.items;b<c;b++){var d=this.options.items[b];"undefined"!=typeof d.value&&(a[d.key]=d.value)}return a},this.initValue=function(a){d(function(a,b){a.value=""}),this.initProperty(),a&&this.setValue(a)},this.setValue=function(a){if(a=a||{},Object.keys(a).length)for(var b in a)this.updateValue(b,a[b])},this.findRender=function(a){return this.findItem(a).find(".property-render .item")},this.findItem=function(a){return g.find("[data-key='"+a+"']")},this.getItem=function(a){var c;return c=b.typeCheck("number",a)?i[a]:b.typeCheck("string",a)?i[parseInt(this.findItem(a).attr("data-index"))]:i[parseInt(a.attr("data-index"))]},this.updateValue=function(a,b){var c=this.findItem(a),d=this.getItem(a);if(d){d.value=b;var e=this.findRender(a);e.empty(),e.html(this.render(c,d))}},this.getAllValue=function(a){var b={};return d(function(a,c){"group"!==a.type&&(b[a.key]=a.value)}),b},this.refreshValue=function(a,b){var c=this.getItem(a),d=c.value;c.value=b,this.emit("change",[c,b,d])},j.str2array=function(a,b){return b=b||",","string"==typeof a?a.split(b):a},j.defaultRenderer=function(a,b){return j.text(a,b)},j.select=function(c,d){for(var f=a("<select />").css({"max-width":"100%"}),g=d.items||[],i=0,k=g.length;i<k;i++){var l=g[i];"string"==typeof l&&(l={text:l,value:l}),f.append(a("<option >").val(l.value).text(l.text))}return f.val(d.value),f.on("change",e(function(){var c=a(this).val();c=b.typeCheck("array",d.value)?j.str2array(c):c,h.refreshValue(a(this).closest(".property-item"),c)},250,f)),f},j.text=function(c,d){var f=a("<input type='text' />").css({width:"100%"}).attr({placeholder:"Type here"});return d.readonly&&$input.attr("readonly",!0),f.val(d.value),f.on("input",e(function(){var e=a(this).val();e=b.typeCheck("array",d.value)?j.str2array(e):e,h.refreshValue(c,e)},250,f)),a([f[0]])},j.textarea=function(c,d){var f=a("<textarea />").css({width:"100%",height:d.height||100}).attr({placeholder:"Type here"});return d.readonly&&f.attr("readonly",!0),f.val(d.value),f.on("input",e(function(){var c=a(this).val();c=b.typeCheck("array",d.value)?j.str2array(c):c,h.refreshValue(a(this).closest(".property-item"),c)},250,f)),f},j.html=function(b,c){var d=a("<div class='html' contenteditable=true />").css({width:"100%",height:c.height||100});return c.readonly&&d.attr("contenteditable",!1),d.html(c.value),d.on("input",e(function(){var b=a(this).html();h.refreshValue(a(this).closest(".property-item"),b)},250,d)),d},j.number=function(b,c){var d=a("<input type='number' />").css({"text-align":"center"});return d.attr("max",c.max||100),d.attr("min",c.min||0),d.attr("step",c.step||1),d.val(c.value),d.on("input",e(function(){h.refreshValue(a(this).closest(".property-item"),+a(this)[0].value)},250,d)),d},j.range=function(b,c){var d=a("<div />").css({position:"relative"}),f=a("<input type='range' />").css({width:"100px","z-index":1});value=c.value;var g=c.postfix||"";c.postfix&&(value=value.replace(g,"")),f.attr("max",c.max||100),f.attr("min",c.min||0),f.attr("step",c.step||1),f.val(+value),c.readonly&&f.attr("readonly",!0);var i=a("<div class='range-progress' />");i.width(value/(+f.attr("max")-+f.attr("min"))*f.width());var j=a("<span />");return j.text(value+g),f.on("input",function(){var b=a(this),c=+b[0].value,d=c/(+b.attr("max")-+b.attr("min"))*a(this).width();i.width(d),j.text(c+g)}),f.on("input",e(function(){var b=a(this),c=+b[0].value;h.refreshValue(b.closest(".property-item"),c+g)},250,f)),d.append([f,i,j]),d},j.checkbox=function(b,c){var d=a("<input type='checkbox' /><i ></i>");return a(d[0]).hide(),d[0].checked="true"==c.value||c.value===!0,d[0].checked?a(d[1]).addClass("icon-checkbox"):a(d[1]).addClass("icon-checkbox2"),d.on("click",e(function(){var c=a(this).hasClass("icon-checkbox");c?a(this).addClass("icon-checkbox2").removeClass("icon-checkbox"):a(this).addClass("icon-checkbox").removeClass("icon-checkbox2"),c=!c,h.refreshValue(b,c)},100,d)),d},j["switch"]=function(b,c){var d=a("<div class='switch inner small' />"),e="true"==c.value||c.value===!0;
  return jui.create("ui.switch",d,{checked:e,event:{change:function(a){h.refreshValue(b,a)}}}),d},j.property=function(b,c){var d=a("<div class='property inner' />"),e=jui.create("ui.property",d,{items:c.items,event:{change:function(){h.refreshValue(b,this.getValue())}}});return e.setValue(c.value),d},j.date=function(b,c){var d=g,e=a("<div class='datepicker-input' />"),f=a("<span class='datepicker-value-text'></span>").css({cursor:"pointer"});e.on("click",function(){var a=e.offset(),b=d.offset(),c=d.outerWidth(),f=d.outerHeight(),g=a.left-b.left;g+e.outerWidth()>=c&&(g=c-e.outerWidth()-20);var h=a.top-b.top+80;h+e.outerHeight()>=f&&(h=f-e.outerHeight()-20),j.css({position:"absolute","z-index":1e5,left:g,top:h}),j.show()});var i=a("<i class='icon-calendar' />");e.html(i),e.append(f);var j=a("<div class='datepicker' />").css({position:"absolute",top:"0px",display:"none"}),k=a("<div class='head' />"),l=a("<table class='body' />");k.html('<div class="prev"><i class="icon-chevron-left"></i></div><div class="title"></div><div class="next"><i class="icon-chevron-right"></i></div>'),l.html("<tr><th>SU</th><th>MO</th><th>TU</th><th>WE</th><th>TH</th><th>FR</th><th>SA</th></tr>"),j.append(k),j.append(l),d.after(j);var m=jui.create("ui.datepicker",j,{date:c.value||+new Date,titleFormat:c.titleFormat||"yyyy. MM",format:c.format||"yyyy/MM/dd",tpl:{date:c.tpl_date||"<td><!= date !></td>"},event:{select:function(a,c){f.html(a),h.refreshValue(b,a)}}});return a("body").on("click",function(b){var c=a(b.target).closest(".datepicker"),d=a(b.target).closest(e);c.length||d.length||j.hide()}),f.html(m.getDate()),e},j.colors=function(b,c){for(var d=c.value,e=[],f=0,g=d.length;f<g;f++){var h=j.color(b,c,f);e.push(h[0])}return a(e)},j.color=function(b,d,f){f="undefined"==typeof f?-1:f;var i=a("<a  class='color-input' />"),j=g,k=f==-1?d.value:d.value[f],l=a("<span />").css({"background-color":k}).html("&nbsp;"),m=a("<span />").html(k||""),n=a("<span class='none-color' title='Delete a color'/>").html("<i class='icon-more'></i>");return i.append(l),i.append(m),i.append(n),i.on("click",function(b){if(a(b.target).closest(".none-color").length)return b.preventDefault(),l.css("background-color",""),m.text(""),void h.refreshValue(i.closest(".property-item"),"");var g=a(this).offset(),n=j.next(".colorpicker");if(n.length)n[0].jui.setColor(k||"");else{n=a('<div class="colorpicker" />'),j.after(n);var o=jui.create("ui.colorpicker",n,{color:k,event:{change:e(function(){var a=o.getColor("hex");if(!(a.indexOf("NAN")>-1))if(l.css("background-color",a),m.html(a),f==-1)h.refreshValue(i.closest(".property-item"),a);else{var b=d.value;b[f]=a,h.refreshValue(i.closest(".property-item"),b)}},100,o)}});a("body").on("click",function(b){var d=a(b.target).closest(".colorpicker"),e=a(b.target).closest(i);d.length||e.length||(c(o),n.remove())})}var p=j.offset(),q=j.outerWidth(),r=j.outerHeight(),s=g.left-p.left;s+n.outerWidth()>=q&&(s=q-n.outerWidth()-20);var t=g.top-p.top+50;t+n.outerHeight()>=r&&(t=r-n.outerHeight()-20),n.css({position:"absolute","z-index":1e5,left:s,top:t}),n.show()}),i}};return c.setup=function(){return{sort:"group",viewport:"default",items:[]}},c}),jui.defineUI("ui.select",["jquery","util.base"],function(a,b){var c=function(){var c,d,e,f,g=[],h={divider:function(b,c){return a("<hr class='item divider' />")},item:function(b,c){var d=a('<div class="item option " />');d.attr("data-index",c),d.attr("value",b.value);var e=b.text?"text":"html";return"function"==typeof b[e]?d[e].call(d,b[e].call(b,this)):(d.text(b.text),d[e].call(d,b[e])),b.selected&&d.addClass("selected"),d}};this.init=function(){c=this,d=a(this.root),g=b.clone(this.options.items),d.hasClass("select")||d.addClass("select"),this.initSelect(),this.initEvent(),this.update(g)},this.initEvent=function(){d.on("click",".title",function(){d.toggleClass("open")}),d.on("click",".item.option",function(){c.setValue(a(this).attr("value"))}),a("body").on("click",function(b){var c=a(b.target).closest(d);c.length||d.removeClass("open")})},this.initSelect=function(){e=a("<div class='title' />"),f=a("<div class='items' />"),e.append(a("<span />").addClass("title-content")),e.append(a("<i class='icon-arrow2' ></i>")),d.addClass("select-"+this.options.align),d.addClass("select-"+this.options.valign),this.options.multi&&d.addClass("multi"),d.append(e).append(f)},this.render=function(){e.find(".title-content").empty(),f.empty();for(var a=0,b=g.length;a<b;a++){var c=g[a],d=c.type||"item",i=h[d].call(null,c,a);f.append(i)}},this.setValue=function(a){var b=0;if(this.options.multi){a instanceof Array||(a=[a]);for(var b=0,c=a.length;b<c;b++)f.find("[value='"+a[b]+"']").toggleClass("selected")}else{var d=f.find(".selected"),e=d.attr("value");d.removeClass("selected"),f.find("[value='"+a+"']").addClass("selected")}this.setTitle(),this.emit("change",[this.getValue(),e])},this.getValue=function(){var b=f.find(".selected").map(function(){return a(this).attr("value")}).toArray();return this.options.multi?b:b[0]},this.setSelectedIndex=function(a){g[a]&&this.setValue(g[a].value)},this.getSelectedIndex=function(){var a=+f.find(".selected").data("index");return a||-1},this.setTitle=function(){var b=f.find(".selected").map(function(){return a("<span class='item-view'>"+a(this).html()+"</span>")[0]}).toArray();if(0==b.length)var c=this.options.placeholder;else var c=a(b);e.find(".title-content").html(c)},this.update=function(a){g=b.clone(a);for(var c=0,d=0,e=g.length;d<e;d++){var f=g[d];"string"==typeof f&&(g[d]={text:f,value:f}),f.selected&&(c=d)}this.render(),this.setTitle()}};return c.setup=function(){return{items:[],placeholder:"Select a item",align:"left",valign:"top",multi:!1,modal:!1}},c}),jui.defineUI("ui.splitter",["jquery"],function(a){var b=function(){function b(){return"vertical"==m}function c(a){if(b()){var c=a.clientX-g.data("prevClientX"),d=parseFloat(g.css("left"))+c;d=e.caculateMinSize(d),g.css("left",d+"px"),p[1].css("left",d+j+"px"),p[0].css("width",d+"px"),n=d,g.data("prevClientX",a.clientX)}else{var f=a.clientY-g.data("prevClientY"),h=parseFloat(g.css("top"))+f;h=e.caculateMinSize(h),g.css("top",h+"px"),p[1].css("top",h+j+"px"),p[0].css("height",h+"px"),n=h,g.data("prevClientY",a.clientY)}}function d(){a(document).off("mousemove",c),a(document).off("mouseup",d),h.css("user-select",""),h.find("iframe").css("pointer-events","auto"),e.emit("move.done",[g])}var e,f,g,h,i,j,k,l,m,n,o,p=[];this.init=function(){e=this,f=a(this.root),i=this.options.barSize,m=this.options.direction,n=this.options.initSize,k=this.options.minSize,o=this.options.fixed,"number"==typeof k&&(k=[k,k]);for(var b=[],c=0,d=this.options.items.length;c<d;c++)p[c]=f.find(this.options.items[c]),p[c].css({position:"absolute",width:"auto",height:"auto",top:0,right:0,bottom:0,left:0}),b[c]=p[c][0];h=a(b),this.initElement(),this.initEvent()},this.initElement=function(){f.css({position:"absolute",width:"100%",height:"100%",overflow:"hidden"}),g&&g.length&&g.remove(),g=b()?a("<div  />").css({position:"absolute",top:"0px",width:i,bottom:"0px",cursor:"ew-resize"}):a("<div />").css({position:"absolute",left:"0px",height:i,right:"0px",cursor:"ns-resize"}),g.addClass(this.options.splitterClass),g.css(this.options.barStyle),j=b()?g.outerWidth():g.outerHeight(),f.append(g),this.initResize()},this.getSize=function(a,b){return"string"==typeof a&&a.indexOf("%")>-1?b*(parseFloat(a.replace("%",""))/100):a},this.getShowList=function(){for(var b=[],c=0,d=h.length;c<d;c++){var f=a(h[c]);f.hasClass(e.options.hideClass)||b.push(h[c])}return a(b)},this.caculateMinSize=function(a){return b()?a<j+k[0]?a=j+k[0]:a>l-j-k[1]&&(a=l-j-k[1]):a<j+k[0]?a=j+k[0]:a>l-j-k[1]&&(a=l-j-k[1]),a},this.initResize=function(){var a=this.getShowList();if(1==a.length)a.css({left:"0px",width:"auto",height:"auto",right:0,top:0,bottom:0}),g.hide();else{if(b()){var c=f.width(),d=this.caculateMinSize(this.getSize(n,c));p[0].css({left:"0px",width:d+"px",top:0,bottom:0}),p[1].css({left:d+j+"px",right:"0px",width:"auto",top:0,bottom:0}),g.css({left:d+"px"})}else{var e=f.height(),d=this.caculateMinSize(this.getSize(n,e));p[0].css({top:"0px",height:d+"px",width:"auto",left:0,right:0,bottom:"auto"}),p[1].css({top:d+j+"px",bottom:"0px",width:"auto",left:0,right:0}),g.css({top:d+"px"})}g.show()}},this.initEvent=function(){o!==!0&&f.on("mousedown","> ."+this.options.splitterClass,function(e){h.css("user-select","none"),h.find("iframe").css("pointer-events","none"),b()?(l=f.width(),g.data("prevClientX",e.clientX)):(l=f.height(),g.data("prevClientY",e.clientY)),a(document).on("mousemove",c),a(document).on("mouseup",d)})},this.setDirection=function(a){m=a,this.initElement()},this.setInitSize=function(a){n=a,this.initResize()},this.setHide=function(b){a(h[b]).hide().addClass(e.options.hideClass),this.initResize()},this.setShow=function(b){a(h[b]).show().removeClass(e.options.hideClass),this.initResize()},this.toggle=function(b){a(h[b]).hasClass(e.options.hideClass)?this.setShow(b):this.setHide(b)}};return b.setup=function(){return{splitterClass:"ui-splitter",hideClass:"hide",barSize:4,barStyle:{"background-color":"#f6f6f6","border-right":"1px solid #e4e4e4"},direction:"vertical",initSize:"50%",minSize:30,items:[],fixed:!1}},b}),jui.defineUI("ui.timepicker",["jquery"],function(a){var b=function(){function b(a,b){var c=new Date(a,b,0),d={min:{year:2015,month:1,date:1,hours:0,minutes:0},max:{year:2020,month:12,date:c.getDate(),hours:23,minutes:59}};return d}function c(a){return a<10?"0"+a:a}function d(a){var b=a||window.event,c=b.keyCode||b.which;c=String.fromCharCode(c);var d=/[0-9]|\./;d.test(c)||(b.returnValue=!1,b.preventDefault&&b.preventDefault())}function e(b,d,e){var f=parseInt(a(b).val());isNaN(f)?a(b).val(c(d)):(f>e&&a(b).val(e),f<d&&a(b).val(c(d)))}function f(b,d){var e=parseInt(a(b).val()),f=e+(d||0);f<0&&(f=0),a(b).val(c(f))}function g(b,c,d,g,h){h||a(b).focus(),f(b,c),e(b,d,g)}function h(c){var d=a(c.target).parent(),e=0,f=k.attr("class"),h=b(d.children(".year").val(),d.children(".month").val());38==c.which?e=1:40==c.which&&(e=-1),0!=e&&g(c.target,e,h.min[f],h.max[f])}function i(e){var f=e.options.year,i=e.options.month,j=e.options.date,l=e.options.hours,m=e.options.minutes,n=a(e.root).children(".year").attr("maxlength",4),o=a(e.root).children(".month").attr("maxlength",2),p=a(e.root).children(".date").attr("maxlength",2),q=a(e.root).children(".hours").attr("maxlength",2),r=a(e.root).children(".minutes").attr("maxlength",2);n.on("keypress",d),n.on("keyup",h),n.on("focusout",function(a){g(this,0,2015,2020,!0)}),n.on("focus",function(a){k=n,k.select()}),o.on("keypress",d),o.on("keyup",h),o.on("focusout",function(a){g(this,0,1,12,!0)}),o.on("focus",function(a){k=o,k.select()}),p.on("keypress",d),p.on("keyup",h),p.on("focusout",function(a){var c=b(n.val(),o.val());g(this,0,1,c.max.date,!0)}),p.on("focus",function(a){k=p,k.select()}),q.on("keypress",d),q.on("keyup",h),q.on("focusout",function(a){g(this,0,0,23,!0)}),q.on("focus",function(a){k=q,k.select()}),r.on("keypress",d),r.on("keyup",h),r.on("focusout",function(a){g(this,0,0,59,!0)}),r.on("focus",function(a){k=r,k.select()}),n.val(f),o.val(c(i)),p.val(c(j)),q.val(c(l)),r.val(c(m)),k=0==n.size()?q:n}function j(c){var d=a(c.root).children("i"),e=a("<div></div>"),f=a("<div></div>"),h=a(c.root).children(".year"),i=a(c.root).children(".month");a(c.root).children(".date"),a(c.root).children(".hours"),a(c.root).children(".minutes");if(!(h.size()>0)){var j=d.outerWidth(),l=a(c.root).outerHeight(),m={position:"absolute",width:j,height:l/2,cursor:"pointer",right:d.css("right")};e.css(a.extend({top:"0px"},m)),f.css(a.extend({top:l/2+"px"},m)),e.on("click",function(a){var c=k.attr("class"),d=b(h.val(),i.val());g(k[0],1,d.min[c],d.max[c])}),f.on("click",function(a){var c=k.attr("class"),d=b(h.val(),i.val());g(k[0],-1,d.min[c],d.max[c])}),a(c.root).append(e),a(c.root).append(f)}}var k=null;this.init=function(){return i(this),j(this),this},this.setYear=function(b){var c=a(this.root).children(".year").val(b);g(c[0],0,2015,2020)},this.getYear=function(){return parseInt(a(this.root).children(".year").val())},this.setMonth=function(b){var c=a(this.root).children(".month").val(b);g(c[0],0,1,12)},this.getMonth=function(){return parseInt(a(this.root).children(".month").val())},this.setDate=function(c){var d=b(this.getYear(),this.getMonth()),e=a(this.root).children(".date").val(c);g(e[0],0,1,d.max.date)},this.getDate=function(){return parseInt(a(this.root).children(".date").val())},this.setHours=function(b){var c=a(this.root).children(".hours").val(b);g(c[0],0,0,23)},this.getHours=function(){return parseInt(a(this.root).children(".hours").val())},this.setMinutes=function(b){var c=a(this.root).children(".minutes").val(b);g(c[0],0,0,59)},this.getMinutes=function(){return parseInt(a(this.root).children(".minutes").val())}};return b.setup=function(){var a=new Date;return{year:a.getFullYear(),month:a.getMonth()+1,date:a.getDate(),hours:a.getHours(),minutes:a.getMinutes()}},b});