add extra sizes for image figures
[roojs1] / roojs-all.js
1 // Roo.js
2 window["undefined"]=window["undefined"];var Roo={};Roo.apply=function(o,c,A){if(A){Roo.apply(o,A);}if(o&&c&&typeof c=='object'){for(var p in c){o[p]=c[p];}}return o;};(function(){var A=0;var ua=navigator.userAgent.toLowerCase();var B=document.compatMode=="CSS1Compat",C=ua.indexOf("opera")>-1,D=(/webkit|khtml/).test(ua),E=ua.indexOf("firefox")>-1,F=ua.indexOf("msie")>-1,G=ua.indexOf("msie 7")>-1,H=/trident.*rv\:11\./.test(ua),I=ua.indexOf("edge")>-1,J=!D&&ua.indexOf("gecko")>-1,K=F&&!B,L=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),M=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),N=(ua.indexOf("linux")!=-1),O=window.location.href.toLowerCase().indexOf("https")===0,P=/iphone|ipad/.test(ua),Q=/android/.test(ua),R=(function(){try{if(ua.indexOf('chrome')!=-1&&ua.indexOf('android')==-1){window.addEventListener('touchstart',function __set_has_touch__(){Roo.isTouch=true;
3 window.removeEventListener('touchstart',__set_has_touch__);});return false;}document.createEvent("TouchEvent");return true;}catch(e){return false;}})();if(F&&!G){try{document.execCommand("BackgroundImageCache",false,true);}catch(e){}}Roo.apply(Roo,{isStrict:B,isSecure:O,isReady:false,debug:false,enableGarbageCollector:true,enableListenerCollection:false,SSL_SECURE_URL:"javascript:false",BLANK_IMAGE_URL:"http:/"+"/localhost/s.gif",emptyFn:function(){}
4 ,applyIf:function(o,c){if(o&&c){for(var p in c){if(typeof o[p]=="undefined"){o[p]=c[p];}}}return o;},addBehaviors:function(o){if(!Roo.isReady){Roo.onReady(function(){Roo.addBehaviors(o);});return;}var S={};for(var b in o){var T=b.split('@');if(T[1]){var s=T[0];
5 if(!S[s]){S[s]=Roo.select(s);}S[s].on(T[1],o[b]);}}S=null;},id:function(el,S){S=S||"roo-gen";el=Roo.getDom(el);var id=S+(++A);return el?(el.id?el.id:(el.id=id)):id;},extend:function(){var io=function(o){for(var m in o){this[m]=o[m];}};return function(sb,sp,S){if(typeof sp=='object'){S=sp;
6 sp=sb;sb=function(){sp.apply(this,arguments);};}var F=function(){},T,U=sp.prototype;F.prototype=U;T=sb.prototype=new F();T.constructor=sb;sb.superclass=U;if(U.constructor==Object.prototype.constructor){U.constructor=sp;}sb.override=function(o){Roo.override(sb,o);
7 };T.override=io;Roo.override(sb,S);return sb;};}(),override:function(S,T){if(T){var p=S.prototype;for(var U in T){p[U]=T[U];}}},namespace:function(){var a=arguments,o=null,i,j,d,rt;for(i=0;i<a.length;++i){d=a[i].split(".");rt=d[0];eval('if (typeof '+rt+' == "undefined"){'+rt+' = {};} o = '+rt+';');
8 for(j=1;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}},factory:function(c,ns){if(!c.xtype||(!ns&&!c.xns)||(c.xns===false)){return c;}ns=c.xns?c.xns:ns;if(c.constructor==ns[c.xtype]){return c;}if(ns[c.xtype]){if(Roo.debug){Roo.log("Roo.Factory("+c.xtype+")");
9 }var S=new ns[c.xtype](c);S.xns=false;return S;}c.xns=false;return c;},log:function(s){if((typeof(console)=='undefined')||(typeof(console.log)=='undefined')){return;}console.log(s);},urlEncode:function(o){if(!o){return "";}var S=[];for(var T in o){var ov=o[T],k=Roo.encodeURIComponent(T);
10 var U=typeof ov;if(U=='undefined'){S.push(k,"=&");}else if(U!="function"&&U!="object"){S.push(k,"=",Roo.encodeURIComponent(ov),"&");}else if(ov instanceof Array){if(ov.length){for(var i=0,V=ov.length;i<V;i++){S.push(k,"=",Roo.encodeURIComponent(ov[i]===undefined?'':ov[i]),"&");
11 }}else{S.push(k,"=&");}}}S.pop();return S.join("");},encodeURIComponent:function(S){try{return encodeURIComponent(S);}catch(e){}if(S==''||S==null){return '';}function nibble_to_hex(V){var W='0123456789ABCDEF';return W.charAt(V);}S=S.toString();var T='';for(var i=0;
12 i<S.length;i++){var c=S.charCodeAt(i);var bs=new Array();if(c>0x10000){bs[0]=0xF0|((c&0x1C0000)>>>18);bs[1]=0x80|((c&0x3F000)>>>12);bs[2]=0x80|((c&0xFC0)>>>6);bs[3]=0x80|(c&0x3F);}else if(c>0x800){bs[0]=0xE0|((c&0xF000)>>>12);bs[1]=0x80|((c&0xFC0)>>>6);bs[2]=0x80|(c&0x3F);
13 }else if(c>0x80){bs[0]=0xC0|((c&0x7C0)>>>6);bs[1]=0x80|(c&0x3F);}else{bs[0]=c;}for(var j=0;j<bs.length;j++){var b=bs[j];var U=nibble_to_hex((b&0xF0)>>>4)+nibble_to_hex(b&0x0F);T+='%'+U;}}return T;},urlDecode:function(S,T){if(!S||!S.length){return {};}var U={}
14 ;var V=S.split('&');var W,X,Y;for(var i=0,Z=V.length;i<Z;i++){W=V[i].split('=');X=decodeURIComponent(W[0]);Y=decodeURIComponent(W[1]);if(T!==true){if(typeof U[X]=="undefined"){U[X]=Y;}else if(typeof U[X]=="string"){U[X]=[U[X]];U[X].push(Y);}else{U[X].push(Y);
15 }}else{U[X]=Y;}}return U;},each:function(S,fn,T){if(typeof S.length=="undefined"||typeof S=="string"){S=[S];}for(var i=0,U=S.length;i<U;i++){if(fn.call(T||S[i],S[i],i,S)===false){return i;};}},combine:function(){var as=arguments,l=as.length,r=[];for(var i=0;
16 i<l;i++){var a=as[i];if(a instanceof Array){r=r.concat(a);}else if(a.length!==undefined&&!a.substr){r=r.concat(Array.prototype.slice.call(a,0));}else{r.push(a);}}return r;},escapeRe:function(s){return s.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1");},callback:function(cb,S,T,U){if(typeof cb=="function"){if(U){cb.defer(U,S,T||[]);
17 }else{cb.apply(S,T||[]);}}},getDom:function(el){if(!el){return null;}return el.dom?el.dom:(typeof el=='string'?document.getElementById(el):el);},getCmp:function(id){return Roo.ComponentMgr.get(id);},num:function(v,S){if(typeof v!='number'){return S;}return v;
18 },destroy:function(){for(var i=0,a=arguments,S=a.length;i<S;i++){var as=a[i];if(as){if(as.dom){as.removeAllListeners();as.remove();continue;}if(typeof as.purgeListeners=='function'){as.purgeListeners();}if(typeof as.destroy=='function'){as.destroy();}}}},type:function(o){if(o===undefined||o===null){return false;
19 }if(o.htmlElement){return 'element';}var t=typeof o;if(t=='object'&&o.nodeName){switch(o.nodeType){case 1:return 'element';case 3:return (/\S/).test(o.nodeValue)?'textnode':'whitespace';}}if(t=='object'||t=='function'){switch(o.constructor){case Array:return 'array';
20 case RegExp:return 'regexp';}if(typeof o.length=='number'&&typeof o.item=='function'){return 'nodelist';}}return t;},isEmpty:function(v,S){return v===null||v===undefined||(!S?v==='':false);},isOpera:C,isSafari:D,isFirefox:E,isIE:F,isIE7:G,isIE11:H,isEdge:I,isGecko:J,isBorderBox:K,isWindows:L,isLinux:N,isMac:M,isIOS:P,isAndroid:Q,isTouch:R,useShims:((F&&!G)||(J&&M)),selectNode:function(S,T){var U=Roo.DomQuery.selectNode(S,T);
21 return U?Roo.get(U):new Roo.Element(false);},getGridSize:function(){var w=Roo.lib.Dom.getViewWidth();switch(true){case w>1200:return 'xl';case w>992:return 'lg';case w>768:return 'md';case w>576:return 'sm';default:return 'xs'}}});})();Roo.namespace("Roo","Roo.util","Roo.grid","Roo.dd","Roo.tree","Roo.data","Roo.form","Roo.menu","Roo.state","Roo.lib","Roo.layout","Roo.app","Roo.ux");
22
23 // Function.js
24 (function(){if(Roo.isIE){function fnCleanUp(){var p=Function.prototype;delete p.createSequence;delete p.defer;delete p.createDelegate;delete p.createCallback;delete p.createInterceptor;window.detachEvent("onunload",fnCleanUp);}window.attachEvent("onunload",fnCleanUp);
25 }})();Roo.apply(Function.prototype,{createCallback:function(){var A=arguments;var B=this;return function(){return B.apply(window,A);};},createDelegate:function(A,B,C){var D=this;return function(){var E=B||arguments;if(C===true){E=Array.prototype.slice.call(arguments,0);
26 E=E.concat(B);}else if(typeof C=="number"){E=Array.prototype.slice.call(arguments,0);var F=[C,0].concat(B);Array.prototype.splice.apply(E,F);}return D.apply(A||window,E);};},defer:function(A,B,C,D){var fn=this.createDelegate(B,C,D);if(A){return setTimeout(fn,A);
27 }fn();return 0;},createSequence:function(A,B){if(typeof A!="function"){return this;}var C=this;return function(){var D=C.apply(this||window,arguments);A.apply(B||this||window,arguments);return D;};},createInterceptor:function(A,B){if(typeof A!="function"){return this;
28 }var C=this;return function(){A.target=this;A.method=C;if(A.apply(B||this||window,arguments)===false){return;}return C.apply(this||window,arguments);};}});
29 // String.js
30 Roo.applyIf(String,{escape:function(A){return A.replace(/('|\\)/g,"\\$1");},leftPad:function(A,B,ch){var C=new String(A);if(ch===null||ch===undefined||ch===''){ch=" ";}while(C.length<B){C=ch+C;}return C;},format:function(A){var B=Array.prototype.slice.call(arguments,1);
31 return A.replace(/\{(\d+)\}/g,function(m,i){return Roo.util.Format.htmlEncode(B[i]);});}});String.prototype.toggle=function(A,B){return this==A?B:A;};String.prototype.unicodeClean=function(){return this.replace(/[\s\S]/g,function(A){if(A.charCodeAt()<256){return A;
32 }try{encodeURIComponent(A);}catch(e){return '';}return A;});};String.prototype.toUpperCaseFirst=function(){return this.charAt(0).toUpperCase()+this.slice(1);};
33 // Number.js
34 Roo.applyIf(Number.prototype,{constrain:function(A,B){return Math.min(Math.max(this,A),B);}});
35 // Array.js
36 Roo.applyIf(Array.prototype,{indexOf:function(o){for(var i=0,A=this.length;i<A;i++){if(this[i]==o){return i;}}return -1;},remove:function(o){var A=this.indexOf(o);if(A!=-1){this.splice(A,1);}},map:function(A){var B=this.length>>>0;if(typeof A!="function"){throw new TypeError();
37 }var C=new Array(B);var D=arguments[1];for(var i=0;i<B;i++){if(i in this){C[i]=A.call(D,this[i],i,this);}}return C;},equals:function(b){if(this===b){return true;}if(b==null){return false;}if(this.length!==b.length){return false;}for(var i=0;i<this.length;
38 ++i){if(this[i]!==b[i]){return false;}}return true;}});Roo.applyIf(Array,{from:function(o){var A=[];for(var i=0;i<o.length;i++){A[i]=o[i];}return A;}});
39 // Date.js
40 Date.prototype.getElapsed=function(A,B){A=A||new Date();var C=Math.abs(A.getTime()-this.getTime());switch(B){case Date.SECOND:return Math.floor(C/(1000));case Date.MINUTE:return Math.floor(C/(1000*60));case Date.HOUR:return Math.floor(C/(1000*60*60));case Date.DAY:return Math.floor(C/(1000*60*60*24));
41 case Date.MONTH:return ((A.format("Y")-this.format("Y"))*12)+(A.format("m")-this.format("m"));case Date.YEAR:return (A.format("Y")-this.format("Y"));case Date.MILLI:default:return C;}};Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0}
42 ;Date.prototype.dateFormat=function(A){if(Date.formatFunctions[A]==null){Date.createNewFormat(A);}var B=Date.formatFunctions[A];return this[B]();};Date.prototype.format=Date.prototype.dateFormat;Date.createNewFormat=function(A){var B="format"+Date.formatFunctions.count++;
43 Date.formatFunctions[A]=B;var C="Date.prototype."+B+" = function(){return ";var D=false;var ch='';for(var i=0;i<A.length;++i){ch=A.charAt(i);if(!D&&ch=="\\"){D=true;}else if(D){D=false;C+="'"+String.escape(ch)+"' + ";}else{C+=Date.getFormatCode(ch);}}eval(C.substring(0,C.length-3)+";}");
44 };Date.getFormatCode=function(A){switch(A){case "d":return "String.leftPad(this.getDate(), 2, '0') + ";case "D":return "Date.dayNames[this.getDay()].substring(0, 3) + ";case "j":return "this.getDate() + ";case "l":return "Date.dayNames[this.getDay()] + ";
45 case "S":return "this.getSuffix() + ";case "w":return "this.getDay() + ";case "z":return "this.getDayOfYear() + ";case "W":return "this.getWeekOfYear() + ";case "F":return "Date.monthNames[this.getMonth()] + ";case "m":return "String.leftPad(this.getMonth() + 1, 2, '0') + ";
46 case "M":return "Date.monthNames[this.getMonth()].substring(0, 3) + ";case "n":return "(this.getMonth() + 1) + ";case "t":return "this.getDaysInMonth() + ";case "L":return "(this.isLeapYear() ? 1 : 0) + ";case "Y":return "this.getFullYear() + ";case "y":return "('' + this.getFullYear()).substring(2, 4) + ";
47 case "a":return "(this.getHours() < 12 ? 'am' : 'pm') + ";case "A":return "(this.getHours() < 12 ? 'AM' : 'PM') + ";case "g":return "((this.getHours() % 12) ? this.getHours() % 12 : 12) + ";case "G":return "this.getHours() + ";case "h":return "String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0') + ";
48 case "H":return "String.leftPad(this.getHours(), 2, '0') + ";case "i":return "String.leftPad(this.getMinutes(), 2, '0') + ";case "s":return "String.leftPad(this.getSeconds(), 2, '0') + ";case "O":return "this.getGMTOffset() + ";case "P":return "this.getGMTColonOffset() + ";
49 case "T":return "this.getTimezone() + ";case "Z":return "(this.getTimezoneOffset() * -60) + ";default:return "'"+String.escape(A)+"' + ";}};Date.parseDate=function(A,B){if(Date.parseFunctions[B]==null){Date.createParser(B);}var C=Date.parseFunctions[B];return Date[C](A);
50 };Date.createParser=function(A){var B="parse"+Date.parseFunctions.count++;var C=Date.parseRegexes.length;var D=1;Date.parseFunctions[A]=B;var E="Date."+B+" = function(input){\n"+"var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, o, z, v;\n"+"var d = new Date();\n"+"y = d.getFullYear();\n"+"m = d.getMonth();\n"+"d = d.getDate();\n"+"if (typeof(input) !== 'string') { input = input.toString(); }\n"+"var results = input.match(Date.parseRegexes["+C+"]);\n"+"if (results && results.length > 0) {";
51 var F="";var G=false;var ch='';for(var i=0;i<A.length;++i){ch=A.charAt(i);if(!G&&ch=="\\"){G=true;}else if(G){G=false;F+=String.escape(ch);}else{var H=Date.formatCodeToRegex(ch,D);D+=H.g;F+=H.s;if(H.g&&H.c){E+=H.c;}}}E+="if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"+"{v = new Date(y, m, d, h, i, s); v.setFullYear(y);}\n"+"else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"+"{v = new Date(y, m, d, h, i); v.setFullYear(y);}\n"+"else if (y >= 0 && m >= 0 && d > 0 && h >= 0)\n"+"{v = new Date(y, m, d, h); v.setFullYear(y);}\n"+"else if (y >= 0 && m >= 0 && d > 0)\n"+"{v = new Date(y, m, d); v.setFullYear(y);}\n"+"else if (y >= 0 && m >= 0)\n"+"{v = new Date(y, m); v.setFullYear(y);}\n"+"else if (y >= 0)\n"+"{v = new Date(y); v.setFullYear(y);}\n"+"}return (v && (z || o))?\n"+"    ((z)? v.add(Date.SECOND, (v.getTimezoneOffset() * 60) + (z*1)) :\n"+"        v.add(Date.HOUR, (v.getGMTOffset() / 100) + (o / -100))) : v\n"+";}";
52 Date.parseRegexes[C]=new RegExp("^"+F+"$");eval(E);};Date.formatCodeToRegex=function(A,B){switch(A){case "D":return {g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case "j":return {g:1,c:"d = parseInt(results["+B+"], 10);\n",s:"(\\d{1,2})"};case "d":return {g:1,c:"d = parseInt(results["+B+"], 10);\n",s:"(\\d{2})"}
53 ;case "l":return {g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case "S":return {g:0,c:null,s:"(?:st|nd|rd|th)"};case "w":return {g:0,c:null,s:"\\d"};case "z":return {g:0,c:null,s:"(?:\\d{1,3})"};case "W":return {g:0,c:null,s:"(?:\\d{2})"};case "F":return {g:1,c:"m = parseInt(Date.monthNumbers[results["+B+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"}
54 ;case "M":return {g:1,c:"m = parseInt(Date.monthNumbers[results["+B+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case "n":return {g:1,c:"m = parseInt(results["+B+"], 10) - 1;\n",s:"(\\d{1,2})"};case "m":return {g:1,c:"m = Math.max(0,parseInt(results["+B+"], 10) - 1);\n",s:"(\\d{2})"}
55 ;case "t":return {g:0,c:null,s:"\\d{1,2}"};case "L":return {g:0,c:null,s:"(?:1|0)"};case "Y":return {g:1,c:"y = parseInt(results["+B+"], 10);\n",s:"(\\d{4})"};case "y":return {g:1,c:"var ty = parseInt(results["+B+"], 10);\n"+"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"}
56 ;case "a":return {g:1,c:"if (results["+B+"] == 'am') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case "A":return {g:1,c:"if (results["+B+"] == 'AM') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"}
57 ;case "g":case "G":return {g:1,c:"h = parseInt(results["+B+"], 10);\n",s:"(\\d{1,2})"};case "h":case "H":return {g:1,c:"h = parseInt(results["+B+"], 10);\n",s:"(\\d{2})"};case "i":return {g:1,c:"i = parseInt(results["+B+"], 10);\n",s:"(\\d{2})"};case "s":return {g:1,c:"s = parseInt(results["+B+"], 10);\n",s:"(\\d{2})"}
58 ;case "O":return {g:1,c:["o = results[",B,"];\n","var sn = o.substring(0,1);\n","var hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60);\n","var mn = o.substring(3,5) % 60;\n","o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))?\n","    (sn + String.leftPad(hr, 2, 0) + String.leftPad(mn, 2, 0)) : null;\n"].join(""),s:"([+\-]\\d{2,4})"}
59 ;case "P":return {g:1,c:["o = results[",B,"];\n","var sn = o.substring(0,1);\n","var hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60);\n","var mn = o.substring(4,6) % 60;\n","o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))?\n","    (sn + String.leftPad(hr, 2, 0) + String.leftPad(mn, 2, 0)) : null;\n"].join(""),s:"([+\-]\\d{4})"}
60 ;case "T":return {g:0,c:null,s:"[A-Z]{1,4}"};case "Z":return {g:1,c:"z = results["+B+"];\n"+"z = (-43200 <= z*1 && z*1 <= 50400)? z : null;\n",s:"([+\-]?\\d{1,5})"};default:return {g:0,c:null,s:String.escape(A)};}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{1,4})[\-+][0-9]{4} .*$/,"$1");
61 };Date.prototype.getGMTOffset=function(){return (this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.abs(Math.floor(this.getTimezoneOffset()/60)),2,"0")+String.leftPad(this.getTimezoneOffset()%60,2,"0");};Date.prototype.getGMTColonOffset=function(){return (this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.abs(Math.floor(this.getTimezoneOffset()/60)),2,"0")+":"+String.leftPad(this.getTimezoneOffset()%60,2,"0");
62 };Date.prototype.getDayOfYear=function(){var A=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var i=0;i<this.getMonth();++i){A+=Date.daysInMonth[i];}return A+this.getDate()-1;};Date.prototype.getWeekOfYear=function(){var A=this.getDayOfYear()+(4-this.getDay());
63 var B=new Date(this.getFullYear(),0,1);var C=(7-B.getDay()+4);return String.leftPad(((A-C)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var A=this.getFullYear();return ((A&3)==0&&(A%100||(A%400==0&&A)));};Date.prototype.getFirstDayOfMonth=function(){var A=(this.getDay()-(this.getDate()-1))%7;
64 return (A<0)?(A+7):A;};Date.prototype.getLastDayOfMonth=function(){var A=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return (A<0)?(A+7):A;};Date.prototype.getFirstDateOfMonth=function(){return new Date(this.getFullYear(),this.getMonth(),1);
65 };Date.prototype.getLastDateOfMonth=function(){return new Date(this.getFullYear(),this.getMonth(),this.getDaysInMonth());};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()];};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return "st";
66 case 2:case 22:return "nd";case 3:case 23:return "rd";default:return "th";}};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];
67 Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.prototype.clone=function(){return new Date(this.getTime());
68 };Date.prototype.clearTime=function(A){if(A){return this.clone().clearTime();}this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};if(Roo.isSafari&&typeof(Date.brokenSetMonth)=='undefined'){Date.brokenSetMonth=Date.prototype.setMonth;
69 Date.prototype.setMonth=function(A){if(A<=-1){var n=Math.ceil(-A);var B=Math.ceil(n/12);var C=(n%12)?12-n%12:0;this.setFullYear(this.getFullYear()-B);return Date.brokenSetMonth.call(this,C);}else{return Date.brokenSetMonth.apply(this,arguments);}};}Date.MILLI="ms";
70 Date.SECOND="s";Date.MINUTE="mi";Date.HOUR="h";Date.DAY="d";Date.MONTH="mo";Date.YEAR="y";Date.prototype.add=function(A,B){var d=this.clone();if(!A||B===0){return d;}switch(A.toLowerCase()){case Date.MILLI:d.setMilliseconds(this.getMilliseconds()+B);break;
71 case Date.SECOND:d.setSeconds(this.getSeconds()+B);break;case Date.MINUTE:d.setMinutes(this.getMinutes()+B);break;case Date.HOUR:d.setHours(this.getHours()+B);break;case Date.DAY:d.setDate(this.getDate()+B);break;case Date.MONTH:var C=this.getDate();if(C>28){C=Math.min(C,this.getFirstDateOfMonth().add('mo',B).getLastDateOfMonth().getDate());
72 }d.setDate(C);d.setMonth(this.getMonth()+B);break;case Date.YEAR:d.setFullYear(this.getFullYear()+B);break;}return d;};
73 // Roo/lib/Dom.js
74 Roo.lib.Dom={getViewWidth:function(A){return A?this.getDocumentWidth():this.getViewportWidth();},getViewHeight:function(A){return A?this.getDocumentHeight():this.getViewportHeight();},getDocumentHeight:function(){var A=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;
75 return Math.max(A,this.getViewportHeight());},getDocumentWidth:function(){var A=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;return Math.max(A,this.getViewportWidth());},getViewportHeight:function(){var A=self.innerHeight;
76 var B=document.compatMode;if((B||Roo.isIE)&&!Roo.isOpera){A=(B=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;}return A;},getViewportWidth:function(){var A=self.innerWidth;var B=document.compatMode;if(B||Roo.isIE){A=(B=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;
77 }return A;},isAncestor:function(p,c){p=Roo.getDom(p);c=Roo.getDom(c);if(!p||!c){return false;}if(p.contains&&!Roo.isSafari){return p.contains(c);}else if(p.compareDocumentPosition){return !!(p.compareDocumentPosition(c)&16);}else{var A=c.parentNode;while(A){if(A==p){return true;
78 }else if(!A.tagName||A.tagName.toUpperCase()=="HTML"){return false;}A=A.parentNode;}return false;}},getRegion:function(el){return Roo.lib.Region.getRegion(el);},getY:function(el){return this.getXY(el)[1];},getX:function(el){return this.getXY(el)[0];},getXY:function(el){var p,pe,b,A,bd=document.body;
79 el=Roo.getDom(el);var B=Roo.lib.AnimBase.fly;if(el.getBoundingClientRect){b=el.getBoundingClientRect();A=B(document).getScroll();return [b.left+A.left,b.top+A.top];}var x=0,y=0;p=el;var C=B(el).getStyle("position")=="absolute";while(p){x+=p.offsetLeft;y+=p.offsetTop;
80 if(!C&&B(p).getStyle("position")=="absolute"){C=true;}if(Roo.isGecko){pe=B(p);var bt=parseInt(pe.getStyle("borderTopWidth"),10)||0;var bl=parseInt(pe.getStyle("borderLeftWidth"),10)||0;x+=bl;y+=bt;if(p!=el&&pe.getStyle('overflow')!='visible'){x+=bl;y+=bt;
81 }}p=p.offsetParent;}if(Roo.isSafari&&C){x-=bd.offsetLeft;y-=bd.offsetTop;}if(Roo.isGecko&&!C){var D=B(bd);x+=parseInt(D.getStyle("borderLeftWidth"),10)||0;y+=parseInt(D.getStyle("borderTopWidth"),10)||0;}p=el.parentNode;while(p&&p!=bd){if(!Roo.isOpera||(p.tagName!='TR'&&B(p).getStyle("display")!="inline")){x-=p.scrollLeft;
82 y-=p.scrollTop;}p=p.parentNode;}return [x,y];},setXY:function(el,xy){el=Roo.fly(el,'_setXY');el.position();var A=el.translatePoints(xy);if(xy[0]!==false){el.dom.style.left=A.left+"px";}if(xy[1]!==false){el.dom.style.top=A.top+"px";}},setX:function(el,x){this.setXY(el,[x,false]);
83 },setY:function(el,y){this.setXY(el,[false,y]);}};
84 // Roo/lib/Event.js
85 Roo.lib.Event=function(){var A=false;var B=[];var C=[];var D=0;var E=[];var F=0;var G=null;return {POLL_RETRYS:200,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,_interval:null,startInterval:function(){if(!this._interval){var H=this;var I=function(){H._tryPreloadAttach();
86 };this._interval=setInterval(I,this.POLL_INTERVAL);}},onAvailable:function(H,I,J,K){E.push({id:H,fn:I,obj:J,override:K,checkReady:false});D=this.POLL_RETRYS;this.startInterval();},addListener:function(el,H,fn){el=Roo.getDom(el);if(!el||!fn){return false;}
87 if("unload"==H){C[C.length]=[el,H,fn];return true;}var I=function(e){return fn(Roo.lib.Event.getEvent(e));};var li=[el,H,fn,I];var J=B.length;B[J]=li;this.doAdd(el,H,I,false);return true;},removeListener:function(el,H,fn){var i,I;el=Roo.getDom(el);if(!fn){return this.purgeElement(el,false,H);
88 }if("unload"==H){for(i=0,I=C.length;i<I;i++){var li=C[i];if(li&&li[0]==el&&li[1]==H&&li[2]==fn){C.splice(i,1);return true;}}return false;}var J=null;var K=arguments[3];if("undefined"==typeof K){K=this._getCacheIndex(el,H,fn);}if(K>=0){J=B[K];}if(!el||!J){return false;
89 }this.doRemove(el,H,J[this.WFN],false);delete B[K][this.WFN];delete B[K][this.FN];B.splice(K,1);return true;},getTarget:function(ev,H){ev=ev.browserEvent||ev;ev=ev.touches?(ev.touches[0]||ev.changedTouches[0]||ev):ev;var t=ev.target||ev.srcElement;return this.resolveTextNode(t);
90 },resolveTextNode:function(H){if(Roo.isSafari&&H&&3==H.nodeType){return H.parentNode;}else{return H;}},getPageX:function(ev){ev=ev.browserEvent||ev;ev=ev.touches?(ev.touches[0]||ev.changedTouches[0]||ev):ev;var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(Roo.isIE){x+=this.getScroll()[1];
91 }}return x;},getPageY:function(ev){ev=ev.browserEvent||ev;ev=ev.touches?(ev.touches[0]||ev.changedTouches[0]||ev):ev;var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(Roo.isIE){y+=this.getScroll()[0];}}return y;},getXY:function(ev){ev=ev.browserEvent||ev;ev=ev.touches?(ev.touches[0]||ev.changedTouches[0]||ev):ev;
92 return [this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){ev=ev.browserEvent||ev;ev=ev.touches?(ev.touches[0]||ev.changedTouches[0]||ev):ev;var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else if(ev.type=="mouseover"){t=ev.fromElement;
93 }}return this.resolveTextNode(t);},getTime:function(ev){ev=ev.browserEvent||ev;ev=ev.touches?(ev.touches[0]||ev.changedTouches[0]||ev):ev;if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(ex){this.lastError=ex;return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);
94 this.preventDefault(ev);},stopPropagation:function(ev){ev=ev.browserEvent||ev;if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){ev=ev.browserEvent||ev;if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;
95 }},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){ev=ev.browserEvent||ev;return ev.charCode||ev.keyCode||0;},_getCacheIndex:function(el,H,fn){for(var i=0,I=B.length;
96 i<I;++i){var li=B[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==H){return i;}}return -1;},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){A=true;var EU=Roo.lib.Event;if(Roo.isIE){EU.doRemove(window,"load",EU._load);
97 }},_tryPreloadAttach:function(){if(this.locked){return false;}this.locked=true;var H=!A;if(!H){H=(D>0);}var I=[];for(var i=0,J=E.length;i<J;++i){var K=E[i];if(K){var el=this.getEl(K.id);if(el){if(!K.checkReady||A||el.nextSibling||(document&&document.body)){var L=el;
98 if(K.override){if(K.override===true){L=K.obj;}else{L=K.override;}}K.fn.call(L,K.obj);E[i]=null;}}else{I.push(K);}}}D=(I.length===0)?0:D-1;if(H){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return true;},purgeElement:function(el,H,I){var J=this.getListeners(el,I);
99 if(J){for(var i=0,K=J.length;i<K;++i){var l=J[i];this.removeListener(el,l.type,l.fn);}}if(H&&el&&el.childNodes){for(i=0,K=el.childNodes.length;i<K;++i){this.purgeElement(el.childNodes[i],H,I);}}},getListeners:function(el,H){var I=[],J;if(!H){J=[B,C];}else if(H=="unload"){J=[C];
100 }else{J=[B];}for(var j=0;j<J.length;++j){var K=J[j];if(K&&K.length>0){for(var i=0,L=K.length;i<L;++i){var l=K[i];if(l&&l[this.EL]===el&&(!H||H===l[this.TYPE])){I.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}}
101 return (I.length)?I:null;},_unload:function(e){var EU=Roo.lib.Event,i,j,l,H,I;for(i=0,H=C.length;i<H;++i){l=C[i];if(l){var J=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){J=l[EU.OBJ];}else{J=l[EU.ADJ_SCOPE];}}l[EU.FN].call(J,EU.getEvent(e),l[EU.OBJ]);
102 C[i]=null;l=null;J=null;}}C=null;if(B&&B.length>0){j=B.length;while(j){I=j-1;l=B[I];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],I);}j=j-1;}l=null;EU.clearCache();}EU.doRemove(window,"unload",EU._unload);},getScroll:function(){var dd=document.documentElement,db=document.body;
103 if(dd&&(dd.scrollTop||dd.scrollLeft)){return [dd.scrollTop,dd.scrollLeft];}else if(db){return [db.scrollTop,db.scrollLeft];}else{return [0,0];}},doAdd:function(){if(window.addEventListener){return function(el,H,fn,I){el.addEventListener(H,fn,(I));};}else if(window.attachEvent){return function(el,H,fn,I){el.attachEvent("on"+H,fn);
104 };}else{return function(){};}}(),doRemove:function(){if(window.removeEventListener){return function(el,H,fn,I){el.removeEventListener(H,fn,(I));};}else if(window.detachEvent){return function(el,H,fn){el.detachEvent("on"+H,fn);};}else{return function(){};}
105 }()};}();(function(){var E=Roo.lib.Event;E.on=E.addListener;E.un=E.removeListener;if(document&&document.body){E._load();}else{E.doAdd(window,"load",E._load);}E.doAdd(window,"unload",E._unload);E._tryPreloadAttach();})();
106 // Roo/lib/Ajax.js
107 (function(){Roo.lib.Ajax={request:function(A,B,cb,C,D){if(D){var hs=D.headers;if(hs){for(var h in hs){if(hs.hasOwnProperty(h)){this.initHeader(h,hs[h],false);}}}if(D.xmlData){this.initHeader('Content-Type','text/xml',false);A='POST';C=D.xmlData;}}return this.asyncRequest(A,B,cb,C);
108 },serializeForm:function(A){if(typeof A=='string'){A=(document.getElementById(A)||document.forms[A]);}var el,B,C,D,E='',F=false;for(var i=0;i<A.elements.length;i++){el=A.elements[i];D=A.elements[i].disabled;B=A.elements[i].name;C=A.elements[i].value;if(!D&&B){switch(el.type){case 'select-one':case 'select-multiple':for(var j=0;
109 j<el.options.length;j++){if(el.options[j].selected){if(Roo.isIE){E+=Roo.encodeURIComponent(B)+'='+Roo.encodeURIComponent(el.options[j].attributes['value'].specified?el.options[j].value:el.options[j].text)+'&';}else{E+=Roo.encodeURIComponent(B)+'='+Roo.encodeURIComponent(el.options[j].hasAttribute('value')?el.options[j].value:el.options[j].text)+'&';
110 }}}break;case 'radio':case 'checkbox':if(el.checked){E+=Roo.encodeURIComponent(B)+'='+Roo.encodeURIComponent(C)+'&';}break;case 'file':case undefined:case 'reset':case 'button':break;case 'submit':if(F==false){E+=Roo.encodeURIComponent(B)+'='+Roo.encodeURIComponent(C)+'&';
111 F=true;}break;default:E+=Roo.encodeURIComponent(B)+'='+Roo.encodeURIComponent(C)+'&';break;}}}E=E.substr(0,E.length-1);return E;},headers:{},hasHeaders:false,useDefaultHeader:true,defaultPostHeader:'application/x-www-form-urlencoded',useDefaultXhrHeader:true,defaultXhrHeader:'XMLHttpRequest',hasDefaultHeaders:true,defaultHeaders:{}
112 ,poll:{},timeout:{},pollInterval:50,transactionId:0,setProgId:function(id){this.activeX.unshift(id);},setDefaultPostHeader:function(b){this.useDefaultHeader=b;},setDefaultXhrHeader:function(b){this.useDefaultXhrHeader=b;},setPollingInterval:function(i){if(typeof i=='number'&&isFinite(i)){this.pollInterval=i;
113 }},createXhrObject:function(A){var B,C;try{C=new XMLHttpRequest();B={conn:C,tId:A};}catch(e){for(var i=0;i<this.activeX.length;++i){try{C=new ActiveXObject(this.activeX[i]);B={conn:C,tId:A};break;}catch(e){}}}finally{return B;}},getConnectionObject:function(){var o;
114 var A=this.transactionId;try{o=this.createXhrObject(A);if(o){this.transactionId++;}}catch(e){}finally{return o;}},asyncRequest:function(A,B,C,D){var o=this.getConnectionObject();if(!o){return null;}else{o.conn.open(A,B,true);if(this.useDefaultXhrHeader){if(!this.defaultHeaders['X-Requested-With']){this.initHeader('X-Requested-With',this.defaultXhrHeader,true);
115 }}if(D&&this.useDefaultHeader){this.initHeader('Content-Type',this.defaultPostHeader);}if(this.hasDefaultHeaders||this.hasHeaders){this.setHeader(o);}this.handleReadyState(o,C);o.conn.send(D||null);return o;}},handleReadyState:function(o,A){var B=this;if(A&&A.timeout){this.timeout[o.tId]=window.setTimeout(function(){B.abort(o,A,true);
116 },A.timeout);}this.poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(B.poll[o.tId]);delete B.poll[o.tId];if(A&&A.timeout){window.clearTimeout(B.timeout[o.tId]);delete B.timeout[o.tId];}B.handleTransactionResponse(o,A);
117 }},this.pollInterval);},handleTransactionResponse:function(o,A,B){if(!A){this.releaseObject(o);return;}var C,D;try{if(o.conn.status!==undefined&&o.conn.status!=0){C=o.conn.status;}else{C=13030;}}catch(e){C=13030;}if(C>=200&&C<300){D=this.createResponseObject(o,A.argument);
118 if(A.success){if(!A.scope){A.success(D);}else{A.success.apply(A.scope,[D]);}}}else{switch(C){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:D=this.createExceptionObject(o.tId,A.argument,(B?B:false));if(A.failure){if(!A.scope){A.failure(D);
119 }else{A.failure.apply(A.scope,[D]);}}break;default:D=this.createResponseObject(o,A.argument);if(A.failure){if(!A.scope){A.failure(D);}else{A.failure.apply(A.scope,[D]);}}}}this.releaseObject(o);D=null;},createResponseObject:function(o,A){var B={};var C={}
120 ;try{var D=o.conn.getAllResponseHeaders();var E=D.split('\n');for(var i=0;i<E.length;i++){var F=E[i].indexOf(':');if(F!=-1){C[E[i].substring(0,F)]=E[i].substring(F+2);}}}catch(e){}B.tId=o.tId;B.status=o.conn.status;B.statusText=o.conn.statusText;B.getResponseHeader=C;
121 B.getAllResponseHeaders=D;B.responseText=o.conn.responseText;B.responseXML=o.conn.responseXML;if(typeof A!==undefined){B.argument=A;}return B;},createExceptionObject:function(A,B,C){var D=0;var E='communication failure';var F=-1;var G='transaction aborted';
122 var H={};H.tId=A;if(C){H.status=F;H.statusText=G;}else{H.status=D;H.statusText=E;}if(B){H.argument=B;}return H;},initHeader:function(A,B,C){var D=(C)?this.defaultHeaders:this.headers;if(D[A]===undefined){D[A]=B;}else{D[A]=B+","+D[A];}if(C){this.hasDefaultHeaders=true;
123 }else{this.hasHeaders=true;}},setHeader:function(o){if(this.hasDefaultHeaders){for(var A in this.defaultHeaders){if(this.defaultHeaders.hasOwnProperty(A)){o.conn.setRequestHeader(A,this.defaultHeaders[A]);}}}if(this.hasHeaders){for(var A in this.headers){if(this.headers.hasOwnProperty(A)){o.conn.setRequestHeader(A,this.headers[A]);
124 }}this.headers={};this.hasHeaders=false;}},resetDefaultHeaders:function(){delete this.defaultHeaders;this.defaultHeaders={};this.hasDefaultHeaders=false;},abort:function(o,A,B){if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this.poll[o.tId]);
125 delete this.poll[o.tId];if(B){delete this.timeout[o.tId];}this.handleTransactionResponse(o,A,true);return true;}else{return false;}},isCallInProgress:function(o){if(o&&o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;}else{return false;}},releaseObject:function(o){o.conn=null;
126 o=null;},activeX:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP']};})();
127 // Roo/lib/Region.js
128 Roo.lib.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};Roo.lib.Region.prototype={contains:function(A){return (A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);},getArea:function(){return ((this.bottom-this.top)*(this.right-this.left));
129 },intersect:function(A){var t=Math.max(this.top,A.top);var r=Math.min(this.right,A.right);var b=Math.min(this.bottom,A.bottom);var l=Math.max(this.left,A.left);if(b>=t&&r>=l){return new Roo.lib.Region(t,r,b,l);}else{return null;}},union:function(A){var t=Math.min(this.top,A.top);
130 var r=Math.max(this.right,A.right);var b=Math.max(this.bottom,A.bottom);var l=Math.min(this.left,A.left);return new Roo.lib.Region(t,r,b,l);},adjust:function(t,l,b,r){this.top+=t;this.left+=l;this.right+=r;this.bottom+=b;return this;}};Roo.lib.Region.getRegion=function(el){var p=Roo.lib.Dom.getXY(el);
131 var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new Roo.lib.Region(t,r,b,l);};
132 // Roo/lib/Point.js
133 Roo.lib.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};Roo.lib.Point.prototype=new Roo.lib.Region();
134 // Roo/lib/Anim.js
135 (function(){Roo.lib.Anim={scroll:function(el,A,B,C,cb,D){this.run(el,A,B,C,cb,D,Roo.lib.Scroll);},motion:function(el,A,B,C,cb,D){this.run(el,A,B,C,cb,D,Roo.lib.Motion);},color:function(el,A,B,C,cb,D){this.run(el,A,B,C,cb,D,Roo.lib.ColorAnim);},run:function(el,A,B,C,cb,D,E){E=E||Roo.lib.AnimBase;
136 if(typeof C=="string"){C=Roo.lib.Easing[C];}var F=new E(el,A,B,C);F.animateX(function(){Roo.callback(cb,D);});return F;}};})();
137 // Roo/lib/AnimBase.js
138 (function(){var A;function fly(el){if(!A){A=new Roo.Element.Flyweight();}A.dom=el;return A;}Roo.lib.AnimBase=function(el,B,C,D){if(el){this.init(el,B,C,D);}};Roo.lib.AnimBase.fly=fly;Roo.lib.AnimBase.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;
139 return ("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(B,C,D){return this.method(this.currentFrame,C,D-C,this.totalFrames);
140 },setAttribute:function(B,C,D){if(this.patterns.noNegatives.test(B)){C=(C>0)?C:0;}Roo.fly(this.getEl(),'_anim').setStyle(B,C+D);},getAttribute:function(B){var el=this.getEl();var C=fly(el).getStyle(B);if(C!=='auto'&&!this.patterns.offsetUnit.test(C)){return parseFloat(C);
141 }var a=this.patterns.offsetAttribute.exec(B)||[];var D=!!(a[3]);var E=!!(a[2]);if(E||(fly(el).getStyle('position')=='absolute'&&D)){C=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{C=0;}return C;},getDefaultUnit:function(B){if(this.patterns.defaultUnit.test(B)){return 'px';
142 }return '';},animateX:function(B,C){var f=function(){this.onComplete.removeListener(f);if(typeof B=="function"){B.call(C||this,this);}};this.onComplete.addListener(f,this);this.animate();},setRuntimeAttribute:function(B){var C;var D;var E=this.attributes;
143 this.runtimeAttributes[B]={};var F=function(H){return (typeof H!=='undefined');};if(!F(E[B]['to'])&&!F(E[B]['by'])){return false;}C=(F(E[B]['from']))?E[B]['from']:this.getAttribute(B);if(F(E[B]['to'])){D=E[B]['to'];}else if(F(E[B]['by'])){if(C.constructor==Array){D=[];
144 for(var i=0,G=C.length;i<G;++i){D[i]=C[i]+E[B]['by'][i];}}else{D=C+E[B]['by'];}}this.runtimeAttributes[B].start=C;this.runtimeAttributes[B].end=D;this.runtimeAttributes[B].unit=(F(E[B].unit))?E[B]['unit']:this.getDefaultUnit(B);},init:function(el,B,C,D){var E=false;
145 var F=null;var G=0;el=Roo.getDom(el);this.attributes=B||{};this.duration=C||1;this.method=D||Roo.lib.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=Roo.lib.AnimMgr.fps;this.getEl=function(){return el;};this.isAnimated=function(){return E;
146 };this.getStartTime=function(){return F;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(Roo.lib.AnimMgr.fps*this.duration):this.duration;Roo.lib.AnimMgr.registerElement(this);
147 };this.stop=function(K){if(K){this.currentFrame=this.totalFrames;this._onTween.fire();}Roo.lib.AnimMgr.stop(this);};var H=function(){this.onStart.fire();this.runtimeAttributes={};for(var K in this.attributes){this.setRuntimeAttribute(K);}E=true;G=0;F=new Date();
148 };var I=function(){var K={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};K.toString=function(){return ('duration: '+K.duration+', currentFrame: '+K.currentFrame);};this.onTween.fire(K);var L=this.runtimeAttributes;for(var M in L){this.setAttribute(M,this.doMethod(M,L[M].start,L[M].end),L[M].unit);
149 }G+=1;};var J=function(){var K=(new Date()-F)/1000;var L={duration:K,frames:G,fps:G/K};L.toString=function(){return ('duration: '+L.duration+', frames: '+L.frames+', fps: '+L.fps);};E=false;G=0;this.onComplete.fire(L);};this._onStart=new Roo.util.Event(this);
150 this.onStart=new Roo.util.Event(this);this.onTween=new Roo.util.Event(this);this._onTween=new Roo.util.Event(this);this.onComplete=new Roo.util.Event(this);this._onComplete=new Roo.util.Event(this);this._onStart.addListener(H);this._onTween.addListener(I);
151 this._onComplete.addListener(J);}};})();
152 // Roo/lib/AnimMgr.js
153 Roo.lib.AnimMgr=new function(){var A=null;var B=[];var C=0;this.fps=1000;this.delay=1;this.registerElement=function(F){B[B.length]=F;C+=1;F._onStart.fire();this.start();};this.unRegister=function(F,G){F._onComplete.fire();G=G||D(F);if(G!=-1){B.splice(G,1);
154 }C-=1;if(C<=0){this.stop();}};this.start=function(){if(A===null){A=setInterval(this.run,this.delay);}};this.stop=function(F){if(!F){clearInterval(A);for(var i=0,G=B.length;i<G;++i){if(B[0].isAnimated()){this.unRegister(B[0],0);}}B=[];A=null;C=0;}else{this.unRegister(F);
155 }};this.run=function(){for(var i=0,F=B.length;i<F;++i){var G=B[i];if(!G||!G.isAnimated()){continue;}if(G.currentFrame<G.totalFrames||G.totalFrames===null){G.currentFrame+=1;if(G.useSeconds){E(G);}G._onTween.fire();}else{Roo.lib.AnimMgr.stop(G,i);}}};var D=function(F){for(var i=0,G=B.length;
156 i<G;++i){if(B[i]==F){return i;}}return -1;};var E=function(F){var G=F.totalFrames;var H=F.currentFrame;var I=(F.currentFrame*F.duration*1000/F.totalFrames);var J=(new Date()-F.getStartTime());var K=0;if(J<F.duration*1000){K=Math.round((J/I-1)*F.currentFrame);
157 }else{K=G-(H+1);}if(K>0&&isFinite(K)){if(F.currentFrame+K>=G){K=G-(H+1);}F.currentFrame+=K;}};};
158 // Roo/lib/Beizer.js
159 Roo.lib.Bezier=new function(){this.getPosition=function(A,t){var n=A.length;var B=[];for(var i=0;i<n;++i){B[i]=[A[i][0],A[i][1]];}for(var j=1;j<n;++j){for(i=0;i<n-j;++i){B[i][0]=(1-t)*B[i][0]+t*B[parseInt(i+1,10)][0];B[i][1]=(1-t)*B[i][1]+t*B[parseInt(i+1,10)][1];
160 }}return [B[0][0],B[0][1]];};};
161 // Roo/lib/Color.js
162 Roo.lib.Color=function(){};Roo.apply(Roo.lib.Color.prototype,{rgb:null,hsv:null,hsl:null,getIntegerRGB:function(){var A=this.getRGB();return {'r':Math.round(A.r),'g':Math.round(A.g),'b':Math.round(A.b),'a':A.a};},getPercentageRGB:function(){var A=this.getRGB();
163 return {'r':100*A.r/255,'g':100*A.g/255,'b':100*A.b/255,'a':A.a};},getCSSHexadecimalRGB:function(){var A=this.getIntegerRGB();var B=A.r.toString(16);var C=A.g.toString(16);var D=A.b.toString(16);return '#'+(B.length==2?B:'0'+B)+(C.length==2?C:'0'+C)+(D.length==2?D:'0'+D);
164 },getCSSIntegerRGB:function(){var A=this.getIntegerRGB();return 'rgb('+A.r+','+A.g+','+A.b+')';},getCSSIntegerRGBA:function(){var A=this.getIntegerRGB();return 'rgb('+A.r+','+A.g+','+A.b+','+A.a+')';},getCSSPercentageRGB:function(){var A=this.getPercentageRGB();
165 return 'rgb('+A.r+'%,'+A.g+'%,'+A.b+'%)';},getCSSPercentageRGBA:function(){var A=this.getPercentageRGB();return 'rgb('+A.r+'%,'+A.g+'%,'+A.b+'%,'+A.a+')';},getCSSHSL:function(){var A=this.getHSL();return 'hsl('+A.h+','+A.s+'%,'+A.l+'%)';},getCSSHSLA:function(){var A=this.getHSL();
166 return 'hsl('+A.h+','+A.s+'%,'+A.l+'%,'+A.a+')';},setNodeColor:function(A){A.style.color=this.getCSSHexadecimalRGB();},setNodeBackgroundColor:function(A){A.style.backgroundColor=this.getCSSHexadecimalRGB();},toRGB:function(){var r=this.getIntegerRGB();return new Roo.lib.RGBColor(r.r,r.g,r.b,r.a);
167 },toHSL:function(){var A=this.getHSL();return new Roo.lib.HSLColor(A.h,A.s,A.l,A.a);},toHSV:function(){var A=this.toRGB();var B=A.getHSV();return new Roo.lib.HSVColor(B.h,B.s,B.v,B.a);},saturate:function(v){var A=this.toRGB();var B=A.getHSV();return new Roo.lib.HSVColor(B.h,B.s*v,B.v,B.a);
168 },getRGB:function(){return {'r':this.rgb.r,'g':this.rgb.g,'b':this.rgb.b,'a':this.alpha};},getHSV:function(){if(this.hsv==null){this.calculateHSV();}return {'h':this.hsv.h,'s':this.hsv.s,'v':this.hsv.v,'a':this.alpha};},getHSL:function(){if(this.hsl==null){this.calculateHSL();
169 }return {'h':this.hsl.h,'s':this.hsl.s,'l':this.hsl.l,'a':this.alpha};}});Roo.lib.RGBColor=function(r,g,b,a){this.alpha=(a===undefined?1:Math.max(0,Math.min(1,a)));this.rgb={'r':Math.max(0,Math.min(255,r)),'g':Math.max(0,Math.min(255,g)),'b':Math.max(0,Math.min(255,b))}
170 ;};Roo.extend(Roo.lib.RGBColor,Roo.lib.Color,{getHue:function(A,B){var C=this.rgb;if(B==0){var D=0;}else{switch(A){case C.r:var D=(C.g-C.b)/B*60;if(D<0){D+=360;}break;case C.g:var D=(C.b-C.r)/B*60+120;break;case C.b:var D=(C.r-C.g)/B*60+240;break;}}return D;
171 },calculateHSV:function(){var A=this.rgb;var B=Math.max(A.r,A.g,A.b);var C=B-Math.min(A.r,A.g,A.b);this.hsv={'h':this.getHue(B,C),'s':(B==0?0:100*C/B),'v':B/2.55};},calculateHSL:function(){var A=this.rgb;var B=Math.max(A.r,A.g,A.b);var C=B-Math.min(A.r,A.g,A.b);
172 var l=B/255-C/510;this.hsl={'h':this.getHue(B,C),'s':(C==0?0:C/2.55/(l<0.5?l*2:2-l*2)),'l':100*l};}});Roo.lib.HSVColor=function(h,s,v,a){this.alpha=(a===undefined?1:Math.max(0,Math.min(1,a)));this.hsv={'h':(h%360+360)%360,'s':Math.max(0,Math.min(100,s)),'v':Math.max(0,Math.min(100,v))}
173 ;this.rgb=null;this.hsl=null;};Roo.extend(Roo.lib.HSVColor,Roo.lib.Color,{calculateRGB:function(){var A=this.hsv;if(A.s==0){var r=A.v;var g=A.v;var b=A.v;}else{var f=A.h/60-Math.floor(A.h/60);var p=A.v*(1-A.s/100);var q=A.v*(1-A.s/100*f);var t=A.v*(1-A.s/100*(1-f));
174 switch(Math.floor(A.h/60)){case 0:var r=A.v;var g=t;var b=p;break;case 1:var r=q;var g=A.v;var b=p;break;case 2:var r=p;var g=A.v;var b=t;break;case 3:var r=p;var g=q;var b=A.v;break;case 4:var r=t;var g=p;var b=A.v;break;case 5:var r=A.v;var g=p;var b=q;
175 break;}}this.rgb={'r':r*2.55,'g':g*2.55,'b':b*2.55};},calculateHSL:function(){var A=this.hsv;var l=(2-A.s/100)*A.v/2;this.hsl={'h':A.h,'s':A.s*A.v/(l<50?l*2:200-l*2),'l':l};if(isNaN(hsl.s)){hsl.s=0;}}});Roo.lib.HSLColor=function(h,s,l,a){this.alpha=(a===undefined?1:Math.max(0,Math.min(1,a)));
176 this.hsl={'h':(h%360+360)%360,'s':Math.max(0,Math.min(100,s)),'l':Math.max(0,Math.min(100,l))};};Roo.extend(Roo.lib.HSLColor,Roo.lib.Color,{calculateRGB:function(){if(this.hsl.s==0){this.rgb={'r':this.hsl.l*2.55,'g':this.hsl.l*2.55,'b':this.hsl.l*2.55};}else{var p=this.hsl.l<50?this.hsl.l*(1+hsl.s/100):this.hsl.l+hsl.s-hsl.l*hsl.s/100;
177 var q=2*hsl.l-p;this.rgb={'r':(h+120)/60%6,'g':h/60,'b':(h+240)/60%6};for(var A in this.rgb){if(this.rgb.hasOwnProperty(A)){if(this.rgb[A]<1){this.rgb[A]=q+(p-q)*this.rgb[A];}else if(this.rgb[A]<3){this.rgb[A]=p;}else if(this.rgb[A]<4){this.rgb[A]=q+(p-q)*(4-this.rgb[A]);
178 }else{this.rgb[A]=q;}this.rgb[A]*=2.55;}}}},calculateHSV:function(){var t=this.hsl.s*(this.hsl.l<50?this.hsl.l:100-this.hsl.l)/100;this.hsv={'h':this.hsl.h,'s':200*t/(this.hsl.l+t),'v':t+this.hsl.l};if(isNaN(this.hsv.s)){this.hsv.s=0;}}});
179 // Roo/lib/ColorAnim.js
180 (function(){Roo.lib.ColorAnim=function(el,D,E,F){Roo.lib.ColorAnim.superclass.constructor.call(this,el,D,E,F);};Roo.extend(Roo.lib.ColorAnim,Roo.lib.AnimBase);var A=Roo.lib.AnimBase.fly;var Y=Roo.lib;var B=Y.ColorAnim.superclass;var C=Y.ColorAnim.prototype;
181 C.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return ("ColorAnim "+id);};C.patterns.color=/color$/i;C.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;C.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;C.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;
182 C.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;C.parseColor=function(s){if(s.length==3){return s;}var c=this.patterns.hex.exec(s);if(c&&c.length==4){return [parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}c=this.patterns.rgb.exec(s);if(c&&c.length==4){return [parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];
183 }c=this.patterns.hex3.exec(s);if(c&&c.length==4){return [parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}return null;};C.getAttribute=function(D){var el=this.getEl();if(this.patterns.color.test(D)){var E=A(el).getStyle(D);if(this.patterns.transparent.test(E)){var F=el.parentNode;
184 E=A(F).getStyle(D);while(F&&this.patterns.transparent.test(E)){F=F.parentNode;E=A(F).getStyle(D);if(F.tagName.toUpperCase()=='HTML'){E='#fff';}}}}else{E=B.getAttribute.call(this,D);}return E;};C.getAttribute=function(D){var el=this.getEl();if(this.patterns.color.test(D)){var E=A(el).getStyle(D);
185 if(this.patterns.transparent.test(E)){var F=el.parentNode;E=A(F).getStyle(D);while(F&&this.patterns.transparent.test(E)){F=F.parentNode;E=A(F).getStyle(D);if(F.tagName.toUpperCase()=='HTML'){E='#fff';}}}}else{E=B.getAttribute.call(this,D);}return E;};C.doMethod=function(D,E,F){var G;
186 if(this.patterns.color.test(D)){G=[];for(var i=0,H=E.length;i<H;++i){G[i]=B.doMethod.call(this,D,E[i],F[i]);}G='rgb('+Math.floor(G[0])+','+Math.floor(G[1])+','+Math.floor(G[2])+')';}else{G=B.doMethod.call(this,D,E,F);}return G;};C.setRuntimeAttribute=function(D){B.setRuntimeAttribute.call(this,D);
187 if(this.patterns.color.test(D)){var E=this.attributes;var F=this.parseColor(this.runtimeAttributes[D].start);var G=this.parseColor(this.runtimeAttributes[D].end);if(typeof E[D]['to']==='undefined'&&typeof E[D]['by']!=='undefined'){G=this.parseColor(E[D].by);
188 for(var i=0,H=F.length;i<H;++i){G[i]=F[i]+G[i];}}this.runtimeAttributes[D].start=F;this.runtimeAttributes[D].end=G;}};})();
189 // Roo/lib/Easing.js
190 Roo.lib.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return -c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b;}return -c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;
191 },easeOutStrong:function(t,b,c,d){return -c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b;}return -c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0){return b;}if((t/=d)==1){return b+c;}if(!p){p=d*.3;
192 }if(!a||a<Math.abs(c)){a=c;var s=p/4;}else{var s=p/(2*Math.PI)*Math.asin(c/a);}return -(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0){return b;}if((t/=d)==1){return b+c;}if(!p){p=d*.3;}if(!a||a<Math.abs(c)){a=c;
193 var s=p/4;}else{var s=p/(2*Math.PI)*Math.asin(c/a);}return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0){return b;}if((t/=d/2)==2){return b+c;}if(!p){p=d*(.3*1.5);}if(!a||a<Math.abs(c)){a=c;var s=p/4;
194 }else{var s=p/(2*Math.PI)*Math.asin(c/a);}if(t<1){return -.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;}return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;
195 }return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;
196 }return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-Roo.lib.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;
197 }else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;},bounceBoth:function(t,b,c,d){if(t<d/2){return Roo.lib.Easing.bounceIn(t*2,0,c,d)*.5+b;}return Roo.lib.Easing.bounceOut(t*2-d,0,c,d)*.5+c*.5+b;
198 }};
199 // Roo/lib/Motion.js
200 (function(){Roo.lib.Motion=function(el,E,F,G){if(el){Roo.lib.Motion.superclass.constructor.call(this,el,E,F,G);}};Roo.extend(Roo.lib.Motion,Roo.lib.ColorAnim);var Y=Roo.lib;var A=Y.Motion.superclass;var B=Y.Motion.prototype;B.toString=function(){var el=this.getEl();
201 var id=el.id||el.tagName;return ("Motion "+id);};B.patterns.points=/^points$/i;B.setAttribute=function(E,F,G){if(this.patterns.points.test(E)){G=G||'px';A.setAttribute.call(this,'left',F[0],G);A.setAttribute.call(this,'top',F[1],G);}else{A.setAttribute.call(this,E,F,G);
202 }};B.getAttribute=function(E){if(this.patterns.points.test(E)){var F=[A.getAttribute.call(this,'left'),A.getAttribute.call(this,'top')];}else{F=A.getAttribute.call(this,E);}return F;};B.doMethod=function(E,F,G){var H=null;if(this.patterns.points.test(E)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;
203 H=Y.Bezier.getPosition(this.runtimeAttributes[E],t);}else{H=A.doMethod.call(this,E,F,G);}return H;};B.setRuntimeAttribute=function(E){if(this.patterns.points.test(E)){var el=this.getEl();var F=this.attributes;var G;var H=F['points']['control']||[];var I;var i,J;
204 if(H.length>0&&!(H[0] instanceof Array)){H=[H];}else{var K=[];for(i=0,J=H.length;i<J;++i){K[i]=H[i];}H=K;}Roo.fly(el).position();if(D(F['points']['from'])){Roo.lib.Dom.setXY(el,F['points']['from']);}else{Roo.lib.Dom.setXY(el,Roo.lib.Dom.getXY(el));}G=this.getAttribute('points');
205 if(D(F['points']['to'])){I=C.call(this,F['points']['to'],G);var L=Roo.lib.Dom.getXY(this.getEl());for(i=0,J=H.length;i<J;++i){H[i]=C.call(this,H[i],G);}}else if(D(F['points']['by'])){I=[G[0]+F['points']['by'][0],G[1]+F['points']['by'][1]];for(i=0,J=H.length;
206 i<J;++i){H[i]=[G[0]+H[i][0],G[1]+H[i][1]];}}this.runtimeAttributes[E]=[G];if(H.length>0){this.runtimeAttributes[E]=this.runtimeAttributes[E].concat(H);}this.runtimeAttributes[E][this.runtimeAttributes[E].length]=I;}else{A.setRuntimeAttribute.call(this,E);
207 }};var C=function(E,F){var G=Roo.lib.Dom.getXY(this.getEl());E=[E[0]-G[0]+F[0],E[1]-G[1]+F[1]];return E;};var D=function(E){return (typeof E!=='undefined');};})();
208 // Roo/lib/Scroll.js
209 (function(){Roo.lib.Scroll=function(el,C,D,E){if(el){Roo.lib.Scroll.superclass.constructor.call(this,el,C,D,E);}};Roo.extend(Roo.lib.Scroll,Roo.lib.ColorAnim);var Y=Roo.lib;var A=Y.Scroll.superclass;var B=Y.Scroll.prototype;B.toString=function(){var el=this.getEl();
210 var id=el.id||el.tagName;return ("Scroll "+id);};B.doMethod=function(C,D,E){var F=null;if(C=='scroll'){F=[this.method(this.currentFrame,D[0],E[0]-D[0],this.totalFrames),this.method(this.currentFrame,D[1],E[1]-D[1],this.totalFrames)];}else{F=A.doMethod.call(this,C,D,E);
211 }return F;};B.getAttribute=function(C){var D=null;var el=this.getEl();if(C=='scroll'){D=[el.scrollLeft,el.scrollTop];}else{D=A.getAttribute.call(this,C);}return D;};B.setAttribute=function(C,D,E){var el=this.getEl();if(C=='scroll'){el.scrollLeft=D[0];el.scrollTop=D[1];
212 }else{A.setAttribute.call(this,C,D,E);}};})();
213 // Roo/lib/UndoManager.js
214 Roo.lib.UndoManager=function(A,B){this.stack=[];this.limit=A;this.scope=B;this.fireEvent=typeof CustomEvent!='undefined'&&B&&B.dispatchEvent;if(this.fireEvent){this.bindEvents();}this.reset();};Roo.lib.UndoManager.prototype={limit:false,stack:false,scope:false,fireEvent:false,position:0,length:0,transact:function(A,B){if(arguments.length<2){throw new TypeError('Not enough arguments to UndoManager.transact.');
215 }A.execute();this.stack.splice(0,this.position);if(B&&this.length){this.stack[0].push(A);}else{this.stack.unshift([A]);}this.position=0;if(this.limit&&this.stack.length>this.limit){this.length=this.stack.length=this.limit;}else{this.length=this.stack.length;
216 }if(this.fireEvent){this.scope.dispatchEvent(new CustomEvent('DOMTransaction',{detail:{transactions:this.stack[0].slice()},bubbles:true,cancelable:false}));}},undo:function(){if(this.position<this.length){for(var i=this.stack[this.position].length-1;i>=0;
217 i--){this.stack[this.position][i].undo();}this.position++;if(this.fireEvent){this.scope.dispatchEvent(new CustomEvent('undo',{detail:{transactions:this.stack[this.position-1].slice()},bubbles:true,cancelable:false}));}}},redo:function(){if(this.position>0){for(var i=0,n=this.stack[this.position-1].length;
218 i<n;i++){this.stack[this.position-1][i].redo();}this.position--;if(this.fireEvent){this.scope.dispatchEvent(new CustomEvent('redo',{detail:{transactions:this.stack[this.position].slice()},bubbles:true,cancelable:false}));}}},item:function(A){if(A>=0&&A<this.length){return this.stack[A].slice();
219 }return null;},clearUndo:function(){this.stack.length=this.length=this.position;},clearRedo:function(){this.stack.splice(0,this.position);this.position=0;this.length=this.stack.length;},reset:function(){this.stack=[];this.position=0;this.length=0;this.current_html=this.scope.innerHTML;
220 if(this.timer!==false){clearTimeout(this.timer);}this.timer=false;this.merge=false;this.addEvent();},current_html:'',timer:false,merge:false,bindEvents:function(){var el=this.scope;el.undoManager=this;this.scope.addEventListener('keydown',function(e){if((e.ctrlKey||e.metaKey)&&e.keyCode===90){if(e.shiftKey){el.undoManager.redo();
221 }else{el.undoManager.undo();}e.preventDefault();}});this.scope.addEventListener('keyup',function(e){if((e.ctrlKey||e.metaKey)&&e.keyCode===90){e.preventDefault();}});var t=this;el.addEventListener('input',function(e){if(el.innerHTML==t.current_html){return;
222 }if(t.timer!==false){clearTimeout(t.timer);t.timer=false;}t.timer=setTimeout(function(){t.merge=false;},1000);t.addEvent(t.merge);t.merge=true;});},addEvent:function(A){A=typeof(A)=='undefined'?false:A;this.scope.undoManager.transact({scope:this.scope,oldHTML:this.current_html,newHTML:this.scope.innerHTML,execute:function(){}
223 ,undo:function(){this.scope.innerHTML=this.current_html=this.oldHTML;},redo:function(){this.scope.innerHTML=this.current_html=this.newHTML;}},false);this.merge=A;this.current_html=this.scope.innerHTML;}};
224 // Roo/lib/Range.js
225 Roo.lib.Range=function(){};Roo.lib.Range.wrap=function(r){return Roo.apply(r,Roo.lib.Range.prototype);};Roo.apply(Roo.lib.Range.prototype,{closest:function(A){if(typeof(A)!='string'){for(var i=0;i<A.length;i++){var r=this.closest(A[i]);if(r!==false){return r;
226 }}return false;}A=A.toLowerCase();var n=this.commonAncestorContainer;while(n.nodeType!=1){n=n.parentNode;}if(n.nodeName.toLowerCase()==A){return n;}if(n.nodeName.toLowerCase()=='body'){return false;}return n.closest(A)||false;},cloneRange:function(){return Roo.lib.Range.wrap(Range.prototype.cloneRange.call(this));
227 }});
228 // Roo/lib/Selection.js
229 Roo.lib.Selection=function(){};Roo.lib.Selection.wrap=function(r,A){Roo.apply(r,Roo.lib.Selection.prototype);r.ownerDocument=A;return r;};Roo.apply(Roo.lib.Selection.prototype,{ownerDocument:false,getRangeAt:function(n){return Roo.lib.Range.wrap(Selection.prototype.getRangeAt.call(this,n));
230 },insertNode:function(A,B){if(typeof(A)=='string'){A=this.ownerDocument.createElement(A);if(B=='in'){A.innerHTML='&nbsp;';}}var C=this.getRangeAt(0);if(this.type!='Caret'){C.deleteContents();}var sn=A.childNodes[0];C.insertNode(A);if(B=='after'){A.insertAdjacentHTML('afterend','&nbsp;');
231 sn=A.nextSibling;}if(B=='none'){return;}this.cursorText(sn);},cursorText:function(n){range=Roo.lib.Range.wrap(new Range());var ix=Array.from(n.parentNode.childNodes).indexOf(n);range.setStart(n.parentNode,ix);range.setEnd(n.parentNode,ix+1);this.removeAllRanges();
232 this.addRange(range);Roo.log([n,range,this,this.baseOffset,this.extentOffset,this.type]);},cursorAfter:function(n){if(!n.nextSibling||n.nextSibling.nodeValue!='&nbsp;'){n.insertAdjacentHTML('afterend','&nbsp;');}this.cursorText(n.nextSibling);}});
233 // Roo/DomHelper.js
234 if(typeof Range!="undefined"&&typeof Range.prototype.createContextualFragment=="undefined"){Range.prototype.createContextualFragment=function(A){var B=window.document;var C=B.createElement("div");C.innerHTML=A;var D=B.createDocumentFragment(),n;while((n=C.firstChild)){D.appendChild(n);
235 }return D;};}Roo.DomHelper=function(){var A=null;var B=/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;var C=/^table|tbody|tr|td$/i;var D={};var E=function(o){if(typeof o=='string'){return o;}var b="";if(!o.tag){o.tag="div";}b+="<"+o.tag;
236 for(var N in o){if(N=="tag"||N=="children"||N=="cn"||N=="html"||typeof o[N]=="function"){continue;}if(N=="style"){var s=o["style"];if(typeof s=="function"){s=s.call();}if(typeof s=="string"){b+=' style="'+s+'"';}else if(typeof s=="object"){b+=' style="';for(var O in s){if(typeof s[O]!="function"){b+=O+":"+s[O]+";";
237 }}b+='"';}}else{if(N=="cls"){b+=' class="'+o["cls"]+'"';}else if(N=="htmlFor"){b+=' for="'+o["htmlFor"]+'"';}else{b+=" "+N+'="'+o[N]+'"';}}}if(B.test(o.tag)){b+="/>";}else{b+=">";var cn=o.children||o.cn;if(cn){if((cn instanceof Array)||(Roo.isSafari&&typeof(cn.join)=="function")){for(var i=0,P=cn.length;
238 i<P;i++){b+=E(cn[i],b);}}else{b+=E(cn,b);}}if(o.html){b+=o.html;}b+="</"+o.tag+">";}return b;};var F=function(o,N){var ns=false;if(o.ns&&o.ns!='html'){if(o.xmlns&&typeof(D[o.ns])=='undefined'){D[o.ns]=o.xmlns;ns=o.xmlns;}if(typeof(D[o.ns])=='undefined'){console.log("Trying to create namespace element "+o.ns+", however no xmlns was sent to builder previously");
239 }ns=D[o.ns];}if(typeof(o)=='string'){return N.appendChild(document.createTextNode(o));}o.tag=o.tag||div;if(o.ns&&Roo.isIE){ns=false;o.tag=o.ns+':'+o.tag;}var el=ns?document.createElementNS(ns,o.tag||'div'):document.createElement(o.tag||'div');var O=el.setAttribute?true:false;
240 for(var P in o){if(P=="tag"||P=="ns"||P=="xmlns"||P=="children"||P=="cn"||P=="html"||P=="style"||typeof o[P]=="function"){continue;}if(P=="cls"&&Roo.isIE){el.className=o["cls"];}else{if(O){el.setAttribute(P=="cls"?'class':P,o[P]);}else{el[P]=o[P];}}}Roo.DomHelper.applyStyles(el,o.style);
241 var cn=o.children||o.cn;if(cn){if((cn instanceof Array)||(Roo.isSafari&&typeof(cn.join)=="function")){for(var i=0,Q=cn.length;i<Q;i++){F(cn[i],el);}}else{F(cn,el);}}if(o.html){el.innerHTML=o.html;}if(N){N.appendChild(el);}return el;};var G=function(N,s,h,e){A.innerHTML=[s,h,e].join('');
242 var i=-1,el=A;while(++i<N&&el.firstChild){el=el.firstChild;}return el;};var ts='<table>',te='</table>',H=ts+'<tbody>',I='</tbody>'+te,J=H+'<tr>',K='</tr>'+I;var L=function(N,O,el,P){if(!A){A=document.createElement('div');}var Q;var R=null;if(N=='td'){if(O=='afterbegin'||O=='beforeend'){return;
243 }if(O=='beforebegin'){R=el;el=el.parentNode;}else{R=el.nextSibling;el=el.parentNode;}Q=G(4,J,P,K);}else if(N=='tr'){if(O=='beforebegin'){R=el;el=el.parentNode;Q=G(3,H,P,I);}else if(O=='afterend'){R=el.nextSibling;el=el.parentNode;Q=G(3,H,P,I);}else{if(O=='afterbegin'){R=el.firstChild;
244 }Q=G(4,J,P,K);}}else if(N=='tbody'){if(O=='beforebegin'){R=el;el=el.parentNode;Q=G(2,ts,P,te);}else if(O=='afterend'){R=el.nextSibling;el=el.parentNode;Q=G(2,ts,P,te);}else{if(O=='afterbegin'){R=el.firstChild;}Q=G(3,H,P,I);}}else{if(O=='beforebegin'||O=='afterend'){return;
245 }if(O=='afterbegin'){R=el.firstChild;}Q=G(2,ts,P,te);}el.insertBefore(Q,R);return Q;};var M=function(N,to){Roo.log(["UpdateNode",N,to]);if(N.nodeType!=to.nodeType){Roo.log(["ReplaceChild - mismatch notType",to,N]);N.parentNode.replaceChild(to,N);}if(N.nodeType==3){if(N.data==to.data){return;
246 }N.data=to.data;return;}if(!N.parentNode){return;}if(N.nodeType!=1||N.tagName!=to.tagName){Roo.log(["ReplaceChild",N,to]);N.parentNode.replaceChild(to,N);return;}var ar=Array.from(N.attributes);for(var i=0;i<ar.length;i++){if(to.hasAttribute(ar[i].name)){continue;
247 }if(ar[i].name=='id'){continue;}Roo.log("removeAttribute"+ar[i].name);N.removeAttribute(ar[i].name);}ar=to.attributes;for(var i=0;i<ar.length;i++){if(N.getAttribute(ar[i].name)==to.getAttribute(ar[i].name)){Roo.log("skipAttribute "+ar[i].name+'='+to.getAttribute(ar[i].name));
248 continue;}Roo.log("updateAttribute "+ar[i].name+'=>'+to.getAttribute(ar[i].name));N.setAttribute(ar[i].name,to.getAttribute(ar[i].name));}var O=Array.from(N.childNodes);var P=Array.from(to.childNodes);for(var i=0;i<Math.max(P.length,O.length);i++){if(i>=O.length){N.appendChild(P[i]);
249 Roo.log(["add",P[i]]);}else if(i>=P.length){N.removeChild(O[i]);Roo.log(["remove",O[i]]);}else{M(O[i],P[i]);}}};return {useDom:false,markup:function(o){return E(o);},applyStyles:function(el,N){if(N){el=Roo.fly(el);if(typeof N=="string"){var re=/\s?([a-z\-]*)\:\s?([^;]*);?/gi;
250 var O;while((O=re.exec(N))!=null){el.setStyle(O[1],O[2]);}}else if(typeof N=="object"){for(var P in N){el.setStyle(P,N[P]);}}else if(typeof N=="function"){Roo.DomHelper.applyStyles(el,N.call());}}},insertHtml:function(N,el,O){N=N.toLowerCase();if(el.insertAdjacentHTML){if(C.test(el.tagName)){var rs;
251 if(rs=L(el.tagName.toLowerCase(),N,el,O)){return rs;}}switch(N){case "beforebegin":el.insertAdjacentHTML('BeforeBegin',O);return el.previousSibling;case "afterbegin":el.insertAdjacentHTML('AfterBegin',O);return el.firstChild;case "beforeend":el.insertAdjacentHTML('BeforeEnd',O);
252 return el.lastChild;case "afterend":el.insertAdjacentHTML('AfterEnd',O);return el.nextSibling;}throw 'Illegal insertion point -> "'+N+'"';}var P=el.ownerDocument.createRange();var Q;switch(N){case "beforebegin":P.setStartBefore(el);Q=P.createContextualFragment(O);
253 el.parentNode.insertBefore(Q,el);return el.previousSibling;case "afterbegin":if(el.firstChild){P.setStartBefore(el.firstChild);Q=P.createContextualFragment(O);el.insertBefore(Q,el.firstChild);return el.firstChild;}else{el.innerHTML=O;return el.firstChild;
254 }case "beforeend":if(el.lastChild){P.setStartAfter(el.lastChild);Q=P.createContextualFragment(O);el.appendChild(Q);return el.lastChild;}else{el.innerHTML=O;return el.lastChild;}case "afterend":P.setStartAfter(el);Q=P.createContextualFragment(O);el.parentNode.insertBefore(Q,el.nextSibling);
255 return el.nextSibling;}throw 'Illegal insertion point -> "'+N+'"';},insertBefore:function(el,o,N){return this.doInsert(el,o,N,"beforeBegin");},insertAfter:function(el,o,N){return this.doInsert(el,o,N,"afterEnd","nextSibling");},insertFirst:function(el,o,N){return this.doInsert(el,o,N,"afterBegin");
256 },doInsert:function(el,o,N,O,P){el=Roo.getDom(el);var Q;if(this.useDom||o.ns){Q=F(o,null);el.parentNode.insertBefore(Q,P?el[P]:el);}else{var R=E(o);Q=this.insertHtml(O,el,R);}return N?Roo.get(Q,true):Q;},append:function(el,o,N){el=Roo.getDom(el);var O;if(this.useDom||o.ns){O=F(o,null);
257 el.appendChild(O);}else{var P=E(o);O=this.insertHtml("beforeEnd",el,P);}return N?Roo.get(O,true):O;},overwrite:function(el,o,N){el=Roo.getDom(el);if(o.ns){while(el.childNodes.length){el.removeChild(el.firstChild);}F(o,el);}else{el.innerHTML=E(o);}return N?Roo.get(el.firstChild,true):el.firstChild;
258 },createTemplate:function(o){var N=E(o);return new Roo.Template(N);},update:function(el,o){M(Roo.getDom(el),F(o));}};}();
259 // Roo/Template.js
260 Roo.Template=function(A){if(A instanceof Array){A=A.join("");}else if(arguments.length>1){A=Array.prototype.join.call(arguments,"");}if(typeof(A)=='object'){Roo.apply(this,A)}else{this.html=A;}if(this.url){this.load();}};Roo.Template.prototype={onLoad:false,url:false,html:'',compiled:false,loaded:false,applyTemplate:function(A){try{if(this.compiled){return this.compiled(A);
261 }var B=this.disableFormats!==true;var fm=Roo.util.Format,C=this;var fn=function(m,D,E,F){if(E&&B){if(E.substr(0,5)=="this."){return C.call(E.substr(5),A[D],A);}else{if(F){var re=/^\s*['"](.*)["']\s*$/;F=F.split(',');for(var i=0,G=F.length;i<G;i++){F[i]=F[i].replace(re,"$1");
262 }F=[A[D]].concat(F);}else{F=[A[D]];}return fm[E].apply(fm,F);}}else{return A[D]!==undefined?A[D]:"";}};return this.html.replace(this.re,fn);}catch(e){Roo.log(e);throw e;}},loading:false,load:function(){if(this.loading){return;}var _t=this;this.loading=true;
263 this.compiled=false;var cx=new Roo.data.Connection();cx.request({url:this.url,method:'GET',success:function(A){_t.loading=false;_t.url=false;_t.set(A.responseText,true);_t.loaded=true;if(_t.onLoad){_t.onLoad();}},failure:function(A){Roo.log("Template failed to load from "+_t.url);
264 _t.loading=false;}});},set:function(A,B){this.html=A;this.compiled=false;if(B){this.compile();}return this;},disableFormats:false,re:/\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var fm=Roo.util.Format;var A=this.disableFormats!==true;
265 var B=Roo.isGecko?"+":",";var fn=function(m,D,E,F){if(E&&A){F=F?','+F:"";if(E.substr(0,5)!="this."){E="fm."+E+'(';}else{E='this.call("'+E.substr(5)+'", ';F=", values";}}else{F='';E="(values['"+D+"'] == undefined ? '' : ";}return "'"+B+E+"values['"+D+"']"+F+")"+B+"'";
266 };var C;if(Roo.isGecko){C="this.compiled = function(values){ return '"+this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};";}else{C=["this.compiled = function(values){ return ['"];C.push(this.html.replace(/\\/g,'\\\\').replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));
267 C.push("'].join('');};");C=C.join('');}eval(C);return this;},call:function(A,B,C){return this[A](B,C);},insertFirst:function(el,A,B){return this.doInsert('afterBegin',el,A,B);},insertBefore:function(el,A,B){return this.doInsert('beforeBegin',el,A,B);},insertAfter:function(el,A,B){return this.doInsert('afterEnd',el,A,B);
268 },append:function(el,A,B){return this.doInsert('beforeEnd',el,A,B);},doInsert:function(A,el,B,C){el=Roo.getDom(el);var D=Roo.DomHelper.insertHtml(A,el,this.applyTemplate(B));return C?Roo.get(D,true):D;},overwrite:function(el,A,B){el=Roo.getDom(el);el.innerHTML=this.applyTemplate(A);
269 return B?Roo.get(el.firstChild,true):el.firstChild;}};Roo.Template.prototype.apply=Roo.Template.prototype.applyTemplate;Roo.DomHelper.Template=Roo.Template;Roo.Template.from=function(el){el=Roo.getDom(el);return new Roo.Template(el.value||el.innerHTML);};
270
271 // Roo/DomQuery.js
272 Roo.DomQuery=function(){var A={},B={},C={};var D=/\S/;var E=/^\s+|\s+$/g;var F=/\{(\d+)\}/g;var G=/^(\s?[\/>+~]\s?|\s|$)/;var H=/^(#)?([\w-\*]+)/;var I=/(\d*)n\+?(\d*)/,J=/\D/;function child(p,M){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==M){return n;
273 }}n=n.nextSibling;}return null;};function next(n){while((n=n.nextSibling)&&n.nodeType!=1);return n;};function prev(n){while((n=n.previousSibling)&&n.nodeType!=1);return n;};function children(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!D.test(n.nodeValue)){d.removeChild(n);
274 }else{n.nodeIndex=++ni;}n=nx;}return this;};function byClassName(c,a,v){if(!v){return c;}var r=[],ri=-1,cn;for(var i=0,ci;ci=c[i];i++){if((' '+((ci instanceof SVGElement)?ci.className.baseVal:ci.className)+' ').indexOf(v)!=-1){r[++ri]=ci;}}return r;};function attrValue(n,M){if(!n.tagName&&typeof n.length!="undefined"){n=n[0];
275 }if(!n){return null;}if(M=="for"){return n.htmlFor;}if(M=="class"||M=="className"){return (n instanceof SVGElement)?n.className.baseVal:n.className;}return n.getAttribute(M)||n[M];};function getNodes(ns,M,N){var O=[],ri=-1,cs;if(!ns){return O;}N=N||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns];
276 }if(!M){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(N);for(var j=0,ci;ci=cs[j];j++){O[++ri]=ci;}}}else if(M=="/"||M==">"){var P=N.toUpperCase();for(var i=0,ni,cn;ni=ns[i];i++){cn=ni.children||ni.childNodes;for(var j=0,cj;cj=cn[j];j++){if(cj.nodeName==P||cj.nodeName==N||N=='*'){O[++ri]=cj;
277 }}}}else if(M=="+"){var P=N.toUpperCase();for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&n.nodeType!=1);if(n&&(n.nodeName==P||n.nodeName==N||N=='*')){O[++ri]=n;}}}else if(M=="~"){for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&(n.nodeType!=1||(N=='*'||n.tagName.toLowerCase()!=N)));
278 if(n){O[++ri]=n;}}}return O;};function concat(a,b){if(b.slice){return a.concat(b);}for(var i=0,l=b.length;i<l;i++){a[a.length]=b[i];}return a;}function byTag(cs,M){if(cs.tagName||cs==document){cs=[cs];}if(!M){return cs;}var r=[],ri=-1;M=M.toLowerCase();for(var i=0,ci;
279 ci=cs[i];i++){if(ci.nodeType==1&&ci.tagName.toLowerCase()==M){r[++ri]=ci;}}return r;};function byId(cs,M,id){if(cs.tagName||cs==document){cs=[cs];}if(!id){return cs;}var r=[],ri=-1;for(var i=0,ci;ci=cs[i];i++){if(ci&&ci.id==id){r[++ri]=ci;return r;}}return r;
280 };function byAttribute(cs,M,N,op,O){var r=[],ri=-1,st=O=="{";var f=Roo.DomQuery.operators[op];for(var i=0,ci;ci=cs[i];i++){var a;if(st){a=Roo.DomQuery.getStyle(ci,M);}else if(M=="class"||M=="className"){a=(ci instanceof SVGElement)?ci.className.baseVal:ci.className;
281 }else if(M=="for"){a=ci.htmlFor;}else if(M=="href"){a=ci.getAttribute("href",2);}else{a=ci.getAttribute(M);}if((f&&f(a,N))||(!f&&a)){r[++ri]=ci;}}return r;};function byPseudo(cs,M,N){return Roo.DomQuery.pseudos[M](cs,N);};var K=window.ActiveXObject?true:false;
282 var batch=30803;var L=30803;function nodupIEXml(cs){var d=++L;cs[0].setAttribute("_nodup",d);var r=[cs[0]];for(var i=1,M=cs.length;i<M;i++){var c=cs[i];if(!c.getAttribute("_nodup")!=d){c.setAttribute("_nodup",d);r[r.length]=c;}}for(var i=0,M=cs.length;i<M;
283 i++){cs[i].removeAttribute("_nodup");}return r;}function nodup(cs){if(!cs){return [];}var M=cs.length,c,i,r=cs,cj,ri=-1;if(!M||typeof cs.nodeType!="undefined"||M==1){return cs;}if(K&&typeof cs[0].selectSingleNode!="undefined"){return nodupIEXml(cs);}var d=++L;
284 cs[0]._nodup=d;for(i=1;c=cs[i];i++){if(c._nodup!=d){c._nodup=d;}else{r=[];for(var j=0;j<i;j++){r[++ri]=cs[j];}for(j=i+1;cj=cs[j];j++){if(cj._nodup!=d){cj._nodup=d;r[++ri]=cj;}}return r;}}return r;}function quickDiffIEXml(c1,c2){var d=++L;for(var i=0,M=c1.length;
285 i<M;i++){c1[i].setAttribute("_qdiff",d);}var r=[];for(var i=0,M=c2.length;i<M;i++){if(c2[i].getAttribute("_qdiff")!=d){r[r.length]=c2[i];}}for(var i=0,M=c1.length;i<M;i++){c1[i].removeAttribute("_qdiff");}return r;}function quickDiff(c1,c2){var M=c1.length;
286 if(!M){return c2;}if(K&&c1[0].selectSingleNode){return quickDiffIEXml(c1,c2);}var d=++L;for(var i=0;i<M;i++){c1[i]._qdiff=d;}var r=[];for(var i=0,N=c2.length;i<N;i++){if(c2[i]._qdiff!=d){r[r.length]=c2[i];}}return r;}function quickId(ns,M,N,id){if(ns==N){var d=N.ownerDocument||N;
287 return d.getElementById(id);}ns=getNodes(ns,M,"*");return byId(ns,null,id);}return {getStyle:function(el,M){return Roo.fly(el).getStyle(M);},compile:function(M,N){N=N||"select";var fn=["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];
288 var q=M,mode,lq;var tk=Roo.DomQuery.matchers;var O=tk.length;var mm;var P=q.match(G);if(P&&P[1]){fn[fn.length]='mode="'+P[1].replace(E,"")+'";';q=q.replace(P[1],"");}while(M.substr(0,1)=="/"){M=M.substr(1);}while(q&&lq!=q){lq=q;var tm=q.match(H);if(N=="select"){if(tm){if(tm[1]=="#"){fn[fn.length]='n = quickId(n, mode, root, "'+tm[2]+'");';
289 }else{fn[fn.length]='n = getNodes(n, mode, "'+tm[2]+'");';}q=q.replace(tm[0],"");}else if(q.substr(0,1)!='@'){fn[fn.length]='n = getNodes(n, mode, "*");';}}else{if(tm){if(tm[1]=="#"){fn[fn.length]='n = byId(n, null, "'+tm[2]+'");';}else{fn[fn.length]='n = byTag(n, "'+tm[2]+'");';
290 }q=q.replace(tm[0],"");}}while(!(mm=q.match(G))){var Q=false;for(var j=0;j<O;j++){var t=tk[j];var m=q.match(t.re);if(m){fn[fn.length]=t.select.replace(F,function(x,i){return m[i];});q=q.replace(m[0],"");Q=true;break;}}if(!Q){throw 'Error parsing selector, parsing failed at "'+q+'"';
291 }}if(mm[1]){fn[fn.length]='mode="'+mm[1].replace(E,"")+'";';q=q.replace(mm[1],"");}}fn[fn.length]="return nodup(n);\n}";eval(fn.join(""));return f;},select:function(M,N,O){if(!N||N==document){N=document;}if(typeof N=="string"){N=document.getElementById(N);
292 }var P=M.split(",");var Q=[];for(var i=0,R=P.length;i<R;i++){var p=P[i].replace(E,"");if(!A[p]){A[p]=Roo.DomQuery.compile(p);if(!A[p]){throw p+" is not a valid selector";}}var S=A[p](N);if(S&&S!=document){Q=Q.concat(S);}}if(P.length>1){return nodup(Q);}return Q;
293 },selectNode:function(M,N){return Roo.DomQuery.select(M,N)[0];},selectValue:function(M,N,O){M=M.replace(E,"");if(!C[M]){C[M]=Roo.DomQuery.compile(M,"select");}var n=C[M](N);n=n[0]?n[0]:n;var v=(n&&n.firstChild?n.firstChild.nodeValue:null);return ((v===null||v===undefined||v==='')?O:v);
294 },selectNumber:function(M,N,O){var v=Roo.DomQuery.selectValue(M,N,O||0);return parseFloat(v);},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el);}var M=(el instanceof Array);var N=Roo.DomQuery.filter(M?el:[el],ss);return M?(N.length==el.length):(N.length>0);
295 },filter:function(M,ss,N){ss=ss.replace(E,"");if(!B[ss]){B[ss]=Roo.DomQuery.compile(ss,"simple");}var O=B[ss](M);return N?quickDiff(O,M):O;},matchers:[{re:/^\.([\w-]+)/,select:'n = byClassName(n, null, " {1} ");'},{re:/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,select:'n = byPseudo(n, "{1}", "{2}");'}
296 ,{re:/^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,select:'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'},{re:/^#([\w-]+)/,select:'n = byId(n, null, "{1}");'},{re:/^@([\w-]+)/,select:'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'}
297 ],operators:{"=":function(a,v){return a==v;},"!=":function(a,v){return a!=v;},"^=":function(a,v){return a&&a.substr(0,v.length)==v;},"$=":function(a,v){return a&&a.substr(a.length-v.length)==v;},"*=":function(a,v){return a&&a.indexOf(v)!==-1;},"%=":function(a,v){return (a%v)==0;
298 },"|=":function(a,v){return a&&(a==v||a.substr(0,v.length+1)==v+'-');},"~=":function(a,v){return a&&(' '+a+' ').indexOf(' '+v+' ')!=-1;}},pseudos:{"first-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.previousSibling)&&n.nodeType!=1);
299 if(!n){r[++ri]=ci;}}return r;},"last-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.nextSibling)&&n.nodeType!=1);if(!n){r[++ri]=ci;}}return r;},"nth-child":function(c,a){var r=[],ri=-1;var m=I.exec(a=="even"&&"2n"||a=="odd"&&"2n+1"||!J.test(a)&&"n+"+a||a);
300 var f=(m[1]||1)-0,l=m[2]-0;for(var i=0,n;n=c[i];i++){var pn=n.parentNode;if(batch!=pn._batch){var j=0;for(var cn=pn.firstChild;cn;cn=cn.nextSibling){if(cn.nodeType==1){cn.nodeIndex=++j;}}pn._batch=batch;}if(f==1){if(l==0||n.nodeIndex==l){r[++ri]=n;}}else if((n.nodeIndex+l)%f==0){r[++ri]=n;
301 }}return r;},"only-child":function(c){var r=[],ri=-1;;for(var i=0,ci;ci=c[i];i++){if(!prev(ci)&&!next(ci)){r[++ri]=ci;}}return r;},"empty":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var M=ci.childNodes,j=0,cn,N=true;while(cn=M[j]){++j;if(cn.nodeType==1||cn.nodeType==3){N=false;
302 break;}}if(N){r[++ri]=ci;}}return r;},"contains":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if((ci.textContent||ci.innerText||'').indexOf(v)!=-1){r[++ri]=ci;}}return r;},"nodeValue":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.firstChild&&ci.firstChild.nodeValue==v){r[++ri]=ci;
303 }}return r;},"checked":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.checked==true){r[++ri]=ci;}}return r;},"not":function(c,ss){return Roo.DomQuery.filter(c,ss,true);},"odd":function(c){return this["nth-child"](c,"odd");},"even":function(c){return this["nth-child"](c,"even");
304 },"nth":function(c,a){return c[a-1]||[];},"first":function(c){return c[0]||[];},"last":function(c){return c[c.length-1]||[];},"has":function(c,ss){var s=Roo.DomQuery.select;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(s(ss,ci).length>0){r[++ri]=ci;}}return r;
305 },"next":function(c,ss){var is=Roo.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=next(ci);if(n&&is(n,ss)){r[++ri]=ci;}}return r;},"prev":function(c,ss){var is=Roo.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=prev(ci);if(n&&is(n,ss)){r[++ri]=ci;
306 }}return r;}}};}();Roo.query=Roo.DomQuery.select;
307 // Roo/util/Observable.js
308 Roo.util.Observable=function(A){A=A||{};this.addEvents(A.events||{});if(A.events){delete A.events;}Roo.apply(this,A);if(this.listeners){this.on(this.listeners);delete this.listeners;}};Roo.util.Observable.prototype={fireEvent:function(){var ce=this.events[arguments[0].toLowerCase()];
309 if(typeof ce=="object"){return ce.fire.apply(ce,Array.prototype.slice.call(arguments,1));}else{return true;}},filterOptRe:/^(?:scope|delay|buffer|single)$/,addListener:function(A,fn,B,o){if(typeof A=="object"){o=A;for(var e in o){if(this.filterOptRe.test(e)){continue;
310 }if(typeof o[e]=="function"){this.addListener(e,o[e],o.scope,o);}else{this.addListener(e,o[e].fn,o[e].scope,o[e]);}}return;}o=(!o||typeof o=="boolean")?{}:o;A=A.toLowerCase();var ce=this.events[A]||true;if(typeof ce=="boolean"){ce=new Roo.util.Event(this,A);
311 this.events[A]=ce;}ce.addListener(fn,B,o);},removeListener:function(A,fn,B){var ce=this.events[A.toLowerCase()];if(typeof ce=="object"){ce.removeListener(fn,B);}},purgeListeners:function(){for(var A in this.events){if(typeof this.events[A]=="object"){this.events[A].clearListeners();
312 }}},relayEvents:function(o,A){var B=function(E){return function(){return this.fireEvent.apply(this,Roo.combine(E,Array.prototype.slice.call(arguments,0)));};};for(var i=0,C=A.length;i<C;i++){var D=A[i];if(!this.events[D]){this.events[D]=true;};o.on(D,B(D),this);
313 }},addEvents:function(o){if(!this.events){this.events={};}Roo.applyIf(this.events,o);},hasListener:function(A){var e=this.events[A];return typeof e=="object"&&e.listeners.length>0;}};Roo.util.Observable.prototype.on=Roo.util.Observable.prototype.addListener;
314 Roo.util.Observable.prototype.un=Roo.util.Observable.prototype.removeListener;Roo.util.Observable.capture=function(o,fn,A){o.fireEvent=o.fireEvent.createInterceptor(fn,A);};Roo.util.Observable.releaseCapture=function(o){o.fireEvent=Roo.util.Observable.prototype.fireEvent;
315 };(function(){var A=function(h,o,D){var E=new Roo.util.DelayedTask();return function(){E.delay(o.buffer,h,D,Array.prototype.slice.call(arguments,0));};};var B=function(h,e,fn,D){return function(){e.removeListener(fn,D);return h.apply(D,arguments);};};var C=function(h,o,D){return function(){var E=Array.prototype.slice.call(arguments,0);
316 setTimeout(function(){h.apply(D,E);},o.delay||10);};};Roo.util.Event=function(D,E){this.name=E;this.obj=D;this.listeners=[];};Roo.util.Event.prototype={addListener:function(fn,D,E){var o=E||{};D=D||this.obj;if(!this.isListening(fn,D)){var l={fn:fn,scope:D,options:o}
317 ;var h=fn;if(o.delay){h=C(h,o,D);}if(o.single){h=B(h,this,fn,D);}if(o.buffer){h=A(h,o,D);}l.fireFn=h;if(!this.firing){this.listeners.push(l);}else{this.listeners=this.listeners.slice(0);this.listeners.push(l);}}},findListener:function(fn,D){D=D||this.obj;
318 var ls=this.listeners;for(var i=0,E=ls.length;i<E;i++){var l=ls[i];if(l.fn==fn&&l.scope==D){return i;}}return -1;},isListening:function(fn,D){return this.findListener(fn,D)!=-1;},removeListener:function(fn,D){var E;if((E=this.findListener(fn,D))!=-1){if(!this.firing){this.listeners.splice(E,1);
319 }else{this.listeners=this.listeners.slice(0);this.listeners.splice(E,1);}return true;}return false;},clearListeners:function(){this.listeners=[];},fire:function(){var ls=this.listeners,D,E=ls.length;if(E>0){this.firing=true;var F=Array.prototype.slice.call(arguments,0);
320 for(var i=0;i<E;i++){var l=ls[i];if(l.fireFn.apply(l.scope||this.obj||window,F)===false){this.firing=false;return false;}}this.firing=false;}return true;}};})();
321 // Roo/Document.js
322 Roo.Document=function(A){this.addEvents({'ready':true});Roo.util.Observable.call(this,A);var B=this;Roo.onReady(function(){B.fireEvent('ready');},null,false);};Roo.extend(Roo.Document,Roo.util.Observable,{});
323 // Roo/EventManager.js
324 Roo.EventManager=function(){var A,B,C=false;var F,G,H,I;var E=Roo.lib.Event;var D=Roo.lib.Dom;var J=function(){if(!C){C=true;Roo.isReady=true;if(B){clearInterval(B);}if(Roo.isGecko||Roo.isOpera){document.removeEventListener("DOMContentLoaded",J,false);}if(Roo.isIE){var T=document.getElementById("ie-deferred-loader");
325 if(T){T.onreadystatechange=null;T.parentNode.removeChild(T);}}if(A){A.fire();A.clearListeners();}}};var K=function(){A=new Roo.util.Event();if(Roo.isGecko||Roo.isOpera){document.addEventListener("DOMContentLoaded",J,false);}else if(Roo.isIE){document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");
326 var T=document.getElementById("ie-deferred-loader");T.onreadystatechange=function(){if(this.readyState=="complete"){J();}};}else if(Roo.isSafari){B=setInterval(function(){var rs=document.readyState;if(rs=="complete"){J();}},10);}E.on(window,"load",J);};var L=function(h,o){var T=new Roo.util.DelayedTask(h);
327 return function(e){e=new Roo.EventObjectImpl(e);T.delay(o.buffer,h,null,[e]);};};var M=function(h,el,T,fn){return function(e){Roo.EventManager.removeListener(el,T,fn);h(e);};};var N=function(h,o){return function(e){e=new Roo.EventObjectImpl(e);setTimeout(function(){h(e);
328 },o.delay||10);};};var O=false;var P=function(){if(O){return O;}var el=document.createElement('div');var T={WebkitTransition:'webkitTransitionEnd',MozTransition:'transitionend',OTransition:'oTransitionEnd otransitionend',transition:'transitionend'};for(var U in T){if(el.style[U]!==undefined){O=T[U];
329 return O;}}};var listen=function(T,U,V,fn,W){var o=(!V||typeof V=="boolean")?{}:V;fn=fn||o.fn;W=W||o.scope;var el=Roo.getDom(T);if(!el){throw "Error listening for \""+U+'\". Element "'+T+'" doesn\'t exist.';}if(U=='transitionend'){U=P();}var h=function(e){e=Roo.EventObject.setEvent(e);
330 var t;if(o.delegate){t=e.getTarget(o.delegate,el);if(!t){return;}}else{t=e.target;}if(o.stopEvent===true){e.stopEvent();}if(o.preventDefault===true){e.preventDefault();}if(o.stopPropagation===true){e.stopPropagation();}if(o.normalized===false){e=e.browserEvent;
331 }fn.call(W||el,e,t,o);};if(o.delay){h=N(h,o);}if(o.single){h=M(h,el,U,fn);}if(o.buffer){h=L(h,o);}fn._handlers=fn._handlers||[];fn._handlers.push([Roo.id(el),U,h]);E.on(el,U,h);if(U=="mousewheel"&&el.addEventListener){el.addEventListener("DOMMouseScroll",h,false);
332 E.on(window,'unload',function(){el.removeEventListener("DOMMouseScroll",h,false);});}if(U=="mousedown"&&el==document){Roo.EventManager.stoppedMouseDownEvent.addListener(h);}return h;};var Q=function(el,T,fn){var id=Roo.id(el),U=fn._handlers,hd=fn;if(U){for(var i=0,V=U.length;
333 i<V;i++){var h=U[i];if(h[0]==id&&h[1]==T){hd=h[2];U.splice(i,1);break;}}}E.un(el,T,hd);el=Roo.getDom(el);if(T=="mousewheel"&&el.addEventListener){el.removeEventListener("DOMMouseScroll",hd,false);}if(T=="mousedown"&&el==document){Roo.EventManager.stoppedMouseDownEvent.removeListener(hd);
334 }};var R=/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;var S={wrap:function(fn,T,U){return function(e){Roo.EventObject.setEvent(e);fn.call(U?T||window:window,Roo.EventObject,T);};},addListener:function(T,U,fn,V,W){if(typeof U=="object"){var o=U;
335 for(var e in o){if(R.test(e)){continue;}if(typeof o[e]=="function"){listen(T,e,o,o[e],o.scope);}else{listen(T,e,o[e]);}}return;}return listen(T,U,W,fn,V);},removeListener:function(T,U,fn){return Q(T,U,fn);},onDocumentReady:function(fn,T,U){if(C){A.addListener(fn,T,U);
336 A.fire();A.clearListeners();return;}if(!A){K();}A.addListener(fn,T,U);},onWindowResize:function(fn,T,U){if(!F){F=new Roo.util.Event();G=new Roo.util.DelayedTask(function(){F.fire(D.getViewWidth(),D.getViewHeight());});E.on(window,"resize",function(){if(Roo.isIE){G.delay(50);
337 }else{F.fire(D.getViewWidth(),D.getViewHeight());}});}F.addListener(fn,T,U);},onTextResize:function(fn,T,U){if(!H){H=new Roo.util.Event();var V=new Roo.Element(document.createElement('div'));V.dom.className='x-text-resize';V.dom.innerHTML='X';V.appendTo(document.body);
338 I=V.dom.offsetHeight;setInterval(function(){if(V.dom.offsetHeight!=I){H.fire(I,I=V.dom.offsetHeight);}},this.textResizeInterval);}H.addListener(fn,T,U);},removeResizeListener:function(fn,T){if(F){F.removeListener(fn,T);}},fireResize:function(){if(F){F.fire(D.getViewWidth(),D.getViewHeight());
339 }},ieDeferSrc:false,textResizeInterval:50};S.on=S.addListener;S.un=S.removeListener;S.stoppedMouseDownEvent=new Roo.util.Event();return S;}();Roo.onReady=Roo.EventManager.onDocumentReady;Roo.onReady(function(){var bd=Roo.get(document.body);if(!bd){return;
340 }var A=[Roo.isIE?"roo-ie":Roo.isIE11?"roo-ie11":Roo.isEdge?"roo-edge":Roo.isGecko?"roo-gecko":Roo.isOpera?"roo-opera":Roo.isSafari?"roo-safari":""];if(Roo.isMac){A.push("roo-mac");}if(Roo.isLinux){A.push("roo-linux");}if(Roo.isIOS){A.push("roo-ios");}if(Roo.isTouch){A.push("roo-touch");
341 }if(Roo.isBorderBox){A.push('roo-border-box');}if(Roo.isStrict){var p=bd.dom.parentNode;if(p){p.className+=' roo-strict';}}bd.addClass(A.join(' '));});Roo.EventObject=function(){var E=Roo.lib.Event;var A={63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35}
342 ;var B=Roo.isIE?{1:0,4:1,2:2}:(Roo.isSafari?{1:0,2:1,3:2}:{0:0,1:1,2:2});Roo.EventObjectImpl=function(e){if(e){this.setEvent(e.browserEvent||e);}};Roo.EventObjectImpl.prototype={browserEvent:null,button:-1,shiftKey:false,ctrlKey:false,altKey:false,BACKSPACE:8,TAB:9,RETURN:13,ENTER:13,SHIFT:16,CONTROL:17,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,F5:116,setEvent:function(e){if(e==this||(e&&e.browserEvent)){return e;
343 }this.browserEvent=e;if(e){this.button=e.button?B[e.button]:(e.which?e.which-1:-1);if(e.type=='click'&&this.button==-1){this.button=0;}this.type=e.type;this.shiftKey=e.shiftKey;this.ctrlKey=e.ctrlKey||e.metaKey;this.altKey=e.altKey;this.keyCode=e.keyCode;
344 this.charCode=(e.type=='keyup'||e.type=='keydown')?0:e.charCode;this.target=E.getTarget(e);this.xy=E.getXY(e);}else{this.button=-1;this.shiftKey=false;this.ctrlKey=false;this.altKey=false;this.keyCode=0;this.charCode=0;this.target=null;this.xy=[0,0];}return this;
345 },stopEvent:function(){if(this.browserEvent){if(this.browserEvent.type=='mousedown'){Roo.EventManager.stoppedMouseDownEvent.fire(this);}E.stopEvent(this.browserEvent);}},preventDefault:function(){if(this.browserEvent){E.preventDefault(this.browserEvent);}
346 },isNavKeyPress:function(){var k=this.keyCode;k=Roo.isSafari?(A[k]||k):k;return (k>=33&&k<=40)||k==this.RETURN||k==this.TAB||k==this.ESC;},isSpecialKey:function(){var k=this.keyCode;return (this.type=='keypress'&&this.ctrlKey)||k==9||k==13||k==40||k==27||(k==16)||(k==17)||(k>=18&&k<=20)||(k>=33&&k<=35)||(k>=36&&k<=39)||(k>=44&&k<=45);
347 },stopPropagation:function(){if(this.browserEvent){if(this.type=='mousedown'){Roo.EventManager.stoppedMouseDownEvent.fire(this);}E.stopPropagation(this.browserEvent);}},getCharCode:function(){return this.charCode||this.keyCode;},getKey:function(){var k=this.keyCode||this.charCode;
348 return Roo.isSafari?(A[k]||k):k;},getPageX:function(){return this.xy[0];},getPageY:function(){return this.xy[1];},getTime:function(){if(this.browserEvent){return E.getTime(this.browserEvent);}return null;},getXY:function(){return this.xy;},getTarget:function(C,D,F){return C?Roo.fly(this.target).findParent(C,D,F):this.target;
349 },getRelatedTarget:function(){if(this.browserEvent){return E.getRelatedTarget(this.browserEvent);}return null;},getWheelDelta:function(){var e=this.browserEvent;var C=0;if(e.wheelDelta){C=e.wheelDelta/120;}else if(e.detail){C=-e.detail/3;}return C;},hasModifier:function(){return !!((this.ctrlKey||this.altKey)||this.shiftKey);
350 },within:function(el,C){var t=this[C?"getRelatedTarget":"getTarget"]();return t&&Roo.fly(el).contains(t);},getPoint:function(){return new Roo.lib.Point(this.xy[0],this.xy[1]);}};return new Roo.EventObjectImpl();}();
351 // Roo/Element.js
352 (function(){var D=Roo.lib.Dom;var E=Roo.lib.Event;var A=Roo.lib.Anim;var B={};var C=/(-[a-z])/gi;var F=function(m,a){return a.charAt(1).toUpperCase();};var G=document.defaultView;Roo.Element=function(J,K){var L=typeof J=="string"?document.getElementById(J):J;
353 this.listeners={};if(!L){return null;}var id=L.id;if(K!==true&&id&&Roo.Element.cache[id]){return Roo.Element.cache[id];}this.dom=L;this.id=id||Roo.id(L);return this;};var El=Roo.Element;El.prototype={originalDisplay:"",visibilityMode:1,defaultUnit:"px",setVisibilityMode:function(J){this.visibilityMode=J;
354 return this;},enableDisplayMode:function(J){this.setVisibilityMode(El.DISPLAY);if(typeof J!="undefined"){this.originalDisplay=J;}return this;},findParent:function(J,K,L){var p=this.dom,b=document.body,M=0,dq=Roo.DomQuery,N;K=K||50;if(typeof K!="number"){N=Roo.getDom(K);
355 K=10;}while(p&&p.nodeType==1&&M<K&&p!=b&&p!=N){if(dq.is(p,J)){return L?Roo.get(p):p;}M++;p=p.parentNode;}return null;},findParentNode:function(J,K,L){var p=Roo.fly(this.dom.parentNode,'_internal');return p?p.findParent(J,K,L):null;},findScrollableParent:function(){var J=/(auto|scroll)/;
356 if(this.getStyle('position')==='fixed'){return Roo.isAndroid?Roo.get(document.documentElement):Roo.get(document.body);}var K=this.getStyle('position')==="absolute";for(var L=this;(L=Roo.get(L.dom.parentNode));){if(K&&L.getStyle('position')==="static"){continue;
357 }if(J.test(L.getStyle('overflow')+L.getStyle('overflow-x')+L.getStyle('overflow-y'))){return L;}if(L.dom.nodeName.toLowerCase()=='body'){return Roo.isAndroid?Roo.get(document.documentElement):Roo.get(document.body);}}return Roo.isAndroid?Roo.get(document.documentElement):Roo.get(document.body);
358 },up:function(J,K){return this.findParentNode(J,K,true);},is:function(J){return Roo.DomQuery.is(this.dom,J);},animate:function(J,K,L,M,N){this.anim(J,{duration:K,callback:L,easing:M},N);return this;},anim:function(J,K,L,M,N,cb){L=L||'run';K=K||{};var O=Roo.lib.Anim[L](this.dom,J,(K.duration||M)||.35,(K.easing||N)||'easeOut',function(){Roo.callback(cb,this);
359 Roo.callback(K.callback,K.scope||this,[this,K]);},this);K.anim=O;return O;},preanim:function(a,i){return !a[i]?false:(typeof a[i]=="object"?a[i]:{duration:a[i+1],callback:a[i+2],easing:a[i+3]});},clean:function(J){if(this.isCleaned&&J!==true){return this;
360 }var ns=/\S/;var d=this.dom,n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!ns.test(n.nodeValue)){d.removeChild(n);}else{n.nodeIndex=++ni;}n=nx;}this.isCleaned=true;return this;},calcOffsetsTo:function(el){el=Roo.get(el);var d=el.dom;
361 var J=false;if(el.getStyle('position')=='static'){el.position('relative');J=true;}var x=0,y=0;var op=this.dom;while(op&&op!=d&&op.tagName!='HTML'){x+=op.offsetLeft;y+=op.offsetTop;op=op.offsetParent;}if(J){el.position('static');}return [x,y];},scrollIntoView:function(J,K){var c=Roo.getDom(J)||document.body;
362 var el=this.dom;var o=this.calcOffsetsTo(c),l=o[0],t=o[1],b=t+el.offsetHeight,r=l+el.offsetWidth;var ch=c.clientHeight;var ct=parseInt(c.scrollTop,10);var cl=parseInt(c.scrollLeft,10);var cb=ct+ch;var cr=cl+c.clientWidth;if(t<ct){c.scrollTop=t;}else if(b>cb){c.scrollTop=b-ch;
363 }if(K!==false){if(l<cl){c.scrollLeft=l;}else if(r>cr){c.scrollLeft=r-c.clientWidth;}}return this;},scrollChildIntoView:function(J,K){Roo.fly(J,'_scrollChildIntoView').scrollIntoView(this,K);},autoHeight:function(J,K,L,M){var N=this.getHeight();this.clip();
364 this.setHeight(1);setTimeout(function(){var O=parseInt(this.dom.scrollHeight,10);if(!J){this.setHeight(O);this.unclip();if(typeof L=="function"){L();}}else{this.setHeight(N);this.setHeight(O,J,K,function(){this.unclip();if(typeof L=="function"){L();}}.createDelegate(this),M);
365 }}.createDelegate(this),0);return this;},contains:function(el){if(!el){return false;}return D.isAncestor(this.dom,el.dom?el.dom:el);},isVisible:function(J){var K=!(this.getStyle("visibility")=="hidden"||this.getStyle("display")=="none");if(J!==true||!K){return K;
366 }var p=this.dom.parentNode;while(p&&p.tagName.toLowerCase()!="body"){if(!Roo.fly(p,'_isVisible').isVisible()){return false;}p=p.parentNode;}return true;},select:function(J,K){return El.select(J,K,this.dom);},query:function(J,K){return Roo.DomQuery.select(J,this.dom);
367 },child:function(J,K){var n=Roo.DomQuery.selectNode(J,this.dom);return K?n:Roo.get(n);},down:function(J,K){var n=Roo.DomQuery.selectNode(" > "+J,this.dom);return K?n:Roo.get(n);},initDD:function(J,K,L){var dd=new Roo.dd.DD(Roo.id(this.dom),J,K);return Roo.apply(dd,L);
368 },initDDProxy:function(J,K,L){var dd=new Roo.dd.DDProxy(Roo.id(this.dom),J,K);return Roo.apply(dd,L);},initDDTarget:function(J,K,L){var dd=new Roo.dd.DDTarget(Roo.id(this.dom),J,K);return Roo.apply(dd,L);},setVisible:function(J,K){if(!K||!A){if(this.visibilityMode==El.DISPLAY){this.setDisplayed(J);
369 }else{this.fixDisplay();this.dom.style.visibility=J?"visible":"hidden";}}else{var L=this.dom;var M=this.visibilityMode;if(J){this.setOpacity(.01);this.setVisible(true);}this.anim({opacity:{to:(J?1:0)}},this.preanim(arguments,1),null,.35,'easeIn',function(){if(!J){if(M==El.DISPLAY){L.style.display="none";
370 }else{L.style.visibility="hidden";}Roo.get(L).setOpacity(1);}});}return this;},isDisplayed:function(){return this.getStyle("display")!="none";},toggle:function(J){this.setVisible(!this.isVisible(),this.preanim(arguments,0));return this;},setDisplayed:function(J){if(typeof J=="boolean"){J=J?this.originalDisplay:"none";
371 }this.setStyle("display",J);return this;},focus:function(){try{this.dom.focus();}catch(e){}return this;},blur:function(){try{this.dom.blur();}catch(e){}return this;},addClass:function(J){if(J instanceof Array){for(var i=0,K=J.length;i<K;i++){this.addClass(J[i]);
372 }}else{if(J&&!this.hasClass(J)){if(this.dom instanceof SVGElement){this.dom.className.baseVal=this.dom.className.baseVal+" "+J;}else{this.dom.className=this.dom.className+" "+J;}}}return this;},radioClass:function(J){var K=this.dom.parentNode.childNodes;for(var i=0;
373 i<K.length;i++){var s=K[i];if(s.nodeType==1){Roo.get(s).removeClass(J);}}this.addClass(J);return this;},removeClass:function(J){var cn=this.dom instanceof SVGElement?this.dom.className.baseVal:this.dom.className;if(!J||!cn){return this;}if(J instanceof Array){for(var i=0,K=J.length;
374 i<K;i++){this.removeClass(J[i]);}}else{if(this.hasClass(J)){var re=this.classReCache[J];if(!re){re=new RegExp('(?:^|\\s+)'+J+'(?:\\s+|$)',"g");this.classReCache[J]=re;}if(this.dom instanceof SVGElement){this.dom.className.baseVal=cn.replace(re," ");}else{this.dom.className=cn.replace(re," ");
375 }}}return this;},classReCache:{},toggleClass:function(J){if(this.hasClass(J)){this.removeClass(J);}else{this.addClass(J);}return this;},hasClass:function(J){if(this.dom instanceof SVGElement){return J&&(' '+this.dom.className.baseVal+' ').indexOf(' '+J+' ')!=-1;
376 }return J&&(' '+this.dom.className+' ').indexOf(' '+J+' ')!=-1;},replaceClass:function(J,K){this.removeClass(J);this.addClass(K);return this;},getStyles:function(){var a=arguments,J=a.length,r={};for(var i=0;i<J;i++){r[a[i]]=this.getStyle(a[i]);}return r;
377 },getStyle:function(){return G&&G.getComputedStyle?function(J){var el=this.dom,v,cs,K;if(J=='float'){J="cssFloat";}if(el.style&&(v=el.style[J])){return v;}if(cs=G.getComputedStyle(el,"")){if(!(K=B[J])){K=B[J]=J.replace(C,F);}return cs[K];}return null;}:function(J){var el=this.dom,v,cs,K;
378 if(J=='opacity'){if(typeof el.style.filter=='string'){var m=el.style.filter.match(/alpha\(opacity=(.*)\)/i);if(m){var fv=parseFloat(m[1]);if(!isNaN(fv)){return fv?fv/100:0;}}}return 1;}else if(J=='float'){J="styleFloat";}if(!(K=B[J])){K=B[J]=J.replace(C,F);
379 }if(v=el.style[K]){return v;}if(cs=el.currentStyle){return cs[K];}return null;};}(),setStyle:function(J,K){if(typeof J=="string"){if(J=='float'){this.setStyle(Roo.isIE?'styleFloat':'cssFloat',K);return this;}var L;if(!(L=B[J])){L=B[J]=J.replace(C,F);}if(L=='opacity'){this.setOpacity(K);
380 }else{this.dom.style[L]=K;}}else{for(var M in J){if(typeof J[M]!="function"){this.setStyle(M,J[M]);}}}return this;},applyStyles:function(J){Roo.DomHelper.applyStyles(this.dom,J);return this;},getX:function(){return D.getX(this.dom);},getY:function(){return D.getY(this.dom);
381 },getXY:function(){return D.getXY(this.dom);},setX:function(x,J){if(!J||!A){D.setX(this.dom,x);}else{this.setXY([x,this.getY()],this.preanim(arguments,1));}return this;},setY:function(y,J){if(!J||!A){D.setY(this.dom,y);}else{this.setXY([this.getX(),y],this.preanim(arguments,1));
382 }return this;},setLeft:function(J){this.setStyle("left",this.addUnits(J));return this;},setTop:function(J){this.setStyle("top",this.addUnits(J));return this;},setRight:function(J){this.setStyle("right",this.addUnits(J));return this;},setBottom:function(J){this.setStyle("bottom",this.addUnits(J));
383 return this;},setXY:function(J,K){if(!K||!A){D.setXY(this.dom,J);}else{this.anim({points:{to:J}},this.preanim(arguments,1),'motion');}return this;},setLocation:function(x,y,J){this.setXY([x,y],this.preanim(arguments,2));return this;},moveTo:function(x,y,J){this.setXY([x,y],this.preanim(arguments,2));
384 return this;},getRegion:function(){return D.getRegion(this.dom);},getHeight:function(J){var h=this.dom.offsetHeight||0;return J!==true?h:h-this.getBorderWidth("tb")-this.getPadding("tb");},getWidth:function(J){var w=this.dom.offsetWidth||0;return J!==true?w:w-this.getBorderWidth("lr")-this.getPadding("lr");
385 },getComputedHeight:function(){var h=Math.max(this.dom.offsetHeight,this.dom.clientHeight);if(!h){h=parseInt(this.getStyle('height'),10)||0;if(!this.isBorderBox()){h+=this.getFrameWidth('tb');}}return h;},getComputedWidth:function(){var w=Math.max(this.dom.offsetWidth,this.dom.clientWidth);
386 if(!w){w=parseInt(this.getStyle('width'),10)||0;if(!this.isBorderBox()){w+=this.getFrameWidth('lr');}}return w;},getSize:function(J){return {width:this.getWidth(J),height:this.getHeight(J)};},getViewSize:function(){var d=this.dom,J=document,aw=0,ah=0;if(d==J||d==J.body){return {width:D.getViewWidth(),height:D.getViewHeight()}
387 ;}else{return {width:d.clientWidth,height:d.clientHeight};}},getValue:function(J){return J?parseInt(this.dom.value,10):this.dom.value;},adjustWidth:function(J){if(typeof J=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){J-=(this.getBorderWidth("lr")+this.getPadding("lr"));
388 }if(J<0){J=0;}}return J;},adjustHeight:function(J){if(typeof J=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){J-=(this.getBorderWidth("tb")+this.getPadding("tb"));}if(J<0){J=0;}}return J;},setWidth:function(J,K){J=this.adjustWidth(J);if(!K||!A){this.dom.style.width=this.addUnits(J);
389 }else{this.anim({width:{to:J}},this.preanim(arguments,1));}return this;},setHeight:function(J,K){J=this.adjustHeight(J);if(!K||!A){this.dom.style.height=this.addUnits(J);}else{this.anim({height:{to:J}},this.preanim(arguments,1));}return this;},setSize:function(J,K,L){if(typeof J=="object"){K=J.height;
390 J=J.width;}J=this.adjustWidth(J);K=this.adjustHeight(K);if(!L||!A){this.dom.style.width=this.addUnits(J);this.dom.style.height=this.addUnits(K);}else{this.anim({width:{to:J},height:{to:K}},this.preanim(arguments,2));}return this;},setBounds:function(x,y,J,K,L){if(!L||!A){this.setSize(J,K);
391 this.setLocation(x,y);}else{J=this.adjustWidth(J);K=this.adjustHeight(K);this.anim({points:{to:[x,y]},width:{to:J},height:{to:K}},this.preanim(arguments,4),'motion');}return this;},setRegion:function(J,K){this.setBounds(J.left,J.top,J.right-J.left,J.bottom-J.top,this.preanim(arguments,1));
392 return this;},addListener:function(J,fn,K,L){if(J=='dblclick'){this.addListener('touchstart',this.onTapHandler,this);}if(!this.dom){return;}if(this.dom instanceof SVGElement&&!(this.dom instanceof SVGSVGElement)){if(typeof(this.listeners[J])=='undefined'){this.listeners[J]=new Roo.util.Event(this,J);
393 }this.listeners[J].addListener(fn,K,L);return;}Roo.EventManager.on(this.dom,J,fn,K||this,L);},tapedTwice:false,onTapHandler:function(J){if(!this.tapedTwice){this.tapedTwice=true;var s=this;setTimeout(function(){s.tapedTwice=false;},300);return;}J.preventDefault();
394 var K=new MouseEvent('dblclick',{view:window,bubbles:true,cancelable:true});this.dom.dispatchEvent(K);},removeListener:function(J,fn,K){Roo.EventManager.removeListener(this.dom,J,fn);if(typeof(this.listeners)=='undefined'||typeof(this.listeners[J])=='undefined'){return this;
395 }this.listeners[J].removeListener(fn,K);return this;},removeAllListeners:function(){E.purgeElement(this.dom);this.listeners={};return this;},relayEvent:function(J,K){this.on(J,function(e){K.fireEvent(J,e);});},setOpacity:function(J,K){if(!K||!A){var s=this.dom.style;
396 if(Roo.isIE){s.zoom=1;s.filter=(s.filter||'').replace(/alpha\([^\)]*\)/gi,"")+(J==1?"":"alpha(opacity="+J*100+")");}else{s.opacity=J;}}else{this.anim({opacity:{to:J}},this.preanim(arguments,1),null,.35,'easeIn');}return this;},getLeft:function(J){if(!J){return this.getX();
397 }else{return parseInt(this.getStyle("left"),10)||0;}},getRight:function(J){if(!J){return this.getX()+this.getWidth();}else{return (this.getLeft(true)+this.getWidth())||0;}},getTop:function(J){if(!J){return this.getY();}else{return parseInt(this.getStyle("top"),10)||0;
398 }},getBottom:function(J){if(!J){return this.getY()+this.getHeight();}else{return (this.getTop(true)+this.getHeight())||0;}},position:function(J,K,x,y){if(!J){if(this.getStyle('position')=='static'){this.setStyle('position','relative');}}else{this.setStyle("position",J);
399 }if(K){this.setStyle("z-index",K);}if(x!==undefined&&y!==undefined){this.setXY([x,y]);}else if(x!==undefined){this.setX(x);}else if(y!==undefined){this.setY(y);}},clearPositioning:function(J){J=J||'';this.setStyle({"left":J,"right":J,"top":J,"bottom":J,"z-index":"","position":"static"}
400 );return this;},getPositioning:function(){var l=this.getStyle("left");var t=this.getStyle("top");return {"position":this.getStyle("position"),"left":l,"right":l?"":this.getStyle("right"),"top":t,"bottom":t?"":this.getStyle("bottom"),"z-index":this.getStyle("z-index")}
401 ;},getBorderWidth:function(J){return this.addStyles(J,El.borders);},getPadding:function(J){return this.addStyles(J,El.paddings);},setPositioning:function(pc){this.applyStyles(pc);if(pc.right=="auto"){this.dom.style.right="";}if(pc.bottom=="auto"){this.dom.style.bottom="";
402 }return this;},fixDisplay:function(){if(this.getStyle("display")=="none"){this.setStyle("visibility","hidden");this.setStyle("display",this.originalDisplay);if(this.getStyle("display")=="none"){this.setStyle("display","block");}}},setLeftTop:function(J,K){this.dom.style.left=this.addUnits(J);
403 this.dom.style.top=this.addUnits(K);return this;},move:function(J,K,L){var xy=this.getXY();J=J.toLowerCase();switch(J){case "l":case "left":this.moveTo(xy[0]-K,xy[1],this.preanim(arguments,2));break;case "r":case "right":this.moveTo(xy[0]+K,xy[1],this.preanim(arguments,2));
404 break;case "t":case "top":case "up":this.moveTo(xy[0],xy[1]-K,this.preanim(arguments,2));break;case "b":case "bottom":case "down":this.moveTo(xy[0],xy[1]+K,this.preanim(arguments,2));break;}return this;},clip:function(){if(!this.isClipped){this.isClipped=true;
405 this.originalClip={"o":this.getStyle("overflow"),"x":this.getStyle("overflow-x"),"y":this.getStyle("overflow-y")};this.setStyle("overflow","hidden");this.setStyle("overflow-x","hidden");this.setStyle("overflow-y","hidden");}return this;},unclip:function(){if(this.isClipped){this.isClipped=false;
406 var o=this.originalClip;if(o.o){this.setStyle("overflow",o.o);}if(o.x){this.setStyle("overflow-x",o.x);}if(o.y){this.setStyle("overflow-y",o.y);}}return this;},getAnchorXY:function(J,K,s){var w,h,vp=false;if(!s){var d=this.dom;if(d==document.body||d==document){vp=true;
407 w=D.getViewWidth();h=D.getViewHeight();}else{w=this.getWidth();h=this.getHeight();}}else{w=s.width;h=s.height;}var x=0,y=0,r=Math.round;switch((J||"tl").toLowerCase()){case "c":x=r(w*.5);y=r(h*.5);break;case "t":x=r(w*.5);y=0;break;case "l":x=0;y=r(h*.5);
408 break;case "r":x=w;y=r(h*.5);break;case "b":x=r(w*.5);y=h;break;case "tl":x=0;y=0;break;case "bl":x=0;y=h;break;case "br":x=w;y=h;break;case "tr":x=w;y=0;break;}if(K===true){return [x,y];}if(vp){var sc=this.getScroll();return [x+sc.left,y+sc.top];}var o=this.getXY();
409 return [x+o[0],y+o[1]];},getAlignToXY:function(el,p,o){el=Roo.get(el);var d=this.dom;if(!el.dom){throw "Element.alignTo with an element that doesn't exist";}var c=false;var p1="",p2="";o=o||[0,0];if(!p){p="tl-bl";}else if(p=="?"){p="tl-bl?";}else if(p.indexOf("-")==-1){p="tl-"+p;
410 }p=p.toLowerCase();var m=p.match(/^([a-z]+)-([a-z]+)(\?)?$/);if(!m){throw "Element.alignTo with an invalid alignment "+p;}p1=m[1];p2=m[2];c=!!m[3];var a1=this.getAnchorXY(p1,true);var a2=el.getAnchorXY(p2,false);var x=a2[0]-a1[0]+o[0];var y=a2[1]-a1[1]+o[1];
411 if(c){var w=this.getWidth(),h=this.getHeight(),r=el.getRegion();var dw=D.getViewWidth()-5,dh=D.getViewHeight()-5;var J=p1.charAt(0),K=p1.charAt(p1.length-1);var L=p2.charAt(0),M=p2.charAt(p2.length-1);var N=((J=="t"&&L=="b")||(J=="b"&&L=="t"));var O=((K=="r"&&M=="l")||(K=="l"&&M=="r"));
412 var P=document;var Q=(P.documentElement.scrollLeft||P.body.scrollLeft||0)+5;var R=(P.documentElement.scrollTop||P.body.scrollTop||0)+5;if((x+w)>dw+Q){x=O?r.left-w:dw+Q-w;}if(x<Q){x=O?r.right:Q;}if((y+h)>dh+R){y=N?r.top-h:dh+R-h;}if(y<R){y=N?r.bottom:R;}}return [x,y];
413 },getConstrainToXY:function(){var os={top:0,left:0,bottom:0,right:0};return function(el,J,K,L){el=Roo.get(el);K=K?Roo.applyIf(K,os):os;var vw,vh,vx=0,vy=0;if(el.dom==document.body||el.dom==document){vw=Roo.lib.Dom.getViewWidth();vh=Roo.lib.Dom.getViewHeight();
414 }else{vw=el.dom.clientWidth;vh=el.dom.clientHeight;if(!J){var M=el.getXY();vx=M[0];vy=M[1];}}var s=el.getScroll();vx+=K.left+s.left;vy+=K.top+s.top;vw-=K.right;vh-=K.bottom;var vr=vx+vw;var vb=vy+vh;var xy=L||(!J?this.getXY():[this.getLeft(true),this.getTop(true)]);
415 var x=xy[0],y=xy[1];var w=this.dom.offsetWidth,h=this.dom.offsetHeight;var N=false;if((x+w)>vr){x=vr-w;N=true;}if((y+h)>vb){y=vb-h;N=true;}if(x<vx){x=vx;N=true;}if(y<vy){y=vy;N=true;}return N?[x,y]:false;};}(),adjustForConstraints:function(xy,J,K){return this.getConstrainToXY(J||document,false,K,xy)||xy;
416 },alignTo:function(J,K,L,M){var xy=this.getAlignToXY(J,K,L);this.setXY(xy,this.preanim(arguments,3));return this;},anchorTo:function(el,J,K,L,M,N){var O=function(){this.alignTo(el,J,K,L);Roo.callback(N,this);};Roo.EventManager.onWindowResize(O,this);var tm=typeof M;
417 if(tm!='undefined'){Roo.EventManager.on(window,'scroll',O,this,{buffer:tm=='number'?M:50});}O.call(this);return this;},clearOpacity:function(){if(window.ActiveXObject){if(typeof this.dom.style.filter=='string'&&(/alpha/i).test(this.dom.style.filter)){this.dom.style.filter="";
418 }}else{this.dom.style.opacity="";this.dom.style["-moz-opacity"]="";this.dom.style["-khtml-opacity"]="";}return this;},hide:function(J){this.setVisible(false,this.preanim(arguments,0));return this;},show:function(J){this.setVisible(true,this.preanim(arguments,0));
419 return this;},addUnits:function(J){return Roo.Element.addUnits(J,this.defaultUnit);},beginMeasure:function(){var el=this.dom;if(el.offsetWidth||el.offsetHeight){return this;}var J=[];var p=this.dom,b=document.body;while((!el.offsetWidth&&!el.offsetHeight)&&p&&p.tagName&&p!=b){var pe=Roo.get(p);
420 if(pe.getStyle('display')=='none'){J.push({el:p,visibility:pe.getStyle("visibility")});p.style.visibility="hidden";p.style.display="block";}p=p.parentNode;}this._measureChanged=J;return this;},endMeasure:function(){var J=this._measureChanged;if(J){for(var i=0,K=J.length;
421 i<K;i++){var r=J[i];r.el.style.visibility=r.visibility;r.el.style.display="none";}this._measureChanged=null;}return this;},update:function(J,K,L){if(typeof J=="undefined"){J="";}if(K!==true){this.dom.innerHTML=J;if(typeof L=="function"){L();}return this;}
422 var id=Roo.id();var M=this.dom;J+='<span id="'+id+'"></span>';E.onAvailable(id,function(){var hd=document.getElementsByTagName("head")[0];var re=/(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;var N=/\ssrc=([\'\"])(.*?)\1/i;var O=/\stype=([\'\"])(.*?)\1/i;
423 var P;while(P=re.exec(J)){var Q=P[1];var R=Q?Q.match(N):false;if(R&&R[2]){var s=document.createElement("script");s.src=R[2];var S=Q.match(O);if(S&&S[2]){s.type=S[2];}hd.appendChild(s);}else if(P[2]&&P[2].length>0){if(window.execScript){window.execScript(P[2]);
424 }else{window.eval(P[2]);}}}var el=document.getElementById(id);if(el){el.parentNode.removeChild(el);}if(typeof L=="function"){L();}});M.innerHTML=J.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,"");return this;},load:function(){var um=this.getUpdateManager();
425 um.update.apply(um,arguments);return this;},getUpdateManager:function(){if(!this.updateManager){this.updateManager=new Roo.UpdateManager(this);}return this.updateManager;},unselectable:function(){this.dom.unselectable="on";this.swallowEvent("selectstart",true);
426 this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");this.addClass("x-unselectable");return this;},getCenterXY:function(){return this.getAlignToXY(document,'c-c');},center:function(J){this.alignTo(J||document,'c-c');return this;},isBorderBox:function(){return I[this.dom.tagName.toLowerCase()]||Roo.isBorderBox;
427 },getBox:function(J,K){var xy;if(!K){xy=this.getXY();}else{var L=parseInt(this.getStyle("left"),10)||0;var M=parseInt(this.getStyle("top"),10)||0;xy=[L,M];}var el=this.dom,w=el.offsetWidth,h=el.offsetHeight,bx;if(!J){bx={x:xy[0],y:xy[1],0:xy[0],1:xy[1],width:w,height:h}
428 ;}else{var l=this.getBorderWidth("l")+this.getPadding("l");var r=this.getBorderWidth("r")+this.getPadding("r");var t=this.getBorderWidth("t")+this.getPadding("t");var b=this.getBorderWidth("b")+this.getPadding("b");bx={x:xy[0]+l,y:xy[1]+t,0:xy[0]+l,1:xy[1]+t,width:w-(l+r),height:h-(t+b)}
429 ;}bx.right=bx.x+bx.width;bx.bottom=bx.y+bx.height;return bx;},getFrameWidth:function(J,K){return K&&Roo.isBorderBox?0:(this.getPadding(J)+this.getBorderWidth(J));},setBox:function(J,K,L){var w=J.width,h=J.height;if((K&&!this.autoBoxAdjust)&&!this.isBorderBox()){w-=(this.getBorderWidth("lr")+this.getPadding("lr"));
430 h-=(this.getBorderWidth("tb")+this.getPadding("tb"));}this.setBounds(J.x,J.y,w,h,this.preanim(arguments,2));return this;},repaint:function(){var J=this.dom;this.addClass("x-repaint");setTimeout(function(){Roo.get(J).removeClass("x-repaint");},1);return this;
431 },getMargins:function(J){if(!J){return {top:parseInt(this.getStyle("margin-top"),10)||0,left:parseInt(this.getStyle("margin-left"),10)||0,bottom:parseInt(this.getStyle("margin-bottom"),10)||0,right:parseInt(this.getStyle("margin-right"),10)||0};}else{return this.addStyles(J,El.margins);
432 }},addStyles:function(J,K){var L=0,v,w;for(var i=0,M=J.length;i<M;i++){v=this.getStyle(K[J.charAt(i)]);if(v){w=parseInt(v,10);if(w){L+=w;}}}return L;},createProxy:function(J,K,L){if(K){K=Roo.getDom(K);}else{K=document.body;}J=typeof J=="object"?J:{tag:"div",cls:J}
433 ;var M=Roo.DomHelper.append(K,J,true);if(L){M.setBox(this.getBox());}return M;},mask:function(J,K){if(this.getStyle("position")=="static"&&this.dom.tagName!=='BODY'){this.setStyle("position","relative");}if(!this._mask){this._mask=Roo.DomHelper.append(this.dom,{cls:"roo-el-mask"}
434 ,true);}this.addClass("x-masked");this._mask.setDisplayed(true);var z=0;var L=this.dom;while(L&&L.style){if(!isNaN(parseInt(L.style.zIndex))){z=Math.max(z,parseInt(L.style.zIndex));}L=L.parentNode;}if(this.dom==document.body){z=1000000;this._mask.setWidth(Roo.lib.Dom.getDocumentWidth());
435 this._mask.setHeight(Roo.lib.Dom.getDocumentHeight());}if(typeof J=='string'){if(!this._maskMsg){this._maskMsg=Roo.DomHelper.append(this.dom,{cls:"roo-el-mask-msg",cn:[{tag:'i',cls:'fa fa-spinner fa-spin'},{tag:'div'}]},true);}var mm=this._maskMsg;mm.dom.className=K?"roo-el-mask-msg "+K:"roo-el-mask-msg";
436 if(mm.dom.lastChild){mm.dom.lastChild.innerHTML=J;}mm.setDisplayed(true);mm.center(this);mm.setStyle('z-index',z+102);}if(Roo.isIE&&!(Roo.isIE7&&Roo.isStrict)&&this.getStyle('height')=='auto'){this._mask.setHeight(this.getHeight());}this._mask.setStyle('z-index',z+100);
437 return this._mask;},unmask:function(J){if(this._mask){if(J===true){this._mask.remove();delete this._mask;if(this._maskMsg){this._maskMsg.remove();delete this._maskMsg;}}else{this._mask.setDisplayed(false);if(this._maskMsg){this._maskMsg.setDisplayed(false);
438 }}}this.removeClass("x-masked");},isMasked:function(){return this._mask&&this._mask.isVisible();},createShim:function(){var el=document.createElement('iframe');el.frameBorder='no';el.className='roo-shim';if(Roo.isIE&&Roo.isSecure){el.src=Roo.SSL_SECURE_URL;
439 }var J=Roo.get(this.dom.parentNode.insertBefore(el,this.dom));J.autoBoxAdjust=false;return J;},remove:function(){if(this.dom.parentNode){this.dom.parentNode.removeChild(this.dom);}delete El.cache[this.dom.id];},addClassOnOver:function(J,K){this.on("mouseover",function(){Roo.fly(this,'_internal').addClass(J);
440 },this.dom);var L=function(e){if(K!==true||!e.within(this,true)){Roo.fly(this,'_internal').removeClass(J);}};this.on("mouseout",L,this.dom);return this;},addClassOnFocus:function(J){this.on("focus",function(){Roo.fly(this,'_internal').addClass(J);},this.dom);
441 this.on("blur",function(){Roo.fly(this,'_internal').removeClass(J);},this.dom);return this;},addClassOnClick:function(J){var K=this.dom;this.on("mousedown",function(){Roo.fly(K,'_internal').addClass(J);var d=Roo.get(document);var fn=function(){Roo.fly(K,'_internal').removeClass(J);
442 d.removeListener("mouseup",fn);};d.on("mouseup",fn);});return this;},swallowEvent:function(J,K){var fn=function(e){e.stopPropagation();if(K){e.preventDefault();}};if(J instanceof Array){for(var i=0,L=J.length;i<L;i++){this.on(J[i],fn);}return this;}this.on(J,fn);
443 return this;},fitToParentDelegate:Roo.emptyFn,fitToParent:function(J,K){Roo.EventManager.removeResizeListener(this.fitToParentDelegate);this.fitToParentDelegate=Roo.emptyFn;if(J===true&&!this.dom.parentNode){return this;}var p=Roo.get(K||this.dom.parentNode);
444 this.setSize(p.getComputedWidth()-p.getFrameWidth('lr'),p.getComputedHeight()-p.getFrameWidth('tb'));if(J===true){this.fitToParentDelegate=this.fitToParent.createDelegate(this,[true,K]);Roo.EventManager.onWindowResize(this.fitToParentDelegate);}return this;
445 },getNextSibling:function(){var n=this.dom.nextSibling;while(n&&n.nodeType!=1){n=n.nextSibling;}return n;},getPrevSibling:function(){var n=this.dom.previousSibling;while(n&&n.nodeType!=1){n=n.previousSibling;}return n;},appendChild:function(el){el=Roo.get(el);
446 el.appendTo(this);return this;},createChild:function(J,K,L){J=J||{tag:'div'};if(K){return Roo.DomHelper.insertBefore(K,J,L!==true);}return Roo.DomHelper[!this.dom.firstChild?'overwrite':'append'](this.dom,J,L!==true);},appendTo:function(el){el=Roo.getDom(el);
447 el.appendChild(this.dom);return this;},insertBefore:function(el){el=Roo.getDom(el);el.parentNode.insertBefore(this.dom,el);return this;},insertAfter:function(el){el=Roo.getDom(el);el.parentNode.insertBefore(this.dom,el.nextSibling);return this;},insertFirst:function(el,J){el=el||{}
448 ;if(typeof el=='object'&&!el.nodeType){return this.createChild(el,this.dom.firstChild,J);}else{el=Roo.getDom(el);this.dom.insertBefore(el,this.dom.firstChild);return !J?Roo.get(el):el;}},insertSibling:function(el,J,K){J=J?J.toLowerCase():'before';el=el||{}
449 ;var rt,L=J=='before'?this.dom:this.dom.nextSibling;if(typeof el=='object'&&!el.nodeType){if(J=='after'&&!this.dom.nextSibling){rt=Roo.DomHelper.append(this.dom.parentNode,el,!K);}else{rt=Roo.DomHelper[J=='after'?'insertAfter':'insertBefore'](this.dom,el,!K);
450 }}else{rt=this.dom.parentNode.insertBefore(Roo.getDom(el),J=='before'?this.dom:this.dom.nextSibling);if(!K){rt=Roo.get(rt);}}return rt;},wrap:function(J,K){if(!J){J={tag:"div"};}var L=Roo.DomHelper.insertBefore(this.dom,J,!K);L.dom?L.dom.appendChild(this.dom):L.appendChild(this.dom);
451 return L;},replace:function(el){el=Roo.get(el);this.insertBefore(el);el.remove();return this;},insertHtml:function(J,K,L){var el=Roo.DomHelper.insertHtml(J,this.dom,K);return L?Roo.get(el):el;},set:function(o,J){var el=this.dom;J=typeof J=='undefined'?(el.setAttribute?true:false):J;
452 for(var K in o){if(K=="style"||typeof o[K]=="function"){continue;}if(K=="cls"){el.className=o["cls"];}else{if(J){el.setAttribute(K,o[K]);}else{el[K]=o[K];}}}if(o.style){Roo.DomHelper.applyStyles(el,o.style);}return this;},addKeyListener:function(J,fn,K){var L;
453 if(typeof J!="object"||J instanceof Array){L={key:J,fn:fn,scope:K};}else{L={key:J.key,shift:J.shift,ctrl:J.ctrl,alt:J.alt,fn:fn,scope:K};}return new Roo.KeyMap(this,L);},addKeyMap:function(J){return new Roo.KeyMap(this,J);},isScrollable:function(){var J=this.dom;
454 return J.scrollHeight>J.clientHeight||J.scrollWidth>J.clientWidth;},scrollTo:function(J,K,L){var M=J.toLowerCase()=="left"?"scrollLeft":"scrollTop";if(!L||!A){this.dom[M]=K;}else{var to=M=="scrollLeft"?[K,this.dom.scrollTop]:[this.dom.scrollLeft,K];this.anim({scroll:{"to":to}
455 },this.preanim(arguments,2),'scroll');}return this;},scroll:function(J,K,L){if(!this.isScrollable()){return;}var el=this.dom;var l=el.scrollLeft,t=el.scrollTop;var w=el.scrollWidth,h=el.scrollHeight;var cw=el.clientWidth,ch=el.clientHeight;J=J.toLowerCase();
456 var M=false;var a=this.preanim(arguments,2);switch(J){case "l":case "left":if(w-l>cw){var v=Math.min(l+K,w-cw);this.scrollTo("left",v,a);M=true;}break;case "r":case "right":if(l>0){var v=Math.max(l-K,0);this.scrollTo("left",v,a);M=true;}break;case "t":case "top":case "up":if(t>0){var v=Math.max(t-K,0);
457 this.scrollTo("top",v,a);M=true;}break;case "b":case "bottom":case "down":if(h-t>ch){var v=Math.min(t+K,h-ch);this.scrollTo("top",v,a);M=true;}break;}return M;},translatePoints:function(x,y){if(typeof x=='object'||x instanceof Array){y=x[1];x=x[0];}var p=this.getStyle('position');
458 var o=this.getXY();var l=parseInt(this.getStyle('left'),10);var t=parseInt(this.getStyle('top'),10);if(isNaN(l)){l=(p=="relative")?0:this.dom.offsetLeft;}if(isNaN(t)){t=(p=="relative")?0:this.dom.offsetTop;}return {left:(x-o[0]+l),top:(y-o[1]+t)};},getScroll:function(){var d=this.dom,J=document;
459 if(d==J||d==J.body){var l=window.pageXOffset||J.documentElement.scrollLeft||J.body.scrollLeft||0;var t=window.pageYOffset||J.documentElement.scrollTop||J.body.scrollTop||0;return {left:l,top:t};}else{return {left:d.scrollLeft,top:d.scrollTop};}},getColor:function(J,K,L){var v=this.getStyle(J);
460 if(!v||v=="transparent"||v=="inherit"){return K;}var M=typeof L=="undefined"?"#":L;if(v.substr(0,4)=="rgb("){var N=v.slice(4,v.length-1).split(",");for(var i=0;i<3;i++){var h=parseInt(N[i]).toString(16);if(h<16){h="0"+h;}M+=h;}}else{if(v.substr(0,1)=="#"){if(v.length==4){for(var i=1;
461 i<4;i++){var c=v.charAt(i);M+=c+c;}}else if(v.length==7){M+=v.substr(1);}}}return (M.length>5?M.toLowerCase():K);},boxWrap:function(J){J=J||'x-box';var el=Roo.get(this.insertHtml('beforeBegin',String.format('<div class="{0}">'+El.boxMarkup+'</div>',J)));el.child('.'+J+'-mc').dom.appendChild(this.dom);
462 return el;},getAttributeNS:Roo.isIE?function(ns,J){var d=this.dom;var K=typeof d[ns+":"+J];if(K!='undefined'&&K!='unknown'){return d[ns+":"+J];}return d[J];}:function(ns,J){var d=this.dom;return d.getAttributeNS(ns,J)||d.getAttribute(ns+":"+J)||d.getAttribute(J)||d[J];
463 },attr:function(J){if(arguments.length>1){this.dom.setAttribute(J,arguments[1]);return arguments[1];}if(typeof(J)=='object'){for(var i in J){this.attr(i,J[i]);}return J;}if(!this.dom.hasAttribute(J)){return undefined;}return this.dom.getAttribute(J);}};var ep=El.prototype;
464 ep.on=ep.addListener;ep.mon=ep.addListener;ep.un=ep.removeListener;ep.autoBoxAdjust=true;El.unitPattern=/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;El.addUnits=function(v,J){if(v===""||v=="auto"){return v;}if(v===undefined){return '';}if(typeof v=="number"||!El.unitPattern.test(v)){return v+(J||'px');
465 }return v;};El.boxMarkup='<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';
466 El.VISIBILITY=1;El.DISPLAY=2;El.borders={l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"};El.paddings={l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"};El.margins={l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"}
467 ;El.cache={};var H;El.get=function(el){var ex,J,id;if(!el){return null;}if(typeof el=="string"){if(!(J=document.getElementById(el))){return null;}if(ex=El.cache[el]){ex.dom=J;}else{ex=El.cache[el]=new El(J);}return ex;}else if(el.tagName){if(!(id=el.id)){id=Roo.id(el);
468 }if(ex=El.cache[id]){ex.dom=el;}else{ex=El.cache[id]=new El(el);}return ex;}else if(el instanceof El){if(el!=H){el.dom=document.getElementById(el.id)||el.dom;El.cache[el.id]=el;}return el;}else if(el.isComposite){return el;}else if(el instanceof Array){return El.select(el);
469 }else if(el==document){if(!H){var f=function(){};f.prototype=El.prototype;H=new f();H.dom=document;}return H;}return null;};El.uncache=function(el){for(var i=0,a=arguments,J=a.length;i<J;i++){if(a[i]){delete El.cache[a[i].id||a[i]];}}};El.garbageCollect=function(){if(!Roo.enableGarbageCollector){clearInterval(El.collectorThread);
470 return;}for(var J in El.cache){var el=El.cache[J],d=el.dom;if(!d||!d.parentNode||(!d.offsetParent&&!document.getElementById(J))){delete El.cache[J];if(d&&Roo.enableListenerCollection){E.purgeElement(d);}}}};El.collectorThreadId=setInterval(El.garbageCollect,30000);
471 El.Flyweight=function(J){this.dom=J;};El.Flyweight.prototype=El.prototype;El._flyweights={};El.fly=function(el,J){J=J||'_global';el=Roo.getDom(el);if(!el){return null;}if(!El._flyweights[J]){El._flyweights[J]=new El.Flyweight();}El._flyweights[J].dom=el;return El._flyweights[J];
472 };Roo.get=El.get;Roo.fly=El.fly;var I=Roo.isStrict?{select:1}:{input:1,select:1,textarea:1};if(Roo.isIE||Roo.isGecko){I['button']=1;}Roo.EventManager.on(window,'unload',function(){delete El.cache;delete El._flyweights;});})();if(Roo.DomQuery){Roo.Element.selectorFunction=Roo.DomQuery.select;
473 }Roo.Element.select=function(A,B,C){var D;if(typeof A=="string"){D=Roo.Element.selectorFunction(A,C);}else if(A.length!==undefined){D=A;}else{throw "Invalid selector";}if(B===true){return new Roo.CompositeElement(D);}else{return new Roo.CompositeElementLite(D);
474 }};Roo.select=Roo.Element.select;
475 // Roo/Fx.js
476 Roo.enableFx=true;Roo.Fx={slideIn:function(A,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){A=A||"t";this.fixDisplay();var r=this.getFxRestore();var b=this.getBox();this.setSize(b);var B=this.fxWrap(r.pos,o,"hidden");var st=this.dom.style;st.visibility="visible";
477 st.position="absolute";var C=function(){el.fxUnwrap(B,r.pos,o);st.width=r.width;st.height=r.height;el.afterFx(o);};var a,pt={to:[b.x,b.y]},bw={to:b.width},bh={to:b.height};switch(A.toLowerCase()){case "t":B.setSize(b.width,0);st.left=st.bottom="0";a={height:bh}
478 ;break;case "l":B.setSize(0,b.height);st.right=st.top="0";a={width:bw};break;case "r":B.setSize(0,b.height);B.setX(b.right);st.left=st.top="0";a={width:bw,points:pt};break;case "b":B.setSize(b.width,0);B.setY(b.bottom);st.left=st.top="0";a={height:bh,points:pt}
479 ;break;case "tl":B.setSize(0,0);st.right=st.bottom="0";a={width:bw,height:bh};break;case "bl":B.setSize(0,0);B.setY(b.y+b.height);st.right=st.top="0";a={width:bw,height:bh,points:pt};break;case "br":B.setSize(0,0);B.setXY([b.right,b.bottom]);st.left=st.top="0";
480 a={width:bw,height:bh,points:pt};break;case "tr":B.setSize(0,0);B.setX(b.x+b.width);st.left=st.bottom="0";a={width:bw,height:bh,points:pt};break;}this.dom.style.visibility="visible";B.show();arguments.callee.anim=B.fxanim(a,o,'motion',.5,'easeOut',C);});return this;
481 },slideOut:function(A,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){A=A||"t";var r=this.getFxRestore();var b=this.getBox();this.setSize(b);var B=this.fxWrap(r.pos,o,"visible");var st=this.dom.style;st.visibility="visible";st.position="absolute";
482 B.setSize(b);var C=function(){if(o.useDisplay){el.setDisplayed(false);}else{el.hide();}el.fxUnwrap(B,r.pos,o);st.width=r.width;st.height=r.height;el.afterFx(o);};var a,D={to:0};switch(A.toLowerCase()){case "t":st.left=st.bottom="0";a={height:D};break;case "l":st.right=st.top="0";
483 a={width:D};break;case "r":st.left=st.top="0";a={width:D,points:{to:[b.right,b.y]}};break;case "b":st.left=st.top="0";a={height:D,points:{to:[b.x,b.bottom]}};break;case "tl":st.right=st.bottom="0";a={width:D,height:D};break;case "bl":st.right=st.top="0";a={width:D,height:D,points:{to:[b.x,b.bottom]}
484 };break;case "br":st.left=st.top="0";a={width:D,height:D,points:{to:[b.x+b.width,b.bottom]}};break;case "tr":st.left=st.bottom="0";a={width:D,height:D,points:{to:[b.right,b.y]}};break;}arguments.callee.anim=B.fxanim(a,o,'motion',.5,"easeOut",C);});return this;
485 },puff:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){this.clearOpacity();this.show();var r=this.getFxRestore();var st=this.dom.style;var A=function(){if(o.useDisplay){el.setDisplayed(false);}else{el.hide();}el.clearOpacity();el.setPositioning(r.pos);
486 st.width=r.width;st.height=r.height;st.fontSize='';el.afterFx(o);};var B=this.getWidth();var C=this.getHeight();arguments.callee.anim=this.fxanim({width:{to:this.adjustWidth(B*2)},height:{to:this.adjustHeight(C*2)},points:{by:[-(B*.5),-(C*.5)]},opacity:{to:0}
487 ,fontSize:{to:200,unit:"%"}},o,'motion',.5,"easeOut",A);});return this;},switchOff:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){this.clearOpacity();this.clip();var r=this.getFxRestore();var st=this.dom.style;var A=function(){if(o.useDisplay){el.setDisplayed(false);
488 }else{el.hide();}el.clearOpacity();el.setPositioning(r.pos);st.width=r.width;st.height=r.height;el.afterFx(o);};this.fxanim({opacity:{to:0.3}},null,null,.1,null,function(){this.clearOpacity();(function(){this.fxanim({height:{to:1},points:{by:[0,this.getHeight()*.5]}
489 },o,'motion',0.3,'easeIn',A);}).defer(100,this);});});return this;},highlight:function(A,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){A=A||"ffff9c";attr=o.attr||"backgroundColor";this.clearOpacity();this.show();var B=this.getColor(attr);var C=this.dom.style[attr];
490 endColor=(o.endColor||B)||"ffffff";var D=function(){el.dom.style[attr]=C;el.afterFx(o);};var a={};a[attr]={from:A,to:endColor};arguments.callee.anim=this.fxanim(a,o,'color',1,'easeIn',D);});return this;},frame:function(A,B,o){var el=this.getFxEl();o=o||{}
491 ;el.queueFx(o,function(){A=A||"#C3DAF9";if(A.length==6){A="#"+A;}B=B||1;duration=o.duration||1;this.show();var b=this.getBox();var C=function(){var D=this.createProxy({style:{visbility:"hidden",position:"absolute","z-index":"35000",border:"0px solid "+A}}
492 );var E=Roo.isBorderBox?2:1;D.animate({top:{from:b.y,to:b.y-20},left:{from:b.x,to:b.x-20},borderWidth:{from:0,to:10},opacity:{from:1,to:0},height:{from:b.height,to:(b.height+(20*E))},width:{from:b.width,to:(b.width+(20*E))}},duration,function(){D.remove();
493 });if(--B>0){C.defer((duration/2)*1000,this);}else{el.afterFx(o);}};C.call(this);});return this;},pause:function(A){var el=this.getFxEl();var o={};el.queueFx(o,function(){setTimeout(function(){el.afterFx(o);},A*1000);});return this;},fadeIn:function(o){var el=this.getFxEl();
494 o=o||{};el.queueFx(o,function(){this.setOpacity(0);this.fixDisplay();this.dom.style.visibility='visible';var to=o.endOpacity||1;arguments.callee.anim=this.fxanim({opacity:{to:to}},o,null,.5,"easeOut",function(){if(to==1){this.clearOpacity();}el.afterFx(o);
495 });});return this;},fadeOut:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){arguments.callee.anim=this.fxanim({opacity:{to:o.endOpacity||0}},o,null,.5,"easeOut",function(){if(this.visibilityMode==Roo.Element.DISPLAY||o.useDisplay){this.dom.style.display="none";
496 }else{this.dom.style.visibility="hidden";}this.clearOpacity();el.afterFx(o);});});return this;},scale:function(w,h,o){this.shift(Roo.apply({},o,{width:w,height:h}));return this;},shift:function(o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){var a={}
497 ,w=o.width,h=o.height,x=o.x,y=o.y,op=o.opacity;if(w!==undefined){a.width={to:this.adjustWidth(w)};}if(h!==undefined){a.height={to:this.adjustHeight(h)};}if(x!==undefined||y!==undefined){a.points={to:[x!==undefined?x:this.getX(),y!==undefined?y:this.getY()]}
498 ;}if(op!==undefined){a.opacity={to:op};}if(o.xy!==undefined){a.points={to:o.xy};}arguments.callee.anim=this.fxanim(a,o,'motion',.35,"easeOut",function(){el.afterFx(o);});});return this;},ghost:function(A,o){var el=this.getFxEl();o=o||{};el.queueFx(o,function(){A=A||"b";
499 var r=this.getFxRestore();var w=this.getWidth(),h=this.getHeight();var st=this.dom.style;var B=function(){if(o.useDisplay){el.setDisplayed(false);}else{el.hide();}el.clearOpacity();el.setPositioning(r.pos);st.width=r.width;st.height=r.height;el.afterFx(o);
500 };var a={opacity:{to:0},points:{}},pt=a.points;switch(A.toLowerCase()){case "t":pt.by=[0,-h];break;case "l":pt.by=[-w,0];break;case "r":pt.by=[w,0];break;case "b":pt.by=[0,h];break;case "tl":pt.by=[-w,-h];break;case "bl":pt.by=[-w,h];break;case "br":pt.by=[w,h];
501 break;case "tr":pt.by=[w,-h];break;}arguments.callee.anim=this.fxanim(a,o,'motion',.5,"easeOut",B);});return this;},syncFx:function(){this.fxDefaults=Roo.apply(this.fxDefaults||{},{block:false,concurrent:true,stopFx:false});return this;},sequenceFx:function(){this.fxDefaults=Roo.apply(this.fxDefaults||{}
502 ,{block:false,concurrent:false,stopFx:false});return this;},nextFx:function(){var ef=this.fxQueue[0];if(ef){ef.call(this);}},hasActiveFx:function(){return this.fxQueue&&this.fxQueue[0];},stopFx:function(){if(this.hasActiveFx()){var A=this.fxQueue[0];if(A&&A.anim&&A.anim.isAnimated()){this.fxQueue=[A];
503 A.anim.stop(true);}}return this;},beforeFx:function(o){if(this.hasActiveFx()&&!o.concurrent){if(o.stopFx){this.stopFx();return true;}return false;}return true;},hasFxBlock:function(){var q=this.fxQueue;return q&&q[0]&&q[0].block;},queueFx:function(o,fn){if(!this.fxQueue){this.fxQueue=[];
504 }if(!this.hasFxBlock()){Roo.applyIf(o,this.fxDefaults);if(!o.concurrent){var A=this.beforeFx(o);fn.block=o.block;this.fxQueue.push(fn);if(A){this.nextFx();}}else{fn.call(this);}}return this;},fxWrap:function(A,o,B){var C;if(!o.wrap||!(C=Roo.get(o.wrap))){var D;
505 if(o.fixPosition){D=this.getXY();}var E=document.createElement("div");E.style.visibility=B;C=Roo.get(this.dom.parentNode.insertBefore(E,this.dom));C.setPositioning(A);if(C.getStyle("position")=="static"){C.position("relative");}this.clearPositioning('auto');
506 C.clip();C.dom.appendChild(this.dom);if(D){C.setXY(D);}}return C;},fxUnwrap:function(A,B,o){this.clearPositioning();this.setPositioning(B);if(!o.wrap){A.dom.parentNode.insertBefore(this.dom,A.dom);A.remove();}},getFxRestore:function(){var st=this.dom.style;
507 return {pos:this.getPositioning(),width:st.width,height:st.height};},afterFx:function(o){if(o.afterStyle){this.applyStyles(o.afterStyle);}if(o.afterCls){this.addClass(o.afterCls);}if(o.remove===true){this.remove();}Roo.callback(o.callback,o.scope,[this]);
508 if(!o.concurrent){this.fxQueue.shift();this.nextFx();}},getFxEl:function(){return Roo.get(this.dom);},fxanim:function(A,B,C,D,E,cb){C=C||'run';B=B||{};var F=Roo.lib.Anim[C](this.dom,A,(B.duration||D)||.35,(B.easing||E)||'easeOut',function(){Roo.callback(cb,this);
509 },this);B.anim=F;return F;}};Roo.Fx.resize=Roo.Fx.scale;Roo.apply(Roo.Element.prototype,Roo.Fx);
510 // Roo/CompositeElement.js
511 Roo.CompositeElement=function(A){this.elements=[];this.addElements(A);};Roo.CompositeElement.prototype={isComposite:true,addElements:function(A){if(!A){return this;}if(typeof A=="string"){A=Roo.Element.selectorFunction(A);}var B=this.elements;var C=B.length-1;
512 for(var i=0,D=A.length;i<D;i++){B[++C]=Roo.get(A[i]);}return this;},fill:function(A){this.elements=[];this.add(A);return this;},filter:function(A,B){var C=[];B=B||false;this.each(function(el){var D=B?!el.is(A):el.is(A);if(D){C[C.length]=el.dom;}});this.fill(C);
513 return this;},invoke:function(fn,A){var B=this.elements;for(var i=0,C=B.length;i<C;i++){Roo.Element.prototype[fn].apply(B[i],A);}return this;},add:function(A){if(typeof A=="string"){this.addElements(Roo.Element.selectorFunction(A));}else if(A.length!==undefined){this.addElements(A);
514 }else{this.addElements([A]);}return this;},each:function(fn,A){var B=this.elements;for(var i=0,C=B.length;i<C;i++){if(fn.call(A||B[i],B[i],this,i)===false){break;}}return this;},item:function(A){return this.elements[A]||null;},first:function(){return this.item(0);
515 },last:function(){return this.item(this.elements.length-1);},getCount:function(){return this.elements.length;},contains:function(el){return this.indexOf(el)!==-1;},indexOf:function(el){return this.elements.indexOf(Roo.get(el));},removeElement:function(el,A){if(el instanceof Array){for(var i=0,B=el.length;
516 i<B;i++){this.removeElement(el[i]);}return this;}var C=typeof el=='number'?el:this.indexOf(el);if(C!==-1){if(A){var d=this.elements[C];if(d.dom){d.remove();}else{d.parentNode.removeChild(d);}}this.elements.splice(C,1);}return this;},replaceElement:function(el,A,B){var C=typeof el=='number'?el:this.indexOf(el);
517 if(C!==-1){if(B){this.elements[C].replaceWith(A);}else{this.elements.splice(C,1,Roo.get(A))}}return this;},clear:function(){this.elements=[];}};(function(){Roo.CompositeElement.createCall=function(B,C){if(!B[C]){B[C]=function(){return this.invoke(C,arguments);
518 };}};for(var A in Roo.Element.prototype){if(typeof Roo.Element.prototype[A]=="function"){Roo.CompositeElement.createCall(Roo.CompositeElement.prototype,A);}};})();
519 // Roo/CompositeElementLite.js
520 Roo.CompositeElementLite=function(A){Roo.CompositeElementLite.superclass.constructor.call(this,A);this.el=new Roo.Element.Flyweight();};Roo.extend(Roo.CompositeElementLite,Roo.CompositeElement,{addElements:function(A){if(A){if(A instanceof Array){this.elements=this.elements.concat(A);
521 }else{var B=this.elements;var C=B.length-1;for(var i=0,D=A.length;i<D;i++){B[++C]=A[i];}}}return this;},invoke:function(fn,A){var B=this.elements;var el=this.el;for(var i=0,C=B.length;i<C;i++){el.dom=B[i];Roo.Element.prototype[fn].apply(el,A);}return this;
522 },item:function(A){if(!this.elements[A]){return null;}this.el.dom=this.elements[A];return this.el;},addListener:function(A,B,C,D){var E=this.elements;for(var i=0,F=E.length;i<F;i++){Roo.EventManager.on(E[i],A,B,C||E[i],D);}return this;},each:function(fn,A){var B=this.elements;
523 var el=this.el;for(var i=0,C=B.length;i<C;i++){el.dom=B[i];if(fn.call(A||el,el,this,i)===false){break;}}return this;},indexOf:function(el){return this.elements.indexOf(Roo.getDom(el));},replaceElement:function(el,A,B){var C=typeof el=='number'?el:this.indexOf(el);
524 if(C!==-1){A=Roo.getDom(A);if(B){var d=this.elements[C];d.parentNode.insertBefore(A,d);d.parentNode.removeChild(d);}this.elements.splice(C,1,A);}return this;}});Roo.CompositeElementLite.prototype.on=Roo.CompositeElementLite.prototype.addListener;
525 // Roo/data/Connection.js
526 Roo.data.Connection=function(A){Roo.apply(this,A);this.addEvents({"beforerequest":true,"requestcomplete":true,"requestexception":true});Roo.data.Connection.superclass.constructor.call(this);};Roo.extend(Roo.data.Connection,Roo.util.Observable,{timeout:30000,autoAbort:false,disableCaching:true,request:function(o){if(this.fireEvent("beforerequest",this,o)!==false){var p=o.params;
527 if(typeof p=="function"){p=p.call(o.scope||window,o);}if(typeof p=="object"){p=Roo.urlEncode(o.params);}if(this.extraParams){var A=Roo.urlEncode(this.extraParams);p=p?(p+'&'+A):A;}var B=o.url||this.url;if(typeof B=='function'){B=B.call(o.scope||window,o);
528 }if(o.form){var C=Roo.getDom(o.form);B=B||C.action;var D=C.getAttribute("enctype");if(o.formData){return this.doFormDataUpload(o,B);}if(o.isUpload||(D&&D.toLowerCase()=='multipart/form-data')){return this.doFormUpload(o,p,B);}var f=Roo.lib.Ajax.serializeForm(C);
529 p=p?(p+'&'+f):f;}if(!o.form&&o.formData){o.formData=o.formData===true?new FormData():o.formData;for(var k in o.params){o.formData.append(k,o.params[k]);}return this.doFormDataUpload(o,B);}var hs=o.headers;if(this.defaultHeaders){hs=Roo.apply(hs||{},this.defaultHeaders);
530 if(!o.headers){o.headers=hs;}}var cb={success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{options:o},timeout:o.timeout||this.timeout};var E=o.method||this.method||(p?"POST":"GET");if(E=='GET'&&(this.disableCaching&&o.disableCaching!==false)||o.disableCaching===true){B+=(B.indexOf('?')!=-1?'&':'?')+'_dc='+(new Date().getTime());
531 }if(typeof o.autoAbort=='boolean'){if(o.autoAbort){this.abort();}}else if(this.autoAbort!==false){this.abort();}if((E=='GET'&&p)||o.xmlData){B+=(B.indexOf('?')!=-1?'&':'?')+p;p='';}Roo.lib.Ajax.useDefaultHeader=typeof(o.headers)=='undefined'||typeof(o.headers['Content-Type'])=='undefined';
532 this.transId=Roo.lib.Ajax.request(E,B,cb,p,o);Roo.lib.Ajax.useDefaultHeader==true;return this.transId;}else{Roo.callback(o.callback,o.scope,[o,null,null]);return null;}},isLoading:function(A){if(A){return Roo.lib.Ajax.isCallInProgress(A);}else{return this.transId?true:false;
533 }},abort:function(A){if(A||this.isLoading()){Roo.lib.Ajax.abort(A||this.transId);}},handleResponse:function(A){this.transId=false;var B=A.argument.options;A.argument=B?B.argument:null;this.fireEvent("requestcomplete",this,A,B);Roo.callback(B.success,B.scope,[A,B]);
534 Roo.callback(B.callback,B.scope,[B,true,A]);},handleFailure:function(A,e){this.transId=false;var B=A.argument.options;A.argument=B?B.argument:null;this.fireEvent("requestexception",this,A,B,e);Roo.callback(B.failure,B.scope,[A,B]);Roo.callback(B.callback,B.scope,[B,false,A]);
535 },doFormUpload:function(o,ps,A){var id=Roo.id();var B=document.createElement('iframe');B.id=id;B.name=id;B.className='x-hidden';if(Roo.isIE){B.src=Roo.SSL_SECURE_URL;}document.body.appendChild(B);if(Roo.isIE){document.frames[id].name=id;}var C=Roo.getDom(o.form);
536 C.target=id;C.method='POST';C.enctype=C.encoding='multipart/form-data';if(A){C.action=A;}var D,hd;if(ps){D=[];ps=Roo.urlDecode(ps,false);for(var k in ps){if(ps.hasOwnProperty(k)){hd=document.createElement('input');hd.type='hidden';hd.name=k;hd.value=ps[k];
537 C.appendChild(hd);D.push(hd);}}}function cb(){var r={responseText:'',responseXML:null};r.argument=o?o.argument:null;try{var F;if(Roo.isIE){F=B.contentWindow.document;}else{F=(B.contentDocument||window.frames[id].document);}if(F&&F.body){r.responseText=F.body.innerHTML;
538 }if(F&&F.XMLDocument){r.responseXML=F.XMLDocument;}else{r.responseXML=F;}}catch(e){}Roo.EventManager.removeListener(B,'load',cb,this);this.fireEvent("requestcomplete",this,r,o);Roo.callback(o.success,o.scope,[r,o]);Roo.callback(o.callback,o.scope,[o,true,r]);
539 setTimeout(function(){document.body.removeChild(B);},100);}Roo.EventManager.on(B,'load',cb,this);C.submit();if(D){for(var i=0,E=D.length;i<E;i++){C.removeChild(D[i]);}}},doFormDataUpload:function(o,A){var B;if(o.form){var C=Roo.getDom(o.form);C.enctype=C.encoding='multipart/form-data';
540 B=o.formData===true?new FormData(C):o.formData;}else{B=o.formData===true?new FormData():o.formData;}var cb={success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{options:o},timeout:o.timeout||this.timeout};if(typeof o.autoAbort=='boolean'){if(o.autoAbort){this.abort();
541 }}else if(this.autoAbort!==false){this.abort();}Roo.lib.Ajax.useDefaultHeader=false;this.transId=Roo.lib.Ajax.request("POST",A,cb,B,o);Roo.lib.Ajax.useDefaultHeader=true;}});
542 // Roo/Ajax.js
543 Roo.Ajax=new Roo.data.Connection({autoAbort:false,serializeForm:function(A){return Roo.lib.Ajax.serializeForm(A);}});
544 // Roo/UpdateManager.js
545 Roo.UpdateManager=function(el,A){el=Roo.get(el);if(!A&&el.updateManager){return el.updateManager;}this.el=el;this.defaultUrl=null;this.addEvents({"beforeupdate":true,"update":true,"failure":true});var d=Roo.UpdateManager.defaults;this.sslBlankUrl=d.sslBlankUrl;
546 this.disableCaching=d.disableCaching;this.indicatorText=d.indicatorText;this.showLoadIndicator=d.showLoadIndicator;this.timeout=d.timeout;this.loadScripts=d.loadScripts;this.transaction=null;this.autoRefreshProcId=null;this.refreshDelegate=this.refresh.createDelegate(this);
547 this.updateDelegate=this.update.createDelegate(this);this.formUpdateDelegate=this.formUpdate.createDelegate(this);this.successDelegate=this.processSuccess.createDelegate(this);this.failureDelegate=this.processFailure.createDelegate(this);if(!this.renderer){this.renderer=new Roo.UpdateManager.BasicRenderer();
548 }Roo.UpdateManager.superclass.constructor.call(this);};Roo.extend(Roo.UpdateManager,Roo.util.Observable,{getEl:function(){return this.el;},update:function(A,B,C,D){if(this.fireEvent("beforeupdate",this.el,A,B)!==false){var E=this.method,F;if(typeof A=="object"){F=A;
549 A=F.url;B=B||F.params;C=C||F.callback;D=D||F.discardUrl;if(C&&F.scope){C=C.createDelegate(F.scope);}if(typeof F.method!="undefined"){E=F.method;};if(typeof F.nocache!="undefined"){this.disableCaching=F.nocache;};if(typeof F.text!="undefined"){this.indicatorText='<div class="loading-indicator">'+F.text+"</div>";
550 };if(typeof F.scripts!="undefined"){this.loadScripts=F.scripts;};if(typeof F.timeout!="undefined"){this.timeout=F.timeout;};}this.showLoading();if(!D){this.defaultUrl=A;}if(typeof A=="function"){A=A.call(this);}E=E||(B?"POST":"GET");if(E=="GET"){A=this.prepareUrl(A);
551 }var o=Roo.apply(F||{},{url:A,params:B,success:this.successDelegate,failure:this.failureDelegate,callback:undefined,timeout:(this.timeout*1000),argument:{"url":A,"form":null,"callback":C,"params":B}});Roo.log("updated manager called with timeout of "+o.timeout);
552 this.transaction=Roo.Ajax.request(o);}},formUpdate:function(A,B,C,D){if(this.fireEvent("beforeupdate",this.el,A,B)!==false){if(typeof B=="function"){B=B.call(this);}A=Roo.getDom(A);this.transaction=Roo.Ajax.request({form:A,url:B,success:this.successDelegate,failure:this.failureDelegate,timeout:(this.timeout*1000),argument:{"url":B,"form":A,"callback":D,"reset":C}
553 });this.showLoading.defer(1,this);}},refresh:function(A){if(this.defaultUrl==null){return;}this.update(this.defaultUrl,null,A,true);},startAutoRefresh:function(A,B,C,D,E){if(E){this.update(B||this.defaultUrl,C,D,true);}if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);
554 }this.autoRefreshProcId=setInterval(this.update.createDelegate(this,[B||this.defaultUrl,C,D,true]),A*1000);},stopAutoRefresh:function(){if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);delete this.autoRefreshProcId;}},isAutoRefreshing:function(){return this.autoRefreshProcId?true:false;
555 },showLoading:function(){if(this.showLoadIndicator){this.el.update(this.indicatorText);}},prepareUrl:function(A){if(this.disableCaching){var B="_dc="+(new Date().getTime());if(A.indexOf("?")!==-1){A+="&"+B;}else{A+="?"+B;}}return A;},processSuccess:function(A){this.transaction=null;
556 if(A.argument.form&&A.argument.reset){try{A.argument.form.reset();}catch(e){}}if(this.loadScripts){this.renderer.render(this.el,A,this,this.updateComplete.createDelegate(this,[A]));}else{this.renderer.render(this.el,A,this);this.updateComplete(A);}},updateComplete:function(A){this.fireEvent("update",this.el,A);
557 if(typeof A.argument.callback=="function"){A.argument.callback(this.el,true,A);}},processFailure:function(A){this.transaction=null;this.fireEvent("failure",this.el,A);if(typeof A.argument.callback=="function"){A.argument.callback(this.el,false,A);}},setRenderer:function(A){this.renderer=A;
558 },getRenderer:function(){return this.renderer;},setDefaultUrl:function(A){this.defaultUrl=A;},abort:function(){if(this.transaction){Roo.Ajax.abort(this.transaction);}},isUpdating:function(){if(this.transaction){return Roo.Ajax.isLoading(this.transaction);
559 }return false;}});Roo.UpdateManager.defaults={timeout:30,loadScripts:false,sslBlankUrl:(Roo.SSL_SECURE_URL||"javascript:false"),disableCaching:false,showLoadIndicator:true,indicatorText:'<div class="loading-indicator">Loading...</div>'};Roo.UpdateManager.updateElement=function(el,A,B,C){var um=Roo.get(el,true).getUpdateManager();
560 Roo.apply(um,C);um.update(A,B,C?C.callback:null);};Roo.UpdateManager.update=Roo.UpdateManager.updateElement;Roo.UpdateManager.BasicRenderer=function(){};Roo.UpdateManager.BasicRenderer.prototype={render:function(el,A,B,C){el.update(A.responseText,B.loadScripts,C);
561 }};
562 // Roo/DomTemplate.js
563 Roo.DomTemplate=function(){Roo.DomTemplate.superclass.constructor.apply(this,arguments);if(this.html){this.compile();}};Roo.extend(Roo.DomTemplate,Roo.Template,{id:0,inPre:false,tpls:false,re:/(\{|\%7B)([\w-\.]+)(?:\:([\w\.]*)(?:\(([^)]*?)?\))?)?(\}|\%7D)/g,iterChild:function(A,B){var C=this.inPre;
564 if(A.tagName=='PRE'){this.inPre=true;}for(var i=0;i<A.childNodes.length;i++){B.call(this,A.childNodes[i]);}this.inPre=C;},compile:function(){var s=this.html;var A=false;var B=false;try{A=document.implementation.createHTMLDocument("");A.documentElement.innerHTML=this.html;
565 B=A.documentElement;}catch(e){B=document.createElement('div');B.innerHTML=this.html;}this.tpls=[];var _t=this;this.iterChild(B,function(n){_t.compileNode(n,true);});var C=this.tpls;var D={uid:'master',id:this.id++,attr:false,value:false,body:B.innerHTML,forCall:false,execCall:false,dom:B,isTop:true}
566 ;C.unshift(D);this.tpls=[];Roo.each(C,function(tp){this.compileTpl(tp);this.tpls[tp.id]=tp;},this);this.master=C[0];return this;},compileNode:function(A,B){if(A.nodeType!=1){if(A.nodeType==3&&!this.inPre){A.nodeValue=A.nodeValue.replace(/\s+/g,' ');}return;
567 }var C={uid:false,id:false,attr:false,value:false,body:'',forCall:false,execCall:false,dom:false,isTop:B};switch(true){case (A.hasAttribute('roo-for')):C.attr='for';break;case (A.hasAttribute('roo-if')):C.attr='if';break;case (A.hasAttribute('roo-name')):C.attr='name';
568 break;case (A.hasAttribute('roo-exec')):C.attr='exec';break;}if(!C.attr){this.iterChild(A,this.compileNode);return;}C.uid=this.id++;C.value=A.getAttribute('roo-'+C.attr);A.removeAttribute('roo-'+C.attr);if(C.attr!='name'){var D=document.createTextNode('{domtpl'+C.uid+'}');
569 A.parentNode.replaceChild(D,A);}else{var D=document.createElement('span');D.className='roo-tpl-'+C.value;A.parentNode.replaceChild(D,A);}this.iterChild(A,this.compileNode);var E=document.createElement('div');E.appendChild(A);C.dom=A;C.body=E.innerHTML;C.id=C.uid;
570 switch(C.attr){case 'for':switch(C.value){case '.':C.forCall=new Function('values','parent','with(values){ return values; }');break;case '..':C.forCall=new Function('values','parent','with(values){ return parent; }');break;default:C.forCall=new Function('values','parent','with(values){ return '+C.value+'; }');
571 }break;case 'exec':C.execCall=new Function('values','parent','with(values){ '+(Roo.util.Format.htmlDecode(C.value))+'; }');break;case 'if':C.ifCall=new Function('values','parent','with(values){ return '+(Roo.util.Format.htmlDecode(C.value))+'; }');break;case 'name':C.id=C.value;
572 break;}this.tpls.push(C);},compileTpl:function(tpl){var fm=Roo.util.Format;var useF=this.disableFormats!==true;var A=Roo.isGecko?"+\n":",\n";var undef=function(C){Roo.debug&&Roo.log("Property not found :"+C);return '';};var fn=function(m,C,D,E,F){F=F?F.replace(/\\'/g,"'"):F;
573 if(typeof(E)=='undefined'){E='htmlEncode';}if(E=='raw'){E=false;}if(D.substr(0,6)=='domtpl'){return "'"+A+'this.applySubTemplate('+D.substr(6)+', values, parent)'+A+"'";}var G=[];var H='';Roo.each(D.split('.'),function(st){H+=(H.length?'.':'')+st;G.push("(typeof("+H+") == 'undefined')");
574 });var I='(('+G.join(" || ")+") ? undef('"+D+"') : ";if(E&&useF){F=F?','+F:"";if(E.substr(0,5)!="this."){E="fm."+E+'(';}else{E='this.call("'+E.substr(5)+'", ';F=", values";}return "'"+A+I+E+D+F+"))"+A+"'";}if(F&&F.length){return "'"+A+I+D+'('+F+"))"+A+"'";
575 }return "'"+A+I+D+")"+A+"'";};var B;if(Roo.isGecko){B="tpl.compiled = function(values, parent){  with(values) { return '"+tpl.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};};";}else{B=["tpl.compiled = function(values, parent){  with (values) { return ['"];
576 B.push(tpl.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));B.push("'].join('');};};");B=B.join('');}Roo.debug&&Roo.log(B.replace(/\\n/,'\n'));eval(B);return this;},applySubTemplate:function(id,A,B){var t=this.tpls[id];try{if(t.ifCall&&!t.ifCall.call(this,A,B)){Roo.debug&&Roo.log('if call on '+t.value+' return false');
577 return '';}}catch(e){Roo.log('Xtemplate.applySubTemplate('+id+'): Exception thrown on roo-if="'+t.value+'" - '+e.toString());Roo.log(A);return '';}try{if(t.execCall&&t.execCall.call(this,A,B)){return '';}}catch(e){Roo.log('Xtemplate.applySubTemplate('+id+'): Exception thrown on roo-for="'+t.value+'" - '+e.toString());
578 Roo.log(A);return '';}try{var vs=t.forCall?t.forCall.call(this,A,B):A;B=t.target?A:B;if(t.forCall&&vs instanceof Array){var C=[];for(var i=0,D=vs.length;i<D;i++){try{C[C.length]=t.compiled.call(this,vs[i],B);}catch(e){Roo.log('Xtemplate.applySubTemplate('+id+'): Exception thrown on body="'+t.value+'" - '+e.toString());
579 Roo.log(e.body);Roo.log(vs[i]);}}return C.join('');}}catch(e){Roo.log('Xtemplate.applySubTemplate('+id+'): Exception thrown on roo-for="'+t.value+'" - '+e.toString());Roo.log(A);return '';}try{return t.compiled.call(this,vs,B);}catch(e){Roo.log('Xtemplate.applySubTemplate('+id+'): Exception thrown on body="'+t.value+'" - '+e.toString());
580 Roo.log(e.body);Roo.log(A);return '';}},applyTemplate:function(A){return this.master.compiled.call(this,A,{});},apply:function(){return this.applyTemplate.apply(this,arguments);}});Roo.DomTemplate.from=function(el){el=Roo.getDom(el);return new Roo.Domtemplate(el.value||el.innerHTML);
581 };
582 // Roo/util/DelayedTask.js
583 Roo.util.DelayedTask=function(fn,A,B){var id=null,d,t;var C=function(){var D=new Date().getTime();if(D-t>=d){clearInterval(id);id=null;fn.apply(A,B||[]);}};this.delay=function(D,E,F,G){if(id&&D!=d){this.cancel();}d=D;t=new Date().getTime();fn=E||fn;A=F||A;
584 B=G||B;if(!id){id=setInterval(C,d);}};this.cancel=function(){if(id){clearInterval(id);id=null;}};};
585 // Roo/util/TaskRunner.js
586 Roo.util.TaskRunner=function(A){A=A||10;var B=[],C=[];var id=0;var D=false;var E=function(){D=false;clearInterval(id);id=0;};var F=function(){if(!D){D=true;id=setInterval(H,A);}};var G=function(I){C.push(I);if(I.onStop){I.onStop();}};var H=function(){if(C.length>0){for(var i=0,I=C.length;
587 i<I;i++){B.remove(C[i]);}C=[];if(B.length<1){E();return;}}var J=new Date().getTime();for(var i=0,I=B.length;i<I;++i){var t=B[i];var K=J-t.taskRunTime;if(t.interval<=K){var rt=t.run.apply(t.scope||t,t.args||[++t.taskRunCount]);t.taskRunTime=J;if(rt===false||t.taskRunCount===t.repeat){G(t);
588 return;}}if(t.duration&&t.duration<=(J-t.taskStartTime)){G(t);}}};this.start=function(I){B.push(I);I.taskStartTime=new Date().getTime();I.taskRunTime=0;I.taskRunCount=0;F();return I;};this.stop=function(I){G(I);return I;};this.stopAll=function(){E();for(var i=0,I=B.length;
589 i<I;i++){if(B[i].onStop){B[i].onStop();}}B=[];C=[];};};Roo.TaskMgr=new Roo.util.TaskRunner();
590 // Roo/util/MixedCollection.js
591 Roo.util.MixedCollection=function(A,B){this.items=[];this.map={};this.keys=[];this.length=0;this.addEvents({"clear":true,"add":true,"replace":true,"remove":true,"sort":true});this.allowFunctions=A===true;if(B){this.getKey=B;}Roo.util.MixedCollection.superclass.constructor.call(this);
592 };Roo.extend(Roo.util.MixedCollection,Roo.util.Observable,{allowFunctions:false,add:function(A,o){if(arguments.length==1){o=arguments[0];A=this.getKey(o);}if(typeof A=="undefined"||A===null){this.length++;this.items.push(o);this.keys.push(null);}else{var B=this.map[A];
593 if(B){return this.replace(A,o);}this.length++;this.items.push(o);this.map[A]=o;this.keys.push(A);}this.fireEvent("add",this.length-1,o,A);return o;},getKey:function(o){return o.id;},replace:function(A,o){if(arguments.length==1){o=arguments[0];A=this.getKey(o);
594 }var B=this.item(A);if(typeof A=="undefined"||A===null||typeof B=="undefined"){return this.add(A,o);}var C=this.indexOfKey(A);this.items[C]=o;this.map[A]=o;this.fireEvent("replace",A,B,o);return o;},addAll:function(A){if(arguments.length>1||A instanceof Array){var B=arguments.length>1?arguments:A;
595 for(var i=0,C=B.length;i<C;i++){this.add(B[i]);}}else{for(var D in A){if(this.allowFunctions||typeof A[D]!="function"){this.add(D,A[D]);}}}},each:function(fn,A){var B=[].concat(this.items);for(var i=0,C=B.length;i<C;i++){if(fn.call(A||B[i],B[i],i,C)===false){break;
596 }}},eachKey:function(fn,A){for(var i=0,B=this.keys.length;i<B;i++){fn.call(A||window,this.keys[i],this.items[i],i,B);}},find:function(fn,A){for(var i=0,B=this.items.length;i<B;i++){if(fn.call(A||window,this.items[i],this.keys[i])){return this.items[i];}}return null;
597 },insert:function(A,B,o){if(arguments.length==2){o=arguments[1];B=this.getKey(o);}if(A>=this.length){return this.add(B,o);}this.length++;this.items.splice(A,0,o);if(typeof B!="undefined"&&B!=null){this.map[B]=o;}this.keys.splice(A,0,B);this.fireEvent("add",A,o,B);
598 return o;},remove:function(o){return this.removeAt(this.indexOf(o));},removeAt:function(A){if(A<this.length&&A>=0){this.length--;var o=this.items[A];this.items.splice(A,1);var B=this.keys[A];if(typeof B!="undefined"){delete this.map[B];}this.keys.splice(A,1);
599 this.fireEvent("remove",o,B);}},removeKey:function(A){return this.removeAt(this.indexOfKey(A));},getCount:function(){return this.length;},indexOf:function(o){if(!this.items.indexOf){for(var i=0,A=this.items.length;i<A;i++){if(this.items[i]==o){return i;}}
600 return -1;}else{return this.items.indexOf(o);}},indexOfKey:function(A){if(!this.keys.indexOf){for(var i=0,B=this.keys.length;i<B;i++){if(this.keys[i]==A){return i;}}return -1;}else{return this.keys.indexOf(A);}},item:function(A){if(A==='length'){return null;
601 }var B=typeof this.map[A]!="undefined"?this.map[A]:this.items[A];return typeof B!='function'||this.allowFunctions?B:null;},itemAt:function(A){return this.items[A];},key:function(A){return this.map[A];},contains:function(o){return this.indexOf(o)!=-1;},containsKey:function(A){return typeof this.map[A]!="undefined";
602 },clear:function(){this.length=0;this.items=[];this.keys=[];this.map={};this.fireEvent("clear");},first:function(){return this.items[0];},last:function(){return this.items[this.length-1];},_sort:function(A,B,fn){var C=String(B).toUpperCase()=="DESC"?-1:1;
603 fn=fn||function(a,b){return a-b;};var c=[],k=this.keys,D=this.items;for(var i=0,E=D.length;i<E;i++){c[c.length]={key:k[i],value:D[i],index:i};}c.sort(function(a,b){var v=fn(a[A],b[A])*C;if(v==0){v=(a.index<b.index?-1:1);}return v;});for(var i=0,E=c.length;
604 i<E;i++){D[i]=c[i].value;k[i]=c[i].key;}this.fireEvent("sort",this);},sort:function(A,fn){this._sort("value",A,fn);},keySort:function(A,fn){this._sort("key",A,fn||function(a,b){return String(a).toUpperCase()-String(b).toUpperCase();});},getRange:function(A,B){var C=this.items;
605 if(C.length<1){return [];}A=A||0;B=Math.min(typeof B=="undefined"?this.length-1:B,this.length-1);var r=[];if(A<=B){for(var i=A;i<=B;i++){r[r.length]=C[i];}}else{for(var i=A;i>=B;i--){r[r.length]=C[i];}}return r;},filter:function(A,B){if(!B.exec){B=String(B);
606 if(B.length==0){return this.clone();}B=new RegExp("^"+Roo.escapeRe(B),"i");}return this.filterBy(function(o){return o&&B.test(o[A]);});},filterBy:function(fn,A){var r=new Roo.util.MixedCollection();r.getKey=this.getKey;var k=this.keys,it=this.items;for(var i=0,B=it.length;
607 i<B;i++){if(fn.call(A||this,it[i],k[i])){r.add(k[i],it[i]);}}return r;},clone:function(){var r=new Roo.util.MixedCollection();var k=this.keys,it=this.items;for(var i=0,A=it.length;i<A;i++){r.add(k[i],it[i]);}r.getKey=this.getKey;return r;}});Roo.util.MixedCollection.prototype.get=Roo.util.MixedCollection.prototype.item;
608
609 // Roo/util/JSON.js
610 Roo.util.JSON=new (function(){var A={}.hasOwnProperty?true:false;var B=function(n){return n<10?"0"+n:n;};var m={"\b":'\\b',"\t":'\\t',"\n":'\\n',"\f":'\\f',"\r":'\\r','"':'\\"',"\\":'\\\\'};var C=function(s){if(/["\\\x00-\x1f]/.test(s)){return '"'+s.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];
611 if(c){return c;}c=b.charCodeAt();return "\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}return '"'+s+'"';};var D=function(o){var a=["["],b,i,l=o.length,v;for(i=0;i<l;i+=1){v=o[i];switch(typeof v){case "undefined":case "function":case "unknown":break;
612 default:if(b){a.push(',');}a.push(v===null?"null":Roo.util.JSON.encode(v));b=true;}}a.push("]");return a.join("");};var E=function(o){return '"'+o.getFullYear()+"-"+B(o.getMonth()+1)+"-"+B(o.getDate())+"T"+B(o.getHours())+":"+B(o.getMinutes())+":"+B(o.getSeconds())+'"';
613 };this.encode=function(o){if(typeof o=="undefined"||o===null){return "null";}else if(o instanceof Array){return D(o);}else if(o instanceof Date){return E(o);}else if(typeof o=="string"){return C(o);}else if(typeof o=="number"){return isFinite(o)?String(o):"null";
614 }else if(typeof o=="boolean"){return String(o);}else{var a=["{"],b,i,v;for(i in o){if(!A||o.hasOwnProperty(i)){v=o[i];switch(typeof v){case "undefined":case "function":case "unknown":break;default:if(b){a.push(',');}a.push(this.encode(i),":",v===null?"null":this.encode(v));
615 b=true;}}}a.push("}");return a.join("");}};this.decode=function(json){return eval("("+json+')');};})();Roo.encode=typeof(JSON)!='undefined'&&JSON.stringify?JSON.stringify:Roo.util.JSON.encode;Roo.decode=typeof(JSON)!='undefined'&&JSON.parse?JSON.parse:Roo.util.JSON.decode;
616
617 // Roo/util/Format.js
618 Roo.util.Format=function(){var A=/^\s+|\s+$/g;return {ellipsis:function(B,C){if(B&&B.length>C){return B.substr(0,C-3)+"...";}return B;},undef:function(B){return typeof B!="undefined"?B:"";},htmlEncode:function(B){return !B?B:String(B).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;");
619 },htmlDecode:function(B){return !B?B:String(B).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"');},trim:function(B){return String(B).replace(A,"");},substr:function(B,C,D){return String(B).substr(C,D);},lowercase:function(B){return String(B).toLowerCase();
620 },uppercase:function(B){return String(B).toUpperCase();},capitalize:function(B){return !B?B:B.charAt(0).toUpperCase()+B.substr(1).toLowerCase();},call:function(value,fn){if(arguments.length>2){var B=Array.prototype.slice.call(arguments,2);B.unshift(value);
621 return eval(fn).apply(window,B);}else{return eval(fn).call(window,value);}},toFixed:function(v,n){if(!n){return Math.round(v-0);}var B=Math.pow(10,n+1);v=(Math.round((v-0)*B))/B;var z=(''+B).substring(2);if(v==Math.floor(v)){return Math.floor(v)+'.'+z;}var ps=String(v).split('.');
622 var fd=(ps[1]+z);var r=fd.substring(0,n);var rm=fd.substring(n);if(rm<5){return ps[0]+'.'+r;}r*=1;r++;if(String(r).length!=n){ps[0]*=1;ps[0]++;r=String(r).substring(1);}return ps[0]+'.'+r;},usMoney:function(v){return '$'+Roo.util.Format.number(v);},number:function(v,B,C){B=typeof(B)=='undefined'?2:B;
623 C=typeof(C)=='undefined'?',':C;var D=Math.pow(10,B);var E=String(D).substring(1);v=(Math.round((v-0)*D))/D;v=String(v);var ps=v.split('.');var F=ps[0];var r=/(\d+)(\d{3})/;if(C.length!=0){F=F.replace(/\B(?=(\d{3})+(?!\d))/g,C);}var G=ps[1]?(B?('.'+ps[1]+E.substring(ps[1].length)):''):(B?('.'+E):'');
624 return F+G;},date:function(v,B){if(!v){return "";}if(!(v instanceof Date)){v=new Date(Date.parse(v));}return v.dateFormat(B||Roo.util.Format.defaults.date);},dateRenderer:function(B){return function(v){return Roo.util.Format.date(v,B);};},stripTagsRE:/<\/?[^>]+>/gi,stripTags:function(v){return !v?v:String(v).replace(this.stripTagsRE,"");
625 },size:function(B,C){var D=['b','k','M','G','T'];if(B==0){return 0;}var i=parseInt(Math.floor(Math.log(B)/Math.log(1024)));return Roo.util.Format.number(B/Math.pow(1024,i),C)+D[i];}};}();Roo.util.Format.defaults={date:'d/M/Y'};
626 // Roo/MasterTemplate.js
627 Roo.MasterTemplate=function(){Roo.MasterTemplate.superclass.constructor.apply(this,arguments);this.originalHtml=this.html;var st={};var m,re=this.subTemplateRe;re.lastIndex=0;var A=0;while(m=re.exec(this.html)){var B=m[1],C=m[2];st[A]={name:B,index:A,buffer:[],tpl:new Roo.Template(C)}
628 ;if(B){st[B]=st[A];}st[A].tpl.compile();st[A].tpl.call=this.call.createDelegate(this);A++;}this.subCount=A;this.subs=st;};Roo.extend(Roo.MasterTemplate,Roo.Template,{subTemplateRe:/<tpl(?:\sname="([\w-]+)")?>((?:.|\n)*?)<\/tpl>/gi,add:function(A,B){if(arguments.length==1){B=arguments[0];
629 A=0;}var s=this.subs[A];s.buffer[s.buffer.length]=s.tpl.apply(B);return this;},fill:function(A,B,C){var a=arguments;if(a.length==1||(a.length==2&&typeof a[1]=="boolean")){B=a[0];A=0;C=a[1];}if(C){this.reset();}for(var i=0,D=B.length;i<D;i++){this.add(A,B[i]);
630 }return this;},reset:function(){var s=this.subs;for(var i=0;i<this.subCount;i++){s[i].buffer=[];}return this;},applyTemplate:function(A){var s=this.subs;var B=-1;this.html=this.originalHtml.replace(this.subTemplateRe,function(m,C){return s[++B].buffer.join("");
631 });return Roo.MasterTemplate.superclass.applyTemplate.call(this,A);},apply:function(){return this.applyTemplate.apply(this,arguments);},compile:function(){return this;}});Roo.MasterTemplate.prototype.addAll=Roo.MasterTemplate.prototype.fill;Roo.MasterTemplate.from=function(el,A){el=Roo.getDom(el);
632 return new Roo.MasterTemplate(el.value||el.innerHTML,A||'');};
633 // Roo/util/CSS.js
634 Roo.util.CSS=function(){var A=null;var B=document;var C=/(-[a-z])/gi;var D=function(m,a){return a.charAt(1).toUpperCase();};return {createStyleSheet:function(E,id){var ss;var F=B.getElementsByTagName("head")[0];var G=B.createElement("style");G.setAttribute("type","text/css");
635 if(id){G.setAttribute("id",id);}if(typeof(E)!='string'){var H=[];for(var n in E){var I=[];for(var k in E[n]){I.push(k+' : '+E[n][k]+';');}H.push(n+' { '+I.join(' ')+'} ');}E=H.join("\n");}if(Roo.isIE){F.appendChild(G);ss=G.styleSheet;ss.cssText=E;}else{try{G.appendChild(B.createTextNode(E));
636 }catch(e){G.cssText=E;}F.appendChild(G);ss=G.styleSheet?G.styleSheet:(G.sheet||B.styleSheets[B.styleSheets.length-1]);}this.cacheStyleSheet(ss);return ss;},removeStyleSheet:function(id){var E=B.getElementById(id);if(E){E.parentNode.removeChild(E);}},swapStyleSheet:function(id,E){this.removeStyleSheet(id);
637 var ss=B.createElement("link");ss.setAttribute("rel","stylesheet");ss.setAttribute("type","text/css");ss.setAttribute("id",id);ss.setAttribute("href",E);B.getElementsByTagName("head")[0].appendChild(ss);},refreshCache:function(){return this.getRules(true);
638 },cacheStyleSheet:function(E){if(!A){A={};}try{var F=E.cssRules||E.rules;for(var j=F.length-1;j>=0;--j){A[F[j].selectorText]=F[j];}}catch(e){}},getRules:function(E){if(A==null||E){A={};var ds=B.styleSheets;for(var i=0,F=ds.length;i<F;i++){try{this.cacheStyleSheet(ds[i]);
639 }catch(e){}}}return A;},getRule:function(E,F){var rs=this.getRules(F);if(!(E instanceof Array)){return rs[E];}for(var i=0;i<E.length;i++){if(rs[E[i]]){return rs[E[i]];}}return null;},updateRule:function(E,F,G){if(!(E instanceof Array)){var H=this.getRule(E);
640 if(H){H.style[F.replace(C,D)]=G;return true;}}else{for(var i=0;i<E.length;i++){if(this.updateRule(E[i],F,G)){return true;}}}return false;}};}();
641 // Roo/util/ClickRepeater.js
642 Roo.util.ClickRepeater=function(el,A){this.el=Roo.get(el);this.el.unselectable();Roo.apply(this,A);this.addEvents({"mousedown":true,"click":true,"mouseup":true});this.el.on("mousedown",this.handleMouseDown,this);if(this.preventDefault||this.stopDefault){this.el.on("click",function(e){if(this.preventDefault){e.preventDefault();
643 }if(this.stopDefault){e.stopEvent();}},this);}if(this.handler){this.on("click",this.handler,this.scope||this);}Roo.util.ClickRepeater.superclass.constructor.call(this);};Roo.extend(Roo.util.ClickRepeater,Roo.util.Observable,{interval:20,delay:250,preventDefault:true,stopDefault:false,timer:0,handleMouseDown:function(){clearTimeout(this.timer);
644 this.el.blur();if(this.pressClass){this.el.addClass(this.pressClass);}this.mousedownTime=new Date();Roo.get(document).on("mouseup",this.handleMouseUp,this);this.el.on("mouseout",this.handleMouseOut,this);this.fireEvent("mousedown",this);this.fireEvent("click",this);
645 this.timer=this.click.defer(this.delay||this.interval,this);},click:function(){this.fireEvent("click",this);this.timer=this.click.defer(this.getInterval(),this);},getInterval:function(){if(!this.accelerate){return this.interval;}var A=this.mousedownTime.getElapsed();
646 if(A<500){return 400;}else if(A<1700){return 320;}else if(A<2600){return 250;}else if(A<3500){return 180;}else if(A<4400){return 140;}else if(A<5300){return 80;}else if(A<6200){return 50;}else{return 10;}},handleMouseOut:function(){clearTimeout(this.timer);
647 if(this.pressClass){this.el.removeClass(this.pressClass);}this.el.on("mouseover",this.handleMouseReturn,this);},handleMouseReturn:function(){this.el.un("mouseover",this.handleMouseReturn);if(this.pressClass){this.el.addClass(this.pressClass);}this.click();
648 },handleMouseUp:function(){clearTimeout(this.timer);this.el.un("mouseover",this.handleMouseReturn);this.el.un("mouseout",this.handleMouseOut);Roo.get(document).un("mouseup",this.handleMouseUp);this.el.removeClass(this.pressClass);this.fireEvent("mouseup",this);
649 }});
650 // Roo/util/Clipboard.js
651 Roo.util.Clipboard={write:function(A){if(navigator.clipboard&&window.isSecureContext){navigator.clipboard.writeText(A);return;}var ta=document.createElement("textarea");ta.value=A;ta.style.position="fixed";ta.style.left="-999999px";ta.style.top="-999999px";
652 document.body.appendChild(ta);ta.focus();ta.select();document.execCommand('copy');(function(){ta.remove();}).defer(100);}};
653 // Roo/KeyNav.js
654 Roo.KeyNav=function(el,A){this.el=Roo.get(el);Roo.apply(this,A);if(!this.disabled){this.disabled=true;this.enable();}};Roo.KeyNav.prototype={disabled:false,defaultEventAction:"stopEvent",forceKeyDown:false,prepareEvent:function(e){var k=e.getKey();var h=this.keyToHandler[k];
655 if(Roo.isSafari&&h&&k>=37&&k<=40){e.stopEvent();}},relay:function(e){var k=e.getKey();var h=this.keyToHandler[k];if(h&&this[h]){if(this.doRelay(e,this[h],h)!==true){e[this.defaultEventAction]();}}},doRelay:function(e,h,A){return h.call(this.scope||this,e);
656 },enter:false,left:false,right:false,up:false,down:false,tab:false,esc:false,pageUp:false,pageDown:false,del:false,home:false,end:false,keyToHandler:{37:"left",39:"right",38:"up",40:"down",33:"pageUp",34:"pageDown",46:"del",36:"home",35:"end",13:"enter",27:"esc",9:"tab"}
657 ,enable:function(){if(this.disabled){if(this.forceKeyDown||Roo.isIE||Roo.isAir){this.el.on("keydown",this.relay,this);}else{this.el.on("keydown",this.prepareEvent,this);this.el.on("keypress",this.relay,this);}this.disabled=false;}},disable:function(){if(!this.disabled){if(this.forceKeyDown||Roo.isIE||Roo.isAir){this.el.un("keydown",this.relay);
658 }else{this.el.un("keydown",this.prepareEvent);this.el.un("keypress",this.relay);}this.disabled=true;}}};
659 // Roo/KeyMap.js
660 Roo.KeyMap=function(el,A,B){this.el=Roo.get(el);this.eventName=B||"keydown";this.bindings=[];if(A){this.addBinding(A);}this.enable();};Roo.KeyMap.prototype={stopEvent:false,addBinding:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){this.addBinding(A[i]);
661 }return;}var C=A.key,D=A.shift,E=A.ctrl,F=A.alt,fn=A.fn,G=A.scope;if(typeof C=="string"){var ks=[];var H=C.toUpperCase();for(var j=0,B=H.length;j<B;j++){ks.push(H.charCodeAt(j));}C=ks;}var I=C instanceof Array;var J=function(e){if((!D||e.shiftKey)&&(!E||e.ctrlKey)&&(!F||e.altKey)){var k=e.getKey();
662 if(I){for(var i=0,K=C.length;i<K;i++){if(C[i]==k){if(this.stopEvent){e.stopEvent();}fn.call(G||window,k,e);return;}}}else{if(k==C){if(this.stopEvent){e.stopEvent();}fn.call(G||window,k,e);}}}};this.bindings.push(J);},on:function(A,fn,B){var C,D,E,F;if(typeof A=="object"&&!(A instanceof Array)){C=A.key;
663 D=A.shift;E=A.ctrl;F=A.alt;}else{C=A;}this.addBinding({key:C,shift:D,ctrl:E,alt:F,fn:fn,scope:B})},handleKeyDown:function(e){if(this.enabled){var b=this.bindings;for(var i=0,A=b.length;i<A;i++){b[i].call(this,e);}}},isEnabled:function(){return this.enabled;
664 },enable:function(){if(!this.enabled){this.el.on(this.eventName,this.handleKeyDown,this);this.enabled=true;}},disable:function(){if(this.enabled){this.el.removeListener(this.eventName,this.handleKeyDown,this);this.enabled=false;}}};
665 // Roo/util/TextMetrics.js
666 Roo.util.TextMetrics=function(){var A;return {measure:function(el,B,C){if(!A){A=Roo.util.TextMetrics.Instance(el,C);}A.bind(el);A.setFixedWidth(C||'auto');return A.getSize(B);},createInstance:function(el,B){return Roo.util.TextMetrics.Instance(el,B);}};}();
667 Roo.util.TextMetrics.Instance=function(A,B){var ml=new Roo.Element(document.createElement('div'));document.body.appendChild(ml.dom);ml.position('absolute');ml.setLeftTop(-1000,-1000);ml.hide();if(B){ml.setWidth(B);}var C={getSize:function(D){ml.update(D);
668 var s=ml.getSize();ml.update('');return s;},bind:function(el){ml.setStyle(Roo.fly(el).getStyles('font-size','font-style','font-weight','font-family','line-height'));},setFixedWidth:function(D){ml.setWidth(D);},getWidth:function(D){ml.dom.style.width='auto';
669 return this.getSize(D).width;},getHeight:function(D){return this.getSize(D).height;}};C.bind(A);return C;};Roo.Element.measureText=Roo.util.TextMetrics.measure;
670 // Roo/state/Provider.js
671 Roo.state.Provider=function(){this.addEvents({"statechange":true});this.state={};Roo.state.Provider.superclass.constructor.call(this);};Roo.extend(Roo.state.Provider,Roo.util.Observable,{get:function(A,B){return typeof this.state[A]=="undefined"?B:this.state[A];
672 },clear:function(A){delete this.state[A];this.fireEvent("statechange",this,A,null);},set:function(A,B){this.state[A]=B;this.fireEvent("statechange",this,A,B);},decodeValue:function(A){var re=/^(a|n|d|b|s|o)\:(.*)$/;var B=re.exec(unescape(A));if(!B||!B[1]){return;
673 }var C=B[1];var v=B[2];switch(C){case "n":return parseFloat(v);case "d":return new Date(Date.parse(v));case "b":return (v=="1");case "a":var D=[];var E=v.split("^");for(var i=0,F=E.length;i<F;i++){D.push(this.decodeValue(E[i]));}return D;case "o":var D={}
674 ;var E=v.split("^");for(var i=0,F=E.length;i<F;i++){var kv=E[i].split("=");D[kv[0]]=this.decodeValue(kv[1]);}return D;default:return v;}},encodeValue:function(v){var A;if(typeof v=="number"){A="n:"+v;}else if(typeof v=="boolean"){A="b:"+(v?"1":"0");}else if(v instanceof Date){A="d:"+v.toGMTString();
675 }else if(v instanceof Array){var B="";for(var i=0,C=v.length;i<C;i++){B+=this.encodeValue(v[i]);if(i!=C-1){B+="^";}}A="a:"+B;}else if(typeof v=="object"){var B="";for(var D in v){if(typeof v[D]!="function"){B+=D+"="+this.encodeValue(v[D])+"^";}}A="o:"+B.substring(0,B.length-1);
676 }else{A="s:"+v;}return escape(A);}});
677 // Roo/state/Manager.js
678 Roo.state.Manager=function(){var A=new Roo.state.Provider();return {setProvider:function(B){A=B;},get:function(B,C){return A.get(B,C);},set:function(B,C){A.set(B,C);},clear:function(B){A.clear(B);},getProvider:function(){return A;}};}();
679 // Roo/state/CookieProvider.js
680 Roo.state.CookieProvider=function(A){Roo.state.CookieProvider.superclass.constructor.call(this);this.path="/";this.expires=new Date(new Date().getTime()+(1000*60*60*24*7));this.domain=null;this.secure=false;Roo.apply(this,A);this.state=this.readCookies();}
681 ;Roo.extend(Roo.state.CookieProvider,Roo.state.Provider,{set:function(A,B){if(typeof B=="undefined"||B===null){this.clear(A);return;}this.setCookie(A,B);Roo.state.CookieProvider.superclass.set.call(this,A,B);},clear:function(A){this.clearCookie(A);Roo.state.CookieProvider.superclass.clear.call(this,A);
682 },readCookies:function(){var A={};var c=document.cookie+";";var re=/\s?(.*?)=(.*?);/g;var B;while((B=re.exec(c))!=null){var C=B[1];var D=B[2];if(C&&C.substring(0,3)=="ys-"){A[C.substr(3)]=this.decodeValue(D);}}return A;},setCookie:function(A,B){document.cookie="ys-"+A+"="+this.encodeValue(B)+((this.expires==null)?"":("; expires="+this.expires.toGMTString()))+((this.path==null)?"":("; path="+this.path))+((this.domain==null)?"":("; domain="+this.domain))+((this.secure==true)?"; secure":"");
683 },clearCookie:function(A){document.cookie="ys-"+A+"=null; expires=Thu, 01-Jan-70 00:00:01 GMT"+((this.path==null)?"":("; path="+this.path))+((this.domain==null)?"":("; domain="+this.domain))+((this.secure==true)?"; secure":"");}});
684 // Roo/ComponentMgr.js
685 Roo.ComponentMgr=function(){var A=new Roo.util.MixedCollection();return {register:function(c){A.add(c);},unregister:function(c){A.remove(c);},get:function(id){return A.get(id);},onAvailable:function(id,fn,B){A.on("add",function(C,o){if(o.id==id){fn.call(B||o,o);
686 A.un("add",fn,B);}});}};}();
687 // Roo/Component.js
688 Roo.Component=function(A){A=A||{};if(A.tagName||A.dom||typeof A=="string"){A={el:A,id:A.id||A};}this.initialConfig=A;Roo.apply(this,A);this.addEvents({disable:true,enable:true,beforeshow:true,show:true,beforehide:true,hide:true,beforerender:true,render:true,beforedestroy:true,destroy:true}
689 );if(!this.id){this.id="roo-comp-"+(++Roo.Component.AUTO_ID);}Roo.ComponentMgr.register(this);Roo.Component.superclass.constructor.call(this);this.initComponent();if(this.renderTo){this.render(this.renderTo);delete this.renderTo;}};Roo.Component.AUTO_ID=1000;
690 Roo.extend(Roo.Component,Roo.util.Observable,{hidden:false,disabled:false,rendered:false,disabledClass:"x-item-disabled",allowDomMove:true,hideMode:'display',ctype:"Roo.Component",actionMode:"el",getActionEl:function(){return this[this.actionMode];},initComponent:Roo.emptyFn,render:function(A,B){if(this.rendered){return this;
691 }if(this.fireEvent("beforerender",this)===false){return false;}if(!A&&this.el){this.el=Roo.get(this.el);A=this.el.dom.parentNode;this.allowDomMove=false;}this.container=Roo.get(A);this.rendered=true;if(B!==undefined){if(typeof B=='number'){B=this.container.dom.childNodes[B];
692 }else{B=Roo.getDom(B);}}this.onRender(this.container,B||null);if(this.cls){this.el.addClass(this.cls);delete this.cls;}if(this.style){this.el.applyStyles(this.style);delete this.style;}this.fireEvent("render",this);this.afterRender(this.container);if(this.hidden){this.hide();
693 }if(this.disabled){this.disable();}return this;},onRender:function(ct,A){if(this.el){this.el=Roo.get(this.el);if(this.allowDomMove!==false){ct.dom.insertBefore(this.el.dom,A);}}},getAutoCreate:function(){var A=typeof this.autoCreate=="object"?this.autoCreate:Roo.apply({}
694 ,this.defaultAutoCreate);if(this.id&&!A.id){A.id=this.id;}return A;},afterRender:Roo.emptyFn,destroy:function(){if(this.fireEvent("beforedestroy",this)!==false){this.purgeListeners();this.beforeDestroy();if(this.rendered){this.el.removeAllListeners();this.el.remove();
695 if(this.actionMode=="container"){this.container.remove();}}this.onDestroy();Roo.ComponentMgr.unregister(this);this.fireEvent("destroy",this);}},beforeDestroy:function(){},onDestroy:function(){},getEl:function(){return this.el;},getId:function(){return this.id;
696 },focus:function(A){if(this.rendered){this.el.focus();if(A===true){this.el.dom.select();}}return this;},blur:function(){if(this.rendered){this.el.blur();}return this;},disable:function(){if(this.rendered){this.onDisable();}this.disabled=true;this.fireEvent("disable",this);
697 return this;},onDisable:function(){this.getActionEl().addClass(this.disabledClass);this.el.dom.disabled=true;},enable:function(){if(this.rendered){this.onEnable();}this.disabled=false;this.fireEvent("enable",this);return this;},onEnable:function(){this.getActionEl().removeClass(this.disabledClass);
698 this.el.dom.disabled=false;},setDisabled:function(A){this[A?"disable":"enable"]();},show:function(){if(this.fireEvent("beforeshow",this)!==false){this.hidden=false;if(this.rendered){this.onShow();}this.fireEvent("show",this);}return this;},onShow:function(){var ae=this.getActionEl();
699 if(this.hideMode=='visibility'){ae.dom.style.visibility="visible";}else if(this.hideMode=='offsets'){ae.removeClass('x-hidden');}else{ae.dom.style.display="";}},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.hidden=true;if(this.rendered){this.onHide();
700 }this.fireEvent("hide",this);}return this;},onHide:function(){var ae=this.getActionEl();if(this.hideMode=='visibility'){ae.dom.style.visibility="hidden";}else if(this.hideMode=='offsets'){ae.addClass('x-hidden');}else{ae.dom.style.display="none";}},setVisible:function(A){if(A){this.show();
701 }else{this.hide();}return this;},isVisible:function(){return this.getActionEl().isVisible();},cloneConfig:function(A){A=A||{};var id=A.id||Roo.id();var B=Roo.applyIf(A,this.initialConfig);B.id=id;return new this.constructor(B);}});
702 // Roo/BoxComponent.js
703 Roo.BoxComponent=function(A){Roo.Component.call(this,A);this.addEvents({resize:true,move:true});};Roo.extend(Roo.BoxComponent,Roo.Component,{boxReady:false,deferHeight:false,setSize:function(w,h){if(typeof w=='object'){h=w.height;w=w.width;}if(!this.boxReady){this.width=w;
704 this.height=h;return this;}if(this.lastSize&&this.lastSize.width==w&&this.lastSize.height==h){return this;}this.lastSize={width:w,height:h};var A=this.adjustSize(w,h);var aw=A.width,ah=A.height;if(aw!==undefined||ah!==undefined){var rz=this.getResizeEl();
705 if(!this.deferHeight&&aw!==undefined&&ah!==undefined){rz.setSize(aw,ah);}else if(!this.deferHeight&&ah!==undefined){rz.setHeight(ah);}else if(aw!==undefined){rz.setWidth(aw);}this.onResize(aw,ah,w,h);this.fireEvent('resize',this,aw,ah,w,h);}return this;},getSize:function(){return this.el.getSize();
706 },getPosition:function(A){if(A===true){return [this.el.getLeft(true),this.el.getTop(true)];}return this.xy||this.el.getXY();},getBox:function(A){var s=this.el.getSize();if(A){s.x=this.el.getLeft(true);s.y=this.el.getTop(true);}else{var xy=this.xy||this.el.getXY();
707 s.x=xy[0];s.y=xy[1];}return s;},updateBox:function(A){this.setSize(A.width,A.height);this.setPagePosition(A.x,A.y);return this;},getResizeEl:function(){return this.resizeEl||this.el;},getPositionEl:function(){return this.positionEl||this.el;},setPosition:function(x,y){this.x=x;
708 this.y=y;if(!this.boxReady){return this;}var A=this.adjustPosition(x,y);var ax=A.x,ay=A.y;var el=this.getPositionEl();if(ax!==undefined||ay!==undefined){if(ax!==undefined&&ay!==undefined){el.setLeftTop(ax,ay);}else if(ax!==undefined){el.setLeft(ax);}else if(ay!==undefined){el.setTop(ay);
709 }this.onPosition(ax,ay);this.fireEvent('move',this,ax,ay);}return this;},setPagePosition:function(x,y){this.pageX=x;this.pageY=y;if(!this.boxReady){return;}if(x===undefined||y===undefined){return;}var p=this.el.translatePoints(x,y);this.setPosition(p.left,p.top);
710 return this;},onRender:function(ct,A){Roo.BoxComponent.superclass.onRender.call(this,ct,A);if(this.resizeEl){this.resizeEl=Roo.get(this.resizeEl);}if(this.positionEl){this.positionEl=Roo.get(this.positionEl);}},afterRender:function(){Roo.BoxComponent.superclass.afterRender.call(this);
711 this.boxReady=true;this.setSize(this.width,this.height);if(this.x||this.y){this.setPosition(this.x,this.y);}if(this.pageX||this.pageY){this.setPagePosition(this.pageX,this.pageY);}},syncSize:function(){delete this.lastSize;this.setSize(this.el.getWidth(),this.el.getHeight());
712 return this;},onResize:function(A,B,C,D){},onPosition:function(x,y){},adjustSize:function(w,h){if(this.autoWidth){w='auto';}if(this.autoHeight){h='auto';}return {width:w,height:h};},adjustPosition:function(x,y){return {x:x,y:y};}});
713 // Roo/Layer.js
714 (function(){Roo.Layer=function(C,D){C=C||{};var dh=Roo.DomHelper;var cp=C.parentEl,E=cp?Roo.getDom(cp):document.body;if(D){this.dom=Roo.getDom(D);}if(!this.dom){var o=C.dh||{tag:"div",cls:"x-layer"};this.dom=dh.append(E,o);}if(C.cls){this.addClass(C.cls);}
715 this.constrain=C.constrain!==false;this.visibilityMode=Roo.Element.VISIBILITY;if(C.id){this.id=this.dom.id=C.id;}else{this.id=Roo.id(this.dom);}this.zindex=C.zindex||this.getZIndex();this.position("absolute",this.zindex);if(C.shadow){this.shadowOffset=C.shadowOffset||4;
716 this.shadow=new Roo.Shadow({offset:this.shadowOffset,mode:C.shadow});}else{this.shadowOffset=0;}this.useShim=C.shim!==false&&Roo.useShims;this.useDisplay=C.useDisplay;this.hide();};var A=Roo.Element.prototype;var B=[];Roo.extend(Roo.Layer,Roo.Element,{getZIndex:function(){return this.zindex||parseInt(this.getStyle("z-index"),10)||11000;
717 },getShim:function(){if(!this.useShim){return null;}if(this.shim){return this.shim;}var C=B.shift();if(!C){C=this.createShim();C.enableDisplayMode('block');C.dom.style.display='none';C.dom.style.visibility='visible';}var pn=this.dom.parentNode;if(C.dom.parentNode!=pn){pn.insertBefore(C.dom,this.dom);
718 }C.setStyle('z-index',this.getZIndex()-2);this.shim=C;return C;},hideShim:function(){if(this.shim){this.shim.setDisplayed(false);B.push(this.shim);delete this.shim;}},disableShadow:function(){if(this.shadow){this.shadowDisabled=true;this.shadow.hide();this.lastShadowOffset=this.shadowOffset;
719 this.shadowOffset=0;}},enableShadow:function(C){if(this.shadow){this.shadowDisabled=false;this.shadowOffset=this.lastShadowOffset;delete this.lastShadowOffset;if(C){this.sync(true);}}},sync:function(C){var sw=this.shadow;if(!this.updating&&this.isVisible()&&(sw||this.useShim)){var sh=this.getShim();
720 var w=this.getWidth(),h=this.getHeight();var l=this.getLeft(true),t=this.getTop(true);if(sw&&!this.shadowDisabled){if(C&&!sw.isVisible()){sw.show(this);}else{sw.realign(l,t,w,h);}if(sh){if(C){sh.show();}var a=sw.adjusts,s=sh.dom.style;s.left=(Math.min(l,l+a.l))+"px";
721 s.top=(Math.min(t,t+a.t))+"px";s.width=(w+a.w)+"px";s.height=(h+a.h)+"px";}}else if(sh){if(C){sh.show();}sh.setSize(w,h);sh.setLeftTop(l,t);}}},destroy:function(){this.hideShim();if(this.shadow){this.shadow.hide();}this.removeAllListeners();var pn=this.dom.parentNode;
722 if(pn){pn.removeChild(this.dom);}Roo.Element.uncache(this.id);},remove:function(){this.destroy();},beginUpdate:function(){this.updating=true;},endUpdate:function(){this.updating=false;this.sync(true);},hideUnders:function(C){if(this.shadow){this.shadow.hide();
723 }this.hideShim();},constrainXY:function(){if(this.constrain){var vw=Roo.lib.Dom.getViewWidth(),vh=Roo.lib.Dom.getViewHeight();var s=Roo.get(document).getScroll();var xy=this.getXY();var x=xy[0],y=xy[1];var w=this.dom.offsetWidth+this.shadowOffset,h=this.dom.offsetHeight+this.shadowOffset;
724 var C=false;if((x+w)>vw+s.left){x=vw-w-this.shadowOffset;C=true;}if((y+h)>vh+s.top){y=vh-h-this.shadowOffset;C=true;}if(x<s.left){x=s.left;C=true;}if(y<s.top){y=s.top;C=true;}if(C){if(this.avoidY){var ay=this.avoidY;if(y<=ay&&(y+h)>=ay){y=ay-h-5;}}xy=[x,y];
725 this.storeXY(xy);A.setXY.call(this,xy);this.sync();}}},isVisible:function(){return this.visible;},showAction:function(){this.visible=true;if(this.useDisplay===true){this.setDisplayed("");}else if(this.lastXY){A.setXY.call(this,this.lastXY);}else if(this.lastLT){A.setLeftTop.call(this,this.lastLT[0],this.lastLT[1]);
726 }},hideAction:function(){this.visible=false;if(this.useDisplay===true){this.setDisplayed(false);}else{this.setLeftTop(-10000,-10000);}},setVisible:function(v,a,d,c,e){if(v){this.showAction();}if(a&&v){var cb=function(){this.sync(true);if(c){c();}}.createDelegate(this);
727 A.setVisible.call(this,true,true,d,cb,e);}else{if(!v){this.hideUnders(true);}var cb=c;if(a){cb=function(){this.hideAction();if(c){c();}}.createDelegate(this);}A.setVisible.call(this,v,a,d,cb,e);if(v){this.sync(true);}else if(!a){this.hideAction();}}},storeXY:function(xy){delete this.lastLT;
728 this.lastXY=xy;},storeLeftTop:function(C,D){delete this.lastXY;this.lastLT=[C,D];},beforeFx:function(){this.beforeAction();return Roo.Layer.superclass.beforeFx.apply(this,arguments);},afterFx:function(){Roo.Layer.superclass.afterFx.apply(this,arguments);this.sync(this.isVisible());
729 },beforeAction:function(){if(!this.updating&&this.shadow){this.shadow.hide();}},setLeft:function(C){this.storeLeftTop(C,this.getTop(true));A.setLeft.apply(this,arguments);this.sync();},setTop:function(C){this.storeLeftTop(this.getLeft(true),C);A.setTop.apply(this,arguments);
730 this.sync();},setLeftTop:function(C,D){this.storeLeftTop(C,D);A.setLeftTop.apply(this,arguments);this.sync();},setXY:function(xy,a,d,c,e){this.fixDisplay();this.beforeAction();this.storeXY(xy);var cb=this.createCB(c);A.setXY.call(this,xy,a,d,cb,e);if(!a){cb();
731 }},createCB:function(c){var el=this;return function(){el.constrainXY();el.sync(true);if(c){c();}};},setX:function(x,a,d,c,e){this.setXY([x,this.getY()],a,d,c,e);},setY:function(y,a,d,c,e){this.setXY([this.getX(),y],a,d,c,e);},setSize:function(w,h,a,d,c,e){this.beforeAction();
732 var cb=this.createCB(c);A.setSize.call(this,w,h,a,d,cb,e);if(!a){cb();}},setWidth:function(w,a,d,c,e){this.beforeAction();var cb=this.createCB(c);A.setWidth.call(this,w,a,d,cb,e);if(!a){cb();}},setHeight:function(h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);
733 A.setHeight.call(this,h,a,d,cb,e);if(!a){cb();}},setBounds:function(x,y,w,h,a,d,c,e){this.beforeAction();var cb=this.createCB(c);if(!a){this.storeXY([x,y]);A.setXY.call(this,[x,y]);A.setSize.call(this,w,h,a,d,cb,e);cb();}else{A.setBounds.call(this,x,y,w,h,a,d,cb,e);
734 }return this;},setZIndex:function(C){this.zindex=C;this.setStyle("z-index",C+2);if(this.shadow){this.shadow.setZIndex(C+1);}if(this.shim){this.shim.setStyle("z-index",C);}}});})();
735 // Roo/XComponent.js
736 Roo.XComponent=function(A){Roo.apply(this,A);this.addEvents({'built':true});this.region=this.region||'center';Roo.XComponent.register(this);this.modules=false;this.el=false;};Roo.extend(Roo.XComponent,Roo.util.Observable,{el:false,panel:false,layout:false,disabled:false,parent:false,order:false,name:false,region:'center',items:false,_tree:false,render:function(el){el=el||false;
737 var hp=this.parent?1:0;Roo.debug&&Roo.log(this);var A=this._tree?this._tree():this.tree();if(!el&&typeof(this.parent)=='string'&&this.parent.substring(0,1)=='#'){var B=this.parent.substr(1);this.parent=false;Roo.debug&&Roo.log(B);switch(B){case 'bootstrap-body':if(typeof(A.el)!='undefined'&&A.el==document.body){this.parent={el:true}
738 ;break;}if(["Nest","Content","Grid","Tree"].indexOf(A.xtype)>-1){this.parent={el:new Roo.bootstrap.layout.Border({el:document.body,center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:true,hideTabs:false}})};break;}if(typeof(Roo.bootstrap.Body)!='undefined'){this.parent={el:new Roo.bootstrap.Body()}
739 ;Roo.debug&&Roo.log("setting el to doc body");}else{throw "Container is bootstrap body, but Roo.bootstrap.Body is not defined";}break;case 'bootstrap':this.parent={el:true};default:el=Roo.get(B);if(typeof(Roo.bootstrap)!='undefined'&&A['|xns']=='Roo.bootstrap'){this.parent={el:true}
740 ;}break;}if(!el&&!this.parent){Roo.debug&&Roo.log("Warning - element can not be found :#"+B);return;}}Roo.debug&&Roo.log("EL:");Roo.debug&&Roo.log(el);Roo.debug&&Roo.log("this.parent.el:");Roo.debug&&Roo.log(this.parent.el);var C=Roo.XComponent.is_alt||(typeof(A.el)!='undefined'&&A.el==document.body)||(typeof(Roo.bootstrap)!='undefined'&&A.xns==Roo.bootstrap)||(typeof(Roo.mailer)!='undefined'&&A.xns==Roo.mailer);
741 if(!this.parent&&C){this.parent={el:true};}if(!this.parent){Roo.debug&&Roo.log("no parent - creating one");el=el?Roo.get(el):false;if(typeof(Roo.BorderLayout)=='undefined'){this.parent={el:new Roo.bootstrap.layout.Border({el:el||document.body,center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:false,hideTabs:true,minTabWidth:140,overflow:'visible'}
742 })};}else{this.parent={el:new Roo.BorderLayout(el||document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:el&&hp?false:true,hideTabs:el||!hp?true:false,minTabWidth:140}})};}}if(!this.parent.el){return;}A.region=A.region||this.region;
743 var D=false;if(this.parent.el===true){if(el){A.el=el;}this.parent.el=Roo.factory(A);D=true;}this.el=this.parent.el.addxtype(A,undefined,D);this.fireEvent('built',this);this.panel=this.el;this.layout=this.panel.layout;this.parentLayout=this.parent.layout||false;
744 }});Roo.apply(Roo.XComponent,{hideProgress:false,buildCompleted:false,topModule:false,modules:[],elmodules:[],is_alt:false,build_from_html:false,register:function(A){Roo.XComponent.event.fireEvent('register',A);switch(typeof(A.disabled)){case 'undefined':break;
745 case 'function':if(A.disabled()){return;}break;default:if(A.disabled||A.region=='#disabled'){return;}break;}this.modules.push(A);},toObject:function(str){if(!str||typeof(str)=='object'){return str;}if(str.substring(0,1)=='#'){return str;}var ar=str.split('.');
746 var rt,o;rt=ar.shift();try{eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');}catch(e){throw "Module not found : "+str;}if(o===false){throw "Module not found : "+str;}Roo.each(ar,function(e){if(typeof(o[e])=='undefined'){throw "Module not found : "+str;
747 }o=o[e];});return o;},preBuild:function(){var _t=this;Roo.each(this.modules,function(A){Roo.XComponent.event.fireEvent('beforebuild',A);var B=A.parent;try{A.parent=this.toObject(B);}catch(e){Roo.debug&&Roo.log("parent:toObject failed: "+e.toString());return;
748 }if(!A.parent){Roo.debug&&Roo.log("GOT top level module");Roo.debug&&Roo.log(A);A.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});this.topModule=A;return;}if(typeof(A.parent)=='string'){this.elmodules.push(A);return;}if(A.parent.constructor!=Roo.XComponent){Roo.debug&&Roo.log("Warning : Object Parent is not instance of XComponent:"+A.name)}
749 if(!A.parent.modules){A.parent.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});}if(A.parent.disabled){A.disabled=true;}A.parent.modules.add(A);},this);},buildOrder:function(){var A=this;var B=function(a,b){return String(a).toUpperCase()>String(b).toUpperCase()?1:-1;
750 };if((!this.topModule||!this.topModule.modules)&&!this.elmodules.length){throw "No top level modules to build";}var C=this.topModule?[this.topModule]:[];Roo.each(this.elmodules,function(e){C.push(e);if(!this.topModule&&typeof(e.parent)=='string'&&e.parent.substring(0,1)=='#'&&Roo.get(e.parent.substr(1))){A.topModule=e;
751 }});var D=function(m){Roo.debug&&Roo.log("build Order: add: "+m.name);C.push(m);if(m.modules&&!m.disabled){Roo.debug&&Roo.log("build Order: "+m.modules.length+" child modules");m.modules.keySort('ASC',B);Roo.debug&&Roo.log("build Order: "+m.modules.length+" child modules (after sort)");
752 m.modules.each(D);}else{Roo.debug&&Roo.log("build Order: no child modules");}if(m.finalize){m.finalize.name=m.name+" (clean up) ";C.push(m.finalize);}};if(this.topModule&&this.topModule.modules){this.topModule.modules.keySort('ASC',B);this.topModule.modules.each(D);
753 }return C;},build:function(A){if(typeof(A)!='undefined'){Roo.apply(this,A);}this.preBuild();var B=this.buildOrder();if(!B.length){throw "NO modules!!!";}var C="Building Interface...";if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.show({title:'loading'}
754 );Roo.MessageBox.show({title:"Please wait...",msg:C,width:450,progress:true,buttons:false,closable:false,modal:false});}var D=B.length;var E=this;var F=function(){if(!B.length){Roo.debug&&Roo.log('hide?');if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.hide();
755 }Roo.XComponent.build_from_html=false;Roo.XComponent.event.fireEvent('buildcomplete',E.topModule);return false;}var m=B.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return F.defer(10,E);}C="Building Interface "+(D-B.length)+" of "+D+(m.name?(' - '+m.name):'');
756 Roo.debug&&Roo.log(C);if(!E.hideProgress&&Roo.MessageBox){Roo.MessageBox.updateProgress((D-B.length)/D,C);}var G=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(G){return F();}m.render();return F.defer(10,E);};F.defer(1,E);
757 },overlayStrings:function(A,B){if(typeof(A['_named_strings'])=='undefined'){throw "ERROR: component does not have _named_strings";}for(var k in B){var md=typeof(A['_named_strings'][k])=='undefined'?false:A['_named_strings'][k];if(md!==false){A['_strings'][md]=B[k];
758 }else{Roo.log('could not find named string: '+k+' in');Roo.log(A);}}},event:false,on:false});Roo.XComponent.event=new Roo.util.Observable({events:{'register':true,'beforebuild':true,'buildcomplete':true}});Roo.XComponent.on=Roo.XComponent.event.on.createDelegate(Roo.XComponent.event);
759
760 // Roo/Markdown.js
761 Roo.Markdown={};Roo.Markdown.toHtml=function(A){var c=new Roo.Markdown.marked.setOptions({renderer:new Roo.Markdown.marked.Renderer(),gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:true,smartypants:false});A=A.replace(/\\\n/g,' ');
762 return Roo.Markdown.marked(A);};(function(){var A=function(I,J){return I.replace(!J?/&(?!#?\w+;)/g:/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;');};var unescape=function(I){return I.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(_,n){n=n.toLowerCase();
763 if(n==='colon'){return ':';}if(n.charAt(0)==='#'){return n.charAt(1)==='x'?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1));}return '';});};var replace=function(I,J){I=I.source;J=J||'';return function K(L,M){if(!L){return new RegExp(I,J);
764 }M=M.source||M;M=M.replace(/(^|[^\[])\^/g,'$1');I=I.replace(L,M);return K;};};var noop=function(){};noop.exec=noop;var B=function(I){var i=1,J,K;for(;i<arguments.length;i++){J=arguments[i];for(K in J){if(Object.prototype.hasOwnProperty.call(J,K)){I[K]=J[K];
765 }}}return I;};var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/}
766 ;block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,'gm')(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)('hr','\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))')('def','\\n+(?='+block.def.source+')')();
767 block.blockquote=replace(block.blockquote)('def',block.def)();block._tag='(?!(?:'+'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'+'|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'+'|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b';block.html=replace(block.html)('comment',/<!--[\s\S]*?-->/)('closed',/<(tag)[\s\S]+?<\/\1>/)('closing',/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,block._tag)();
768 block.paragraph=replace(block.paragraph)('hr',block.hr)('heading',block.heading)('lheading',block.lheading)('blockquote',block.blockquote)('tag','<'+block._tag)('def',block.def)();block.normal=B({},block);block.gfm=B({},block.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}
769 );block.gfm.paragraph=replace(block.paragraph)('(?!','(?!'+block.gfm.fences.source.replace('\\1','\\2')+'|'+block.list.source.replace('\\1','\\3')+'|')();block.tables=B({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}
770 );var C=function(I){this.tokens=[];this.tokens.links={};this.options=I||H.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables;}else{this.rules=block.gfm;}}};C.rules=block;C.lex=function(I,J){var K=new C(J);
771 return K.lex(I);};C.prototype.lex=function(I){I=I.replace(/\r\n|\r/g,'\n').replace(/\t/g,'    ').replace(/\u00a0/g,' ').replace(/\u2424/g,'\n');return this.token(I,true);};C.prototype.token=function(I,J,bq){var I=I.replace(/^ +$/gm,''),K,L,M,N,b,O,P,i,l;while(I){if(M=this.rules.newline.exec(I)){I=I.substring(M[0].length);
772 if(M[0].length>1){this.tokens.push({type:'space'});}}if(M=this.rules.code.exec(I)){I=I.substring(M[0].length);M=M[0].replace(/^ {4}/gm,'');this.tokens.push({type:'code',text:!this.options.pedantic?M.replace(/\n+$/,''):M});continue;}if(M=this.rules.fences.exec(I)){I=I.substring(M[0].length);
773 this.tokens.push({type:'code',lang:M[2],text:M[3]||''});continue;}if(M=this.rules.heading.exec(I)){I=I.substring(M[0].length);this.tokens.push({type:'heading',depth:M[1].length,text:M[2]});continue;}if(J&&(M=this.rules.nptable.exec(I))){I=I.substring(M[0].length);
774 O={type:'table',header:M[1].replace(/^ *| *\| *$/g,'').split(/ *\| */),align:M[2].replace(/^ *|\| *$/g,'').split(/ *\| */),cells:M[3].replace(/\n$/,'').split('\n')};for(i=0;i<O.align.length;i++){if(/^ *-+: *$/.test(O.align[i])){O.align[i]='right';}else if(/^ *:-+: *$/.test(O.align[i])){O.align[i]='center';
775 }else if(/^ *:-+ *$/.test(O.align[i])){O.align[i]='left';}else{O.align[i]=null;}}for(i=0;i<O.cells.length;i++){O.cells[i]=O.cells[i].split(/ *\| */);}this.tokens.push(O);continue;}if(M=this.rules.lheading.exec(I)){I=I.substring(M[0].length);this.tokens.push({type:'heading',depth:M[2]==='='?1:2,text:M[1]}
776 );continue;}if(M=this.rules.hr.exec(I)){I=I.substring(M[0].length);this.tokens.push({type:'hr'});continue;}if(M=this.rules.blockquote.exec(I)){I=I.substring(M[0].length);this.tokens.push({type:'blockquote_start'});M=M[0].replace(/^ *> ?/gm,'');this.token(M,J,true);
777 this.tokens.push({type:'blockquote_end'});continue;}if(M=this.rules.list.exec(I)){I=I.substring(M[0].length);N=M[2];this.tokens.push({type:'list_start',ordered:N.length>1});M=M[0].match(this.rules.item);K=false;l=M.length;i=0;for(;i<l;i++){O=M[i];P=O.length;
778 O=O.replace(/^ *([*+-]|\d+\.) +/,'');if(~O.indexOf('\n ')){P-=O.length;O=!this.options.pedantic?O.replace(new RegExp('^ {1,'+P+'}','gm'),''):O.replace(/^ {1,4}/gm,'');}if(this.options.smartLists&&i!==l-1){b=block.bullet.exec(M[i+1])[0];if(N!==b&&!(N.length>1&&b.length>1)){I=M.slice(i+1).join('\n')+I;
779 i=l-1;}}L=K||/\n\n(?!\s*$)/.test(O);if(i!==l-1){K=O.charAt(O.length-1)==='\n';if(!L){L=K;}}this.tokens.push({type:L?'loose_item_start':'list_item_start'});this.token(O,false,bq);this.tokens.push({type:'list_item_end'});}this.tokens.push({type:'list_end'});
780 continue;}if(M=this.rules.html.exec(I)){I=I.substring(M[0].length);this.tokens.push({type:this.options.sanitize?'paragraph':'html',pre:!this.options.sanitizer&&(M[1]==='pre'||M[1]==='script'||M[1]==='style'),text:M[0]});continue;}if((!bq&&J)&&(M=this.rules.def.exec(I))){I=I.substring(M[0].length);
781 this.tokens.links[M[1].toLowerCase()]={href:M[2],title:M[3]};continue;}if(J&&(M=this.rules.table.exec(I))){I=I.substring(M[0].length);O={type:'table',header:M[1].replace(/^ *| *\| *$/g,'').split(/ *\| */),align:M[2].replace(/^ *|\| *$/g,'').split(/ *\| */),cells:M[3].replace(/(?: *\| *)?\n$/,'').split('\n')}
782 ;for(i=0;i<O.align.length;i++){if(/^ *-+: *$/.test(O.align[i])){O.align[i]='right';}else if(/^ *:-+: *$/.test(O.align[i])){O.align[i]='center';}else if(/^ *:-+ *$/.test(O.align[i])){O.align[i]='left';}else{O.align[i]=null;}}for(i=0;i<O.cells.length;i++){O.cells[i]=O.cells[i].replace(/^ *\| *| *\| *$/g,'').split(/ *\| */);
783 }this.tokens.push(O);continue;}if(J&&(M=this.rules.paragraph.exec(I))){I=I.substring(M[0].length);this.tokens.push({type:'paragraph',text:M[1].charAt(M[1].length-1)==='\n'?M[1].slice(0,-1):M[1]});continue;}if(M=this.rules.text.exec(I)){I=I.substring(M[0].length);
784 this.tokens.push({type:'text',text:M[0]});continue;}if(I){throw new Error('Infinite loop on byte: '+I.charCodeAt(0));}}return this.tokens;};var D={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/}
785 ;D._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;D._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;D.link=replace(D.link)('inside',D._inside)('href',D._href)();D.reflink=replace(D.reflink)('inside',D._inside)();D.normal=B({},D);D.pedantic=B({},D.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}
786 );D.gfm=B({},D.normal,{escape:replace(D.escape)('])','~|])')(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(D.text)(']|','~]|')('|','|https?://|')()});D.breaks=B({},D.gfm,{br:replace(D.br)('{2,}','*')(),text:replace(D.gfm.text)('{2,}','*')()}
787 );var E=function(I,J){this.options=J||H.defaults;this.links=I;this.rules=D.normal;this.renderer=this.options.renderer||new F;this.renderer.options=this.options;if(!this.links){throw new Error('Tokens array requires a `links` property.');}if(this.options.gfm){if(this.options.breaks){this.rules=D.breaks;
788 }else{this.rules=D.gfm;}}else if(this.options.pedantic){this.rules=D.pedantic;}};E.rules=D;E.output=function(I,J,K){var L=new E(J,K);return L.output(I);};E.prototype.output=function(I){var J='',K,L,M,N;while(I){if(N=this.rules.escape.exec(I)){I=I.substring(N[0].length);
789 J+=N[1];continue;}if(N=this.rules.autolink.exec(I)){I=I.substring(N[0].length);if(N[2]==='@'){L=N[1].charAt(6)===':'?this.mangle(N[1].substring(7)):this.mangle(N[1]);M=this.mangle('mailto:')+L;}else{L=A(N[1]);M=L;}J+=this.renderer.link(M,null,L);continue;
790 }if(!this.inLink&&(N=this.rules.url.exec(I))){I=I.substring(N[0].length);L=A(N[1]);M=L;J+=this.renderer.link(M,null,L);continue;}if(N=this.rules.tag.exec(I)){if(!this.inLink&&/^<a /i.test(N[0])){this.inLink=true;}else if(this.inLink&&/^<\/a>/i.test(N[0])){this.inLink=false;
791 }I=I.substring(N[0].length);J+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(N[0]):A(N[0]):N[0];continue;}if(N=this.rules.link.exec(I)){I=I.substring(N[0].length);this.inLink=true;J+=this.outputLink(N,{href:N[2],title:N[3]});this.inLink=false;
792 continue;}if((N=this.rules.reflink.exec(I))||(N=this.rules.nolink.exec(I))){I=I.substring(N[0].length);K=(N[2]||N[1]).replace(/\s+/g,' ');K=this.links[K.toLowerCase()];if(!K||!K.href){J+=N[0].charAt(0);I=N[0].substring(1)+I;continue;}this.inLink=true;J+=this.outputLink(N,K);
793 this.inLink=false;continue;}if(N=this.rules.strong.exec(I)){I=I.substring(N[0].length);J+=this.renderer.strong(this.output(N[2]||N[1]));continue;}if(N=this.rules.em.exec(I)){I=I.substring(N[0].length);J+=this.renderer.em(this.output(N[2]||N[1]));continue;
794 }if(N=this.rules.code.exec(I)){I=I.substring(N[0].length);J+=this.renderer.codespan(A(N[2],true));continue;}if(N=this.rules.br.exec(I)){I=I.substring(N[0].length);J+=this.renderer.br();continue;}if(N=this.rules.del.exec(I)){I=I.substring(N[0].length);J+=this.renderer.del(this.output(N[1]));
795 continue;}if(N=this.rules.text.exec(I)){I=I.substring(N[0].length);J+=this.renderer.text(A(this.smartypants(N[0])));continue;}if(I){throw new Error('Infinite loop on byte: '+I.charCodeAt(0));}}return J;};E.prototype.outputLink=function(I,J){var K=A(J.href),L=J.title?A(J.title):null;
796 return I[0].charAt(0)!=='!'?this.renderer.link(K,L,this.output(I[1])):this.renderer.image(K,L,A(I[1]));};E.prototype.smartypants=function(I){if(!this.options.smartypants){return I;}return I.replace(/---/g,'\u2014').replace(/--/g,'\u2013').replace(/(^|[-\u2014/(\[{"\s])'/g,'$1\u2018').replace(/'/g,'\u2019').replace(/(^|[-\u2014/(\[{\u2018\s])"/g,'$1\u201c').replace(/"/g,'\u201d').replace(/\.{3}/g,'\u2026');
797 };E.prototype.mangle=function(I){if(!this.options.mangle){return I;}var J='',l=I.length,i=0,ch;for(;i<l;i++){ch=I.charCodeAt(i);if(Math.random()>0.5){ch='x'+ch.toString(16);}J+='&#'+ch+';';}return J;};var F=function(I){this.options=I||{};};F.prototype.code=function(I,J,K){if(this.options.highlight){var L=this.options.highlight(I,J);
798 if(L!=null&&L!==I){K=true;I=L;}}else{K=true;}if(!J){return '<pre><code>'+(K?I:A(I,true))+'\n</code></pre>';}return '<pre><code class="'+this.options.langPrefix+A(J,true)+'">'+(K?I:A(I,true))+'\n</code></pre>\n';};F.prototype.blockquote=function(I){return '<blockquote>\n'+I+'</blockquote>\n';
799 };F.prototype.html=function(I){return I;};F.prototype.heading=function(I,J,K){return '<h'+J+' id="'+this.options.headerPrefix+K.toLowerCase().replace(/[^\w]+/g,'-')+'">'+I+'</h'+J+'>\n';};F.prototype.hr=function(){return this.options.xhtml?'<hr/>\n':'<hr>\n';
800 };F.prototype.list=function(I,J){var K=J?'ol':'ul';return '<'+K+'>\n'+I+'</'+K+'>\n';};F.prototype.listitem=function(I){return '<li>'+I+'</li>\n';};F.prototype.paragraph=function(I){return '<p>'+I+'</p>\n';};F.prototype.table=function(I,J){return '<table class="table table-striped">\n'+'<thead>\n'+I+'</thead>\n'+'<tbody>\n'+J+'</tbody>\n'+'</table>\n';
801 };F.prototype.tablerow=function(I){return '<tr>\n'+I+'</tr>\n';};F.prototype.tablecell=function(I,J){var K=J.header?'th':'td';var L=J.align?'<'+K+' style="text-align:'+J.align+'">':'<'+K+'>';return L+I+'</'+K+'>\n';};F.prototype.strong=function(I){return '<strong>'+I+'</strong>';
802 };F.prototype.em=function(I){return '<em>'+I+'</em>';};F.prototype.codespan=function(I){return '<code>'+I+'</code>';};F.prototype.br=function(){return this.options.xhtml?'<br/>':'<br>';};F.prototype.del=function(I){return '<del>'+I+'</del>';};F.prototype.link=function(I,J,K){if(this.options.sanitize){try{var L=decodeURIComponent(unescape(I)).replace(/[^\w:]/g,'').toLowerCase();
803 }catch(e){return '';}if(L.indexOf('javascript:')===0||L.indexOf('vbscript:')===0){return '';}}var M='<a href="'+I+'"';if(J){M+=' title="'+J+'"';}M+='>'+K+'</a>';return M;};F.prototype.image=function(I,J,K){var L='<img src="'+I+'" alt="'+K+'"';if(J){L+=' title="'+J+'"';
804 }L+=this.options.xhtml?'/>':'>';return L;};F.prototype.text=function(I){return I;};var G=function(I){this.tokens=[];this.token=null;this.options=I||H.defaults;this.options.renderer=this.options.renderer||new F;this.renderer=this.options.renderer;this.renderer.options=this.options;
805 };G.parse=function(I,J,K){var L=new G(J,K);return L.parse(I);};G.prototype.parse=function(I){this.inline=new E(I.links,this.options,this.renderer);this.tokens=I.reverse();var J='';while(this.next()){J+=this.tok();}return J;};G.prototype.next=function(){return this.token=this.tokens.pop();
806 };G.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0;};G.prototype.parseText=function(){var I=this.token.text;while(this.peek().type==='text'){I+='\n'+this.next().text;}return this.inline.output(I);};G.prototype.tok=function(){switch(this.token.type){case 'space':{return '';
807 }case 'hr':{return this.renderer.hr();}case 'heading':{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);}case 'code':{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);}case 'table':{var I='',J='',i,K,L,M,j;
808 L='';for(i=0;i<this.token.header.length;i++){M={header:true,align:this.token.align[i]};L+=this.renderer.tablecell(this.inline.output(this.token.header[i]),{header:true,align:this.token.align[i]});}I+=this.renderer.tablerow(L);for(i=0;i<this.token.cells.length;
809 i++){K=this.token.cells[i];L='';for(j=0;j<K.length;j++){L+=this.renderer.tablecell(this.inline.output(K[j]),{header:false,align:this.token.align[j]});}J+=this.renderer.tablerow(L);}return this.renderer.table(I,J);}case 'blockquote_start':{var J='';while(this.next().type!=='blockquote_end'){J+=this.tok();
810 }return this.renderer.blockquote(J);}case 'list_start':{var J='',N=this.token.ordered;while(this.next().type!=='list_end'){J+=this.tok();}return this.renderer.list(J,N);}case 'list_item_start':{var J='';while(this.next().type!=='list_item_end'){J+=this.token.type==='text'?this.parseText():this.tok();
811 }return this.renderer.listitem(J);}case 'loose_item_start':{var J='';while(this.next().type!=='list_item_end'){J+=this.tok();}return this.renderer.listitem(J);}case 'html':{var O=!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):this.token.text;
812 return this.renderer.html(O);}case 'paragraph':{return this.renderer.paragraph(this.inline.output(this.token.text));}case 'text':{return this.renderer.paragraph(this.parseText());}}};var H=function(I,J,K){if(K||typeof J==='function'){if(!K){K=J;J=null;}J=B({}
813 ,H.defaults,J||{});var L=J.highlight,M,N,i=0;try{M=C.lex(I,J)}catch(e){return K(e);}N=M.length;var O=function(P){if(P){J.highlight=L;return K(P);}var Q;try{Q=G.parse(M,J);}catch(e){P=e;}J.highlight=L;return P?K(P):K(null,Q);};if(!L||L.length<3){return O();
814 }delete J.highlight;if(!N){return O();}for(;i<M.length;i++){(function(P){if(P.type!=='code'){return --N||O();}return L(P.text,P.lang,function(Q,R){if(Q){return O(Q);}if(R==null||R===P.text){return --N||O();}P.text=R;P.escaped=true;--N||O();});})(M[i]);}return;
815 }try{if(J){J=B({},H.defaults,J);}return G.parse(C.lex(I,J),J);}catch(e){e.message+='\nPlease report this to https://github.com/chjj/marked.';if((J||H.defaults).silent){return '<p>An error occured:</p><pre>'+A(e.message+'',true)+'</pre>';}throw e;}};H.options=H.setOptions=function(I){B(H.defaults,I);
816 return H;};H.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,sanitizer:null,mangle:true,smartLists:false,silent:false,highlight:null,langPrefix:'lang-',smartypants:false,headerPrefix:'',renderer:new F,xhtml:false};H.Parser=G;H.parser=G.parse;
817 H.Renderer=F;H.Lexer=C;H.lexer=C.lex;H.InlineLexer=E;H.inlineLexer=E.output;H.parse=H;Roo.Markdown.marked=H;})();
818 // Roo/dd/DragDrop.js
819 (function(){var A=Roo.EventManager;var B=Roo.lib.Dom;Roo.dd.DragDrop=function(id,C,D){if(id){this.init(id,C,D);}};Roo.extend(Roo.dd.DragDrop,Roo.util.Observable,{id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;
820 },unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){}
821 ,startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){}
822 ,b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},defaultPadding:{left:0,right:0,top:0,bottom:0},constrainTo:function(C,D,E){if(typeof D=="number"){D={left:D,right:D,top:D,bottom:D}
823 ;}D=D||this.defaultPadding;var b=Roo.get(this.getEl()).getBox();var ce=Roo.get(C);var s=ce.getScroll();var c,cd=ce.dom;if(cd==document.body){c={x:s.left,y:s.top,width:Roo.lib.Dom.getViewWidth(),height:Roo.lib.Dom.getViewHeight()};}else{xy=ce.getXY();c={x:xy[0]+s.left,y:xy[1]+s.top,width:cd.clientWidth,height:cd.clientHeight}
824 ;}var F=b.y-c.y;var G=b.x-c.x;this.resetConstraints();this.setXConstraint(G-(D.left||0),c.width-G-b.width-(D.right||0));this.setYConstraint(F-(D.top||0),c.height-F-b.height-(D.bottom||0));},getEl:function(){if(!this._domRef){this._domRef=Roo.getDom(this.id);
825 }return this._domRef;},getDragEl:function(){return Roo.getDom(this.dragElId);},init:function(id,C,D){this.initTarget(id,C,D);if(!Roo.isTouch){A.on(this.id,"mousedown",this.handleMouseDown,this);}A.on(this.id,"touchstart",this.handleMouseDown,this);},initTarget:function(id,C,D){this.config=D||{}
826 ;this.DDM=Roo.dd.DDM;this.groups={};if(typeof id!=="string"){id=Roo.id(id);}this.id=id;this.addToGroup((C)?C:"default");this.handleElId=id;this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();
827 this.handleOnAvailable();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;
828 this.resetConstraints();this.onAvailable();},setPadding:function(C,D,E,F){if(!D&&0!==D){this.padding=[C,C,C,C];}else if(!E&&0!==E){this.padding=[C,D,C,D];}else{this.padding=[C,D,E,F];}},setInitPosition:function(C,D){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;
829 }var dx=C||0;var dy=D||0;var p=B.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(C){var p=C||B.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];
830 this.startPageY=p[1];},addToGroup:function(C){this.groups[C]=true;this.DDM.regDragDrop(this,C);},removeFromGroup:function(C){if(this.groups[C]){delete this.groups[C];}this.DDM.removeDDFromGroup(this,C);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){id=Roo.id(id);
831 }this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){id=Roo.id(id);}A.on(id,"mousedown",this.handleMouseDown,this);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){A.un(this.id,"mousedown",this.handleMouseDown);
832 A.un(this.id,"touchstart",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},destroy:function(){this.unreg();},isLocked:function(){return (this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,C){if(!Roo.isTouch&&this.primaryButtonOnly&&e.button!=0){return;
833 }if(e.browserEvent.touches&&e.browserEvent.touches.length!=1){return;}if(this.isLocked()){return;}this.DDM.refreshCache(this.groups);var pt=new Roo.lib.Point(Roo.lib.Event.getPageX(e),Roo.lib.Event.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}
834 else{if(this.clickValidator(e)){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var C=e.getTarget();return (this.isValidHandleChild(C)&&(this.id==this.handleElId||this.DDM.handleWasClicked(C,this.id)));
835 },addInvalidHandleType:function(C){var D=C.toUpperCase();this.invalidHandleTypes[D]=D;},addInvalidHandleId:function(id){if(typeof id!=="string"){id=Roo.id(id);}this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(C){this.invalidHandleClasses.push(C);
836 },removeInvalidHandleType:function(C){var D=C.toUpperCase();delete this.invalidHandleTypes[D];},removeInvalidHandleId:function(id){if(typeof id!=="string"){id=Roo.id(id);}delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(C){for(var i=0,D=this.invalidHandleClasses.length;
837 i<D;++i){if(this.invalidHandleClasses[i]==C){delete this.invalidHandleClasses[i];}}},isValidHandleChild:function(C){var D=true;var E;try{E=C.nodeName.toUpperCase();}catch(e){E=C.nodeName;}D=D&&!this.invalidHandleTypes[E];D=D&&!this.invalidHandleIds[C.id];
838 for(var i=0,F=this.invalidHandleClasses.length;D&&i<F;++i){D=!B.hasClass(C,this.invalidHandleClasses[i]);}return D;},setXTicks:function(C,D){this.xTicks=[];this.xTickSize=D;var E={};for(var i=this.initPageX;i>=this.minX;i=i-D){if(!E[i]){this.xTicks[this.xTicks.length]=i;
839 E[i]=true;}}for(i=this.initPageX;i<=this.maxX;i=i+D){if(!E[i]){this.xTicks[this.xTicks.length]=i;E[i]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(C,D){this.yTicks=[];this.yTickSize=D;var E={};for(var i=this.initPageY;i>=this.minY;i=i-D){if(!E[i]){this.yTicks[this.yTicks.length]=i;
840 E[i]=true;}}for(i=this.initPageY;i<=this.maxY;i=i+D){if(!E[i]){this.yTicks[this.yTicks.length]=i;E[i]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(C,D,E){this.leftConstraint=C;this.rightConstraint=D;this.minX=this.initPageX-C;this.maxX=this.initPageX+D;
841 if(E){this.setXTicks(this.initPageX,E);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(C,D,E){this.topConstraint=C;
842 this.bottomConstraint=D;this.minY=this.initPageY-C;this.maxY=this.initPageY+D;if(E){this.setYTicks(this.initPageY,E);}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;
843 var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);
844 }},getTick:function(C,D){if(!D){return C;}else if(D[0]>=C){return D[0];}else{for(var i=0,E=D.length;i<E;++i){var F=i+1;if(D[F]&&D[F]>=C){var G=C-D[i];var H=D[F]-C;return (H>G)?D[i]:D[F];}}return D[D.length-1];}},toString:function(){return ("DragDrop "+this.id);
845 }});})();
846 // Roo/dd/DragDropMgr.js
847 if(!Roo.dd.DragDropMgr){Roo.dd.DragDropMgr=function(){var A=Roo.EventManager;return {ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true;
848 },POINT:0,INTERSECT:1,mode:0,_execOnAll:function(B,C){for(var i in this.ids){for(var j in this.ids[i]){var D=this.ids[i][j];if(!this.isTypeOfDD(D)){continue;}D[B].apply(D,C);}}},_onLoad:function(){this.init();if(!Roo.isTouch){A.on(document,"mouseup",this.handleMouseUp,this,true);
849 A.on(document,"mousemove",this.handleMouseMove,this,true);}A.on(document,"touchend",this.handleMouseUp,this,true);A.on(document,"touchmove",this.handleMouseMove,this,true);A.on(window,"unload",this._onUnload,this,true);A.on(window,"resize",this._onResize,this,true);
850 },_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:350,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(B,C){if(!this.initialized){this.init();
851 }if(!this.ids[C]){this.ids[C]={};}this.ids[C][B.id]=B;},removeDDFromGroup:function(B,C){if(!this.ids[C]){this.ids[C]={};}var D=this.ids[C];if(D&&D[B.id]){delete D[B.id];}},_remove:function(B){for(var g in B.groups){if(g&&this.ids[g][B.id]){delete this.ids[g][B.id];
852 }}delete this.handleIds[B.id];},regHandle:function(B,C){if(!this.handleIds[B]){this.handleIds[B]={};}this.handleIds[B][C]=C;},isDragDrop:function(id){return (this.getDDById(id))?true:false;},getRelated:function(B,C){var D=[];for(var i in B.groups){for(j in this.ids[i]){var dd=this.ids[i][j];
853 if(!this.isTypeOfDD(dd)){continue;}if(!C||dd.isTarget){D[D.length]=dd;}}}return D;},isLegalTarget:function(B,C){var D=this.getRelated(B,true);for(var i=0,E=D.length;i<E;++i){if(D[i].id==C.id){return true;}}return false;},isTypeOfDD:function(B){return (B&&B.__ygDragDrop);
854 },isHandle:function(B,C){return (this.handleIds[B]&&this.handleIds[B][C]);},getDDById:function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id];}}return null;},handleMouseDown:function(e,B){if(Roo.QuickTips){Roo.QuickTips.disable();}this.currentTarget=e.getTarget();
855 this.dragCurrent=B;var el=B.getEl();this.startX=e.getPageX();this.startY=e.getPageY();this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var C=Roo.dd.DDM;C.startDrag(C.startX,C.startY);
856 },this.clickTimeThresh);},startDrag:function(x,y){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(x,y);this.dragCurrent.startDrag(x,y);}this.dragThreshMet=true;},handleMouseUp:function(e){if(Roo.QuickTips){Roo.QuickTips.enable();
857 }if(!this.dragCurrent){return;}clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(e,true);}else{}this.stopDrag(e);this.stopEvent(e);},stopEvent:function(e){if(this.stopPropagation){e.stopPropagation();}if(this.preventDefault){e.preventDefault();
858 }},stopDrag:function(e){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(e);this.dragCurrent.endDrag(e);}this.dragCurrent.onMouseUp(e);}this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(e){if(!this.dragCurrent){return true;
859 }if(Roo.isIE&&(e.button!==0&&e.button!==1&&e.button!==2)){this.stopEvent(e);return this.handleMouseUp(e);}if(!this.dragThreshMet){var B=Math.abs(this.startX-e.getPageX());var C=Math.abs(this.startY-e.getPageY());if(B>this.clickPixelThresh||C>this.clickPixelThresh){this.startDrag(this.startX,this.startY);
860 }}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);if(!this.dragCurrent.moveOnly){this.fireEvents(e,false);}}this.stopEvent(e);return true;},fireEvents:function(e,B){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}var pt=e.getPoint();
861 var C=[];var D=[];var E=[];var F=[];var G=[];for(var i in this.dragOvers){var H=this.dragOvers[i];if(!this.isTypeOfDD(H)){continue;}if(!this.isOverTarget(pt,H,this.mode)){D.push(H);}C[i]=true;delete this.dragOvers[i];}for(var I in dc.groups){if("string"!=typeof I){continue;
862 }for(i in this.ids[I]){var J=this.ids[I][i];if(!this.isTypeOfDD(J)){continue;}if(J.isTarget&&!J.isLocked()&&J!=dc){if(this.isOverTarget(pt,J,this.mode)){if(B){F.push(J);}else{if(!C[J.id]){G.push(J);}else{E.push(J);}this.dragOvers[J.id]=J;}}}}}if(this.mode){if(D.length){dc.b4DragOut(e,D);
863 dc.onDragOut(e,D);}if(G.length){dc.onDragEnter(e,G);}if(E.length){dc.b4DragOver(e,E);dc.onDragOver(e,E);}if(F.length){dc.b4DragDrop(e,F);dc.onDragDrop(e,F);}}else{var K=0;for(i=0,K=D.length;i<K;++i){dc.b4DragOut(e,D[i].id);dc.onDragOut(e,D[i].id);}for(i=0,K=G.length;
864 i<K;++i){dc.onDragEnter(e,G[i].id);}for(i=0,K=E.length;i<K;++i){dc.b4DragOver(e,E[i].id);dc.onDragOver(e,E[i].id);}for(i=0,K=F.length;i<K;++i){dc.b4DragDrop(e,F[i].id);dc.onDragDrop(e,F[i].id);}}if(B&&!F.length){dc.onInvalidDrop(e);}},getBestMatch:function(B){var C=null;
865 var D=B.length;if(D==1){C=B[0];}else{for(var i=0;i<D;++i){var dd=B[i];if(dd.cursorIsOver){C=dd;break;}else{if(!C||C.overlap.getArea()<dd.overlap.getArea()){C=dd;}}}}return C;},refreshCache:function(B){for(var C in B){if("string"!=typeof C){continue;}for(var i in this.ids[C]){var D=this.ids[C][i];
866 if(this.isTypeOfDD(D)){var E=this.getLocation(D);if(E){this.locationCache[D.id]=E;}else{delete this.locationCache[D.id];}}}}},verifyEl:function(el){if(el){var B;if(Roo.isIE){try{B=el.offsetParent;}catch(e){}}else{B=el.offsetParent;}if(B){return true;}}return false;
867 },getLocation:function(B){if(!this.isTypeOfDD(B)){return null;}var el=B.getEl(),C,x1,x2,y1,y2,t,r,b,l;try{C=Roo.lib.Dom.getXY(el);}catch(e){}if(!C){return null;}x1=C[0];x2=x1+el.offsetWidth;y1=C[1];y2=y1+el.offsetHeight;t=y1-B.padding[0];r=x2+B.padding[1];
868 b=y2+B.padding[2];l=x1-B.padding[3];return new Roo.lib.Region(t,r,b,l);},isOverTarget:function(pt,B,C){var D=this.locationCache[B.id];if(!D||!this.useCache){D=this.getLocation(B);this.locationCache[B.id]=D;}if(!D){return false;}B.cursorIsOver=D.contains(pt);
869 var dc=this.dragCurrent;if(!dc||!dc.getTargetCoord||(!C&&!dc.constrainX&&!dc.constrainY)){return B.cursorIsOver;}B.overlap=null;var E=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();var F=new Roo.lib.Region(E.y,E.x+el.offsetWidth,E.y+el.offsetHeight,E.x);
870 var G=F.intersect(D);if(G){B.overlap=G;return (C)?true:B.cursorIsOver;}else{return false;}},_onUnload:function(e,me){Roo.dd.DragDropMgr.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}this._execOnAll("unreg",[]);
871 for(i in this.elementCache){delete this.elementCache[i];}this.elementCache={};this.ids={};},elementCache:{},getElWrapper:function(id){var B=this.elementCache[id];if(!B||!B.el){B=this.elementCache[id]=new this.ElementWrapper(Roo.getDom(id));}return B;},getElement:function(id){return Roo.getDom(id);
872 },getCss:function(id){var el=Roo.getDom(id);return (el)?el.style:null;},ElementWrapper:function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style;},getPosX:function(el){return Roo.lib.Dom.getX(el);},getPosY:function(el){return Roo.lib.Dom.getY(el);
873 },swapNode:function(n1,n2){if(n1.swapNode){n1.swapNode(n2);}else{var p=n2.parentNode;var s=n2.nextSibling;if(s==n1){p.insertBefore(n1,n2);}else if(n2==n1.nextSibling){p.insertBefore(n2,n1);}else{n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}}},getScroll:function(){var t,l,B=document.documentElement,db=document.body;
874 if(B&&(B.scrollTop||B.scrollLeft)){t=B.scrollTop;l=B.scrollLeft;}else if(db){t=db.scrollTop;l=db.scrollLeft;}else{}return {top:t,left:l};},getStyle:function(el,B){return Roo.fly(el).getStyle(B);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;
875 },moveToEl:function(B,C){var D=Roo.lib.Dom.getXY(C);Roo.lib.Dom.setXY(B,D);},numericSort:function(a,b){return (a-b);},_timeoutCount:0,_addListeners:function(){var B=Roo.dd.DDM;if(Roo.lib.Event&&document){B._onLoad();}else{if(B._timeoutCount>2000){}else{setTimeout(B._addListeners,10);
876 if(document&&document.body){B._timeoutCount+=1;}}}},handleWasClicked:function(B,id){if(this.isHandle(id,B.id)){return true;}else{var p=B.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}return false;}};}();Roo.dd.DDM=Roo.dd.DragDropMgr;
877 Roo.dd.DDM._addListeners();}
878 // Roo/dd/DD.js
879 Roo.dd.DD=function(id,A,B){if(id){this.init(id,A,B);}};Roo.extend(Roo.dd.DD,Roo.dd.DragDrop,{scroll:true,autoOffset:function(A,B){var x=A-this.startPageX;var y=B-this.startPageY;this.setDelta(x,y);},setDelta:function(A,B){this.deltaX=A;this.deltaY=B;},setDragElPos:function(A,B){var el=this.getDragEl();
880 this.alignElWithMouse(el,A,B);},alignElWithMouse:function(el,A,B){var C=this.getTargetCoord(A,B);var D=el.dom?el:Roo.fly(el);if(!this.deltaSetXY){var E=[C.x,C.y];D.setXY(E);var F=D.getLeft(true);var G=D.getTop(true);this.deltaSetXY=[F-C.x,G-C.y];}else{D.setLeftTop(C.x+this.deltaSetXY[0],C.y+this.deltaSetXY[1]);
881 }this.cachePosition(C.x,C.y);this.autoScroll(C.x,C.y,el.offsetHeight,el.offsetWidth);return C;},cachePosition:function(A,B){if(A){this.lastPageX=A;this.lastPageY=B;}else{var C=Roo.lib.Dom.getXY(this.getEl());this.lastPageX=C[0];this.lastPageY=C[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var A=Roo.lib.Dom.getViewWidth();
882 var B=Roo.lib.Dom.getViewHeight();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var C=h+y;var D=w+x;var E=(A+st-y-this.deltaY);var F=(B+sl-x-this.deltaX);var G=40;var H=(document.all)?80:30;if(C>A&&E<G){window.scrollTo(sl,st+H);}if(y<st&&st>0&&y-st<G){window.scrollTo(sl,st-H);
883 }if(D>B&&F<G){window.scrollTo(sl+H,st);}if(x<sl&&sl>0&&x-sl<G){window.scrollTo(sl-H,st);}}},getTargetCoord:function(A,B){var x=A-this.deltaX;var y=B-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX;}if(x>this.maxX){x=this.maxX;}}if(this.constrainY){if(y<this.minY){y=this.minY;
884 }if(y>this.maxY){y=this.maxY;}}x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y};},applyConfig:function(){Roo.dd.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.autoOffset(e.getPageX(),e.getPageY());
885 },b4Drag:function(e){this.setDragElPos(e.getPageX(),e.getPageY());},toString:function(){return ("DD "+this.id);}});
886 // Roo/dd/DDProxy.js
887 Roo.dd.DDProxy=function(id,A,B){if(id){this.init(id,A,B);this.initFrame();}};Roo.dd.DDProxy.dragElId="ygddfdiv";Roo.extend(Roo.dd.DDProxy,Roo.dd.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var A=this;var B=document.body;if(!B||!B.firstChild){setTimeout(function(){A.createFrame();
888 },50);return;}var C=this.getDragEl();if(!C){C=document.createElement("div");C.id=this.dragElId;var s=C.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;B.insertBefore(C,B.firstChild);}},initFrame:function(){this.createFrame();
889 },applyConfig:function(){Roo.dd.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||Roo.dd.DDProxy.dragElId);},showFrame:function(A,B){var el=this.getEl();
890 var C=this.getDragEl();var s=C.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}this.setDragElPos(A,B);Roo.fly(C).show();},_resizeProxy:function(){if(this.resizeFrame){var el=this.getEl();
891 Roo.fly(this.getDragEl()).setSize(el.offsetWidth,el.offsetHeight);}},b4MouseDown:function(e){var x=e.getPageX();var y=e.getPageY();this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){Roo.fly(this.getDragEl()).hide();
892 },endDrag:function(e){var A=this.getEl();var B=this.getDragEl();B.style.visibility="";this.beforeMove();A.style.visibility="hidden";Roo.dd.DDM.moveToEl(A,B);B.style.visibility="hidden";A.style.visibility="";this.afterDrag();},beforeMove:function(){},afterDrag:function(){}
893 ,toString:function(){return ("DDProxy "+this.id);}});
894 // Roo/dd/DDTarget.js
895 Roo.dd.DDTarget=function(id,A,B){if(id){this.initTarget(id,A,B);}if(B&&(B.listeners||B.events)){Roo.dd.DragDrop.superclass.constructor.call(this,{listeners:B.listeners||{},events:B.events||{}});}};Roo.extend(Roo.dd.DDTarget,Roo.dd.DragDrop,{toString:function(){return ("DDTarget "+this.id);
896 }});
897 // Roo/dd/ScrollManager.js
898 Roo.dd.ScrollManager=function(){var A=Roo.dd.DragDropMgr;var B={};var C=null;var D={};var E=function(e){C=null;H();};var F=function(){if(A.dragCurrent){A.refreshCache(A.dragCurrent.groups);}};var G=function(){if(A.dragCurrent){var K=Roo.dd.ScrollManager;if(!K.animate){if(D.el.scroll(D.dir,K.increment)){F();
899 }}else{D.el.scroll(D.dir,K.increment,true,K.animDuration,F);}}};var H=function(){if(D.id){clearInterval(D.id);}D.id=0;D.el=null;D.dir="";};var I=function(el,K){Roo.log('scroll startproc');H();D.el=el;D.dir=K;D.id=setInterval(G,Roo.dd.ScrollManager.frequency);
900 };var J=function(e,K){if(K||!A.dragCurrent){return;}var L=Roo.dd.ScrollManager;if(!C||C!=A.dragCurrent){C=A.dragCurrent;L.refreshCache();}var xy=Roo.lib.Event.getXY(e);var pt=new Roo.lib.Point(xy[0],xy[1]);for(var id in B){var el=B[id],r=el._region;if(r&&r.contains(pt)&&el.isScrollable()){if(r.bottom-pt.y<=L.thresh){if(D.el!=el){I(el,"down");
901 }return;}else if(r.right-pt.x<=L.thresh){if(D.el!=el){I(el,"left");}return;}else if(pt.y-r.top<=L.thresh){if(D.el!=el){I(el,"up");}return;}else if(pt.x-r.left<=L.thresh){if(D.el!=el){I(el,"right");}return;}}}H();};A.fireEvents=A.fireEvents.createSequence(J,A);
902 A.stopDrag=A.stopDrag.createSequence(E,A);return {register:function(el){if(el instanceof Array){for(var i=0,K=el.length;i<K;i++){this.register(el[i]);}}else{el=Roo.get(el);B[el.id]=el;}Roo.dd.ScrollManager.els=B;},unregister:function(el){if(el instanceof Array){for(var i=0,K=el.length;
903 i<K;i++){this.unregister(el[i]);}}else{el=Roo.get(el);delete B[el.id];}},thresh:25,increment:100,frequency:500,animate:true,animDuration:.4,refreshCache:function(){for(var id in B){if(typeof B[id]=='object'){B[id]._region=B[id].getRegion();}}}};}();
904 // Roo/dd/Registry.js
905 Roo.dd.Registry=function(){var A={};var B={};var C=0;var D=function(el,E){if(typeof el=="string"){return el;}var id=el.id;if(!id&&E!==false){id="roodd-"+(++C);el.id=id;}return id;};return {register:function(el,E){E=E||{};if(typeof el=="string"){el=document.getElementById(el);
906 }E.ddel=el;A[D(el)]=E;if(E.isHandle!==false){B[E.ddel.id]=E;}if(E.handles){var hs=E.handles;for(var i=0,F=hs.length;i<F;i++){B[D(hs[i])]=E;}}},unregister:function(el){var id=D(el,false);var E=A[id];if(E){delete A[id];if(E.handles){var hs=E.handles;for(var i=0,F=hs.length;
907 i<F;i++){delete B[D(hs[i],false)];}}}},getHandle:function(id){if(typeof id!="string"){id=id.id;}return B[id];},getHandleFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);return t?B[t.id]:null;},getTarget:function(id){if(typeof id!="string"){id=id.id;
908 }return A[id];},getTargetFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);return t?A[t.id]||B[t.id]:null;}};}();
909 // Roo/dd/StatusProxy.js
910 Roo.dd.StatusProxy=function(A){Roo.apply(this,A);this.id=this.id||Roo.id();this.el=new Roo.Layer({dh:{id:this.id,tag:"div",cls:"x-dd-drag-proxy "+this.dropNotAllowed,children:[{tag:"div",cls:"x-dd-drop-icon"},{tag:"div",cls:"x-dd-drag-ghost"}]},shadow:!A||A.shadow!==false}
911 );this.ghost=Roo.get(this.el.dom.childNodes[1]);this.dropStatus=this.dropNotAllowed;};Roo.dd.StatusProxy.prototype={dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",setStatus:function(A){A=A||this.dropNotAllowed;if(this.dropStatus!=A){this.el.replaceClass(this.dropStatus,A);
912 this.dropStatus=A;}},reset:function(A){this.el.dom.className="x-dd-drag-proxy "+this.dropNotAllowed;this.dropStatus=this.dropNotAllowed;if(A){this.ghost.update("");}},update:function(A){if(typeof A=="string"){this.ghost.update(A);}else{this.ghost.update("");
913 A.style.margin="0";this.ghost.dom.appendChild(A);}var el=this.ghost.dom.firstChild;if(el){Roo.fly(el).setStyle('float','none');}},getEl:function(){return this.el;},getGhost:function(){return this.ghost;},hide:function(A){this.el.hide();if(A){this.reset(true);
914 }},stop:function(){if(this.anim&&this.anim.isAnimated&&this.anim.isAnimated()){this.anim.stop();}},show:function(){this.el.show();},sync:function(){this.el.sync();},repair:function(xy,A,B){this.callback=A;this.scope=B;if(xy&&this.animRepair!==false){this.el.addClass("x-dd-drag-repair");
915 this.el.hideUnders(true);this.anim=this.el.shift({duration:this.repairDuration||.5,easing:'easeOut',xy:xy,stopFx:true,callback:this.afterRepair,scope:this});}else{this.afterRepair();}},afterRepair:function(){this.hide(true);if(typeof this.callback=="function"){this.callback.call(this.scope||this);
916 }this.callback=null;this.scope=null;}};
917 // Roo/dd/DragSource.js
918 Roo.dd.DragSource=function(el,A){this.el=Roo.get(el);this.dragData={};Roo.apply(this,A);if(!this.proxy){this.proxy=new Roo.dd.StatusProxy();}Roo.dd.DragSource.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{dragElId:this.proxy.id,resizeFrame:false,isTarget:false,scroll:this.scroll===true}
919 );this.dragging=false;};Roo.extend(Roo.dd.DragSource,Roo.dd.DDProxy,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",getDragData:function(e){return this.dragData;},onDragEnter:function(e,id){var A=Roo.dd.DragDropMgr.getDDById(id);this.cachedTarget=A;
920 if(this.beforeDragEnter(A,e,id)!==false){if(A.isNotifyTarget){var B=A.notifyEnter(this,e,this.dragData);this.proxy.setStatus(B);}else{this.proxy.setStatus(this.dropAllowed);}if(this.afterDragEnter){this.afterDragEnter(A,e,id);}}},beforeDragEnter:function(A,e,id){return true;
921 },alignElWithMouse:function(){Roo.dd.DragSource.superclass.alignElWithMouse.apply(this,arguments);this.proxy.sync();},onDragOver:function(e,id){var A=this.cachedTarget||Roo.dd.DragDropMgr.getDDById(id);if(this.beforeDragOver(A,e,id)!==false){if(A.isNotifyTarget){var B=A.notifyOver(this,e,this.dragData);
922 this.proxy.setStatus(B);}if(this.afterDragOver){this.afterDragOver(A,e,id);}}},beforeDragOver:function(A,e,id){return true;},onDragOut:function(e,id){var A=this.cachedTarget||Roo.dd.DragDropMgr.getDDById(id);if(this.beforeDragOut(A,e,id)!==false){if(A.isNotifyTarget){A.notifyOut(this,e,this.dragData);
923 }this.proxy.reset();if(this.afterDragOut){this.afterDragOut(A,e,id);}}this.cachedTarget=null;},beforeDragOut:function(A,e,id){return true;},onDragDrop:function(e,id){var A=this.cachedTarget||Roo.dd.DragDropMgr.getDDById(id);if(this.beforeDragDrop(A,e,id)!==false){if(A.isNotifyTarget){if(A.notifyDrop(this,e,this.dragData)){this.onValidDrop(A,e,id);
924 }else{this.onInvalidDrop(A,e,id);}}else{this.onValidDrop(A,e,id);}if(this.afterDragDrop){this.afterDragDrop(A,e,id);}}delete this.cachedTarget;},beforeDragDrop:function(A,e,id){return true;},onValidDrop:function(A,e,id){this.hideProxy();if(this.afterValidDrop){this.afterValidDrop(A,e,id);
925 }},getRepairXY:function(e,A){return this.el.getXY();},onInvalidDrop:function(A,e,id){this.beforeInvalidDrop(A,e,id);if(this.cachedTarget){if(this.cachedTarget.isNotifyTarget){this.cachedTarget.notifyOut(this,e,this.dragData);}this.cacheTarget=null;}this.proxy.repair(this.getRepairXY(e,this.dragData),this.afterRepair,this);
926 if(this.afterInvalidDrop){this.afterInvalidDrop(e,id);}},afterRepair:function(){if(Roo.enableFx){this.el.highlight(this.hlColor||"c3daf9");}this.dragging=false;},beforeInvalidDrop:function(A,e,id){return true;},handleMouseDown:function(e){if(this.dragging){return;
927 }var A=this.getDragData(e);if(A&&this.onBeforeDrag(A,e)!==false){this.dragData=A;this.proxy.stop();Roo.dd.DragSource.superclass.handleMouseDown.apply(this,arguments);}},onBeforeDrag:function(A,e){return true;},onStartDrag:Roo.emptyFn,startDrag:function(x,y){this.proxy.reset();
928 this.dragging=true;this.proxy.update("");this.onInitDrag(x,y);this.proxy.show();},onInitDrag:function(x,y){var A=this.el.dom.cloneNode(true);A.id=Roo.id();this.proxy.update(A);this.onStartDrag(x,y);return true;},getProxy:function(){return this.proxy;},hideProxy:function(){this.proxy.hide();
929 this.proxy.reset(true);this.dragging=false;},triggerCacheRefresh:function(){Roo.dd.DDM.refreshCache(this.groups);},b4EndDrag:function(e){},endDrag:function(e){this.onEndDrag(this.dragData,e);},onEndDrag:function(A,e){},autoOffset:function(x,y){this.setDelta(-12,-20);
930 }});
931 // Roo/dd/DropTarget.js
932 Roo.dd.DropTarget=function(el,A){this.el=Roo.get(el);var B=false;;if(A&&A.listeners){B=A.listeners;delete A.listeners;}Roo.apply(this,A);if(this.containerScroll){Roo.dd.ScrollManager.register(this.el);}this.addEvents({"enter":true,"over":true,"out":true,"drop":true}
933 );Roo.dd.DropTarget.superclass.constructor.call(this,this.el.dom,this.ddGroup||this.group,{isTarget:true,listeners:B||{}});};Roo.extend(Roo.dd.DropTarget,Roo.dd.DDTarget,{dropAllowed:"x-dd-drop-ok",dropNotAllowed:"x-dd-drop-nodrop",success:false,valid:false,isTarget:true,isNotifyTarget:true,notifyEnter:function(dd,e,A){this.valid=true;
934 this.fireEvent('enter',dd,e,A);if(this.overClass){this.el.addClass(this.overClass);}return typeof(this.valid)=='string'?'x-dd-drop-'+this.valid:(this.valid?this.dropAllowed:this.dropNotAllowed);},notifyOver:function(dd,e,A){this.valid=true;this.fireEvent('over',dd,e,A);
935 return typeof(this.valid)=='string'?'x-dd-drop-'+this.valid:(this.valid?this.dropAllowed:this.dropNotAllowed);},notifyOut:function(dd,e,A){this.fireEvent('out',dd,e,A);if(this.overClass){this.el.removeClass(this.overClass);}},notifyDrop:function(dd,e,A){this.success=false;
936 this.fireEvent('drop',dd,e,A);return this.success;}});
937 // Roo/dd/DragZone.js
938 Roo.dd.DragZone=function(el,A){Roo.dd.DragZone.superclass.constructor.call(this,el,A);if(this.containerScroll){Roo.dd.ScrollManager.register(this.el);}};Roo.extend(Roo.dd.DragZone,Roo.dd.DragSource,{getDragData:function(e){return Roo.dd.Registry.getHandleFromEvent(e);
939 },onInitDrag:function(x,y){this.proxy.update(this.dragData.ddel.cloneNode(true));this.onStartDrag(x,y);return true;},afterRepair:function(){if(Roo.enableFx){Roo.Element.fly(this.dragData.ddel).highlight(this.hlColor||"c3daf9");}this.dragging=false;},getRepairXY:function(e){return Roo.Element.fly(this.dragData.ddel).getXY();
940 }});
941 // Roo/dd/DropZone.js
942 Roo.dd.DropZone=function(el,A){Roo.dd.DropZone.superclass.constructor.call(this,el,A);};Roo.extend(Roo.dd.DropZone,Roo.dd.DropTarget,{getTargetFromEvent:function(e){return Roo.dd.Registry.getTargetFromEvent(e);},onNodeEnter:function(n,dd,e,A){},onNodeOver:function(n,dd,e,A){return this.dropAllowed;
943 },onNodeOut:function(n,dd,e,A){},onNodeDrop:function(n,dd,e,A){return false;},onContainerOver:function(dd,e,A){return this.dropNotAllowed;},onContainerDrop:function(dd,e,A){return false;},notifyEnter:function(dd,e,A){return this.dropNotAllowed;},notifyOver:function(dd,e,A){var n=this.getTargetFromEvent(e);
944 if(!n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null;}return this.onContainerOver(dd,e,A);}if(this.lastOverNode!=n){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);}this.onNodeEnter(n,dd,e,A);this.lastOverNode=n;
945 }return this.onNodeOver(n,dd,e,A);},notifyOut:function(dd,e,A){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null;}},notifyDrop:function(dd,e,A){if(this.lastOverNode){this.onNodeOut(this.lastOverNode,dd,e,A);this.lastOverNode=null;
946 }var n=this.getTargetFromEvent(e);return n?this.onNodeDrop(n,dd,e,A):this.onContainerDrop(dd,e,A);},triggerCacheRefresh:function(){Roo.dd.DDM.refreshCache(this.groups);}});
947 // Roo/data/SortTypes.js
948 Roo.data.SortTypes={none:function(s){return s;},stripTagsRE:/<\/?[^>]+>/gi,asText:function(s){return String(s).replace(this.stripTagsRE,"");},asUCText:function(s){return String(s).toUpperCase().replace(this.stripTagsRE,"");},asUCString:function(s){return String(s).toUpperCase();
949 },asDate:function(s){if(!s){return 0;}if(s instanceof Date){return s.getTime();}return Date.parse(String(s));},asFloat:function(s){var A=parseFloat(String(s).replace(/,/g,""));if(isNaN(A)){A=0;}return A;},asInt:function(s){var A=parseInt(String(s).replace(/,/g,""));
950 if(isNaN(A)){A=0;}return A;}};
951 // Roo/data/Record.js
952 Roo.data.Record=function(A,id){this.id=(id||id===0)?id:++Roo.data.Record.AUTO_ID;this.data=A;};Roo.data.Record.create=function(o){var f=function(){f.superclass.constructor.apply(this,arguments);};Roo.extend(f,Roo.data.Record);var p=f.prototype;p.fields=new Roo.util.MixedCollection(false,function(B){return B.name;
953 });for(var i=0,A=o.length;i<A;i++){p.fields.add(new Roo.data.Field(o[i]));}f.getField=function(B){return p.fields.get(B);};return f;};Roo.data.Record.AUTO_ID=1000;Roo.data.Record.EDIT='edit';Roo.data.Record.REJECT='reject';Roo.data.Record.COMMIT='commit';
954 Roo.data.Record.prototype={dirty:false,editing:false,error:null,modified:null,join:function(A){this.store=A;},set:function(A,B){if(this.data[A]==B){return;}this.dirty=true;if(!this.modified){this.modified={};}if(typeof this.modified[A]=='undefined'){this.modified[A]=this.data[A];
955 }this.data[A]=B;if(!this.editing&&this.store){this.store.afterEdit(this);}},get:function(A){return this.data[A];},beginEdit:function(){this.editing=true;this.modified={};},cancelEdit:function(){this.editing=false;delete this.modified;},endEdit:function(){this.editing=false;
956 if(this.dirty&&this.store){this.store.afterEdit(this);}},reject:function(){var m=this.modified;for(var n in m){if(typeof m[n]!="function"){this.data[n]=m[n];}}this.dirty=false;delete this.modified;this.editing=false;if(this.store){this.store.afterReject(this);
957 }},commit:function(){this.dirty=false;delete this.modified;this.editing=false;if(this.store){this.store.afterCommit(this);}},hasError:function(){return this.error!=null;},clearError:function(){this.error=null;},copy:function(A){return new this.constructor(Roo.apply({}
958 ,this.data),A||this.id);}};
959 // Roo/data/Store.js
960 Roo.data.Store=function(A){this.data=new Roo.util.MixedCollection(false);this.data.getKey=function(o){return o.id;};this.baseParams={};this.paramNames={"start":"start","limit":"limit","sort":"sort","dir":"dir","multisort":"_multisort"};if(A&&A.data){this.inlineData=A.data;
961 delete A.data;}Roo.apply(this,A);if(this.reader){this.reader=Roo.factory(this.reader,Roo.data);this.reader.xmodule=this.xmodule||false;if(!this.recordType){this.recordType=this.reader.recordType;}if(this.reader.onMetaChange){this.reader.onMetaChange=this.onMetaChange.createDelegate(this);
962 }}if(this.recordType){this.fields=this.recordType.prototype.fields;}this.modified=[];this.addEvents({datachanged:true,metachange:true,add:true,remove:true,update:true,clear:true,beforeload:true,beforeloadadd:true,load:true,loadexception:true});if(this.proxy){this.proxy=Roo.factory(this.proxy,Roo.data);
963 this.proxy.xmodule=this.xmodule||false;this.relayEvents(this.proxy,["loadexception"]);}this.sortToggle={};this.sortOrder=[];Roo.data.Store.superclass.constructor.call(this);if(this.inlineData){this.loadData(this.inlineData);delete this.inlineData;}};Roo.extend(Roo.data.Store,Roo.util.Observable,{multiSort:false,remoteSort:false,pruneModifiedRecords:false,lastOptions:null,add:function(A){A=[].concat(A);
964 for(var i=0,B=A.length;i<B;i++){A[i].join(this);}var C=this.data.length;this.data.addAll(A);this.fireEvent("add",this,A,C);},remove:function(A){var B=this.data.indexOf(A);this.data.removeAt(B);if(this.pruneModifiedRecords){this.modified.remove(A);}this.fireEvent("remove",this,A,B);
965 },removeAll:function(){this.data.clear();if(this.pruneModifiedRecords){this.modified=[];}this.fireEvent("clear",this);},insert:function(A,B){B=[].concat(B);for(var i=0,C=B.length;i<C;i++){this.data.insert(A,B[i]);B[i].join(this);}this.fireEvent("add",this,B,A);
966 },indexOf:function(A){return this.data.indexOf(A);},indexOfId:function(id){return this.data.indexOfKey(id);},getById:function(id){return this.data.key(id);},getAt:function(A){return this.data.itemAt(A);},getRange:function(A,B){return this.data.getRange(A,B);
967 },storeOptions:function(o){o=Roo.apply({},o);delete o.callback;delete o.scope;this.lastOptions=o;},load:function(A){A=A||{};if(this.fireEvent("beforeload",this,A)!==false){this.storeOptions(A);var p=Roo.apply(A.params||{},this.baseParams);if(!this.reader.metaFromRemote){p._requestMeta=1;
968 }if(this.sortInfo&&this.remoteSort){var pn=this.paramNames;p[pn["sort"]]=this.sortInfo.field;p[pn["dir"]]=this.sortInfo.direction;}if(this.multiSort){var pn=this.paramNames;p[pn["multisort"]]=Roo.encode({sort:this.sortToggle,order:this.sortOrder});}this.proxy.load(p,this.reader,this.loadRecords,this,A);
969 }},reload:function(A){this.load(Roo.applyIf(A||{},this.lastOptions));},loadRecords:function(o,A,B){if(!o){if(B!==false){this.fireEvent("load",this,[],A,o);}if(A.callback){A.callback.call(A.scope||this,[],A,false);}return;}if(o.success===false){if(!this.hasListener('loadexception')&&typeof(o.raw.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",o.raw.errorMsg);
970 }this.fireEvent("loadexception",this,o,A,o.raw.errorMsg);return;}var r=o.records,t=o.totalRecords||r.length;this.fireEvent("beforeloadadd",this,r,A,o);if(!A||A.add!==true){if(this.pruneModifiedRecords){this.modified=[];}for(var i=0,C=r.length;i<C;i++){r[i].join(this);
971 }if(this.snapshot){this.data=this.snapshot;delete this.snapshot;}this.data.clear();this.data.addAll(r);this.totalLength=t;this.applySort();this.fireEvent("datachanged",this);}else{this.totalLength=Math.max(t,this.data.length+r.length);this.add(r);}if(this.parent&&!Roo.isIOS&&!this.useNativeIOS&&this.parent.emptyTitle.length){var e=new Roo.data.Record({}
972 );e.set(this.parent.displayField,this.parent.emptyTitle);e.set(this.parent.valueField,'');this.insert(0,e);}this.fireEvent("load",this,r,A,o);if(A.callback){A.callback.call(A.scope||this,r,A,true);}},loadData:function(o,A){var r=this.reader.readRecords(o);
973 this.loadRecords(r,{add:A},true);},loadDataFromChildren:function(A){this.loadData(this.reader.toLoadData(A));},getCount:function(){return this.data.length||0;},getTotalCount:function(){return this.totalLength||0;},getSortState:function(){return this.sortInfo;
974 },applySort:function(){if(this.sortInfo&&!this.remoteSort){var s=this.sortInfo,f=s.field;var st=this.fields.get(f).sortType;var fn=function(r1,r2){var v1=st(r1.data[f]),v2=st(r2.data[f]);return v1>v2?1:(v1<v2?-1:0);};this.data.sort(s.direction,fn);if(this.snapshot&&this.snapshot!=this.data){this.snapshot.sort(s.direction,fn);
975 }}},setDefaultSort:function(A,B){this.sortInfo={field:A,direction:B?B.toUpperCase():"ASC"};},sort:function(A,B){var f=this.fields.get(A);if(!B){this.sortToggle[f.name]=this.sortToggle[f.name]||f.sortDir;if(this.multiSort||(this.sortInfo&&this.sortInfo.field==f.name)){B=(this.sortToggle[f.name]||"ASC").toggle("ASC","DESC");
976 }else{B=f.sortDir;}}this.sortToggle[f.name]=B;this.sortInfo={field:f.name,direction:B};if(!this.remoteSort){this.applySort();this.fireEvent("datachanged",this);}else{this.load(this.lastOptions);}},each:function(fn,A){this.data.each(fn,A);},getModifiedRecords:function(){return this.modified;
977 },createFilterFn:function(A,B,C){if(!B.exec){B=String(B);if(B.length==0){return false;}B=new RegExp((C===true?'':'^')+Roo.escapeRe(B),"i");}return function(r){return B.test(r.data[A]);};},sum:function(A,B,C){var rs=this.data.items,v=0;B=B||0;C=(C||C===0)?C:rs.length-1;
978 for(var i=B;i<=C;i++){v+=(rs[i].data[A]||0);}return v;},filter:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.filterBy(fn):this.clearFilter();},filterBy:function(fn,A){this.snapshot=this.snapshot||this.data;this.data=this.queryBy(fn,A||this);
979 this.fireEvent("datachanged",this);},query:function(A,B,C){var fn=this.createFilterFn(A,B,C);return fn?this.queryBy(fn):this.data.clone();},queryBy:function(fn,A){var B=this.snapshot||this.data;return B.filterBy(fn,A||this);},collect:function(A,B,C){var d=(C===true&&this.snapshot)?this.snapshot.items:this.data.items;
980 var v,sv,r=[],l={};for(var i=0,D=d.length;i<D;i++){v=d[i].data[A];sv=String(v);if((B||!Roo.isEmpty(v))&&!l[sv]){l[sv]=true;r[r.length]=v;}}return r;},clearFilter:function(A){if(this.snapshot&&this.snapshot!=this.data){this.data=this.snapshot;delete this.snapshot;
981 if(A!==true){this.fireEvent("datachanged",this);}}},afterEdit:function(A){if(this.modified.indexOf(A)==-1){this.modified.push(A);}this.fireEvent("update",this,A,Roo.data.Record.EDIT);},afterReject:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.REJECT);
982 },afterCommit:function(A){this.modified.remove(A);this.fireEvent("update",this,A,Roo.data.Record.COMMIT);},commitChanges:function(){var m=this.modified.slice(0);this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].commit();}},rejectChanges:function(){var m=this.modified.slice(0);
983 this.modified=[];for(var i=0,A=m.length;i<A;i++){m[i].reject();}},onMetaChange:function(A,B,o){this.recordType=B;this.fields=B.prototype.fields;delete this.snapshot;this.sortInfo=A.sortInfo||this.sortInfo;this.modified=[];this.fireEvent('metachange',this,this.reader.meta);
984 },moveIndex:function(A,B){var C=this.indexOf(A);var D=C+B;this.remove(A);this.insert(D,A);}});
985 // Roo/data/SimpleStore.js
986 Roo.data.SimpleStore=function(A){Roo.data.SimpleStore.superclass.constructor.call(this,{isLocal:true,reader:typeof(A.reader)!='undefined'?A.reader:new Roo.data.ArrayReader({id:A.id},Roo.data.Record.create(A.fields)),proxy:new Roo.data.MemoryProxy(A.data)});
987 this.load();};Roo.extend(Roo.data.SimpleStore,Roo.data.Store);
988 // Roo/data/JsonStore.js
989 Roo.data.JsonStore=function(c){Roo.data.JsonStore.superclass.constructor.call(this,Roo.apply(c,{proxy:!c.data?new Roo.data.HttpProxy({url:c.url}):undefined,reader:new Roo.data.JsonReader(c,c.fields)}));};Roo.extend(Roo.data.JsonStore,Roo.data.Store);
990 // Roo/data/Field.js
991 Roo.data.Field=function(A){if(typeof A=="string"){A={name:A};}Roo.apply(this,A);if(!this.type){this.type="auto";}var st=Roo.data.SortTypes;if(typeof this.sortType=="string"){this.sortType=st[this.sortType];}if(!this.sortType){switch(this.type){case "string":this.sortType=st.asUCString;
992 break;case "date":this.sortType=st.asDate;break;default:this.sortType=st.none;}}var B=/[\$,%]/g;if(!this.convert){var cv,C=this.dateFormat;switch(this.type){case "":case "auto":case undefined:cv=function(v){return v;};break;case "string":cv=function(v){return (v===undefined||v===null)?'':String(v);
993 };break;case "int":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseInt(String(v).replace(B,""),10):'';};break;case "float":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseFloat(String(v).replace(B,""),10):'';};break;case "bool":case "boolean":cv=function(v){return v===true||v==="true"||v==1;
994 };break;case "date":cv=function(v){if(!v){return '';}if(v instanceof Date){return v;}if(C){if(C=="timestamp"){return new Date(v*1000);}return Date.parseDate(v,C);}var D=Date.parse(v);return D?new Date(D):null;};break;}this.convert=cv;}};Roo.data.Field.prototype={dateFormat:null,defaultValue:"",mapping:null,sortType:null,sortDir:"ASC"}
995 ;
996 // Roo/data/DataReader.js
997 Roo.data.DataReader=function(A,B){this.meta=A;this.recordType=B instanceof Array?Roo.data.Record.create(B):B;};Roo.data.DataReader.prototype={readerType:'Data',newRow:function(d){var da={};this.recordType.prototype.fields.each(function(c){switch(c.type){case 'int':da[c.name]=0;
998 break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break;case 'boolean':da[c.name]=false;break;default:da[c.name]="";break;}});return new this.recordType(Roo.apply(da,d));}};
999 // Roo/data/DataProxy.js
1000 Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable);
1001 // Roo/data/MemoryProxy.js
1002 Roo.data.MemoryProxy=function(A){var B=A;if(typeof(A)!='undefined'&&typeof(A.data)!='undefined'){B=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=B;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{}
1003 ;var F;try{F=B.readRecords(A.data?A.data:this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}});
1004 // Roo/data/HttpProxy.js
1005 Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{}
1006 ,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false);
1007 }},loadResponse:function(o,A,B){delete this.activeRequest;if(!A){this.fireEvent("loadexception",this,o,B);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}var C;try{C=o.reader.read(B);}catch(e){o.success=false;o.raw={errorMsg:B.responseText}
1008 ;this.fireEvent("loadexception",this,o,B,e);o.request.callback.call(o.request.scope,o,o.request.arg,false);return;}this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,C,o.request.arg,true);},update:function(A){},updateResponse:function(A){}
1009 });
1010 // Roo/data/ScriptTagProxy.js
1011 Roo.data.ScriptTagProxy=function(A){Roo.data.ScriptTagProxy.superclass.constructor.call(this);Roo.apply(this,A);this.head=document.getElementsByTagName("head")[0];};Roo.data.ScriptTagProxy.TRANS_ID=1000;Roo.extend(Roo.data.ScriptTagProxy,Roo.data.DataProxy,{timeout:30000,callbackParam:"callback",nocache:true,load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var p=Roo.urlEncode(Roo.apply(A,this.extraParams));
1012 var F=this.url;F+=(F.indexOf("?")!=-1?"&":"?")+p;if(this.nocache){F+="&_dc="+(new Date().getTime());}var G=++Roo.data.ScriptTagProxy.TRANS_ID;var H={id:G,cb:"stcCallback"+G,scriptId:"stcScript"+G,params:A,arg:E,url:F,callback:C,scope:D,reader:B};var I=this;
1013 window[H.cb]=function(o){I.handleResponse(o,H);};F+=String.format("&{0}={1}",this.callbackParam,H.cb);if(this.autoAbort!==false){this.abort();}H.timeoutId=this.handleFailure.defer(this.timeout,this,[H]);var J=document.createElement("script");J.setAttribute("src",F);
1014 J.setAttribute("type","text/javascript");J.setAttribute("id",H.scriptId);this.head.appendChild(J);this.trans=H;}else{C.call(D||this,null,E,false);}},isLoading:function(){return this.trans?true:false;},abort:function(){if(this.isLoading()){this.destroyTrans(this.trans);
1015 }},destroyTrans:function(A,B){this.head.removeChild(document.getElementById(A.scriptId));clearTimeout(A.timeoutId);if(B){window[A.cb]=undefined;try{delete window[A.cb];}catch(e){}}else{window[A.cb]=function(){window[A.cb]=undefined;try{delete window[A.cb];
1016 }catch(e){}};}},handleResponse:function(o,A){this.trans=false;this.destroyTrans(A,true);var B;try{B=A.reader.readRecords(o);}catch(e){this.fireEvent("loadexception",this,o,A.arg,e);A.callback.call(A.scope||window,null,A.arg,false);return;}this.fireEvent("load",this,o,A.arg);
1017 A.callback.call(A.scope||window,B,A.arg,true);},handleFailure:function(A){this.trans=false;this.destroyTrans(A,false);this.fireEvent("loadexception",this,null,A.arg);A.callback.call(A.scope||window,null,A.arg,false);}});
1018 // Roo/data/JsonReader.js
1019 Roo.data.JsonReader=function(A,B){A=A||{};Roo.applyIf(A,{totalProperty:'total',successProperty:'success',root:'data',id:'id'});Roo.data.JsonReader.superclass.constructor.call(this,A,B||A.fields);};Roo.extend(Roo.data.JsonReader,Roo.data.DataReader,{readerType:'Json',metaFromRemote:false,read:function(A){var B=A.responseText;
1020 var o=eval("("+B+")");if(!o){throw {message:"JsonReader.read: Json object not found"};}if(o.metaData){delete this.ef;this.metaFromRemote=true;this.meta=o.metaData;this.recordType=Roo.data.Record.create(o.metaData.fields);this.onMetaChange(this.meta,this.recordType,o);
1021 }return this.readRecords(o);},onMetaChange:function(A,B,o){},simpleAccess:function(A,B){return A[B];},getJsonAccessor:function(){var re=/[\[\.]/;return function(A){try{return (re.test(A))?new Function("obj","return obj."+A):function(B){return B[A];};}catch(e){}
1022 return Roo.emptyFn;};}(),readRecords:function(o){this.o=o;var s=this.meta,A=this.recordType,f=A?A.prototype.fields:null,fi=f?f.items:[],fl=f?f.length:0;if(!this.ef){if(s.totalProperty){this.getTotal=this.getJsonAccessor(s.totalProperty);}if(s.successProperty){this.getSuccess=this.getJsonAccessor(s.successProperty);
1023 }this.getRoot=s.root?this.getJsonAccessor(s.root):function(p){return p;};if(s.id){var g=this.getJsonAccessor(s.id);this.getId=function(I){var r=g(I);return (r===undefined||r==="")?null:r;};}else{this.getId=function(){return null;};}this.ef=[];for(var jj=0;
1024 jj<fl;jj++){f=fi[jj];var B=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;this.ef[jj]=this.getJsonAccessor(B);}}var C=this.getRoot(o),c=C.length,D=c,E=true;if(s.totalProperty){var vt=parseInt(this.getTotal(o),10);if(!isNaN(vt)){D=vt;}}if(s.successProperty){var vs=this.getSuccess(o);
1025 if(vs===false||vs==='false'){E=false;}}var F=[];for(var i=0;i<c;i++){var n=C[i];var G={};var id=this.getId(n);for(var j=0;j<fl;j++){f=fi[j];var v=this.ef[j](n);if(!f.convert){Roo.log('missing convert for '+f.name);Roo.log(f);continue;}G[f.name]=f.convert((v!==undefined)?v:f.defaultValue);
1026 }if(!A){return {raw:{errorMsg:"JSON Reader Error: fields or metadata not available to create Record"},success:false,records:[],totalRecords:0};}var H=new A(G,id);H.json=n;F[i]=H;}return {raw:o,success:E,records:F,totalRecords:D};},toLoadData:function(A){var B=typeof(A.data.cn)=='undefined'?[]:A.data.cn;
1027 return {data:B,total:B.length};}});
1028 // Roo/data/XmlReader.js
1029 Roo.data.XmlReader=function(A,B){A=A||{};Roo.data.XmlReader.superclass.constructor.call(this,A,B||A.fields);};Roo.extend(Roo.data.XmlReader,Roo.data.DataReader,{readerType:'Xml',read:function(A){var B=A.responseXML;if(!B){throw {message:"XmlReader.read: XML Document not available"}
1030 ;}return this.readRecords(B);},readRecords:function(A){this.xmlData=A;var B=A.documentElement||A;var q=Roo.DomQuery;var C=this.recordType,D=C.prototype.fields;var E=this.meta.id;var F=0,G=true;if(this.meta.totalRecords){F=q.selectNumber(this.meta.totalRecords,B,0);
1031 }if(this.meta.success){var sv=q.selectValue(this.meta.success,B,true);G=sv!==false&&sv!=='false';}var H=[];var ns=q.select(this.meta.record,B);for(var i=0,I=ns.length;i<I;i++){var n=ns[i];var J={};var id=E?q.selectValue(E,n):undefined;for(var j=0,K=D.length;
1032 j<K;j++){var f=D.items[j];var v=q.selectValue(f.mapping||f.name,n,f.defaultValue);v=f.convert(v);J[f.name]=v;}var L=new C(J,id);L.node=n;H[H.length]=L;}return {success:G,records:H,totalRecords:F||H.length};}});
1033 // Roo/data/ArrayReader.js
1034 Roo.data.ArrayReader=function(A,B){Roo.data.ArrayReader.superclass.constructor.call(this,A,B||A.fields);};Roo.extend(Roo.data.ArrayReader,Roo.data.JsonReader,{readRecords:function(o){var A=this.meta?this.meta.id:null;var B=this.recordType,C=B.prototype.fields;
1035 var D=[];var E=o;for(var i=0;i<E.length;i++){var n=E[i];var F={};var id=((A||A===0)&&n[A]!==undefined&&n[A]!==""?n[A]:null);for(var j=0,G=C.length;j<G;j++){var f=C.items[j];var k=f.mapping!==undefined&&f.mapping!==null?f.mapping:j;var v=n[k]!==undefined?n[k]:f.defaultValue;
1036 v=f.convert(v);F[f.name]=v;}var H=new B(F,id);H.json=n;D[D.length]=H;}return {records:D,totalRecords:D.length};},toLoadData:function(A){return typeof(A.data.cn)=='undefined'?[]:A.data.cn;}});
1037 // Roo/data/Tree.js
1038 Roo.data.Tree=function(A){this.nodeHash={};this.root=null;if(A){this.setRootNode(A);}this.addEvents({"append":true,"remove":true,"move":true,"insert":true,"beforeappend":true,"beforeremove":true,"beforemove":true,"beforeinsert":true});Roo.data.Tree.superclass.constructor.call(this);
1039 };Roo.extend(Roo.data.Tree,Roo.util.Observable,{pathSeparator:"/",proxyNodeEvent:function(){return this.fireEvent.apply(this,arguments);},getRootNode:function(){return this.root;},setRootNode:function(A){this.root=A;A.ownerTree=this;A.isRoot=true;this.registerNode(A);
1040 return A;},getNodeById:function(id){return this.nodeHash[id];},registerNode:function(A){this.nodeHash[A.id]=A;},unregisterNode:function(A){delete this.nodeHash[A.id];},toString:function(){return "[Tree"+(this.id?" "+this.id:"")+"]";}});Roo.data.Node=function(A){this.attributes=A||{}
1041 ;this.leaf=this.attributes.leaf;this.id=this.attributes.id;if(!this.id){this.id=Roo.id(null,"ynode-");this.attributes.id=this.id;}this.childNodes=[];if(!this.childNodes.indexOf){this.childNodes.indexOf=function(o){for(var i=0,B=this.length;i<B;i++){if(this[i]==o){return i;
1042 }}return -1;};}this.parentNode=null;this.firstChild=null;this.lastChild=null;this.previousSibling=null;this.nextSibling=null;this.addEvents({"append":true,"remove":true,"move":true,"insert":true,"beforeappend":true,"beforeremove":true,"beforemove":true,"beforeinsert":true}
1043 );this.listeners=this.attributes.listeners;Roo.data.Node.superclass.constructor.call(this);};Roo.extend(Roo.data.Node,Roo.util.Observable,{fireEvent:function(A){if(Roo.data.Node.superclass.fireEvent.apply(this,arguments)===false){return false;}var ot=this.getOwnerTree();
1044 if(ot){if(ot.proxyNodeEvent.apply(ot,arguments)===false){return false;}}return true;},isLeaf:function(){return this.leaf===true;},setFirstChild:function(A){this.firstChild=A;},setLastChild:function(A){this.lastChild=A;},isLast:function(){return (!this.parentNode?true:this.parentNode.lastChild==this);
1045 },isFirst:function(){return (!this.parentNode?true:this.parentNode.firstChild==this);},hasChildNodes:function(){return !this.isLeaf()&&this.childNodes.length>0;},appendChild:function(A){var B=false;if(A instanceof Array){B=A;}else if(arguments.length>1){B=arguments;
1046 }if(B){for(var i=0,C=B.length;i<C;i++){this.appendChild(B[i]);}}else{if(this.fireEvent("beforeappend",this.ownerTree,this,A)===false){return false;}var D=this.childNodes.length;var E=A.parentNode;if(E){if(A.fireEvent("beforemove",A.getOwnerTree(),A,E,this,D)===false){return false;
1047 }E.removeChild(A);}D=this.childNodes.length;if(D==0){this.setFirstChild(A);}this.childNodes.push(A);A.parentNode=this;var ps=this.childNodes[D-1];if(ps){A.previousSibling=ps;ps.nextSibling=A;}else{A.previousSibling=null;}A.nextSibling=null;this.setLastChild(A);
1048 A.setOwnerTree(this.getOwnerTree());this.fireEvent("append",this.ownerTree,this,A,D);if(this.ownerTree){this.ownerTree.fireEvent("appendnode",this,A,D);}if(E){A.fireEvent("move",this.ownerTree,A,E,this,D);}return A;}},removeChild:function(A){var B=this.childNodes.indexOf(A);
1049 if(B==-1){return false;}if(this.fireEvent("beforeremove",this.ownerTree,this,A)===false){return false;}this.childNodes.splice(B,1);if(A.previousSibling){A.previousSibling.nextSibling=A.nextSibling;}if(A.nextSibling){A.nextSibling.previousSibling=A.previousSibling;
1050 }if(this.firstChild==A){this.setFirstChild(A.nextSibling);}if(this.lastChild==A){this.setLastChild(A.previousSibling);}A.setOwnerTree(null);A.parentNode=null;A.previousSibling=null;A.nextSibling=null;this.fireEvent("remove",this.ownerTree,this,A);return A;
1051 },insertBefore:function(A,B){if(!B){return this.appendChild(A);}if(A==B){return false;}if(this.fireEvent("beforeinsert",this.ownerTree,this,A,B)===false){return false;}var C=this.childNodes.indexOf(B);var D=A.parentNode;var E=C;if(D==this&&this.childNodes.indexOf(A)<C){E--;
1052 }if(D){if(A.fireEvent("beforemove",A.getOwnerTree(),A,D,this,C,B)===false){return false;}D.removeChild(A);}if(E==0){this.setFirstChild(A);}this.childNodes.splice(E,0,A);A.parentNode=this;var ps=this.childNodes[E-1];if(ps){A.previousSibling=ps;ps.nextSibling=A;
1053 }else{A.previousSibling=null;}A.nextSibling=B;B.previousSibling=A;A.setOwnerTree(this.getOwnerTree());this.fireEvent("insert",this.ownerTree,this,A,B);if(D){A.fireEvent("move",this.ownerTree,A,D,this,E,B);}return A;},item:function(A){return this.childNodes[A];
1054 },replaceChild:function(A,B){this.insertBefore(A,B);this.removeChild(B);return B;},indexOf:function(A){return this.childNodes.indexOf(A);},getOwnerTree:function(){if(!this.ownerTree){var p=this;while(p){if(p.ownerTree){this.ownerTree=p.ownerTree;break;}p=p.parentNode;
1055 }}return this.ownerTree;},getDepth:function(){var A=0;var p=this;while(p.parentNode){++A;p=p.parentNode;}return A;},setOwnerTree:function(A){if(A!=this.ownerTree){if(this.ownerTree){this.ownerTree.unregisterNode(this);}this.ownerTree=A;var cs=this.childNodes;
1056 for(var i=0,B=cs.length;i<B;i++){cs[i].setOwnerTree(A);}if(A){A.registerNode(this);}}},getPath:function(A){A=A||"id";var p=this.parentNode;var b=[this.attributes[A]];while(p){b.unshift(p.attributes[A]);p=p.parentNode;}var B=this.getOwnerTree().pathSeparator;
1057 return B+b.join(B);},bubble:function(fn,A,B){var p=this;while(p){if(fn.call(A||p,B||p)===false){break;}p=p.parentNode;}},cascade:function(fn,A,B){if(fn.call(A||this,B||this)!==false){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){cs[i].cascade(fn,A,B);
1058 }}},eachChild:function(fn,A,B){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){if(fn.call(A||this,B||cs[i])===false){break;}}},findChild:function(A,B){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){if(cs[i].attributes[A]==B){return cs[i];
1059 }}return null;},findChildBy:function(fn,A){var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){if(fn.call(A||cs[i],cs[i])===true){return cs[i];}}return null;},sort:function(fn,A){var cs=this.childNodes;var B=cs.length;if(B>0){var C=A?function(){fn.apply(A,arguments);
1060 }:fn;cs.sort(C);for(var i=0;i<B;i++){var n=cs[i];n.previousSibling=cs[i-1];n.nextSibling=cs[i+1];if(i==0){this.setFirstChild(n);}if(i==B-1){this.setLastChild(n);}}}},contains:function(A){return A.isAncestor(this);},isAncestor:function(A){var p=this.parentNode;
1061 while(p){if(p==A){return true;}p=p.parentNode;}return false;},toString:function(){return "[Node"+(this.id?" "+this.id:"")+"]";}});
1062 // Roo/Shadow.js
1063 Roo.Shadow=function(A){Roo.apply(this,A);if(typeof this.mode!="string"){this.mode=this.defaultMode;}var o=this.offset,a={h:0};var B=Math.floor(this.offset/2);switch(this.mode.toLowerCase()){case "drop":a.w=0;a.l=a.t=o;a.t-=1;if(Roo.isIE){a.l-=this.offset+B;
1064 a.t-=this.offset+B;a.w-=B;a.h-=B;a.t+=1;}break;case "sides":a.w=(o*2);a.l=-o;a.t=o-1;if(Roo.isIE){a.l-=(this.offset-B);a.t-=this.offset+B;a.l+=1;a.w-=(this.offset-B)*2;a.w-=B+1;a.h-=1;}break;case "frame":a.w=a.h=(o*2);a.l=a.t=-o;a.t+=1;a.h-=2;if(Roo.isIE){a.l-=(this.offset-B);
1065 a.t-=(this.offset-B);a.l+=1;a.w-=(this.offset+B+1);a.h-=(this.offset+B);a.h+=1;}break;};this.adjusts=a;};Roo.Shadow.prototype={mode:false,offset:4,defaultMode:"drop",show:function(A){A=Roo.get(A);if(!this.el){this.el=Roo.Shadow.Pool.pull();if(this.el.dom.nextSibling!=A.dom){this.el.insertBefore(A);
1066 }}this.el.setStyle("z-index",this.zIndex||parseInt(A.getStyle("z-index"),10)-1);if(Roo.isIE){this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";}this.realign(A.getLeft(true),A.getTop(true),A.getWidth(),A.getHeight());
1067 this.el.dom.style.display="block";},isVisible:function(){return this.el?true:false;},realign:function(l,t,w,h){if(!this.el){return;}var a=this.adjusts,d=this.el.dom,s=d.style;var A=0;s.left=(l+a.l)+"px";s.top=(t+a.t)+"px";var sw=(w+a.w),sh=(h+a.h),B=sw+"px",C=sh+"px";
1068 if(s.width!=B||s.height!=C){s.width=B;s.height=C;if(!Roo.isIE){var cn=d.childNodes;var D=Math.max(0,(sw-12))+"px";cn[0].childNodes[1].style.width=D;cn[1].childNodes[1].style.width=D;cn[2].childNodes[1].style.width=D;cn[1].style.height=Math.max(0,(sh-12))+"px";
1069 }}},hide:function(){if(this.el){this.el.dom.style.display="none";Roo.Shadow.Pool.push(this.el);delete this.el;}},setZIndex:function(z){this.zIndex=z;if(this.el){this.el.setStyle("z-index",z);}}};Roo.Shadow.Pool=function(){var p=[];var A=Roo.isIE?'<div class="x-ie-shadow"></div>':'<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>';
1070 return {pull:function(){var sh=p.shift();if(!sh){sh=Roo.get(Roo.DomHelper.insertHtml("beforeBegin",document.body.firstChild,A));sh.autoBoxAdjust=false;}return sh;},push:function(sh){p.push(sh);}};}();
1071 // Roo/SplitBar.js
1072 Roo.SplitBar=function(A,B,C,D,E){this.el=Roo.get(A,true);this.el.dom.unselectable="on";this.resizingEl=Roo.get(B,true);this.orientation=C||Roo.SplitBar.HORIZONTAL;this.minSize=0;this.maxSize=2000;this.animate=false;this.useShim=false;this.shim=null;if(!E){this.proxy=Roo.SplitBar.createProxy(this.orientation);
1073 }else{this.proxy=Roo.get(E).dom;}this.dd=new Roo.dd.DDProxy(this.el.dom.id,"XSplitBars",{dragElId:this.proxy.id});this.dd.b4StartDrag=this.onStartProxyDrag.createDelegate(this);this.dd.endDrag=this.onEndProxyDrag.createDelegate(this);this.dragSpecs={};this.adapter=new Roo.SplitBar.BasicLayoutAdapter();
1074 this.adapter.init(this);if(this.orientation==Roo.SplitBar.HORIZONTAL){this.placement=D||(this.el.getX()>this.resizingEl.getX()?Roo.SplitBar.LEFT:Roo.SplitBar.RIGHT);this.el.addClass("x-splitbar-h");}else{this.placement=D||(this.el.getY()>this.resizingEl.getY()?Roo.SplitBar.TOP:Roo.SplitBar.BOTTOM);
1075 this.el.addClass("x-splitbar-v");}this.addEvents({"resize":true,"moved":true,"beforeresize":true,"beforeapply":true});Roo.util.Observable.call(this);};Roo.extend(Roo.SplitBar,Roo.util.Observable,{onStartProxyDrag:function(x,y){this.fireEvent("beforeresize",this);
1076 if(!this.overlay){var o=Roo.DomHelper.insertFirst(document.body,{cls:"x-drag-overlay",html:"&#160;"},true);o.unselectable();o.enableDisplayMode("block");Roo.SplitBar.prototype.overlay=o;}this.overlay.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));
1077 this.overlay.show();Roo.get(this.proxy).setDisplayed("block");var A=this.adapter.getElementSize(this);this.activeMinSize=this.getMinimumSize();;this.activeMaxSize=this.getMaximumSize();;var c1=A-this.activeMinSize;var c2=Math.max(this.activeMaxSize-A,0);if(this.orientation==Roo.SplitBar.HORIZONTAL){this.dd.resetConstraints();
1078 this.dd.setXConstraint(this.placement==Roo.SplitBar.LEFT?c1:c2,this.placement==Roo.SplitBar.LEFT?c2:c1);this.dd.setYConstraint(0,0);}else{this.dd.resetConstraints();this.dd.setXConstraint(0,0);this.dd.setYConstraint(this.placement==Roo.SplitBar.TOP?c1:c2,this.placement==Roo.SplitBar.TOP?c2:c1);
1079 }this.dragSpecs.startSize=A;this.dragSpecs.startPoint=[x,y];Roo.dd.DDProxy.prototype.b4StartDrag.call(this.dd,x,y);},onEndProxyDrag:function(e){Roo.get(this.proxy).setDisplayed(false);var A=Roo.lib.Event.getXY(e);if(this.overlay){this.overlay.hide();}var B;
1080 if(this.orientation==Roo.SplitBar.HORIZONTAL){B=this.dragSpecs.startSize+(this.placement==Roo.SplitBar.LEFT?A[0]-this.dragSpecs.startPoint[0]:this.dragSpecs.startPoint[0]-A[0]);}else{B=this.dragSpecs.startSize+(this.placement==Roo.SplitBar.TOP?A[1]-this.dragSpecs.startPoint[1]:this.dragSpecs.startPoint[1]-A[1]);
1081 }B=Math.min(Math.max(B,this.activeMinSize),this.activeMaxSize);if(B!=this.dragSpecs.startSize){if(this.fireEvent('beforeapply',this,B)!==false){this.adapter.setElementSize(this,B);this.fireEvent("moved",this,B);this.fireEvent("resize",this,B);}}},getAdapter:function(){return this.adapter;
1082 },setAdapter:function(A){this.adapter=A;this.adapter.init(this);},getMinimumSize:function(){return this.minSize;},setMinimumSize:function(A){this.minSize=A;},getMaximumSize:function(){return this.maxSize;},setMaximumSize:function(A){this.maxSize=A;},setCurrentSize:function(A){var B=this.animate;
1083 this.animate=false;this.adapter.setElementSize(this,A);this.animate=B;},destroy:function(A){if(this.shim){this.shim.remove();}this.dd.unreg();this.proxy.parentNode.removeChild(this.proxy);if(A){this.el.remove();}}});Roo.SplitBar.createProxy=function(A){var B=new Roo.Element(document.createElement("div"));
1084 B.unselectable();var C='x-splitbar-proxy';B.addClass(C+' '+(A==Roo.SplitBar.HORIZONTAL?C+'-h':C+'-v'));document.body.appendChild(B.dom);return B.dom;};Roo.SplitBar.BasicLayoutAdapter=function(){};Roo.SplitBar.BasicLayoutAdapter.prototype={init:function(s){}
1085 ,getElementSize:function(s){if(s.orientation==Roo.SplitBar.HORIZONTAL){return s.resizingEl.getWidth();}else{return s.resizingEl.getHeight();}},setElementSize:function(s,A,B){if(s.orientation==Roo.SplitBar.HORIZONTAL){if(!s.animate){s.resizingEl.setWidth(A);
1086 if(B){B(s,A);}}else{s.resizingEl.setWidth(A,true,.1,B,'easeOut');}}else{if(!s.animate){s.resizingEl.setHeight(A);if(B){B(s,A);}}else{s.resizingEl.setHeight(A,true,.1,B,'easeOut');}}}};Roo.SplitBar.AbsoluteLayoutAdapter=function(A){this.basic=new Roo.SplitBar.BasicLayoutAdapter();
1087 this.container=Roo.get(A);};Roo.SplitBar.AbsoluteLayoutAdapter.prototype={init:function(s){this.basic.init(s);},getElementSize:function(s){return this.basic.getElementSize(s);},setElementSize:function(s,A,B){this.basic.setElementSize(s,A,this.moveSplitter.createDelegate(this,[s]));
1088 },moveSplitter:function(s){var A=Roo.SplitBar;switch(s.placement){case A.LEFT:s.el.setX(s.resizingEl.getRight());break;case A.RIGHT:s.el.setStyle("right",(this.container.getWidth()-s.resizingEl.getLeft())+"px");break;case A.TOP:s.el.setY(s.resizingEl.getBottom());
1089 break;case A.BOTTOM:s.el.setY(s.resizingEl.getTop()-s.el.getHeight());break;}}};Roo.SplitBar.VERTICAL=1;Roo.SplitBar.HORIZONTAL=2;Roo.SplitBar.LEFT=1;Roo.SplitBar.RIGHT=2;Roo.SplitBar.TOP=3;Roo.SplitBar.BOTTOM=4;
1090 // Roo/View.js
1091 Roo.View=function(A,B,C){this.parent=false;if(typeof(B)=='undefined'){Roo.apply(this,A);this.el=Roo.get(this.el);}else{this.el=Roo.get(A);this.tpl=B;Roo.apply(this,C);}this.wrapEl=this.el.wrap().wrap();if(typeof(this.tpl)=="string"){this.tpl=new Roo.Template(this.tpl);
1092 }else{this.tpl=new Roo.factory(this.tpl,Roo);}this.tpl.compile();this.addEvents({"beforeclick":true,"click":true,"dblclick":true,"contextmenu":true,"selectionchange":true,"beforeselect":true,"preparedata":true});this.el.on({"click":this.onClick,"dblclick":this.onDblClick,"contextmenu":this.onContextMenu,scope:this}
1093 );this.selections=[];this.nodes=[];this.cmp=new Roo.CompositeElementLite([]);if(this.store){this.store=Roo.factory(this.store,Roo.data);this.setStore(this.store,true);}if(this.footer&&this.footer.xtype){var D=this.wrapEl.appendChild(document.createElement("div"));
1094 this.footer.dataSource=this.store;this.footer.container=D;this.footer=Roo.factory(this.footer,Roo);D.insertFirst(this.el);}Roo.View.superclass.constructor.call(this);};Roo.extend(Roo.View,Roo.util.Observable,{store:false,el:'',tpl:false,dataName:false,selectedClass:"x-view-selected",emptyText:"",mask:false,multiSelect:false,singleSelect:false,toggleSelect:false,tickable:false,getEl:function(){return this.wrapEl;
1095 },refresh:function(){var t=this.tpl;this.clearSelections();this.el.update("");var A=[];var B=this.store.getRange();if(B.length<1){this.el.update(this.emptyText);return;}var el=this.el;if(this.dataName){this.el.update(t.apply(this.store.meta));el=this.el.child('.roo-tpl-'+this.dataName);
1096 }for(var i=0,C=B.length;i<C;i++){var D=this.prepareData(B[i].data,i,B[i]);this.fireEvent("preparedata",this,D,i,B[i]);var d=Roo.apply({},D);if(this.tickable){Roo.apply(d,{'roo-id':Roo.id()});var E=this;Roo.each(this.parent.item,function(F){if(F[E.parent.valueField]!=D[E.parent.valueField]){return;
1097 }Roo.apply(d,{'roo-data-checked':'checked'});});}A[A.length]=Roo.util.Format.trim(this.dataName?t.applySubtemplate(this.dataName,d,this.store.meta):t.apply(d));}el.update(A.join(""));this.nodes=el.dom.childNodes;this.updateIndexes(0);},prepareData:function(A,B,C){this.fireEvent("preparedata",this,A,B,C);
1098 return A;},onUpdate:function(ds,A){this.clearSelections();var B=this.store.indexOf(A);var n=this.nodes[B];this.tpl.insertBefore(n,this.prepareData(A.data,B,A));n.parentNode.removeChild(n);this.updateIndexes(B,B);},onAdd:function(ds,A,B){this.clearSelections();
1099 if(this.nodes.length==0){this.refresh();return;}var n=this.nodes[B];for(var i=0,C=A.length;i<C;i++){var d=this.prepareData(A[i].data,i,A[i]);if(n){this.tpl.insertBefore(n,d);}else{this.tpl.append(this.el,d);}}this.updateIndexes(B);},onRemove:function(ds,A,B){this.clearSelections();
1100 var el=this.dataName?this.el.child('.roo-tpl-'+this.dataName):this.el;el.dom.removeChild(this.nodes[B]);this.updateIndexes(B);},refreshNode:function(A){this.onUpdate(this.store,this.store.getAt(A));},updateIndexes:function(A,B){var ns=this.nodes;A=A||0;B=B||ns.length-1;
1101 for(var i=A;i<=B;i++){ns[i].nodeIndex=i;}},setStore:function(A,B){if(!B&&this.store){this.store.un("datachanged",this.refresh);this.store.un("add",this.onAdd);this.store.un("remove",this.onRemove);this.store.un("update",this.onUpdate);this.store.un("clear",this.refresh);
1102 this.store.un("beforeload",this.onBeforeLoad);this.store.un("load",this.onLoad);this.store.un("loadexception",this.onLoad);}if(A){A.on("datachanged",this.refresh,this);A.on("add",this.onAdd,this);A.on("remove",this.onRemove,this);A.on("update",this.onUpdate,this);
1103 A.on("clear",this.refresh,this);A.on("beforeload",this.onBeforeLoad,this);A.on("load",this.onLoad,this);A.on("loadexception",this.onLoad,this);}if(A){this.refresh();}},onBeforeLoad:function(A,B){if(!B.add){this.el.update("");}this.el.mask(this.mask?this.mask:"Loading");
1104 },onLoad:function(){this.el.unmask();},findItemFromChild:function(A){var el=this.dataName?this.el.child('.roo-tpl-'+this.dataName,true):this.el.dom;if(!A||A.parentNode==el){return A;}var p=A.parentNode;while(p&&p!=el){if(p.parentNode==el){return p;}p=p.parentNode;
1105 }return null;},onClick:function(e){var A=this.findItemFromChild(e.getTarget());if(A){var B=this.indexOf(A);if(this.onItemClick(A,B,e)!==false){this.fireEvent("click",this,B,A,e);}}else{this.clearSelections();}},onContextMenu:function(e){var A=this.findItemFromChild(e.getTarget());
1106 if(A){this.fireEvent("contextmenu",this,this.indexOf(A),A,e);}},onDblClick:function(e){var A=this.findItemFromChild(e.getTarget());if(A){this.fireEvent("dblclick",this,this.indexOf(A),A,e);}},onItemClick:function(A,B,e){if(this.fireEvent("beforeclick",this,B,A,e)===false){return false;
1107 }if(this.toggleSelect){var m=this.isSelected(A)?'unselect':'select';var _t=this;_t[m](A,true,false);return true;}if(this.multiSelect||this.singleSelect){if(this.multiSelect&&e.shiftKey&&this.lastSelection){this.select(this.getNodes(this.indexOf(this.lastSelection),B),false);
1108 }else{this.select(A,this.multiSelect&&e.ctrlKey);this.lastSelection=A;}if(!this.tickable){e.preventDefault();}}return true;},getSelectionCount:function(){return this.selections.length;},getSelectedNodes:function(){return this.selections;},getSelectedIndexes:function(){var A=[],s=this.selections;
1109 for(var i=0,B=s.length;i<B;i++){A.push(s[i].nodeIndex);}return A;},clearSelections:function(A){if(this.nodes&&(this.multiSelect||this.singleSelect)&&this.selections.length>0){this.cmp.elements=this.selections;this.cmp.removeClass(this.selectedClass);this.selections=[];
1110 if(!A){this.fireEvent("selectionchange",this,this.selections);}}},isSelected:function(A){var s=this.selections;if(s.length<1){return false;}A=this.getNode(A);return s.indexOf(A)!==-1;},select:function(A,B,C){if(A instanceof Array){if(!B){this.clearSelections(true);
1111 }for(var i=0,D=A.length;i<D;i++){this.select(A[i],true,true);}return;}var E=this.getNode(A);if(!E||this.isSelected(E)){return;}if(!B){this.clearSelections(true);}if(this.fireEvent("beforeselect",this,E,this.selections)!==false){Roo.fly(E).addClass(this.selectedClass);
1112 this.selections.push(E);if(!C){this.fireEvent("selectionchange",this,this.selections);}}},unselect:function(A,B,C){if(A instanceof Array){Roo.each(this.selections,function(s){this.unselect(s,A);},this);return;}var D=this.getNode(A);if(!D||!this.isSelected(D)){return;
1113 }var ns=[];Roo.each(this.selections,function(s){if(s==D){Roo.fly(D).removeClass(this.selectedClass);return;}ns.push(s);},this);this.selections=ns;this.fireEvent("selectionchange",this,this.selections);},getNode:function(A){if(typeof A=="string"){return document.getElementById(A);
1114 }else if(typeof A=="number"){return this.nodes[A];}return A;},getNodes:function(A,B){var ns=this.nodes;A=A||0;B=typeof B=="undefined"?ns.length-1:B;var C=[];if(A<=B){for(var i=A;i<=B;i++){C.push(ns[i]);}}else{for(var i=A;i>=B;i--){C.push(ns[i]);}}return C;
1115 },indexOf:function(A){A=this.getNode(A);if(typeof A.nodeIndex=="number"){return A.nodeIndex;}var ns=this.nodes;for(var i=0,B=ns.length;i<B;i++){if(ns[i]==A){return i;}}return -1;}});
1116 // Roo/JsonView.js
1117 Roo.JsonView=function(A,B,C){Roo.JsonView.superclass.constructor.call(this,A,B,C);var um=this.el.getUpdateManager();um.setRenderer(this);um.on("update",this.onLoad,this);um.on("failure",this.onLoadException,this);this.addEvents({'beforerender':true,'load':true,'loadexception':true}
1118 );};Roo.extend(Roo.JsonView,Roo.View,{jsonRoot:"",refresh:function(){this.clearSelections();this.el.update("");var A=[];var o=this.jsonData;if(o&&o.length>0){for(var i=0,B=o.length;i<B;i++){var C=this.prepareData(o[i],i,o);A[A.length]=this.tpl.apply(C);}}
1119 else{A.push(this.emptyText);}this.el.update(A.join(""));this.nodes=this.el.dom.childNodes;this.updateIndexes(0);},load:function(){var um=this.el.getUpdateManager();um.update.apply(um,arguments);},render:function(el,A){this.clearSelections();this.el.update("");
1120 var o;try{if(A!=''){o=Roo.util.JSON.decode(A.responseText);if(this.jsonRoot){o=o[this.jsonRoot];}}}catch(e){}this.jsonData=o;this.beforeRender();this.refresh();},getCount:function(){return this.jsonData?this.jsonData.length:0;},getNodeData:function(A){if(A instanceof Array){var B=[];
1121 for(var i=0,C=A.length;i<C;i++){B.push(this.getNodeData(A[i]));}return B;}return this.jsonData[this.indexOf(A)]||null;},beforeRender:function(){this.snapshot=this.jsonData;if(this.sortInfo){this.sort.apply(this,this.sortInfo);}this.fireEvent("beforerender",this,this.jsonData);
1122 },onLoad:function(el,o){this.fireEvent("load",this,this.jsonData,o);},onLoadException:function(el,o){this.fireEvent("loadexception",this,o);},filter:function(A,B){if(this.jsonData){var C=[];var ss=this.snapshot;if(typeof B=="string"){var D=B.length;if(D==0){this.clearFilter();
1123 return;}B=B.toLowerCase();for(var i=0,E=ss.length;i<E;i++){var o=ss[i];if(o[A].substr(0,D).toLowerCase()==B){C.push(o);}}}else if(B.exec){for(var i=0,E=ss.length;i<E;i++){var o=ss[i];if(B.test(o[A])){C.push(o);}}}else{return;}this.jsonData=C;this.refresh();
1124 }},filterBy:function(fn,A){if(this.jsonData){var B=[];var ss=this.snapshot;for(var i=0,C=ss.length;i<C;i++){var o=ss[i];if(fn.call(A||this,o)){B.push(o);}}this.jsonData=B;this.refresh();}},clearFilter:function(){if(this.snapshot&&this.jsonData!=this.snapshot){this.jsonData=this.snapshot;
1125 this.refresh();}},sort:function(A,B,C){this.sortInfo=Array.prototype.slice.call(arguments,0);if(this.jsonData){var p=A;var D=B&&B.toLowerCase()=="desc";var f=function(o1,o2){var v1=C?C(o1[p]):o1[p];var v2=C?C(o2[p]):o2[p];;if(v1<v2){return D?+1:-1;}else if(v1>v2){return D?-1:+1;
1126 }else{return 0;}};this.jsonData.sort(f);this.refresh();if(this.jsonData!=this.snapshot){this.snapshot.sort(f);}}}});
1127 // Roo/ColorPalette.js
1128 Roo.ColorPalette=function(A){Roo.ColorPalette.superclass.constructor.call(this,A);this.addEvents({select:true});if(this.handler){this.on("select",this.handler,this.scope,true);}};Roo.extend(Roo.ColorPalette,Roo.Component,{itemCls:"x-color-palette",value:null,clickEvent:'click',ctype:"Roo.ColorPalette",allowReselect:false,colors:["000000","993300","333300","003300","003366","000080","333399","333333","800000","FF6600","808000","008000","008080","0000FF","666699","808080","FF0000","FF9900","99CC00","339966","33CCCC","3366FF","800080","969696","FF00FF","FFCC00","FFFF00","00FF00","00FFFF","00CCFF","993366","C0C0C0","FF99CC","FFCC99","FFFF99","CCFFCC","CCFFFF","99CCFF","CC99FF","FFFFFF"],onRender:function(A,B){var t=new Roo.MasterTemplate('<tpl><a href="#" class="color-{0}" hidefocus="on"><em><span style="background:#{0}" unselectable="on">&#160;</span></em></a></tpl>');
1129 var c=this.colors;for(var i=0,C=c.length;i<C;i++){t.add([c[i]]);}var el=document.createElement("div");el.className=this.itemCls;t.overwrite(el);A.dom.insertBefore(el,B);this.el=Roo.get(el);this.el.on(this.clickEvent,this.handleClick,this,{delegate:"a"});if(this.clickEvent!='click'){this.el.on('click',Roo.emptyFn,this,{delegate:"a",preventDefault:true}
1130 );}},afterRender:function(){Roo.ColorPalette.superclass.afterRender.call(this);if(this.value){var s=this.value;this.value=null;this.select(s);}},handleClick:function(e,t){e.preventDefault();if(!this.disabled){var c=t.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];
1131 this.select(c.toUpperCase());}},select:function(A){A=A.replace("#","");if(A!=this.value||this.allowReselect){var el=this.el;if(this.value){el.child("a.color-"+this.value).removeClass("x-color-palette-sel");}el.child("a.color-"+A).addClass("x-color-palette-sel");
1132 this.value=A;this.fireEvent("select",this,A);}}});
1133 // Roo/DatePicker.js
1134 Roo.DatePicker=function(A){Roo.DatePicker.superclass.constructor.call(this,A);this.value=A&&A.value?A.value.clearTime():new Date().clearTime();this.addEvents({'select':true,'monthchange':true});if(this.handler){this.on("select",this.handler,this.scope||this);
1135 }if(!this.disabledDatesRE&&this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1){re+="|";}}this.disabledDatesRE=new RegExp(re+")");}};Roo.extend(Roo.DatePicker,Roo.Component,{todayText:"Today",okText:"&#160;OK&#160;",cancelText:"Cancel",todayTip:"{0} (Spacebar)",minDate:null,maxDate:null,minText:"This date is before the minimum date",maxText:"This date is after the maximum date",format:"m/d/y",disabledDays:null,disabledDaysText:"",disabledDatesRE:null,disabledDatesText:"",constrainToViewport:true,monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:'Next Month (Control+Right)',prevText:'Previous Month (Control+Left)',monthYearText:'Choose a month (Control+Up/Down to move years)',startDay:0,showClear:false,setValue:function(A){var B=this.value;
1136 if(typeof(A)=='string'){A=Date.parseDate(A,this.format);}if(!A){A=new Date();}this.value=A.clearTime(true);if(this.el){this.update(this.value);}},getValue:function(){return this.value;},focus:function(){if(this.el){this.update(this.activeDate);}},onRender:function(A,B){var m=['<table cellspacing="0">','<tr><td class="x-date-left"><a href="#" title="',this.prevText,'">&#160;</a></td><td class="x-date-middle" align="center"></td><td class="x-date-right"><a href="#" title="',this.nextText,'">&#160;</a></td></tr>','<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'];
1137 var dn=this.dayNames;for(var i=0;i<7;i++){var d=this.startDay+i;if(d>6){d=d-7;}m.push("<th><span>",dn[d].substr(0,1),"</span></th>");}m[m.length]="</tr></thead><tbody><tr>";for(var i=0;i<42;i++){if(i%7==0&&i!=0){m[m.length]="</tr><tr>";}m[m.length]='<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>';
1138 }m[m.length]='</tr></tbody></table></td></tr><tr>'+'<td colspan="3" class="x-date-bottom" align="center"></td></tr></table><div class="x-date-mp"></div>';var el=document.createElement("div");el.className="x-date-picker";el.innerHTML=m.join("");A.dom.insertBefore(el,B);
1139 this.el=Roo.get(el);this.eventEl=Roo.get(el.firstChild);new Roo.util.ClickRepeater(this.el.child("td.x-date-left a"),{handler:this.showPrevMonth,scope:this,preventDefault:true,stopDefault:true});new Roo.util.ClickRepeater(this.el.child("td.x-date-right a"),{handler:this.showNextMonth,scope:this,preventDefault:true,stopDefault:true}
1140 );this.eventEl.on("mousewheel",this.handleMouseWheel,this);this.monthPicker=this.el.down('div.x-date-mp');this.monthPicker.enableDisplayMode('block');var kn=new Roo.KeyNav(this.eventEl,{"left":function(e){e.ctrlKey?this.showPrevMonth():this.update(this.activeDate.add("d",-1));
1141 },"right":function(e){e.ctrlKey?this.showNextMonth():this.update(this.activeDate.add("d",1));},"up":function(e){e.ctrlKey?this.showNextYear():this.update(this.activeDate.add("d",-7));},"down":function(e){e.ctrlKey?this.showPrevYear():this.update(this.activeDate.add("d",7));
1142 },"pageUp":function(e){this.showNextMonth();},"pageDown":function(e){this.showPrevMonth();},"enter":function(e){e.stopPropagation();return true;},scope:this});this.eventEl.on("click",this.handleDateClick,this,{delegate:"a.x-date-date"});this.eventEl.addKeyListener(Roo.EventObject.SPACE,this.selectToday,this);
1143 this.el.unselectable();this.cells=this.el.select("table.x-date-inner tbody td");this.textNodes=this.el.query("table.x-date-inner tbody span");this.mbtn=new Roo.Button(this.el.child("td.x-date-middle",true),{text:"&#160;",tooltip:this.monthYearText});this.mbtn.on('click',this.showMonthPicker,this);
1144 this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");var C=(new Date()).dateFormat(this.format);var D=new Roo.Toolbar(this.el.child("td.x-date-bottom",true));if(this.showClear){D.add(new Roo.Toolbar.Fill());}D.add({text:String.format(this.todayText,C),tooltip:String.format(this.todayTip,C),handler:this.selectToday,scope:this}
1145 );if(this.showClear){D.add(new Roo.Toolbar.Fill());D.add({text:'&#160;',cls:'x-btn-icon x-btn-clear',handler:function(){this.fireEvent("select",this,'');},scope:this});}if(Roo.isIE){this.el.repaint();}this.update(this.value);},createMonthPicker:function(){if(!this.monthPicker.dom.firstChild){var A=['<table border="0" cellspacing="0">'];
1146 for(var i=0;i<6;i++){A.push('<tr><td class="x-date-mp-month"><a href="#">',this.monthNames[i].substr(0,3),'</a></td>','<td class="x-date-mp-month x-date-mp-sep"><a href="#">',this.monthNames[i+6].substr(0,3),'</a></td>',i==0?'<td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-prev"></a></td><td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-next"></a></td></tr>':'<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>');
1147 }A.push('<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',this.okText,'</button><button type="button" class="x-date-mp-cancel">',this.cancelText,'</button></td></tr>','</table>');this.monthPicker.update(A.join(''));this.monthPicker.on('click',this.onMonthClick,this);
1148 this.monthPicker.on('dblclick',this.onMonthDblClick,this);this.mpMonths=this.monthPicker.select('td.x-date-mp-month');this.mpYears=this.monthPicker.select('td.x-date-mp-year');this.mpMonths.each(function(m,a,i){i+=1;if((i%2)==0){m.dom.xmonth=5+Math.round(i*.5);
1149 }else{m.dom.xmonth=Math.round((i-1)*.5);}});}},showMonthPicker:function(){this.createMonthPicker();var A=this.el.getSize();this.monthPicker.setSize(A);this.monthPicker.child('table').setSize(A);this.mpSelMonth=(this.activeDate||this.value).getMonth();this.updateMPMonth(this.mpSelMonth);
1150 this.mpSelYear=(this.activeDate||this.value).getFullYear();this.updateMPYear(this.mpSelYear);this.monthPicker.slideIn('t',{duration:.2});},updateMPYear:function(y){this.mpyear=y;var ys=this.mpYears.elements;for(var i=1;i<=10;i++){var td=ys[i-1],y2;if((i%2)==0){y2=y+Math.round(i*.5);
1151 td.firstChild.innerHTML=y2;td.xyear=y2;}else{y2=y-(5-Math.round(i*.5));td.firstChild.innerHTML=y2;td.xyear=y2;}this.mpYears.item(i-1)[y2==this.mpSelYear?'addClass':'removeClass']('x-date-mp-sel');}},updateMPMonth:function(sm){this.mpMonths.each(function(m,a,i){m[m.dom.xmonth==sm?'addClass':'removeClass']('x-date-mp-sel');
1152 });},selectMPMonth:function(m){},onMonthClick:function(e,t){e.stopEvent();var el=new Roo.Element(t),pn;if(el.is('button.x-date-mp-cancel')){this.hideMonthPicker();}else if(el.is('button.x-date-mp-ok')){this.update(new Date(this.mpSelYear,this.mpSelMonth,(this.activeDate||this.value).getDate()));
1153 this.hideMonthPicker();}else if(pn=el.up('td.x-date-mp-month',2)){this.mpMonths.removeClass('x-date-mp-sel');pn.addClass('x-date-mp-sel');this.mpSelMonth=pn.dom.xmonth;}else if(pn=el.up('td.x-date-mp-year',2)){this.mpYears.removeClass('x-date-mp-sel');pn.addClass('x-date-mp-sel');
1154 this.mpSelYear=pn.dom.xyear;}else if(el.is('a.x-date-mp-prev')){this.updateMPYear(this.mpyear-10);}else if(el.is('a.x-date-mp-next')){this.updateMPYear(this.mpyear+10);}},onMonthDblClick:function(e,t){e.stopEvent();var el=new Roo.Element(t),pn;if(pn=el.up('td.x-date-mp-month',2)){this.update(new Date(this.mpSelYear,pn.dom.xmonth,(this.activeDate||this.value).getDate()));
1155 this.hideMonthPicker();}else if(pn=el.up('td.x-date-mp-year',2)){this.update(new Date(pn.dom.xyear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker();}},hideMonthPicker:function(A){if(this.monthPicker){if(A===true){this.monthPicker.hide();
1156 }else{this.monthPicker.slideOut('t',{duration:.2});}}},showPrevMonth:function(e){this.update(this.activeDate.add("mo",-1));},showNextMonth:function(e){this.update(this.activeDate.add("mo",1));},showPrevYear:function(){this.update(this.activeDate.add("y",-1));
1157 },showNextYear:function(){this.update(this.activeDate.add("y",1));},handleMouseWheel:function(e){var A=e.getWheelDelta();if(A>0){this.showPrevMonth();e.stopEvent();}else if(A<0){this.showNextMonth();e.stopEvent();}},handleDateClick:function(e,t){e.stopEvent();
1158 if(t.dateValue&&!Roo.fly(t.parentNode).hasClass("x-date-disabled")){this.setValue(new Date(t.dateValue));this.fireEvent("select",this,this.value);}},selectToday:function(){this.setValue(new Date().clearTime());this.fireEvent("select",this,this.value);},update:function(A){var vd=this.activeDate;
1159 this.activeDate=A;if(vd&&this.el){var t=A.getTime();if(vd.getMonth()==A.getMonth()&&vd.getFullYear()==A.getFullYear()){this.cells.removeClass("x-date-selected");this.cells.each(function(c){if(c.dom.firstChild.dateValue==t){c.addClass("x-date-selected");setTimeout(function(){try{c.dom.firstChild.focus();
1160 }catch(e){}},50);return false;}});return;}}var B=A.getDaysInMonth();var C=A.getFirstDateOfMonth();var D=C.getDay()-this.startDay;if(D<=this.startDay){D+=7;}var pm=A.add("mo",-1);var E=pm.getDaysInMonth()-D;var F=this.cells.elements;var G=this.textNodes;B+=D;
1161 var H=86400000;var d=(new Date(pm.getFullYear(),pm.getMonth(),E)).clearTime();var I=new Date().clearTime().getTime();var J=A.clearTime().getTime();var K=this.minDate?this.minDate.clearTime():Number.NEGATIVE_INFINITY;var L=this.maxDate?this.maxDate.clearTime():Number.POSITIVE_INFINITY;
1162 var M=this.disabledDatesRE;var N=this.disabledDatesText;var O=this.disabledDays?this.disabledDays.join(""):false;var P=this.disabledDaysText;var Q=this.format;var R=function(U,V){V.title="";var t=d.getTime();V.firstChild.dateValue=t;if(t==I){V.className+=" x-date-today";
1163 V.title=U.todayText;}if(t==J){V.className+=" x-date-selected";setTimeout(function(){try{V.firstChild.focus();}catch(e){}},50);}if(t<K){V.className=" x-date-disabled";V.title=U.minText;return;}if(t>L){V.className=" x-date-disabled";V.title=U.maxText;return;
1164 }if(O){if(O.indexOf(d.getDay())!=-1){V.title=P;V.className=" x-date-disabled";}}if(M&&Q){var W=d.dateFormat(Q);if(M.test(W)){V.title=N.replace("%0",W);V.className=" x-date-disabled";}}};var i=0;for(;i<D;i++){G[i].innerHTML=(++E);d.setDate(d.getDate()+1);F[i].className="x-date-prevday";
1165 R(this,F[i]);}for(;i<B;i++){intDay=i-D+1;G[i].innerHTML=(intDay);d.setDate(d.getDate()+1);F[i].className="x-date-active";R(this,F[i]);}var S=0;for(;i<42;i++){G[i].innerHTML=(++S);d.setDate(d.getDate()+1);F[i].className="x-date-nextday";R(this,F[i]);}this.mbtn.setText(this.monthNames[A.getMonth()]+" "+A.getFullYear());
1166 this.fireEvent('monthchange',this,A);if(!this.internalRender){var T=this.el.dom.firstChild;var w=T.offsetWidth;this.el.setWidth(w+this.el.getBorderWidth("lr"));Roo.fly(T).setWidth(w);this.internalRender=true;if(Roo.isOpera&&!this.secondPass){T.rows[0].cells[1].style.width=(w-(T.rows[0].cells[0].offsetWidth+T.rows[0].cells[2].offsetWidth))+"px";
1167 this.secondPass=true;this.update.defer(10,this,[A]);}}}});
1168 // Roo/TabPanel.js
1169 Roo.TabPanel=function(A,B){this.el=Roo.get(A,true);if(B){if(typeof B=="boolean"){this.tabPosition=B?"bottom":"top";}else{Roo.apply(this,B);}}if(this.tabPosition=="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-bottom");
1170 }this.stripWrap=Roo.get(this.createStrip(this.el.dom),true);this.stripEl=Roo.get(this.createStripList(this.stripWrap.dom),true);this.stripBody=Roo.get(this.stripWrap.dom.firstChild.firstChild,true);if(Roo.isIE){Roo.fly(this.stripWrap.dom.firstChild).setStyle("overflow-x","hidden");
1171 }if(this.tabPosition!="bottom"){this.bodyEl=Roo.get(this.createBody(this.el.dom));this.el.addClass("x-tabs-top");}this.items=[];this.bodyEl.setStyle("position","relative");this.active=null;this.activateDelegate=this.activate.createDelegate(this);this.addEvents({"tabchange":true,"beforetabchange":true}
1172 );Roo.EventManager.onWindowResize(this.onResize,this);this.cpad=this.el.getPadding("lr");this.hiddenCount=0;if(this.toolbar){var C=this.toolbar;C.container=this.stripEl.child('td.x-tab-strip-toolbar');this.toolbar=new Roo.Toolbar(C);if(Roo.isSafari){var D=C.container.child('table',true);
1173 D.setAttribute('width','100%');}}Roo.TabPanel.superclass.constructor.call(this);};Roo.extend(Roo.TabPanel,Roo.util.Observable,{tabPosition:"top",currentTabWidth:0,minTabWidth:40,maxTabWidth:250,preferredTabWidth:175,resizeTabs:false,monitorResize:true,toolbar:false,addTab:function(id,A,B,C){var D=new Roo.TabPanelItem(this,id,A,C);
1174 this.addTabItem(D);if(B){D.setContent(B);}return D;},getTab:function(id){return this.items[id];},hideTab:function(id){var t=this.items[id];if(!t.isHidden()){t.setHidden(true);this.hiddenCount++;this.autoSizeTabs();}},unhideTab:function(id){var t=this.items[id];
1175 if(t.isHidden()){t.setHidden(false);this.hiddenCount--;this.autoSizeTabs();}},addTabItem:function(A){this.items[A.id]=A;this.items.push(A);if(this.resizeTabs){A.setWidth(this.currentTabWidth||this.preferredTabWidth);this.autoSizeTabs();}else{A.autoSize();
1176 }},removeTab:function(id){var A=this.items;var B=A[id];if(!B){return;}var C=A.indexOf(B);if(this.active==B&&A.length>1){var D=this.getNextAvailable(C);if(D){D.activate();}}this.stripEl.dom.removeChild(B.pnode.dom);if(B.bodyEl.dom.parentNode==this.bodyEl.dom){this.bodyEl.dom.removeChild(B.bodyEl.dom);
1177 }A.splice(C,1);delete this.items[B.id];B.fireEvent("close",B);B.purgeListeners();this.autoSizeTabs();},getNextAvailable:function(A){var B=this.items;var C=A;while(C<B.length){var D=B[++C];if(D&&!D.isHidden()){return D;}}C=A;while(C>=0){var D=B[--C];if(D&&!D.isHidden()){return D;
1178 }}return null;},disableTab:function(id){var A=this.items[id];if(A&&this.active!=A){A.disable();}},enableTab:function(id){var A=this.items[id];A.enable();},activate:function(id){var A=this.items[id];if(!A){return null;}if(A==this.active||A.disabled){return A;
1179 }var e={};this.fireEvent("beforetabchange",this,e,A);if(e.cancel!==true&&!A.disabled){if(this.active){this.active.hide();}this.active=this.items[id];this.active.show();this.fireEvent("tabchange",this,this.active);}return A;},getActiveTab:function(){return this.active;
1180 },syncHeight:function(A){var B=(A||this.el.getHeight())-this.el.getBorderWidth("tb")-this.el.getPadding("tb");var bm=this.bodyEl.getMargins();var C=B-(this.stripWrap.getHeight()||0)-(bm.top+bm.bottom);this.bodyEl.setHeight(C);return C;},onResize:function(){if(this.monitorResize){this.autoSizeTabs();
1181 }},beginUpdate:function(){this.updating=true;},endUpdate:function(){this.updating=false;this.autoSizeTabs();},autoSizeTabs:function(){var A=this.items.length;var B=A-this.hiddenCount;if(!this.resizeTabs||A<1||B<1||this.updating){return;}var w=Math.max(this.el.getWidth()-this.cpad,10);
1182 var C=Math.floor(w/B);var b=this.stripBody;if(b.getWidth()>w){var D=this.items;this.setTabWidth(Math.max(C,this.minTabWidth)-2);if(C<this.minTabWidth){}}else{if(this.currentTabWidth<this.preferredTabWidth){this.setTabWidth(Math.min(C,this.preferredTabWidth)-2);
1183 }}},getCount:function(){return this.items.length;},setTabWidth:function(A){this.currentTabWidth=A;for(var i=0,B=this.items.length;i<B;i++){if(!this.items[i].isHidden()){this.items[i].setWidth(A);}}},destroy:function(A){Roo.EventManager.removeResizeListener(this.onResize,this);
1184 for(var i=0,B=this.items.length;i<B;i++){this.items[i].purgeListeners();}if(A===true){this.el.update("");this.el.remove();}}});Roo.TabPanelItem=function(A,id,B,C){this.tabPanel=A;this.id=id;this.disabled=false;this.text=B;this.loaded=false;this.closable=C;
1185 this.bodyEl=Roo.get(A.createItemBody(A.bodyEl.dom,id));this.bodyEl.setVisibilityMode(Roo.Element.VISIBILITY);this.bodyEl.setStyle("display","block");this.bodyEl.setStyle("zoom","1");this.hideAction();var D=A.createStripElements(A.stripEl.dom,B,C);this.el=Roo.get(D.el,true);
1186 this.inner=Roo.get(D.inner,true);this.textEl=Roo.get(this.el.dom.firstChild.firstChild.firstChild,true);this.pnode=Roo.get(D.el.parentNode,true);this.el.on("mousedown",this.onTabMouseDown,this);this.el.on("click",this.onTabClick,this);if(C){var c=Roo.get(D.close,true);
1187 c.dom.title=this.closeText;c.addClassOnOver("close-over");c.on("click",this.closeClick,this);}this.addEvents({"activate":true,"beforeclose":true,"close":true,"deactivate":true});this.hidden=false;Roo.TabPanelItem.superclass.constructor.call(this);};Roo.extend(Roo.TabPanelItem,Roo.util.Observable,{purgeListeners:function(){Roo.util.Observable.prototype.purgeListeners.call(this);
1188 this.el.removeAllListeners();},show:function(){this.pnode.addClass("on");this.showAction();if(Roo.isOpera){this.tabPanel.stripWrap.repaint();}this.fireEvent("activate",this.tabPanel,this);},isActive:function(){return this.tabPanel.getActiveTab()==this;},hide:function(){this.pnode.removeClass("on");
1189 this.hideAction();this.fireEvent("deactivate",this.tabPanel,this);},hideAction:function(){this.bodyEl.hide();this.bodyEl.setStyle("position","absolute");this.bodyEl.setLeft("-20000px");this.bodyEl.setTop("-20000px");},showAction:function(){this.bodyEl.setStyle("position","relative");
1190 this.bodyEl.setTop("");this.bodyEl.setLeft("");this.bodyEl.show();},setTooltip:function(A){if(Roo.QuickTips&&Roo.QuickTips.isEnabled()){this.textEl.dom.qtip=A;this.textEl.dom.removeAttribute('title');}else{this.textEl.dom.title=A;}},onTabClick:function(e){e.preventDefault();
1191 this.tabPanel.activate(this.id);},onTabMouseDown:function(e){e.preventDefault();this.tabPanel.activate(this.id);},getWidth:function(){return this.inner.getWidth();},setWidth:function(A){var B=A-this.pnode.getPadding("lr");this.inner.setWidth(B);this.textEl.setWidth(B-this.inner.getPadding("lr"));
1192 this.pnode.setWidth(A);},setHidden:function(A){this.hidden=A;this.pnode.setStyle("display",A?"none":"");},isHidden:function(){return this.hidden;},getText:function(){return this.text;},autoSize:function(){this.textEl.setWidth(1);this.setWidth(this.textEl.dom.scrollWidth+this.pnode.getPadding("lr")+this.inner.getPadding("lr")+2);
1193 },setText:function(A){this.text=A;this.textEl.update(A);this.setTooltip(A);if(!this.tabPanel.resizeTabs){this.autoSize();}},activate:function(){this.tabPanel.activate(this.id);},disable:function(){if(this.tabPanel.active!=this){this.disabled=true;this.pnode.addClass("disabled");
1194 }},enable:function(){this.disabled=false;this.pnode.removeClass("disabled");},setContent:function(A,B){this.bodyEl.update(A,B);},getUpdateManager:function(){return this.bodyEl.getUpdateManager();},setUrl:function(A,B,C){if(this.refreshDelegate){this.un('activate',this.refreshDelegate);
1195 }this.refreshDelegate=this._handleRefresh.createDelegate(this,[A,B,C]);this.on("activate",this.refreshDelegate);return this.bodyEl.getUpdateManager();},_handleRefresh:function(A,B,C){if(!C||!this.loaded){var D=this.bodyEl.getUpdateManager();D.update(A,B,this._setLoaded.createDelegate(this));
1196 }},refresh:function(){if(this.refreshDelegate){this.loaded=false;this.refreshDelegate();}},_setLoaded:function(){this.loaded=true;},closeClick:function(e){var o={};e.stopEvent();this.fireEvent("beforeclose",this,o);if(o.cancel!==true){this.tabPanel.removeTab(this.id);
1197 }},closeText:"Close this tab"});Roo.TabPanel.prototype.createStrip=function(A){var B=document.createElement("div");B.className="x-tabs-wrap";A.appendChild(B);return B;};Roo.TabPanel.prototype.createStripList=function(A){A.innerHTML='<div class="x-tabs-strip-wrap">'+'<table class="x-tabs-strip" cellspacing="0" cellpadding="0" border="0"><tbody><tr>'+'<td class="x-tab-strip-toolbar"></td></tr></tbody></table></div>';
1198 return A.firstChild.firstChild.firstChild.firstChild;};Roo.TabPanel.prototype.createBody=function(A){var B=document.createElement("div");Roo.id(B,"tab-body");Roo.fly(B).addClass("x-tabs-body");A.appendChild(B);return B;};Roo.TabPanel.prototype.createItemBody=function(A,id){var B=Roo.getDom(id);
1199 if(!B){B=document.createElement("div");B.id=id;}Roo.fly(B).addClass("x-tabs-item-body");A.insertBefore(B,A.firstChild);return B;};Roo.TabPanel.prototype.createStripElements=function(A,B,C){var td=document.createElement("td");A.insertBefore(td,A.childNodes[A.childNodes.length-1]);
1200 if(C){td.className="x-tabs-closable";if(!this.closeTpl){this.closeTpl=new Roo.Template('<a href="#" class="x-tabs-right"><span class="x-tabs-left"><em class="x-tabs-inner">'+'<span unselectable="on"'+(this.disableTooltips?'':' title="{text}"')+' class="x-tabs-text">{text}</span>'+'<div unselectable="on" class="close-icon">&#160;</div></em></span></a>');
1201 }var el=this.closeTpl.overwrite(td,{"text":B});var D=el.getElementsByTagName("div")[0];var E=el.getElementsByTagName("em")[0];return {"el":el,"close":D,"inner":E};}else{if(!this.tabTpl){this.tabTpl=new Roo.Template('<a href="#" class="x-tabs-right"><span class="x-tabs-left"><em class="x-tabs-inner">'+'<span unselectable="on"'+(this.disableTooltips?'':' title="{text}"')+' class="x-tabs-text">{text}</span></em></span></a>');
1202 }var el=this.tabTpl.overwrite(td,{"text":B});var E=el.getElementsByTagName("em")[0];return {"el":el,"inner":E};}};
1203 // Roo/Button.js
1204 Roo.Button=function(A,B){if(!B){B=A;A=B.renderTo||false;}Roo.apply(this,B);this.addEvents({"click":true,"toggle":true,'mouseover':true,'mouseout':true,'render':true});if(this.menu){this.menu=Roo.menu.MenuMgr.get(this.menu);}Roo.util.Observable.call(this);if(A){this.render(A);
1205 }};Roo.extend(Roo.Button,Roo.util.Observable,{hidden:false,disabled:false,pressed:false,tabIndex:undefined,enableToggle:false,menu:undefined,menuAlign:"tl-bl?",iconCls:undefined,type:'button',menuClassTarget:'tr',clickEvent:'click',handleMouseEvents:true,tooltipType:'qtip',render:function(A){var B;
1206 if(this.hideParent){this.parentEl=Roo.get(A);}if(!this.dhconfig){if(!this.template){if(!Roo.Button.buttonTemplate){Roo.Button.buttonTemplate=new Roo.Template('<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>','<td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><em unselectable="on"><button class="x-btn-text" type="{1}">{0}</button></em></td><td class="x-btn-right"><i>&#160;</i></td>',"</tr></tbody></table>");
1207 }this.template=Roo.Button.buttonTemplate;}B=this.template.append(A,[this.text||'&#160;',this.type],true);var C=B.child("button:first");C.on('focus',this.onFocus,this);C.on('blur',this.onBlur,this);if(this.cls){B.addClass(this.cls);}if(this.icon){C.setStyle('background-image','url('+this.icon+')');
1208 }if(this.iconCls){C.addClass(this.iconCls);if(!this.cls){B.addClass(this.text?'x-btn-text-icon':'x-btn-icon');}}if(this.tabIndex!==undefined){C.dom.tabIndex=this.tabIndex;}if(this.tooltip){if(typeof this.tooltip=='object'){Roo.QuickTips.tips(Roo.apply({target:C.id}
1209 ,this.tooltip));}else{C.dom[this.tooltipType]=this.tooltip;}}}else{B=Roo.DomHelper.append(Roo.get(A).dom,this.dhconfig,true);}this.el=B;if(this.id){this.el.dom.id=this.el.id=this.id;}if(this.menu){this.el.child(this.menuClassTarget).addClass("x-btn-with-menu");
1210 this.menu.on("show",this.onMenuShow,this);this.menu.on("hide",this.onMenuHide,this);}B.addClass("x-btn");if(Roo.isIE&&!Roo.isIE7){this.autoWidth.defer(1,this);}else{this.autoWidth();}if(this.handleMouseEvents){B.on("mouseover",this.onMouseOver,this);B.on("mouseout",this.onMouseOut,this);
1211 B.on("mousedown",this.onMouseDown,this);}B.on(this.clickEvent,this.onClick,this);if(this.hidden){this.hide();}if(this.disabled){this.disable();}Roo.ButtonToggleMgr.register(this);if(this.pressed){this.el.addClass("x-btn-pressed");}if(this.repeat){var D=new Roo.util.ClickRepeater(B,typeof this.repeat=="object"?this.repeat:{}
1212 );D.on("click",this.onClick,this);}this.fireEvent('render',this);},getEl:function(){return this.el;},destroy:function(){Roo.ButtonToggleMgr.unregister(this);this.el.removeAllListeners();this.purgeListeners();this.el.remove();},autoWidth:function(){if(this.el){this.el.setWidth("auto");
1213 if(Roo.isIE7&&Roo.isStrict){var ib=this.el.child('button');if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Roo.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));}}if(this.minWidth){if(this.hidden){this.el.beginMeasure();}if(this.el.getWidth()<this.minWidth){this.el.setWidth(this.minWidth);
1214 }if(this.hidden){this.el.endMeasure();}}}},setHandler:function(A,B){this.handler=A;this.scope=B;},setText:function(A){this.text=A;if(this.el){this.el.child("td.x-btn-center button.x-btn-text").update(A);}this.autoWidth();},getText:function(){return this.text;
1215 },show:function(){this.hidden=false;if(this.el){this[this.hideParent?'parentEl':'el'].setStyle("display","");}},hide:function(){this.hidden=true;if(this.el){this[this.hideParent?'parentEl':'el'].setStyle("display","none");}},setVisible:function(A){if(A){this.show();
1216 }else{this.hide();}},setPressed:function(A){if(A!=this.pressed){if(A){this.el.addClass("x-btn-pressed");this.pressed=true;}else{this.el.removeClass("x-btn-pressed");this.pressed=false;}}},toggle:function(A){A=A===undefined?!this.pressed:A;if(A!=this.pressed){if(A){this.el.addClass("x-btn-pressed");
1217 this.pressed=true;this.fireEvent("toggle",this,true);}else{this.el.removeClass("x-btn-pressed");this.pressed=false;this.fireEvent("toggle",this,false);}if(this.toggleHandler){this.toggleHandler.call(this.scope||this,this,A);}}},focus:function(){this.el.child('button:first').focus();
1218 },disable:function(){if(this.el){this.el.addClass("x-btn-disabled");}this.disabled=true;},enable:function(){if(this.el){this.el.removeClass("x-btn-disabled");}this.disabled=false;},setDisabled:function(v){this[v!==true?"enable":"disable"]();},onClick:function(e){if(e){e.preventDefault();
1219 }if(e.button!=0){return;}if(!this.disabled){if(this.enableToggle){this.toggle();}if(this.menu&&!this.menu.isVisible()){this.menu.show(this.el,this.menuAlign);}this.fireEvent("click",this,e);if(this.handler){this.el.removeClass("x-btn-over");this.handler.call(this.scope||this,this,e);
1220 }}},onMouseOver:function(e){if(!this.disabled){this.el.addClass("x-btn-over");this.fireEvent('mouseover',this,e);}},onMouseOut:function(e){if(!e.within(this.el,true)){this.el.removeClass("x-btn-over");this.fireEvent('mouseout',this,e);}},onFocus:function(e){if(!this.disabled){this.el.addClass("x-btn-focus");
1221 }},onBlur:function(e){this.el.removeClass("x-btn-focus");},onMouseDown:function(e){if(!this.disabled&&e.button==0){this.el.addClass("x-btn-click");Roo.get(document).on('mouseup',this.onMouseUp,this);}},onMouseUp:function(e){if(e.button==0){this.el.removeClass("x-btn-click");
1222 Roo.get(document).un('mouseup',this.onMouseUp,this);}},onMenuShow:function(e){this.el.addClass("x-btn-menu-active");},onMenuHide:function(e){this.el.removeClass("x-btn-menu-active");}});Roo.ButtonToggleMgr=function(){var A={};function toggleGroup(B,C){if(C){var g=A[B.toggleGroup];
1223 for(var i=0,l=g.length;i<l;i++){if(g[i]!=B){g[i].toggle(false);}}}}return {register:function(B){if(!B.toggleGroup){return;}var g=A[B.toggleGroup];if(!g){g=A[B.toggleGroup]=[];}g.push(B);B.on("toggle",toggleGroup);},unregister:function(B){if(!B.toggleGroup){return;
1224 }var g=A[B.toggleGroup];if(g){g.remove(B);B.un("toggle",toggleGroup);}}};}();
1225 // Roo/SplitButton.js
1226 Roo.SplitButton=function(A,B){Roo.SplitButton.superclass.constructor.call(this,A,B);this.addEvents({"arrowclick":true});};Roo.extend(Roo.SplitButton,Roo.Button,{render:function(A){var B=new Roo.Template('<table cellspacing="0" class="x-btn-menu-wrap x-btn"><tr><td>','<table cellspacing="0" class="x-btn-wrap x-btn-menu-text-wrap"><tbody>','<tr><td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><button class="x-btn-text" type="{1}">{0}</button></td></tr>',"</tbody></table></td><td>",'<table cellspacing="0" class="x-btn-wrap x-btn-menu-arrow-wrap"><tbody>','<tr><td class="x-btn-center"><button class="x-btn-menu-arrow-el" type="button">&#160;</button></td><td class="x-btn-right"><i>&#160;</i></td></tr>',"</tbody></table></td></tr></table>");
1227 var C=B.append(A,[this.text,this.type],true);var D=C.child("button");if(this.cls){C.addClass(this.cls);}if(this.icon){D.setStyle('background-image','url('+this.icon+')');}if(this.iconCls){D.addClass(this.iconCls);if(!this.cls){C.addClass(this.text?'x-btn-text-icon':'x-btn-icon');
1228 }}this.el=C;if(this.handleMouseEvents){C.on("mouseover",this.onMouseOver,this);C.on("mouseout",this.onMouseOut,this);C.on("mousedown",this.onMouseDown,this);C.on("mouseup",this.onMouseUp,this);}C.on(this.clickEvent,this.onClick,this);if(this.tooltip){if(typeof this.tooltip=='object'){Roo.QuickTips.tips(Roo.apply({target:D.id}
1229 ,this.tooltip));}else{D.dom[this.tooltipType]=this.tooltip;}}if(this.arrowTooltip){C.child("button:nth(2)").dom[this.tooltipType]=this.arrowTooltip;}if(this.hidden){this.hide();}if(this.disabled){this.disable();}if(this.pressed){this.el.addClass("x-btn-pressed");
1230 }if(Roo.isIE&&!Roo.isIE7){this.autoWidth.defer(1,this);}else{this.autoWidth();}if(this.menu){this.menu.on("show",this.onMenuShow,this);this.menu.on("hide",this.onMenuHide,this);}this.fireEvent('render',this);},autoWidth:function(){if(this.el){var A=this.el.child("table:first");
1231 var B=this.el.child("table:last");this.el.setWidth("auto");A.setWidth("auto");if(Roo.isIE7&&Roo.isStrict){var ib=this.el.child('button:first');if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Roo.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));
1232 }}if(this.minWidth){if(this.hidden){this.el.beginMeasure();}if((A.getWidth()+B.getWidth())<this.minWidth){A.setWidth(this.minWidth-B.getWidth());}if(this.hidden){this.el.endMeasure();}}this.el.setWidth(A.getWidth()+B.getWidth());}},setHandler:function(A,B){this.handler=A;
1233 this.scope=B;},setArrowHandler:function(A,B){this.arrowHandler=A;this.scope=B;},focus:function(){if(this.el){this.el.child("button:first").focus();}},onClick:function(e){e.preventDefault();if(!this.disabled){if(e.getTarget(".x-btn-menu-arrow-wrap")){if(this.menu&&!this.menu.isVisible()){this.menu.show(this.el,this.menuAlign);
1234 }this.fireEvent("arrowclick",this,e);if(this.arrowHandler){this.arrowHandler.call(this.scope||this,this,e);}}else{this.fireEvent("click",this,e);if(this.handler){this.handler.call(this.scope||this,this,e);}}}},onMouseDown:function(e){if(!this.disabled){Roo.fly(e.getTarget("table")).addClass("x-btn-click");
1235 }},onMouseUp:function(e){Roo.fly(e.getTarget("table")).removeClass("x-btn-click");}});Roo.MenuButton=Roo.SplitButton;
1236 // Roo/Toolbar.js
1237 Roo.Toolbar=function(A,B,C){if(A instanceof Array){B=A;C=B;A=null;}if(typeof(A)=='object'&&A.xtype){C=A;A=C.container;B=C.buttons||[];}var D=[];if(C&&C.items){D=C.items;delete C.items;}Roo.apply(this,C);this.buttons=B;if(A){this.render(A);}this.xitems=D;Roo.each(D,function(b){this.add(b);
1238 },this);};Roo.Toolbar.prototype={items:false,render:function(ct){this.el=Roo.get(ct);if(this.cls){this.el.addClass(this.cls);}this.el.update('<div class="x-toolbar x-small-editor"><table cellspacing="0"><tr></tr></table></div>');this.tr=this.el.child("tr",true);
1239 var A=0;this.items=new Roo.util.MixedCollection(false,function(o){return o.id||("item"+(++A));});if(this.buttons){this.add.apply(this,this.buttons);delete this.buttons;}},add:function(){var a=arguments,l=a.length;for(var i=0;i<l;i++){this._add(a[i]);}},_add:function(el){if(el.xtype){el=Roo.factory(el,typeof(Roo.Toolbar[el.xtype])=='undefined'?Roo.form:Roo.Toolbar);
1240 }if(el.applyTo){return this.addField(el);}if(el.render){return this.addItem(el);}if(typeof el=="string"){if(el=="separator"||el=="-"){return this.addSeparator();}if(el==" "){return this.addSpacer();}if(el=="->"){return this.addFill();}return this.addText(el);
1241 }if(el.tagName){return this.addElement(el);}if(typeof el=="object"){return this.addButton(el);}return false;},addxtype:function(e){return this.add(e);},getEl:function(){return this.el;},addSeparator:function(){return this.addItem(new Roo.Toolbar.Separator());
1242 },addSpacer:function(){return this.addItem(new Roo.Toolbar.Spacer());},addFill:function(){return this.addItem(new Roo.Toolbar.Fill());},addElement:function(el){return this.addItem(new Roo.Toolbar.Item(el));},items:false,addItem:function(A){var td=this.nextBlock();
1243 A.render(td);this.items.add(A);return A;},addButton:function(A){if(A instanceof Array){var B=[];for(var i=0,C=A.length;i<C;i++){B.push(this.addButton(A[i]));}return B;}var b=A;if(!(A instanceof Roo.Toolbar.Button)){b=A.split?new Roo.Toolbar.SplitButton(A):new Roo.Toolbar.Button(A);
1244 }var td=this.nextBlock();b.render(td);this.items.add(b);return b;},addText:function(A){return this.addItem(new Roo.Toolbar.TextItem(A));},insertButton:function(A,B){if(B instanceof Array){var C=[];for(var i=0,D=B.length;i<D;i++){C.push(this.insertButton(A+i,B[i]));
1245 }return C;}if(!(B instanceof Roo.Toolbar.Button)){B=new Roo.Toolbar.Button(B);}var td=document.createElement("td");this.tr.insertBefore(td,this.tr.childNodes[A]);B.render(td);this.items.insert(A,B);return B;},addDom:function(A,B){var td=this.nextBlock();Roo.DomHelper.overwrite(td,A);
1246 var ti=new Roo.Toolbar.Item(td.firstChild);ti.render(td);this.items.add(ti);return ti;},fields:false,addField:function(A){if(!this.fields){var B=0;this.fields=new Roo.util.MixedCollection(false,function(o){return o.id||("item"+(++B));});}var td=this.nextBlock();
1247 A.render(td);var ti=new Roo.Toolbar.Item(td.firstChild);ti.render(td);this.items.add(ti);this.fields.add(A);return ti;},hide:function(){this.el.child('div').setVisibilityMode(Roo.Element.DISPLAY);this.el.child('div').hide();},show:function(){this.el.child('div').show();
1248 },nextBlock:function(){var td=document.createElement("td");this.tr.appendChild(td);return td;},destroy:function(){if(this.items){Roo.destroy.apply(Roo,this.items.items);}if(this.fields){Roo.destroy.apply(Roo,this.fields.items);}Roo.Element.uncache(this.el,this.tr);
1249 }};Roo.Toolbar.Item=function(el){var A={};if(typeof(el.xtype)!='undefined'){A=el;el=A.el;}this.el=Roo.getDom(el);this.id=Roo.id(this.el);this.hidden=false;this.addEvents({'render':true});Roo.Toolbar.Item.superclass.constructor.call(this,A);};Roo.extend(Roo.Toolbar.Item,Roo.util.Observable,{getEl:function(){return this.el;
1250 },render:function(td){this.td=td;td.appendChild(this.el);this.fireEvent('render',this);},destroy:function(){this.td.parentNode.removeChild(this.td);},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";
1251 },setVisible:function(A){if(A){this.show();}else{this.hide();}},focus:function(){Roo.fly(this.el).focus();},disable:function(){Roo.fly(this.td).addClass("x-item-disabled");this.disabled=true;this.el.disabled=true;},enable:function(){Roo.fly(this.td).removeClass("x-item-disabled");
1252 this.disabled=false;this.el.disabled=false;}});Roo.Toolbar.Separator=function(A){var s=document.createElement("span");s.className="ytb-sep";if(A){A.el=s;}Roo.Toolbar.Separator.superclass.constructor.call(this,A||s);};Roo.extend(Roo.Toolbar.Separator,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn}
1253 );Roo.Toolbar.Spacer=function(A){var s=document.createElement("div");s.className="ytb-spacer";if(A){A.el=s;}Roo.Toolbar.Spacer.superclass.constructor.call(this,A||s);};Roo.extend(Roo.Toolbar.Spacer,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn}
1254 );Roo.Toolbar.Fill=Roo.extend(Roo.Toolbar.Spacer,{render:function(td){td.style.width='100%';Roo.Toolbar.Fill.superclass.render.call(this,td);}});Roo.Toolbar.TextItem=function(A){var B=A||"";if(typeof(A)=='object'){B=A.text||"";}else{A=null;}var s=document.createElement("span");
1255 s.className="ytb-text";s.innerHTML=B;if(A){A.el=s;}Roo.Toolbar.TextItem.superclass.constructor.call(this,A||s);};Roo.extend(Roo.Toolbar.TextItem,Roo.Toolbar.Item,{enable:Roo.emptyFn,disable:Roo.emptyFn,focus:Roo.emptyFn,show:function(){this.hidden=false;this.el.style.display="";
1256 },hide:function(){this.hidden=true;this.el.style.display="none";}});Roo.Toolbar.Button=function(A){Roo.Toolbar.Button.superclass.constructor.call(this,null,A);};Roo.extend(Roo.Toolbar.Button,Roo.Button,{render:function(td){this.td=td;Roo.Toolbar.Button.superclass.render.call(this,td);
1257 },destroy:function(){Roo.Toolbar.Button.superclass.destroy.call(this);this.td.parentNode.removeChild(this.td);},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;this.td.style.display="none";},disable:function(){Roo.fly(this.td).addClass("x-item-disabled");
1258 this.disabled=true;},enable:function(){Roo.fly(this.td).removeClass("x-item-disabled");this.disabled=false;}});Roo.ToolbarButton=Roo.Toolbar.Button;Roo.Toolbar.SplitButton=function(A){Roo.Toolbar.SplitButton.superclass.constructor.call(this,null,A);};Roo.extend(Roo.Toolbar.SplitButton,Roo.SplitButton,{render:function(td){this.td=td;
1259 Roo.Toolbar.SplitButton.superclass.render.call(this,td);},destroy:function(){Roo.Toolbar.SplitButton.superclass.destroy.call(this);this.td.parentNode.removeChild(this.td);},show:function(){this.hidden=false;this.td.style.display="";},hide:function(){this.hidden=true;
1260 this.td.style.display="none";}});Roo.Toolbar.MenuButton=Roo.Toolbar.SplitButton;
1261 // Roo/PagingToolbar.js
1262 Roo.PagingToolbar=function(el,ds,A){if(typeof(el)=='object'&&el.xtype){A=el;ds=el.dataSource;el=A.container;}var B=[];if(A.items){B=A.items;A.items=[];}Roo.PagingToolbar.superclass.constructor.call(this,el,null,A);this.ds=ds;this.cursor=0;this.renderButtons(this.el);
1263 this.bind(ds);Roo.each(B,function(e){this.add(Roo.factory(e));},this);};Roo.extend(Roo.PagingToolbar,Roo.Toolbar,{pageSize:20,displayMsg:'Displaying {0} - {1} of {2}',emptyMsg:'No data to display',beforePageText:"Page",afterPageText:"of {0}",firstText:"First Page",prevText:"Previous Page",nextText:"Next Page",lastText:"Last Page",refreshText:"Refresh",renderButtons:function(el){Roo.PagingToolbar.superclass.render.call(this,el);
1264 this.first=this.addButton({tooltip:this.firstText,cls:"x-btn-icon x-grid-page-first",disabled:true,handler:this.onClick.createDelegate(this,["first"])});this.prev=this.addButton({tooltip:this.prevText,cls:"x-btn-icon x-grid-page-prev",disabled:true,handler:this.onClick.createDelegate(this,["prev"])}
1265 );this.add(this.beforePageText);this.field=Roo.get(this.addDom({tag:"input",type:"text",size:"3",value:"1",cls:"x-grid-page-number"}).el);this.field.on("keydown",this.onPagingKeydown,this);this.field.on("focus",function(){this.dom.select();});this.afterTextEl=this.addText(String.format(this.afterPageText,1));
1266 this.field.setHeight(18);this.next=this.addButton({tooltip:this.nextText,cls:"x-btn-icon x-grid-page-next",disabled:true,handler:this.onClick.createDelegate(this,["next"])});this.last=this.addButton({tooltip:this.lastText,cls:"x-btn-icon x-grid-page-last",disabled:true,handler:this.onClick.createDelegate(this,["last"])}
1267 );this.loading=this.addButton({tooltip:this.refreshText,cls:"x-btn-icon x-grid-loading",handler:this.onClick.createDelegate(this,["refresh"])});if(this.displayInfo){this.displayEl=Roo.fly(this.el.dom.firstChild).createChild({cls:'x-paging-info'});}},updateInfo:function(){if(this.displayEl){var A=this.ds.getCount();
1268 var B=A==0?this.emptyMsg:String.format(this.displayMsg,this.cursor+1,this.cursor+A,this.ds.getTotalCount());this.displayEl.update(B);}},onLoad:function(ds,r,o){this.cursor=o.params?o.params.start:0;var d=this.getPageData(),ap=d.activePage,ps=d.pages;this.afterTextEl.el.innerHTML=String.format(this.afterPageText,d.pages);
1269 this.field.dom.value=ap;this.first.setDisabled(ap==1);this.prev.setDisabled(ap==1);this.next.setDisabled(ap==ps);this.last.setDisabled(ap==ps);this.loading.enable();this.updateInfo();},getPageData:function(){var A=this.ds.getTotalCount();return {total:A,activePage:Math.ceil((this.cursor+this.pageSize)/this.pageSize),pages:A<this.pageSize?1:Math.ceil(A/this.pageSize)}
1270 ;},onLoadError:function(){this.loading.enable();},onPagingKeydown:function(e){var k=e.getKey();var d=this.getPageData();if(k==e.RETURN){var v=this.field.dom.value,A;if(!v||isNaN(A=parseInt(v,10))){this.field.dom.value=d.activePage;return;}A=Math.min(Math.max(1,A),d.pages)-1;
1271 this.ds.load({params:{start:A*this.pageSize,limit:this.pageSize}});e.stopEvent();}else if(k==e.HOME||(k==e.UP&&e.ctrlKey)||(k==e.PAGEUP&&e.ctrlKey)||(k==e.RIGHT&&e.ctrlKey)||k==e.END||(k==e.DOWN&&e.ctrlKey)||(k==e.LEFT&&e.ctrlKey)||(k==e.PAGEDOWN&&e.ctrlKey)){var A=(k==e.HOME||(k==e.DOWN&&e.ctrlKey)||(k==e.LEFT&&e.ctrlKey)||(k==e.PAGEDOWN&&e.ctrlKey))?1:d.pages;
1272 this.field.dom.value=A;this.ds.load({params:{start:(A-1)*this.pageSize,limit:this.pageSize}});e.stopEvent();}else if(k==e.UP||k==e.RIGHT||k==e.PAGEUP||k==e.DOWN||k==e.LEFT||k==e.PAGEDOWN){var v=this.field.dom.value,A;var B=(e.shiftKey)?10:1;if(k==e.DOWN||k==e.LEFT||k==e.PAGEDOWN){B*=-1;
1273 }if(!v||isNaN(A=parseInt(v,10))){this.field.dom.value=d.activePage;return;}else if(parseInt(v,10)+B>=1&parseInt(v,10)+B<=d.pages){this.field.dom.value=parseInt(v,10)+B;A=Math.min(Math.max(1,A+B),d.pages)-1;this.ds.load({params:{start:A*this.pageSize,limit:this.pageSize}
1274 });}e.stopEvent();}},beforeLoad:function(){if(this.loading){this.loading.disable();}},onClick:function(A){var ds=this.ds;switch(A){case "first":ds.load({params:{start:0,limit:this.pageSize}});break;case "prev":ds.load({params:{start:Math.max(0,this.cursor-this.pageSize),limit:this.pageSize}
1275 });break;case "next":ds.load({params:{start:this.cursor+this.pageSize,limit:this.pageSize}});break;case "last":var B=ds.getTotalCount();var C=B%this.pageSize;var D=C?(B-C):B-this.pageSize;ds.load({params:{start:D,limit:this.pageSize}});break;case "refresh":ds.load({params:{start:this.cursor,limit:this.pageSize}
1276 });break;}},unbind:function(ds){ds.un("beforeload",this.beforeLoad,this);ds.un("load",this.onLoad,this);ds.un("loadexception",this.onLoadError,this);ds.un("remove",this.updateInfo,this);ds.un("add",this.updateInfo,this);this.ds=undefined;},bind:function(ds){ds.on("beforeload",this.beforeLoad,this);
1277 ds.on("load",this.onLoad,this);ds.on("loadexception",this.onLoadError,this);ds.on("remove",this.updateInfo,this);ds.on("add",this.updateInfo,this);this.ds=ds;}});
1278 // Roo/Resizable.js
1279 Roo.Resizable=function(el,A){this.el=Roo.get(el);if(A&&A.wrap){A.resizeChild=this.el;this.el=this.el.wrap(typeof A.wrap=="object"?A.wrap:{cls:"xresizable-wrap"});this.el.id=this.el.dom.id=A.resizeChild.id+"-rzwrap";this.el.setStyle("overflow","hidden");this.el.setPositioning(A.resizeChild.getPositioning());
1280 A.resizeChild.clearPositioning();if(!A.width||!A.height){var B=A.resizeChild.getSize();this.el.setSize(B.width,B.height);}if(A.pinned&&!A.adjustments){A.adjustments="auto";}}this.proxy=this.el.createProxy({tag:"div",cls:"x-resizable-proxy",id:this.el.id+"-rzproxy"}
1281 );this.proxy.unselectable();this.proxy.enableDisplayMode('block');Roo.apply(this,A);if(this.pinned){this.disableTrackOver=true;this.el.addClass("x-resizable-pinned");}var C=this.el.getStyle("position");if(C!="absolute"&&C!="fixed"){this.el.setStyle("position","relative");
1282 }if(!this.handles){this.handles='s,e,se';if(this.multiDirectional){this.handles+=',n,w';}}if(this.handles=="all"){this.handles="n s e w ne nw se sw";}var hs=this.handles.split(/\s*?[,;]\s*?| /);var ps=Roo.Resizable.positions;for(var i=0,D=hs.length;i<D;i++){if(hs[i]&&ps[hs[i]]){var E=ps[hs[i]];
1283 this[E]=new Roo.Resizable.Handle(this,E,this.disableTrackOver,this.transparent);}}this.corner=this.southeast;if(this.handles.indexOf("n")!=-1||this.handles.indexOf("w")!=-1||this.handles.indexOf("hd")!=-1){this.updateBox=true;}this.activeHandle=null;if(this.resizeChild){if(typeof this.resizeChild=="boolean"){this.resizeChild=Roo.get(this.el.dom.firstChild,true);
1284 }else{this.resizeChild=Roo.get(this.resizeChild,true);}}if(this.adjustments=="auto"){var rc=this.resizeChild;var hw=this.west,he=this.east,hn=this.north,hs=this.south;if(rc&&(hw||hn)){rc.position("relative");rc.setLeft(hw?hw.el.getWidth():0);rc.setTop(hn?hn.el.getHeight():0);
1285 }this.adjustments=[(he?-he.el.getWidth():0)+(hw?-hw.el.getWidth():0),(hn?-hn.el.getHeight():0)+(hs?-hs.el.getHeight():0)-1];}if(this.draggable){this.dd=this.dynamic?this.el.initDD(null):this.el.initDDProxy(null,{dragElId:this.proxy.id});this.dd.setHandleElId(this.resizeChild?this.resizeChild.id:this.el.id);
1286 }this.addEvents({"beforeresize":true,"resizing":true,"resize":true});if(this.width!==null&&this.height!==null){this.resizeTo(this.width,this.height);}else{this.updateChildSize();}if(Roo.isIE){this.el.dom.style.zoom=1;}Roo.Resizable.superclass.constructor.call(this);
1287 };Roo.extend(Roo.Resizable,Roo.util.Observable,{resizeChild:false,adjustments:[0,0],minWidth:5,minHeight:5,maxWidth:10000,maxHeight:10000,enabled:true,animate:false,duration:.35,dynamic:false,handles:false,multiDirectional:false,disableTrackOver:false,easing:'easeOutStrong',widthIncrement:0,heightIncrement:0,pinned:false,width:null,height:null,preserveRatio:false,transparent:false,minX:0,minY:0,draggable:false,constrainTo:undefined,resizeRegion:undefined,resizeTo:function(A,B){this.el.setSize(A,B);
1288 this.updateChildSize();this.fireEvent("resize",this,A,B,null);},startSizing:function(e,A){this.fireEvent("beforeresize",this,e);if(this.enabled){if(!this.overlay){this.overlay=this.el.createProxy({tag:"div",cls:"x-resizable-overlay",html:"&#160;"});this.overlay.unselectable();
1289 this.overlay.enableDisplayMode("block");this.overlay.on("mousemove",this.onMouseMove,this);this.overlay.on("mouseup",this.onMouseUp,this);}this.overlay.setStyle("cursor",A.el.getStyle("cursor"));this.resizing=true;this.startBox=this.el.getBox();this.startPoint=e.getXY();
1290 this.offsets=[(this.startBox.x+this.startBox.width)-this.startPoint[0],(this.startBox.y+this.startBox.height)-this.startPoint[1]];this.overlay.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.overlay.show();if(this.constrainTo){var ct=Roo.get(this.constrainTo);
1291 this.resizeRegion=ct.getRegion().adjust(ct.getFrameWidth('t'),ct.getFrameWidth('l'),-ct.getFrameWidth('b'),-ct.getFrameWidth('r'));}this.proxy.setStyle('visibility','hidden');this.proxy.show();this.proxy.setBox(this.startBox);if(!this.dynamic){this.proxy.setStyle('visibility','visible');
1292 }}},onMouseDown:function(A,e){if(this.enabled){e.stopEvent();this.activeHandle=A;this.startSizing(e,A);}},onMouseUp:function(e){var A=this.resizeElement();this.resizing=false;this.handleOut();this.overlay.hide();this.proxy.hide();this.fireEvent("resize",this,A.width,A.height,e);
1293 },updateChildSize:function(){if(this.resizeChild){var el=this.el;var A=this.resizeChild;var B=this.adjustments;if(el.dom.offsetWidth){var b=el.getSize(true);A.setSize(b.width+B[0],b.height+B[1]);}if(Roo.isIE){setTimeout(function(){if(el.dom.offsetWidth){var b=el.getSize(true);
1294 A.setSize(b.width+B[0],b.height+B[1]);}},10);}}},snap:function(A,B,C){if(!B||!A){return A;}var D=A;var m=A%B;if(m>0){if(m>(B/2)){D=A+(B-m);}else{D=A-m;}}return Math.max(C,D);},resizeElement:function(){var A=this.proxy.getBox();if(this.updateBox){this.el.setBox(A,false,this.animate,this.duration,null,this.easing);
1295 }else{this.el.setSize(A.width,A.height,this.animate,this.duration,null,this.easing);}this.updateChildSize();if(!this.dynamic){this.proxy.hide();}return A;},constrain:function(v,A,m,mx){if(v-A<m){A=v-m;}else if(v-A>mx){A=mx-v;}return A;},onMouseMove:function(e){if(this.enabled){try{if(this.resizeRegion&&!this.resizeRegion.contains(e.getPoint())){return;
1296 }var A=this.curSize||this.startBox;var x=this.startBox.x,y=this.startBox.y;var ox=x,oy=y;var w=A.width,h=A.height;var ow=w,oh=h;var mw=this.minWidth,mh=this.minHeight;var B=this.maxWidth,C=this.maxHeight;var wi=this.widthIncrement;var hi=this.heightIncrement;
1297 var D=e.getXY();var E=-(this.startPoint[0]-Math.max(this.minX,D[0]));var F=-(this.startPoint[1]-Math.max(this.minY,D[1]));var G=this.activeHandle.position;switch(G){case "east":w+=E;w=Math.min(Math.max(mw,w),B);break;case "south":h+=F;h=Math.min(Math.max(mh,h),C);
1298 break;case "southeast":w+=E;h+=F;w=Math.min(Math.max(mw,w),B);h=Math.min(Math.max(mh,h),C);break;case "north":F=this.constrain(h,F,mh,C);y+=F;h-=F;break;case "hdrag":if(wi){var H=Math.abs(E);var I=(H%wi);if(I>(wi/2)){E=(E>0)?E-I+wi:E+I-wi;}else{E=(E>0)?E-I:E+I;
1299 }}x+=E;x=Math.max(this.minX,x);break;case "west":E=this.constrain(w,E,mw,B);x+=E;w-=E;break;case "northeast":w+=E;w=Math.min(Math.max(mw,w),B);F=this.constrain(h,F,mh,C);y+=F;h-=F;break;case "northwest":E=this.constrain(w,E,mw,B);F=this.constrain(h,F,mh,C);
1300 y+=F;h-=F;x+=E;w-=E;break;case "southwest":E=this.constrain(w,E,mw,B);h+=F;h=Math.min(Math.max(mh,h),C);x+=E;w-=E;break;}var sw=this.snap(w,wi,mw);var sh=this.snap(h,hi,mh);if(sw!=w||sh!=h){switch(G){case "northeast":y-=sh-h;break;case "north":y-=sh-h;break;
1301 case "southwest":x-=sw-w;break;case "west":x-=sw-w;break;case "northwest":x-=sw-w;y-=sh-h;break;}w=sw;h=sh;}if(this.preserveRatio){switch(G){case "southeast":case "east":h=oh*(w/ow);h=Math.min(Math.max(mh,h),C);w=ow*(h/oh);break;case "south":w=ow*(h/oh);w=Math.min(Math.max(mw,w),B);
1302 h=oh*(w/ow);break;case "northeast":w=ow*(h/oh);w=Math.min(Math.max(mw,w),B);h=oh*(w/ow);break;case "north":var tw=w;w=ow*(h/oh);w=Math.min(Math.max(mw,w),B);h=oh*(w/ow);x+=(tw-w)/2;break;case "southwest":h=oh*(w/ow);h=Math.min(Math.max(mh,h),C);var tw=w;w=ow*(h/oh);
1303 x+=tw-w;break;case "west":var th=h;h=oh*(w/ow);h=Math.min(Math.max(mh,h),C);y+=(th-h)/2;var tw=w;w=ow*(h/oh);x+=tw-w;break;case "northwest":var tw=w;var th=h;h=oh*(w/ow);h=Math.min(Math.max(mh,h),C);w=ow*(h/oh);y+=th-h;x+=tw-w;break;}}if(G=='hdrag'){w=ow;
1304 }this.proxy.setBounds(x,y,w,h);if(this.dynamic){this.resizeElement();}}catch(e){}}this.fireEvent("resizing",this,x,y,w,h,e);},handleOver:function(){if(this.enabled){this.el.addClass("x-resizable-over");}},handleOut:function(){if(!this.resizing){this.el.removeClass("x-resizable-over");
1305 }},getEl:function(){return this.el;},getResizeChild:function(){return this.resizeChild;},groupHandler:function(){},destroy:function(A){this.proxy.remove();if(this.overlay){this.overlay.removeAllListeners();this.overlay.remove();}var ps=Roo.Resizable.positions;
1306 for(var k in ps){if(typeof ps[k]!="function"&&this[ps[k]]){var h=this[ps[k]];h.el.removeAllListeners();h.el.remove();}}if(A){this.el.update("");this.el.remove();}}});Roo.Resizable.positions={n:"north",s:"south",e:"east",w:"west",se:"southeast",sw:"southwest",nw:"northwest",ne:"northeast",hd:"hdrag"}
1307 ;Roo.Resizable.Handle=function(rz,A,B,C){if(!this.tpl){var D=Roo.DomHelper.createTemplate({tag:"div",cls:"x-resizable-handle x-resizable-handle-{0}"});D.compile();Roo.Resizable.Handle.prototype.tpl=D;}this.position=A;this.rz=rz;var E=A=='hdrag'?'north':A;
1308 this.el=this.tpl.append(rz.el.dom,[E],true);if(A=='hdrag'){this.el.setStyle('cursor','pointer');}this.el.unselectable();if(C){this.el.setOpacity(0);}this.el.on("mousedown",this.onMouseDown,this);if(!B){this.el.on("mouseover",this.onMouseOver,this);this.el.on("mouseout",this.onMouseOut,this);
1309 }};Roo.Resizable.Handle.prototype={afterResize:function(rz){Roo.log('after?');},onMouseDown:function(e){this.rz.onMouseDown(this,e);},onMouseOver:function(e){this.rz.handleOver(this,e);},onMouseOut:function(e){this.rz.handleOut(this,e);}};
1310 // Roo/Editor.js
1311 Roo.Editor=function(A,B){Roo.Editor.superclass.constructor.call(this,B);this.field=A;this.addEvents({"beforestartedit":true,"startedit":true,"beforecomplete":true,"complete":true,"specialkey":true});};Roo.extend(Roo.Editor,Roo.Component,{value:"",alignment:"c-c?",shadow:"frame",constrain:false,completeOnEnter:false,cancelOnEsc:false,updateEl:false,onRender:function(ct,A){this.el=new Roo.Layer({shadow:this.shadow,cls:"x-editor",parentEl:ct,shim:this.shim,shadowOffset:4,id:this.id,constrain:this.constrain}
1312 );this.el.setStyle("overflow",Roo.isGecko?"auto":"hidden");if(this.field.msgTarget!='title'){this.field.msgTarget='qtip';}this.field.render(this.el);if(Roo.isGecko){this.field.el.dom.setAttribute('autocomplete','off');}this.field.on("specialkey",this.onSpecialKey,this);
1313 if(this.swallowKeys){this.field.el.swallowEvent(['keydown','keypress']);}this.field.show();this.field.on("blur",this.onBlur,this);if(this.field.grow){this.field.on("autosize",this.el.sync,this.el,{delay:1});}},onSpecialKey:function(A,e){if(this.completeOnEnter&&e.getKey()==e.ENTER){e.stopEvent();
1314 this.completeEdit();return;}if(e.getKey()==e.ENTER){return;}if(this.cancelOnEsc&&e.getKey()==e.ESC){this.cancelEdit();return;}this.fireEvent('specialkey',A,e);},startEdit:function(el,A){if(this.editing){this.completeEdit();}this.boundEl=Roo.get(el);var v=A!==undefined?A:this.boundEl.dom.innerHTML;
1315 if(!this.rendered){this.render(this.parentEl||document.body);}if(this.fireEvent("beforestartedit",this,this.boundEl,v)===false){return;}this.startValue=v;this.field.setValue(v);if(this.autoSize){var sz=this.boundEl.getSize();switch(this.autoSize){case "width":this.setSize(sz.width,"");
1316 break;case "height":this.setSize("",sz.height);break;default:this.setSize(sz.width,sz.height);}}this.el.alignTo(this.boundEl,this.alignment);this.editing=true;if(Roo.QuickTips){Roo.QuickTips.disable();}this.show();},setSize:function(w,h){this.field.setSize(w,h);
1317 if(this.el){this.el.sync();}},realign:function(){this.el.alignTo(this.boundEl,this.alignment);},completeEdit:function(A){if(!this.editing){return;}var v=this.getValue();if(this.revertInvalid!==false&&!this.field.isValid()){v=this.startValue;this.cancelEdit(true);
1318 }if(String(v)===String(this.startValue)&&this.ignoreNoChange){this.editing=false;this.hide();return;}if(this.fireEvent("beforecomplete",this,v,this.startValue)!==false){this.editing=false;if(this.updateEl&&this.boundEl){this.boundEl.update(v);}if(A!==true){this.hide();
1319 }this.fireEvent("complete",this,v,this.startValue);}},onShow:function(){this.el.show();if(this.hideEl!==false){this.boundEl.hide();}this.field.show();if(Roo.isIE&&!this.fixIEFocus){this.fixIEFocus=true;this.deferredFocus.defer(50,this);}else{this.field.focus();
1320 }this.fireEvent("startedit",this.boundEl,this.startValue);},deferredFocus:function(){if(this.editing){this.field.focus();}},cancelEdit:function(A){if(this.editing){this.setValue(this.startValue);if(A!==true){this.hide();}}},onBlur:function(){if(this.allowBlur!==true&&this.editing){this.completeEdit();
1321 }},onHide:function(){if(this.editing){this.completeEdit();return;}this.field.blur();if(this.field.collapse){this.field.collapse();}this.el.hide();if(this.hideEl!==false){this.boundEl.show();}if(Roo.QuickTips){Roo.QuickTips.enable();}},setValue:function(v){this.field.setValue(v);
1322 },getValue:function(){return this.field.getValue();}});
1323 // Roo/BasicDialog.js
1324 Roo.BasicDialog=function(el,A){this.el=Roo.get(el);var dh=Roo.DomHelper;if(!this.el&&A&&A.autoCreate){if(typeof A.autoCreate=="object"){if(!A.autoCreate.id){A.autoCreate.id=el;}this.el=dh.append(document.body,A.autoCreate,true);}else{this.el=dh.append(document.body,{tag:"div",id:el,style:'visibility:hidden;'}
1325 ,true);}}el=this.el;el.setDisplayed(true);el.hide=this.hideAction;this.id=el.id;el.addClass("x-dlg");Roo.apply(this,A);this.proxy=el.createProxy("x-dlg-proxy");this.proxy.hide=this.hideAction;this.proxy.setOpacity(.5);this.proxy.hide();if(A.width){el.setWidth(A.width);
1326 }if(A.height){el.setHeight(A.height);}this.size=el.getSize();if(typeof A.x!="undefined"&&typeof A.y!="undefined"){this.xy=[A.x,A.y];}else{this.xy=el.getCenterXY(true);}this.header=el.child("> .x-dlg-hd");this.body=el.child("> .x-dlg-bd");this.footer=el.child("> .x-dlg-ft");
1327 if(!this.header){this.header=el.createChild({tag:"div",cls:"x-dlg-hd",html:"&#160;"},this.body?this.body.dom:null);}if(!this.body){this.body=el.createChild({tag:"div",cls:"x-dlg-bd"});}this.header.unselectable();if(this.title){this.header.update(this.title);
1328 }this.focusEl=el.createChild({tag:"a",href:"#",cls:"x-dlg-focus",tabIndex:"-1"});this.focusEl.swallowEvent("click",true);this.header.wrap({cls:"x-dlg-hd-right"}).wrap({cls:"x-dlg-hd-left"},true);this.bwrap=this.body.wrap({tag:"div",cls:"x-dlg-dlg-body"});
1329 if(this.footer){this.bwrap.dom.appendChild(this.footer.dom);}this.bg=this.el.createChild({tag:"div",cls:"x-dlg-bg",html:'<div class="x-dlg-bg-left"><div class="x-dlg-bg-right"><div class="x-dlg-bg-center">&#160;</div></div></div>'});this.centerBg=this.bg.child("div.x-dlg-bg-center");
1330 if(this.autoScroll!==false&&!this.autoTabs){this.body.setStyle("overflow","auto");}this.toolbox=this.el.createChild({cls:"x-dlg-toolbox"});if(this.closable!==false){this.el.addClass("x-dlg-closable");this.close=this.toolbox.createChild({cls:"x-dlg-close"}
1331 );this.close.on("click",this.closeClick,this);this.close.addClassOnOver("x-dlg-close-over");}if(this.collapsible!==false){this.collapseBtn=this.toolbox.createChild({cls:"x-dlg-collapse"});this.collapseBtn.on("click",this.collapseClick,this);this.collapseBtn.addClassOnOver("x-dlg-collapse-over");
1332 this.header.on("dblclick",this.collapseClick,this);}if(this.resizable!==false){this.el.addClass("x-dlg-resizable");this.resizer=new Roo.Resizable(el,{minWidth:this.minWidth||80,minHeight:this.minHeight||80,handles:this.resizeHandles||"all",pinned:true});this.resizer.on("beforeresize",this.beforeResize,this);
1333 this.resizer.on("resize",this.onResize,this);}if(this.draggable!==false){el.addClass("x-dlg-draggable");if(!this.proxyDrag){var dd=new Roo.dd.DD(el.dom.id,"WindowDrag");}else{var dd=new Roo.dd.DDProxy(el.dom.id,"WindowDrag",{dragElId:this.proxy.id});}dd.setHandleElId(this.header.id);
1334 dd.endDrag=this.endMove.createDelegate(this);dd.startDrag=this.startMove.createDelegate(this);dd.onDrag=this.onDrag.createDelegate(this);dd.scroll=false;this.dd=dd;}if(this.modal){this.mask=dh.append(document.body,{tag:"div",cls:"x-dlg-mask"},true);this.mask.enableDisplayMode("block");
1335 this.mask.hide();this.el.addClass("x-dlg-modal");}if(this.shadow){this.shadow=new Roo.Shadow({mode:typeof this.shadow=="string"?this.shadow:"sides",offset:this.shadowOffset});}else{this.shadowOffset=0;}if(Roo.useShims&&this.shim!==false){this.shim=this.el.createShim();
1336 this.shim.hide=this.hideAction;this.shim.hide();}else{this.shim=false;}if(this.autoTabs){this.initTabs();}if(this.buttons){var B=this.buttons;this.buttons=[];Roo.each(B,function(b){this.addButton(b);},this);}this.addEvents({"keydown":true,"move":true,"resize":true,"beforehide":true,"hide":true,"beforeshow":true,"show":true}
1337 );el.on("keydown",this.onKeyDown,this);el.on("mousedown",this.toFront,this);Roo.EventManager.onWindowResize(this.adjustViewport,this,true);this.el.hide();Roo.DialogManager.register(this);Roo.BasicDialog.superclass.constructor.call(this);};Roo.extend(Roo.BasicDialog,Roo.util.Observable,{shadowOffset:Roo.isIE?6:5,minHeight:80,minWidth:200,minButtonWidth:75,defaultButton:null,buttonAlign:"right",tabTag:'div',firstShow:true,setTitle:function(A){this.header.update(A);
1338 return this;},closeClick:function(){this.hide();},collapseClick:function(){this[this.collapsed?"expand":"collapse"]();},collapse:function(){if(!this.collapsed){this.collapsed=true;this.el.addClass("x-dlg-collapsed");this.restoreHeight=this.el.getHeight();
1339 this.resizeTo(this.el.getWidth(),this.header.getHeight());}},expand:function(){if(this.collapsed){this.collapsed=false;this.el.removeClass("x-dlg-collapsed");this.resizeTo(this.el.getWidth(),this.restoreHeight);}},initTabs:function(){var A=this.getTabs();
1340 while(A.getTab(0)){A.removeTab(0);}this.el.select(this.tabTag+'.x-dlg-tab').each(function(el){var B=el.dom;A.addTab(Roo.id(B),B.title);B.title="";});A.activate(0);return A;},beforeResize:function(){this.resizer.minHeight=Math.max(this.minHeight,this.getHeaderFooterHeight(true)+40);
1341 },onResize:function(){this.refreshSize();this.syncBodyHeight();this.adjustAssets();this.focus();this.fireEvent("resize",this,this.size.width,this.size.height);},onKeyDown:function(e){if(this.isVisible()){this.fireEvent("keydown",this,e);}},resizeTo:function(A,B){this.el.setSize(A,B);
1342 this.size={width:A,height:B};this.syncBodyHeight();if(this.fixedcenter){this.center();}if(this.isVisible()){this.constrainXY();this.adjustAssets();}this.fireEvent("resize",this,A,B);return this;},setContentSize:function(w,h){h+=this.getHeaderFooterHeight()+this.body.getMargins("tb");
1343 w+=this.body.getMargins("lr")+this.bwrap.getMargins("lr")+this.centerBg.getPadding("lr");h+=this.body.getPadding("tb")+this.bwrap.getBorderWidth("tb")+this.body.getBorderWidth("tb")+this.el.getBorderWidth("tb");w+=this.body.getPadding("lr")+this.bwrap.getBorderWidth("lr")+this.body.getBorderWidth("lr")+this.bwrap.getPadding("lr")+this.el.getBorderWidth("lr");
1344 if(this.tabs){h+=this.tabs.stripWrap.getHeight()+this.tabs.bodyEl.getMargins("tb")+this.tabs.bodyEl.getPadding("tb");w+=this.tabs.bodyEl.getMargins("lr")+this.tabs.bodyEl.getPadding("lr");}this.resizeTo(w,h);return this;},addKeyListener:function(A,fn,B){var C,D,E,F;
1345 if(typeof A=="object"&&!(A instanceof Array)){C=A["key"];D=A["shift"];E=A["ctrl"];F=A["alt"];}else{C=A;}var G=function(H,e){if((!D||e.shiftKey)&&(!E||e.ctrlKey)&&(!F||e.altKey)){var k=e.getKey();if(C instanceof Array){for(var i=0,I=C.length;i<I;i++){if(C[i]==k){fn.call(B||window,H,k,e);
1346 return;}}}else{if(k==C){fn.call(B||window,H,k,e);}}}};this.on("keydown",G);return this;},getTabs:function(){if(!this.tabs){this.el.addClass("x-dlg-auto-tabs");this.body.addClass(this.tabPosition=="bottom"?"x-tabs-bottom":"x-tabs-top");this.tabs=new Roo.TabPanel(this.body.dom,this.tabPosition=="bottom");
1347 }return this.tabs;},addButton:function(A,B,C){var dh=Roo.DomHelper;if(!this.footer){this.footer=dh.append(this.bwrap,{tag:"div",cls:"x-dlg-ft"},true);}if(!this.btnContainer){var tb=this.footer.createChild({cls:"x-dlg-btns x-dlg-btns-"+this.buttonAlign,html:'<table cellspacing="0"><tbody><tr></tr></tbody></table><div class="x-clear"></div>'}
1348 ,null,true);this.btnContainer=tb.firstChild.firstChild.firstChild;}var D={handler:B,scope:C,minWidth:this.minButtonWidth,hideParent:true};if(typeof A=="string"){D.text=A;}else{if(A.tag){D.dhconfig=A;}else{Roo.apply(D,A);}}var fc=false;if((typeof(D.position)!='undefined')&&D.position<this.btnContainer.childNodes.length-1){D.position=Math.max(0,D.position);
1349 fc=this.btnContainer.childNodes[D.position];}var E=new Roo.Button(fc?this.btnContainer.insertBefore(document.createElement("td"),fc):this.btnContainer.appendChild(document.createElement("td")),D);this.syncBodyHeight();if(!this.buttons){this.buttons=[];}this.buttons.push(E);
1350 return E;},setDefaultButton:function(A){this.defaultButton=A;return this;},getHeaderFooterHeight:function(A){var B=0;if(this.header){B+=this.header.getHeight();}if(this.footer){var fm=this.footer.getMargins();B+=(this.footer.getHeight()+fm.top+fm.bottom);
1351 }B+=this.bwrap.getPadding("tb")+this.bwrap.getBorderWidth("tb");B+=this.centerBg.getPadding("tb");return B;},syncBodyHeight:function(){var bd=this.body,cb=this.centerBg,bw=this.bwrap;var A=this.size.height-this.getHeaderFooterHeight(false);bd.setHeight(A-bd.getMargins("tb"));
1352 var hh=this.header.getHeight();var h=this.size.height-hh;cb.setHeight(h);bw.setLeftTop(cb.getPadding("l"),hh+cb.getPadding("t"));bw.setHeight(h-cb.getPadding("tb"));bw.setWidth(this.el.getWidth(true)-cb.getPadding("lr"));bd.setWidth(bw.getWidth(true));if(this.tabs){this.tabs.syncHeight();
1353 if(Roo.isIE){this.tabs.el.repaint();}}},restoreState:function(){var A=Roo.state.Manager.get(this.stateId||(this.el.id+"-state"));if(A&&A.width){this.xy=[A.x,A.y];this.resizeTo(A.width,A.height);}return this;},beforeShow:function(){this.expand();if(this.fixedcenter){this.xy=this.el.getCenterXY(true);
1354 }if(this.modal){Roo.get(document.body).addClass("x-body-masked");this.mask.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.mask.show();}this.constrainXY();},animShow:function(){var b=Roo.get(this.animateTarget).getBox();this.proxy.setSize(b.width,b.height);
1355 this.proxy.setLocation(b.x,b.y);this.proxy.show();this.proxy.setBounds(this.xy[0],this.xy[1],this.size.width,this.size.height,true,.35,this.showEl.createDelegate(this));},show:function(A){if(this.fireEvent("beforeshow",this)===false){return;}if(this.syncHeightBeforeShow){this.syncBodyHeight();
1356 }else if(this.firstShow){this.firstShow=false;this.syncBodyHeight();}this.animateTarget=A||this.animateTarget;if(!this.el.isVisible()){this.beforeShow();if(this.animateTarget&&Roo.get(this.animateTarget)){this.animShow();}else{this.showEl();}}return this;
1357 },showEl:function(){this.proxy.hide();this.el.setXY(this.xy);this.el.show();this.adjustAssets(true);this.toFront();this.focus();if(Roo.isIE){this.el.repaint();}this.fireEvent("show",this);},focus:function(){if(this.defaultButton){this.defaultButton.focus();
1358 }else{this.focusEl.focus();}},constrainXY:function(){if(this.constraintoviewport!==false){if(!this.viewSize){if(this.container){var s=this.container.getSize();this.viewSize=[s.width,s.height];}else{this.viewSize=[Roo.lib.Dom.getViewWidth(),Roo.lib.Dom.getViewHeight()];
1359 }}var s=Roo.get(this.container||document).getScroll();var x=this.xy[0],y=this.xy[1];var w=this.size.width,h=this.size.height;var vw=this.viewSize[0],vh=this.viewSize[1];var A=false;if(x+w>vw+s.left){x=vw-w;A=true;}if(y+h>vh+s.top){y=vh-h;A=true;}if(x<s.left){x=s.left;
1360 A=true;}if(y<s.top){y=s.top;A=true;}if(A){this.xy=[x,y];if(this.isVisible()){this.el.setLocation(x,y);this.adjustAssets();}}}},onDrag:function(){if(!this.proxyDrag){this.xy=this.el.getXY();this.adjustAssets();}},adjustAssets:function(A){var x=this.xy[0],y=this.xy[1];
1361 var w=this.size.width,h=this.size.height;if(A===true){if(this.shadow){this.shadow.show(this.el);}if(this.shim){this.shim.show();}}if(this.shadow&&this.shadow.isVisible()){this.shadow.show(this.el);}if(this.shim&&this.shim.isVisible()){this.shim.setBounds(x,y,w,h);
1362 }},adjustViewport:function(w,h){if(!w||!h){w=Roo.lib.Dom.getViewWidth();h=Roo.lib.Dom.getViewHeight();}this.viewSize=[w,h];if(this.modal&&this.mask.isVisible()){this.mask.setSize(w,h);this.mask.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));
1363 }if(this.isVisible()){this.constrainXY();}},destroy:function(A){if(this.isVisible()){this.animateTarget=null;this.hide();}Roo.EventManager.removeResizeListener(this.adjustViewport,this);if(this.tabs){this.tabs.destroy(A);}Roo.destroy(this.shim,this.proxy,this.resizer,this.close,this.mask);
1364 if(this.dd){this.dd.unreg();}if(this.buttons){for(var i=0,B=this.buttons.length;i<B;i++){this.buttons[i].destroy();}}this.el.removeAllListeners();if(A===true){this.el.update("");this.el.remove();}Roo.DialogManager.unregister(this);},startMove:function(){if(this.proxyDrag){this.proxy.show();
1365 }if(this.constraintoviewport!==false){this.dd.constrainTo(document.body,{right:this.shadowOffset,bottom:this.shadowOffset});}},endMove:function(){if(!this.proxyDrag){Roo.dd.DD.prototype.endDrag.apply(this.dd,arguments);}else{Roo.dd.DDProxy.prototype.endDrag.apply(this.dd,arguments);
1366 this.proxy.hide();}this.refreshSize();this.adjustAssets();this.focus();this.fireEvent("move",this,this.xy[0],this.xy[1]);},toFront:function(){Roo.DialogManager.bringToFront(this);return this;},toBack:function(){Roo.DialogManager.sendToBack(this);return this;
1367 },center:function(){var xy=this.el.getCenterXY(true);this.moveTo(xy[0],xy[1]);return this;},moveTo:function(x,y){this.xy=[x,y];if(this.isVisible()){this.el.setXY(this.xy);this.adjustAssets();}return this;},alignTo:function(A,B,C){this.xy=this.el.getAlignToXY(A,B,C);
1368 if(this.isVisible()){this.el.setXY(this.xy);this.adjustAssets();}return this;},anchorTo:function(el,A,B,C){var D=function(){this.alignTo(el,A,B);};Roo.EventManager.onWindowResize(D,this);var tm=typeof C;if(tm!='undefined'){Roo.EventManager.on(window,'scroll',D,this,{buffer:tm=='number'?C:50}
1369 );}D.call(this);return this;},isVisible:function(){return this.el.isVisible();},animHide:function(A){var b=Roo.get(this.animateTarget).getBox();this.proxy.show();this.proxy.setBounds(this.xy[0],this.xy[1],this.size.width,this.size.height);this.el.hide();this.proxy.setBounds(b.x,b.y,b.width,b.height,true,.35,this.hideEl.createDelegate(this,[A]));
1370 },hide:function(A){if(this.fireEvent("beforehide",this)===false){return;}if(this.shadow){this.shadow.hide();}if(this.shim){this.shim.hide();}if(this.animateTarget&&Roo.get(this.animateTarget)){this.animHide(A);}else{this.el.hide();this.hideEl(A);}return this;
1371 },hideEl:function(A){this.proxy.hide();if(this.modal){this.mask.hide();Roo.get(document.body).removeClass("x-body-masked");}this.fireEvent("hide",this);if(typeof A=="function"){A();}},hideAction:function(){this.setLeft("-10000px");this.setTop("-10000px");
1372 this.setStyle("visibility","hidden");},refreshSize:function(){this.size=this.el.getSize();this.xy=this.el.getXY();Roo.state.Manager.set(this.stateId||this.el.id+"-state",this.el.getBox());},setZIndex:function(A){if(this.modal){this.mask.setStyle("z-index",A);
1373 }if(this.shim){this.shim.setStyle("z-index",++A);}if(this.shadow){this.shadow.setZIndex(++A);}this.el.setStyle("z-index",++A);if(this.proxy){this.proxy.setStyle("z-index",++A);}if(this.resizer){this.resizer.proxy.setStyle("z-index",++A);}this.lastZIndex=A;
1374 },getEl:function(){return this.el;}});Roo.DialogManager=function(){var A={};var B=[];var C=null;var D=function(d1,d2){return (!d1._lastAccess||d1._lastAccess<d2._lastAccess)?-1:1;};var E=function(){B.sort(D);var F=Roo.DialogManager.zseed;for(var i=0,G=B.length;
1375 i<G;i++){var H=B[i];if(H){H.setZIndex(F+(i*10));}}};return {zseed:9000,register:function(F){A[F.id]=F;B.push(F);},unregister:function(F){delete A[F.id];var i=0;var G=0;if(!B.indexOf){for(i=0,G=B.length;i<G;i++){if(B[i]==F){B.splice(i,1);return;}}}else{i=B.indexOf(F);
1376 if(i!=-1){B.splice(i,1);}}},get:function(id){return typeof id=="object"?id:A[id];},bringToFront:function(F){F=this.get(F);if(F!=C){C=F;F._lastAccess=new Date().getTime();E();}return F;},sendToBack:function(F){F=this.get(F);F._lastAccess=-(new Date().getTime());
1377 E();return F;},hideAll:function(){for(var id in A){if(A[id]&&typeof A[id]!="function"&&A[id].isVisible()){A[id].hide();}}}};}();
1378 // Roo/LayoutDialog.js
1379 Roo.LayoutDialog=function(el,A){var B=A;if(typeof(A)=='undefined'){B=Roo.apply({},el);el=Roo.get(document.body||document.documentElement).createChild();}B.autoTabs=false;Roo.LayoutDialog.superclass.constructor.call(this,el,B);this.body.setStyle({overflow:"hidden",position:"relative"}
1380 );this.layout=new Roo.BorderLayout(this.body.dom,B);this.layout.monitorWindowResize=false;this.el.addClass("x-dlg-auto-layout");this.center=Roo.BasicDialog.prototype.center;this.on("show",this.layout.layout,this.layout,true);if(B.items){var C=B.items;delete B.items;
1381 Roo.each(C,this.addxtype,this);}};Roo.extend(Roo.LayoutDialog,Roo.BasicDialog,{endUpdate:function(){this.layout.endUpdate();},beginUpdate:function(){this.layout.beginUpdate();},getLayout:function(){return this.layout;},showEl:function(){Roo.LayoutDialog.superclass.showEl.apply(this,arguments);
1382 if(Roo.isIE7){this.layout.layout();}},syncBodyHeight:function(){Roo.LayoutDialog.superclass.syncBodyHeight.call(this);if(this.layout){this.layout.layout();}},addxtype:function(c){return this.layout.addxtype(c);}});
1383 // Roo/MessageBox.js
1384 Roo.MessageBox=function(){var A,B,C,D;var E,F,G,H,I,pp;var J,K,L;var M=function(Q){A.hide();Roo.callback(B.fn,B.scope||window,[Q,K.dom.value],1);};var N=function(){if(B&&B.cls){A.el.removeClass(B.cls);}if(D){Roo.TaskMgr.stop(D);D=null;}};var O=function(b){var Q=0;
1385 if(!b){J["ok"].hide();J["cancel"].hide();J["yes"].hide();J["no"].hide();A.footer.dom.style.display='none';return Q;}A.footer.dom.style.display='';for(var k in J){if(typeof J[k]!="function"){if(b[k]){J[k].show();J[k].setText(typeof b[k]=="string"?b[k]:Roo.MessageBox.buttonText[k]);
1386 Q+=J[k].el.getWidth()+15;}else{J[k].hide();}}}return Q;};var P=function(d,k,e){if(B&&B.closable!==false){A.hide();}if(e){e.stopEvent();}};return {getDialog:function(){if(!A){A=new Roo.BasicDialog("x-msg-box",{autoCreate:true,shadow:true,draggable:true,resizable:false,constraintoviewport:false,fixedcenter:true,collapsible:false,shim:true,modal:true,width:400,height:100,buttonAlign:"center",closeClick:function(){if(B&&B.buttons&&B.buttons.no&&!B.buttons.cancel){M("no");
1387 }else{M("cancel");}}});A.on("hide",N);C=A.mask;A.addKeyListener(27,P);J={};var bt=this.buttonText;J["ok"]=A.addButton(bt["ok"],M.createCallback("ok"));J["yes"]=A.addButton(bt["yes"],M.createCallback("yes"));J["no"]=A.addButton(bt["no"],M.createCallback("no"));
1388 J["cancel"]=A.addButton(bt["cancel"],M.createCallback("cancel"));E=A.body.createChild({html:'<span class="roo-mb-text"></span><br /><input type="text" class="roo-mb-input" /><textarea class="roo-mb-textarea"></textarea><div class="roo-mb-progress-wrap"><div class="roo-mb-progress"><div class="roo-mb-progress-bar">&#160;</div></div></div>'}
1389 );F=E.dom.firstChild;G=Roo.get(E.dom.childNodes[2]);G.enableDisplayMode();G.addKeyListener([10,13],function(){if(A.isVisible()&&B&&B.buttons){if(B.buttons.ok){M("ok");}else if(B.buttons.yes){M("yes");}}});H=Roo.get(E.dom.childNodes[3]);H.enableDisplayMode();
1390 I=Roo.get(E.dom.childNodes[4]);I.enableDisplayMode();var pf=I.dom.firstChild;if(pf){pp=Roo.get(pf.firstChild);pp.setHeight(pf.offsetHeight);}}return A;},updateText:function(Q){if(!A.isVisible()&&!B.width){A.resizeTo(this.maxWidth,100);}F.innerHTML=Q||'&#160;';
1391 var cw=Math.max(F.offsetWidth,F.parentNode.scrollWidth);var w=Math.max(Math.min(B.width||cw,this.maxWidth),Math.max(B.minWidth||this.minWidth,L));if(B.prompt){K.setWidth(w);}if(A.isVisible()){A.fixedcenter=false;}if(E.getHeight()>(Roo.lib.Dom.getViewHeight()-100)){E.setHeight(Roo.lib.Dom.getViewHeight()-100);
1392 E.dom.style.overflowY='auto'+(Roo.isIE?'':' !important');}else{E.dom.style.height='';E.dom.style.overflowY='';}if(cw>w){E.dom.style.get='auto'+(Roo.isIE?'':' !important');}else{E.dom.style.overflowX='';}A.setContentSize(w,E.getHeight());if(A.isVisible()){A.fixedcenter=true;
1393 }return this;},updateProgress:function(Q,R){if(R){this.updateText(R);}if(pp){pp.setWidth(Math.floor(Q*I.dom.firstChild.offsetWidth));}return this;},isVisible:function(){return A&&A.isVisible();},hide:function(){if(this.isVisible()){A.hide();}},show:function(Q){if(this.isVisible()){this.hide();
1394 Roo.log("[Roo.Messagebox] Show called while message displayed:");Roo.log("Old Dialog Message:"+F.innerHTML);Roo.log("New Dialog Message:"+Q.msg)}var d=this.getDialog();B=Q;d.setTitle(B.title||"&#160;");d.close.setDisplayed(B.closable!==false);K=G;B.prompt=B.prompt||(B.multiline?true:false);
1395 if(B.prompt){if(B.multiline){G.hide();H.show();H.setHeight(typeof B.multiline=="number"?B.multiline:this.defaultTextHeight);K=H;}else{G.show();H.hide();}}else{G.hide();H.hide();}I.setDisplayed(B.progress===true);this.updateProgress(0);K.dom.value=B.value||"";
1396 if(B.prompt){A.setDefaultButton(K);}else{var bs=B.buttons;var db=null;if(bs&&bs.ok){db=J["ok"];}else if(bs&&bs.yes){db=J["yes"];}A.setDefaultButton(db);}L=O(B.buttons);this.updateText(B.msg);if(B.cls){d.el.addClass(B.cls);}d.proxyDrag=B.proxyDrag===true;d.modal=B.modal!==false;
1397 d.mask=B.modal!==false?C:false;if(!d.isVisible()){document.body.appendChild(A.el.dom);d.animateTarget=null;d.show(Q.animEl);}A.toFront();return this;},progress:function(Q,R){this.show({title:Q,msg:R,buttons:false,progress:true,closable:false,minWidth:this.minProgressWidth,modal:true}
1398 );return this;},alert:function(Q,R,fn,S){this.show({title:Q,msg:R,buttons:this.OK,fn:fn,scope:S,modal:true});return this;},wait:function(Q,R){this.show({title:R,msg:Q,buttons:false,closable:false,progress:true,modal:true,width:300,wait:true});D=Roo.TaskMgr.start({run:function(i){Roo.MessageBox.updateProgress(((((i+20)%20)+1)*5)*.01);
1399 },interval:1000});return this;},confirm:function(Q,R,fn,S){this.show({title:Q,msg:R,buttons:this.YESNO,fn:fn,scope:S,modal:true});return this;},prompt:function(Q,R,fn,S,T){this.show({title:Q,msg:R,buttons:this.OKCANCEL,fn:fn,minWidth:250,scope:S,prompt:true,multiline:T,modal:true}
1400 );return this;},OK:{ok:true},YESNO:{yes:true,no:true},OKCANCEL:{ok:true,cancel:true},YESNOCANCEL:{yes:true,no:true,cancel:true},defaultTextHeight:75,maxWidth:600,minWidth:100,minProgressWidth:250,buttonText:{ok:"OK",cancel:"Cancel",yes:"Yes",no:"No"}};}();
1401 Roo.Msg=Roo.MessageBox;
1402 // Roo/QuickTips.js
1403 Roo.QuickTips=function(){var el,A,B,C,tm,D,E,F={},G,H=null,I,J;var ce,bd,xy,dd;var K=false,L=true,M=false;var N=1,O=1,P=1,Q=[];var R=function(e){if(L){return;}var t=e.getTarget();if(!t||t.nodeType!==1||t==document||t==document.body){return;}if(ce&&t==ce.el){clearTimeout(O);
1404 return;}if(t&&F[t.id]){F[t.id].el=t;N=W.defer(tm.showDelay,tm,[F[t.id]]);return;}var a,et=Roo.fly(t);var ns=D.namespace;if(tm.interceptTitles&&t.title){a=t.title;t.qtip=a;t.removeAttribute("title");e.preventDefault();}else{a=t.qtip||et.getAttributeNS(ns,D.attribute)||et.getAttributeNS(D.alt_namespace,D.attribute);
1405 }if(a){N=W.defer(tm.showDelay,tm,[{el:t,text:a.replace(/\\n/g,'<br/>'),width:et.getAttributeNS(ns,D.width),autoHide:et.getAttributeNS(ns,D.hide)!="user",title:et.getAttributeNS(ns,D.title),cls:et.getAttributeNS(ns,D.cls)}]);}};var S=function(e){clearTimeout(N);
1406 var t=e.getTarget();if(t&&ce&&ce.el==t&&(tm.autoHide&&ce.autoHide!==false)){O=setTimeout(Y,tm.hideDelay);}};var T=function(e){if(L){return;}xy=e.getXY();xy[1]+=18;if(tm.trackMouse&&ce){el.setXY(xy);}};var U=function(e){clearTimeout(N);clearTimeout(O);if(!e.within(el)){if(tm.hideOnClick){Y();
1407 tm.disable();tm.enable.defer(100,tm);}}};var V=function(){return 2;};var W=function(o){if(L){return;}clearTimeout(P);ce=o;if(H){el.removeClass(H);H=null;}if(ce.cls){el.addClass(ce.cls);H=ce.cls;}if(ce.title){C.update(ce.title);C.show();}else{C.update('');
1408 C.hide();}el.dom.style.width=tm.maxWidth+'px';B.update(o.text);var p=V(),w=ce.width;if(!w){var td=B.dom;var aw=Math.max(td.offsetWidth,td.clientWidth,td.scrollWidth);if(aw>tm.maxWidth){w=tm.maxWidth;}else if(aw<tm.minWidth){w=tm.minWidth;}else{w=aw;}}el.setWidth(parseInt(w,10)+p);
1409 if(ce.autoHide===false){E.setDisplayed(true);if(dd){dd.unlock();}}else{E.setDisplayed(false);if(dd){dd.lock();}}if(xy){el.avoidY=xy[1]-18;el.setXY(xy);}if(tm.animate){el.setOpacity(.1);el.setStyle("visibility","visible");el.fadeIn({callback:X});}else{X();
1410 }};var X=function(){if(ce){el.show();G.enable();if(tm.autoDismiss&&ce.autoHide!==false){P=setTimeout(Y,tm.autoDismissDelay);}}};var Y=function(a){clearTimeout(P);clearTimeout(O);ce=null;if(el.isVisible()){G.disable();if(a!==true&&tm.animate){el.fadeOut({callback:Z}
1411 );}else{Z();}}};var Z=function(){el.hide();if(H){el.removeClass(H);H=null;}};return {minWidth:40,maxWidth:300,interceptTitles:false,trackMouse:false,hideOnClick:true,showDelay:500,hideDelay:200,autoHide:true,autoDismiss:true,autoDismissDelay:5000,animate:false,title:'',text:'',cls:'',width:null,init:function(){tm=Roo.QuickTips;
1412 D=tm.tagConfig;if(!M){if(!Roo.isReady){Roo.onReady(Roo.QuickTips.init,Roo.QuickTips);return;}el=new Roo.Layer({cls:"x-tip",shadow:"drop",shim:true,constrain:true,shadowOffset:4});el.fxDefaults={stopFx:true};el.update('<div class="x-tip-bd"><div class="x-tip-close"></div><h3></h3><div class="x-tip-bd-inner"></div><div class="x-clear"></div></div>');
1413 C=el.child('h3');C.enableDisplayMode("block");A=el.child('div.x-tip-bd');B=el.child('div.x-tip-bd-inner');E=el.child('div.x-tip-close');E.enableDisplayMode("block");E.on("click",Y);var d=Roo.get(document);d.on("mousedown",U);d.on("mouseover",R);d.on("mouseout",S);
1414 d.on("mousemove",T);G=d.addKeyListener(27,Y);G.disable();if(Roo.dd.DD){dd=el.initDD("default",null,{onDrag:function(){el.sync();}});dd.setHandleElId(C.id);dd.lock();}M=true;}this.enable();},register:function(a){var cs=a instanceof Array?a:arguments;for(var i=0,b=cs.length;
1415 i<b;i++){var c=cs[i];var d=c.target;if(d){if(d instanceof Array){for(var j=0,e=d.length;j<e;j++){F[d[j]]=c;}}else{F[typeof d=='string'?d:Roo.id(d)]=c;}}}},unregister:function(el){delete F[Roo.id(el)];},enable:function(){if(M&&L){Q.pop();if(Q.length<1){L=false;
1416 }}},disable:function(){L=true;clearTimeout(N);clearTimeout(O);clearTimeout(P);if(ce){Y(true);}Q.push(1);},isEnabled:function(){return !L;},tagConfig:{namespace:"roo",alt_namespace:"ext",attribute:"qtip",width:"width",target:"target",title:"qtitle",hide:"hide",cls:"qclass"}
1417 };}();Roo.QuickTips.tips=Roo.QuickTips.register;
1418 // Roo/tree/TreePanel.js
1419 Roo.tree.TreePanel=function(el,A){var B=false;var C=false;if(A.root){B=A.root;delete A.root;}if(A.loader){C=A.loader;delete A.loader;}Roo.apply(this,A);Roo.tree.TreePanel.superclass.constructor.call(this);this.el=Roo.get(el);this.el.addClass('x-tree');if(B){this.setRootNode(Roo.factory(B,Roo.tree));
1420 }if(C){this.loader=Roo.factory(C,Roo.tree);}this.id=this.el.id;this.addEvents({"beforeload":true,"load":true,"textchange":true,"beforeexpand":true,"beforecollapse":true,"expand":true,"disabledchange":true,"collapse":true,"beforeclick":true,"checkchange":true,"click":true,"dblclick":true,"contextmenu":true,"beforechildrenrendered":true,"startdrag":true,"enddrag":true,"dragdrop":true,"beforenodedrop":true,"nodedrop":true,"nodedragover":true,"appendnode":true}
1421 );if(this.singleExpand){this.on("beforeexpand",this.restrictExpand,this);}if(this.editor){this.editor.tree=this;this.editor=Roo.factory(this.editor,Roo.tree);}if(this.selModel){this.selModel=Roo.factory(this.selModel,Roo.tree);}};Roo.extend(Roo.tree.TreePanel,Roo.data.Tree,{rootVisible:true,animate:Roo.enableFx,lines:true,enableDD:false,hlDrop:Roo.enableFx,renderer:false,rendererTip:false,restrictExpand:function(A){var p=A.parentNode;
1422 if(p){if(p.expandedChild&&p.expandedChild.parentNode==p){p.expandedChild.collapse();}p.expandedChild=A;}},setRootNode:function(A){Roo.tree.TreePanel.superclass.setRootNode.call(this,A);if(!this.rootVisible){A.ui=new Roo.tree.RootTreeNodeUI(A);}return A;},getEl:function(){return this.el;
1423 },getLoader:function(){return this.loader;},expandAll:function(){this.root.expand(true);},collapseAll:function(){this.root.collapse(true);},getSelectionModel:function(){if(!this.selModel){this.selModel=new Roo.tree.DefaultSelectionModel();}return this.selModel;
1424 },getChecked:function(a,A){A=A||this.root;var r=[];var f=function(){if(this.attributes.checked){r.push(!a?this:(a=='id'?this.id:this.attributes[a]));}};A.cascade(f);return r;},expandPath:function(A,B,C){B=B||"id";var D=A.split(this.pathSeparator);var E=this.root;
1425 if(E.attributes[B]!=D[1]){if(C){C(false,null);}return;}var F=1;var f=function(){if(++F==D.length){if(C){C(true,E);}return;}var c=E.findChild(B,D[F]);if(!c){if(C){C(false,E);}return;}E=c;c.expand(false,false,f);};E.expand(false,false,f);},selectPath:function(A,B,C){B=B||"id";
1426 var D=A.split(this.pathSeparator);var v=D.pop();if(D.length>0){var f=function(E,F){if(E&&F){var n=F.findChild(B,v);if(n){n.select();if(C){C(true,n);}}else if(C){C(false,n);}}else{if(C){C(false,n);}}};this.expandPath(D.join(this.pathSeparator),B,f);}else{this.root.select();
1427 if(C){C(true,this.root);}}},getTreeEl:function(){return this.el;},render:function(){if(this.innerCt){return this;}this.innerCt=this.el.createChild({tag:"ul",cls:"x-tree-root-ct "+(this.lines?"x-tree-lines":"x-tree-no-lines")});if(this.containerScroll){Roo.dd.ScrollManager.register(this.el);
1428 }if((this.enableDD||this.enableDrop)&&!this.dropZone){this.dropZone=new Roo.tree.TreeDropZone(this,this.dropConfig||{ddGroup:this.ddGroup||"TreeDD",appendOnly:this.ddAppendOnly===true});}if((this.enableDD||this.enableDrag)&&!this.dragZone){this.dragZone=new Roo.tree.TreeDragZone(this,this.dragConfig||{ddGroup:this.ddGroup||"TreeDD",scroll:this.ddScroll}
1429 );}this.getSelectionModel().init(this);if(!this.root){Roo.log("ROOT not set in tree");return this;}this.root.render();if(!this.rootVisible){this.root.renderChildren();}return this;}});
1430 // Roo/tree/TreeSelectionModel.js
1431 Roo.tree.DefaultSelectionModel=function(A){this.selNode=null;this.addEvents({"selectionchange":true,"beforeselect":true});Roo.tree.DefaultSelectionModel.superclass.constructor.call(this,A);};Roo.extend(Roo.tree.DefaultSelectionModel,Roo.util.Observable,{init:function(A){this.tree=A;
1432 A.getTreeEl().on("keydown",this.onKeyDown,this);A.on("click",this.onNodeClick,this);},onNodeClick:function(A,e){if(e.ctrlKey&&this.selNode==A){this.unselect(A);return;}this.select(A);},select:function(A){var B=this.selNode;if(B!=A&&this.fireEvent('beforeselect',this,A,B)!==false){if(B){B.ui.onSelectedChange(false);
1433 }this.selNode=A;A.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,A,B);}return A;},unselect:function(A){if(this.selNode==A){this.clearSelections();}},clearSelections:function(){var n=this.selNode;if(n){n.ui.onSelectedChange(false);this.selNode=null;
1434 this.fireEvent("selectionchange",this,null);}return n;},getSelectedNode:function(){return this.selNode;},isSelected:function(A){return this.selNode==A;},selectPrevious:function(){var s=this.selNode||this.lastSelNode;if(!s){return null;}var ps=s.previousSibling;
1435 if(ps){if(!ps.isExpanded()||ps.childNodes.length<1){return this.select(ps);}else{var lc=ps.lastChild;while(lc&&lc.isExpanded()&&lc.childNodes.length>0){lc=lc.lastChild;}return this.select(lc);}}else if(s.parentNode&&(this.tree.rootVisible||!s.parentNode.isRoot)){return this.select(s.parentNode);
1436 }return null;},selectNext:function(){var s=this.selNode||this.lastSelNode;if(!s){return null;}if(s.firstChild&&s.isExpanded()){return this.select(s.firstChild);}else if(s.nextSibling){return this.select(s.nextSibling);}else if(s.parentNode){var A=null;s.parentNode.bubble(function(){if(this.nextSibling){A=this.getOwnerTree().selModel.select(this.nextSibling);
1437 return false;}});return A;}return null;},onKeyDown:function(e){var s=this.selNode||this.lastSelNode;var sm=this;if(!s){return;}var k=e.getKey();switch(k){case e.DOWN:e.stopEvent();this.selectNext();break;case e.UP:e.stopEvent();this.selectPrevious();break;
1438 case e.RIGHT:e.preventDefault();if(s.hasChildNodes()){if(!s.isExpanded()){s.expand();}else if(s.firstChild){this.select(s.firstChild,e);}}break;case e.LEFT:e.preventDefault();if(s.hasChildNodes()&&s.isExpanded()){s.collapse();}else if(s.parentNode&&(this.tree.rootVisible||s.parentNode!=this.tree.getRootNode())){this.select(s.parentNode,e);
1439 }break;};}});Roo.tree.MultiSelectionModel=function(){this.selNodes=[];this.selMap={};this.addEvents({"selectionchange":true});Roo.tree.MultiSelectionModel.superclass.constructor.call(this,cfg);};Roo.extend(Roo.tree.MultiSelectionModel,Roo.util.Observable,{init:function(A){this.tree=A;
1440 A.getTreeEl().on("keydown",this.onKeyDown,this);A.on("click",this.onNodeClick,this);},onNodeClick:function(A,e){this.select(A,e,e.ctrlKey);},select:function(A,e,B){if(B!==true){this.clearSelections(true);}if(this.isSelected(A)){this.lastSelNode=A;return A;
1441 }this.selNodes.push(A);this.selMap[A.id]=A;this.lastSelNode=A;A.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,this.selNodes);return A;},unselect:function(A){if(this.selMap[A.id]){A.ui.onSelectedChange(false);var sn=this.selNodes;var B=-1;
1442 if(sn.indexOf){B=sn.indexOf(A);}else{for(var i=0,C=sn.length;i<C;i++){if(sn[i]==A){B=i;break;}}}if(B!=-1){this.selNodes.splice(B,1);}delete this.selMap[A.id];this.fireEvent("selectionchange",this,this.selNodes);}},clearSelections:function(A){var sn=this.selNodes;
1443 if(sn.length>0){for(var i=0,B=sn.length;i<B;i++){sn[i].ui.onSelectedChange(false);}this.selNodes=[];this.selMap={};if(A!==true){this.fireEvent("selectionchange",this,this.selNodes);}}},isSelected:function(A){return this.selMap[A.id]?true:false;},getSelectedNodes:function(){return this.selNodes;
1444 },onKeyDown:Roo.tree.DefaultSelectionModel.prototype.onKeyDown,selectNext:Roo.tree.DefaultSelectionModel.prototype.selectNext,selectPrevious:Roo.tree.DefaultSelectionModel.prototype.selectPrevious});
1445 // Roo/tree/TreeNode.js
1446 Roo.tree.TreeNode=function(A){A=A||{};if(typeof A=="string"){A={text:A};}this.childrenRendered=false;this.rendered=false;Roo.tree.TreeNode.superclass.constructor.call(this,A);this.expanded=A.expanded===true;this.isTarget=A.isTarget!==false;this.draggable=A.draggable!==false&&A.allowDrag!==false;
1447 this.allowChildren=A.allowChildren!==false&&A.allowDrop!==false;this.text=A.text;this.disabled=A.disabled===true;this.addEvents({"textchange":true,"beforeexpand":true,"beforecollapse":true,"expand":true,"disabledchange":true,"collapse":true,"beforeclick":true,"checkchange":true,"click":true,"dblclick":true,"contextmenu":true,"beforechildrenrendered":true}
1448 );var B=this.attributes.uiProvider||Roo.tree.TreeNodeUI;this.ui=new B(this);if(typeof(this.attributes.items)=='undefined'||!this.attributes.items){return;}Roo.each(this.attributes.items,function(c){this.appendChild(Roo.factory(c,Roo.Tree));},this);delete this.attributes.items;
1449 };Roo.extend(Roo.tree.TreeNode,Roo.data.Node,{preventHScroll:true,isExpanded:function(){return this.expanded;},getUI:function(){return this.ui;},setFirstChild:function(A){var of=this.firstChild;Roo.tree.TreeNode.superclass.setFirstChild.call(this,A);if(this.childrenRendered&&of&&A!=of){of.renderIndent(true,true);
1450 }if(this.rendered){this.renderIndent(true,true);}},setLastChild:function(A){var ol=this.lastChild;Roo.tree.TreeNode.superclass.setLastChild.call(this,A);if(this.childrenRendered&&ol&&A!=ol){ol.renderIndent(true,true);}if(this.rendered){this.renderIndent(true,true);
1451 }},appendChild:function(){var A=Roo.tree.TreeNode.superclass.appendChild.apply(this,arguments);if(A&&this.childrenRendered){A.render();}this.ui.updateExpandIcon();return A;},removeChild:function(A){this.ownerTree.getSelectionModel().unselect(A);Roo.tree.TreeNode.superclass.removeChild.apply(this,arguments);
1452 if(this.childrenRendered){A.ui.remove();}if(this.childNodes.length<1){this.collapse(false,false);}else{this.ui.updateExpandIcon();}if(!this.firstChild){this.childrenRendered=false;}return A;},insertBefore:function(A,B){var C=Roo.tree.TreeNode.superclass.insertBefore.apply(this,arguments);
1453 if(C&&B&&this.childrenRendered){A.render();}this.ui.updateExpandIcon();return C;},setText:function(A){var B=this.text;this.text=A;this.attributes.text=A;if(this.rendered){this.ui.onTextChange(this,A,B);}this.fireEvent("textchange",this,A,B);},select:function(){this.getOwnerTree().getSelectionModel().select(this);
1454 },unselect:function(){this.getOwnerTree().getSelectionModel().unselect(this);},isSelected:function(){return this.getOwnerTree().getSelectionModel().isSelected(this);},expand:function(A,B,C){if(!this.expanded){if(this.fireEvent("beforeexpand",this,A,B)===false){return;
1455 }if(!this.childrenRendered){this.renderChildren();}this.expanded=true;if(!this.isHiddenRoot()&&(this.getOwnerTree()&&this.getOwnerTree().animate&&B!==false)||B){this.ui.animExpand(function(){this.fireEvent("expand",this);if(typeof C=="function"){C(this);}
1456 if(A===true){this.expandChildNodes(true);}}.createDelegate(this));return;}else{this.ui.expand();this.fireEvent("expand",this);if(typeof C=="function"){C(this);}}}else{if(typeof C=="function"){C(this);}}if(A===true){this.expandChildNodes(true);}},isHiddenRoot:function(){return this.isRoot&&!this.getOwnerTree().rootVisible;
1457 },collapse:function(A,B){if(this.expanded&&!this.isHiddenRoot()){if(this.fireEvent("beforecollapse",this,A,B)===false){return;}this.expanded=false;if((this.getOwnerTree().animate&&B!==false)||B){this.ui.animCollapse(function(){this.fireEvent("collapse",this);
1458 if(A===true){this.collapseChildNodes(true);}}.createDelegate(this));return;}else{this.ui.collapse();this.fireEvent("collapse",this);}}if(A===true){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){cs[i].collapse(true,false);}}},delayedExpand:function(A){if(!this.expandProcId){this.expandProcId=this.expand.defer(A,this);
1459 }},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);}this.expandProcId=false;},toggle:function(){if(this.expanded){this.collapse();}else{this.expand();}},ensureVisible:function(A){var B=this.getOwnerTree();B.expandPath(this.parentNode.getPath(),false,function(){B.getTreeEl().scrollChildIntoView(this.ui.anchor);
1460 Roo.callback(A);}.createDelegate(this));},expandChildNodes:function(A){var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].expand(A);}},collapseChildNodes:function(A){var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].collapse(A);}},disable:function(){this.disabled=true;
1461 this.unselect();if(this.rendered&&this.ui.onDisableChange){this.ui.onDisableChange(this,true);}this.fireEvent("disabledchange",this,true);},enable:function(){this.disabled=false;if(this.rendered&&this.ui.onDisableChange){this.ui.onDisableChange(this,false);
1462 }this.fireEvent("disabledchange",this,false);},renderChildren:function(A){if(A!==false){this.fireEvent("beforechildrenrendered",this);}var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].render(true);}this.childrenRendered=true;},sort:function(fn,A){Roo.tree.TreeNode.superclass.sort.apply(this,arguments);
1463 if(this.childrenRendered){var cs=this.childNodes;for(var i=0,B=cs.length;i<B;i++){cs[i].render(true);}}},render:function(A){this.ui.render(A);if(!this.rendered){this.rendered=true;if(this.expanded){this.expanded=false;this.expand(false,false);}}},renderIndent:function(A,B){if(B){this.ui.childIndent=null;
1464 }this.ui.renderIndent();if(A===true&&this.childrenRendered){var cs=this.childNodes;for(var i=0,C=cs.length;i<C;i++){cs[i].renderIndent(true,B);}}}});
1465 // Roo/tree/AsyncTreeNode.js
1466 Roo.tree.AsyncTreeNode=function(A){this.loaded=false;this.loading=false;Roo.tree.AsyncTreeNode.superclass.constructor.apply(this,arguments);this.addEvents({'beforeload':true,'load':true});};Roo.extend(Roo.tree.AsyncTreeNode,Roo.tree.TreeNode,{expand:function(A,B,C){if(this.loading){var D;
1467 var f=function(){if(!this.loading){clearInterval(D);this.expand(A,B,C);}}.createDelegate(this);D=setInterval(f,200);return;}if(!this.loaded){if(this.fireEvent("beforeload",this)===false){return;}this.loading=true;this.ui.beforeLoad(this);var E=this.loader||this.attributes.loader||this.getOwnerTree().getLoader();
1468 if(E){E.load(this,this.loadComplete.createDelegate(this,[A,B,C]));return;}}Roo.tree.AsyncTreeNode.superclass.expand.call(this,A,B,C);},isLoading:function(){return this.loading;},loadComplete:function(A,B,C){this.loading=false;this.loaded=true;this.ui.afterLoad(this);
1469 this.fireEvent("load",this);this.expand(A,B,C);},isLoaded:function(){return this.loaded;},hasChildNodes:function(){if(!this.isLeaf()&&!this.loaded){return true;}else{return Roo.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);}},reload:function(A){this.collapse(false,false);
1470 while(this.firstChild){this.removeChild(this.firstChild);}this.childrenRendered=false;this.loaded=false;if(this.isHiddenRoot()){this.expanded=false;}this.expand(false,false,A);}});
1471 // Roo/tree/TreeNodeUI.js
1472 Roo.tree.TreeNodeUI=function(A){this.node=A;this.rendered=false;this.animating=false;this.emptyIcon=Roo.BLANK_IMAGE_URL;};Roo.tree.TreeNodeUI.prototype={removeChild:function(A){if(this.rendered){this.ctNode.removeChild(A.ui.getEl());}},beforeLoad:function(){this.addClass("x-tree-node-loading");
1473 },afterLoad:function(){this.removeClass("x-tree-node-loading");},onTextChange:function(A,B,C){if(this.rendered){this.textNode.innerHTML=B;}},onDisableChange:function(A,B){this.disabled=B;if(B){this.addClass("x-tree-node-disabled");}else{this.removeClass("x-tree-node-disabled");
1474 }},onSelectedChange:function(A){if(A){this.focus();this.addClass("x-tree-selected");}else{this.removeClass("x-tree-selected");}},onMove:function(A,B,C,D,E,F){this.childIndent=null;if(this.rendered){var G=D.ui.getContainer();if(!G){this.holder=document.createElement("div");
1475 this.holder.appendChild(this.wrap);return;}var H=F?F.ui.getEl():null;if(H){G.insertBefore(this.wrap,H);}else{G.appendChild(this.wrap);}this.node.renderIndent(true);}},addClass:function(A){if(this.elNode){Roo.fly(this.elNode).addClass(A);}},removeClass:function(A){if(this.elNode){Roo.fly(this.elNode).removeClass(A);
1476 }},remove:function(){if(this.rendered){this.holder=document.createElement("div");this.holder.appendChild(this.wrap);}},fireEvent:function(){return this.node.fireEvent.apply(this.node,arguments);},initEvents:function(){this.node.on("move",this.onMove,this);
1477 var E=Roo.EventManager;var a=this.anchor;var el=Roo.fly(a,'_treeui');if(Roo.isOpera){el.setStyle("text-decoration","none");}el.on("click",this.onClick,this);el.on("dblclick",this.onDblClick,this);if(this.checkbox){Roo.EventManager.on(this.checkbox,Roo.isIE?'click':'change',this.onCheckChange,this);
1478 }el.on("contextmenu",this.onContextMenu,this);var A=Roo.fly(this.iconNode);A.on("click",this.onClick,this);A.on("dblclick",this.onDblClick,this);A.on("contextmenu",this.onContextMenu,this);E.on(this.ecNode,"click",this.ecClick,this,true);if(this.node.disabled){this.addClass("x-tree-node-disabled");
1479 }if(this.node.hidden){this.addClass("x-tree-node-disabled");}var ot=this.node.getOwnerTree();var dd=ot?(ot.enableDD||ot.enableDrag||ot.enableDrop):false;if(dd&&(!this.node.isRoot||ot.rootVisible)){Roo.dd.Registry.register(this.elNode,{node:this.node,handles:this.getDDHandles(),isHandle:false}
1480 );}},getDDHandles:function(){return [this.iconNode,this.textNode];},hide:function(){if(this.rendered){this.wrap.style.display="none";}},show:function(){if(this.rendered){this.wrap.style.display="";}},onContextMenu:function(e){if(this.node.hasListener("contextmenu")||this.node.getOwnerTree().hasListener("contextmenu")){e.preventDefault();
1481 this.focus();this.fireEvent("contextmenu",this.node,e);}},onClick:function(e){if(this.dropping){e.stopEvent();return;}if(this.fireEvent("beforeclick",this.node,e)!==false){if(!this.disabled&&this.node.attributes.href){this.fireEvent("click",this.node,e);return;
1482 }e.preventDefault();if(this.disabled){return;}if(this.node.attributes.singleClickExpand&&!this.animating&&this.node.hasChildNodes()){this.node.toggle();}this.fireEvent("click",this.node,e);}else{e.stopEvent();}},onDblClick:function(e){e.preventDefault();if(this.disabled){return;
1483 }if(this.checkbox){this.toggleCheck();}if(!this.animating&&this.node.hasChildNodes()){this.node.toggle();}this.fireEvent("dblclick",this.node,e);},onCheckChange:function(){var A=this.checkbox.checked;this.node.attributes.checked=A;this.fireEvent('checkchange',this.node,A);
1484 },ecClick:function(e){if(!this.animating&&this.node.hasChildNodes()){this.node.toggle();}},startDrop:function(){this.dropping=true;},endDrop:function(){setTimeout(function(){this.dropping=false;}.createDelegate(this),50);},expand:function(){this.updateExpandIcon();
1485 this.ctNode.style.display="";},focus:function(){if(!this.node.preventHScroll){try{this.anchor.focus();}catch(e){}}else if(!Roo.isIE){try{var A=this.node.getOwnerTree().getTreeEl().dom;var l=A.scrollLeft;this.anchor.focus();A.scrollLeft=l;}catch(e){}}},toggleCheck:function(A){var cb=this.checkbox;
1486 if(cb){cb.checked=(A===undefined?!cb.checked:A);}},blur:function(){try{this.anchor.blur();}catch(e){}},animExpand:function(A){var ct=Roo.get(this.ctNode);ct.stopFx();if(!this.node.hasChildNodes()){this.updateExpandIcon();this.ctNode.style.display="";Roo.callback(A);
1487 return;}this.animating=true;this.updateExpandIcon();ct.slideIn('t',{callback:function(){this.animating=false;Roo.callback(A);},scope:this,duration:this.node.ownerTree.duration||.25});},highlight:function(){var A=this.node.getOwnerTree();Roo.fly(this.wrap).highlight(A.hlColor||"C3DAF9",{endColor:A.hlBaseColor}
1488 );},collapse:function(){this.updateExpandIcon();this.ctNode.style.display="none";},animCollapse:function(A){var ct=Roo.get(this.ctNode);ct.enableDisplayMode('block');ct.stopFx();this.animating=true;this.updateExpandIcon();ct.slideOut('t',{callback:function(){this.animating=false;
1489 Roo.callback(A);},scope:this,duration:this.node.ownerTree.duration||.25});},getContainer:function(){return this.ctNode;},getEl:function(){return this.wrap;},appendDDGhost:function(A){A.appendChild(this.elNode.cloneNode(true));},getDDRepairXY:function(){return Roo.lib.Dom.getXY(this.iconNode);
1490 },onRender:function(){this.render();},render:function(A){var n=this.node,a=n.attributes;var B=n.parentNode?n.parentNode.ui.getContainer():n.ownerTree.innerCt.dom;if(!this.rendered){this.rendered=true;this.renderElements(n,a,B,A);if(a.qtip){if(this.textNode.setAttributeNS){this.textNode.setAttributeNS("ext","qtip",a.qtip);
1491 if(a.qtipTitle){this.textNode.setAttributeNS("ext","qtitle",a.qtipTitle);}}else{this.textNode.setAttribute("ext:qtip",a.qtip);if(a.qtipTitle){this.textNode.setAttribute("ext:qtitle",a.qtipTitle);}}}else if(a.qtipCfg){a.qtipCfg.target=Roo.id(this.textNode);
1492 Roo.QuickTips.register(a.qtipCfg);}this.initEvents();if(!this.node.expanded){this.updateExpandIcon();}}else{if(A===true){B.appendChild(this.wrap);}}},renderElements:function(n,a,A,B){this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():'';var t=n.getOwnerTree();
1493 var C=t&&t.renderer?t.renderer(n.attributes):Roo.util.Format.htmlEncode(n.text);if(typeof(n.attributes.html)!='undefined'){C=n.attributes.html;}var D=t&&t.rendererTip?t.rendererTip(n.attributes):C;var cb=typeof a.checked=='boolean';var E=a.href?a.href:Roo.isGecko?"":"#";
1494 var F=['<li class="x-tree-node"><div class="x-tree-node-el ',a.cls,'">','<span class="x-tree-node-indent">',this.indentMarkup,"</span>",'<img src="',this.emptyIcon,'" class="x-tree-ec-icon" />','<img src="',a.icon||this.emptyIcon,'" class="x-tree-node-icon',(a.icon?" x-tree-node-inline-icon":""),(a.iconCls?" "+a.iconCls:""),'" unselectable="on" />',cb?('<input class="x-tree-node-cb" type="checkbox" '+(a.checked?'checked="checked" />':' />')):'','<a hidefocus="on" href="',E,'" tabIndex="1" ',a.hrefTarget?' target="'+a.hrefTarget+'"':"",'><span unselectable="on" qtip="',D,'">',C,"</span></a></div>",'<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>"];
1495 if(B!==true&&n.nextSibling&&n.nextSibling.ui.getEl()){this.wrap=Roo.DomHelper.insertHtml("beforeBegin",n.nextSibling.ui.getEl(),F.join(""));}else{this.wrap=Roo.DomHelper.insertHtml("beforeEnd",A,F.join(""));}this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];
1496 var cs=this.elNode.childNodes;this.indentNode=cs[0];this.ecNode=cs[1];this.iconNode=cs[2];var G=3;if(cb){this.checkbox=cs[3];G++;}this.anchor=cs[G];this.textNode=cs[G].firstChild;},getAnchor:function(){return this.anchor;},getTextEl:function(){return this.textNode;
1497 },getIconEl:function(){return this.iconNode;},isChecked:function(){return this.checkbox?this.checkbox.checked:false;},updateExpandIcon:function(){if(this.rendered){var n=this.node,c1,c2;var A=n.isLast()?"x-tree-elbow-end":"x-tree-elbow";var B=n.hasChildNodes();
1498 if(B){if(n.expanded){A+="-minus";c1="x-tree-node-collapsed";c2="x-tree-node-expanded";}else{A+="-plus";c1="x-tree-node-expanded";c2="x-tree-node-collapsed";}if(this.wasLeaf){this.removeClass("x-tree-node-leaf");this.wasLeaf=false;}if(this.c1!=c1||this.c2!=c2){Roo.fly(this.elNode).replaceClass(c1,c2);
1499 this.c1=c1;this.c2=c2;}}else{if(!this.wasLeaf&&this.node.leaf){Roo.fly(this.elNode).replaceClass("x-tree-node-expanded","x-tree-node-leaf");delete this.c1;delete this.c2;this.wasLeaf=true;}}var C="x-tree-ec-icon "+A;if(this.ecc!=C){this.ecNode.className=C;
1500 this.ecc=C;}}},getChildIndent:function(){if(!this.childIndent){var A=[];var p=this.node;while(p){if(!p.isRoot||(p.isRoot&&p.ownerTree.rootVisible)){if(!p.isLast()){A.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />');}else{A.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />');
1501 }}p=p.parentNode;}this.childIndent=A.join("");}return this.childIndent;},renderIndent:function(){if(this.rendered){var A="";var p=this.node.parentNode;if(p){A=p.ui.getChildIndent();}if(this.indentMarkup!=A){this.indentNode.innerHTML=A;this.indentMarkup=A;
1502 }this.updateExpandIcon();}}};Roo.tree.RootTreeNodeUI=function(){Roo.tree.RootTreeNodeUI.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.tree.RootTreeNodeUI,Roo.tree.TreeNodeUI,{render:function(){if(!this.rendered){var A=this.node.ownerTree.innerCt.dom;
1503 this.node.expanded=true;A.innerHTML='<div class="x-tree-root-node"></div>';this.wrap=this.ctNode=A.firstChild;}},collapse:function(){},expand:function(){}});
1504 // Roo/tree/TreeLoader.js
1505 Roo.tree.TreeLoader=function(A){this.baseParams={};this.requestMethod="POST";Roo.apply(this,A);this.addEvents({beforeload:true,load:true,loadexception:true,create:true});Roo.tree.TreeLoader.superclass.constructor.call(this);};Roo.extend(Roo.tree.TreeLoader,Roo.util.Observable,{uiProviders:{}
1506 ,clearOnLoad:true,root:false,queryParam:false,load:function(A,B){if(this.clearOnLoad){while(A.firstChild){A.removeChild(A.firstChild);}}if(A.attributes.children){var cs=A.attributes.children;for(var i=0,C=cs.length;i<C;i++){A.appendChild(this.createNode(cs[i]));
1507 }if(typeof B=="function"){B();}}else if(this.dataUrl){this.requestData(A,B);}},getParams:function(A){var B=[],bp=this.baseParams;for(var C in bp){if(typeof bp[C]!="function"){B.push(encodeURIComponent(C),"=",encodeURIComponent(bp[C]),"&");}}var n=this.queryParam===false?'node':this.queryParam;
1508 B.push(n+"=",encodeURIComponent(A.id));return B.join("");},requestData:function(A,B){if(this.fireEvent("beforeload",this,A,B)!==false){this.transId=Roo.Ajax.request({method:this.requestMethod,url:this.dataUrl||this.url,success:this.handleResponse,failure:this.handleFailure,scope:this,argument:{callback:B,node:A}
1509 ,params:this.getParams(A)});}else{if(typeof B=="function"){B();}}},isLoading:function(){return this.transId?true:false;},abort:function(){if(this.isLoading()){Roo.Ajax.abort(this.transId);}},createNode:function(attr){if(this.baseAttrs){Roo.applyIf(attr,this.baseAttrs);
1510 }if(this.applyLoader!==false){attr.loader=this;}if(typeof(attr.uiProvider)=='string'){attr.uiProvider=this.uiProviders[attr.uiProvider]||eval(attr.uiProvider);}if(typeof(this.uiProviders['default'])!='undefined'){attr.uiProvider=this.uiProviders['default'];
1511 }this.fireEvent('create',this,attr);attr.leaf=typeof(attr.leaf)=='string'?attr.leaf*1:attr.leaf;return (attr.leaf?new Roo.tree.TreeNode(attr):new Roo.tree.AsyncTreeNode(attr));},processResponse:function(A,B,C){var D=A.responseText;try{var o=Roo.decode(D);
1512 if(this.root===false&&typeof(o.success)!=undefined){this.root='data';}if(this.root!==false&&!o.success){var a=A.argument;this.fireEvent("loadexception",this,a.node,A);Roo.log("Load failed - should have a handler really");return;}if(this.root!==false){o=o[this.root];
1513 }for(var i=0,E=o.length;i<E;i++){var n=this.createNode(o[i]);if(n){B.appendChild(n);}}if(typeof C=="function"){C(this,B);}}catch(e){this.handleFailure(A);}},handleResponse:function(A){this.transId=false;var a=A.argument;this.processResponse(A,a.node,a.callback);
1514 this.fireEvent("load",this,a.node,A);},handleFailure:function(A){this.transId=false;var a=A.argument;this.fireEvent("loadexception",this,a.node,A);if(typeof a.callback=="function"){a.callback(this,a.node);}}});
1515 // Roo/tree/TreeFilter.js
1516 Roo.tree.TreeFilter=function(A,B){this.tree=A;this.filtered={};Roo.apply(this,B);};Roo.tree.TreeFilter.prototype={clearBlank:false,reverse:false,autoClear:false,remove:false,filter:function(A,B,C){B=B||"text";var f;if(typeof A=="string"){var D=A.length;if(D==0&&this.clearBlank){this.clear();
1517 return;}A=A.toLowerCase();f=function(n){return n.attributes[B].substr(0,D).toLowerCase()==A;};}else if(A.exec){f=function(n){return A.test(n.attributes[B]);};}else{throw 'Illegal filter type, must be string or regex';}this.filterBy(f,null,C);},filterBy:function(fn,A,B){B=B||this.tree.root;
1518 if(this.autoClear){this.clear();}var af=this.filtered,rv=this.reverse;var f=function(n){if(n==B){return true;}if(af[n.id]){return false;}var m=fn.call(A||n,n);if(!m||rv){af[n.id]=n;n.ui.hide();return false;}return true;};B.cascade(f);if(this.remove){for(var id in af){if(typeof id!="function"){var n=af[id];
1519 if(n&&n.parentNode){n.parentNode.removeChild(n);}}}}},clear:function(){var t=this.tree;var af=this.filtered;for(var id in af){if(typeof id!="function"){var n=af[id];if(n){n.ui.show();}}}this.filtered={};}};
1520 // Roo/tree/TreeSorter.js
1521 Roo.tree.TreeSorter=function(A,B){Roo.apply(this,B);A.on("beforechildrenrendered",this.doSort,this);A.on("append",this.updateSort,this);A.on("insert",this.updateSort,this);var C=this.dir&&this.dir.toLowerCase()=="desc";var p=this.property||"text";var D=this.sortType;
1522 var fs=this.folderSort;var cs=this.caseSensitive===true;var E=this.leafAttr||'leaf';this.sortFn=function(n1,n2){if(fs){if(n1.attributes[E]&&!n2.attributes[E]){return 1;}if(!n1.attributes[E]&&n2.attributes[E]){return -1;}}var v1=D?D(n1):(cs?n1.attributes[p]:n1.attributes[p].toUpperCase());
1523 var v2=D?D(n2):(cs?n2.attributes[p]:n2.attributes[p].toUpperCase());if(v1<v2){return C?+1:-1;}else if(v1>v2){return C?-1:+1;}else{return 0;}};};Roo.tree.TreeSorter.prototype={doSort:function(A){A.sort(this.sortFn);},compareNodes:function(n1,n2){return (n1.text.toUpperCase()>n2.text.toUpperCase()?1:-1);
1524 },updateSort:function(A,B){if(B.childrenRendered){this.doSort.defer(1,this,[B]);}}};
1525 // Roo/tree/TreeDropZone.js
1526 if(Roo.dd.DropZone){Roo.tree.TreeDropZone=function(A,B){this.allowParentInsert=false;this.allowContainerDrop=false;this.appendOnly=false;Roo.tree.TreeDropZone.superclass.constructor.call(this,A.innerCt,B);this.tree=A;this.lastInsertClass="x-tree-no-status";
1527 this.dragOverData={};};Roo.extend(Roo.tree.TreeDropZone,Roo.dd.DropZone,{ddGroup:"TreeDD",scroll:true,expandDelay:1000,expandNode:function(A){if(A.hasChildNodes()&&!A.isExpanded()){A.expand(false,null,this.triggerCacheRefresh.createDelegate(this));}},queueExpand:function(A){this.expandProcId=this.expandNode.defer(this.expandDelay,this,[A]);
1528 },cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);this.expandProcId=false;}},isValidDropPoint:function(n,pt,dd,e,A){if(!n||!A){return false;}var B=n.node;var C=A.node;if(!(B&&B.isTarget&&pt)){return false;}if(pt=="append"&&B.allowChildren===false){return false;
1529 }if((pt=="above"||pt=="below")&&(B.parentNode&&B.parentNode.allowChildren===false)){return false;}if(C&&(B==C||C.contains(B))){return false;}var D=this.dragOverData;D.tree=this.tree;D.target=B;D.data=A;D.point=pt;D.source=dd;D.rawEvent=e;D.dropNode=C;D.cancel=false;
1530 var E=this.tree.fireEvent("nodedragover",D);return D.cancel===false&&E!==false;},getDropPoint:function(e,n,dd){var tn=n.node;if(tn.isRoot){return tn.allowChildren!==false?"append":false;}var A=n.ddel;var t=Roo.lib.Dom.getY(A),b=t+A.offsetHeight;var y=Roo.lib.Event.getPageY(e);
1531 var B=tn.allowChildren===false;if(this.appendOnly||tn.parentNode.allowChildren===false){return B?false:"append";}var C=false;if(!this.allowParentInsert){C=tn.hasChildNodes()&&tn.isExpanded();}var q=(b-t)/(B?2:3);if(y>=t&&y<(t+q)){return "above";}else if(!C&&(B||y>=b-q&&y<=b)){return "below";
1532 }else{return "append";}},onNodeEnter:function(n,dd,e,A){this.cancelExpand();},onNodeOver:function(n,dd,e,A){var pt=this.getDropPoint(e,n,dd);var B=n.node;if(!this.expandProcId&&pt=="append"&&B.hasChildNodes()&&!n.node.isExpanded()){this.queueExpand(B);}else if(pt!="append"){this.cancelExpand();
1533 }var C=this.dropNotAllowed;if(this.isValidDropPoint(n,pt,dd,e,A)){if(pt){var el=n.ddel;var D;if(pt=="above"){C=n.node.isFirst()?"x-tree-drop-ok-above":"x-tree-drop-ok-between";D="x-tree-drag-insert-above";}else if(pt=="below"){C=n.node.isLast()?"x-tree-drop-ok-below":"x-tree-drop-ok-between";
1534 D="x-tree-drag-insert-below";}else{C="x-tree-drop-ok-append";D="x-tree-drag-append";}if(this.lastInsertClass!=D){Roo.fly(el).replaceClass(this.lastInsertClass,D);this.lastInsertClass=D;}}}return C;},onNodeOut:function(n,dd,e,A){this.cancelExpand();this.removeDropIndicators(n);
1535 },onNodeDrop:function(n,dd,e,A){var B=this.getDropPoint(e,n,dd);var C=n.node;C.ui.startDrop();if(!this.isValidDropPoint(n,B,dd,e,A)){C.ui.endDrop();return false;}var D=A.node||(dd.getTreeNode?dd.getTreeNode(A,C,B,e):null);var E={tree:this.tree,target:C,data:A,point:B,source:dd,rawEvent:e,dropNode:D,cancel:!D}
1536 ;var F=this.tree.fireEvent("beforenodedrop",E);if(F===false||E.cancel===true||!E.dropNode){C.ui.endDrop();return false;}C=E.target;if(B=="append"&&!C.isExpanded()){C.expand(false,null,function(){this.completeDrop(E);}.createDelegate(this));}else{this.completeDrop(E);
1537 }return true;},completeDrop:function(de){var ns=de.dropNode,p=de.point,t=de.target;if(!(ns instanceof Array)){ns=[ns];}var n;for(var i=0,A=ns.length;i<A;i++){n=ns[i];if(p=="above"){t.parentNode.insertBefore(n,t);}else if(p=="below"){t.parentNode.insertBefore(n,t.nextSibling);
1538 }else{t.appendChild(n);}}n.ui.focus();if(this.tree.hlDrop){n.ui.highlight();}t.ui.endDrop();this.tree.fireEvent("nodedrop",de);},afterNodeMoved:function(dd,A,e,B,C){if(this.tree.hlDrop){C.ui.focus();C.ui.highlight();}this.tree.fireEvent("nodedrop",this.tree,B,A,dd,e);
1539 },getTree:function(){return this.tree;},removeDropIndicators:function(n){if(n&&n.ddel){var el=n.ddel;Roo.fly(el).removeClass(["x-tree-drag-insert-above","x-tree-drag-insert-below","x-tree-drag-append"]);this.lastInsertClass="_noclass";}},beforeDragDrop:function(A,e,id){this.cancelExpand();
1540 return true;},afterRepair:function(A){if(A&&Roo.enableFx){A.node.ui.highlight();}this.hideProxy();}});}
1541 // Roo/tree/TreeDragZone.js
1542 if(Roo.dd.DragZone){Roo.tree.TreeDragZone=function(A,B){Roo.tree.TreeDragZone.superclass.constructor.call(this,A.getTreeEl(),B);this.tree=A;};Roo.extend(Roo.tree.TreeDragZone,Roo.dd.DragZone,{ddGroup:"TreeDD",onBeforeDrag:function(A,e){var n=A.node;return n&&n.draggable&&!n.disabled;
1543 },onInitDrag:function(e){var A=this.dragData;this.tree.getSelectionModel().select(A.node);this.proxy.update("");A.node.ui.appendDDGhost(this.proxy.ghost.dom);this.tree.fireEvent("startdrag",this.tree,A.node,e);},getRepairXY:function(e,A){return A.node.ui.getDDRepairXY();
1544 },onEndDrag:function(A,e){this.tree.fireEvent("enddrag",this.tree,A.node,e);},onValidDrop:function(dd,e,id){this.tree.fireEvent("dragdrop",this.tree,this.dragData.node,dd,e);this.hideProxy();},beforeInvalidDrop:function(e,id){var sm=this.tree.getSelectionModel();
1545 sm.clearSelections();sm.select(this.dragData.node);}});}
1546 // Roo/tree/TreeEditor.js
1547 Roo.tree.TreeEditor=function(A,B){var C=A;var D;if(B){D=B.events?B:new Roo.form.TextField(B);}else{C=A.tree;A.field=A.field||{};A.field.xtype='TextField';D=Roo.factory(A.field,Roo.form);}A=A||{};this.addEvents({"beforenodeedit":true});Roo.tree.TreeEditor.superclass.constructor.call(this,D,A);
1548 this.tree=C;C.on('beforeclick',this.beforeNodeClick,this);C.getTreeEl().on('mousedown',this.hide,this);this.on('complete',this.updateNode,this);this.on('beforestartedit',this.fitToTree,this);this.on('startedit',this.bindScroll,this,{delay:10});this.on('specialkey',this.onSpecialKey,this);
1549 };Roo.extend(Roo.tree.TreeEditor,Roo.Editor,{alignment:"l-l",autoSize:false,hideEl:false,cls:"x-small-editor x-tree-editor",shim:false,shadow:"frame",maxWidth:250,editDelay:350,fitToTree:function(ed,el){var td=this.tree.getTreeEl().dom,nd=el.dom;if(td.scrollLeft>nd.offsetLeft){td.scrollLeft=nd.offsetLeft;
1550 }var w=Math.min(this.maxWidth,(td.clientWidth>20?td.clientWidth:td.offsetWidth)-Math.max(0,nd.offsetLeft-td.scrollLeft)-5);this.setSize(w,'');return this.fireEvent('beforenodeedit',this,this.editNode);},triggerEdit:function(A){this.completeEdit();this.editNode=A;
1551 this.startEdit(A.ui.textNode,A.text);},bindScroll:function(){this.tree.getTreeEl().on('scroll',this.cancelEdit,this);},beforeNodeClick:function(A,e){var B=(this.lastClick?this.lastClick.getElapsed():0);this.lastClick=new Date();if(B>this.editDelay&&this.tree.getSelectionModel().isSelected(A)){e.stopEvent();
1552 this.triggerEdit(A);return false;}return true;},updateNode:function(ed,A){this.tree.getTreeEl().un('scroll',this.cancelEdit,this);this.editNode.setText(A);},onHide:function(){Roo.tree.TreeEditor.superclass.onHide.call(this);if(this.editNode){this.editNode.ui.focus();
1553 }},onSpecialKey:function(A,e){var k=e.getKey();if(k==e.ESC){e.stopEvent();this.cancelEdit();}else if(k==e.ENTER&&!e.hasModifier()){e.stopEvent();this.completeEdit();}}});
1554 // Roo/tree/ColumnNodeUI.js
1555 Roo.tree.ColumnNodeUI=Roo.extend(Roo.tree.TreeNodeUI,{renderElements:function(n,a,A,B){this.indentMarkup=n.parentNode?n.parentNode.ui.getChildIndent():'';var t=n.getOwnerTree();var C=Pman.Tab.Document_TypesTree.tree.el.id;var D=t.columns;var bw=t.borderWidth;
1556 var c=D[0];var E=a.href?a.href:Roo.isGecko?"":"#";var cb=typeof a.checked=="boolean";var tx=String.format('{0}',n.text||(c.renderer?c.renderer(a[c.dataIndex],n,a):a[c.dataIndex]));var F='x-t-'+C+'-c0';var G=['<li class="x-tree-node">','<div class="x-tree-node-el ',a.cls,'">','<div class="x-tree-col ',F,'" style="width:',c.width-bw,'px;">','<span class="x-tree-node-indent">',this.indentMarkup,'</span>','<img src="',this.emptyIcon,'" class="x-tree-ec-icon  " />','<img src="',a.icon||this.emptyIcon,'" class="x-tree-node-icon',(a.icon?' x-tree-node-inline-icon':''),(a.iconCls?' '+a.iconCls:''),'" unselectable="on" />',(cb?('<input class="x-tree-node-cb" type="checkbox" '+(a.checked?'checked="checked" />':' />')):''),'<a class="x-tree-node-anchor" hidefocus="on" href="',E,'" tabIndex="1" ',(a.hrefTarget?' target="'+a.hrefTarget+'"':''),'>','<span unselectable="on" qtip="'+tx+'">',tx,'</span></a>','</div>','<a class="x-tree-node-anchor" hidefocus="on" href="',E,'" tabIndex="1" ',(a.hrefTarget?' target="'+a.hrefTarget+'"':''),'>'];
1557 for(var i=1,H=D.length;i<H;i++){c=D[i];F='x-t-'+C+'-c'+i;tx=String.format('{0}',(c.renderer?c.renderer(a[c.dataIndex],n,a):a[c.dataIndex]));G.push('<div class="x-tree-col ',F,' ',(c.cls?c.cls:''),'" style="width:',c.width-bw,'px;">','<div class="x-tree-col-text" qtip="'+tx+'">',tx,"</div>","</div>");
1558 }G.push('</a>','<div class="x-clear"></div></div>','<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>");if(B!==true&&n.nextSibling&&n.nextSibling.ui.getEl()){this.wrap=Roo.DomHelper.insertHtml("beforeBegin",n.nextSibling.ui.getEl(),G.join(""));
1559 }else{this.wrap=Roo.DomHelper.insertHtml("beforeEnd",A,G.join(""));}var el=this.wrap.firstChild;this.elRow=el;this.elNode=el.firstChild;this.ranchor=el.childNodes[1];this.ctNode=this.wrap.childNodes[1];var cs=el.firstChild.childNodes;this.indentNode=cs[0];
1560 this.ecNode=cs[1];this.iconNode=cs[2];var I=3;if(cb){this.checkbox=cs[3];I++;}this.anchor=cs[I];this.textNode=cs[I].firstChild;},initEvents:function(){Roo.tree.ColumnNodeUI.superclass.initEvents.call(this);var a=this.ranchor;var el=Roo.get(a);if(Roo.isOpera){el.setStyle("text-decoration","none");
1561 }el.on("click",this.onClick,this);el.on("dblclick",this.onDblClick,this);el.on("contextmenu",this.onContextMenu,this);},addClass:function(A){if(this.elRow){Roo.fly(this.elRow).addClass(A);}},removeClass:function(A){if(this.elRow){Roo.fly(this.elRow).removeClass(A);
1562 }}});
1563 // Roo/tree/ColumnTree.js
1564 Roo.tree.ColumnTree=function(el,A){Roo.tree.ColumnTree.superclass.constructor.call(this,el,A);this.addEvents({"resize":true});this.on('resize',this.onResize,this);};Roo.extend(Roo.tree.ColumnTree,Roo.tree.TreePanel,{borderWidth:Roo.isBorderBox?0:2,headEls:false,render:function(){Roo.tree.ColumnTree.superclass.render.apply(this);
1565 this.el.addClass('x-column-tree');this.headers=this.el.createChild({cls:'x-tree-headers'},this.innerCt.dom);var A=this.columns,c;var B=0;this.headEls=[];var C=A.length;for(var i=0;i<C;i++){c=A[i];B+=c.width;this.headEls.push(this.headers.createChild({cls:'x-tree-hd '+(c.cls?c.cls+'-hd':''),cn:{cls:'x-tree-hd-text',html:c.header}
1566 ,style:'width:'+(c.width-this.borderWidth)+'px;'}));}this.headers.createChild({cls:'x-clear'});this.headers.setWidth(B);this.innerCt.setStyle({overflow:'auto'});this.onResize(this.width,this.height);},onResize:function(w,h){this.height=h;this.width=w;this.innerCt.setWidth(this.width);
1567 this.innerCt.setHeight(this.height-20);var A=this.columns,c;var B=0;var C=false;var D=A.length;for(var i=0;i<D;i++){c=A[i];if(this.autoExpandColumn!==false&&c.dataIndex==this.autoExpandColumn){C=this.headEls[i];continue;}B+=c.width;}if(C){C.setWidth(((w-B)-this.borderWidth-20));
1568 }this.headers.setWidth(w-20);}});
1569 // Roo/menu/Menu.js
1570 Roo.menu.Menu=function(A){Roo.menu.Menu.superclass.constructor.call(this,A);this.id=this.id||Roo.id();this.addEvents({beforeshow:true,beforehide:true,show:true,hide:true,click:true,mouseover:true,mouseout:true,itemclick:true});if(this.registerMenu){Roo.menu.MenuMgr.register(this);
1571 }var B=this.items;this.items=new Roo.util.MixedCollection();if(B){this.add.apply(this,B);}};Roo.extend(Roo.menu.Menu,Roo.util.Observable,{minWidth:120,shadow:"sides",subMenuAlign:"tl-tr?",defaultAlign:"tl-bl?",allowOtherMenus:false,registerMenu:true,hidden:true,render:function(){if(this.el){return;
1572 }var el=this.el=new Roo.Layer({cls:"x-menu",shadow:this.shadow,constrain:false,parentEl:this.parentEl||document.body,zindex:15000});this.keyNav=new Roo.menu.MenuNav(this);if(this.plain){el.addClass("x-menu-plain");}if(this.cls){el.addClass(this.cls);}this.focusEl=el.createChild({tag:"a",cls:"x-menu-focus",href:"#",onclick:"return false;",tabIndex:"-1"}
1573 );var ul=el.createChild({tag:"ul",cls:"x-menu-list"});ul.on('click',this.onClick,this);ul.on("mouseover",this.onMouseOver,this);ul.on("mouseout",this.onMouseOut,this);this.items.each(function(A){if(A.hidden){return;}var li=document.createElement("li");li.className="x-menu-list-item";
1574 ul.dom.appendChild(li);A.render(li,this);},this);this.ul=ul;this.autoWidth();},autoWidth:function(){var el=this.el,ul=this.ul;if(!el){return;}var w=this.width;if(w){el.setWidth(w);}else if(Roo.isIE){el.setWidth(this.minWidth);var t=el.dom.offsetWidth;el.setWidth(ul.getWidth()+el.getFrameWidth("lr"));
1575 }},delayAutoWidth:function(){if(this.rendered){if(!this.awTask){this.awTask=new Roo.util.DelayedTask(this.autoWidth,this);}this.awTask.delay(20);}},findTargetItem:function(e){var t=e.getTarget(".x-menu-list-item",this.ul,true);if(t&&t.menuItemId){return this.items.get(t.menuItemId);
1576 }},onClick:function(e){Roo.log("menu.onClick");var t=this.findTargetItem(e);if(!t){return;}Roo.log(e);if(Roo.isTouch&&e.type=='touchstart'&&t.menu&&!t.disabled){if(t==this.activeItem&&t.shouldDeactivate(e)){this.activeItem.deactivate();delete this.activeItem;
1577 return;}if(t.canActivate){this.setActiveItem(t,true);}return;}t.onClick(e);this.fireEvent("click",this,t,e);},setActiveItem:function(A,B){if(A!=this.activeItem){if(this.activeItem){this.activeItem.deactivate();}this.activeItem=A;A.activate(B);}else if(B){A.expandMenu();
1578 }},tryActivate:function(A,B){var C=this.items;for(var i=A,D=C.length;i>=0&&i<D;i+=B){var E=C.get(i);if(!E.disabled&&E.canActivate){this.setActiveItem(E,false);return E;}}return false;},onMouseOver:function(e){var t;if(t=this.findTargetItem(e)){if(t.canActivate&&!t.disabled){this.setActiveItem(t,true);
1579 }}this.fireEvent("mouseover",this,e,t);},onMouseOut:function(e){var t;if(t=this.findTargetItem(e)){if(t==this.activeItem&&t.shouldDeactivate(e)){this.activeItem.deactivate();delete this.activeItem;}}this.fireEvent("mouseout",this,e,t);},isVisible:function(){return this.el&&!this.hidden;
1580 },show:function(el,A,B){this.parentMenu=B;if(!this.el){this.render();}this.fireEvent("beforeshow",this);this.showAt(this.el.getAlignToXY(el,A||this.defaultAlign),B,false);},showAt:function(xy,A,_e){this.parentMenu=A;if(!this.el){this.render();}if(_e!==false){this.fireEvent("beforeshow",this);
1581 xy=this.el.adjustForConstraints(xy);}this.el.setXY(xy);this.el.show();this.hidden=false;this.focus();this.fireEvent("show",this);},focus:function(){if(!this.hidden){this.doFocus.defer(50,this);}},doFocus:function(){if(!this.hidden){this.focusEl.focus();}}
1582 ,hide:function(A){if(this.el&&this.isVisible()){this.fireEvent("beforehide",this);if(this.activeItem){this.activeItem.deactivate();this.activeItem=null;}this.el.hide();this.hidden=true;this.fireEvent("hide",this);}if(A===true&&this.parentMenu){this.parentMenu.hide(true);
1583 }},add:function(){var a=arguments,l=a.length,A;for(var i=0;i<l;i++){var el=a[i];if((typeof(el)=="object")&&el.xtype&&el.xns){el=Roo.factory(el,Roo.menu);}if(el.render){A=this.addItem(el);}else if(typeof el=="string"){if(el=="separator"||el=="-"){A=this.addSeparator();
1584 }else{A=this.addText(el);}}else if(el.tagName||el.el){A=this.addElement(el);}else if(typeof el=="object"){A=this.addMenuItem(el);}}return A;},getEl:function(){if(!this.el){this.render();}return this.el;},addSeparator:function(){return this.addItem(new Roo.menu.Separator());
1585 },addElement:function(el){return this.addItem(new Roo.menu.BaseItem(el));},addItem:function(A){this.items.add(A);if(this.ul){var li=document.createElement("li");li.className="x-menu-list-item";this.ul.dom.appendChild(li);A.render(li,this);this.delayAutoWidth();
1586 }return A;},addMenuItem:function(A){if(!(A instanceof Roo.menu.Item)){if(typeof A.checked=="boolean"){A=new Roo.menu.CheckItem(A);}else{A=new Roo.menu.Item(A);}}return this.addItem(A);},addText:function(A){return this.addItem(new Roo.menu.TextItem({text:A}
1587 ));},insert:function(A,B){this.items.insert(A,B);if(this.ul){var li=document.createElement("li");li.className="x-menu-list-item";this.ul.dom.insertBefore(li,this.ul.dom.childNodes[A]);B.render(li,this);this.delayAutoWidth();}return B;},remove:function(A){this.items.removeKey(A.id);
1588 A.destroy();},removeAll:function(){var f;while(f=this.items.first()){this.remove(f);}}});Roo.menu.MenuNav=function(A){Roo.menu.MenuNav.superclass.constructor.call(this,A.el);this.scope=this.menu=A;};Roo.extend(Roo.menu.MenuNav,Roo.KeyNav,{doRelay:function(e,h){var k=e.getKey();
1589 if(!this.menu.activeItem&&e.isNavKeyPress()&&k!=e.SPACE&&k!=e.RETURN){this.menu.tryActivate(0,1);return false;}return h.call(this.scope||this,e,this.menu);},up:function(e,m){if(!m.tryActivate(m.items.indexOf(m.activeItem)-1,-1)){m.tryActivate(m.items.length-1,-1);
1590 }},down:function(e,m){if(!m.tryActivate(m.items.indexOf(m.activeItem)+1,1)){m.tryActivate(0,1);}},right:function(e,m){if(m.activeItem){m.activeItem.expandMenu(true);}},left:function(e,m){m.hide();if(m.parentMenu&&m.parentMenu.activeItem){m.parentMenu.activeItem.activate();
1591 }},enter:function(e,m){if(m.activeItem){e.stopPropagation();m.activeItem.onClick(e);m.fireEvent("click",this,m.activeItem);return true;}}});
1592 // Roo/menu/MenuMgr.js
1593 Roo.menu.MenuMgr=function(){var A,B,C={},D=false,E=new Date();function init(){A={};B=new Roo.util.MixedCollection();Roo.get(document).addKeyListener(27,function(){if(B.length>0){hideAll();}});}function hideAll(){if(B&&B.length>0){var c=B.clone();c.each(function(m){m.hide();
1594 });}}function onHide(m){B.remove(m);if(B.length<1){Roo.get(document).un("mousedown",onMouseDown);D=false;}}function onShow(m){var F=B.last();E=new Date();B.add(m);if(!D){Roo.get(document).on("mousedown",onMouseDown);D=true;}if(m.parentMenu){m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"),10)+3);
1595 m.parentMenu.activeChild=m;}else if(F&&F.isVisible()){m.getEl().setZIndex(parseInt(F.getEl().getStyle("z-index"),10)+3);}}function onBeforeHide(m){if(m.activeChild){m.activeChild.hide();}if(m.autoHideTimer){clearTimeout(m.autoHideTimer);delete m.autoHideTimer;
1596 }}function onBeforeShow(m){var pm=m.parentMenu;if(!pm&&!m.allowOtherMenus){hideAll();}else if(pm&&pm.activeChild&&B!=m){pm.activeChild.hide();}}function onMouseDown(e){if(E.getElapsed()>50&&B.length>0&&!e.getTarget(".x-menu")){hideAll();}}function onBeforeCheck(mi,F){if(F){var g=C[mi.group];
1597 for(var i=0,l=g.length;i<l;i++){if(g[i]!=mi){g[i].setChecked(false);}}}}return {hideAll:function(){hideAll();},register:function(F){if(!A){init();}A[F.id]=F;F.on("beforehide",onBeforeHide);F.on("hide",onHide);F.on("beforeshow",onBeforeShow);F.on("show",onShow);
1598 var g=F.group;if(g&&F.events["checkchange"]){if(!C[g]){C[g]=[];}C[g].push(F);F.on("checkchange",onCheck);}},get:function(F){if(typeof F=="string"){return A[F];}else if(F.events){return F;}else if(typeof F.length=='number'){return new Roo.menu.Menu({items:F}
1599 );}else{return new Roo.menu.Menu(F);}},unregister:function(F){delete A[F.id];F.un("beforehide",onBeforeHide);F.un("hide",onHide);F.un("beforeshow",onBeforeShow);F.un("show",onShow);var g=F.group;if(g&&F.events["checkchange"]){C[g].remove(F);F.un("checkchange",onCheck);
1600 }},registerCheckable:function(F){var g=F.group;if(g){if(!C[g]){C[g]=[];}C[g].push(F);F.on("beforecheckchange",onBeforeCheck);}},unregisterCheckable:function(F){var g=F.group;if(g){C[g].remove(F);F.un("beforecheckchange",onBeforeCheck);}}};}();
1601 // Roo/menu/BaseItem.js
1602 Roo.menu.BaseItem=function(A){Roo.menu.BaseItem.superclass.constructor.call(this,A);this.addEvents({click:true,activate:true,deactivate:true});if(this.handler){this.on("click",this.handler,this.scope,true);}};Roo.extend(Roo.menu.BaseItem,Roo.Component,{canActivate:false,hidden:false,activeClass:"x-menu-item-active",hideOnClick:true,hideDelay:100,ctype:"Roo.menu.BaseItem",actionMode:"container",render:function(A,B){this.parentMenu=B;
1603 Roo.menu.BaseItem.superclass.render.call(this,A);this.container.menuItemId=this.id;},onRender:function(A,B){this.el=Roo.get(this.el);A.dom.appendChild(this.el.dom);},onClick:function(e){if(!this.disabled&&this.fireEvent("click",this,e)!==false&&this.parentMenu.fireEvent("itemclick",this,e)!==false){this.handleClick(e);
1604 }else{e.stopEvent();}},activate:function(){if(this.disabled){return false;}var li=this.container;li.addClass(this.activeClass);this.region=li.getRegion().adjust(2,2,-2,-2);this.fireEvent("activate",this);return true;},deactivate:function(){this.container.removeClass(this.activeClass);
1605 this.fireEvent("deactivate",this);},shouldDeactivate:function(e){return !this.region||!this.region.contains(e.getPoint());},handleClick:function(e){if(this.hideOnClick){this.parentMenu.hide.defer(this.hideDelay,this.parentMenu,[true]);}},expandMenu:function(A){}
1606 ,hideMenu:function(){}});
1607 // Roo/menu/Adapter.js
1608 Roo.menu.Adapter=function(A,B){Roo.menu.Adapter.superclass.constructor.call(this,B);this.component=A;};Roo.extend(Roo.menu.Adapter,Roo.menu.BaseItem,{canActivate:true,onRender:function(A,B){this.component.render(A);this.el=this.component.getEl();},activate:function(){if(this.disabled){return false;
1609 }this.component.focus();this.fireEvent("activate",this);return true;},deactivate:function(){this.fireEvent("deactivate",this);},disable:function(){this.component.disable();Roo.menu.Adapter.superclass.disable.call(this);},enable:function(){this.component.enable();
1610 Roo.menu.Adapter.superclass.enable.call(this);}});
1611 // Roo/menu/TextItem.js
1612 Roo.menu.TextItem=function(A){if(typeof(A)=='string'){this.text=A;}else{Roo.apply(this,A);}Roo.menu.TextItem.superclass.constructor.call(this);};Roo.extend(Roo.menu.TextItem,Roo.menu.BaseItem,{text:'',hideOnClick:false,itemCls:"x-menu-text",onRender:function(){var s=document.createElement("span");
1613 s.className=this.itemCls;s.innerHTML=this.text;this.el=s;Roo.menu.TextItem.superclass.onRender.apply(this,arguments);}});
1614 // Roo/menu/Separator.js
1615 Roo.menu.Separator=function(A){Roo.menu.Separator.superclass.constructor.call(this,A);};Roo.extend(Roo.menu.Separator,Roo.menu.BaseItem,{itemCls:"x-menu-sep",hideOnClick:false,onRender:function(li){var s=document.createElement("span");s.className=this.itemCls;
1616 s.innerHTML="&#160;";this.el=s;li.addClass("x-menu-sep-li");Roo.menu.Separator.superclass.onRender.apply(this,arguments);}});
1617 // Roo/menu/Item.js
1618 Roo.menu.Item=function(A){Roo.menu.Item.superclass.constructor.call(this,A);if(this.menu){this.menu=Roo.menu.MenuMgr.get(this.menu);}};Roo.extend(Roo.menu.Item,Roo.menu.BaseItem,{text:'',html:'',icon:undefined,itemCls:"x-menu-item",canActivate:true,showDelay:200,hideDelay:200,ctype:"Roo.menu.Item",onRender:function(A,B){var el=document.createElement("a");
1619 el.hideFocus=true;el.unselectable="on";el.href=this.href||"#";if(this.hrefTarget){el.target=this.hrefTarget;}el.className=this.itemCls+(this.menu?" x-menu-item-arrow":"")+(this.cls?" "+this.cls:"");var C=this.html.length?this.html:String.format('{0}',this.text);
1620 el.innerHTML=String.format('<img src="{0}" class="x-menu-item-icon {1}" />'+C,this.icon||Roo.BLANK_IMAGE_URL,this.iconCls||'');this.el=el;Roo.menu.Item.superclass.onRender.call(this,A,B);},setText:function(A,B){if(B){this.html=A;}else{this.text=A;this.html='';
1621 }if(this.rendered){var C=this.html.length?this.html:String.format('{0}',this.text);this.el.update(String.format('<img src="{0}" class="x-menu-item-icon {2}">'+C,this.icon||Roo.BLANK_IMAGE_URL,this.text,this.iconCls||''));this.parentMenu.autoWidth();}},handleClick:function(e){if(!this.href){e.stopEvent();
1622 }Roo.menu.Item.superclass.handleClick.apply(this,arguments);},activate:function(A){if(Roo.menu.Item.superclass.activate.apply(this,arguments)){this.focus();if(A){this.expandMenu();}}return true;},shouldDeactivate:function(e){if(Roo.menu.Item.superclass.shouldDeactivate.call(this,e)){if(this.menu&&this.menu.isVisible()){return !this.menu.getEl().getRegion().contains(e.getPoint());
1623 }return true;}return false;},deactivate:function(){Roo.menu.Item.superclass.deactivate.apply(this,arguments);this.hideMenu();},expandMenu:function(A){if(!this.disabled&&this.menu){clearTimeout(this.hideTimer);delete this.hideTimer;if(!this.menu.isVisible()&&!this.showTimer){this.showTimer=this.deferExpand.defer(this.showDelay,this,[A]);
1624 }else if(this.menu.isVisible()&&A){this.menu.tryActivate(0,1);}}},deferExpand:function(A){delete this.showTimer;this.menu.show(this.container,this.parentMenu.subMenuAlign||"tl-tr?",this.parentMenu);if(A){this.menu.tryActivate(0,1);}},hideMenu:function(){clearTimeout(this.showTimer);
1625 delete this.showTimer;if(!this.hideTimer&&this.menu&&this.menu.isVisible()){this.hideTimer=this.deferHide.defer(this.hideDelay,this);}},deferHide:function(){delete this.hideTimer;this.menu.hide();}});
1626 // Roo/menu/CheckItem.js
1627 Roo.menu.CheckItem=function(A){Roo.menu.CheckItem.superclass.constructor.call(this,A);this.addEvents({"beforecheckchange":true,"checkchange":true});if(this.checkHandler){this.on('checkchange',this.checkHandler,this.scope);}};Roo.extend(Roo.menu.CheckItem,Roo.menu.Item,{itemCls:"x-menu-item x-menu-check-item",groupClass:"x-menu-group-item",checked:false,ctype:"Roo.menu.CheckItem",onRender:function(c){Roo.menu.CheckItem.superclass.onRender.apply(this,arguments);
1628 if(this.group){this.el.addClass(this.groupClass);}Roo.menu.MenuMgr.registerCheckable(this);if(this.checked){this.checked=false;this.setChecked(true,true);}},destroy:function(){if(this.rendered){Roo.menu.MenuMgr.unregisterCheckable(this);}Roo.menu.CheckItem.superclass.destroy.apply(this,arguments);
1629 },setChecked:function(A,B){if(this.checked!=A&&this.fireEvent("beforecheckchange",this,A)!==false){if(this.container){this.container[A?"addClass":"removeClass"]("x-menu-item-checked");}this.checked=A;if(B!==true){this.fireEvent("checkchange",this,A);}}},handleClick:function(e){if(!this.disabled&&!(this.checked&&this.group)){this.setChecked(!this.checked);
1630 }Roo.menu.CheckItem.superclass.handleClick.apply(this,arguments);}});
1631 // Roo/menu/DateItem.js
1632 Roo.menu.DateItem=function(A){Roo.menu.DateItem.superclass.constructor.call(this,new Roo.DatePicker(A),A);this.picker=this.component;this.addEvents({select:true});this.picker.on("render",function(B){B.getEl().swallowEvent("click");B.container.addClass("x-menu-date-item");
1633 });this.picker.on("select",this.onSelect,this);};Roo.extend(Roo.menu.DateItem,Roo.menu.Adapter,{onSelect:function(A,B){this.fireEvent("select",this,B,A);Roo.menu.DateItem.superclass.handleClick.call(this);}});
1634 // Roo/menu/ColorItem.js
1635 Roo.menu.ColorItem=function(A){Roo.menu.ColorItem.superclass.constructor.call(this,new Roo.ColorPalette(A),A);this.palette=this.component;this.relayEvents(this.palette,["select"]);if(this.selectHandler){this.on('select',this.selectHandler,this.scope);}};Roo.extend(Roo.menu.ColorItem,Roo.menu.Adapter);
1636
1637 // Roo/menu/DateMenu.js
1638 Roo.menu.DateMenu=function(A){Roo.menu.DateMenu.superclass.constructor.call(this,A);this.plain=true;var di=new Roo.menu.DateItem(A);this.add(di);this.picker=di.picker;this.relayEvents(di,["select"]);this.on('beforeshow',function(){if(this.picker){this.picker.hideMonthPicker(false);
1639 }},this);};Roo.extend(Roo.menu.DateMenu,Roo.menu.Menu,{cls:'x-date-menu'});
1640 // Roo/menu/ColorMenu.js
1641 Roo.menu.ColorMenu=function(A){Roo.menu.ColorMenu.superclass.constructor.call(this,A);this.plain=true;var ci=new Roo.menu.ColorItem(A);this.add(ci);this.palette=ci.palette;this.relayEvents(ci,["select"]);};Roo.extend(Roo.menu.ColorMenu,Roo.menu.Menu);
1642 // Roo/form/TextItem.js
1643 Roo.form.TextItem=function(A){Roo.form.TextItem.superclass.constructor.call(this,A);};Roo.extend(Roo.form.TextItem,Roo.BoxComponent,{tag:'div',html:'',getAutoCreate:function(){var A={id:this.id,tag:this.tag,html:this.html,cls:'x-form-item'};return A;},onRender:function(ct,A){Roo.form.TextItem.superclass.onRender.call(this,ct,A);
1644 if(!this.el){var B=this.getAutoCreate();if(!B.name){B.name=typeof(this.name)=='undefined'?this.id:this.name;}if(!B.name.length){delete B.name;}this.el=ct.createChild(B,A);}},setHTML:function(A){this.fieldEl.dom.innerHTML=A;}});
1645 // Roo/form/Field.js
1646 Roo.form.Field=function(A){Roo.form.Field.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Field,Roo.BoxComponent,{invalidClass:"x-form-invalid",invalidText:"The value in this field is invalid",focusClass:"x-form-focus",validationEvent:"keyup",validateOnBlur:true,validationDelay:250,defaultAutoCreate:{tag:"input",type:"text",size:"20",autocomplete:"new-password"}
1647 ,fieldClass:"x-form-field",msgTarget:'qtip',msgFx:'normal',readOnly:false,disabled:false,inputType:undefined,tabIndex:undefined,isFormField:true,hasFocus:false,value:undefined,loadedValue:false,initComponent:function(){Roo.form.Field.superclass.initComponent.call(this);
1648 this.addEvents({focus:true,blur:true,specialkey:true,change:true,invalid:true,valid:true,keyup:true});},getName:function(){return this.rendered&&this.el.dom.name?this.el.dom.name:(this.hiddenName||'');},onRender:function(ct,A){Roo.form.Field.superclass.onRender.call(this,ct,A);
1649 if(!this.el){var B=this.getAutoCreate();if(!B.name){B.name=typeof(this.name)=='undefined'?this.id:this.name;}if(!B.name.length){delete B.name;}if(this.inputType){B.type=this.inputType;}this.el=ct.createChild(B,A);}var C=this.el.dom.type;if(C){if(C=='password'){C='text';
1650 }this.el.addClass('x-form-'+C);}if(this.readOnly){this.el.dom.readOnly=true;}if(this.tabIndex!==undefined){this.el.dom.setAttribute('tabIndex',this.tabIndex);}this.el.addClass([this.fieldClass,this.cls]);this.initValue();},applyTo:function(A){this.allowDomMove=false;
1651 this.el=Roo.get(A);this.render(this.el.dom.parentNode);return this;},initValue:function(){if(this.value!==undefined){this.setValue(this.value);}else if(this.el.dom.value.length>0){this.setValue(this.el.dom.value);}},isDirty:function(){if(this.disabled){return false;
1652 }return String(this.getValue())!==String(this.originalValue);},resetHasChanged:function(){this.loadedValue=String(this.getValue());},hasChanged:function(){if(this.disabled||this.readOnly){return false;}return this.loadedValue!==false&&String(this.getValue())!==this.loadedValue;
1653 },afterRender:function(){Roo.form.Field.superclass.afterRender.call(this);this.initEvents();},fireKey:function(e){if(e.isNavKeyPress()){this.fireEvent("specialkey",this,e);}},reset:function(){this.setValue(this.resetValue);this.originalValue=this.getValue();
1654 this.clearInvalid();},initEvents:function(){this.el.on("keydown",this.fireKey,this);this.el.on("focus",this.onFocus,this);this.el.on("blur",this.onBlur,this);this.el.relayEvent('keyup',this);this.originalValue=this.getValue();this.resetValue=this.getValue();
1655 },onFocus:function(){if(!Roo.isOpera&&this.focusClass){this.el.addClass(this.focusClass);}if(!this.hasFocus){this.hasFocus=true;this.startValue=this.getValue();this.fireEvent("focus",this);}},beforeBlur:Roo.emptyFn,onBlur:function(){this.beforeBlur();if(!Roo.isOpera&&this.focusClass){this.el.removeClass(this.focusClass);
1656 }this.hasFocus=false;if(this.validationEvent!==false&&this.validateOnBlur&&this.validationEvent!="blur"){this.validate();}var v=this.getValue();if(String(v)!==String(this.startValue)){this.fireEvent('change',this,v,this.startValue);}this.fireEvent("blur",this);
1657 },isValid:function(A){if(this.disabled){return true;}var B=this.preventMark;this.preventMark=A===true;var v=this.validateValue(this.processValue(this.getRawValue()));this.preventMark=B;return v;},validate:function(){if(this.disabled||this.validateValue(this.processValue(this.getRawValue()))){this.clearInvalid();
1658 return true;}return false;},processValue:function(A){return A;},validateValue:function(A){return true;},markInvalid:function(A){if(!this.rendered||this.preventMark){return;}var B=(typeof(this.combo)!='undefined')?this.combo:this;B.el.addClass(this.invalidClass);
1659 A=A||this.invalidText;switch(this.msgTarget){case 'qtip':B.el.dom.qtip=A;B.el.dom.qclass='x-form-invalid-tip';if(Roo.QuickTips){Roo.QuickTips.enable();}break;case 'title':this.el.dom.title=A;break;case 'under':if(!this.errorEl){var C=this.el.findParent('.x-form-element',5,true);
1660 this.errorEl=C.createChild({cls:'x-form-invalid-msg'});this.errorEl.setWidth(C.getWidth(true)-20);}this.errorEl.update(A);Roo.form.Field.msgFx[this.msgFx].show(this.errorEl,this);break;case 'side':if(!this.errorIcon){var C=this.el.findParent('.x-form-element',5,true);
1661 this.errorIcon=C.createChild({cls:'x-form-invalid-icon'});}this.alignErrorIcon();this.errorIcon.dom.qtip=A;this.errorIcon.dom.qclass='x-form-invalid-tip';this.errorIcon.show();this.on('resize',this.alignErrorIcon,this);break;default:var t=Roo.getDom(this.msgTarget);
1662 t.innerHTML=A;t.style.display=this.msgDisplay;break;}this.fireEvent('invalid',this,A);},alignErrorIcon:function(){this.errorIcon.alignTo(this.el,'tl-tr',[2,0]);},clearInvalid:function(){if(!this.rendered||this.preventMark){return;}var A=(typeof(this.combo)!='undefined')?this.combo:this;
1663 A.el.removeClass(this.invalidClass);switch(this.msgTarget){case 'qtip':A.el.dom.qtip='';break;case 'title':this.el.dom.title='';break;case 'under':if(this.errorEl){Roo.form.Field.msgFx[this.msgFx].hide(this.errorEl,this);}break;case 'side':if(this.errorIcon){this.errorIcon.dom.qtip='';
1664 this.errorIcon.hide();this.un('resize',this.alignErrorIcon,this);}break;default:var t=Roo.getDom(this.msgTarget);t.innerHTML='';t.style.display='none';break;}this.fireEvent('valid',this);},getRawValue:function(){var v=this.el.getValue();return v;},getValue:function(){var v=this.el.getValue();
1665 return v;},setRawValue:function(v){return this.el.dom.value=(v===null||v===undefined?'':v);},setValue:function(v){this.value=v;if(this.rendered){this.el.dom.value=(v===null||v===undefined?'':v);this.validate();}},adjustSize:function(w,h){var s=Roo.form.Field.superclass.adjustSize.call(this,w,h);
1666 s.width=this.adjustWidth(this.el.dom.tagName,s.width);return s;},adjustWidth:function(A,w){A=A.toLowerCase();if(typeof w=='number'&&Roo.isStrict&&!Roo.isSafari){if(Roo.isIE&&(A=='input'||A=='textarea')){if(A=='input'){return w+2;}if(A=='textarea'){return w-2;
1667 }}else if(Roo.isOpera){if(A=='input'){return w+2;}if(A=='textarea'){return w-2;}}}return w;}});Roo.form.Field.msgFx={normal:{show:function(A,f){A.setDisplayed('block');},hide:function(A,f){A.setDisplayed(false).update('');}},slide:{show:function(A,f){A.slideIn('t',{stopFx:true}
1668 );},hide:function(A,f){A.slideOut('t',{stopFx:true,useDisplay:true});}},slideRight:{show:function(A,f){A.fixDisplay();A.alignTo(f.el,'tl-tr');A.slideIn('l',{stopFx:true});},hide:function(A,f){A.slideOut('l',{stopFx:true,useDisplay:true});}}};
1669 // Roo/form/TextField.js
1670 Roo.form.TextField=function(A){Roo.form.TextField.superclass.constructor.call(this,A);this.addEvents({autosize:true});};Roo.extend(Roo.form.TextField,Roo.form.Field,{grow:false,growMin:30,growMax:800,vtype:null,maskRe:null,disableKeyFilter:false,allowBlank:true,minLength:0,maxLength:Number.MAX_VALUE,minLengthText:"The minimum length for this field is {0}",maxLengthText:"The maximum length for this field is {0}",selectOnFocus:false,allowLeadingSpace:false,blankText:"This field is required",validator:null,regex:null,regexText:"",emptyText:null,initEvents:function(){if(this.emptyText){this.el.attr('placeholder',this.emptyText);
1671 }Roo.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=='keyup'){this.validationTask=new Roo.util.DelayedTask(this.validate,this);this.el.on('keyup',this.filterValidation,this);}else if(this.validationEvent!==false){this.el.on(this.validationEvent,this.validate,this,{buffer:this.validationDelay}
1672 );}if(this.selectOnFocus){this.on("focus",this.preFocus,this);}if(!this.allowLeadingSpace){this.on('blur',this.cleanLeadingSpace,this);}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Roo.form.VTypes[this.vtype+'Mask']))){this.el.on("keypress",this.filterKeys,this);
1673 }if(this.grow){this.el.on("keyup",this.onKeyUp,this,{buffer:50});this.el.on("click",this.autoSize,this);}if(this.el.is('input[type=password]')&&Roo.isSafari){this.el.on('keydown',this.SafariOnKeyDown,this);}},processValue:function(A){if(this.stripCharsRe){var B=A.replace(this.stripCharsRe,'');
1674 if(B!==A){this.setRawValue(B);return B;}}return A;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},cleanLeadingSpace:function(e){if(this.inputType=='file'){return;
1675 }this.setValue((this.getValue()+'').replace(/^\s+/,''));},reset:function(){Roo.form.TextField.superclass.reset.call(this);},preFocus:function(){if(this.selectOnFocus){this.el.dom.select();}},filterKeys:function(e){var k=e.getKey();if(!Roo.isIE&&(e.isNavKeyPress()||k==e.BACKSPACE||(k==e.DELETE&&e.button==-1))){return;
1676 }var c=e.getCharCode(),cc=String.fromCharCode(c);if(Roo.isIE&&(e.isSpecialKey()||!cc)){return;}if(!this.maskRe.test(cc)){e.stopEvent();}},setValue:function(v){Roo.form.TextField.superclass.setValue.apply(this,arguments);this.autoSize();},validateValue:function(A){if(A.length<1){if(this.allowBlank){this.clearInvalid();
1677 return true;}else{this.markInvalid(this.blankText);return false;}}if(A.length<this.minLength){this.markInvalid(String.format(this.minLengthText,this.minLength));return false;}if(A.length>this.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));
1678 return false;}if(this.vtype){var vt=Roo.form.VTypes;if(!vt[this.vtype](A,this)){this.markInvalid(this.vtypeText||vt[this.vtype+'Text']);return false;}}if(typeof this.validator=="function"){var B=this.validator(A);if(B!==true){this.markInvalid(B);return false;
1679 }}if(this.regex&&!this.regex.test(A)){this.markInvalid(this.regexText);return false;}return true;},selectText:function(A,B){var v=this.getRawValue();if(v.length>0){A=A===undefined?0:A;B=B===undefined?v.length:B;var d=this.el.dom;if(d.setSelectionRange){d.setSelectionRange(A,B);
1680 }else if(d.createTextRange){var C=d.createTextRange();C.moveStart("character",A);C.moveEnd("character",v.length-B);C.select();}}},autoSize:function(){if(!this.grow||!this.rendered){return;}if(!this.metrics){this.metrics=Roo.util.TextMetrics.createInstance(this.el);
1681 }var el=this.el;var v=el.dom.value;var d=document.createElement('div');d.appendChild(document.createTextNode(v));v=d.innerHTML;d=null;v+="&#160;";var w=Math.min(this.growMax,Math.max(this.metrics.getWidth(v)+10,this.growMin));this.el.setWidth(w);this.fireEvent("autosize",this,w);
1682 },SafariOnKeyDown:function(A){var B=false;if(this.el.dom.selectionEnd>0){B=(this.el.dom.selectionEnd-this.el.dom.selectionStart-this.getValue().length==0)?true:false;}if(((A.getKey()==8||A.getKey()==46)&&this.getValue().length==1)){A.preventDefault();this.setValue('');
1683 return;}if(B&&A.getCharCode()>31){A.preventDefault();var cc=String.fromCharCode(A.getCharCode());this.setValue(A.shiftKey?cc:cc.toLowerCase());}}});
1684 // Roo/form/Hidden.js
1685 Roo.form.Hidden=function(A){Roo.form.Hidden.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Hidden,Roo.form.TextField,{fieldLabel:'',inputType:'hidden',width:50,allowBlank:true,labelSeparator:'',hidden:true,itemCls:'x-form-item-display-none'});
1686 // Roo/form/TriggerField.js
1687 Roo.form.TriggerField=function(A){this.mimicing=false;Roo.form.TriggerField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.TriggerField,Roo.form.TextField,{defaultAutoCreate:{tag:"input",type:"text",size:"16",autocomplete:"new-password"},hideTrigger:false,autoSize:Roo.emptyFn,monitorTab:true,deferHeight:true,actionMode:'wrap',onResize:function(w,h){Roo.form.TriggerField.superclass.onResize.apply(this,arguments);
1688 if(typeof w=='number'){var x=w-this.trigger.getWidth();this.el.setWidth(this.adjustWidth('input',x));this.trigger.setStyle('left',x+'px');}},adjustSize:Roo.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;
1689 },alignErrorIcon:function(){this.errorIcon.alignTo(this.wrap,'tl-tr',[2,0]);},onRender:function(ct,A){Roo.form.TriggerField.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:"x-form-field-wrap"});this.trigger=this.wrap.createChild(this.triggerConfig||{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.triggerClass}
1690 );if(this.hideTrigger){this.trigger.setDisplayed(false);}this.initTrigger();if(!this.width){this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());}},initTrigger:function(){this.trigger.on("click",this.onTriggerClick,this,{preventDefault:true});this.trigger.addClassOnOver('x-form-trigger-over');
1691 this.trigger.addClassOnClick('x-form-trigger-click');},onDestroy:function(){if(this.trigger){this.trigger.removeAllListeners();this.trigger.remove();}if(this.wrap){this.wrap.remove();}Roo.form.TriggerField.superclass.onDestroy.call(this);},onFocus:function(){Roo.form.TriggerField.superclass.onFocus.call(this);
1692 if(!this.mimicing){this.wrap.addClass('x-trigger-wrap-focus');this.mimicing=true;Roo.get(Roo.isIE?document.body:document).on("mousedown",this.mimicBlur,this);if(this.monitorTab){this.el.on("keydown",this.checkTab,this);}}},checkTab:function(e){if(e.getKey()==e.TAB){this.triggerBlur();
1693 }},onBlur:function(){},mimicBlur:function(e,t){if(!this.wrap.contains(t)&&this.validateBlur()){this.triggerBlur();}},triggerBlur:function(){this.mimicing=false;Roo.get(Roo.isIE?document.body:document).un("mousedown",this.mimicBlur);if(this.monitorTab){this.el.un("keydown",this.checkTab,this);
1694 }this.wrap.removeClass('x-trigger-wrap-focus');Roo.form.TriggerField.superclass.onBlur.call(this);},validateBlur:function(e,t){return true;},onDisable:function(){Roo.form.TriggerField.superclass.onDisable.call(this);if(this.wrap){this.wrap.addClass('x-item-disabled');
1695 }},onEnable:function(){Roo.form.TriggerField.superclass.onEnable.call(this);if(this.wrap){this.wrap.removeClass('x-item-disabled');}},onShow:function(){var ae=this.getActionEl();if(ae){ae.dom.style.display='';ae.dom.style.visibility='visible';}},onHide:function(){var ae=this.getActionEl();
1696 ae.dom.style.display='none';},onTriggerClick:Roo.emptyFn});Roo.form.TwinTriggerField=Roo.extend(Roo.form.TriggerField,{initComponent:function(){Roo.form.TwinTriggerField.superclass.initComponent.call(this);this.triggerConfig={tag:'span',cls:'x-form-twin-triggers',cn:[{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger1Class}
1697 ,{tag:"img",src:Roo.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger2Class}]};},getTrigger:function(A){return this.triggers[A];},initTrigger:function(){var ts=this.trigger.select('.x-form-trigger',true);this.wrap.setStyle('overflow','hidden');var A=this;
1698 ts.each(function(t,B,C){t.hide=function(){var w=A.wrap.getWidth();this.dom.style.display='none';A.el.setWidth(w-A.trigger.getWidth());};t.show=function(){var w=A.wrap.getWidth();this.dom.style.display='';A.el.setWidth(w-A.trigger.getWidth());};var D='Trigger'+(C+1);
1699 if(this['hide'+D]){t.dom.style.display='none';}t.on("click",this['on'+D+'Click'],this,{preventDefault:true});t.addClassOnOver('x-form-trigger-over');t.addClassOnClick('x-form-trigger-click');},this);this.triggers=ts.elements;},onTrigger1Click:Roo.emptyFn,onTrigger2Click:Roo.emptyFn}
1700 );
1701 // Roo/form/TextArea.js
1702 Roo.form.TextArea=function(A){Roo.form.TextArea.superclass.constructor.call(this,A);if(this.minHeight!==undefined){this.growMin=this.minHeight;}if(this.maxHeight!==undefined){this.growMax=this.maxHeight;}};Roo.extend(Roo.form.TextArea,Roo.form.TextField,{growMin:60,growMax:1000,preventScrollbars:false,onRender:function(ct,A){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:300px;height:60px;",autocomplete:"new-password"}
1703 ;}Roo.form.TextArea.superclass.onRender.call(this,ct,A);if(this.grow){this.textSizeEl=Roo.DomHelper.append(document.body,{tag:"pre",cls:"x-form-grow-sizer"});if(this.preventScrollbars){this.el.setStyle("overflow","hidden");}this.el.setHeight(this.growMin);
1704 }},onDestroy:function(){if(this.textSizeEl){this.textSizeEl.parentNode.removeChild(this.textSizeEl);}Roo.form.TextArea.superclass.onDestroy.call(this);},onKeyUp:function(e){if(!e.isNavKeyPress()||e.getKey()==e.ENTER){this.autoSize();}},autoSize:function(){if(!this.grow||!this.textSizeEl){return;
1705 }var el=this.el;var v=el.dom.value;var ts=this.textSizeEl;ts.innerHTML='';ts.appendChild(document.createTextNode(v));v=ts.innerHTML;Roo.fly(ts).setWidth(this.el.getWidth());if(v.length<1){v="&#160;&#160;";}else{if(Roo.isIE){v=v.replace(/\n/g,'<p>&#160;</p>');
1706 }v+="&#160;\n&#160;";}ts.innerHTML=v;var h=Math.min(this.growMax,Math.max(ts.offsetHeight,this.growMin));if(h!=this.lastHeight){this.lastHeight=h;this.el.setHeight(h);this.fireEvent("autosize",this,h);}}});
1707 // Roo/form/NumberField.js
1708 Roo.form.NumberField=function(A){Roo.form.NumberField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.NumberField,Roo.form.TextField,{fieldClass:"x-form-field x-form-num-field",allowDecimals:true,decimalSeparator:".",decimalPrecision:2,allowNegative:true,minValue:Number.NEGATIVE_INFINITY,maxValue:Number.MAX_VALUE,minText:"The minimum value for this field is {0}",maxText:"The maximum value for this field is {0}",nanText:"{0} is not a valid number",initEvents:function(){Roo.form.NumberField.superclass.initEvents.call(this);
1709 var A="0123456789";if(this.allowDecimals){A+=this.decimalSeparator;}if(this.allowNegative){A+="-";}this.stripCharsRe=new RegExp('[^'+A+']','gi');var B=function(e){var k=e.getKey();if(!Roo.isIE&&(e.isSpecialKey()||k==e.BACKSPACE||k==e.DELETE)){return;}var c=e.getCharCode();
1710 if(A.indexOf(String.fromCharCode(c))===-1){e.stopEvent();}};this.el.on("keypress",B,this);},validateValue:function(A){if(!Roo.form.NumberField.superclass.validateValue.call(this,A)){return false;}if(A.length<1){return true;}var B=this.parseValue(A);if(isNaN(B)){this.markInvalid(String.format(this.nanText,A));
1711 return false;}if(B<this.minValue){this.markInvalid(String.format(this.minText,this.minValue));return false;}if(B>this.maxValue){this.markInvalid(String.format(this.maxText,this.maxValue));return false;}return true;},getValue:function(){return this.fixPrecision(this.parseValue(Roo.form.NumberField.superclass.getValue.call(this)));
1712 },parseValue:function(A){A=parseFloat(String(A).replace(this.decimalSeparator,"."));return isNaN(A)?'':A;},fixPrecision:function(A){var B=isNaN(A);if(!this.allowDecimals||this.decimalPrecision==-1||B||!A){return B?'':A;}return parseFloat(A).toFixed(this.decimalPrecision);
1713 },setValue:function(v){v=this.fixPrecision(v);Roo.form.NumberField.superclass.setValue.call(this,String(v).replace(".",this.decimalSeparator));},decimalPrecisionFcn:function(v){return Math.floor(v);},beforeBlur:function(){var v=this.parseValue(this.getRawValue());
1714 if(v){this.setValue(v);}}});
1715 // Roo/form/DateField.js
1716 Roo.form.DateField=function(A){Roo.form.DateField.superclass.constructor.call(this,A);this.addEvents({'select':true});if(typeof this.minValue=="string"){this.minValue=this.parseDate(this.minValue);}if(typeof this.maxValue=="string"){this.maxValue=this.parseDate(this.maxValue);
1717 }this.ddMatch=null;if(this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1){re+="|";}}this.ddMatch=new RegExp(re+")");}};Roo.extend(Roo.form.DateField,Roo.form.TriggerField,{format:"m/d/y",altFormats:"m/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d",disabledDays:null,disabledDaysText:"Disabled",disabledDates:null,disabledDatesText:"Disabled",zeroValue:'1800-01-01',minValue:null,maxValue:null,minText:"The date in this field must be equal to or after {0}",maxText:"The date in this field must be equal to or before {0}",invalidText:"{0} is not a valid date - it must be in the format {1}",triggerClass:'x-form-date-trigger',useIso:false,defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"off"}
1718 ,hiddenField:false,onRender:function(ct,A){Roo.form.DateField.superclass.onRender.call(this,ct,A);if(this.useIso){Roo.log("Changing name?");this.el.dom.setAttribute('name',this.name+'____hidden___');this.hiddenField=this.el.insertSibling({tag:'input',type:'hidden',name:this.name}
1719 ,'before',true);this.hiddenField.value=this.value?this.formatDate(this.value,'Y-m-d'):'';this.hiddenName=this.name;}},validateValue:function(A){A=this.formatDate(A);if(!Roo.form.DateField.superclass.validateValue.call(this,A)){Roo.log('super failed');return false;
1720 }if(A.length<1){return true;}var B=A;A=this.parseDate(A);if(!A){Roo.log('parse date failed'+B);this.markInvalid(String.format(this.invalidText,B,this.format));return false;}var C=A.getTime();if(this.minValue&&C<this.minValue.getTime()){this.markInvalid(String.format(this.minText,this.formatDate(this.minValue)));
1721 return false;}if(this.maxValue&&C>this.maxValue.getTime()){this.markInvalid(String.format(this.maxText,this.formatDate(this.maxValue)));return false;}if(this.disabledDays){var D=A.getDay();for(var i=0;i<this.disabledDays.length;i++){if(D===this.disabledDays[i]){this.markInvalid(this.disabledDaysText);
1722 return false;}}}var E=this.formatDate(A);if(this.ddMatch&&this.ddMatch.test(E)){this.markInvalid(String.format(this.disabledDatesText,E));return false;}return true;},validateBlur:function(){return !this.menu||!this.menu.isVisible();},getName:function(){if(!this.rendered){return ''}
1723 ;return !this.hiddenName&&this.el.dom.name?this.el.dom.name:(this.hiddenName||'');},getValue:function(){return this.hiddenField?this.hiddenField.value:this.parseDate(Roo.form.DateField.superclass.getValue.call(this))||"";},setValue:function(A){if(this.hiddenField){this.hiddenField.value=this.formatDate(this.parseDate(A),'Y-m-d');
1724 }Roo.form.DateField.superclass.setValue.call(this,this.formatDate(this.parseDate(A)));this.value=this.parseDate(A);},parseDate:function(A){if(A instanceof Date){if(A<Date.parseDate(this.zeroValue,'Y-m-d')){return '';}return A;}if(!A||A instanceof Date){return A;
1725 }var v=Date.parseDate(A,this.format);if(!v&&this.useIso){v=Date.parseDate(A,'Y-m-d');}if(!v&&this.altFormats){if(!this.altFormatsArray){this.altFormatsArray=this.altFormats.split("|");}for(var i=0,B=this.altFormatsArray.length;i<B&&!v;i++){v=Date.parseDate(A,this.altFormatsArray[i]);
1726 }}if(v<Date.parseDate(this.zeroValue,'Y-m-d')){v='';}return v;},formatDate:function(A,B){return (!A||!(A instanceof Date))?A:A.dateFormat(B||this.format);},menuListeners:{select:function(m,d){this.setValue(d);this.fireEvent('select',this,d);},show:function(){this.onFocus();
1727 },hide:function(){this.focus.defer(10,this);var ml=this.menuListeners;this.menu.un("select",ml.select,this);this.menu.un("show",ml.show,this);this.menu.un("hide",ml.hide,this);}},onTriggerClick:function(){if(this.disabled){return;}if(this.menu==null){this.menu=new Roo.menu.DateMenu();
1728 }Roo.apply(this.menu.picker,{showClear:this.allowBlank,minDate:this.minValue,maxDate:this.maxValue,disabledDatesRE:this.ddMatch,disabledDatesText:this.disabledDatesText,disabledDays:this.disabledDays,disabledDaysText:this.disabledDaysText,format:this.useIso?'Y-m-d':this.format,minText:String.format(this.minText,this.formatDate(this.minValue)),maxText:String.format(this.maxText,this.formatDate(this.maxValue))}
1729 );this.menu.on(Roo.apply({},this.menuListeners,{scope:this}));this.menu.picker.setValue(this.getValue()||new Date());this.menu.show(this.el,"tl-bl?");},beforeBlur:function(){var v=this.parseDate(this.getRawValue());if(v){this.setValue(v);}},isDirty:function(){if(this.disabled){return false;
1730 }if(typeof(this.startValue)==='undefined'){return false;}return String(this.getValue())!==String(this.startValue);},cleanLeadingSpace:function(e){return;}});
1731 // Roo/form/MonthField.js
1732 Roo.form.MonthField=function(A){Roo.form.MonthField.superclass.constructor.call(this,A);this.addEvents({'select':true});if(typeof this.minValue=="string"){this.minValue=this.parseDate(this.minValue);}if(typeof this.maxValue=="string"){this.maxValue=this.parseDate(this.maxValue);
1733 }this.ddMatch=null;if(this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1){re+="|";}}this.ddMatch=new RegExp(re+")");}};Roo.extend(Roo.form.MonthField,Roo.form.TriggerField,{format:"M Y",altFormats:"M Y|m/Y|m-y|m-Y|my|mY",disabledDays:[0,1,2,3,4,5,6],disabledDaysText:"Disabled",disabledDates:null,disabledDatesText:"Disabled",minValue:null,maxValue:null,minText:"The date in this field must be equal to or after {0}",maxText:"The date in this field must be equal to or before {0}",invalidText:"{0} is not a valid date - it must be in the format {1}",triggerClass:'x-form-date-trigger',useIso:true,defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"new-password"}
1734 ,hiddenField:false,hideMonthPicker:false,onRender:function(ct,A){Roo.form.MonthField.superclass.onRender.call(this,ct,A);if(this.useIso){this.el.dom.removeAttribute('name');this.hiddenField=this.el.insertSibling({tag:'input',type:'hidden',name:this.name},'before',true);
1735 this.hiddenField.value=this.value?this.formatDate(this.value,'Y-m-d'):'';this.hiddenName=this.name;}},validateValue:function(A){A=this.formatDate(A);if(!Roo.form.MonthField.superclass.validateValue.call(this,A)){return false;}if(A.length<1){return true;}var B=A;
1736 A=this.parseDate(A);if(!A){this.markInvalid(String.format(this.invalidText,B,this.format));return false;}var C=A.getTime();if(this.minValue&&C<this.minValue.getTime()){this.markInvalid(String.format(this.minText,this.formatDate(this.minValue)));return false;
1737 }if(this.maxValue&&C>this.maxValue.getTime()){this.markInvalid(String.format(this.maxText,this.formatDate(this.maxValue)));return false;}var D=this.formatDate(A);return true;},validateBlur:function(){return !this.menu||!this.menu.isVisible();},getValue:function(){return this.hiddenField?this.hiddenField.value:this.parseDate(Roo.form.MonthField.superclass.getValue.call(this))||"";
1738 },setValue:function(A){Roo.log('month setValue'+A);var B=this.parseDate(A);if(this.hiddenField){this.hiddenField.value=this.formatDate(this.parseDate(A),'Y-m-d');}Roo.form.MonthField.superclass.setValue.call(this,this.formatDate(this.parseDate(A)));this.value=this.parseDate(A);
1739 },parseDate:function(A){if(!A||A instanceof Date){A=A?Date.parseDate(A.format('Y-m')+'-01','Y-m-d'):null;return A;}var v=Date.parseDate(A,this.format);if(!v&&this.useIso){v=Date.parseDate(A,'Y-m-d');}if(v){v=Date.parseDate(v.format('Y-m')+'-01','Y-m-d');}
1740 if(!v&&this.altFormats){if(!this.altFormatsArray){this.altFormatsArray=this.altFormats.split("|");}for(var i=0,B=this.altFormatsArray.length;i<B&&!v;i++){v=Date.parseDate(A,this.altFormatsArray[i]);}}return v;},formatDate:function(A,B){return (!A||!(A instanceof Date))?A:A.dateFormat(B||this.format);
1741 },menuListeners:{select:function(m,d){this.setValue(d);this.fireEvent('select',this,d);},show:function(){this.onFocus();},hide:function(){this.focus.defer(10,this);var ml=this.menuListeners;this.menu.un("select",ml.select,this);this.menu.un("show",ml.show,this);
1742 this.menu.un("hide",ml.hide,this);}},onTriggerClick:function(){if(this.disabled){return;}if(this.menu==null){this.menu=new Roo.menu.DateMenu();}Roo.apply(this.menu.picker,{showClear:this.allowBlank,minDate:this.minValue,maxDate:this.maxValue,disabledDatesRE:this.ddMatch,disabledDatesText:this.disabledDatesText,format:this.useIso?'Y-m-d':this.format,minText:String.format(this.minText,this.formatDate(this.minValue)),maxText:String.format(this.maxText,this.formatDate(this.maxValue))}
1743 );this.menu.on(Roo.apply({},this.menuListeners,{scope:this}));var m=this.menu;var p=m.picker;var A=true;p.hideMonthPicker=function(B){if(A){return;}if(this.monthPicker){Roo.log("hideMonthPicker called");if(B===true){this.monthPicker.hide();}else{this.monthPicker.slideOut('t',{duration:.2}
1744 );p.setValue(new Date(m.picker.mpSelYear,m.picker.mpSelMonth,1));p.fireEvent("select",this,this.value);m.hide();}}};Roo.log('picker set value');Roo.log(this.getValue());p.setValue(this.getValue()?this.parseDate(this.getValue()):new Date());m.show(this.el,'tl-bl?');
1745 A=false;Roo.select('.x-date-picker table',true).first().dom.style.visibility="hidden";p.showMonthPicker.defer(100,p);},beforeBlur:function(){var v=this.parseDate(this.getRawValue());if(v){this.setValue(v);}}});
1746 // Roo/form/ComboBox.js
1747 Roo.form.ComboBox=function(A){Roo.form.ComboBox.superclass.constructor.call(this,A);this.addEvents({'expand':true,'collapse':true,'beforeselect':true,'select':true,'beforequery':true,'add':true,'edit':true});if(this.transform){this.allowDomMove=false;var s=Roo.getDom(this.transform);
1748 if(!this.hiddenName){this.hiddenName=s.name;}if(!this.store){this.mode='local';var d=[],B=s.options;for(var i=0,C=B.length;i<C;i++){var o=B[i];var D=(Roo.isIE?o.getAttributeNode('value').specified:o.hasAttribute('value'))?o.value:o.text;if(o.selected){this.value=D;
1749 }d.push([D,o.text]);}this.store=new Roo.data.SimpleStore({'id':0,fields:['value','text'],data:d});this.valueField='value';this.displayField='text';}s.name=Roo.id();if(!this.lazyRender){this.target=true;this.el=Roo.DomHelper.insertBefore(s,this.autoCreate||this.defaultAutoCreate);
1750 s.parentNode.removeChild(s);this.render(this.el.parentNode);}else{s.parentNode.removeChild(s);}}if(this.store){this.store=Roo.factory(this.store,Roo.data);}this.selectedIndex=-1;if(this.mode=='local'){if(A.queryDelay===undefined){this.queryDelay=10;}if(A.minChars===undefined){this.minChars=0;
1751 }}};Roo.extend(Roo.form.ComboBox,Roo.form.TriggerField,{defaultAutoCreate:{tag:"input",type:"text",size:"24",autocomplete:"off"},listWidth:undefined,displayField:undefined,valueField:undefined,hiddenName:undefined,listClass:'',selectedClass:'x-combo-selected',triggerClass:'x-form-arrow-trigger',shadow:'sides',listAlign:'tl-bl?',maxHeight:300,triggerAction:'query',minChars:4,typeAhead:false,queryDelay:500,pageSize:0,selectOnFocus:false,queryParam:'query',loadingText:'Loading...',resizable:false,handleHeight:8,editable:true,allQuery:'',mode:'remote',minListWidth:70,forceSelection:false,typeAheadDelay:250,valueNotFoundText:undefined,blockFocus:false,disableClear:false,alwaysQuery:false,addicon:false,editicon:false,onRender:function(ct,A){Roo.form.ComboBox.superclass.onRender.call(this,ct,A);
1752 if(this.hiddenName){this.hiddenField=this.el.insertSibling({tag:'input',type:'hidden',name:this.hiddenName,id:(this.hiddenId||this.hiddenName)},'before',true);this.hiddenField.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:'';
1753 this.el.dom.removeAttribute('name');}if(Roo.isGecko){this.el.dom.setAttribute('autocomplete','off');}var B='x-combo-list';this.list=new Roo.Layer({shadow:this.shadow,cls:[B,this.listClass].join(' '),constrain:false});var lw=this.listWidth||Math.max(this.wrap.getWidth(),this.minListWidth);
1754 this.list.setWidth(lw);this.list.swallowEvent('mousewheel');this.assetHeight=0;if(this.title){this.header=this.list.createChild({cls:B+'-hd',html:this.title});this.assetHeight+=this.header.getHeight();}this.innerList=this.list.createChild({cls:B+'-inner'}
1755 );this.innerList.on('mouseover',this.onViewOver,this);this.innerList.on('mousemove',this.onViewMove,this);this.innerList.setWidth(lw-this.list.getFrameWidth('lr'));if(this.allowBlank&&!this.pageSize&&!this.disableClear){this.footer=this.list.createChild({cls:B+'-ft'}
1756 );this.pageTb=new Roo.Toolbar(this.footer);}if(this.pageSize){this.footer=this.list.createChild({cls:B+'-ft'});this.pageTb=new Roo.PagingToolbar(this.footer,this.store,{pageSize:this.pageSize});}if(this.pageTb&&this.allowBlank&&!this.disableClear){var C=this;
1757 this.pageTb.add(new Roo.Toolbar.Fill(),{cls:'x-btn-icon x-btn-clear',text:'&#160;',handler:function(){C.collapse();C.clearValue();C.onSelect(false,-1);}});}if(this.footer){this.assetHeight+=this.footer.getHeight();}if(!this.tpl){this.tpl='<div class="'+B+'-item">{'+this.displayField+'}</div>';
1758 }this.view=new Roo.View(this.innerList,this.tpl,{singleSelect:true,store:this.store,selectedClass:this.selectedClass});this.view.on('click',this.onViewClick,this);this.store.on('beforeload',this.onBeforeLoad,this);this.store.on('load',this.onLoad,this);this.store.on('loadexception',this.onLoadException,this);
1759 if(this.resizable){this.resizer=new Roo.Resizable(this.list,{pinned:true,handles:'se'});this.resizer.on('resize',function(r,w,h){this.maxHeight=h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight;this.listWidth=w;this.innerList.setWidth(w-this.list.getFrameWidth('lr'));
1760 this.restrictHeight();},this);this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom',this.handleHeight+'px');}if(!this.editable){this.editable=true;this.setEditable(false);}if(typeof(this.events.add.listeners)!='undefined'){this.addicon=this.wrap.createChild({tag:'img',src:Roo.BLANK_IMAGE_URL,cls:'x-form-combo-add'}
1761 );this.addicon.on('click',function(e){this.fireEvent('add',this);},this);}if(typeof(this.events.edit.listeners)!='undefined'){this.editicon=this.wrap.createChild({tag:'img',src:Roo.BLANK_IMAGE_URL,cls:'x-form-combo-edit'});if(this.addicon){this.editicon.setStyle('margin-left','40px');
1762 }this.editicon.on('click',function(e){this.fireEvent('edit',this,this.lastData);},this);}},initEvents:function(){Roo.form.ComboBox.superclass.initEvents.call(this);this.keyNav=new Roo.KeyNav(this.el,{"up":function(e){this.inKeyMode=true;this.selectPrev();
1763 },"down":function(e){if(!this.isExpanded()){this.onTriggerClick();}else{this.inKeyMode=true;this.selectNext();}},"enter":function(e){this.onViewClick();},"esc":function(e){this.collapse();},"tab":function(e){this.onViewClick(false);this.fireEvent("specialkey",this,e);
1764 return true;},scope:this,doRelay:function(A,B,C){if(C=='down'||this.scope.isExpanded()){return Roo.KeyNav.prototype.doRelay.apply(this,arguments);}return true;},forceKeyDown:true});this.queryDelay=Math.max(this.queryDelay||10,this.mode=='local'?10:250);this.dqTask=new Roo.util.DelayedTask(this.initQuery,this);
1765 if(this.typeAhead){this.taTask=new Roo.util.DelayedTask(this.onTypeAhead,this);}if(this.editable!==false){this.el.on("keyup",this.onKeyUp,this);}if(this.forceSelection){this.on('blur',this.doForce,this);}},onDestroy:function(){if(this.view){this.view.setStore(null);
1766 this.view.el.removeAllListeners();this.view.el.remove();this.view.purgeListeners();}if(this.list){this.list.destroy();}if(this.store){this.store.un('beforeload',this.onBeforeLoad,this);this.store.un('load',this.onLoad,this);this.store.un('loadexception',this.onLoadException,this);
1767 }Roo.form.ComboBox.superclass.onDestroy.call(this);},fireKey:function(e){if(e.isNavKeyPress()&&!this.list.isVisible()){this.fireEvent("specialkey",this,e);}},onResize:function(w,h){Roo.form.ComboBox.superclass.onResize.apply(this,arguments);if(typeof w!='number'){return;
1768 }var tw=this.trigger.getWidth();tw+=this.addicon?this.addicon.getWidth():0;tw+=this.editicon?this.editicon.getWidth():0;var x=w-tw;this.el.setWidth(this.adjustWidth('input',x));this.trigger.setStyle('left',x+'px');if(this.list&&this.listWidth===undefined){var lw=Math.max(x+this.trigger.getWidth(),this.minListWidth);
1769 this.list.setWidth(lw);this.innerList.setWidth(lw-this.list.getFrameWidth('lr'));}},setEditable:function(A){if(A==this.editable){return;}this.editable=A;if(!A){this.el.dom.setAttribute('readOnly',true);this.el.on('mousedown',this.onTriggerClick,this);this.el.addClass('x-combo-noedit');
1770 }else{this.el.dom.setAttribute('readOnly',false);this.el.un('mousedown',this.onTriggerClick,this);this.el.removeClass('x-combo-noedit');}},onBeforeLoad:function(){if(!this.hasFocus){return;}this.innerList.update(this.loadingText?'<div class="loading-indicator">'+this.loadingText+'</div>':'');
1771 this.restrictHeight();this.selectedIndex=-1;},onLoad:function(){if(!this.hasFocus){return;}if(this.store.getCount()>0){this.expand();this.restrictHeight();if(this.lastQuery==this.allQuery){if(this.editable){this.el.dom.select();}if(!this.selectByValue(this.value,true)){this.select(0,true);
1772 }}else{this.selectNext();if(this.typeAhead&&this.lastKey!=Roo.EventObject.BACKSPACE&&this.lastKey!=Roo.EventObject.DELETE){this.taTask.delay(this.typeAheadDelay);}}}else{this.onEmptyResults();}},onLoadException:function(){this.collapse();Roo.log(this.store.reader.jsonData);
1773 if(this.store&&typeof(this.store.reader.jsonData.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",this.store.reader.jsonData.errorMsg);}},onTypeAhead:function(){if(this.store.getCount()>0){var r=this.store.getAt(0);var A=r.data[this.displayField];
1774 var B=A.length;var C=this.getRawValue().length;if(C!=B){this.setRawValue(A);this.selectText(C,A.length);}}},onSelect:function(A,B){if(this.fireEvent('beforeselect',this,A,B)!==false){this.setFromData(B>-1?A.data:false);this.collapse();this.fireEvent('select',this,A,B);
1775 }},getValue:function(){if(this.valueField){return typeof this.value!='undefined'?this.value:'';}return Roo.form.ComboBox.superclass.getValue.call(this);},clearValue:function(){if(this.hiddenField){this.hiddenField.value='';}this.value='';this.setRawValue('');
1776 this.lastSelectionText='';},setValue:function(v){var A=v;if(this.valueField){var r=this.findRecord(this.valueField,v);if(r){A=r.data[this.displayField];}else if(this.valueNotFoundText!==undefined){A=this.valueNotFoundText;}}this.lastSelectionText=A;if(this.hiddenField){this.hiddenField.value=v;
1777 }Roo.form.ComboBox.superclass.setValue.call(this,A);this.value=v;},lastData:false,setFromData:function(o){var dv='';var vv='';this.lastData=o;if(this.displayField){dv=!o||typeof(o[this.displayField])=='undefined'?'':o[this.displayField];}else{Roo.log('no  displayField value set for '+(this.name?this.name:this.id));
1778 }if(this.valueField){vv=!o||typeof(o[this.valueField])=='undefined'?dv:o[this.valueField];}if(this.hiddenField){this.hiddenField.value=vv;this.lastSelectionText=dv;Roo.form.ComboBox.superclass.setValue.call(this,dv);this.value=vv;return;}this.lastSelectionText=dv;
1779 Roo.form.ComboBox.superclass.setValue.call(this,dv);this.value=vv;},reset:function(){this.setValue(this.resetValue);this.originalValue=this.getValue();this.clearInvalid();this.lastData=false;if(this.view){this.view.clearSelections();}},findRecord:function(A,B){var C;
1780 if(this.store.getCount()>0){this.store.each(function(r){if(r.data[A]==B){C=r;return false;}return true;});}return C;},getName:function(){if(!this.rendered){return ''};return !this.hiddenName&&this.el.dom.name?this.el.dom.name:(this.hiddenName||'');},onViewMove:function(e,t){this.inKeyMode=false;
1781 },onViewOver:function(e,t){if(this.inKeyMode){return;}var A=this.view.findItemFromChild(t);if(A){var B=this.view.indexOf(A);this.select(B,false);}},onViewClick:function(A){var B=this.view.getSelectedIndexes()[0];var r=this.store.getAt(B);if(r){this.onSelect(r,B);
1782 }if(A!==false&&!this.blockFocus){this.el.focus();}},restrictHeight:function(){this.innerList.dom.style.height='';var A=this.innerList.dom;var h=Math.max(A.clientHeight,A.offsetHeight,A.scrollHeight);this.innerList.setHeight(h<this.maxHeight?'auto':this.maxHeight);
1783 this.list.beginUpdate();this.list.setHeight(this.innerList.getHeight()+this.list.getFrameWidth('tb')+(this.resizable?this.handleHeight:0)+this.assetHeight);this.list.alignTo(this.el,this.listAlign);this.list.endUpdate();},onEmptyResults:function(){this.collapse();
1784 },isExpanded:function(){return this.list.isVisible();},selectByValue:function(v,A){if(v!==undefined&&v!==null){var r=this.findRecord(this.valueField||this.displayField,v);if(r){this.select(this.store.indexOf(r),A);return true;}}return false;},select:function(A,B){this.selectedIndex=A;
1785 this.view.select(A);if(B!==false){var el=this.view.getNode(A);if(el){this.innerList.scrollChildIntoView(el,false);}}},selectNext:function(){var ct=this.store.getCount();if(ct>0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex<ct-1){this.select(this.selectedIndex+1);
1786 }}},selectPrev:function(){var ct=this.store.getCount();if(ct>0){if(this.selectedIndex==-1){this.select(0);}else if(this.selectedIndex!=0){this.select(this.selectedIndex-1);}}},onKeyUp:function(e){if(this.editable!==false&&!e.isSpecialKey()){this.lastKey=e.getKey();
1787 this.dqTask.delay(this.queryDelay);}},validateBlur:function(){return !this.list||!this.list.isVisible();},initQuery:function(){this.doQuery(this.getRawValue());},doForce:function(){if(this.el.dom.value.length>0){this.el.dom.value=this.lastSelectionText===undefined?'':this.lastSelectionText;
1788 }},doQuery:function(q,A){if(q===undefined||q===null){q='';}var qe={query:q,forceAll:A,combo:this,cancel:false};if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}q=qe.query;A=qe.forceAll;if(A===true||(q.length>=this.minChars)){if(this.lastQuery!=q||this.alwaysQuery){this.lastQuery=q;
1789 if(this.mode=='local'){this.selectedIndex=-1;if(A){this.store.clearFilter();}else{this.store.filter(this.displayField,q);}this.onLoad();}else{this.store.baseParams[this.queryParam]=q;this.store.load({params:this.getParams(q)});this.expand();}}else{this.selectedIndex=-1;
1790 this.onLoad();}}},getParams:function(q){var p={};if(this.pageSize){p.start=0;p.limit=this.pageSize;}return p;},collapse:function(){if(!this.isExpanded()){return;}this.list.hide();Roo.get(document).un('mousedown',this.collapseIf,this);Roo.get(document).un('mousewheel',this.collapseIf,this);
1791 if(!this.editable){Roo.get(document).un('keydown',this.listKeyPress,this);}this.fireEvent('collapse',this);},collapseIf:function(e){if(!e.within(this.wrap)&&!e.within(this.list)){this.collapse();}},expand:function(){if(this.isExpanded()||!this.hasFocus){return;
1792 }this.list.alignTo(this.el,this.listAlign);this.list.show();Roo.get(document).on('mousedown',this.collapseIf,this);Roo.get(document).on('mousewheel',this.collapseIf,this);if(!this.editable){Roo.get(document).on('keydown',this.listKeyPress,this);}this.fireEvent('expand',this);
1793 },onTriggerClick:function(){if(this.disabled){return;}if(this.isExpanded()){this.collapse();if(!this.blockFocus){this.el.focus();}}else{this.hasFocus=true;if(this.triggerAction=='all'){this.doQuery(this.allQuery,true);}else{this.doQuery(this.getRawValue());
1794 }if(!this.blockFocus){this.el.focus();}}},listKeyPress:function(e){if(e.isSpecialKey()){return false;}var k=String.fromCharCode(e.getKey()).toUpperCase();var A=false;var B=this.view.getSelectedNodes();var C=false;if(B.length){var ix=this.view.indexOf(B[0]);
1795 C=this.store.getAt(ix);if(!C.get(this.displayField)||C.get(this.displayField).substring(0,1).toUpperCase()!=k){C=false;}}this.store.each(function(v){if(C){if(C.id==v.id){C=false;}return;}if(v.get(this.displayField)&&v.get(this.displayField).substring(0,1).toUpperCase()==k){A=this.store.indexOf(v);
1796 return false;}},this);if(A===false){return true;}this.view.select(A);var sn=Roo.get(this.view.getSelectedNodes()[0]);sn.scrollIntoView(sn.dom.parentNode,false);}});
1797 // Roo/form/ComboBoxArray.js
1798 Roo.form.ComboBoxArray=function(A){this.addEvents({'beforeremove':true,'remove':true});Roo.form.ComboBoxArray.superclass.constructor.call(this,A);this.items=new Roo.util.MixedCollection(false);};Roo.extend(Roo.form.ComboBoxArray,Roo.form.TextField,{lastData:false,inputType:'hidden',width:300,name:false,hiddenName:false,seperator:',',items:false,hiddenEl:false,el:false,onRender:function(ct,A){this.combo.hiddenName=this.hiddenName?(this.hiddenName+'-subcombo'):this.hiddenName;
1799 this.combo.name=this.name?(this.name+'-subcombo'):this.name;this.combo=Roo.factory(this.combo,Roo.form);this.combo.onRender(ct,A);if(typeof(this.combo.width)!='undefined'){this.combo.onResize(this.combo.width,0);}this.combo.initEvents();this.store=this.combo.store;
1800 this.valueField=this.combo.valueField;this.displayField=this.combo.displayField;this.combo.wrap.addClass('x-cbarray-grp');var B=this.combo.wrap.createChild({tag:'div',cls:'x-cbarray-cb'},this.combo.el.dom);this.hiddenEl=this.combo.wrap.createChild({tag:'input',type:'hidden',name:this.hiddenName,value:''}
1801 );this.el=this.combo.wrap.createChild({tag:'input',type:'hidden',name:this.name,value:''});this.outerWrap=this.combo.wrap;this.wrap=B;this.outerWrap.setWidth(this.width);this.outerWrap.dom.removeChild(this.el.dom);this.wrap.dom.appendChild(this.el.dom);this.outerWrap.dom.removeChild(this.combo.trigger.dom);
1802 this.combo.wrap.dom.appendChild(this.combo.trigger.dom);this.combo.trigger.setStyle('position','relative');this.combo.trigger.setStyle('left','0px');this.combo.trigger.setStyle('top','2px');this.combo.el.setStyle('vertical-align','text-bottom');if(this.adder){this.adder=this.outerWrap.createChild({tag:'img',src:Roo.BLANK_IMAGE_URL,cls:'x-form-adder',style:'margin-left:2px'}
1803 );var _t=this;this.adder.on('click',function(e){_t.fireEvent('adderclick',this,e);},_t);}this.combo.on('select',function(cb,C,ix){this.addItem(C.data);cb.setValue('');cb.el.dom.value='';},this);},getName:function(){if(!this.rendered){return ''};return this.hiddenName?this.hiddenName:this.name;
1804 },onResize:function(w,h){return;if(typeof w!='number'){return;}var tw=this.combo.trigger.getWidth();tw+=this.addicon?this.addicon.getWidth():0;tw+=this.editicon?this.editicon.getWidth():0;var x=w-tw;this.combo.el.setWidth(this.combo.adjustWidth('input',x));
1805 this.combo.trigger.setStyle('left','0px');if(this.list&&this.listWidth===undefined){var lw=Math.max(x+this.combo.trigger.getWidth(),this.combo.minListWidth);this.list.setWidth(lw);this.innerList.setWidth(lw-this.list.getFrameWidth('lr'));}},addItem:function(A){var B=this.combo.valueField;
1806 var C=this.combo.displayField;if(this.items.indexOfKey(A[B])>-1){return;}var x=new Roo.form.ComboBoxArray.Item({data:A,displayField:C,tipField:C,cb:this});this.items.add(A[B],x);this.updateHiddenEl();x.render(this.outerWrap,this.wrap.dom);},updateHiddenEl:function(){this.validate();
1807 if(!this.hiddenEl){return;}var ar=[];var A=this.combo.valueField;this.items.each(function(f){ar.push(f.data[A]);});this.hiddenEl.dom.value=ar.join(this.seperator);this.validate();},reset:function(){this.items.clear();Roo.each(this.outerWrap.select('.x-cbarray-item',true).elements,function(el){el.remove();
1808 });this.el.dom.value='';if(this.hiddenEl){this.hiddenEl.dom.value='';}},getValue:function(){return this.hiddenEl?this.hiddenEl.dom.value:'';},setValue:function(v){this.reset();if(this.store.isLocal&&(typeof(v)=='string')){this.hiddenEl.value=v;var A=[];Roo.each(v.split(this.seperator),function(k){Roo.log("CHECK "+this.valueField+','+k);
1809 var li=this.store.query(this.valueField,k);if(!li.length){return;}var B={};B[this.valueField]=k;B[this.displayField]=li.item(0).data[this.displayField];this.addItem(B);},this)}if(typeof(v)=='object'){Roo.each(v,function(l){var B=l;if(typeof(l)=='string'){B={}
1810 ;B[this.valueField]=l;B[this.displayField]=l}this.addItem(B);},this);}},setFromData:function(v){this.reset();this.el.dom.value=v[this.displayField];this.hiddenEl.dom.value=v[this.valueField];if(typeof(v[this.valueField])!='string'||!v[this.valueField].length){return;
1811 }var kv=v[this.valueField];var dv=v[this.displayField];kv=typeof(kv)!='string'?'':kv;dv=typeof(dv)!='string'?'':dv;var A=kv.split(this.seperator);var B=dv.split(this.seperator);for(var i=0;i<A.length;i++){add={};add[this.valueField]=A[i];add[this.displayField]=B[i];
1812 this.addItem(add);}},validate:function(){if(this.disabled||this.validateValue(this.processValue(this.getValue()))){this.clearInvalid();return true;}return false;},validateValue:function(A){return Roo.form.ComboBoxArray.superclass.validateValue.call(this,this.getValue());
1813 },isDirty:function(){if(this.disabled){return false;}try{var d=Roo.decode(String(this.originalValue));}catch(e){return String(this.getValue())!==String(this.originalValue);}var A=[];for(var i=0;i<d.length;i++){A.push(d[i][this.valueField]);}return String(this.getValue())!==String(A.join(this.seperator));
1814 }});Roo.form.ComboBoxArray.Item=function(A){A.id=Roo.id();Roo.form.ComboBoxArray.Item.superclass.constructor.call(this,A);};Roo.extend(Roo.form.ComboBoxArray.Item,Roo.BoxComponent,{data:{},cb:false,displayField:false,tipField:false,defaultAutoCreate:{tag:'div',cls:'x-cbarray-item',cn:[{tag:'div'}
1815 ,{tag:'img',width:16,height:16,src:Roo.BLANK_IMAGE_URL,align:'center'}]},onRender:function(ct,A){Roo.form.Field.superclass.onRender.call(this,ct,A);if(!this.el){var B=this.getAutoCreate();this.el=ct.createChild(B,A);}this.el.child('img').dom.setAttribute('src',Roo.BLANK_IMAGE_URL);
1816 this.el.child('div').dom.innerHTML=this.cb.renderer?this.cb.renderer(this.data):String.format('{0}',this.data[this.displayField]);this.el.child('div').dom.setAttribute('qtip',String.format('{0}',this.data[this.tipField]));this.el.child('img').on('click',this.remove,this);
1817 },remove:function(){if(this.cb.disabled){return;}if(false!==this.cb.fireEvent('beforeremove',this.cb,this)){this.cb.items.remove(this);this.el.child('img').un('click',this.remove,this);this.el.remove();this.cb.updateHiddenEl();this.cb.fireEvent('remove',this.cb,this);
1818 }}});
1819 // Roo/form/ComboNested.js
1820 Roo.form.ComboNested=function(A){Roo.form.ComboCheck.superclass.constructor.call(this,A);var B=['hiddenName','displayField','valueField'];var _t=this;Roo.each(B,function(e){if((typeof(_t[e])=='undefined')||!_t[e].length){throw "Roo.form.ComboNested : missing value for: "+e;
1821 }});};Roo.extend(Roo.form.ComboNested,Roo.form.ComboBox,{maxColumns:3,list:null,innerLists:null,views:null,stores:null,loadingChildren:false,onRender:function(ct,A){Roo.form.ComboBox.superclass.onRender.call(this,ct,A);if(this.hiddenName){this.hiddenField=this.el.insertSibling({tag:'input',type:'hidden',name:this.hiddenName,id:(this.hiddenId||this.hiddenName)}
1822 ,'before',true);this.hiddenField.value=this.hiddenValue!==undefined?this.hiddenValue:this.value!==undefined?this.value:'';this.el.dom.removeAttribute('name');}if(Roo.isGecko){this.el.dom.setAttribute('autocomplete','off');}var B='x-combo-list';this.list=new Roo.Layer({shadow:this.shadow,cls:[B,this.listClass].join(' '),constrain:false}
1823 );var lw=this.listWidth||Math.max(this.wrap.getWidth(),this.minListWidth);this.list.setWidth(lw);this.list.swallowEvent('mousewheel');this.assetHeight=0;if(this.title){this.header=this.list.createChild({cls:B+'-hd',html:this.title});this.assetHeight+=this.header.getHeight();
1824 }this.innerLists=[];this.views=[];this.stores=[];for(var i=0;i<this.maxColumns;i++){this.onRenderList(B,i);}this.footer=this.list.createChild({cls:B+'-ft'});this.pageTb=new Roo.Toolbar(this.footer);var C=this;this.pageTb.add({text:'Done',handler:function(){C.collapse();
1825 }});if(this.allowBlank&&!this.disableClear){this.pageTb.add(new Roo.Toolbar.Fill(),{cls:'x-btn-icon x-btn-clear',text:'&#160;',handler:function(){C.collapse();C.clearValue();C.onSelect(false,-1);}});}if(this.footer){this.assetHeight+=this.footer.getHeight();
1826 }},onRenderList:function(A,i){var lw=Math.floor(((this.listWidth*this.maxColumns||Math.max(this.wrap.getWidth(),this.minListWidth))-this.list.getFrameWidth('lr'))/this.maxColumns);this.list.setWidth(lw);var il=this.innerLists[i]=this.list.createChild({cls:A+'-inner'}
1827 );il.setWidth(lw);il.setStyle({'overflow-x':'hidden'});if(!this.tpl){this.tpl=new Roo.Template({html:'<div class="'+A+'-item '+A+'-item-{cn:this.isEmpty}">{'+this.displayField+'}</div>',isEmpty:function(D,E){var dl=typeof(D.data)!='undefined'?D.data.length:D.length;
1828 return dl?'has-children':'no-children'}});}var B=this.store;if(i>0){B=new Roo.data.SimpleStore({reader:this.store.reader,data:[]});}this.stores[i]=B;var C=this.views[i]=new Roo.View(il,this.tpl,{singleSelect:true,store:B,selectedClass:this.selectedClass});
1829 C.getEl().setWidth(lw);C.getEl().setStyle({position:i<1?'relative':'absolute',top:0,left:(i*lw)+'px',display:i>0?'none':'block'});C.on('selectionchange',this.onSelectChange.createDelegate(this,{list:i},true));C.on('dblclick',this.onDoubleClick.createDelegate(this,{list:i}
1830 ,true));B.on('beforeload',this.onBeforeLoad,this);B.on('load',this.onLoad,this,{list:i});B.on('loadexception',this.onLoadException,this);},restrictHeight:function(){var mh=0;Roo.each(this.innerLists,function(il,i){var el=this.views[i].getEl();el.dom.style.height='';
1831 var A=el.dom;var h=Math.max(il.clientHeight,il.offsetHeight,il.scrollHeight);mh=Math.max(h,mh);if(i<1){el.setHeight(h<this.maxHeight?'auto':this.maxHeight);il.setHeight(h<this.maxHeight?'auto':this.maxHeight);}},this);this.list.beginUpdate();this.list.setHeight(mh+this.list.getFrameWidth('tb')+this.assetHeight);
1832 this.list.alignTo(this.el,this.listAlign);this.list.endUpdate();},onBeforeLoad:function(){if(!this.hasFocus){return;}this.innerLists[0].update(this.loadingText?'<div class="loading-indicator">'+this.loadingText+'</div>':'');this.restrictHeight();this.selectedIndex=-1;
1833 },onLoad:function(a,b,c,d){if(!this.loadingChildren){for(var i=1;i<this.views.length;i++){this.views[i].getEl().setStyle({display:'none'});}var lw=Math.floor(((this.listWidth*this.maxColumns||Math.max(this.wrap.getWidth(),this.minListWidth))-this.list.getFrameWidth('lr'))/this.maxColumns);
1834 this.list.setWidth(lw);}if(!this.hasFocus){return;}if(this.store.getCount()>0){this.expand();this.restrictHeight();}else{this.onEmptyResults();}if(!this.loadingChildren){this.selectActive();}},onLoadException:function(){this.collapse();Roo.log(this.store.reader.jsonData);
1835 if(this.store&&typeof(this.store.reader.jsonData.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",this.store.reader.jsonData.errorMsg);}},cleanLeadingSpace:function(e){},onSelectChange:function(A,B,C){var ix=A.getSelectedIndexes();if(C.list>this.maxColumns-2){if(A.store.getCount()<1){this.views[C.list].getEl().setStyle({display:'none'}
1836 );}else{if(ix.length){this.setFromData(A.store.getAt(ix[0]).data);}}return;}if(!ix.length){var D=this.stores[C.list+1];D.data.clear();return;}var E=A.store.getAt(ix[0]);this.setFromData(E.data);this.fireEvent('select',this,E,ix[0]);var lw=Math.floor(((this.listWidth*this.maxColumns||Math.max(this.wrap.getWidth(),this.minListWidth))-this.list.getFrameWidth('lr'))/this.maxColumns);
1837 this.loadingChildren=true;this.stores[C.list+1].loadDataFromChildren(E);this.loadingChildren=false;var dl=this.stores[C.list+1].getTotalCount();this.views[C.list+1].getEl().setHeight(this.innerLists[0].getHeight());this.views[C.list+1].getEl().setStyle({display:dl?'block':'none'}
1838 );for(var i=C.list+2;i<this.views.length;i++){this.views[i].getEl().setStyle({display:'none'});}this.innerLists[C.list+1].setHeight(this.innerLists[0].getHeight());this.list.setWidth(lw*(C.list+(dl?2:1)));if(this.isLoading){}},onDoubleClick:function(){this.collapse();
1839 },recordToStack:function(A,B,C,D){var E=new Roo.data.SimpleStore({reader:this.store.reader,data:[]});var F=this;var G=false;var H=false;if(A.getCount()<1){return false;}A.each(function(r){if(r.data[B]==C){G=r;H=r;return false;}if(r.data.cn&&r.data.cn.length){E.loadDataFromChildren(r);
1840 var I=F.recordToStack(E,B,C,D);if(I!==false){G=I;H=r;return false;}}return true;});if(G==false){return false}D.unshift(H);return G;},selectActive:function(){var A=[];this.recordToStack(this.store,this.valueField,this.getValue(),A);for(var i=0;i<A.length;i++){this.views[i].select(A[i].store.indexOf(A[i]),false,false);
1841 }}});
1842 // Roo/form/Checkbox.js
1843 Roo.form.Checkbox=function(A){Roo.form.Checkbox.superclass.constructor.call(this,A);this.addEvents({check:true});};Roo.extend(Roo.form.Checkbox,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",checked:false,defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"off"}
1844 ,boxLabel:"",inputValue:'1',valueOff:'0',actionMode:'viewEl',itemCls:'x-menu-check-item x-form-item',groupClass:'x-menu-group-item',inputType:'hidden',inSetChecked:false,inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments);
1845 if(!this.boxLabel){this.el.alignTo(this.wrap,'c-c');}},initEvents:function(){Roo.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this);},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;
1846 },onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:'x-menu-check-item '});var B=this.wrap.createChild({tag:'img',cls:'x-menu-item-icon',style:'margin: 0px;',src:Roo.BLANK_IMAGE_URL});this.viewEl=B;this.wrap.on('click',this.onClick,this);
1847 this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange',this.setFromHidden,this);if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel});}this.setChecked(this.checked);},initValue:Roo.emptyFn,getValue:function(){if(this.el){return String(this.el.dom.value)==String(this.inputValue)?this.inputValue:this.valueOff;
1848 }return this.valueOff;},onClick:function(){if(this.disabled){return;}this.setChecked(!this.checked);},setValue:function(v,A){this.setChecked(String(v)===String(this.inputValue),A);},setChecked:function(A,B){if(this.inSetChecked){this.checked=A;return;}if(this.wrap){this.wrap[A?'addClass':'removeClass']('x-menu-item-checked');
1849 }this.checked=A;if(B!==true){this.fireEvent('check',this,A);}this.inSetChecked=true;this.el.dom.value=A?this.inputValue:this.valueOff;this.inSetChecked=false;},setFromHidden:function(){if(!this.el){return;}this.setValue(this.el.dom.value);},onDestroy:function(){if(this.viewEl){Roo.get(this.viewEl).remove();
1850 }Roo.form.Checkbox.superclass.onDestroy.call(this);},setBoxLabel:function(A){this.wrap.select('.x-form-cb-label',true).first().dom.innerHTML=A;}});
1851 // Roo/form/Radio.js
1852 Roo.form.Radio=function(){Roo.form.Radio.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.form.Radio,Roo.form.Checkbox,{inputType:'radio',getGroupValue:function(){return this.el.up('form').child('input[name='+this.el.dom.name+']:checked',true).value;
1853 },onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);if(this.inputValue!==undefined){this.el.dom.value=this.inputValue;}this.wrap=this.el.wrap({cls:"x-form-check-wrap"});if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel}
1854 );}if(this.checked){this.el.dom.checked='checked';}}});
1855 // Roo/rtf/namespace.js
1856 Roo.rtf={};
1857 // Roo/rtf/Hex.js
1858 Roo.rtf.Hex=function(A){this.hexstr=A;};
1859 // Roo/rtf/Paragraph.js
1860 Roo.rtf.Paragraph=function(A){this.content=[];};
1861 // Roo/rtf/Span.js
1862 Roo.rtf.Span=function(A){this.value=A.value;};
1863 // Roo/rtf/Group.js
1864 Roo.rtf.Group=function(A){this.content=[];this.cn=[];};Roo.rtf.Group.prototype={ignorable:false,content:false,cn:false,addContent:function(A){this.content.push(A);},addChild:function(cn){this.cn.push(cn);},toDataURL:function(){var A=false;switch(true){case this.content.filter(function(a){return a.value=='pngblip'}
1865 ).length>0:A="image/png";break;case this.content.filter(function(a){return a.value=='jpegblip'}).length>0:A="image/jpeg";break;default:return 'about:blank';}var B=this.content[this.content.length-1].value;return 'data:'+A+';base64,'+btoa(B.match(/\w{2}/g).map(function(a){return String.fromCharCode(parseInt(a,16));
1866 }).join(""));}};
1867 // Roo/rtf/Document.js
1868 Roo.rtf.Document=function(){this.rtlch=[];this.content=[];this.cn=[];};Roo.extend(Roo.rtf.Document,Roo.rtf.Group,{addChild:function(cn){this.cn.push(cn);switch(cn.type){case 'rtlch':case 'listtext':case 'shpinst':this.rtlch.push(cn);return;default:this[cn.type]=cn;
1869 }},getElementsByType:function(A){var B=[];this._getElementsByType(A,B,this.cn,'rtf');return B;},_getElementsByType:function(A,B,C,D){C.forEach(function(n,i){if(n.type==A){n.path=D+'/'+n.type+':'+i;B.push(n);}if(n.cn.length>0){this._getElementsByType(A,B,n.cn,D+'/'+n.type+':'+i);
1870 }},this);}});
1871 // Roo/rtf/Ctrl.js
1872 Roo.rtf.Ctrl=function(A){this.value=A.value;this.param=A.param;};
1873 // Roo/rtf/Parser.js
1874 Roo.rtf.Parser=function(A){this.text='';this.parserState=this.parseText;this.doc={};this.groupStack=[];this.hexStore=[];this.doc=false;this.groups=[];for(var ii=0;ii<A.length;++ii){++this.cpos;if(A[ii]==='\n'){++this.row;this.col=1;}else{++this.col;}this.parserState(A[ii]);
1875 }};Roo.rtf.Parser.prototype={text:'',controlWord:'',controlWordParam:'',hexChar:'',doc:false,group:false,groupStack:false,hexStore:false,cpos:0,row:1,col:1,push:function(el){var m='cmd'+el.type;if(typeof(this[m])=='undefined'){Roo.log('invalid cmd:'+el.type);
1876 return;}this[m](el);},flushHexStore:function(){if(this.hexStore.length<1){return;}var A=this.hexStore.map(function(B){return B.value;}).join('');this.group.addContent(new Roo.rtf.Hex(A));this.hexStore.splice(0)},cmdgroupstart:function(){this.flushHexStore();
1877 if(this.group){this.groupStack.push(this.group);}if(this.doc===false){this.group=this.doc=new Roo.rtf.Document();return;}this.group=new Roo.rtf.Group(this.group);},cmdignorable:function(){this.flushHexStore();this.group.ignorable=true;},cmdendparagraph:function(){this.flushHexStore();
1878 this.group.addContent(new Roo.rtf.Paragraph());},cmdgroupend:function(){this.flushHexStore();var A=this.group;this.group=this.groupStack.pop();if(this.group){this.group.addChild(A);}var B=this.group||this.doc;if(A.ignorable===false){this.groups.push(A);}}
1879 ,cmdtext:function(A){this.flushHexStore();if(!this.group){return;}this.group.addContent(new Roo.rtf.Span(A));},cmdcontrolword:function(A){this.flushHexStore();if(!this.group.type){this.group.type=A.value;return;}this.group.addContent(new Roo.rtf.Ctrl(A));
1880 return;},cmdhexchar:function(A){this.hexStore.push(A);},cmderror:function(A){throw A.value;},parseText:function(c){if(c==='\\'){this.parserState=this.parseEscapes;}else if(c==='{'){this.emitStartGroup();}else if(c==='}'){this.emitEndGroup();}else if(c==='\x0A'||c==='\x0D'){}
1881 else{this.text+=c;}},parseEscapes:function(c){if(c==='\\'||c==='{'||c==='}'){this.text+=c;this.parserState=this.parseText;}else{this.parserState=this.parseControlSymbol;this.parseControlSymbol(c);}},parseControlSymbol:function(c){if(c==='~'){this.text+='\u00a0';
1882 this.parserState=this.parseText}else if(c==='-'){this.text+='\u00ad';}else if(c==='_'){this.text+='\u2011';}else if(c==='*'){this.emitIgnorable();this.parserState=this.parseText;}else if(c==="'"){this.parserState=this.parseHexChar;}else if(c==='|'){this.emitFormula();
1883 this.parserState=this.parseText;}else if(c===':'){this.emitIndexSubEntry();this.parserState=this.parseText;}else if(c==='\x0a'){this.emitEndParagraph();this.parserState=this.parseText;}else if(c==='\x0d'){this.emitEndParagraph();this.parserState=this.parseText;
1884 }else{this.parserState=this.parseControlWord;this.parseControlWord(c);}},parseHexChar:function(c){if(/^[A-Fa-f0-9]$/.test(c)){this.hexChar+=c;if(this.hexChar.length>=2){this.emitHexChar();this.parserState=this.parseText;}return;}this.emitError("Invalid character \""+c+"\" in hex literal.");
1885 this.parserState=this.parseText;},parseControlWord:function(c){if(c===' '){this.emitControlWord();this.parserState=this.parseText;}else if(/^[-\d]$/.test(c)){this.parserState=this.parseControlWordParam;this.controlWordParam+=c;}else if(/^[A-Za-z]$/.test(c)){this.controlWord+=c;
1886 }else{this.emitControlWord();this.parserState=this.parseText;this.parseText(c);}},parseControlWordParam:function(c){if(/^\d$/.test(c)){this.controlWordParam+=c;}else if(c===' '){this.emitControlWord();this.parserState=this.parseText;}else{this.emitControlWord();
1887 this.parserState=this.parseText;this.parseText(c);}},emitText:function(){if(this.text===''){return;}this.push({type:'text',value:this.text,pos:this.cpos,row:this.row,col:this.col});this.text=''},emitControlWord:function(){this.emitText();if(this.controlWord===''){}
1888 else{this.push({type:'controlword',value:this.controlWord,param:this.controlWordParam!==''&&Number(this.controlWordParam),pos:this.cpos,row:this.row,col:this.col});}this.controlWord='';this.controlWordParam='';},emitStartGroup:function(){this.emitText();this.push({type:'groupstart',pos:this.cpos,row:this.row,col:this.col}
1889 );},emitEndGroup:function(){this.emitText();this.push({type:'groupend',pos:this.cpos,row:this.row,col:this.col});},emitIgnorable:function(){this.emitText();this.push({type:'ignorable',pos:this.cpos,row:this.row,col:this.col});},emitHexChar:function(){this.emitText();
1890 this.push({type:'hexchar',value:this.hexChar,pos:this.cpos,row:this.row,col:this.col});this.hexChar=''},emitError:function(A){this.emitText();this.push({type:'error',value:A,row:this.row,col:this.col,char:this.cpos});},emitEndParagraph:function(){this.emitText();
1891 this.push({type:'endparagraph',pos:this.cpos,row:this.row,col:this.col});}};
1892 // Roo/htmleditor/namespace.js
1893 Roo.htmleditor={};
1894 // Roo/htmleditor/Filter.js
1895 Roo.htmleditor.Filter=function(A){Roo.apply(this.cfg);};Roo.htmleditor.Filter.prototype={node:false,tag:false,replaceComment:false,replaceTag:false,walk:function(A){Roo.each(Array.from(A.childNodes),function(e){switch(true){case e.nodeType==8&&this.replaceComment!==false:this.replaceComment(e);
1896 return;case e.nodeType!=1:return;case this.tag===true:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='object'&&this.tag.indexOf(":")>-1:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='string'&&this.tag==":":case typeof(this.tag)=='object'&&this.tag.indexOf(e.tagName)>-1:case typeof(this.tag)=='string'&&this.tag==e.tagName:if(this.replaceTag&&false===this.replaceTag(e)){return;
1897 }if(e.hasChildNodes()){this.walk(e);}return;default:if(e.hasChildNodes()){this.walk(e);}}},this);}};
1898 // Roo/htmleditor/FilterAttributes.js
1899 Roo.htmleditor.FilterAttributes=function(A){Roo.apply(this,A);this.attrib_black=this.attrib_black||[];this.attrib_white=this.attrib_white||[];this.attrib_clean=this.attrib_clean||[];this.style_white=this.style_white||[];this.style_black=this.style_black||[];
1900 this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterAttributes,Roo.htmleditor.Filter,{tag:true,attrib_black:false,attrib_clean:false,attrib_white:false,style_white:false,style_black:false,replaceTag:function(A){if(!A.attributes||!A.attributes.length){return true;
1901 }for(var i=A.attributes.length-1;i>-1;i--){var a=A.attributes[i];if(this.attrib_white.length&&this.attrib_white.indexOf(a.name.toLowerCase())<0){A.removeAttribute(a.name);continue;}if(a.name.toLowerCase().substr(0,2)=='on'){A.removeAttribute(a.name);continue;
1902 }if(this.attrib_black.indexOf(a.name.toLowerCase())>-1){A.removeAttribute(a.name);continue;}if(this.attrib_clean.indexOf(a.name.toLowerCase())>-1){this.cleanAttr(A,a.name,a.value);continue;}if(a.name=='style'){this.cleanStyle(A,a.name,a.value);continue;}if(a.name=='class'){if(a.value.match(/^Mso/)){A.removeAttribute('class');
1903 }if(a.value.match(/^body$/)){A.removeAttribute('class');}continue;}}return true;},cleanAttr:function(A,n,v){if(v.match(/^\./)||v.match(/^\//)){return;}if(v.match(/^(http|https):\/\//)||v.match(/^mailto:/)||v.match(/^ftp:/)||v.match(/^data:/)){return;}if(v.match(/^#/)){return;
1904 }if(v.match(/^\{/)){return;}A.removeAttribute(n);},cleanStyle:function(A,n,v){if(v.match(/expression/)){A.removeAttribute(n);return;}var B=v.split(/;/);var C=[];Roo.each(B,function(p){p=p.replace(/^\s+/g,'').replace(/\s+$/g,'');if(!p.length){return true;}
1905 var l=p.split(':').shift().replace(/\s+/g,'');l=l.replace(/^\s+/g,'').replace(/\s+$/g,'');if(this.style_black.length&&(this.style_black.indexOf(l)>-1||this.style_black.indexOf(l.toLowerCase())>-1)){return true;}if(this.style_white.length&&style_white.indexOf(l)<0&&style_white.indexOf(l.toLowerCase())<0){return true;
1906 }C.push(p);return true;},this);if(C.length){A.setAttribute(n,C.join(';'));}else{A.removeAttribute(n);}}});
1907 // Roo/htmleditor/FilterBlack.js
1908 Roo.htmleditor.FilterBlack=function(A){Roo.apply(this,A);this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterBlack,Roo.htmleditor.Filter,{tag:true,replaceTag:function(n){n.parentNode.removeChild(n);}});
1909 // Roo/htmleditor/FilterComment.js
1910 Roo.htmleditor.FilterComment=function(A){this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterComment,Roo.htmleditor.Filter,{replaceComment:function(n){n.parentNode.removeChild(n);}});
1911 // Roo/htmleditor/FilterKeepChildren.js
1912 Roo.htmleditor.FilterKeepChildren=function(A){Roo.apply(this,A);if(this.tag===false){return;}this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterKeepChildren,Roo.htmleditor.FilterBlack,{replaceTag:function(A){var ar=Array.from(A.childNodes);for(var i=0;i<ar.length;
1913 i++){if(ar[i].nodeType==1){if((typeof(this.tag)=='object'&&this.tag.indexOf(ar[i].tagName)>-1)||(typeof(this.tag)=='string'&&this.tag==ar[i].tagName)){this.replaceTag(ar[i]);continue;}}}ar=Array.from(A.childNodes);for(var i=0;i<ar.length;i++){A.removeChild(ar[i]);
1914 A.parentNode.insertBefore(ar[i],A);if(this.tag!==false){this.walk(ar[i]);}}A.parentNode.removeChild(A);return false;}});
1915 // Roo/htmleditor/FilterParagraph.js
1916 Roo.htmleditor.FilterParagraph=function(A){this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterParagraph,Roo.htmleditor.Filter,{tag:'P',replaceTag:function(A){if(A.childNodes.length==1&&A.childNodes[0].nodeType==3&&A.childNodes[0].textContent.trim().length<1){A.parentNode.replaceChild(A.ownerDocument.createElement('BR'),A);
1917 return false;}var ar=Array.from(A.childNodes);for(var i=0;i<ar.length;i++){A.removeChild(ar[i]);A.parentNode.insertBefore(ar[i],A);}A.parentNode.insertBefore(A.ownerDocument.createElement('BR'),A);A.parentNode.insertBefore(A.ownerDocument.createElement('BR'),A);
1918 A.parentNode.removeChild(A);return false;}});
1919 // Roo/htmleditor/FilterSpan.js
1920 Roo.htmleditor.FilterSpan=function(A){this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterSpan,Roo.htmleditor.FilterKeepChildren,{tag:'SPAN',replaceTag:function(A){if(A.attributes&&A.attributes.length>0){return true;}Roo.htmleditor.FilterKeepChildren.prototype.replaceTag.call(this,A);
1921 return false;}});
1922 // Roo/htmleditor/FilterTableWidth.js
1923 Roo.htmleditor.FilterTableWidth=function(A){this.tag=['TABLE','TD','TR','TH','THEAD','TBODY'];this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterTableWidth,Roo.htmleditor.Filter,{replaceTag:function(A){if(A.hasAttribute('width')){A.removeAttribute('width');
1924 }if(A.hasAttribute("style")){var B=A.getAttribute("style").split(";");var C=[];Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");if(kv[0].match(/^\s*(width|min-width)\s*$/)){return;}C.push(s);});A.setAttribute("style",C.length?C.join(';'):'');
1925 if(!C.length){A.removeAttribute('style');}}return true;}});
1926 // Roo/htmleditor/FilterWord.js
1927 Roo.htmleditor.FilterWord=function(A){this.replaceDocBullets(A.node);};Roo.extend(Roo.htmleditor.FilterWord,Roo.htmleditor.Filter,{tag:true,replaceTag:function(A){if(A.nodeName=='SPAN'&&!A.hasAttributes()&&A.childNodes.length==1&&A.firstChild.nodeName=="#text"){var B=A.firstChild;
1928 A.removeChild(B);if(A.getAttribute('lang')!='zh-CN'){A.parentNode.insertBefore(A.ownerDocument.createTextNode(" "),A);}A.parentNode.insertBefore(B,A);if(A.getAttribute('lang')!='zh-CN'){A.parentNode.insertBefore(A.ownerDocument.createTextNode(" "),A);}A.parentNode.removeChild(A);
1929 return false;}if(A.tagName.toLowerCase().match(/^(style|script|applet|embed|noframes|noscript)$/)){A.parentNode.removeChild(A);return false;}if(A.tagName.toLowerCase().match(/^(meta|link|\\?xml:|st1:|o:|v:|font)/)){while(A.childNodes.length){var cn=A.childNodes[0];
1930 A.removeChild(cn);A.parentNode.insertBefore(cn,A);if(cn.nodeType==1){this.replaceTag(cn);}}A.parentNode.removeChild(A);return false;}if(A.className.length){var cn=A.className.split(/\W+/);var C=[];Roo.each(cn,function(F){if(F.match(/Mso[a-zA-Z]+/)){return;
1931 }C.push(F);});A.className=C.length?C.join(' '):'';if(!C.length){A.removeAttribute("class");}}if(A.hasAttribute("lang")){A.removeAttribute("lang");}if(A.hasAttribute("style")){var D=A.getAttribute("style").split(";");var E=[];Roo.each(D,function(s){if(!s.match(/:/)){return;
1932 }var kv=s.split(":");if(kv[0].match(/^(mso-|line|font|background|margin|padding|color)/)){return;}E.push(s);});A.setAttribute("style",E.length?E.join(';'):'');if(!E.length){A.removeAttribute('style');}}return true;},styleToObject:function(A){var B=(A.getAttribute("style")||'').split(";");
1933 var C={};Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");C[kv[0].trim()]=kv[1];});return C;},replaceDocBullets:function(A){var B=A.getElementsByClassName('ql-indent-1');while(B.length){this.replaceDocBullet(B.item(0));}var B=A.getElementsByClassName('MsoListParagraph');
1934 while(B.length){this.replaceDocBullet(B.item(0));}},replaceDocBullet:function(p){var ns=p,A=p.parentNode,B=A.ownerDocument,C=[];while(ns){if(ns.nodeType!=1){ns=ns.nextSibling;continue;}if(!ns.className.match(/(MsoListParagraph|ql-indent-1)/i)){break;}C.push(ns);
1935 ns=ns.nextSibling;}var ul=A.ownerDocument.createElement('ul');A.insertBefore(ul,p);var D=0;var E=[ul];var F=false;C.forEach(function(n,G){var H=n.getElementsByTagName('span');if(!H.length){A.removeChild(n);return;}var I={};for(var i=0;i<H.length;i++){I=this.styleToObject(H[i]);
1936 if(typeof(I['mso-list'])=='undefined'){continue;}H[i].parentNode.removeChild(H[i]);break;}I=this.styleToObject(n);if(typeof(I['mso-list'])=='undefined'){A.removeChild(n);return;}var J=(I['mso-list'].split(' ')[1].replace(/level/,'')*1)-1;if(J>D){var K=B.createElement('ul');
1937 F.appendChild(K);E[J]=K;}D=J;var L=E[J].appendChild(B.createElement('li'));F=L;L.innerHTML=n.innerHTML;A.removeChild(n);},this);}});
1938 // Roo/htmleditor/FilterStyleToTag.js
1939 Roo.htmleditor.FilterStyleToTag=function(A){this.tags={B:['fontWeight','bold'],I:['fontStyle','italic'],SUP:['verticalAlign','super'],SUB:['verticalAlign','sub']};Roo.apply(this,A);this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterStyleToTag,Roo.htmleditor.Filter,{tag:true,tags:false,replaceTag:function(A){if(A.getAttribute("style")===null){return true;
1940 }var B=[];for(var k in this.tags){if(A.style[this.tags[k][0]]==this.tags[k][1]){B.push(k);A.style.removeProperty(this.tags[k][0]);}}if(!B.length){return true;}var cn=Array.from(A.childNodes);var nn=A;Roo.each(B,function(t){var nc=A.ownerDocument.createElement(t);
1941 nn.appendChild(nc);nn=nc;});for(var i=0;i<cn.length;cn++){A.removeChild(cn[i]);nn.appendChild(cn[i]);}return true}})
1942 // Roo/htmleditor/FilterLongBr.js
1943 Roo.htmleditor.FilterLongBr=function(A){this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterLongBr,Roo.htmleditor.Filter,{tag:'BR',replaceTag:function(A){var ps=A.nextSibling;while(ps&&ps.nodeType==3&&ps.nodeValue.trim().length<1){ps=ps.nextSibling;}if(!ps&&['TD','TH','LI','H1','H2','H3','H4','H5','H6'].indexOf(A.parentNode.tagName)>-1){A.parentNode.removeChild(A);
1944 return false;}if(!ps||ps.nodeType!=1){return false;}if(!ps||ps.tagName!='BR'){return false;}if(!A.previousSibling){return false;}var ps=A.previousSibling;while(ps&&ps.nodeType==3&&ps.nodeValue.trim().length<1){ps=ps.previousSibling;}if(!ps||ps.nodeType!=1){return false;
1945 }if(!ps||['BR','H1','H2','H3','H4','H5','H6'].indexOf(ps.tagName)<0){return false;}A.parentNode.removeChild(A);return false;}});
1946 // Roo/htmleditor/FilterBlock.js
1947 Roo.htmleditor.FilterBlock=function(A){Roo.apply(this,A);var qa=A.node.querySelectorAll;this.removeAttributes('data-block');this.removeAttributes('contenteditable');this.removeAttributes('id');};Roo.apply(Roo.htmleditor.FilterBlock.prototype,{node:true,removeAttributes:function(A){var ar=this.node.querySelectorAll('*['+A+']');
1948 for(var i=0;i<ar.length;i++){ar[i].removeAttribute(A);}}});
1949 // Roo/htmleditor/TidySerializer.js
1950 Roo.htmleditor.TidySerializer=function(A){Roo.apply(this,A);this.writer=new Roo.htmleditor.TidyWriter(A);};Roo.htmleditor.TidySerializer.prototype={inner:false,writer:false,serialize:function(A){var B=this.writer;var C=this;this.handlers={3:function(D){B.text(D.nodeValue,D);
1951 },8:function(D){B.comment(D.nodeValue);},7:function(D){B.pi(D.name,D.nodeValue);},10:function(D){B.doctype(D.nodeValue);},4:function(D){B.cdata(D.nodeValue);},11:function(D){D=D.firstChild;if(!D){return;}while(D){C.walk(D);D=D.nextSibling}}};B.reset();1!=A.nodeType||this.inner?this.handlers[11](A):this.walk(A);
1952 return B.getContent();},walk:function(A){var B,C,D,i,l,E,F=this.handlers[A.nodeType];if(F){F(A);return;}var G=A.nodeName;var H=A.childNodes.length<1;var I=this.writer;var J=A.attributes;I.start(A.nodeName,J,H,A);if(H){return;}A=A.firstChild;if(!A){I.end(G);
1953 return;}while(A){this.walk(A);A=A.nextSibling;}I.end(G);}};
1954 // Roo/htmleditor/TidyWriter.js
1955 Roo.htmleditor.TidyWriter=function(A){Roo.apply(this,A);this.html=[];this.state=[];this.encode=Roo.htmleditor.TidyEntities.getEncodeFunc(A.entity_encoding||'raw',A.entities);};Roo.htmleditor.TidyWriter.prototype={state:false,indent:'  ',indentstr:'',in_pre:false,in_inline:false,last_inline:false,encode:false,start:function(A,B,C,D){var i,l,E,F;
1956 var G=this.in_inline||Roo.htmleditor.TidyWriter.inline_elements.indexOf(A)>-1;var H=this.in_pre||Roo.htmleditor.TidyWriter.whitespace_elements.indexOf(A)>-1;var I=C?Roo.htmleditor.TidyWriter.shortend_elements.indexOf(A)>-1:false;var J=A=='BR'?false:G;if(!J&&!this.in_pre&&this.lastElementEndsWS()){i_inline=false;
1957 }var K=this.indentstr;if(!this.in_pre){if(G){if(A=='BR'){this.addLine();}else if(this.lastElementEndsWS()){this.addLine();}else{K='';}}else{this.addLine();}}else{K='';}this.html.push(K+'<',A.toLowerCase());if(B){for(i=0,l=B.length;i<l;i++){E=B[i];this.html.push(' ',E.name,'="',this.encode(E.value,true),'"');
1958 }}if(C){if(I){this.html[this.html.length]='/>';}else{this.html[this.html.length]='></'+A.toLowerCase()+'>';}var L=A=='BR'?false:this.in_inline;if(!L&&!this.in_pre){this.addLine();}return;}this.html[this.html.length]='>';this.pushState({indentstr:H?'':(this.indentstr+this.indent),in_pre:H,in_inline:G}
1959 );if(!G&&!H){this.addLine();}},lastElementEndsWS:function(){var A=this.html.length>0?this.html[this.html.length-1]:false;if(A===false){return true;}return A.match(/\s+$/);},end:function(A){var B;this.popState();var C='';var D=this.in_inline||Roo.htmleditor.TidyWriter.inline_elements.indexOf(A)>-1;
1960 if(!this.in_pre&&!D){this.addLine();C=this.indentstr;}this.html.push(C+'</',A.toLowerCase(),'>');this.last_inline=D;},text:function(A,B){if(A.length<1){return;}var C=new XMLSerializer().serializeToString(document.createTextNode(A));if(this.in_pre){this.html[this.html.length]=C;
1961 return;}if(this.in_inline){C=C.replace(/\s+/g,' ');if(C!=' '){C=C.replace(/\s+/,' ');if(B.nextSibling&&B.nextSibling.nodeType==1&&B.nextSibling.nodeName=='BR'){C=C.replace(/\s+$/g,'');}if(B.previousSibling&&B.previousSibling.nodeType==1&&B.previousSibling.nodeName=='BR'){C=this.indentstr+C.replace(/^\s+/g,'');
1962 }if(C.match(/\n/)){C=C.replace(/(?![^\n]{1,64}$)([^\n]{1,64})\s/g,'$1\n'+this.indentstr);C=C.replace(/\n\s+$/,'');}}this.html[this.html.length]=C;return;}var D=this.indentstr;C=C.replace(/\s+/g," ");if(B.previousSibling&&B.previousSibling.nodeType==1&&Roo.htmleditor.TidyWriter.inline_elements.indexOf(B.previousSibling.nodeName)>-1){D='';
1963 }else{this.addLine();C=C.replace(/^\s+/,'');}if(B.nextSibling&&B.nextSibling.nodeType==1&&Roo.htmleditor.TidyWriter.inline_elements.indexOf(B.nextSibling.nodeName)>-1){}else{C=C.replace(/\s+$/,'');}if(C.length<1){return;}if(!C.match(/\n/)){this.html.push(D+C);
1964 return;}C=this.indentstr+C.replace(/(?![^\n]{1,64}$)([^\n]{1,64})\s/g,'$1\n'+this.indentstr);C=C.replace(/\s+$/,'');this.html.push(C);},cdata:function(A){this.html.push('<![CDATA[',A,']]>');},comment:function(A){this.html.push('<!--',A,'-->');},pi:function(A,B){B?this.html.push('<?',A,' ',this.encode(B),'?>'):this.html.push('<?',A,'?>');
1965 this.indent!=''&&this.html.push('\n');},doctype:function(A){this.html.push('<!DOCTYPE',A,'>',this.indent!=''?'\n':'');},reset:function(){this.html.length=0;this.state=[];this.pushState({indentstr:'',in_pre:false,in_inline:false})},getContent:function(){return this.html.join('').replace(/\n$/,'');
1966 },pushState:function(A){this.state.push(A);Roo.apply(this,A);},popState:function(){if(this.state.length<1){return;}var A={in_pre:false,indentstr:''};this.state.pop();if(this.state.length>0){A=this.state[this.state.length-1];}Roo.apply(this,A);},addLine:function(){if(this.html.length<1){return;
1967 }var A=this.html[this.html.length-1];if(A.length>0&&'\n'!==A){this.html.push('\n');}}};Roo.htmleditor.TidyWriter.inline_elements=['SPAN','STRONG','B','EM','I','FONT','STRIKE','U','VAR','CITE','DFN','CODE','MARK','Q','SUP','SUB','SAMP','A'];Roo.htmleditor.TidyWriter.shortend_elements=['AREA','BASE','BASEFONT','BR','COL','FRAME','HR','IMG','INPUT','ISINDEX','LINK','','META','PARAM','EMBED','SOURCE','WBR','TRACK'];
1968 Roo.htmleditor.TidyWriter.whitespace_elements=['PRE','SCRIPT','NOSCRIPT','STYLE','TEXTAREA','VIDEO','AUDIO','IFRAME','OBJECT','CODE'];
1969 // Roo/htmleditor/TidyEntities.js
1970 Roo.htmleditor.TidyEntities={init:function(){this.namedEntities=this.buildEntitiesLookup(this.namedEntitiesData,32);},buildEntitiesLookup:function(A,B){var i,C,D,E={};if(!A){return {};}A=typeof(A)=='string'?A.split(','):A;B=B||10;for(i=0;i<A.length;i+=2){C=String.fromCharCode(parseInt(A[i],B));
1971 if(!this.baseEntities[C]){D='&'+A[i+1]+';';E[C]=D;E[D]=C;}}return E;},asciiMap:{128:'€',130:'‚',131:'ƒ',132:'„',133:'…',134:'†',135:'‡',136:'ˆ',137:'‰',138:'Š',139:'‹',140:'Œ',142:'Ž',145:'‘',146:'’',147:'“',148:'”',149:'•',150:'–',151:'—',152:'˜',153:'™',154:'š',155:'›',156:'œ',158:'ž',159:'Ÿ'}
1972 ,baseEntities:{'"':'&quot;','\'':'&#39;','<':'&lt;','>':'&gt;','&':'&amp;','`':'&#96;'},reverseEntities:{'&lt;':'<','&gt;':'>','&amp;':'&','&quot;':'"','&apos;':'\''},attrsCharsRegExp:/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,textCharsRegExp:/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,rawCharsRegExp:/[<>&\"\']/g,entityRegExp:/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,namedEntities:false,namedEntitiesData:['50','nbsp','51','iexcl','52','cent','53','pound','54','curren','55','yen','56','brvbar','57','sect','58','uml','59','copy','5a','ordf','5b','laquo','5c','not','5d','shy','5e','reg','5f','macr','5g','deg','5h','plusmn','5i','sup2','5j','sup3','5k','acute','5l','micro','5m','para','5n','middot','5o','cedil','5p','sup1','5q','ordm','5r','raquo','5s','frac14','5t','frac12','5u','frac34','5v','iquest','60','Agrave','61','Aacute','62','Acirc','63','Atilde','64','Auml','65','Aring','66','AElig','67','Ccedil','68','Egrave','69','Eacute','6a','Ecirc','6b','Euml','6c','Igrave','6d','Iacute','6e','Icirc','6f','Iuml','6g','ETH','6h','Ntilde','6i','Ograve','6j','Oacute','6k','Ocirc','6l','Otilde','6m','Ouml','6n','times','6o','Oslash','6p','Ugrave','6q','Uacute','6r','Ucirc','6s','Uuml','6t','Yacute','6u','THORN','6v','szlig','70','agrave','71','aacute','72','acirc','73','atilde','74','auml','75','aring','76','aelig','77','ccedil','78','egrave','79','eacute','7a','ecirc','7b','euml','7c','igrave','7d','iacute','7e','icirc','7f','iuml','7g','eth','7h','ntilde','7i','ograve','7j','oacute','7k','ocirc','7l','otilde','7m','ouml','7n','divide','7o','oslash','7p','ugrave','7q','uacute','7r','ucirc','7s','uuml','7t','yacute','7u','thorn','7v','yuml','ci','fnof','sh','Alpha','si','Beta','sj','Gamma','sk','Delta','sl','Epsilon','sm','Zeta','sn','Eta','so','Theta','sp','Iota','sq','Kappa','sr','Lambda','ss','Mu','st','Nu','su','Xi','sv','Omicron','t0','Pi','t1','Rho','t3','Sigma','t4','Tau','t5','Upsilon','t6','Phi','t7','Chi','t8','Psi','t9','Omega','th','alpha','ti','beta','tj','gamma','tk','delta','tl','epsilon','tm','zeta','tn','eta','to','theta','tp','iota','tq','kappa','tr','lambda','ts','mu','tt','nu','tu','xi','tv','omicron','u0','pi','u1','rho','u2','sigmaf','u3','sigma','u4','tau','u5','upsilon','u6','phi','u7','chi','u8','psi','u9','omega','uh','thetasym','ui','upsih','um','piv','812','bull','816','hellip','81i','prime','81j','Prime','81u','oline','824','frasl','88o','weierp','88h','image','88s','real','892','trade','89l','alefsym','8cg','larr','8ch','uarr','8ci','rarr','8cj','darr','8ck','harr','8dl','crarr','8eg','lArr','8eh','uArr','8ei','rArr','8ej','dArr','8ek','hArr','8g0','forall','8g2','part','8g3','exist','8g5','empty','8g7','nabla','8g8','isin','8g9','notin','8gb','ni','8gf','prod','8gh','sum','8gi','minus','8gn','lowast','8gq','radic','8gt','prop','8gu','infin','8h0','ang','8h7','and','8h8','or','8h9','cap','8ha','cup','8hb','int','8hk','there4','8hs','sim','8i5','cong','8i8','asymp','8j0','ne','8j1','equiv','8j4','le','8j5','ge','8k2','sub','8k3','sup','8k4','nsub','8k6','sube','8k7','supe','8kl','oplus','8kn','otimes','8l5','perp','8m5','sdot','8o8','lceil','8o9','rceil','8oa','lfloor','8ob','rfloor','8p9','lang','8pa','rang','9ea','loz','9j0','spades','9j3','clubs','9j5','hearts','9j6','diams','ai','OElig','aj','oelig','b0','Scaron','b1','scaron','bo','Yuml','m6','circ','ms','tilde','802','ensp','803','emsp','809','thinsp','80c','zwnj','80d','zwj','80e','lrm','80f','rlm','80j','ndash','80k','mdash','80o','lsquo','80p','rsquo','80q','sbquo','80s','ldquo','80t','rdquo','80u','bdquo','810','dagger','811','Dagger','81g','permil','81p','lsaquo','81q','rsaquo','85c','euro'],encodeRaw:function(A,B){var t=this;
1973 return A.replace(B?this.attrsCharsRegExp:this.textCharsRegExp,function(C){return t.baseEntities[C]||C;});},encodeAllRaw:function(A){var t=this;return (''+A).replace(this.rawCharsRegExp,function(B){return t.baseEntities[B]||B;});},encodeNumeric:function(A,B){var t=this;
1974 return A.replace(B?this.attrsCharsRegExp:this.textCharsRegExp,function(C){if(C.length>1){return '&#'+(1024*(C.charCodeAt(0)-55296)+(C.charCodeAt(1)-56320)+65536)+';';}return t.baseEntities[C]||'&#'+C.charCodeAt(0)+';';});},encodeNamed:function(A,B,C){var t=this;
1975 C=C||this.namedEntities;return A.replace(B?this.attrsCharsRegExp:this.textCharsRegExp,function(D){return t.baseEntities[D]||C[D]||D;});},getEncodeFunc:function(A,B){B=this.buildEntitiesLookup(B)||this.namedEntities;var t=this;function encodeNamedAndNumeric(C,D){return C.replace(D?t.attrsCharsRegExp:t.textCharsRegExp,function(E){return t.baseEntities[E]||B[E]||'&#'+E.charCodeAt(0)+';'||E;
1976 });}function encodeCustomNamed(C,D){return t.encodeNamed(C,D,B);}A=this.makeMap(A.replace(/\+/g,','));if(A.named&&A.numeric){return this.encodeNamedAndNumeric;}if(A.named){if(B){return encodeCustomNamed;}return this.encodeNamed;}if(A.numeric){return this.encodeNumeric;
1977 }return this.encodeRaw;},decode:function(A){var t=this;return A.replace(this.entityRegExp,function(B,C){if(C){C='x'===C.charAt(0).toLowerCase()?parseInt(C.substr(1),16):parseInt(C,10);if(C>65535){C-=65536;return String.fromCharCode(55296+(C>>10),56320+(1023&C));
1978 }return t.asciiMap[C]||String.fromCharCode(C);}return t.reverseEntities[B]||t.namedEntities[B]||t.nativeDecode(B);});},nativeDecode:function(A){return A;},makeMap:function(A,B,C){var i;A=A||[];B=B||',';if(typeof A=="string"){A=A.split(B);}C=C||{};i=A.length;
1979 while(i--){C[A[i]]={};}return C;}};Roo.htmleditor.TidyEntities.init();
1980 // Roo/htmleditor/KeyEnter.js
1981 Roo.htmleditor.KeyEnter=function(A){Roo.apply(this,A);Roo.get(this.core.doc.body).on('keypress',this.keypress,this);};Roo.htmleditor.KeyEnter.prototype={core:false,keypress:function(e){if(e.charCode!=13&&e.charCode!=10){Roo.log([e.charCode,e]);return true;
1982 }e.preventDefault();var A=this.core.doc;var B=this.core.getSelection();var C=B.getRangeAt(0);var n=C.commonAncestorContainer;var pc=C.closest(['ol','ul']);var D=C.closest('li');if(!pc||e.ctrlKey){if(!e.ctrlKey){B.insertNode('br','after');}else{var br=A.createElement('br');
1983 br.className='clear';br.setAttribute('style','clear: both');B.insertNode(br,'after');}this.core.undoManager.addEvent();this.core.fireEditorEvent(e);return false;}if(D.innerText.trim()==''&&D.previousSibling&&D.previousSibling.nodeName=='LI'&&D.previousSibling.innerText.trim()==''){D.parentNode.removeChild(D.previousSibling);
1984 B.cursorAfter(pc);this.core.undoManager.addEvent();this.core.fireEditorEvent(e);return false;}var li=A.createElement('LI');li.innerHTML='&nbsp;';if(!D||!D.firstSibling){pc.appendChild(li);}else{D.parentNode.insertBefore(li,D.firstSibling);}B.cursorText(li.firstChild);
1985 this.core.undoManager.addEvent();this.core.fireEditorEvent(e);return false;}};
1986 // Roo/htmleditor/Block.js
1987 Roo.htmleditor.Block=function(A){};Roo.htmleditor.Block.factory=function(A){var cc=Roo.htmleditor.Block.cache;var id=Roo.get(A).id;if(typeof(cc[id])!='undefined'&&(!cc[id].node||cc[id].node.closest('body'))){Roo.htmleditor.Block.cache[id].readElement(A);return Roo.htmleditor.Block.cache[id];
1988 }var db=A.getAttribute('data-block');if(!db){db=A.nodeName.toLowerCase().toUpperCaseFirst();}var B=Roo.htmleditor['Block'+db];if(typeof(B)=='undefined'){Roo.log("OOps missing block : "+'Block'+db);return false;}Roo.htmleditor.Block.cache[id]=new B({node:A}
1989 );return Roo.htmleditor.Block.cache[id];};Roo.htmleditor.Block.initAll=function(A,B){if(typeof(B)=='undefined'){var ia=Roo.htmleditor.Block.initAll;ia(A,'table');ia(A,'td');ia(A,'figure');return;}Roo.each(Roo.get(A).query(B),function(e){Roo.htmleditor.Block.factory(e);
1990 },this);};Roo.htmleditor.Block.cache={};Roo.htmleditor.Block.prototype={node:false,friendly_name:'Based Block',deleteTitle:false,context:false,updateElement:function(A){Roo.DomHelper.update(A===undefined?this.node:A,this.toObject());},toHTML:function(){return Roo.DomHelper.markup(this.toObject());
1991 },getVal:function(A,B,C,D){var n=A;if(B!==true&&n.tagName!=B.toUpperCase()){n=A.getElementsByTagName(B).item(0);}if(!n){return '';}if(C===false){return n;}if(C=='html'){return n.innerHTML;}if(C=='style'){return n.style[D];}return n.hasAttribute(C)?n.getAttribute(C):'';
1992 },toObject:function(){return {};},readElement:function(A){}};
1993 // Roo/htmleditor/BlockFigure.js
1994 Roo.htmleditor.BlockFigure=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);};Roo.extend(Roo.htmleditor.BlockFigure,Roo.htmleditor.Block,{image_src:'',align:'center',caption:'',caption_display:'block',width:'100%',cls:'',href:'',video_url:'',text_align:'left',friendly_name:'Image with caption',deleteTitle:"Delete Image and Caption",contextMenu:function(A){var B=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode);
1995 };var C=typeof(Roo.bootstrap)=='undefined'?Roo:Roo.bootstrap;var D=A.editorcore.syncValue;var E={};return [{xtype:'TextItem',text:"Source: ",xns:C.Toolbar},{xtype:'Button',text:'Change Image URL',listeners:{click:function(F,G){var b=B();Roo.MessageBox.show({title:"Image Source URL",msg:"Enter the url for the image",buttons:Roo.MessageBox.OKCANCEL,fn:function(H,I){if(H!='ok'){return;
1996 }b.image_src=I;b.updateElement();D();A.editorcore.onEditorEvent();},minWidth:250,prompt:true,modal:true,value:b.image_src});}},xns:C.Toolbar},{xtype:'Button',text:'Change Link URL',listeners:{click:function(F,G){var b=B();Roo.MessageBox.show({title:"Link URL",msg:"Enter the url for the link - leave blank to have no link",buttons:Roo.MessageBox.OKCANCEL,fn:function(H,I){if(H!='ok'){return;
1997 }b.href=I;b.updateElement();D();A.editorcore.onEditorEvent();},minWidth:250,prompt:true,modal:true,value:b.href});}},xns:C.Toolbar},{xtype:'Button',text:'Show Video URL',listeners:{click:function(F,G){Roo.MessageBox.alert("Video URL",B().video_url==''?'This image is not linked ot a video':'The image is linked to: <a target="_new" href="'+B().video_url+'">'+B().video_url+'</a>');
1998 }},xns:C.Toolbar},{xtype:'TextItem',text:"Width: ",xns:C.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:70,name:'width',listeners:{select:function(F,r,G){A.editorcore.selectNode(A.tb.selectedNode);
1999 var b=B();b.width=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['100%'],['80%'],['50%'],['20%'],['10%']],fields:['val'],xns:Roo.data}},{xtype:'TextItem',text:"Align: ",xns:C.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:70,name:'align',listeners:{select:function(F,r,G){A.editorcore.selectNode(A.tb.selectedNode);
2000 var b=B();b.align=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['left'],['right'],['center']],fields:['val'],xns:Roo.data}},{xtype:'Button',text:'Hide Caption',name:'caption_display',pressed:false,enableToggle:true,setValue:function(v){this.setText(v?"Hide Caption":"Show Caption");
2001 this.setPressed(v!='block');},listeners:{toggle:function(F,G){var b=B();b.caption_display=b.caption_display=='block'?'none':'block';this.setText(b.caption_display=='block'?"Hide Caption":"Show Caption");b.updateElement();D();A.editorcore.selectNode(A.tb.selectedNode);
2002 A.editorcore.onEditorEvent();}},xns:C.Toolbar}];},toObject:function(){var d=document.createElement('div');d.innerHTML=this.caption;var m=this.width!='100%'&&this.align=='center'?'0 auto':0;var iw=this.align=='center'?this.width:'100%';var A={tag:'img',contenteditable:'false',src:this.image_src,alt:d.innerText.replace(/\n/g," ").replace(/\s+/g,' ').trim(),style:{width:iw,maxWidth:iw+' !important',margin:m}
2003 };if(this.href.length>0){A={tag:'a',href:this.href,contenteditable:'true',cn:[A]};}if(this.video_url.length>0){A={tag:'div',cls:this.cls,frameborder:0,allowfullscreen:true,width:420,height:315,src:this.video_url,cn:[A]};}var B=this.caption_display=='none'?'':(this.caption.length?this.caption:"Caption");
2004 var C={tag:'figure','data-block':'Figure','data-width':this.width,contenteditable:'false',style:{display:'block',float:this.align,maxWidth:this.align=='center'?'100% !important':(this.width+' !important'),width:this.align=='center'?'100%':this.width,margin:'0px',padding:this.align=='center'?'0':'0 10px',textAlign:this.align}
2005 ,align:this.align,cn:[A,{tag:'figcaption','data-display':this.caption_display,style:{textAlign:'left',fontSize:'16px',lineHeight:'24px',display:this.caption_display,maxWidth:(this.align=='center'?this.width:'100%')+' !important',margin:m,width:this.align=='center'?this.width:'100%'}
2006 ,cls:this.cls.length>0?(this.cls+'-thumbnail'):'',cn:[{tag:'div',style:{marginTop:'16px',textAlign:'left'},align:'left',cn:[{tag:'i',contenteditable:true,html:B}]}]}]};return C;},readElement:function(A){this.video_url=this.getVal(A,'div','src');this.cls=this.getVal(A,'div','class');
2007 this.href=this.getVal(A,'a','href');this.image_src=this.getVal(A,'img','src');this.align=this.getVal(A,'figure','align');var B=this.getVal(A,'figcaption',false);if(B!==''){this.caption=this.getVal(B,'i','html');}this.caption_display=this.getVal(A,'figcaption','data-display');
2008 this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}})
2009 // Roo/htmleditor/BlockTable.js
2010 Roo.htmleditor.BlockTable=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);if(!A.node){this.rows=[];for(var r=0;r<this.no_row;r++){this.rows[r]=[];for(var c=0;c<this.no_col;c++){this.rows[r][c]=this.emptyCell();
2011 }}}};Roo.extend(Roo.htmleditor.BlockTable,Roo.htmleditor.Block,{rows:false,no_col:1,no_row:1,width:'100%',friendly_name:'Table',deleteTitle:'Delete Table',contextMenu:function(A){var B=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode);};var C=typeof(Roo.bootstrap)=='undefined'?Roo:Roo.bootstrap;
2012 var D=A.editorcore.syncValue;var E={};return [{xtype:'TextItem',text:"Width: ",xns:C.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:100,name:'width',listeners:{select:function(F,r,G){A.editorcore.selectNode(A.tb.selectedNode);
2013 var b=B();b.width=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['100%'],['auto']],fields:['val'],xns:Roo.data}},{xtype:'TextItem',text:"Columns: ",xns:C.Toolbar},{xtype:'Button',text:'-',listeners:{click:function(F,e){A.editorcore.selectNode(A.tb.selectedNode);
2014 B().removeColumn();D();A.editorcore.onEditorEvent();}},xns:C.Toolbar},{xtype:'Button',text:'+',listeners:{click:function(F,e){A.editorcore.selectNode(A.tb.selectedNode);B().addColumn();D();A.editorcore.onEditorEvent();}},xns:C.Toolbar},{xtype:'TextItem',text:"Rows: ",xns:C.Toolbar}
2015 ,{xtype:'Button',text:'-',listeners:{click:function(F,e){A.editorcore.selectNode(A.tb.selectedNode);B().removeRow();D();A.editorcore.onEditorEvent();}},xns:C.Toolbar},{xtype:'Button',text:'+',listeners:{click:function(F,e){B().addRow();D();A.editorcore.onEditorEvent();
2016 }},xns:C.Toolbar},{xtype:'Button',text:'Reset Column Widths',listeners:{click:function(F,e){B().resetWidths();D();A.editorcore.onEditorEvent();}},xns:C.Toolbar}];},toObject:function(){var A={tag:'table',contenteditable:'false','data-block':'Table',style:{width:this.width,border:'solid 1px #000','border-collapse':'collapse'}
2017 ,cn:[{tag:'tbody',cn:[]}]};var B=0;Roo.each(this.rows,function(C){var tr={tag:'tr',style:{margin:'6px',border:'solid 1px #000',textAlign:'left'},cn:[]};A.cn[0].cn.push(tr);var nc=0;Roo.each(C,function(D){var td={tag:'td',contenteditable:'true','data-block':'Td',html:D.html,style:D.style}
2018 ;if(D.colspan>1){td.colspan=D.colspan;nc+=D.colspan;}else{nc++;}if(D.rowspan>1){td.rowspan=D.rowspan;}tr.cn.push(td);},this);B=Math.max(nc,B);},this);B++;return A;},readElement:function(A){A=A?A:this.node;this.width=this.getVal(A,true,'style','width')||'100%';
2019 this.rows=[];this.no_row=0;var B=Array.from(A.rows);B.forEach(function(tr){var C=[];this.rows.push(C);this.no_row++;var D=0;Array.from(tr.cells).forEach(function(td){var E={colspan:td.hasAttribute('colspan')?td.getAttribute('colspan')*1:1,rowspan:td.hasAttribute('rowspan')?td.getAttribute('rowspan')*1:1,style:td.hasAttribute('style')?td.getAttribute('style'):'',html:td.innerHTML}
2020 ;D+=E.colspan;C.push(E);},this);this.no_col=Math.max(this.no_col,D);},this);},normalizeRows:function(){var A=[];var B=-1;this.rows.forEach(function(C){B++;A[B]=[];C=this.normalizeRow(C);var D=0;C.forEach(function(c){while(typeof(A[B][D])!='undefined'){D++;
2021 }if(typeof(A[B])=='undefined'){A[B]=[];}A[B][D]=c;c.row=B;c.col=D;if(c.rowspan<2){return;}for(var i=1;i<c.rowspan;i++){if(typeof(A[B+i])=='undefined'){A[B+i]=[];}A[B+i][D]=c;}});},this);return A;},normalizeRow:function(A){var B=[];A.forEach(function(c){if(c.colspan<2){B.push(c);
2022 return;}for(var i=0;i<c.colspan;i++){B.push(c);}});return B;},deleteColumn:function(A){if(!A||A.type!='col'){return;}if(this.no_col<2){return;}this.rows.forEach(function(B){var C=this.normalizeRow(B);var D=C[A.col];if(D.colspan>1){D.colspan--;}else{B.remove(D);
2023 }},this);this.no_col--;},removeColumn:function(){this.deleteColumn({type:'col',col:this.no_col-1});this.updateElement();},addColumn:function(){this.rows.forEach(function(A){A.push(this.emptyCell());},this);this.updateElement();},deleteRow:function(A){if(!A||A.type!='row'){return;
2024 }if(this.no_row<2){return;}var B=this.normalizeRows();B[A.row].forEach(function(D){if(D.rowspan>1){D.rowspan--;}else{D.remove=1;}},this);var C=[];this.rows.forEach(function(D){newrow=[];D.forEach(function(c){if(typeof(c.remove)=='undefined'){newrow.push(c);
2025 }});if(newrow.length>0){C.push(D);}});this.rows=C;this.no_row--;this.updateElement();},removeRow:function(){this.deleteRow({type:'row',row:this.no_row-1});},addRow:function(){var A=[];for(var i=0;i<this.no_col;i++){A.push(this.emptyCell());}this.rows.push(A);
2026 this.updateElement();},emptyCell:function(){return (new Roo.htmleditor.BlockTd({})).toObject();},removeNode:function(){return this.node;},resetWidths:function(){Array.from(this.node.getElementsByTagName('td')).forEach(function(n){var nn=Roo.htmleditor.Block.factory(n);
2027 nn.width='';nn.updateElement(n);});}})
2028 // Roo/htmleditor/BlockTd.js
2029 Roo.htmleditor.BlockTd=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);};Roo.extend(Roo.htmleditor.BlockTd,Roo.htmleditor.Block,{node:false,width:'',textAlign:'left',valign:'top',colspan:1,rowspan:1,friendly_name:'Table Cell',deleteTitle:false,contextMenu:function(A){var B=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode);
2030 };var C=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode.closest('table'));};var lr=false;var D=function(){lr=A.editorcore.getSelection().getRangeAt(0);};var restoreSel=function(){if(lr){(function(){A.editorcore.focus();var cr=A.editorcore.getSelection();
2031 cr.removeAllRanges();cr.addRange(lr);A.editorcore.onEditorEvent();}).defer(10,this);}};var rooui=typeof(Roo.bootstrap)=='undefined'?Roo:Roo.bootstrap;var E=A.editorcore.syncValue;var F={};return [{xtype:'Button',text:'Edit Table',listeners:{click:function(){var t=A.tb.selectedNode.closest('table');
2032 A.editorcore.selectNode(t);A.editorcore.onEditorEvent();}}},{xtype:'TextItem',text:"Column Width: ",xns:rooui.Toolbar},{xtype:'Button',text:'-',listeners:{click:function(G,e){A.editorcore.selectNode(A.tb.selectedNode);B().shrinkColumn();E();A.editorcore.onEditorEvent();
2033 }},xns:rooui.Toolbar},{xtype:'Button',text:'+',listeners:{click:function(G,e){A.editorcore.selectNode(A.tb.selectedNode);B().growColumn();E();A.editorcore.onEditorEvent();}},xns:rooui.Toolbar},{xtype:'TextItem',text:"Vertical Align: ",xns:rooui.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:100,name:'valign',listeners:{select:function(G,r,H){A.editorcore.selectNode(A.tb.selectedNode);
2034 var b=B();b.valign=r.get('val');b.updateElement();E();A.editorcore.onEditorEvent();}},xns:rooui.form,store:{xtype:'SimpleStore',data:[['top'],['middle'],['bottom']],fields:['val'],xns:Roo.data}},{xtype:'TextItem',text:"Merge Cells: ",xns:rooui.Toolbar},{xtype:'Button',text:'Right',listeners:{click:function(G,e){A.editorcore.selectNode(A.tb.selectedNode);
2035 B().mergeRight();E();A.editorcore.onEditorEvent();}},xns:rooui.Toolbar},{xtype:'Button',text:'Below',listeners:{click:function(G,e){A.editorcore.selectNode(A.tb.selectedNode);B().mergeBelow();E();A.editorcore.onEditorEvent();}},xns:rooui.Toolbar},{xtype:'TextItem',text:"| ",xns:rooui.Toolbar}
2036 ,{xtype:'Button',text:'Split',listeners:{click:function(G,e){B().split();E();A.editorcore.selectNode(A.tb.selectedNode);A.editorcore.onEditorEvent();}},xns:rooui.Toolbar},{xtype:'Fill',xns:rooui.Toolbar},{xtype:'Button',text:'Delete',xns:rooui.Toolbar,menu:{xtype:'Menu',xns:rooui.menu,items:[{xtype:'Item',html:'Column',listeners:{click:function(G,e){var t=C();
2037 B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEvent();}},xns:rooui.menu},{xtype:'Item',html:'Row',listeners:{click:function(G,e){var t=C();B().deleteRow();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEvent();}},xns:rooui.menu}
2038 ,{xtype:'Separator',xns:rooui.menu},{xtype:'Item',html:'Table',listeners:{click:function(G,e){var t=C();var nn=t.node.nextSibling||t.node.previousSibling;t.node.parentNode.removeChild(t.node);if(nn){A.editorcore.selectNode(nn,true);}A.editorcore.onEditorEvent();
2039 }},xns:rooui.menu}]}}];},toObject:function(){var A={tag:'td',contenteditable:'true','data-block':'Td',valign:this.valign,style:{'text-align':this.textAlign,border:'solid 1px rgb(0, 0, 0)','border-collapse':'collapse',padding:'6px','vertical-align':this.valign}
2040 ,html:this.html};if(this.width!=''){A.width=this.width;A.style.width=this.width;}if(this.colspan>1){A.colspan=this.colspan;}if(this.rowspan>1){A.rowspan=this.rowspan;}return A;},readElement:function(A){A=A?A:this.node;this.width=A.style.width;this.colspan=Math.max(1,1*A.getAttribute('colspan'));
2041 this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:"&nbsp;"};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[];
2042 var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan}
2043 ;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c;
2044 cn++;return;}for(var j=0;j<c.rowspan;j++){if(typeof(A[rn+j])=='undefined'){continue;}A[rn+j][cn]=c;for(var i=0;i<c.colspan;i++){A[rn+j][cn+i]=c;}}cn+=c.colspan;},this);rn++;},this);if(C){this.colWidths[0]=false;}return A;},mergeRight:function(){var tr=this.node.closest('tr');
2045 var i=Array.prototype.indexOf.call(tr.childNodes,this.node);if(i>=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan];
2046 if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray();
2047 if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;
2048 }this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray();
2049 var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r<cd.row+cd.rowspan;r++){for(var c=cd.col;c<cd.col+cd.colspan;c++){if(r==cd.row&&c==cd.col){this.node.removeAttribute('rowspan');this.node.removeAttribute('colspan');continue;}var B=this.node.cloneNode();
2050 B.removeAttribute('id');B.innerHTML='';A[r][c]={cell:B,col:c,row:r,colspan:1,rowspan:1};}}this.redrawAllCells(A);},redrawAllCells:function(A){var B=this.node.closest('tr').closest('table');var C=B.rows[0].parentNode;Array.from(B.rows).forEach(function(r,ri){Array.from(r.cells).forEach(function(ce,ci){ce.parentNode.removeChild(ce);
2051 });r.parentNode.removeChild(r);});for(var r=0;r<A.length;r++){var re=B.rows[r];var re=B.ownerDocument.createElement('tr');C.appendChild(re);for(var c=0;c<A[r].length;c++){if(A[r][c].cell===false){continue;}re.appendChild(A[r][c].cell);A[r][c].cell=false;}
2052 }},updateWidths:function(A){for(var r=0;r<A.length;r++){for(var c=0;c<A[r].length;c++){if(A[r][c].cell===false){continue;}if(this.colWidths[0]!=false&&A[r][c].colspan<2){var el=Roo.htmleditor.Block.factory(A[r][c].cell);el.width=Math.floor(this.colWidths[c])+'%';
2053 el.updateElement(el.node);}A[r][c].cell=false;}}},normalizeWidths:function(A){if(this.colWidths[0]===false){var nw=100.0/this.colWidths.length;this.colWidths.forEach(function(w,i){this.colWidths[i]=nw;},this);return;}var t=0,B=[];this.colWidths.forEach(function(w,i){this.colWidths[i]=this.colWidths[i]==''?0:(this.colWidths[i]+'').replace(/[^0-9]+/g,'')*1;
2054 var D=this.colWidths[i];if(D>0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew;
2055 },this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;
2056 return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);
2057 this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A);},deleteRow:function(){var A=this.toTableArray();for(var i=0;i<A[this.cellData.row].length;i++){var c=A[this.cellData.row][i];if(c.row!=this.cellData.row){c.rowspan--;
2058 c.cell.setAttribute('rowspan',c.rowspan);continue;}if(c.rowspan>1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan);}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i<A.length;i++){var c=A[i][this.cellData.col];
2059 if(c.col!=this.cellData.col){A[i][this.cellData.col].colspan--;}else if(c.colspan>1){c.colspan--;c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}})
2060 // Roo/HtmlEditorCore.js
2061 Roo.HtmlEditorCore=function(A){Roo.HtmlEditorCore.superclass.constructor.call(this,A);this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editorevent:true});this.applyBlacklists();};Roo.extend(Roo.HtmlEditorCore,Roo.Component,{owner:false,resizable:false,height:300,width:500,autoClean:true,enableBlocks:true,stylesheets:false,language:'en',allowComments:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',clearUp:true,black:false,white:false,bodyCls:'',undoManager:false,getDocMarkup:function(){var st='';
2062 if(this.stylesheets===false){Roo.get(document.head).select('style').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom);});Roo.get(document.head).select('link').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom);
2063 });}else if(!this.stylesheets.length){st='<style type="text/css">'+'body{border:0;margin:0;padding:3px;height:98%;cursor:text;}'+'</style>';}else{for(var i in this.stylesheets){if(typeof(this.stylesheets[i])!='string'){continue;}st+='<link rel="stylesheet" href="'+this.stylesheets[i]+'" type="text/css">';
2064 }}st+='<style type="text/css">'+'IMG { cursor: pointer } '+'</style>';st+='<meta name="google" content="notranslate">';var A='notranslate roo-htmleditor-body';if(this.bodyCls.length){A+=' '+this.bodyCls;}return '<html  class="notranslate" translate="no"><head>'+st+' </head><body contenteditable="true" data-enable-grammerly="true" class="'+A+'"></body></html>';
2065 },onRender:function(ct,A){var _t=this;this.el=this.owner.inputEl?this.owner.inputEl():this.owner.el;this.el.dom.style.border='0 none';this.el.dom.setAttribute('tabIndex',-1);this.el.addClass('x-hidden hide');if(Roo.isIE){this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')}
2066 this.frameId=Roo.id();var B=this.owner.wrap.createChild({tag:'iframe',cls:'form-control',id:this.frameId,name:this.frameId,frameBorder:'no','src':Roo.SSL_SECURE_URL?Roo.SSL_SECURE_URL:"javascript:false"},this.el);this.iframe=B.dom;this.assignDocWin();this.doc.designMode='on';
2067 this.doc.open();this.doc.write(this.getDocMarkup());this.doc.close();var C={run:function(){this.assignDocWin();if(this.doc.body||this.doc.readyState=='complete'){try{this.doc.designMode="on";}catch(e){return;}Roo.TaskMgr.stop(C);this.initEditor.defer(10,this);
2068 }},interval:10,duration:10000,scope:this};Roo.TaskMgr.start(C);},onResize:function(w,h){Roo.log('resize: '+w+','+h);if(!this.iframe){return;}if(typeof w=='number'){this.iframe.style.width=w+'px';}if(typeof h=='number'){this.iframe.style.height=h+'px';if(this.doc){(this.doc.body||this.doc.documentElement).style.height=(h-(this.iframePad*2))+'px';
2069 }}},toggleSourceEdit:function(A){this.sourceEditMode=A===true;if(this.sourceEditMode){Roo.get(this.iframe).addClass(['x-hidden','hide','d-none']);}else{Roo.get(this.iframe).removeClass(['x-hidden','hide','d-none']);this.deferFocus();}},cleanHtml:function(A){A=String(A);
2070 if(A.length>5){if(Roo.isSafari){A=A.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi,'');}}if(A=='&nbsp;'){A='';}return A;},syncValue:function(){if(this.initialized){if(this.undoManager){this.undoManager.addEvent();}var bd=(this.doc.body||this.doc.documentElement);
2071 var A=this.win.getSelection();var B=document.createElement('div');B.innerHTML=bd.innerHTML;var C=B.getElementsByClassName('gtx-trans-icon');if(C.length>0){var rm=C.item(0).parentNode;rm.parentNode.removeChild(rm);}if(this.enableBlocks){new Roo.htmleditor.FilterBlock({node:B}
2072 );}var D=new Roo.htmleditor.TidySerializer({inner:true});var E=D.serialize(B);if(Roo.isSafari){var bs=bd.getAttribute('style');var m=bs?bs.match(/text-align:(.*?);/i):false;if(m&&m[1]){E='<div style="'+m[0]+'">'+E+'</div>';}}E=this.cleanHtml(E);E=E.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[\u0080-\uFFFF]/g,function(F){var cc=F.charCodeAt();
2073 if(F.length==2){var G=F.charCodeAt(0)-0xD800;var H=F.charCodeAt(1)-0xDC00;cc=(G*0x400)+H+0x10000;}else if((cc>=0x4E00&&cc<0xA000)||(cc>=0x3400&&cc<0x4E00)||(cc>=0xf900&&cc<0xfb00)){return F;}return "&#"+cc+";";});if(this.owner.fireEvent('beforesync',this,E)!==false){this.el.dom.value=E;
2074 this.owner.fireEvent('sync',this,E);}}},pushValue:function(){if(this.initialized){var v=this.el.dom.value.trim();if(this.owner.fireEvent('beforepush',this,v)!==false){var d=(this.doc.body||this.doc.documentElement);d.innerHTML=v;this.el.dom.value=d.innerHTML;
2075 this.owner.fireEvent('push',this,v);}if(this.autoClean){new Roo.htmleditor.FilterParagraph({node:this.doc.body});new Roo.htmleditor.FilterSpan({node:this.doc.body});}if(this.enableBlocks){Roo.htmleditor.Block.initAll(this.doc.body);}this.updateLanguage();
2076 var lc=this.doc.body.lastChild;if(lc&&lc.nodeType==1&&lc.getAttribute("contenteditable")=="false"){this.doc.body.appendChild(this.doc.createElement('br'));}}},deferFocus:function(){this.focus.defer(10,this);},focus:function(){if(this.win&&!this.sourceEditMode){this.win.focus();
2077 }else{this.el.focus();}},assignDocWin:function(){var A=this.iframe;if(Roo.isIE){this.doc=A.contentWindow.document;this.win=A.contentWindow;}else{if(!Roo.get(this.frameId)&&!A.contentDocument){return;}this.doc=(A.contentDocument||Roo.get(this.frameId).dom.document);
2078 this.win=(A.contentWindow||Roo.get(this.frameId).dom.contentWindow);}},initEditor:function(){this.assignDocWin();this.doc.designMode="on";this.doc.open();this.doc.write(this.getDocMarkup());this.doc.close();var A=(this.doc.body||this.doc.documentElement);
2079 A.bgProperties='fixed';A.setAttribute("translate","no");Roo.EventManager.on(this.doc,{'mouseup':this.onEditorEvent,'dblclick':this.onEditorEvent,'click':this.onEditorEvent,'keyup':this.onEditorEvent,buffer:100,scope:this});Roo.EventManager.on(this.doc,{'paste':this.onPasteEvent,scope:this}
2080 );if(Roo.isGecko){Roo.EventManager.on(this.doc,'keypress',this.mozKeyPress,this);}if(Roo.isIE||Roo.isSafari||Roo.isOpera){Roo.EventManager.on(this.doc,'keydown',this.fixKeys,this);}this.initialized=true;new Roo.htmleditor.KeyEnter({core:this});this.owner.fireEvent('initialize',this);
2081 this.pushValue();},onPasteEvent:function(e,v){var cd=(e.browserEvent.clipboardData||window.clipboardData);if(cd.files&&cd.files.length>0){var A=(window.createObjectURL&&window)||(window.URL&&URL.revokeObjectURL&&URL)||(window.webkitURL&&webkitURL);var B=A.createObjectURL(cd.files[0]);
2082 this.insertAtCursor('<img src=" + url + ">');return false;}if(cd.types.indexOf('text/html')<0){return false;}var C=[];var D=cd.getData('text/html');if(cd.types.indexOf('text/rtf')>-1){var E=new Roo.rtf.Parser(cd.getData('text/rtf'));C=E.doc?E.doc.getElementsByType('pict'):[];
2083 }C=C.filter(function(g){return !g.path.match(/^rtf\/(head|pgdsctbl|listtable|footerf)/);}).map(function(g){return g.toDataURL();}).filter(function(g){return g!='about:blank';});D=this.cleanWordChars(D);var d=(new DOMParser().parseFromString(D,'text/html')).body;
2084 var sn=this.getParentElement();if(d.getElementsByTagName('table').length&&sn&&sn.closest('table')){e.preventDefault();this.insertAtCursor("You can not nest tables");return false;}if(C.length>0){Roo.each(d.getElementsByTagName('img'),function(F,i){F.setAttribute('src',C[i]);
2085 });}if(this.autoClean){new Roo.htmleditor.FilterWord({node:d});new Roo.htmleditor.FilterStyleToTag({node:d});new Roo.htmleditor.FilterAttributes({node:d,attrib_white:['href','src','name','align','colspan','rowspan','data-display','data-width'],attrib_clean:['href','src']}
2086 );new Roo.htmleditor.FilterBlack({node:d,tag:this.black});new Roo.htmleditor.FilterKeepChildren({node:d,tag:['FONT',':']});new Roo.htmleditor.FilterParagraph({node:d});new Roo.htmleditor.FilterSpan({node:d});new Roo.htmleditor.FilterLongBr({node:d});new Roo.htmleditor.FilterComment({node:d}
2087 );}if(this.enableBlocks){Array.from(d.getElementsByTagName('img')).forEach(function(F){if(F.closest('figure')){return;}var G=new Roo.htmleditor.BlockFigure({image_src:F.src});G.updateElement(F);});}this.insertAtCursor(d.innerHTML.replace(/&nbsp;/g,' '));if(this.enableBlocks){Roo.htmleditor.Block.initAll(this.doc.body);
2088 }e.preventDefault();return false;},onDestroy:function(){if(this.rendered){}},onFirstFocus:function(){this.assignDocWin();this.undoManager=new Roo.lib.UndoManager(100,(this.doc.body||this.doc.documentElement));this.activated=true;if(Roo.isGecko){this.win.focus();
2089 var s=this.win.getSelection();if(!s.focusNode||s.focusNode.nodeType!=3){var r=s.getRangeAt(0);r.selectNodeContents((this.doc.body||this.doc.documentElement));r.collapse(true);this.deferFocus();}try{this.execCmd('useCSS',true);this.execCmd('styleWithCSS',false);
2090 }catch(e){}}this.owner.fireEvent('activate',this);},adjustFont:function(A){var B=A.cmd=='increasefontsize'?1:-1;var v=parseInt(this.doc.queryCommandValue('FontSize')||3,10);if(Roo.isSafari){var sm={10:1,13:2,16:3,18:4,24:5,32:6,48:7};v=(v<10)?10:v;v=(v>48)?48:v;
2091 v=typeof(sm[v])=='undefined'?1:sm[v];}v=Math.max(1,v+B);this.execCmd('FontSize',v);},onEditorEvent:function(e){if(e&&(e.ctrlKey||e.metaKey)&&e.keyCode===90){return;}if(e&&e.target.nodeName=='BODY'&&e.type=="mouseup"&&this.doc.body.lastChild){var lc=this.doc.body.lastChild;
2092 while((lc.nodeType==3&&lc.nodeValue=='')||lc.id=='gtx-trans'){lc=lc.previousSibling;}if(lc.nodeType==1&&lc.nodeName!='BR'){var ns=this.doc.createElement('br');this.doc.body.appendChild(ns);range=this.doc.createRange();range.setStartAfter(ns);range.collapse(true);
2093 var A=this.win.getSelection();A.removeAllRanges();A.addRange(range);}}this.fireEditorEvent(e);this.syncValue();},fireEditorEvent:function(e){this.owner.fireEvent('editorevent',this,e);},insertTag:function(tg){if(tg.toLowerCase()=='span'||tg.toLowerCase()=='code'||tg.toLowerCase()=='sup'||tg.toLowerCase()=='sub'){range=this.createRange(this.getSelection());
2094 var A=this.doc.createElement(tg.toLowerCase());A.appendChild(range.extractContents());range.insertNode(A);return;}this.execCmd("formatblock",tg);this.undoManager.addEvent();},insertText:function(A){var B=this.createRange();B.deleteContents();B.insertNode(this.doc.createTextNode(A));
2095 this.undoManager.addEvent();},relayCmd:function(A,B){switch(A){case 'justifyleft':case 'justifyright':case 'justifycenter':var n=this.getParentElement();var td=n.closest('td');if(td){var bl=Roo.htmleditor.Block.factory(td);bl.textAlign=A.replace('justify','');
2096 bl.updateElement();this.owner.fireEvent('editorevent',this);return;}this.execCmd('styleWithCSS',true);break;case 'bold':case 'italic':this.execCmd('styleWithCSS',false);break;default:break;}this.win.focus();this.execCmd(A,B);this.owner.fireEvent('editorevent',this);
2097 this.owner.deferFocus();},execCmd:function(A,B){this.doc.execCommand(A,false,B===undefined?null:B);this.syncValue();},insertAtCursor:function(A){if(!this.activated){return;}if(Roo.isGecko||Roo.isOpera||Roo.isSafari){this.win.focus();var B,C;var D=this.win;
2098 if(D.getSelection&&D.getSelection().getRangeAt){this.createRange(this.getSelection()).deleteContents();B=D.getSelection().getRangeAt(0);C=typeof(A)=='string'?B.createContextualFragment(A):A;B.insertNode(C);B=B.cloneRange();B.collapse(false);D.getSelection().removeAllRanges();
2099 D.getSelection().addRange(B);}else if(D.document.selection&&D.document.selection.createRange){var E=typeof(A)=='string'?A:A.outerHTML;D.document.selection.createRange().pasteHTML(E);}else{var E=typeof(A)=='string'?A:A.outerHTML;this.execCmd('InsertHTML',E);
2100 }this.syncValue();this.deferFocus();}},mozKeyPress:function(e){if(e.ctrlKey){var c=e.getCharCode(),A;if(c>0){c=String.fromCharCode(c).toLowerCase();switch(c){case 'b':A='bold';break;case 'i':A='italic';break;case 'u':A='underline';break;}if(A){this.relayCmd(A);
2101 e.preventDefault();}}}},fixKeys:function(){if(Roo.isIE){return function(e){var k=e.getKey(),r;if(k==e.TAB){e.stopEvent();r=this.doc.selection.createRange();if(r){r.collapse(true);r.pasteHTML('&#160;&#160;&#160;&#160;');this.deferFocus();}return;}};}else if(Roo.isOpera){return function(e){var k=e.getKey();
2102 if(k==e.TAB){e.stopEvent();this.win.focus();this.execCmd('InsertHTML','&#160;&#160;&#160;&#160;');this.deferFocus();}};}else if(Roo.isSafari){return function(e){var k=e.getKey();if(k==e.TAB){e.stopEvent();this.execCmd('InsertText','\t');this.deferFocus();
2103 return;}this.mozKeyPress(e);};}}(),getAllAncestors:function(){var p=this.getSelectedNode();var a=[];if(!p){a.push(p);p=this.getParentElement();}while(p&&(p.nodeType==1)&&(p.tagName.toLowerCase()!='body')){a.push(p);p=p.parentNode;}a.push(this.doc.body);return a;
2104 },lastSel:false,lastSelNode:false,getSelection:function(){this.assignDocWin();return Roo.lib.Selection.wrap(Roo.isIE?this.doc.selection:this.win.getSelection(),this.doc);},selectNode:function(A,B){var C=A.ownerDocument.createRange();try{C.selectNode(A);}catch(e){C.selectNodeContents(A);
2105 }if(B===true){C.collapse(true);}var s=this.win.getSelection();s.removeAllRanges();s.addRange(C);},getSelectedNode:function(){var A=this.createRange(this.getSelection()).cloneRange();if(Roo.isIE){var B=A.parentElement();while(true){var C=A.duplicate();C.moveToElementText(B);
2106 if(C.inRange(A)){break;}if((B.nodeType!=1)||(B.tagName.toLowerCase()=='body')){break;}B=B.parentElement;}return B;}var ac=A.commonAncestorContainer;if(ac.nodeType==3){ac=ac.parentNode;}var ar=ac.childNodes;var D=[];var E=[];var F=false;for(var i=0;i<ar.length;
2107 i++){if((ar[i].nodeType==3)&&(!ar[i].data.length)){continue;}if(this.rangeIntersectsNode(A,ar[i])&&this.rangeCompareNode(A,ar[i])==3){D.push(ar[i]);continue;}if((ar[i].nodeType==1)&&this.rangeIntersectsNode(A,ar[i])&&(this.rangeCompareNode(A,ar[i])>0)){E.push(ar[i]);
2108 continue;}if(!this.rangeIntersectsNode(A,ar[i])||(this.rangeCompareNode(A,ar[i])==0)){continue;}F=true;}if(!D.length&&E.length){D=E;}if(F||!D.length||(D.length>1)){return false;}return D[0];},createRange:function(A){if(typeof A!="undefined"){try{return A.getRangeAt?A.getRangeAt(0):A.createRange();
2109 }catch(e){return this.doc.createRange();}}else{return this.doc.createRange();}},getParentElement:function(){this.assignDocWin();var A=Roo.isIE?this.doc.selection:this.win.getSelection();var B=this.createRange(A);try{var p=B.commonAncestorContainer;while(p.nodeType==3){p=p.parentNode;
2110 }return p;}catch(e){return null;}},rangeIntersectsNode:function(A,B){var C=B.ownerDocument.createRange();try{C.selectNode(B);}catch(e){C.selectNodeContents(B);}var D=A.cloneRange();D.collapse(true);var E=A.cloneRange();E.collapse(false);var F=C.cloneRange();
2111 F.collapse(true);var G=C.cloneRange();G.collapse(false);return D.compareBoundaryPoints(Range.START_TO_START,G)==-1&&E.compareBoundaryPoints(Range.START_TO_START,F)==1;},rangeCompareNode:function(A,B){var C=B.ownerDocument.createRange();try{C.selectNode(B);
2112 }catch(e){C.selectNodeContents(B);}A.collapse(true);C.collapse(true);var ss=A.compareBoundaryPoints(Range.START_TO_START,C);var ee=A.compareBoundaryPoints(Range.END_TO_END,C);var D=ss==1;var E=ee==-1;if(D&&E){return 0;}if(!D&&E){return 1;}if(D&&!E){return 2;
2113 }return 3;},cleanWordChars:function(A){var B=[[8211,"&#8211;"],[8212,"&#8212;"],[8216,"'"],[8217,"'"],[8220,'"'],[8221,'"'],[8226,"*"],[8230,"..."]];var C=A;Roo.each(B,function(sw){var D=new RegExp("\\u"+sw[0].toString(16),"g");C=C.replace(D,sw[1]);});return C;
2114 },cleanUpChild:function(A){new Roo.htmleditor.FilterComment({node:A});new Roo.htmleditor.FilterAttributes({node:A,attrib_black:this.ablack,attrib_clean:this.aclean,style_white:this.cwhite,style_black:this.cblack});new Roo.htmleditor.FilterBlack({node:A,tag:this.black}
2115 );new Roo.htmleditor.FilterKeepChildren({node:A,tag:this.tag_remove});},cleanWord:function(A){new Roo.htmleditor.FilterWord({node:A?A:this.doc.body});new Roo.htmleditor.FilterKeepChildren({node:A?A:this.doc.body,tag:['FONT',':']});},cleanTableWidths:function(A){new Roo.htmleditor.FilterTableWidth({node:A?A:this.doc.body}
2116 );},applyBlacklists:function(){var w=typeof(this.owner.white)!='undefined'&&this.owner.white?this.owner.white:[];var b=typeof(this.owner.black)!='undefined'&&this.owner.black?this.owner.black:[];this.aclean=typeof(this.owner.aclean)!='undefined'&&this.owner.aclean?this.owner.aclean:Roo.HtmlEditorCore.aclean;
2117 this.ablack=typeof(this.owner.ablack)!='undefined'&&this.owner.ablack?this.owner.ablack:Roo.HtmlEditorCore.ablack;this.tag_remove=typeof(this.owner.tag_remove)!='undefined'&&this.owner.tag_remove?this.owner.tag_remove:Roo.HtmlEditorCore.tag_remove;this.white=[];
2118 this.black=[];Roo.each(Roo.HtmlEditorCore.white,function(A){if(b.indexOf(A)>-1){return;}this.white.push(A);},this);Roo.each(w,function(A){if(b.indexOf(A)>-1){return;}if(this.white.indexOf(A)>-1){return;}this.white.push(A);},this);Roo.each(Roo.HtmlEditorCore.black,function(A){if(w.indexOf(A)>-1){return;
2119 }this.black.push(A);},this);Roo.each(b,function(A){if(w.indexOf(A)>-1){return;}if(this.black.indexOf(A)>-1){return;}this.black.push(A);},this);w=typeof(this.owner.cwhite)!='undefined'&&this.owner.cwhite?this.owner.cwhite:[];b=typeof(this.owner.cblack)!='undefined'&&this.owner.cblack?this.owner.cblack:[];
2120 this.cwhite=[];this.cblack=[];Roo.each(Roo.HtmlEditorCore.cwhite,function(A){if(b.indexOf(A)>-1){return;}this.cwhite.push(A);},this);Roo.each(w,function(A){if(b.indexOf(A)>-1){return;}if(this.cwhite.indexOf(A)>-1){return;}this.cwhite.push(A);},this);Roo.each(Roo.HtmlEditorCore.cblack,function(A){if(w.indexOf(A)>-1){return;
2121 }this.cblack.push(A);},this);Roo.each(b,function(A){if(w.indexOf(A)>-1){return;}if(this.cblack.indexOf(A)>-1){return;}this.cblack.push(A);},this);},setStylesheets:function(A){if(typeof(A)=='string'){Roo.get(this.iframe.contentDocument.head).createChild({tag:'link',rel:'stylesheet',type:'text/css',href:A}
2122 );return;}var B=this;Roo.each(A,function(s){if(!s.length){return;}Roo.get(B.iframe.contentDocument.head).createChild({tag:'link',rel:'stylesheet',type:'text/css',href:s});});},updateLanguage:function(){if(!this.iframe||!this.iframe.contentDocument){return;
2123 }Roo.get(this.iframe.contentDocument.body).attr("lang",this.language);},removeStylesheets:function(){var A=this;Roo.each(Roo.get(A.iframe.contentDocument.head).select('link[rel=stylesheet]',true).elements,function(s){s.remove();});},setStyle:function(A){Roo.get(this.iframe.contentDocument.head).createChild({tag:'style',type:'text/css',html:A}
2124 );return;}});Roo.HtmlEditorCore.white=['AREA','BR','IMG','INPUT','HR','WBR','ADDRESS','BLOCKQUOTE','CENTER','DD','DIR','DIV','DL','DT','H1','H2','H3','H4','H5','H6','HR','ISINDEX','LISTING','MARQUEE','MENU','MULTICOL','OL','P','PLAINTEXT','PRE','TABLE','UL','XMP','CAPTION','COL','COLGROUP','TBODY','TD','TFOOT','TH','THEAD','TR','DIR','MENU','OL','UL','DL','EMBED','OBJECT'];
2125 Roo.HtmlEditorCore.black=['APPLET','BASE','BASEFONT','BGSOUND','BLINK','BODY','FRAME','FRAMESET','HEAD','HTML','ILAYER','IFRAME','LAYER','LINK','META','OBJECT','SCRIPT','STYLE','TITLE','XML','COLGROUP','COL'];Roo.HtmlEditorCore.clean=['SCRIPT','STYLE','TITLE','XML'];
2126 Roo.HtmlEditorCore.tag_remove=['FONT','TBODY'];Roo.HtmlEditorCore.ablack=['on'];Roo.HtmlEditorCore.aclean=['action','background','codebase','dynsrc','href','lowsrc'];Roo.HtmlEditorCore.pwhite=['http','https','mailto'];Roo.HtmlEditorCore.cwhite=[];Roo.HtmlEditorCore.cblack=[];
2127
2128 // Roo/form/HtmlEditor.js
2129 Roo.form.HtmlEditor=function(A){Roo.form.HtmlEditor.superclass.constructor.call(this,A);if(!this.toolbars){this.toolbars=[];}this.editorcore=new Roo.HtmlEditorCore(Roo.apply({owner:this},A));};Roo.extend(Roo.form.HtmlEditor,Roo.form.Field,{clearUp:true,toolbars:false,resizable:false,height:300,width:500,stylesheets:false,cblack:false,cwhite:false,black:false,white:false,allowComments:false,enableBlocks:true,autoClean:true,bodyCls:'',language:'en',frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',actionMode:'container',defaultAutoCreate:{tag:"textarea",style:"width:500px;height:300px;",autocomplete:"new-password"}
2130 ,initComponent:function(){this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editmodechange:true,editorevent:true,firstfocus:true,autosave:true,savedpreview:true,stylesheetsclick:true,paste:true});this.defaultAutoCreate={tag:"textarea",style:'width: '+this.width+'px;height: '+this.height+'px;',autocomplete:"new-password"}
2131 ;},createToolbar:function(A){Roo.log("create toolbars");if(!A.toolbars||!A.toolbars.length){A.toolbars=[new Roo.form.HtmlEditor.ToolbarStandard()];}for(var i=0;i<A.toolbars.length;i++){A.toolbars[i]=Roo.factory(typeof(A.toolbars[i])=='string'?{xtype:A.toolbars[i]}
2132 :A.toolbars[i],Roo.form.HtmlEditor);A.toolbars[i].init(A);}},getSelectedNode:function(){if(this.toolbars.length<2||!this.toolbars[1].tb){return false;}return this.toolbars[1].tb.selectedNode;},onRender:function(ct,A){var _t=this;Roo.form.HtmlEditor.superclass.onRender.call(this,ct,A);
2133 this.wrap=this.el.wrap({cls:'x-html-editor-wrap',cn:{cls:'x-html-editor-tb'}});this.editorcore.onRender(ct,A);if(this.resizable){this.resizeEl=new Roo.Resizable(this.wrap,{pinned:true,wrap:true,dynamic:true,minHeight:this.height,height:this.height,handles:this.resizable,width:this.width,listeners:{resize:function(r,w,h){_t.onResize(w,h);
2134 }}});}this.createToolbar(this);if(!this.width){this.setSize(this.wrap.getSize());}if(this.resizeEl){this.resizeEl.resizeTo.defer(100,this.resizeEl,[this.width,this.height]);}this.keyNav=new Roo.KeyNav(this.el,{"tab":function(e){e.preventDefault();var B=this.getValue();
2135 var C=this.el.dom.selectionStart;var D=this.el.dom.selectionEnd;if(!e.shiftKey){this.setValue(B.substring(0,C)+"\t"+B.substring(D));this.el.dom.setSelectionRange(D+1,D+1);return;}var f=B.substring(0,C).split("\t");if(f.pop().length!=0){return;}this.setValue(f.join("\t")+B.substring(D));
2136 this.el.dom.setSelectionRange(C-1,C-1);},"home":function(e){e.preventDefault();var B=this.el.dom.selectionStart;var C=this.getValue().split("\n");if(!C.length){return;}if(e.ctrlKey){this.el.dom.setSelectionRange(0,0);return;}var D=0;for(var i=0;i<C.length;
2137 i++){D+=C[i].length;if(i!=0){D+=1;}if(D<B){continue;}D-=C[i].length;break;}if(!e.shiftKey){this.el.dom.setSelectionRange(D,D);return;}this.el.dom.selectionStart=D;this.el.dom.selectionEnd=B;},"end":function(e){e.preventDefault();var B=this.el.dom.selectionStart;
2138 var C=this.getValue().split("\n");if(!C.length){return;}if(e.ctrlKey){this.el.dom.setSelectionRange(this.getValue().length,this.getValue().length);return;}var D=0;for(var i=0;i<C.length;i++){D+=C[i].length;if(i!=0){D+=1;}if(D<B){continue;}break;}if(!e.shiftKey){this.el.dom.setSelectionRange(D,D);
2139 return;}this.el.dom.selectionStart=B;this.el.dom.selectionEnd=D;},scope:this,doRelay:function(B,C,D){return Roo.KeyNav.prototype.doRelay.apply(this,arguments);},forceKeyDown:true});},onResize:function(w,h){Roo.form.HtmlEditor.superclass.onResize.apply(this,arguments);
2140 var ew=false;var eh=false;if(this.el){if(typeof w=='number'){var aw=w-this.wrap.getFrameWidth('lr');this.el.setWidth(this.adjustWidth('textarea',aw));ew=aw;}if(typeof h=='number'){var A=0;for(var i=0;i<this.toolbars.length;i++){A+=this.toolbars[i].tb.el.getHeight();
2141 if(this.toolbars[i].footer){A+=this.toolbars[i].footer.el.getHeight();}}var ah=h-this.wrap.getFrameWidth('tb')-A;ah-=5;this.el.setHeight(this.adjustWidth('textarea',ah));var eh=ah;}}Roo.log('onResize:'+[w,h,ew,eh].join(','));this.editorcore.onResize(ew,eh);
2142 },toggleSourceEdit:function(A){this.editorcore.toggleSourceEdit(A);if(this.editorcore.sourceEditMode){Roo.log('editor - showing textarea');this.editorcore.syncValue();this.el.removeClass('x-hidden');this.el.dom.removeAttribute('tabIndex');this.el.focus();
2143 this.el.dom.scrollTop=0;for(var i=0;i<this.toolbars.length;i++){if(this.toolbars[i] instanceof Roo.form.HtmlEditor.ToolbarContext){this.toolbars[i].tb.hide();this.toolbars[i].footer.hide();}}}else{Roo.log('editor - hiding textarea');this.editorcore.pushValue();
2144 this.el.addClass('x-hidden');this.el.dom.setAttribute('tabIndex',-1);for(var i=0;i<this.toolbars.length;i++){if(this.toolbars[i] instanceof Roo.form.HtmlEditor.ToolbarContext){this.toolbars[i].tb.show();this.toolbars[i].footer.show();}}}this.setSize(this.wrap.getSize());
2145 this.onResize(this.wrap.getSize().width,this.wrap.getSize().height);this.fireEvent('editmodechange',this,this.editorcore.sourceEditMode);},adjustSize:Roo.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;
2146 },initEvents:function(){this.originalValue=this.getValue();},markInvalid:Roo.emptyFn,clearInvalid:Roo.emptyFn,setValue:function(v){Roo.form.HtmlEditor.superclass.setValue.call(this,v);this.editorcore.pushValue();},updateLanguage:function(A){this.language=A;
2147 this.editorcore.language=A;this.editorcore.updateLanguage();},deferFocus:function(){this.focus.defer(10,this);},focus:function(){this.editorcore.focus();},onDestroy:function(){if(this.rendered){for(var i=0;i<this.toolbars.length;i++){this.toolbars[i].onDestroy();
2148 }this.wrap.dom.innerHTML='';this.wrap.remove();}},onFirstFocus:function(){this.editorcore.onFirstFocus();for(var i=0;i<this.toolbars.length;i++){this.toolbars[i].onFirstFocus();}},syncValue:function(){this.editorcore.syncValue();},pushValue:function(){this.editorcore.pushValue();
2149 },setStylesheets:function(A){this.editorcore.setStylesheets(A);},removeStylesheets:function(){this.editorcore.removeStylesheets();}});
2150 // Roo/form/HtmlEditor/ToolbarStandard.js
2151 Roo.form.HtmlEditor.ToolbarStandard=function(A){Roo.apply(this,A);this.disable=this.disable||{};Roo.applyIf(this.disable,{fontSize:true,colors:true,specialElements:true});};Roo.form.HtmlEditor.ToolbarStandard.prototype={tb:false,rendered:false,editor:false,editorcore:false,disable:false,createLinkText:'Please enter the URL for the link:',defaultLinkValue:'http:/'+'/',fontFamilies:['Arial','Courier New','Tahoma','Times New Roman','Verdana'],specialChars:["&#169;","&#174;","&#8482;","&#163;","&#8230;","&#247;","&#8364;","&#176;"],specialElements:[{text:"Insert Table",xtype:'MenuItem',xns:Roo.Menu,ihtml:'<table><tr><td>Cell</td></tr></table>'}
2152 ,{text:"Insert Image",xtype:'MenuItem',xns:Roo.Menu,ihtml:'<img src="about:blank"/>'}],inputElements:["form","input:text","input:hidden","input:checkbox","input:radio","input:password","input:submit","input:button","select","textarea","label"],formats:[["p"],["h1"],["h2"],["h3"],["h4"],["h5"],["h6"],["pre"],["code"],["abbr"],["acronym"],["address"],["cite"],["samp"],["var"],['div'],['span'],['sup'],['sub']],cleanStyles:["font-size"],defaultFont:'tahoma',fontSelect:false,formatCombo:false,init:function(A){this.editor=A;
2153 this.editorcore=A.editorcore?A.editorcore:A;var B=this.editorcore;var _t=this;var C=B.frameId;var D=this;function btn(id,H,I){var J=C+'-'+id;return {id:J,cmd:id,cls:'x-btn-icon x-edit-'+id,enableToggle:H!==false,scope:_t,handler:I||_t.relayBtnCmd,clickEvent:'mousedown',tooltip:D.buttonTips[id]||undefined,tabIndex:-1}
2154 ;}var tb=new Roo.Toolbar(A.wrap.dom.firstChild);this.tb=tb;tb.el.on('click',function(e){e.preventDefault();});if(!this.disable.font){};if(!this.disable.formats){this.formatCombo=new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'tag',fields:['tag'],data:this.formats}
2155 ),blockFocus:true,name:'',displayField:'tag',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Add tag',selectOnFocus:true,width:135,listeners:{'select':function(c,r,i){B.insertTag(r.get('tag'));A.focus();}}});tb.addField(this.formatCombo);
2156 }if(!this.disable.format){tb.add(btn('bold'),btn('italic'),btn('underline'),btn('strikethrough'));};if(!this.disable.fontSize){tb.add('-',btn('increasefontsize',false,B.adjustFont),btn('decreasefontsize',false,B.adjustFont));};if(!this.disable.colors){tb.add('-',{id:B.frameId+'-forecolor',cls:'x-btn-icon x-edit-forecolor',clickEvent:'mousedown',tooltip:this.buttonTips['forecolor']||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({allowReselect:true,focus:Roo.emptyFn,value:'000000',plain:true,selectHandler:function(cp,H){B.execCmd('forecolor',Roo.isSafari||Roo.isIE?'#'+H:H);
2157 A.deferFocus();},scope:B,clickEvent:'mousedown'})},{id:B.frameId+'backcolor',cls:'x-btn-icon x-edit-backcolor',clickEvent:'mousedown',tooltip:this.buttonTips['backcolor']||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({focus:Roo.emptyFn,value:'FFFFFF',plain:true,allowReselect:true,selectHandler:function(cp,H){if(Roo.isGecko){B.execCmd('useCSS',false);
2158 B.execCmd('hilitecolor',H);B.execCmd('useCSS',true);A.deferFocus();}else{B.execCmd(Roo.isOpera?'hilitecolor':'backcolor',Roo.isSafari||Roo.isIE?'#'+H:H);A.deferFocus();}},scope:B,clickEvent:'mousedown'})});};if(!this.disable.alignments){tb.add('-',btn('justifyleft'),btn('justifycenter'),btn('justifyright'));
2159 };if(!this.disable.links){tb.add('-',btn('createlink',false,this.createLink));};if(!this.disable.lists){tb.add('-',btn('insertorderedlist'),btn('insertunorderedlist'));}if(!this.disable.sourceEdit){tb.add('-',btn('sourceedit',true,function(H){this.toggleSourceEdit(H.pressed);
2160 }));}var E={};if(!this.disable.special){E={text:"&#169;",cls:'x-edit-none',menu:{items:[]}};for(var i=0;i<this.specialChars.length;i++){E.menu.items.push({html:this.specialChars[i],handler:function(a,b){B.insertAtCursor(String.fromCharCode(a.html.replace('&#','').replace(';','')));
2161 },tabIndex:-1});}tb.add(E);}var F={};if(!this.disable.cleanStyles){F={cls:'x-btn-icon x-btn-clear',menu:{items:[]}};for(var i=0;i<this.cleanStyles.length;i++){F.menu.items.push({actiontype:this.cleanStyles[i],html:'Remove '+this.cleanStyles[i],handler:function(a,b){var c=Roo.get(B.doc.body);
2162 c.select('[style]').each(function(s){s.dom.style.removeProperty(a.actiontype);});B.syncValue();},tabIndex:-1});}F.menu.items.push({actiontype:'tablewidths',html:'Remove Table Widths',handler:function(a,b){B.cleanTableWidths();B.syncValue();},tabIndex:-1});
2163 F.menu.items.push({actiontype:'word',html:'Remove MS Word Formating',handler:function(a,b){B.cleanWord();B.syncValue();},tabIndex:-1});F.menu.items.push({actiontype:'all',html:'Remove All Styles',handler:function(a,b){var c=Roo.get(B.doc.body);c.select('[style]').each(function(s){s.dom.removeAttribute('style');
2164 });B.syncValue();},tabIndex:-1});F.menu.items.push({actiontype:'all',html:'Remove All CSS Classes',handler:function(a,b){var c=Roo.get(B.doc.body);c.select('[class]').each(function(s){s.dom.removeAttribute('class');});B.cleanWord();B.syncValue();},tabIndex:-1}
2165 );F.menu.items.push({actiontype:'tidy',html:'Tidy HTML Source',handler:function(a,b){new Roo.htmleditor.Tidy(B.doc.body);B.syncValue();},tabIndex:-1});tb.add(F);}if(!this.disable.specialElements){var G={text:"Other;",cls:'x-edit-none',menu:{items:[]}};for(var i=0;
2166 i<this.specialElements.length;i++){G.menu.items.push(Roo.apply({handler:function(a,b){A.insertAtCursor(this.ihtml);}},this.specialElements[i]));}tb.add(G);}if(this.btns){for(var i=0;i<this.btns.length;i++){var b=Roo.factory(this.btns[i],this.btns[i].xns||Roo.form);
2167 b.cls='x-edit-none';if(typeof(this.btns[i].cls)!='undefined'&&this.btns[i].cls.indexOf('x-init-enable')!==-1){b.cls+=' x-init-enable';}b.scope=B;tb.add(b);}}this.tb.items.each(function(H){if(H.id!=B.frameId+'-sourceedit'&&(typeof(H.cls)!='undefined'&&H.cls.indexOf('x-init-enable')===-1)){H.disable();
2168 }});this.rendered=true;A.on('editorevent',this.updateToolbar,this);},relayBtnCmd:function(A){this.editorcore.relayCmd(A.cmd);},createLink:function(){var ec=this.editorcore;var ar=ec.getAllAncestors();var n=false;for(var i=0;i<ar.length;i++){if(ar[i]&&ar[i].nodeName=='A'){n=ar[i];
2169 break;}}(function(){Roo.MessageBox.show({title:"Add / Edit Link URL",msg:"Enter the url for the link",buttons:Roo.MessageBox.OKCANCEL,fn:function(A,B){if(A!='ok'){return;}if(B&&B!='http:/'+'/'){if(n){n.setAttribute('href',B);}else{ec.relayCmd('createlink',B);
2170 }}},minWidth:250,prompt:true,modal:true,value:n?n.getAttribute('href'):''});}).defer(100,this);},updateToolbar:function(){if(!this.editorcore.activated){this.editor.onFirstFocus();return;}var A=this.tb.items.map,B=this.editorcore.doc,C=this.editorcore.frameId;
2171 if(!this.disable.font&&!Roo.isSafari){}if(!this.disable.format){A[C+'-bold'].toggle(B.queryCommandState('bold'));A[C+'-italic'].toggle(B.queryCommandState('italic'));A[C+'-underline'].toggle(B.queryCommandState('underline'));A[C+'-strikethrough'].toggle(B.queryCommandState('strikethrough'));
2172 }if(!this.disable.alignments){A[C+'-justifyleft'].toggle(B.queryCommandState('justifyleft'));A[C+'-justifycenter'].toggle(B.queryCommandState('justifycenter'));A[C+'-justifyright'].toggle(B.queryCommandState('justifyright'));}if(!Roo.isSafari&&!this.disable.lists){A[C+'-insertorderedlist'].toggle(B.queryCommandState('insertorderedlist'));
2173 A[C+'-insertunorderedlist'].toggle(B.queryCommandState('insertunorderedlist'));}var D=this.editorcore.getAllAncestors();if(this.formatCombo){var E=this.formatCombo.store;this.formatCombo.setValue("");for(var i=0;i<D.length;i++){if(D[i]&&E.query('tag',D[i].tagName.toLowerCase(),false).length){this.formatCombo.setValue(D[i].tagName.toLowerCase());
2174 break;}}}Roo.menu.MenuMgr.hideAll();},createFontOptions:function(){var A=[],fs=this.fontFamilies,ff,lc;for(var i=0,B=fs.length;i<B;i++){ff=fs[i];lc=ff.toLowerCase();A.push('<option value="',lc,'" style="font-family:',ff,';"',(this.defaultFont==lc?' selected="true">':'>'),ff,'</option>');
2175 }return A.join('');},toggleSourceEdit:function(A){Roo.log("toolbar toogle");if(A===undefined){A=!this.sourceEditMode;}this.sourceEditMode=A===true;var B=this.tb.items.get(this.editorcore.frameId+'-sourceedit');if(B.pressed!==this.sourceEditMode){B.toggle(this.sourceEditMode);
2176 return;}if(A){Roo.log("disabling buttons");this.tb.items.each(function(C){if(C.cmd!='sourceedit'&&(typeof(C.cls)!='undefined'&&C.cls.indexOf('x-init-enable')===-1)){C.disable();}});}else{Roo.log("enabling buttons");if(this.editorcore.initialized){this.tb.items.each(function(C){C.enable();
2177 });Roo.each(Roo.get(this.editorcore.doc.body).query('*[data-block]'),function(e){Roo.htmleditor.Block.factory(e).updateElement(e);},this);}}Roo.log("calling toggole on editor");this.editor.toggleSourceEdit(A);},buttonTips:{bold:{title:'Bold (Ctrl+B)',text:'Make the selected text bold.',cls:'x-html-editor-tip'}
2178 ,italic:{title:'Italic (Ctrl+I)',text:'Make the selected text italic.',cls:'x-html-editor-tip'},underline:{title:'Underline (Ctrl+U)',text:'Underline the selected text.',cls:'x-html-editor-tip'},strikethrough:{title:'Strikethrough',text:'Strikethrough the selected text.',cls:'x-html-editor-tip'}
2179 ,increasefontsize:{title:'Grow Text',text:'Increase the font size.',cls:'x-html-editor-tip'},decreasefontsize:{title:'Shrink Text',text:'Decrease the font size.',cls:'x-html-editor-tip'},backcolor:{title:'Text Highlight Color',text:'Change the background color of the selected text.',cls:'x-html-editor-tip'}
2180 ,forecolor:{title:'Font Color',text:'Change the color of the selected text.',cls:'x-html-editor-tip'},justifyleft:{title:'Align Text Left',text:'Align text to the left.',cls:'x-html-editor-tip'},justifycenter:{title:'Center Text',text:'Center text in the editor.',cls:'x-html-editor-tip'}
2181 ,justifyright:{title:'Align Text Right',text:'Align text to the right.',cls:'x-html-editor-tip'},insertunorderedlist:{title:'Bullet List',text:'Start a bulleted list.',cls:'x-html-editor-tip'},insertorderedlist:{title:'Numbered List',text:'Start a numbered list.',cls:'x-html-editor-tip'}
2182 ,createlink:{title:'Hyperlink',text:'Make the selected text a hyperlink.',cls:'x-html-editor-tip'},sourceedit:{title:'Source Edit',text:'Switch to source editing mode.',cls:'x-html-editor-tip'}},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();
2183 if(A.menu.el){A.menu.el.destroy();}}A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();});}};
2184 // Roo/form/HtmlEditor/ToolbarContext.js
2185 Roo.form.HtmlEditor.ToolbarContext=function(A){Roo.apply(this,A);this.styles=this.styles||{};};Roo.form.HtmlEditor.ToolbarContext.types={'IMG':[{name:'width',title:"Width",width:40},{name:'height',title:"Height",width:40},{name:'align',title:"Align",opts:[[""],["left"],["right"],["center"],["top"]],width:80}
2186 ,{name:'border',title:"Border",width:40},{name:'alt',title:"Alt",width:120},{name:'src',title:"Src",width:220}],'FIGURE':[{name:'align',title:"Align",opts:[[""],["left"],["right"],["center"],["top"]],width:80}],'A':[{name:'name',title:"Name",width:50},{name:'target',title:"Target",width:120}
2187 ,{name:'href',title:"Href",width:220}],'INPUT':[{name:'name',title:"name",width:120},{name:'value',title:"Value",width:120},{name:'width',title:"Width",width:40}],'LABEL':[{name:'for',title:"For",width:120}],'TEXTAREA':[{name:'name',title:"name",width:120}
2188 ,{name:'rows',title:"Rows",width:20},{name:'cols',title:"Cols",width:20}],'SELECT':[{name:'name',title:"name",width:120},{name:'selectoptions',title:"Options",width:200}],'BODY':[{name:'title',title:"Title",width:200,disabled:true}],'*':[]};Roo.form.HtmlEditor.ToolbarContext.stores=false;
2189 Roo.form.HtmlEditor.ToolbarContext.options={'font-family':[['Helvetica,Arial,sans-serif','Helvetica'],['Courier New','Courier New'],['Tahoma','Tahoma'],['Times New Roman,serif','Times'],['Verdana','Verdana']]};Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,{tb:false,rendered:false,editor:false,editorcore:false,disable:false,styles:false,options:false,toolbars:false,init:function(A){this.editor=A;
2190 this.editorcore=A.editorcore?A.editorcore:A;var B=this.editorcore;var C=B.frameId;var D=this;function btn(id,F,G){var H=C+'-'+id;return {id:H,cmd:id,cls:'x-btn-icon x-edit-'+id,enableToggle:F!==false,scope:B,handler:G||B.relayBtnCmd,clickEvent:'mousedown',tooltip:D.buttonTips[id]||undefined,tabIndex:-1}
2191 ;}var E=A.wrap.createChild({tag:'div'},A.wrap.dom.firstChild.nextSibling,true);var ty=Roo.form.HtmlEditor.ToolbarContext.types;this.toolbars={};for(var i in ty){this.toolbars[i]=this.buildToolbar(ty[i],i);}this.tb=this.toolbars.BODY;this.tb.el.show();this.buildFooter();
2192 this.footer.show();A.on('hide',function(){this.footer.hide()},this);A.on('show',function(){this.footer.show()},this);this.rendered=true;A.on('editorevent',this.updateToolbar,this);},updateToolbar:function(A,ev,B){if(ev){ev.stopEvent();}if(!this.editorcore.activated){this.editor.onFirstFocus();
2193 return;}if(ev&&(ev.type=='mouseup'||ev.type=='click')&&ev.target&&ev.target.tagName!='BODY'){B=ev.target;}Array.from(this.editorcore.doc.body.querySelectorAll('.roo-ed-selection')).forEach(function(e){e.classList.remove('roo-ed-selection');});var C=this.editorcore.getAllAncestors();
2194 var ty=Roo.form.HtmlEditor.ToolbarContext.types;if(!B){B=C.length?(C[0]?C[0]:C[1]):this.editorcore.doc.body;B=B?B:this.editorcore.doc.body;B=B.tagName.length?B:this.editorcore.doc.body;}var tn=B.tagName.toUpperCase();var D=this.tb.selectedNode;this.tb.selectedNode=B;
2195 var E=tn;var db=false;if(B&&B.hasAttribute('data-block')){db=B;}else if(B&&B.closest('[data-block]')){db=B.closest('[data-block]');}var F=false;if(db&&this.editorcore.enableBlocks){F=Roo.htmleditor.Block.factory(db);if(F){db.className=(db.classList.length>0?db.className+' ':'')+'roo-ed-selection';
2196 tn='BLOCK.'+db.getAttribute('data-block');if(typeof(this.toolbars[tn])=='undefined'){this.toolbars[tn]=this.buildToolbar(false,tn,F.friendly_name,F);}this.toolbars[tn].selectedNode=db;E=F.friendly_name;C=this.editorcore.getAllAncestors();}}if(this.tb.name==tn&&D==this.tb.selectedNode&&ev!==false){return;
2197 }this.tb.el.hide();this.tb=typeof(this.toolbars[tn])!='undefined'?this.toolbars[tn]:this.toolbars['*'];this.tb.el.show();this.tb.items.first().el.innerHTML=E+':&nbsp;';if(F&&this.tb.fields){this.tb.fields.each(function(e){e.setValue(F[e.name]);});}else if(this.tb.fields&&this.tb.selectedNode){this.tb.fields.each(function(e){if(e.stylename){e.setValue(this.tb.selectedNode.style[e.stylename]);
2198 return;}e.setValue(this.tb.selectedNode.getAttribute(e.attrname));},this);this.updateToolbarStyles(this.tb.selectedNode);}Roo.menu.MenuMgr.hideAll();this.updateFooter(C);},updateToolbarStyles:function(A){var B=false;for(var i in this.styles){B=true;break;
2199 }if(B&&this.tb.hasStyles){var st=this.tb.fields.item(0);st.store.removeAll();var cn=A.className.split(/\s+/);var C=[];if(this.styles['*']){Roo.each(this.styles['*'],function(v){C.push([v,cn.indexOf(v)>-1?1:0]);});}if(this.styles[tn]){Roo.each(this.styles[tn],function(v){C.push([v,cn.indexOf(v)>-1?1:0]);
2200 });}st.store.loadData(C);st.collapse();st.setValue(cn);}},updateFooter:function(A){var B='';if(A===false){this.footDisp.dom.innerHTML='';return;}this.footerEls=A.reverse();Roo.each(this.footerEls,function(a,i){if(!a){return;}B+=B.length?' &gt; ':'';B+='<span class="x-ed-loc-'+i+'">'+a.tagName+'</span>';
2201 });var sz=this.footDisp.up('td').getSize();this.footDisp.dom.style.width=(sz.width-10)+'px';this.footDisp.dom.style.marginLeft='5px';this.footDisp.dom.style.overflow='hidden';this.footDisp.dom.innerHTML=B;},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();
2202 if(A.menu.el){A.menu.el.destroy();}}A.destroy();});}},onFirstFocus:function(){this.tb.items.each(function(A){A.enable();});},buildToolbar:function(A,nm,B,C){var D=this.editor;var E=this.editorcore;var F=D.wrap.createChild({tag:'div'},D.wrap.dom.firstChild.nextSibling,true);
2203 var tb=new Roo.Toolbar(F);if(A===false&&C){A=C.contextMenu(this);}tb.hasStyles=false;tb.name=nm;tb.add((typeof(B)=='undefined'?nm:B)+":&nbsp;");var G=Array.from(this.styles);if(G&&G.length){tb.hasStyles=true;tb.addField(new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'val',fields:['val','selected'],data:[]}
2204 ),name:'-roo-edit-className',attrname:'className',displayField:'val',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Select Style',selectOnFocus:true,width:130,listeners:{'select':function(c,r,i){tb.selectedNode.className=r?r.get('val'):'';
2205 E.syncValue();}}}));}var H=Roo.form.HtmlEditor.ToolbarContext;for(var i=0;i<A.length;i++){if(typeof(A[i].xtype)!='undefined'){tb[typeof(A[i].name)=='undefined'?'add':'addField'](Roo.factory(A[i]));continue;}var I=A[i];tb.add(I.title+":&nbsp;");var J=I.opts?I.opts:false;
2206 if(I.optname){J=Roo.form.HtmlEditor.ToolbarContext.options[I.optname];}if(J){tb.addField(new Roo.form.ComboBox({store:typeof(H.stores[i])!='undefined'?Roo.factory(H.stores[i],Roo.data):new Roo.data.SimpleStore({id:'val',fields:['val','display'],data:J}),name:'-roo-edit-'+A[i].name,attrname:A[i].name,stylename:I.style?I.style:false,displayField:I.displayField?I.displayField:'val',valueField:'val',typeAhead:false,mode:typeof(H.stores[A[i].name])!='undefined'?'remote':'local',editable:false,triggerAction:'all',emptyText:'Select',selectOnFocus:true,width:I.width?I.width:130,listeners:{'select':function(c,r,i){if(c.stylename){tb.selectedNode.style[c.stylename]=r.get('val');
2207 E.syncValue();return;}if(r===false){tb.selectedNode.removeAttribute(c.attrname);E.syncValue();return;}tb.selectedNode.setAttribute(c.attrname,r.get('val'));E.syncValue();}}}));continue;}tb.addField(new Roo.form.TextField({name:'-roo-edit-'+A[i].name,attrname:A[i].name,width:I.width,value:'',listeners:{'change':function(f,nv,ov){tb.selectedNode.setAttribute(f.attrname,nv);
2208 E.syncValue();}}}));}var K=this;var L=!C||C.deleteTitle!==false;if(nm=='BODY'){L=false;tb.addSeparator();tb.addButton({text:'Stylesheets',listeners:{click:function(){K.editor.fireEvent('stylesheetsclick',K.editor);}}});}tb.addFill();if(L){tb.addButton({text:C&&C.deleteTitle?C.deleteTitle:'Remove Block or Formating',listeners:{click:function(){var sn=tb.selectedNode;
2209 if(C){sn=Roo.htmleditor.Block.factory(tb.selectedNode).removeNode();}if(!sn){return;}var M=sn.childNodes[0]||sn.nextSibling||sn.previousSibling||sn.parentNode;if(sn.hasAttribute('data-block')){M=sn.nextSibling||sn.previousSibling||sn.parentNode;sn.parentNode.removeChild(sn);
2210 }else if(sn&&sn.tagName!='BODY'){a=new Roo.htmleditor.FilterKeepChildren({tag:false});a.replaceTag(sn);}var N=E.createRange();N.setStart(M,0);N.setEnd(M,0);var O=E.getSelection();O.removeAllRanges();O.addRange(N);K.updateToolbar(null,null,null);K.updateFooter(false);
2211 }}});}tb.el.on('click',function(e){e.preventDefault();});tb.el.setVisibilityMode(Roo.Element.DISPLAY);tb.el.hide();return tb;},buildFooter:function(){var A=this.editor.wrap.createChild();this.footer=new Roo.Toolbar(A);var B=new Roo.Toolbar.Fill();var _t=this;
2212 this.footer.add({text:'&lt;',xtype:'Button',handler:function(){_t.footDisp.scrollTo('left',0,true)}});this.footer.add(B);this.footer.add({text:'&gt;',xtype:'Button',handler:function(){_t.footDisp.select('span').last().scrollIntoView(_t.footDisp,true);}});
2213 var A=Roo.get(B.el);A.addClass('x-editor-context');this.footDispWrap=A;this.footDispWrap.overflow='hidden';this.footDisp=A.createChild();this.footDispWrap.on('click',this.onContextClick,this)},onContextClick:function(ev,A){ev.preventDefault();var cn=A.className;
2214 if(!cn.match(/x-ed-loc-/)){return;}var n=cn.split('-').pop();var B=this.footerEls;var C=B[n];this.editorcore.selectNode(C);this.updateToolbar(null,null,C);}});
2215 // Roo/form/BasicForm.js
2216 Roo.form.BasicForm=function(el,A){this.allItems=[];this.childForms=[];Roo.apply(this,A);this.items=new Roo.util.MixedCollection(false,function(o){return o.id||(o.id=Roo.id());});this.addEvents({beforeaction:true,actionfailed:true,actioncomplete:true});if(el){this.initEl(el);
2217 }Roo.form.BasicForm.superclass.constructor.call(this);Roo.form.BasicForm.popover.apply();};Roo.extend(Roo.form.BasicForm,Roo.util.Observable,{timeout:30,activeAction:null,trackResetOnLoad:false,childForms:false,allItems:false,waitMsgTarget:false,disableMask:false,errorMask:false,maskOffset:100,initEl:function(el){this.el=Roo.get(el);
2218 this.id=this.el.id||Roo.id();this.el.on('submit',this.onSubmit,this);this.el.addClass('x-form');},onSubmit:function(e){e.stopEvent();},isValid:function(){var A=true;var B=false;this.items.each(function(f){if(f.validate()){return;}A=false;if(!B&&f.el.isVisible(true)){B=f;
2219 }});if(this.errorMask&&!A){Roo.form.BasicForm.popover.mask(this,B);}return A;},invalidFields:function(){var A=[];this.items.each(function(f){if(f.validate()){return;}A.push(f);});return A;},isDirty:function(){var A=false;this.items.each(function(f){if(f.isDirty()){A=true;
2220 return false;}});return A;},hasChanged:function(){var A=false;this.items.each(function(f){if(f.hasChanged()){A=true;return false;}});return A;},resetHasChanged:function(){this.items.each(function(f){f.resetHasChanged();});},doAction:function(A,B){if(typeof A=='string'){A=new Roo.form.Action.ACTION_TYPES[A](this,B);
2221 }if(this.fireEvent('beforeaction',this,A)!==false){this.beforeAction(A);A.run.defer(100,A);}return this;},submit:function(A){this.doAction('submit',A);return this;},load:function(A){this.doAction('load',A);return this;},updateRecord:function(A){A.beginEdit();
2222 var fs=A.fields;fs.each(function(f){var B=this.findField(f.name);if(B){A.set(f.name,B.getValue());}},this);A.endEdit();return this;},loadRecord:function(A){this.setValues(A.data);return this;},beforeAction:function(A){var o=A.options;if(!this.disableMask){if(this.waitMsgTarget===true){this.el.mask(o.waitMsg||"Sending",'x-mask-loading');
2223 }else if(this.waitMsgTarget){this.waitMsgTarget=Roo.get(this.waitMsgTarget);this.waitMsgTarget.mask(o.waitMsg||"Sending",'x-mask-loading');}else{Roo.MessageBox.wait(o.waitMsg||"Sending",o.waitTitle||this.waitTitle||'Please Wait...');}}},afterAction:function(A,B){this.activeAction=null;
2224 var o=A.options;if(!this.disableMask){if(this.waitMsgTarget===true){this.el.unmask();}else if(this.waitMsgTarget){this.waitMsgTarget.unmask();}else{Roo.MessageBox.updateProgress(1);Roo.MessageBox.hide();}}if(B){if(o.reset){this.reset();}Roo.callback(o.success,o.scope,[this,A]);
2225 this.fireEvent('actioncomplete',this,A);}else{if((typeof(A.result)!='undefined')&&(typeof(A.result.errors)!='undefined')&&(typeof(A.result.errors.needs_confirm)!='undefined')){var _t=this;Roo.MessageBox.confirm("Change requires confirmation",A.result.errorMsg,function(r){if(r!='yes'){return;
2226 }_t.doAction('submit',{params:{_submit_confirmed:1}});});return;}Roo.callback(o.failure,o.scope,[this,A]);if(!this.hasListener('actionfailed')){Roo.MessageBox.alert("Error",(typeof(A.result)!='undefined'&&typeof(A.result.errorMsg)!='undefined')?A.result.errorMsg:"Saving Failed, please check your entries or try again");
2227 }this.fireEvent('actionfailed',this,A);}},findField:function(id){var A=this.items.get(id);if(!A){this.items.each(function(f){if(f.isFormField&&(f.dataIndex==id||f.id==id||f.getName()==id)){A=f;return false;}});}return A||null;},addForm:function(A){if(this.childForms.indexOf(A)>-1){return;
2228 }this.childForms.push(A);var n='';Roo.each(A.allItems,function(fe){n=typeof(fe.getName)=='undefined'?fe.name:fe.getName();if(this.findField(n)){return;}var B=new Roo.form.Hidden({name:n});B.render(this.el);this.add(B);},this);},markInvalid:function(A){if(A instanceof Array){for(var i=0,B=A.length;
2229 i<B;i++){var C=A[i];var f=this.findField(C.id);if(f){f.markInvalid(C.msg);}}}else{var D,id;for(id in A){if(typeof A[id]!='function'&&(D=this.findField(id))){D.markInvalid(A[id]);}}}Roo.each(this.childForms||[],function(f){f.markInvalid(A);});return this;}
2230 ,setValues:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var v=A[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else{var C,id;for(id in A){if(typeof A[id]!='function'&&(C=this.findField(id))){if(C.setFromData&&C.valueField&&C.displayField&&(C.store&&!C.store.isLocal)){var sd={}
2231 ;sd[C.valueField]=typeof(A[C.hiddenName])=='undefined'?'':A[C.hiddenName];sd[C.displayField]=typeof(A[C.name])=='undefined'?'':A[C.name];C.setFromData(sd);}else{C.setValue(A[id]);}if(this.trackResetOnLoad){C.originalValue=C.getValue();}}}}this.resetHasChanged();
2232 Roo.each(this.childForms||[],function(f){f.setValues(A);f.resetHasChanged();});return this;},getValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getFieldValues());},this);}if(typeof(FormData)!='undefined'&&A!==true){try{var fd=(new FormData(this.el.dom)).entries();
2233 var B={};var C=fd.next();while(!C.done){B[C.value[0]]=C.value[1];C=fd.next();};return B;}catch(e){}}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getFieldValues());
2234 },this);}var B={};this.items.each(function(f){if(f.readOnly&&A!==true){return;}if(!f.getName()){return;}var v=f.getValue();if(f.inputType=='radio'){if(typeof(B[f.getName()])=='undefined'){B[f.getName()]='';}if(!f.el.dom.checked){return;}v=f.el.dom.value;}
2235 if((typeof(v)=='object')&&f.getRawValue){v=f.getRawValue();}if(f.name!=f.getName()){B[f.name]=f.getRawValue();}B[f.getName()]=v;});return B;},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});Roo.each(this.childForms||[],function(f){f.clearInvalid();
2236 });return this;},reset:function(){this.items.each(function(f){f.reset();});Roo.each(this.childForms||[],function(f){f.reset();});this.resetHasChanged();return this;},add:function(){this.items.addAll(Array.prototype.slice.call(arguments,0));return this;},remove:function(A){this.items.remove(A);
2237 return this;},render:function(){this.items.each(function(f){if(f.isFormField&&!f.rendered&&document.getElementById(f.id)){f.applyTo(f.id);}});return this;},applyToFields:function(o){this.items.each(function(f){Roo.apply(f,o);});return this;},applyIfToFields:function(o){this.items.each(function(f){Roo.applyIf(f,o);
2238 });return this;}});Roo.BasicForm=Roo.form.BasicForm;Roo.apply(Roo.form.BasicForm,{popover:{padding:5,isApplied:false,isMasked:false,form:false,target:false,intervalID:false,maskEl:false,apply:function(){if(this.isApplied){return;}this.maskEl={top:Roo.DomHelper.append(Roo.get(document.body),{tag:"div",cls:"x-dlg-mask roo-form-top-mask"}
2239 ,true),left:Roo.DomHelper.append(Roo.get(document.body),{tag:"div",cls:"x-dlg-mask roo-form-left-mask"},true),bottom:Roo.DomHelper.append(Roo.get(document.body),{tag:"div",cls:"x-dlg-mask roo-form-bottom-mask"},true),right:Roo.DomHelper.append(Roo.get(document.body),{tag:"div",cls:"x-dlg-mask roo-form-right-mask"}
2240 ,true)};this.maskEl.top.enableDisplayMode("block");this.maskEl.left.enableDisplayMode("block");this.maskEl.bottom.enableDisplayMode("block");this.maskEl.right.enableDisplayMode("block");Roo.get(document.body).on('click',function(){this.unmask();},this);Roo.get(document.body).on('touchstart',function(){this.unmask();
2241 },this);this.isApplied=true},mask:function(A,B){this.form=A;this.target=B;if(!this.form.errorMask||!B.el){return;}var C=this.target.el.findScrollableParent()||this.target.el.findParent('div.x-layout-active-content',100,true)||Roo.get(document.body);var ot=this.target.el.calcOffsetsTo(C);
2242 var D=ot[1]-this.form.maskOffset;D=Math.min(D,C.dom.scrollHeight);C.scrollTo('top',D);var el=this.target.wrap||this.target.el;var E=el.getBox();this.maskEl.top.setStyle('position','absolute');this.maskEl.top.setStyle('z-index',10000);this.maskEl.top.setSize(Roo.lib.Dom.getDocumentWidth(),E.y-this.padding);
2243 this.maskEl.top.setLeft(0);this.maskEl.top.setTop(0);this.maskEl.top.show();this.maskEl.left.setStyle('position','absolute');this.maskEl.left.setStyle('z-index',10000);this.maskEl.left.setSize(E.x-this.padding,E.height+this.padding*2);this.maskEl.left.setLeft(0);
2244 this.maskEl.left.setTop(E.y-this.padding);this.maskEl.left.show();this.maskEl.bottom.setStyle('position','absolute');this.maskEl.bottom.setStyle('z-index',10000);this.maskEl.bottom.setSize(Roo.lib.Dom.getDocumentWidth(),Roo.lib.Dom.getDocumentHeight()-E.bottom-this.padding);
2245 this.maskEl.bottom.setLeft(0);this.maskEl.bottom.setTop(E.bottom+this.padding);this.maskEl.bottom.show();this.maskEl.right.setStyle('position','absolute');this.maskEl.right.setStyle('z-index',10000);this.maskEl.right.setSize(Roo.lib.Dom.getDocumentWidth()-E.right-this.padding,E.height+this.padding*2);
2246 this.maskEl.right.setLeft(E.right+this.padding);this.maskEl.right.setTop(E.y-this.padding);this.maskEl.right.show();this.intervalID=window.setInterval(function(){Roo.form.BasicForm.popover.unmask();},10000);window.onwheel=function(){return false;};(function(){this.isMasked=true;
2247 }).defer(500,this);},unmask:function(){if(!this.isApplied||!this.isMasked||!this.form||!this.target||!this.form.errorMask){return;}this.maskEl.top.setStyle('position','absolute');this.maskEl.top.setSize(0,0).setXY([0,0]);this.maskEl.top.hide();this.maskEl.left.setStyle('position','absolute');
2248 this.maskEl.left.setSize(0,0).setXY([0,0]);this.maskEl.left.hide();this.maskEl.bottom.setStyle('position','absolute');this.maskEl.bottom.setSize(0,0).setXY([0,0]);this.maskEl.bottom.hide();this.maskEl.right.setStyle('position','absolute');this.maskEl.right.setSize(0,0).setXY([0,0]);
2249 this.maskEl.right.hide();window.onwheel=function(){return true;};if(this.intervalID){window.clearInterval(this.intervalID);this.intervalID=false;}this.isMasked=false;}}});
2250 // Roo/form/Form.js
2251 Roo.form.Form=function(A){var B=[];if(A.items){B=A.items;delete A.items;}Roo.form.Form.superclass.constructor.call(this,null,A);this.url=this.url||this.action;if(!this.root){this.root=new Roo.form.Layout(Roo.applyIf({id:Roo.id()},A));}this.active=this.root;
2252 this.buttons=[];this.allItems=[];this.addEvents({clientvalidation:true,rendered:true});if(this.progressUrl){this.addxtype({xns:Roo.form,xtype:'Hidden',name:'UPLOAD_IDENTIFIER'});}Roo.each(B,this.addxtype,this);};Roo.extend(Roo.form.Form,Roo.form.BasicForm,{buttonAlign:'center',minButtonWidth:75,labelAlign:'left',monitorValid:false,monitorPoll:200,progressUrl:false,formData:false,column:function(c){var A=new Roo.form.Column(c);
2253 this.start(A);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));this.end();}return A;},fieldset:function(c){var fs=new Roo.form.FieldSet(c);this.start(fs);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));
2254 this.end();}return fs;},container:function(c){var l=new Roo.form.Layout(c);this.start(l);if(arguments.length>1){this.add.apply(this,Array.prototype.slice.call(arguments,1));this.end();}return l;},start:function(c){Roo.applyIf(c,{'labelAlign':this.active.labelAlign,'labelWidth':this.active.labelWidth,'itemCls':this.active.itemCls}
2255 );this.active.stack.push(c);c.ownerCt=this.active;this.active=c;return this;},end:function(){if(this.active==this.root){return this;}this.active=this.active.ownerCt;return this;},add:function(){this.active.stack.push.apply(this.active.stack,arguments);this.allItems.push.apply(this.allItems,arguments);
2256 var r=[];for(var i=0,a=arguments,A=a.length;i<A;i++){if(a[i].isFormField){r.push(a[i]);}}if(r.length>0){Roo.form.Form.superclass.add.apply(this,r);}return this;},findbyId:function(id){var A=false;if(!id){return A;}Roo.each(this.allItems,function(f){if(f.id==id||f.name==id){A=f;
2257 return false;}});return A;},render:function(ct){ct=Roo.get(ct);var o=this.autoCreate||{tag:'form',method:this.method||'POST',id:this.id||Roo.id()};this.initEl(ct.createChild(o));this.root.render(this.el);this.items.each(function(f){f.render('x-form-el-'+f.id);
2258 });if(this.buttons.length>0){var tb=this.el.createChild({cls:'x-form-btns-ct',cn:{cls:"x-form-btns x-form-btns-"+this.buttonAlign,html:'<table cellspacing="0"><tbody><tr></tr></tbody></table><div class="x-clear"></div>'}},null,true);var tr=tb.getElementsByTagName('tr')[0];
2259 for(var i=0,A=this.buttons.length;i<A;i++){var b=this.buttons[i];var td=document.createElement('td');td.className='x-form-btn-td';b.render(tr.appendChild(td));}}if(this.monitorValid){this.startMonitoring();}this.fireEvent('rendered',this);return this;},addButton:function(A,B,C){var bc={handler:B,scope:C,minWidth:this.minButtonWidth,hideParent:true}
2260 ;if(typeof A=="string"){bc.text=A;}else{Roo.apply(bc,A);}var D=new Roo.Button(null,bc);this.buttons.push(D);return D;},addxtype:function(){var ar=Array.prototype.slice.call(arguments,0);var A=false;for(var i=0;i<ar.length;i++){if(!ar[i]){continue;}if(Roo.form[ar[i].xtype]){ar[i].form=this;
2261 var fe=Roo.factory(ar[i],Roo.form);if(!A){A=fe;}fe.form=this;if(fe.store){fe.store.form=this;}if(fe.isLayout){this.start(fe);this.allItems.push(fe);if(fe.items&&fe.addxtype){fe.addxtype.apply(fe,fe.items);delete fe.items;}this.end();continue;}this.add(fe);
2262 }if(ar[i].xtype=='Button'){this.addButton(ar[i]);this.allItems.push(fe);continue;}if(ar[i].xtype=='end'){alert('end is not supported on xtype any more, use items');}}return A;},startMonitoring:function(){if(!this.bound){this.bound=true;Roo.TaskMgr.start({run:this.bindHandler,interval:this.monitorPoll||200,scope:this}
2263 );}},stopMonitoring:function(){this.bound=false;},bindHandler:function(){if(!this.bound){return false;}var A=true;this.items.each(function(f){if(!f.isValid(true)){A=false;return false;}});for(var i=0,B=this.buttons.length;i<B;i++){var C=this.buttons[i];if(C.formBind===true&&C.disabled===A){C.setDisabled(!A);
2264 }}this.fireEvent('clientvalidation',this,A);}});Roo.Form=Roo.form.Form;
2265 // Roo/form/Action.js
2266 Roo.namespace('Roo.form');Roo.form.Action=function(A,B){this.form=A;this.options=B||{};};Roo.form.Action.CLIENT_INVALID='client';Roo.form.Action.SERVER_INVALID='server';Roo.form.Action.CONNECT_FAILURE='connect';Roo.form.Action.LOAD_FAILURE='load';Roo.form.Action.prototype={type:'default',failureType:undefined,response:undefined,result:undefined,run:function(A){}
2267 ,success:function(A){},handleResponse:function(A){},failure:function(A){this.response=A;this.failureType=Roo.form.Action.CONNECT_FAILURE;this.form.afterAction(this,false);},processResponse:function(A){this.response=A;if(!A.responseText){return true;}this.result=this.handleResponse(A);
2268 return this.result;},getUrl:function(A){var B=this.options.url||this.form.url||this.form.el.dom.action;if(A){var p=this.getParams();if(p){B+=(B.indexOf('?')!=-1?'&':'?')+p;}}return B;},getMethod:function(){return (this.options.method||this.form.method||this.form.el.dom.method||'POST').toUpperCase();
2269 },getParams:function(){var bp=this.form.baseParams;var p=this.options.params;if(p){if(typeof p=="object"){p=Roo.urlEncode(Roo.applyIf(p,bp));}else if(typeof p=='string'&&bp){p+='&'+Roo.urlEncode(bp);}}else if(bp){p=Roo.urlEncode(bp);}return p;},createCallback:function(){return {success:this.success,failure:this.failure,scope:this,timeout:(this.form.timeout*1000),upload:this.form.fileUpload?this.success:undefined}
2270 ;}};Roo.form.Action.Submit=function(A,B){Roo.form.Action.Submit.superclass.constructor.call(this,A,B);};Roo.extend(Roo.form.Action.Submit,Roo.form.Action,{type:'submit',haveProgress:false,uploadComplete:false,uploadProgress:function(){if(!this.form.progressUrl){return;
2271 }if(!this.haveProgress){Roo.MessageBox.progress("Uploading","Uploading");}if(this.uploadComplete){Roo.MessageBox.hide();return;}this.haveProgress=true;var A=this.form.findField('UPLOAD_IDENTIFIER').getValue();var c=new Roo.data.Connection();c.request({url:this.form.progressUrl,params:{id:A}
2272 ,method:'GET',success:function(B){var C=false;var D;try{C=Roo.decode(B.responseText)}catch(e){Roo.log("Invalid data from server..");Roo.log(D);return;}if(!C||!C.success){Roo.log(C);Roo.MessageBox.alert(Roo.encode(C));return;}var E=C.data;if(this.uploadComplete){Roo.MessageBox.hide();
2273 return;}if(E){Roo.MessageBox.updateProgress(E.bytes_uploaded/E.bytes_total,Math.floor((E.bytes_total-E.bytes_uploaded)/1000)+'k remaining');}this.uploadProgress.defer(2000,this);},failure:function(B){Roo.log('progress url failed ');Roo.log(B);},scope:this}
2274 );},run:function(){this.form.getValues();var o=this.options;var A=this.getMethod();var B=A=='POST';if(o.clientValidation===false||this.form.isValid()){if(this.form.progressUrl){this.form.findField('UPLOAD_IDENTIFIER').setValue((new Date()*1)+''+Math.random());
2275 }Roo.Ajax.request(Roo.apply(this.createCallback(),{form:this.form.el.dom,url:this.getUrl(!B),method:A,params:B?this.getParams():null,isUpload:this.form.fileUpload,formData:this.form.formData}));this.uploadProgress();}else if(o.clientValidation!==false){this.failureType=Roo.form.Action.CLIENT_INVALID;
2276 this.form.afterAction(this,false);}},success:function(A){this.uploadComplete=true;if(this.haveProgress){Roo.MessageBox.hide();}var B=this.processResponse(A);if(B===true||B.success){this.form.afterAction(this,true);return;}if(B.errors){this.form.markInvalid(B.errors);
2277 this.failureType=Roo.form.Action.SERVER_INVALID;}this.form.afterAction(this,false);},failure:function(A){this.uploadComplete=true;if(this.haveProgress){Roo.MessageBox.hide();}this.response=A;this.failureType=Roo.form.Action.CONNECT_FAILURE;this.form.afterAction(this,false);
2278 },handleResponse:function(A){if(this.form.errorReader){var rs=this.form.errorReader.read(A);var B=[];if(rs.records){for(var i=0,C=rs.records.length;i<C;i++){var r=rs.records[i];B[i]=r.data;}}if(B.length<1){B=null;}return {success:rs.success,errors:B};}var D=false;
2279 try{D=Roo.decode(A.responseText);}catch(e){D={success:false,errorMsg:"Failed to read server message: "+(A?A.responseText:' - no message'),errors:[]};}return D;}});Roo.form.Action.Load=function(A,B){Roo.form.Action.Load.superclass.constructor.call(this,A,B);
2280 this.reader=this.form.reader;};Roo.extend(Roo.form.Action.Load,Roo.form.Action,{type:'load',run:function(){Roo.Ajax.request(Roo.apply(this.createCallback(),{method:this.getMethod(),url:this.getUrl(false),params:this.getParams()}));},success:function(A){var B=this.processResponse(A);
2281 if(B===true||!B.success||!B.data){this.failureType=Roo.form.Action.LOAD_FAILURE;this.form.afterAction(this,false);return;}this.form.clearInvalid();this.form.setValues(B.data);this.form.afterAction(this,true);},handleResponse:function(A){if(this.form.reader){var rs=this.form.reader.read(A);
2282 var B=rs.records&&rs.records[0]?rs.records[0].data:null;return {success:rs.success,data:B};}return Roo.decode(A.responseText);}});Roo.form.Action.ACTION_TYPES={'load':Roo.form.Action.Load,'submit':Roo.form.Action.Submit};
2283 // Roo/form/Layout.js
2284 Roo.form.Layout=function(A){var B=[];if(A.items){B=A.items;delete A.items;}Roo.form.Layout.superclass.constructor.call(this,A);this.stack=[];Roo.each(B,this.addxtype,this);};Roo.extend(Roo.form.Layout,Roo.Component,{clear:true,labelSeparator:':',hideLabels:false,defaultAutoCreate:{tag:'div',cls:'x-form-ct'}
2285 ,isLayout:true,onRender:function(ct,A){if(this.el){this.el=Roo.get(this.el);}else{var B=this.getAutoCreate();this.el=ct.createChild(B,A);}if(this.style){this.el.applyStyles(this.style);}if(this.labelAlign){this.el.addClass('x-form-label-'+this.labelAlign);
2286 }if(this.hideLabels){this.labelStyle="display:none";this.elementStyle="padding-left:0;";}else{if(typeof this.labelWidth=='number'){this.labelStyle="width:"+this.labelWidth+"px;";this.elementStyle="padding-left:"+((this.labelWidth+(typeof this.labelPad=='number'?this.labelPad:5))+'px')+";";
2287 }if(this.labelAlign=='top'){this.labelStyle="width:auto;";this.elementStyle="padding-left:0;";}}var C=this.stack;var D=C.length;if(D>0){if(!this.fieldTpl){var t=new Roo.Template('<div class="x-form-item {5}">','<label for="{0}" style="{2}">{1}{4}</label>','<div class="x-form-element" id="x-form-el-{0}" style="{3}">','</div>','</div><div class="x-form-clear-left"></div>');
2288 t.disableFormats=true;t.compile();Roo.form.Layout.prototype.fieldTpl=t;}for(var i=0;i<D;i++){if(C[i].isFormField){this.renderField(C[i]);}else{this.renderComponent(C[i]);}}}if(this.clear){this.el.createChild({cls:'x-form-clear'});}},renderField:function(f){f.fieldEl=Roo.get(this.fieldTpl.append(this.el,[f.id,f.fieldLabel,f.labelStyle||this.labelStyle||'',this.elementStyle||'',typeof f.labelSeparator=='undefined'?this.labelSeparator:f.labelSeparator,f.itemCls||this.itemCls||''],true).getPrevSibling());
2289 },renderComponent:function(c){c.render(c.isLayout?this.el:this.el.createChild());},addxtype:function(o){o.form=this.form;var fe=Roo.factory(o,Roo.form);this.form.allItems.push(fe);this.stack.push(fe);if(fe.isFormField){this.form.items.add(fe);}return fe;}
2290 });
2291 // Roo/form/Column.js
2292 Roo.form.Column=function(A){Roo.form.Column.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Column,Roo.form.Layout,{defaultAutoCreate:{tag:'div',cls:'x-form-ct x-form-column'},onRender:function(ct,A){Roo.form.Column.superclass.onRender.call(this,ct,A);
2293 if(this.width){this.el.setWidth(this.width);}}});
2294 // Roo/form/Row.js
2295 Roo.form.Row=function(A){Roo.form.Row.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Row,Roo.form.Layout,{defaultAutoCreate:{tag:'div',cls:'x-form-ct x-form-row'},padWidth:20,onRender:function(ct,A){if(!this.rowTpl){var t=new Roo.Template('<div class="x-form-item {5}" style="float:left;width:{6}px">','<label for="{0}" style="{2}">{1}{4}</label>','<div class="x-form-element" id="x-form-el-{0}" style="{3}">','</div>','</div>');
2296 t.disableFormats=true;t.compile();Roo.form.Layout.prototype.rowTpl=t;}this.fieldTpl=this.rowTpl;var B=100;if((this.labelAlign!='top')){if(typeof this.labelWidth=='number'){B=this.labelWidth}this.padWidth=20+B;}Roo.form.Column.superclass.onRender.call(this,ct,A);
2297 if(this.width){this.el.setWidth(this.width);}if(this.height){this.el.setHeight(this.height);}},renderField:function(f){f.fieldEl=this.fieldTpl.append(this.el,[f.id,f.fieldLabel,f.labelStyle||this.labelStyle||'',this.elementStyle||'',typeof f.labelSeparator=='undefined'?this.labelSeparator:f.labelSeparator,f.itemCls||this.itemCls||'',f.width?f.width+this.padWidth:160+this.padWidth],true);
2298 }});
2299 // Roo/form/FieldSet.js
2300 Roo.form.FieldSet=function(A){Roo.form.FieldSet.superclass.constructor.call(this,A);};Roo.extend(Roo.form.FieldSet,Roo.form.Layout,{defaultAutoCreate:{tag:'fieldset',cn:{tag:'legend'}},onRender:function(ct,A){Roo.form.FieldSet.superclass.onRender.call(this,ct,A);
2301 if(this.legend){this.setLegend(this.legend);}},setLegend:function(A){if(this.rendered){this.el.child('legend').update(A);}}});
2302 // Roo/form/VTypes.js
2303 Roo.form.VTypes=function(){var A=/^[a-zA-Z_]+$/;var B=/^[a-zA-Z0-9_]+$/;var C=/^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,24}$/;var D=/(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;return {'email':function(v){return C.test(v);
2304 },'emailText':'This field should be an e-mail address in the format "user@domain.com"','emailMask':/[a-z0-9_\.\-@]/i,'url':function(v){return D.test(v);},'urlText':'This field should be a URL in the format "http:/'+'/www.domain.com"','alpha':function(v){return A.test(v);
2305 },'alphaText':'This field should only contain letters and _','alphaMask':/[a-z_]/i,'alphanum':function(v){return B.test(v);},'alphanumText':'This field should only contain letters, numbers and _','alphanumMask':/[a-z0-9_]/i};}();
2306 // Roo/form/FCKeditor.js
2307 Roo.form.FCKeditor=function(A){Roo.form.FCKeditor.superclass.constructor.call(this,A);this.addEvents({editorinit:true});};Roo.form.FCKeditor.editors={};Roo.extend(Roo.form.FCKeditor,Roo.form.TextArea,{fckconfig:false,toolbarSet:'Basic',basePath:'/fckeditor/',frame:false,value:'',onRender:function(ct,A){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:300px;height:60px;",autocomplete:"new-password"}
2308 ;}Roo.form.FCKeditor.superclass.onRender.call(this,ct,A);Roo.form.FCKeditor.editors[this.getId()]=this;this.replaceTextarea();},getEditor:function(){return this.fckEditor;},setValue:function(A){if(typeof(A)=='undefined'){return;}Roo.form.FCKeditor.superclass.setValue.apply(this,[A]);
2309 if(!this.getEditor()){return;}this.getEditor().SetData(A);},getValue:function(){if(this.frame&&this.frame.dom.style.display=='none'){return Roo.form.FCKeditor.superclass.getValue.call(this);}if(!this.el||!this.getEditor()){return this.value;}var A=this.getEditor().GetData();
2310 Roo.form.FCKeditor.superclass.setValue.apply(this,[A]);return Roo.form.FCKeditor.superclass.getValue.call(this);},getRawValue:function(){if(this.frame&&this.frame.dom.style.display=='none'){return Roo.form.FCKeditor.superclass.getRawValue.call(this);}if(!this.el||!this.getEditor()){return this.value;
2311 return;}var A=this.getEditor().GetData();Roo.form.FCKeditor.superclass.setRawValue.apply(this,[A]);return Roo.form.FCKeditor.superclass.getRawValue.call(this);},setSize:function(w,h){Roo.form.FCKeditor.superclass.setSize.apply(this,[w,h]);this.frame.dom.setAttribute('width',w);
2312 this.frame.dom.setAttribute('height',h);this.frame.setSize(w,h);},toggleSourceEdit:function(A){this.el.dom.style.display=A?'':'none';this.frame.dom.style.display=A?'none':'';},focus:function(A){if(this.frame.dom.style.display=='none'){return Roo.form.FCKeditor.superclass.focus.call(this);
2313 }if(!this.el||!this.getEditor()){this.focus.defer(100,this,[A]);return;}var B=this.getEditor().EditorDocument.getElementsByTagName(A);this.getEditor().Focus();if(B.length){if(!this.getEditor().Selection.GetSelection()){this.focus.defer(100,this,[A]);return;
2314 }var r=this.getEditor().EditorDocument.createRange();r.setStart(B[0],0);r.setEnd(B[0],0);this.getEditor().Selection.GetSelection().removeAllRanges();this.getEditor().Selection.GetSelection().addRange(r);this.getEditor().Focus();}},replaceTextarea:function(){if(document.getElementById(this.getId()+'___Frame')){return;
2315 }var A=document.getElementById(this.getId());var B=document.getElementsByName(this.getId());A.style.display='none';if(A.tabIndex){this.TabIndex=A.tabIndex;}this._insertHtmlBefore(this._getConfigHtml(),A);this._insertHtmlBefore(this._getIFrameHtml(),A);this.frame=Roo.get(this.getId()+'___Frame')}
2316 ,_getConfigHtml:function(){var A='';for(var o in this.fckconfig){A+=A.length>0?'&amp;':'';A+=encodeURIComponent(o)+'='+encodeURIComponent(this.fckconfig[o]);}return '<input type="hidden" id="'+this.getId()+'___Config" value="'+A+'" style="display:none" />';
2317 },_getIFrameHtml:function(){var A='fckeditor.html';var B=this.basePath+'editor/'+A+'?InstanceName='+encodeURIComponent(this.getId());B+=this.toolbarSet?('&amp;Toolbar='+this.toolbarSet):'';var C='<iframe id="'+this.getId()+'___Frame" src="'+B+'" width="'+this.width+'" height="'+this.height+'"'+(this.tabIndex?' tabindex="'+this.tabIndex+'"':'')+' frameborder="0" scrolling="no"></iframe>';
2318 return C;},_insertHtmlBefore:function(A,B){if(B.insertAdjacentHTML){B.insertAdjacentHTML('beforeBegin',A);}else{var C=document.createRange();C.setStartBefore(B);var D=C.createContextualFragment(A);B.parentNode.insertBefore(D,B);}}});function FCKeditor_OnComplete(A){var f=Roo.form.FCKeditor.editors[A.Name];
2319 f.fckEditor=A;f.fireEvent('editorinit',f,A);}
2320 // Roo/form/GridField.js
2321 Roo.form.GridField=function(A){Roo.form.GridField.superclass.constructor.call(this,A);};Roo.extend(Roo.form.GridField,Roo.form.Field,{width:100,height:50,xgrid:false,defaultAutoCreate:{tag:'input',type:'hidden',autocomplete:'new-password'},addTitle:false,onResize:function(){Roo.form.Field.superclass.onResize.apply(this,arguments);
2322 },initEvents:function(){},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){this.style=this.style||'overflow: hidden; border:1px solid #c3daf9;';var B=this.style;delete this.style;Roo.form.GridField.superclass.onRender.call(this,ct,A);
2323 this.wrap=this.el.wrap({cls:''});this.viewEl=this.wrap.createChild({tag:'div'});if(B){this.viewEl.applyStyles(B);}if(this.width){this.viewEl.setWidth(this.width);}if(this.height){this.viewEl.setHeight(this.height);}this.grid=new Roo.grid[this.xgrid.xtype](this.viewEl,this.xgrid);
2324 this.grid.render();this.grid.getDataSource().on('remove',this.refreshValue,this);this.grid.getDataSource().on('update',this.refreshValue,this);this.grid.on('afteredit',this.refreshValue,this);},setValue:function(v){v=v||[];if(this.grid&&this.grid.getDataSource()&&typeof(v)!='undefined'){var ds=this.grid.getDataSource();
2325 var A={};A[ds.reader.meta.root]=typeof(v)=='string'?Roo.decode(v):v;ds.loadData(A);}if(this.grid.sm){this.grid.sm.clearSelections();}Roo.form.GridField.superclass.setValue.call(this,v);this.refreshValue();},refreshValue:function(){var A=[];this.grid.getDataSource().each(function(r){A.push(r.data);
2326 });this.el.dom.value=Roo.encode(A);}});
2327 // Roo/form/DisplayField.js
2328 Roo.form.DisplayField=function(A){Roo.form.DisplayField.superclass.constructor.call(this,A);this.addEvents({close:true});};Roo.extend(Roo.form.DisplayField,Roo.form.TextField,{inputType:'hidden',allowBlank:true,readOnly:true,focusClass:undefined,fieldClass:'x-form-field',valueRenderer:undefined,width:100,closable:false,onResize:function(){Roo.form.DisplayField.superclass.onResize.apply(this,arguments);
2329 },initEvents:function(){if(this.closable){this.closeEl.on('click',this.onClose,this);}},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},onRender:function(ct,A){Roo.form.DisplayField.superclass.onRender.call(this,ct,A);
2330 this.wrap=this.el.wrap();this.viewEl=this.wrap.createChild({tag:'div',cls:'x-form-displayfield'});if(this.closable){this.closeEl=this.wrap.createChild({tag:'div',cls:'x-dlg-close'});}if(this.bodyStyle){this.viewEl.applyStyles(this.bodyStyle);}this.setValue(this.value);
2331 },onClick:function(){},setValue:function(v){this.value=v;var A=this.valueRenderer?this.valueRenderer(v):String.format('{0}',v);if(!this.viewEl){return;}this.viewEl.dom.innerHTML=A;Roo.form.DisplayField.superclass.setValue.call(this,v);},onClose:function(e){e.preventDefault();
2332 this.fireEvent('close',this);}});
2333 // Roo/form/DayPicker.js
2334 Roo.form.DayPicker=function(A){Roo.form.DayPicker.superclass.constructor.call(this,A);};Roo.extend(Roo.form.DayPicker,Roo.form.Field,{focusClass:undefined,fieldClass:"x-form-field",defaultAutoCreate:{tag:"input",type:'hidden',autocomplete:"new-password"},actionMode:'viewEl',inputType:'hidden',inputElement:false,basedOn:false,isFormField:true,onResize:function(){Roo.form.Checkbox.superclass.onResize.apply(this,arguments);
2335 if(!this.boxLabel){this.el.alignTo(this.wrap,'c-c');}},initEvents:function(){Roo.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this);},getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;
2336 },onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:'x-form-daypick-item '});var r1='<table><tr>';var r2='<tr class="x-form-daypick-icons">';for(var i=0;i<7;i++){r1+='<td><div>'+Date.dayNames[i].substring(0,3)+'</div></td>';
2337 r2+='<td><img class="x-menu-item-icon" src="'+Roo.BLANK_IMAGE_URL+'"></td>';}var B=this.wrap.createChild(r1+'</tr>'+r2+'</tr></table>');B.select('img').on('click',this.onClick,this);this.viewEl=B;this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange',this.setFromHidden,this);
2338 },initValue:Roo.emptyFn,getValue:function(){return this.el.dom.value;},onClick:function(e){Roo.get(e.target).toggleClass('x-menu-item-checked');this.refreshValue();},refreshValue:function(){var A='';this.viewEl.select('img',true).each(function(e,i,n){A+=e.is(".x-menu-item-checked")?String(n):'';
2339 });this.setValue(A,true);},setValue:function(v,A){if(!this.el.dom){return;}var B=this.el.dom.value;this.el.dom.value=v;if(A){return;}this.viewEl.select('img',true).each(function(e,i,n){var on=e.is(".x-menu-item-checked");var C=v.indexOf(String(n))>-1;if(on!=C){e.toggleClass('x-menu-item-checked');
2340 }});this.fireEvent('change',this,v,B);},setFromHidden:function(){if(!this.el){return;}this.setValue(this.el.dom.value);},onDestroy:function(){if(this.viewEl){Roo.get(this.viewEl).remove();}Roo.form.DayPicker.superclass.onDestroy.call(this);}});
2341 // Roo/form/ComboCheck.js
2342 Roo.form.ComboCheck=function(A){Roo.form.ComboCheck.superclass.constructor.call(this,A);var B=['hiddenName','displayField','valueField'];var _t=this;Roo.each(B,function(e){if((typeof(_t[e])=='undefined')||!_t[e].length){throw "Roo.form.ComboCheck : missing value for: "+e;
2343 }});};Roo.extend(Roo.form.ComboCheck,Roo.form.ComboBox,{editable:false,selectedClass:'x-menu-item-checked',onRender:function(ct,A){var _t=this;if(!this.tpl){var B='x-combo-list';this.tpl=new Roo.Template({html:'<div class="'+B+'-item x-menu-check-item">'+'<img class="x-menu-item-icon" style="margin: 0px;" src="'+Roo.BLANK_IMAGE_URL+'">'+'<span>{'+this.displayField+'}</span>'+'</div>'}
2344 );}Roo.form.ComboCheck.superclass.onRender.call(this,ct,A);this.view.singleSelect=false;this.view.multiSelect=true;this.view.toggleSelect=true;this.pageTb.add(new Roo.Toolbar.Fill(),{text:'Done',handler:function(){_t.collapse();}});},onViewOver:function(e,t){return;
2345 },onViewClick:function(A,B){return;},select:function(){},selectByValue:function(xv,A){var ar=this.getValueArray();var B=[];Roo.each(ar,function(v){if(v===undefined||v===null){return;}var r=this.findRecord(this.valueField,v);if(r){B.push(this.store.indexOf(r))}
2346 },this);this.view.select(B);return false;},onSelect:function(A,B){this.view.clearSelections();this.setValue('[]');if(this.value!=this.valueBefore){this.fireEvent('change',this,this.value,this.valueBefore);this.valueBefore=this.value;}},getValueArray:function(){var ar=[];
2347 try{if(typeof(this.value)=='undefined'){return [];}var ar=Roo.decode(this.value);return ar instanceof Array?ar:[];}catch(e){Roo.log(e+"\nRoo.form.ComboCheck:getValueArray  invalid data:"+this.getValue());return [];}},expand:function(){Roo.form.ComboCheck.superclass.expand.call(this);
2348 this.valueBefore=typeof(this.value)=='undefined'?'':this.value;},collapse:function(){Roo.form.ComboCheck.superclass.collapse.call(this);var sl=this.view.getSelectedIndexes();var st=this.store;var nv=[];var tv=[];var r;Roo.each(sl,function(i){r=st.getAt(i);
2349 nv.push(r.get(this.valueField));},this);this.setValue(Roo.encode(nv));if(this.value!=this.valueBefore){this.fireEvent('change',this,this.value,this.valueBefore);this.valueBefore=this.value;}},setValue:function(v){this.value=v;var A=this.getValueArray();var tv=[];
2350 Roo.each(A,function(k){var r=this.findRecord(this.valueField,k);if(r){tv.push(r.data[this.displayField]);}else if(this.valueNotFoundText!==undefined){tv.push(this.valueNotFoundText);}},this);Roo.form.ComboBox.superclass.setValue.call(this,tv.join(', '));this.hiddenField.value=v;
2351 this.value=v;}});
2352 // Roo/form/Signature.js
2353 Roo.form.Signature=function(A){Roo.form.Signature.superclass.constructor.call(this,A);this.addEvents({'confirm':true,'reset':true});};Roo.extend(Roo.form.Signature,Roo.form.Field,{labels:{clear:"Clear",confirm:"Confirm"},width:300,height:100,allowBlank:false,signPanel:{}
2354 ,isMouseDown:false,isConfirmed:false,signatureTmp:'',defaultAutoCreate:{tag:"input",type:"hidden"},onRender:function(ct,A){Roo.form.Signature.superclass.onRender.call(this,ct,A);this.wrap=this.el.wrap({cls:'x-form-signature-wrap',style:'width: '+this.width+'px',cn:{cls:'x-form-signature'}
2355 });this.createToolbar(this);this.signPanel=this.wrap.createChild({tag:'div',style:'width: '+this.width+'px; height: '+this.height+'px; border: 0;'},this.el);this.svgID=Roo.id();this.svgEl=this.signPanel.createChild({xmlns:'http://www.w3.org/2000/svg',tag:'svg',id:this.svgID+"-svg",width:this.width,height:this.height,viewBox:'0 0 '+this.width+' '+this.height,cn:[{tag:"rect",id:this.svgID+"-svg-r",width:this.width,height:this.height,fill:"#ffa"}
2356 ,{tag:"line",id:this.svgID+"-svg-l",x1:"0",y1:(this.height*0.8),x2:this.width,y2:(this.height*0.8),'stroke':"#666",'stroke-width':"1",'stroke-dasharray':"3",'shape-rendering':"crispEdges",'pointer-events':"none"},{tag:"path",id:this.svgID+"-svg-p",'stroke':"navy",'stroke-width':"3",'fill':"none",'pointer-events':'none'}
2357 ]});this.createSVG();this.svgBox=this.svgEl.dom.getScreenCTM();},createSVG:function(){var A=this.signPanel;var r=A.select('#'+this.svgID+'-svg-r',true).first().dom;var t=this;r.addEventListener('mousedown',function(e){return t.down(e);},false);r.addEventListener('mousemove',function(e){return t.move(e);
2358 },false);r.addEventListener('mouseup',function(e){return t.up(e);},false);r.addEventListener('mouseout',function(e){return t.up(e);},false);r.addEventListener('touchstart',function(e){return t.down(e);},false);r.addEventListener('touchmove',function(e){return t.move(e);
2359 },false);r.addEventListener('touchend',function(e){return t.up(e);},false);},isTouchEvent:function(e){return e.type.match(/^touch/);},getCoords:function(e){var pt=this.svgEl.dom.createSVGPoint();pt.x=e.clientX;pt.y=e.clientY;if(this.isTouchEvent(e)){pt.x=e.targetTouches[0].clientX;
2360 pt.y=e.targetTouches[0].clientY;}var a=this.svgEl.dom.getScreenCTM();var b=a.inverse();var mx=pt.matrixTransform(b);return mx.x+','+mx.y;},down:function(e){this.signatureTmp+='M'+this.getCoords(e)+' ';this.signPanel.select('#'+this.svgID+'-svg-p',true).first().attr('d',this.signatureTmp);
2361 this.isMouseDown=true;e.preventDefault();},move:function(e){if(this.isMouseDown){this.signatureTmp+='L'+this.getCoords(e)+' ';this.signPanel.select('#'+this.svgID+'-svg-p',true).first().attr('d',this.signatureTmp);}e.preventDefault();},up:function(e){this.isMouseDown=false;
2362 var sp=this.signatureTmp.split(' ');if(sp.length>1){if(!sp[sp.length-2].match(/^L/)){sp.pop();sp.pop();sp.push("");this.signatureTmp=sp.join(" ");}}if(this.getValue()!=this.signatureTmp){this.signPanel.select('#'+this.svgID+'-svg-r',true).first().attr('fill','#ffa');
2363 this.isConfirmed=false;}e.preventDefault();},createToolbar:function(A){function btn(id,B,C){var D=fid+'-'+id;return {id:D,cmd:id,cls:'x-btn-icon x-edit-'+id,enableToggle:B!==false,scope:A,handler:C||A.relayBtnCmd,clickEvent:'mousedown',tooltip:etb.buttonTips[id]||undefined,tabIndex:-1}
2364 ;}var tb=new Roo.Toolbar(A.wrap.dom.firstChild);this.tb=tb;this.tb.add({cls:' x-signature-btn x-signature-'+id,scope:A,handler:this.reset,clickEvent:'mousedown',text:this.labels.clear},{xtype:'Fill',xns:Roo.Toolbar},{cls:'  x-signature-btn x-signature-'+id,scope:A,handler:this.confirmHandler,clickEvent:'mousedown',text:this.labels.confirm}
2365 );},getImageDataURI:function(){var A=this.svgEl.dom.parentNode.innerHTML;var B='data:image/svg+xml;base64,'+window.btoa(A);return B;},getConfirmed:function(){return this.isConfirmed;},getWidth:function(){return this.width;},getHeight:function(){return this.height;
2366 },getSignature:function(){return this.signatureTmp;},reset:function(){this.signatureTmp='';this.signPanel.select('#'+this.svgID+'-svg-r',true).first().attr('fill','#ffa');this.signPanel.select('#'+this.svgID+'-svg-p',true).first().attr('d','');this.isConfirmed=false;
2367 Roo.form.Signature.superclass.reset.call(this);},setSignature:function(s){this.signatureTmp=s;this.signPanel.select('#'+this.svgID+'-svg-r',true).first().attr('fill','#ffa');this.signPanel.select('#'+this.svgID+'-svg-p',true).first().attr('d',s);this.setValue(s);
2368 this.isConfirmed=false;Roo.form.Signature.superclass.reset.call(this);},test:function(){},setConfirmed:function(){},confirmHandler:function(){if(!this.getSignature()){return;}this.signPanel.select('#'+this.svgID+'-svg-r',true).first().attr('fill','#cfc');
2369 this.setValue(this.getSignature());this.isConfirmed=true;this.fireEvent('confirm',this);},validateValue:function(A){if(this.allowBlank){return true;}if(this.isConfirmed){return true;}return false;}});
2370 // Roo/form/Select.js
2371 Roo.form.Select=function(A){Roo.form.Select.superclass.constructor.call(this,A);};Roo.extend(Roo.form.Select,Roo.form.ComboBox,{defaultAutoCreate:{tag:"select"},listWidth:undefined,displayField:undefined,valueField:undefined,hiddenName:undefined,listClass:'',selectedClass:'x-combo-selected',triggerClass:'x-form-arrow-trigger',shadow:'sides',listAlign:'tl-bl?',maxHeight:300,triggerAction:'query',minChars:4,typeAhead:false,queryDelay:500,pageSize:0,selectOnFocus:false,queryParam:'query',loadingText:'Loading...',resizable:false,handleHeight:8,editable:true,allQuery:'',mode:'remote',minListWidth:70,forceSelection:false,typeAheadDelay:250,valueNotFoundText:undefined,defaultValue:'',blockFocus:false,disableClear:false,alwaysQuery:false,addicon:false,editicon:false,onRender:function(ct,A){Roo.form.Field.prototype.onRender.call(this,ct,A);
2372 if(this.store){this.store.on('beforeload',this.onBeforeLoad,this);this.store.on('load',this.onLoad,this);this.store.on('loadexception',this.onLoadException,this);this.store.load({});}},initEvents:function(){},onDestroy:function(){if(this.store){this.store.un('beforeload',this.onBeforeLoad,this);
2373 this.store.un('load',this.onLoad,this);this.store.un('loadexception',this.onLoadException,this);}},fireKey:function(e){if(e.isNavKeyPress()&&!this.list.isVisible()){this.fireEvent("specialkey",this,e);}},onResize:function(w,h){return;},setEditable:function(A){}
2374 ,onBeforeLoad:function(){Roo.log("Select before load");return;this.innerList.update(this.loadingText?'<div class="loading-indicator">'+this.loadingText+'</div>':'');this.selectedIndex=-1;},onLoad:function(){var A=this.el.dom;A.innerHTML='';var od=A.ownerDocument;
2375 if(this.emptyText){var op=od.createElement('option');op.setAttribute('value','');op.innerHTML=String.format('{0}',this.emptyText);A.appendChild(op);}if(this.store.getCount()>0){var vf=this.valueField;var df=this.displayField;this.store.data.each(function(r){var op=od.createElement('option');
2376 op.setAttribute('value',r.data[vf]);op.innerHTML=String.format('{0}',r.data[df]);A.appendChild(op);});if(typeof(this.defaultValue!='undefined')){this.setValue(this.defaultValue);}}else{}},onLoadException:function(){dom.innerHTML='';Roo.log("Select on load exception");
2377 return;this.collapse();Roo.log(this.store.reader.jsonData);if(this.store&&typeof(this.store.reader.jsonData.errorMsg)!='undefined'){Roo.MessageBox.alert("Error loading",this.store.reader.jsonData.errorMsg);}},onTypeAhead:function(){},onSelect:function(A,B){Roo.log('on select?');
2378 return;if(this.fireEvent('beforeselect',this,A,B)!==false){this.setFromData(B>-1?A.data:false);this.collapse();this.fireEvent('select',this,A,B);}},getValue:function(){var A=this.el.dom;this.value=A.options[A.selectedIndex].value;return this.value;},clearValue:function(){this.value='';
2379 this.el.dom.selectedIndex=this.emptyText?0:-1;},setValue:function(v){var d=this.el.dom;for(var i=0;i<d.options.length;i++){if(v==d.options[i].value){d.selectedIndex=i;this.value=v;return;}}this.clearValue();},lastData:false,setFromData:function(o){Roo.log('setfrom data?');
2380 },reset:function(){this.clearValue();},findRecord:function(A,B){return false;var C;if(this.store.getCount()>0){this.store.each(function(r){if(r.data[A]==B){C=r;return false;}return true;});}return C;},getName:function(){if(!this.rendered){return ''};return !this.hiddenName&&this.el.dom.name?this.el.dom.name:(this.hiddenName||'');
2381 },onEmptyResults:function(){Roo.log('empty results');},isExpanded:function(){return false;},selectByValue:function(v,A){Roo.log('select By Value');return false;if(v!==undefined&&v!==null){var r=this.findRecord(this.valueField||this.displayField,v);if(r){this.select(this.store.indexOf(r),A);
2382 return true;}}return false;},select:function(A,B){Roo.log('select ');return;this.selectedIndex=A;this.view.select(A);if(B!==false){var el=this.view.getNode(A);if(el){this.innerList.scrollChildIntoView(el,false);}}},validateBlur:function(){return;},initQuery:function(){this.doQuery(this.getRawValue());
2383 },doForce:function(){if(this.el.dom.value.length>0){this.el.dom.value=this.lastSelectionText===undefined?'':this.lastSelectionText;}},doQuery:function(q,A){Roo.log('doQuery?');if(q===undefined||q===null){q='';}var qe={query:q,forceAll:A,combo:this,cancel:false}
2384 ;if(this.fireEvent('beforequery',qe)===false||qe.cancel){return false;}q=qe.query;A=qe.forceAll;if(A===true||(q.length>=this.minChars)){if(this.lastQuery!=q||this.alwaysQuery){this.lastQuery=q;if(this.mode=='local'){this.selectedIndex=-1;if(A){this.store.clearFilter();
2385 }else{this.store.filter(this.displayField,q);}this.onLoad();}else{this.store.baseParams[this.queryParam]=q;this.store.load({params:this.getParams(q)});this.expand();}}else{this.selectedIndex=-1;this.onLoad();}}},getParams:function(q){var p={};if(this.pageSize){p.start=0;
2386 p.limit=this.pageSize;}return p;},collapse:function(){},collapseIf:function(e){},expand:function(){},setWidth:function(){},getResizeEl:function(){return this.el;}});
2387 // Roo/DDView.js
2388 Roo.DDView=function(A,B,C){Roo.DDView.superclass.constructor.apply(this,arguments);this.getEl().setStyle("outline","0px none");this.getEl().unselectable();if(this.dragGroup){this.setDraggable(this.dragGroup.split(","));}if(this.dropGroup){this.setDroppable(this.dropGroup.split(","));
2389 }if(this.deletable){this.setDeletable();}this.isDirtyFlag=false;this.addEvents({"drop":true});};Roo.extend(Roo.DDView,Roo.View,{isFormField:true,reset:Roo.emptyFn,clearInvalid:Roo.form.Field.prototype.clearInvalid,validate:function(){return true;},destroy:function(){this.purgeListeners();
2390 this.getEl.removeAllListeners();this.getEl().remove();if(this.dragZone){if(this.dragZone.destroy){this.dragZone.destroy();}}if(this.dropZone){if(this.dropZone.destroy){this.dropZone.destroy();}}},getName:function(){return this.name;},setValue:function(v){if(!this.store){throw "DDView.setValue(). DDView must be constructed with a valid Store";
2391 }var A={};A[this.store.reader.meta.root]=v?[].concat(v):[];this.store.proxy=new Roo.data.MemoryProxy(A);this.store.load();},getValue:function(){var A='(';this.store.each(function(B){A+=B.id+',';});return A.substr(0,A.length-1)+')';},getIds:function(){var i=0,A=new Array(this.store.getCount());
2392 this.store.each(function(B){A[i++]=B.id;});return A;},isDirty:function(){return this.isDirtyFlag;},getTargetFromEvent:function(e){var A=e.getTarget();while((A!==null)&&(A.parentNode!=this.el.dom)){A=A.parentNode;}if(!A){A=this.el.dom.lastChild||this.el.dom;
2393 }return A;},getDragData:function(e){var A=this.findItemFromChild(e.getTarget());if(A){this.handleSelection(e);var B=this.getSelectedNodes();var C={source:this,copy:this.copy||(this.allowCopy&&e.ctrlKey),nodes:B,records:[]};var D=this.getSelectedIndexes();
2394 for(var i=0;i<D.length;i++){C.records.push(this.store.getAt(D[i]));}if(B.length==1){C.ddel=A.cloneNode(true);}else{var E=document.createElement('div');E.className='multi-proxy';for(var i=0,F=B.length;i<F;i++){E.appendChild(B[i].cloneNode(true));}C.ddel=E;
2395 }return C;}return false;},setDraggable:function(A){if(A instanceof Array){Roo.each(A,this.setDraggable,this);return;}if(this.dragZone){this.dragZone.addToGroup(A);}else{this.dragZone=new Roo.dd.DragZone(this.getEl(),{containerScroll:true,ddGroup:A});if(!this.multiSelect){this.singleSelect=true;
2396 }this.dragZone.getDragData=this.getDragData.createDelegate(this);}},setDroppable:function(A){if(A instanceof Array){Roo.each(A,this.setDroppable,this);return;}if(this.dropZone){this.dropZone.addToGroup(A);}else{this.dropZone=new Roo.dd.DropZone(this.getEl(),{containerScroll:true,ddGroup:A}
2397 );this.dropZone.getTargetFromEvent=this.getTargetFromEvent.createDelegate(this);this.dropZone.onNodeEnter=this.onNodeEnter.createDelegate(this);this.dropZone.onNodeOver=this.onNodeOver.createDelegate(this);this.dropZone.onNodeOut=this.onNodeOut.createDelegate(this);
2398 this.dropZone.onNodeDrop=this.onNodeDrop.createDelegate(this);}},getDropPoint:function(e,n,dd){if(n==this.el.dom){return "above";}var t=Roo.lib.Dom.getY(n),b=t+n.offsetHeight;var c=t+(b-t)/2;var y=Roo.lib.Event.getPageY(e);if(y<=c){return "above";}else{return "below";
2399 }},onNodeEnter:function(n,dd,e,A){return false;},onNodeOver:function(n,dd,e,A){var pt=this.getDropPoint(e,n,dd);var B=this.dropNotAllowed;if(pt){var C;if(pt=="above"){B=n.previousSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-above";C="x-view-drag-insert-above";
2400 }else{B=n.nextSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-below";C="x-view-drag-insert-below";}if(this.lastInsertClass!=C){Roo.fly(n).replaceClass(this.lastInsertClass,C);this.lastInsertClass=C;}}return B;},onNodeOut:function(n,dd,e,A){this.removeDropIndicators(n);
2401 },onNodeDrop:function(n,dd,e,A){if(this.fireEvent("drop",this,n,dd,e,A)===false){return false;}var pt=this.getDropPoint(e,n,dd);var B=(n==this.el.dom)?this.nodes.length:n.nodeIndex;if(pt=="below"){B++;}for(var i=0;i<A.records.length;i++){var r=A.records[i];
2402 var C=this.store.getById(r.id);if(C&&(dd!=this.dragZone)){Roo.fly(this.getNode(this.store.indexOf(C))).frame("red",1);}else{if(A.copy){this.store.insert(B++,r.copy());}else{A.source.isDirtyFlag=true;r.store.remove(r);this.store.insert(B++,r);}this.isDirtyFlag=true;
2403 }}this.dragZone.cachedTarget=null;return true;},removeDropIndicators:function(n){if(n){Roo.fly(n).removeClass(["x-view-drag-insert-above","x-view-drag-insert-below"]);this.lastInsertClass="_noclass";}},setDeletable:function(A){if(!this.singleSelect&&!this.multiSelect){this.singleSelect=true;
2404 }var c=this.getContextMenu();this.contextMenu.on("itemclick",function(B){switch(B.id){case "delete":this.remove(this.getSelectedIndexes());break;}},this);this.contextMenu.add({icon:A,id:"delete",text:'Delete'});},getContextMenu:function(){if(!this.contextMenu){this.contextMenu=new Roo.menu.Menu({id:this.id+"-contextmenu"}
2405 );this.el.on("contextmenu",this.showContextMenu,this);}return this.contextMenu;},disableContextMenu:function(){if(this.contextMenu){this.el.un("contextmenu",this.showContextMenu,this);}},showContextMenu:function(e,A){A=this.findItemFromChild(e.getTarget());
2406 if(A){e.stopEvent();this.select(this.getNode(A),this.multiSelect&&e.ctrlKey,true);this.contextMenu.showAt(e.getXY());}},remove:function(A){A=[].concat(A);for(var i=0;i<A.length;i++){var B=this.store.getAt(A[i]);this.store.remove(B);}},onDblClick:function(e){var A=this.findItemFromChild(e.getTarget());
2407 if(A){if(this.fireEvent("dblclick",this,this.indexOf(A),A,e)===false){return false;}if(this.dragGroup){var B=Roo.dd.DragDropMgr.getRelated(this.dragZone,true);while(B.indexOf(this.dropZone)>-1){B.remove(this.dropZone);}if(B.length==1){this.dragZone.cachedTarget=null;
2408 var el=Roo.get(B[0].getEl());var C=el.getBox(true);B[0].onNodeDrop(el.dom,{target:el.dom,xy:[C.x,C.y+C.height-1]},null,this.getDragData(e));}}}},handleSelection:function(e){this.dragZone.cachedTarget=null;var A=this.findItemFromChild(e.getTarget());if(!A){this.clearSelections(true);
2409 return;}if(A&&(this.multiSelect||this.singleSelect)){if(this.multiSelect&&e.shiftKey&&(!e.ctrlKey)&&this.lastSelection){this.select(this.getNodes(this.indexOf(this.lastSelection),A.nodeIndex),false);}else if(this.isSelected(this.getNode(A))&&e.ctrlKey){this.unselect(A);
2410 }else{this.select(A,this.multiSelect&&e.ctrlKey);this.lastSelection=A;}}},onItemClick:function(A,B,e){if(this.fireEvent("beforeclick",this,B,A,e)===false){return false;}return true;},unselect:function(A,B){var C=this.getNode(A);if(C&&this.isSelected(C)){if(this.fireEvent("beforeselect",this,C,this.selections)!==false){Roo.fly(C).removeClass(this.selectedClass);
2411 this.selections.remove(C);if(!B){this.fireEvent("selectionchange",this,this.selections);}}}}});
2412 // Roo/LayoutManager.js
2413 Roo.LayoutManager=function(A,B){Roo.LayoutManager.superclass.constructor.call(this);this.el=Roo.get(A);if(this.el.dom==document.body&&Roo.isIE&&!B.allowScroll){document.body.scroll="no";}else if(this.el.dom!=document.body&&this.el.getStyle('position')=='static'){this.el.position('relative');
2414 }this.id=this.el.id;this.el.addClass("x-layout-container");this.monitorWindowResize=true;this.regions={};this.addEvents({"layout":true,"regionresized":true,"regioncollapsed":true,"regionexpanded":true});this.updating=false;Roo.EventManager.onWindowResize(this.onWindowResize,this,true);
2415 };Roo.extend(Roo.LayoutManager,Roo.util.Observable,{isUpdating:function(){return this.updating;},beginUpdate:function(){this.updating=true;},endUpdate:function(A){this.updating=false;if(!A){this.layout();}},layout:function(){},onRegionResized:function(A,B){this.fireEvent("regionresized",A,B);
2416 this.layout();},onRegionCollapsed:function(A){this.fireEvent("regioncollapsed",A);},onRegionExpanded:function(A){this.fireEvent("regionexpanded",A);},getViewSize:function(){var A;if(this.el.dom!=document.body){A=this.el.getSize();}else{A={width:Roo.lib.Dom.getViewWidth(),height:Roo.lib.Dom.getViewHeight()}
2417 ;}A.width-=this.el.getBorderWidth("lr")-this.el.getPadding("lr");A.height-=this.el.getBorderWidth("tb")-this.el.getPadding("tb");return A;},getEl:function(){return this.el;},getRegion:function(A){return this.regions[A.toLowerCase()];},onWindowResize:function(){if(this.monitorWindowResize){this.layout();
2418 }}});
2419 // Roo/BorderLayout.js
2420 Roo.BorderLayout=function(A,B){B=B||{};Roo.BorderLayout.superclass.constructor.call(this,A,B);this.factory=B.factory||Roo.BorderLayout.RegionFactory;for(var i=0,C=this.factory.validRegions.length;i<C;i++){var D=this.factory.validRegions[i];if(B[D]){this.addRegion(D,B[D]);
2421 }}};Roo.extend(Roo.BorderLayout,Roo.LayoutManager,{addRegion:function(A,B){if(!this.regions[A]){var r=this.factory.create(A,this,B);this.bindRegion(A,r);}return this.regions[A];},bindRegion:function(A,r){this.regions[A]=r;r.on("visibilitychange",this.layout,this);
2422 r.on("paneladded",this.layout,this);r.on("panelremoved",this.layout,this);r.on("invalidated",this.layout,this);r.on("resized",this.onRegionResized,this);r.on("collapsed",this.onRegionCollapsed,this);r.on("expanded",this.onRegionExpanded,this);},layout:function(){if(this.updating){return;
2423 }var A=this.getViewSize();var w=A.width;var h=A.height;var B=w;var C=h;var D=0;var E=0;var rs=this.regions;var F=rs["north"];var G=rs["south"];var H=rs["west"];var I=rs["east"];var J=rs["center"];if(F&&F.isVisible()){var b=F.getBox();var m=F.getMargins();
2424 b.width=w-(m.left+m.right);b.x=m.left;b.y=m.top;D=b.height+b.y+m.bottom;C-=D;F.updateBox(this.safeBox(b));}if(G&&G.isVisible()){var b=G.getBox();var m=G.getMargins();b.width=w-(m.left+m.right);b.x=m.left;var K=(b.height+m.top+m.bottom);b.y=h-K+m.top;C-=K;
2425 G.updateBox(this.safeBox(b));}if(H&&H.isVisible()){var b=H.getBox();var m=H.getMargins();b.height=C-(m.top+m.bottom);b.x=m.left;b.y=D+m.top;var L=(b.width+m.left+m.right);E+=L;B-=L;H.updateBox(this.safeBox(b));}if(I&&I.isVisible()){var b=I.getBox();var m=I.getMargins();
2426 b.height=C-(m.top+m.bottom);var L=(b.width+m.left+m.right);b.x=w-L+m.left;b.y=D+m.top;B-=L;I.updateBox(this.safeBox(b));}if(J){var m=J.getMargins();var M={x:E+m.left,y:D+m.top,width:B-(m.left+m.right),height:C-(m.top+m.bottom)};J.updateBox(this.safeBox(M));
2427 }this.el.repaint();this.fireEvent("layout",this);},safeBox:function(A){A.width=Math.max(0,A.width);A.height=Math.max(0,A.height);return A;},add:function(A,B){A=A.toLowerCase();return this.regions[A].add(B);},remove:function(A,B){A=A.toLowerCase();return this.regions[A].remove(B);
2428 },findPanel:function(A){var rs=this.regions;for(var B in rs){if(typeof rs[B]!="function"){var p=rs[B].getPanel(A);if(p){return p;}}}return null;},showPanel:function(A){var rs=this.regions;for(var B in rs){var r=rs[B];if(typeof r!="function"){if(r.hasPanel(A)){return r.showPanel(A);
2429 }}}return null;},restoreState:function(A){if(!A){A=Roo.state.Manager;}var sm=new Roo.LayoutStateManager();sm.init(this,A);},batchAdd:function(A){this.beginUpdate();for(var B in A){var lr=this.regions[B];if(lr){this.addTypedPanels(lr,A[B]);}}this.endUpdate();
2430 },addTypedPanels:function(lr,ps){if(typeof ps=='string'){lr.add(new Roo.ContentPanel(ps));}else if(ps instanceof Array){for(var i=0,A=ps.length;i<A;i++){this.addTypedPanels(lr,ps[i]);}}else if(!ps.events){var el=ps.el;delete ps.el;lr.add(new Roo.ContentPanel(el||Roo.id(),ps));
2431 }else{lr.add(ps);}},addxtype:function(A){if(!A.xtype.match(/Panel$/)){return false;}var B=false;if(typeof(A.region)=='undefined'){Roo.log("Failed to add Panel, region was not set");Roo.log(A);return false;}var C=A.region;delete A.region;var D=[];if(A.items){D=A.items;
2432 delete A.items;}var nb=false;switch(A.xtype){case 'ContentPanel':case 'ScrollPanel':case 'ViewPanel':if(A.autoCreate){B=new Roo[A.xtype](A);}else{var el=this.el.createChild();B=new Roo[A.xtype](el,A);}this.add(C,B);break;case 'TreePanel':A.el=this.el.createChild();
2433 B=new Roo[A.xtype](A);this.add(C,B);break;case 'NestedLayoutPanel':var el=this.el.createChild();var E=A.layout;delete A.layout;E.items=E.items||[];D=E.items;if(C=='center'&&this.active&&this.getRegion('center').panels.length<1){A.background=false;}var F=new Roo.BorderLayout(el,E);
2434 B=new Roo[A.xtype](F,A);this.add(C,B);nb={};break;case 'GridPanel':var el=this.el.createChild();var G=new Roo.grid[A.grid.xtype](el,A.grid);delete A.grid;if(C=='center'&&this.active){A.background=false;}B=new Roo[A.xtype](G,A);this.add(C,B);if(A.background){B.on('activate',function(gp){if(!gp.grid.rendered){gp.grid.render();
2435 }});}else{G.render();}break;default:if(typeof(Roo[A.xtype])!='undefined'){B=new Roo[A.xtype](A);this.add(C,B);}else{alert("Can not add '"+A.xtype+"' to BorderLayout");return null;}}this.beginUpdate();var C='';var H={};Roo.each(D,function(i){C=nb&&i.region?i.region:false;
2436 var I=B.addxtype(i);if(C){nb[C]=nb[C]==undefined?0:nb[C]+1;if(!i.background){H[C]=nb[C];}}});this.endUpdate();if(nb){for(var r in H){C=this.getRegion(r);if(C){C.showPanel(H[r]);}}}return B;}});Roo.BorderLayout.create=function(A,B){var C=new Roo.BorderLayout(B||document.body,A);
2437 C.beginUpdate();var D=Roo.BorderLayout.RegionFactory.validRegions;for(var j=0,E=D.length;j<E;j++){var lr=D[j];if(C.regions[lr]&&A[lr].panels){var r=C.regions[lr];var ps=A[lr].panels;C.addTypedPanels(r,ps);}}C.endUpdate();return C;};Roo.BorderLayout.RegionFactory={validRegions:["north","south","east","west","center"],create:function(A,B,C){A=A.toLowerCase();
2438 if(C.lightweight||C.basic){return new Roo.BasicLayoutRegion(B,C,A);}switch(A){case "north":return new Roo.NorthLayoutRegion(B,C);case "south":return new Roo.SouthLayoutRegion(B,C);case "east":return new Roo.EastLayoutRegion(B,C);case "west":return new Roo.WestLayoutRegion(B,C);
2439 case "center":return new Roo.CenterLayoutRegion(B,C);}throw 'Layout region "'+A+'" not supported.';}};
2440 // Roo/BasicLayoutRegion.js
2441 Roo.BasicLayoutRegion=function(A,B,C,D){this.mgr=A;this.position=C;this.events={"beforeremove":true,"invalidated":true,"visibilitychange":true,"paneladded":true,"panelremoved":true,"beforecollapse":true,"collapsed":true,"expanded":true,"slideshow":true,"slidehide":true,"panelactivated":true,"resized":true}
2442 ;this.panels=new Roo.util.MixedCollection();this.panels.getKey=this.getPanelId.createDelegate(this);this.box=null;this.activePanel=null;if(B.listeners||B.events){Roo.BasicLayoutRegion.superclass.constructor.call(this,{listeners:B.listeners||{},events:B.events||{}
2443 });}if(D!==true){this.applyConfig(B);}};Roo.extend(Roo.BasicLayoutRegion,Roo.util.Observable,{getPanelId:function(p){return p.getId();},applyConfig:function(A){this.margins=A.margins||this.margins||{top:0,left:0,right:0,bottom:0};this.config=A;},resizeTo:function(A){var el=this.el?this.el:(this.activePanel?this.activePanel.getEl():null);
2444 if(el){switch(this.position){case "east":case "west":el.setWidth(A);this.fireEvent("resized",this,A);break;case "north":case "south":el.setHeight(A);this.fireEvent("resized",this,A);break;}}},getBox:function(){return this.activePanel?this.activePanel.getEl().getBox(false,true):null;
2445 },getMargins:function(){return this.margins;},updateBox:function(A){this.box=A;var el=this.activePanel.getEl();el.dom.style.left=A.x+"px";el.dom.style.top=A.y+"px";this.activePanel.setSize(A.width,A.height);},getEl:function(){return this.activePanel;},isVisible:function(){return this.activePanel?true:false;
2446 },setActivePanel:function(A){A=this.getPanel(A);if(this.activePanel&&this.activePanel!=A){this.activePanel.setActiveState(false);this.activePanel.getEl().setLeftTop(-10000,-10000);}this.activePanel=A;A.setActiveState(true);if(this.box){A.setSize(this.box.width,this.box.height);
2447 }this.fireEvent("panelactivated",this,A);this.fireEvent("invalidated");},showPanel:function(A){if(A=this.getPanel(A)){this.setActivePanel(A);}return A;},getActivePanel:function(){return this.activePanel;},add:function(A){if(arguments.length>1){for(var i=0,B=arguments.length;
2448 i<B;i++){this.add(arguments[i]);}return null;}if(this.hasPanel(A)){this.showPanel(A);return A;}var el=A.getEl();if(el.dom.parentNode!=this.mgr.el.dom){this.mgr.el.dom.appendChild(el.dom);}if(A.setRegion){A.setRegion(this);}this.panels.add(A);el.setStyle("position","absolute");
2449 if(!A.background){this.setActivePanel(A);if(this.config.initialSize&&this.panels.getCount()==1){this.resizeTo(this.config.initialSize);}}this.fireEvent("paneladded",this,A);return A;},hasPanel:function(A){if(typeof A=="object"){A=A.getId();}return this.getPanel(A)?true:false;
2450 },remove:function(A,B){A=this.getPanel(A);if(!A){return null;}var e={};this.fireEvent("beforeremove",this,A,e);if(e.cancel===true){return null;}var C=A.getId();this.panels.removeKey(C);return A;},getPanel:function(id){if(typeof id=="object"){return id;}return this.panels.get(id);
2451 },getPosition:function(){return this.position;}});
2452 // Roo/LayoutRegion.js
2453 Roo.LayoutRegion=function(A,B,C){Roo.LayoutRegion.superclass.constructor.call(this,A,B,C,true);var dh=Roo.DomHelper;this.el=dh.append(A.el.dom,{tag:"div",cls:"x-layout-panel x-layout-panel-"+this.position},true);this.titleEl=dh.append(this.el.dom,{tag:"div",unselectable:"on",cls:"x-unselectable x-layout-panel-hd x-layout-title-"+this.position,children:[{tag:"span",cls:"x-unselectable x-layout-panel-hd-text",unselectable:"on",html:"&#160;"}
2454 ,{tag:"div",cls:"x-unselectable x-layout-panel-hd-tools",unselectable:"on"}]},true);this.titleEl.enableDisplayMode();this.titleTextEl=this.titleEl.dom.firstChild;this.tools=Roo.get(this.titleEl.dom.childNodes[1],true);this.closeBtn=this.createTool(this.tools.dom,"x-layout-close");
2455 this.closeBtn.enableDisplayMode();this.closeBtn.on("click",this.closeClicked,this);this.closeBtn.hide();this.createBody(B);this.visible=true;this.collapsed=false;if(B.hideWhenEmpty){this.hide();this.on("paneladded",this.validateVisibility,this);this.on("panelremoved",this.validateVisibility,this);
2456 }this.applyConfig(B);};Roo.extend(Roo.LayoutRegion,Roo.BasicLayoutRegion,{createBody:function(){this.bodyEl=this.el.createChild({tag:"div",cls:"x-layout-panel-body"});},applyConfig:function(c){if(c.collapsible&&this.position!="center"&&!this.collapsedEl){var dh=Roo.DomHelper;
2457 if(c.titlebar!==false){this.collapseBtn=this.createTool(this.tools.dom,"x-layout-collapse-"+this.position);this.collapseBtn.on("click",this.collapse,this);this.collapseBtn.enableDisplayMode();if(c.showPin===true||this.showPin){this.stickBtn=this.createTool(this.tools.dom,"x-layout-stick");
2458 this.stickBtn.enableDisplayMode();this.stickBtn.on("click",this.expand,this);this.stickBtn.hide();}}this.collapsedEl=dh.append(this.mgr.el.dom,{cls:"x-layout-collapsed x-layout-collapsed-"+this.position,children:[{cls:"x-layout-collapsed-tools",children:[{cls:"x-layout-ctools-inner"}
2459 ]}]},true);if(c.floatable!==false){this.collapsedEl.addClassOnOver("x-layout-collapsed-over");this.collapsedEl.on("click",this.collapseClick,this);}if(c.collapsedTitle&&(this.position=="north"||this.position=="south")){this.collapsedTitleTextEl=dh.append(this.collapsedEl.dom,{tag:"div",cls:"x-unselectable x-layout-panel-hd-text",id:"message",unselectable:"on",style:{"float":"left"}
2460 });this.collapsedTitleTextEl.innerHTML=c.collapsedTitle;}this.expandBtn=this.createTool(this.collapsedEl.dom.firstChild.firstChild,"x-layout-expand-"+this.position);this.expandBtn.on("click",this.expand,this);}if(this.collapseBtn){this.collapseBtn.setVisible(c.collapsible==true);
2461 }this.cmargins=c.cmargins||this.cmargins||(this.position=="west"||this.position=="east"?{top:0,left:2,right:2,bottom:0}:{top:2,left:0,right:0,bottom:2});this.margins=c.margins||this.margins||{top:0,left:0,right:0,bottom:0};this.bottomTabs=c.tabPosition!="top";
2462 this.autoScroll=c.autoScroll||false;if(this.autoScroll){this.bodyEl.setStyle("overflow","auto");}else{this.bodyEl.setStyle("overflow","hidden");}if((!c.titlebar&&!c.title)||c.titlebar===false){this.titleEl.hide();}else{this.titleEl.show();if(c.title){this.titleTextEl.innerHTML=c.title;
2463 }}this.duration=c.duration||.30;this.slideDuration=c.slideDuration||.45;this.config=c;if(c.collapsed){this.collapse(true);}if(c.hidden){this.hide();}},isVisible:function(){return this.visible;},setCollapsedTitle:function(A){A=A||"&#160;";if(this.collapsedTitleTextEl){this.collapsedTitleTextEl.innerHTML=A;
2464 }},getBox:function(){var b;if(!this.collapsed){b=this.el.getBox(false,true);}else{b=this.collapsedEl.getBox(false,true);}return b;},getMargins:function(){return this.collapsed?this.cmargins:this.margins;},highlight:function(){this.el.addClass("x-layout-panel-dragover");
2465 },unhighlight:function(){this.el.removeClass("x-layout-panel-dragover");},updateBox:function(A){this.box=A;if(!this.collapsed){this.el.dom.style.left=A.x+"px";this.el.dom.style.top=A.y+"px";this.updateBody(A.width,A.height);}else{this.collapsedEl.dom.style.left=A.x+"px";
2466 this.collapsedEl.dom.style.top=A.y+"px";this.collapsedEl.setSize(A.width,A.height);}if(this.tabs){this.tabs.autoSizeTabs();}},updateBody:function(w,h){if(w!==null){this.el.setWidth(w);w-=this.el.getBorderWidth("rl");if(this.config.adjustments){w+=this.config.adjustments[0];
2467 }}if(h!==null){this.el.setHeight(h);h=this.titleEl&&this.titleEl.isDisplayed()?h-(this.titleEl.getHeight()||0):h;h-=this.el.getBorderWidth("tb");if(this.config.adjustments){h+=this.config.adjustments[1];}this.bodyEl.setHeight(h);if(this.tabs){h=this.tabs.syncHeight(h);
2468 }}if(this.panelSize){w=w!==null?w:this.panelSize.width;h=h!==null?h:this.panelSize.height;}if(this.activePanel){var el=this.activePanel.getEl();w=w!==null?w:el.getWidth();h=h!==null?h:el.getHeight();this.panelSize={width:w,height:h};this.activePanel.setSize(w,h);
2469 }if(Roo.isIE&&this.tabs){this.tabs.el.repaint();}},getEl:function(){return this.el;},hide:function(){if(!this.collapsed){this.el.dom.style.left="-2000px";this.el.hide();}else{this.collapsedEl.dom.style.left="-2000px";this.collapsedEl.hide();}this.visible=false;
2470 this.fireEvent("visibilitychange",this,false);},show:function(){if(!this.collapsed){this.el.show();}else{this.collapsedEl.show();}this.visible=true;this.fireEvent("visibilitychange",this,true);},closeClicked:function(){if(this.activePanel){this.remove(this.activePanel);
2471 }},collapseClick:function(e){if(this.isSlid){e.stopPropagation();this.slideIn();}else{e.stopPropagation();this.slideOut();}},collapse:function(A,B){if(this.collapsed){return;}if(B||this.fireEvent("beforecollapse",this)!=false){this.collapsed=true;if(this.split){this.split.el.hide();
2472 }if(this.config.animate&&A!==true){this.fireEvent("invalidated",this);this.animateCollapse();}else{this.el.setLocation(-20000,-20000);this.el.hide();this.collapsedEl.show();this.fireEvent("collapsed",this);this.fireEvent("invalidated",this);}}},animateCollapse:function(){}
2473 ,expand:function(e,A){if(e){e.stopPropagation();}if(!this.collapsed||this.el.hasActiveFx()){return;}if(this.isSlid){this.afterSlideIn();A=true;}this.collapsed=false;if(this.config.animate&&A!==true){this.animateExpand();}else{this.el.show();if(this.split){this.split.el.show();
2474 }this.collapsedEl.setLocation(-2000,-2000);this.collapsedEl.hide();this.fireEvent("invalidated",this);this.fireEvent("expanded",this);}},animateExpand:function(){},initTabs:function(){this.bodyEl.setStyle("overflow","hidden");var ts=new Roo.TabPanel(this.bodyEl.dom,{tabPosition:this.bottomTabs?'bottom':'top',disableTooltips:this.config.disableTabTips,toolbar:this.config.toolbar}
2475 );if(this.config.hideTabs){ts.stripWrap.setDisplayed(false);}this.tabs=ts;ts.resizeTabs=this.config.resizeTabs===true;ts.minTabWidth=this.config.minTabWidth||40;ts.maxTabWidth=this.config.maxTabWidth||250;ts.preferredTabWidth=this.config.preferredTabWidth||150;
2476 ts.monitorResize=false;ts.bodyEl.setStyle("overflow",this.config.autoScroll?"auto":"hidden");ts.bodyEl.addClass('x-layout-tabs-body');this.panels.each(this.initPanelAsTab,this);},initPanelAsTab:function(A){var ti=this.tabs.addTab(A.getEl().id,A.getTitle(),null,this.config.closeOnTab&&A.isClosable());
2477 if(A.tabTip!==undefined){ti.setTooltip(A.tabTip);}ti.on("activate",function(){this.setActivePanel(A);},this);if(this.config.closeOnTab){ti.on("beforeclose",function(t,e){e.cancel=true;this.remove(A);},this);}return ti;},updatePanelTitle:function(A,B){if(this.activePanel==A){this.updateTitle(B);
2478 }if(this.tabs){var ti=this.tabs.getTab(A.getEl().id);ti.setText(B);if(A.tabTip!==undefined){ti.setTooltip(A.tabTip);}}},updateTitle:function(A){if(this.titleTextEl&&!this.config.title){this.titleTextEl.innerHTML=(typeof A!="undefined"&&A.length>0?A:"&#160;");
2479 }},setActivePanel:function(A){A=this.getPanel(A);if(this.activePanel&&this.activePanel!=A){this.activePanel.setActiveState(false);}this.activePanel=A;A.setActiveState(true);if(this.panelSize){A.setSize(this.panelSize.width,this.panelSize.height);}if(this.closeBtn){this.closeBtn.setVisible(!this.config.closeOnTab&&!this.isSlid&&A.isClosable());
2480 }this.updateTitle(A.getTitle());if(this.tabs){this.fireEvent("invalidated",this);}this.fireEvent("panelactivated",this,A);},showPanel:function(A){A=this.getPanel(A);if(A){if(this.tabs){var B=this.tabs.getTab(A.getEl().id);if(B.isHidden()){this.tabs.unhideTab(B.id);
2481 }B.activate();}else{this.setActivePanel(A);}}return A;},getActivePanel:function(){return this.activePanel;},validateVisibility:function(){if(this.panels.getCount()<1){this.updateTitle("&#160;");this.closeBtn.hide();this.hide();}else{if(!this.isVisible()){this.show();
2482 }}},add:function(A){if(arguments.length>1){for(var i=0,B=arguments.length;i<B;i++){this.add(arguments[i]);}return null;}if(this.hasPanel(A)){this.showPanel(A);return A;}A.setRegion(this);this.panels.add(A);if(this.panels.getCount()==1&&!this.config.alwaysShowTabs){this.bodyEl.dom.appendChild(A.getEl().dom);
2483 if(A.background!==true){this.setActivePanel(A);}this.fireEvent("paneladded",this,A);return A;}if(!this.tabs){this.initTabs();}else{this.initPanelAsTab(A);}if(A.background!==true){this.tabs.activate(A.getEl().id);}this.fireEvent("paneladded",this,A);return A;
2484 },hidePanel:function(A){if(this.tabs&&(A=this.getPanel(A))){this.tabs.hideTab(A.getEl().id);}},unhidePanel:function(A){if(this.tabs&&(A=this.getPanel(A))){this.tabs.unhideTab(A.getEl().id);}},clearPanels:function(){while(this.panels.getCount()>0){this.remove(this.panels.first());
2485 }},remove:function(A,B){A=this.getPanel(A);if(!A){return null;}var e={};this.fireEvent("beforeremove",this,A,e);if(e.cancel===true){return null;}B=(typeof B!="undefined"?B:(this.config.preservePanels===true||A.preserve===true));var C=A.getId();this.panels.removeKey(C);
2486 if(B){document.body.appendChild(A.getEl().dom);}if(this.tabs){this.tabs.removeTab(A.getEl().id);}else if(!B){this.bodyEl.dom.removeChild(A.getEl().dom);}if(this.panels.getCount()==1&&this.tabs&&!this.config.alwaysShowTabs){var p=this.panels.first();var D=document.createElement("div");
2487 D.appendChild(p.getEl().dom);this.bodyEl.update("");this.bodyEl.dom.appendChild(p.getEl().dom);D=null;this.updateTitle(p.getTitle());this.tabs=null;this.bodyEl.setStyle("overflow",this.config.autoScroll?"auto":"hidden");this.setActivePanel(p);}A.setRegion(null);
2488 if(this.activePanel==A){this.activePanel=null;}if(this.config.autoDestroy!==false&&B!==true){try{A.destroy();}catch(e){}}this.fireEvent("panelremoved",this,A);return A;},getTabs:function(){return this.tabs;},createTool:function(A,B){var C=Roo.DomHelper.append(A,{tag:"div",cls:"x-layout-tools-button",children:[{tag:"div",cls:"x-layout-tools-button-inner "+B,html:"&#160;"}
2489 ]},true);C.addClassOnOver("x-layout-tools-button-over");return C;}});
2490 // Roo/SplitLayoutRegion.js
2491 Roo.SplitLayoutRegion=function(A,B,C,D){this.cursor=D;Roo.SplitLayoutRegion.superclass.constructor.call(this,A,B,C);};Roo.extend(Roo.SplitLayoutRegion,Roo.LayoutRegion,{splitTip:"Drag to resize.",collapsibleSplitTip:"Drag to resize. Double click to hide.",useSplitTips:false,applyConfig:function(A){Roo.SplitLayoutRegion.superclass.applyConfig.call(this,A);
2492 if(A.split){if(!this.split){var B=Roo.DomHelper.append(this.mgr.el.dom,{tag:"div",id:this.el.id+"-split",cls:"x-layout-split x-layout-split-"+this.position,html:"&#160;"});this.split=new Roo.SplitBar(B,this.el,this.orientation);this.split.on("moved",this.onSplitMove,this);
2493 this.split.useShim=A.useShim===true;this.split.getMaximumSize=this[this.position=='north'||this.position=='south'?'getVMaxSize':'getHMaxSize'].createDelegate(this);if(this.useSplitTips){this.split.el.dom.title=A.collapsible?this.collapsibleSplitTip:this.splitTip;
2494 }if(A.collapsible){this.split.el.on("dblclick",this.collapse,this);}}if(typeof A.minSize!="undefined"){this.split.minSize=A.minSize;}if(typeof A.maxSize!="undefined"){this.split.maxSize=A.maxSize;}if(A.hideWhenEmpty||A.hidden||A.collapsed){this.hideSplitter();
2495 }}},getHMaxSize:function(){var A=this.config.maxSize||10000;var B=this.mgr.getRegion("center");return Math.min(A,(this.el.getWidth()+B.getEl().getWidth())-B.getMinWidth());},getVMaxSize:function(){var A=this.config.maxSize||10000;var B=this.mgr.getRegion("center");
2496 return Math.min(A,(this.el.getHeight()+B.getEl().getHeight())-B.getMinHeight());},onSplitMove:function(A,B){this.fireEvent("resized",this,B);},getSplitBar:function(){return this.split;},hide:function(){this.hideSplitter();Roo.SplitLayoutRegion.superclass.hide.call(this);
2497 },hideSplitter:function(){if(this.split){this.split.el.setLocation(-2000,-2000);this.split.el.hide();}},show:function(){if(this.split){this.split.el.show();}Roo.SplitLayoutRegion.superclass.show.call(this);},beforeSlide:function(){if(Roo.isGecko){this.bodyEl.clip();
2498 if(this.tabs){this.tabs.bodyEl.clip();}if(this.activePanel){this.activePanel.getEl().clip();if(this.activePanel.beforeSlide){this.activePanel.beforeSlide();}}}},afterSlide:function(){if(Roo.isGecko){this.bodyEl.unclip();if(this.tabs){this.tabs.bodyEl.unclip();
2499 }if(this.activePanel){this.activePanel.getEl().unclip();if(this.activePanel.afterSlide){this.activePanel.afterSlide();}}}},initAutoHide:function(){if(this.autoHide!==false){if(!this.autoHideHd){var st=new Roo.util.DelayedTask(this.slideIn,this);this.autoHideHd={"mouseout":function(e){if(!e.within(this.el,true)){st.delay(500);
2500 }},"mouseover":function(e){st.cancel();},scope:this};}this.el.on(this.autoHideHd);}},clearAutoHide:function(){if(this.autoHide!==false){this.el.un("mouseout",this.autoHideHd.mouseout);this.el.un("mouseover",this.autoHideHd.mouseover);}},clearMonitor:function(){Roo.get(document).un("click",this.slideInIf,this);
2501 },slideOut:function(){if(this.isSlid||this.el.hasActiveFx()){return;}this.isSlid=true;if(this.collapseBtn){this.collapseBtn.hide();}this.closeBtnState=this.closeBtn.getStyle('display');this.closeBtn.hide();if(this.stickBtn){this.stickBtn.show();}this.el.show();
2502 this.el.alignTo(this.collapsedEl,this.getCollapseAnchor());this.beforeSlide();this.el.setStyle("z-index",10001);this.el.slideIn(this.getSlideAnchor(),{callback:function(){this.afterSlide();this.initAutoHide();Roo.get(document).on("click",this.slideInIf,this);
2503 this.fireEvent("slideshow",this);},scope:this,block:true});},afterSlideIn:function(){this.clearAutoHide();this.isSlid=false;this.clearMonitor();this.el.setStyle("z-index","");if(this.collapseBtn){this.collapseBtn.show();}this.closeBtn.setStyle('display',this.closeBtnState);
2504 if(this.stickBtn){this.stickBtn.hide();}this.fireEvent("slidehide",this);},slideIn:function(cb){if(!this.isSlid||this.el.hasActiveFx()){Roo.callback(cb);return;}this.isSlid=false;this.beforeSlide();this.el.slideOut(this.getSlideAnchor(),{callback:function(){this.el.setLeftTop(-10000,-10000);
2505 this.afterSlide();this.afterSlideIn();Roo.callback(cb);},scope:this,block:true});},slideInIf:function(e){if(!e.within(this.el)){this.slideIn();}},animateCollapse:function(){this.beforeSlide();this.el.setStyle("z-index",20000);var A=this.getSlideAnchor();this.el.slideOut(A,{callback:function(){this.el.setStyle("z-index","");
2506 this.collapsedEl.slideIn(A,{duration:.3});this.afterSlide();this.el.setLocation(-10000,-10000);this.el.hide();this.fireEvent("collapsed",this);},scope:this,block:true});},animateExpand:function(){this.beforeSlide();this.el.alignTo(this.collapsedEl,this.getCollapseAnchor(),this.getExpandAdj());
2507 this.el.setStyle("z-index",20000);this.collapsedEl.hide({duration:.1});this.el.slideIn(this.getSlideAnchor(),{callback:function(){this.el.setStyle("z-index","");this.afterSlide();if(this.split){this.split.el.show();}this.fireEvent("invalidated",this);this.fireEvent("expanded",this);
2508 },scope:this,block:true});},anchors:{"west":"left","east":"right","north":"top","south":"bottom"},sanchors:{"west":"l","east":"r","north":"t","south":"b"},canchors:{"west":"tl-tr","east":"tr-tl","north":"tl-bl","south":"bl-tl"},getAnchor:function(){return this.anchors[this.position];
2509 },getCollapseAnchor:function(){return this.canchors[this.position];},getSlideAnchor:function(){return this.sanchors[this.position];},getAlignAdj:function(){var cm=this.cmargins;switch(this.position){case "west":return [0,0];break;case "east":return [0,0];
2510 break;case "north":return [0,0];break;case "south":return [0,0];break;}},getExpandAdj:function(){var c=this.collapsedEl,cm=this.cmargins;switch(this.position){case "west":return [-(cm.right+c.getWidth()+cm.left),0];break;case "east":return [cm.right+c.getWidth()+cm.left,0];
2511 break;case "north":return [0,-(cm.top+cm.bottom+c.getHeight())];break;case "south":return [0,cm.top+cm.bottom+c.getHeight()];break;}}});
2512 // Roo/CenterLayoutRegion.js
2513 Roo.CenterLayoutRegion=function(A,B){Roo.LayoutRegion.call(this,A,B,"center");this.visible=true;this.minWidth=B.minWidth||20;this.minHeight=B.minHeight||20;};Roo.extend(Roo.CenterLayoutRegion,Roo.LayoutRegion,{hide:function(){},show:function(){},getMinWidth:function(){return this.minWidth;
2514 },getMinHeight:function(){return this.minHeight;}});Roo.NorthLayoutRegion=function(A,B){Roo.LayoutRegion.call(this,A,B,"north","n-resize");if(this.split){this.split.placement=Roo.SplitBar.TOP;this.split.orientation=Roo.SplitBar.VERTICAL;this.split.el.addClass("x-layout-split-v");
2515 }var C=B.initialSize||B.height;if(typeof C!="undefined"){this.el.setHeight(C);}};Roo.extend(Roo.NorthLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.VERTICAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();}var A=this.el.getBox();
2516 if(this.split){A.height+=this.split.el.getHeight();}return A;},updateBox:function(A){if(this.split&&!this.collapsed){A.height-=this.split.el.getHeight();this.split.el.setLeft(A.x);this.split.el.setTop(A.y+A.height);this.split.el.setWidth(A.width);}if(this.collapsed){this.updateBody(A.width,null);
2517 }Roo.LayoutRegion.prototype.updateBox.call(this,A);}});Roo.SouthLayoutRegion=function(A,B){Roo.SplitLayoutRegion.call(this,A,B,"south","s-resize");if(this.split){this.split.placement=Roo.SplitBar.BOTTOM;this.split.orientation=Roo.SplitBar.VERTICAL;this.split.el.addClass("x-layout-split-v");
2518 }var C=B.initialSize||B.height;if(typeof C!="undefined"){this.el.setHeight(C);}};Roo.extend(Roo.SouthLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.VERTICAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();}var A=this.el.getBox();
2519 if(this.split){var sh=this.split.el.getHeight();A.height+=sh;A.y-=sh;}return A;},updateBox:function(A){if(this.split&&!this.collapsed){var sh=this.split.el.getHeight();A.height-=sh;A.y+=sh;this.split.el.setLeft(A.x);this.split.el.setTop(A.y-sh);this.split.el.setWidth(A.width);
2520 }if(this.collapsed){this.updateBody(A.width,null);}Roo.LayoutRegion.prototype.updateBox.call(this,A);}});Roo.EastLayoutRegion=function(A,B){Roo.SplitLayoutRegion.call(this,A,B,"east","e-resize");if(this.split){this.split.placement=Roo.SplitBar.RIGHT;this.split.orientation=Roo.SplitBar.HORIZONTAL;
2521 this.split.el.addClass("x-layout-split-h");}var C=B.initialSize||B.width;if(typeof C!="undefined"){this.el.setWidth(C);}};Roo.extend(Roo.EastLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.HORIZONTAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();
2522 }var A=this.el.getBox();if(this.split){var sw=this.split.el.getWidth();A.width+=sw;A.x-=sw;}return A;},updateBox:function(A){if(this.split&&!this.collapsed){var sw=this.split.el.getWidth();A.width-=sw;this.split.el.setLeft(A.x);this.split.el.setTop(A.y);this.split.el.setHeight(A.height);
2523 A.x+=sw;}if(this.collapsed){this.updateBody(null,A.height);}Roo.LayoutRegion.prototype.updateBox.call(this,A);}});Roo.WestLayoutRegion=function(A,B){Roo.SplitLayoutRegion.call(this,A,B,"west","w-resize");if(this.split){this.split.placement=Roo.SplitBar.LEFT;
2524 this.split.orientation=Roo.SplitBar.HORIZONTAL;this.split.el.addClass("x-layout-split-h");}var C=B.initialSize||B.width;if(typeof C!="undefined"){this.el.setWidth(C);}};Roo.extend(Roo.WestLayoutRegion,Roo.SplitLayoutRegion,{orientation:Roo.SplitBar.HORIZONTAL,getBox:function(){if(this.collapsed){return this.collapsedEl.getBox();
2525 }var A=this.el.getBox();if(this.split){A.width+=this.split.el.getWidth();}return A;},updateBox:function(A){if(this.split&&!this.collapsed){var sw=this.split.el.getWidth();A.width-=sw;this.split.el.setLeft(A.x+A.width);this.split.el.setTop(A.y);this.split.el.setHeight(A.height);
2526 }if(this.collapsed){this.updateBody(null,A.height);}Roo.LayoutRegion.prototype.updateBox.call(this,A);}});
2527 // Roo/LayoutStateManager.js
2528 Roo.LayoutStateManager=function(A){this.state={north:{},south:{},east:{},west:{}};};Roo.LayoutStateManager.prototype={init:function(A,B){this.provider=B;var C=B.get(A.id+"-layout-state");if(C){var D=A.isUpdating();if(!D){A.beginUpdate();}for(var E in C){if(typeof C[E]!="function"){var F=C[E];
2529 var r=A.getRegion(E);if(r&&F){if(F.size){r.resizeTo(F.size);}if(F.collapsed==true){r.collapse(true);}else{r.expand(null,true);}}}}if(!D){A.endUpdate();}this.state=C;}this.layout=A;A.on("regionresized",this.onRegionResized,this);A.on("regioncollapsed",this.onRegionCollapsed,this);
2530 A.on("regionexpanded",this.onRegionExpanded,this);},storeState:function(){this.provider.set(this.layout.id+"-layout-state",this.state);},onRegionResized:function(A,B){this.state[A.getPosition()].size=B;this.storeState();},onRegionCollapsed:function(A){this.state[A.getPosition()].collapsed=true;
2531 this.storeState();},onRegionExpanded:function(A){this.state[A.getPosition()].collapsed=false;this.storeState();}};
2532 // Roo/ContentPanel.js
2533 Roo.ContentPanel=function(el,A,B){if(el.autoCreate){A=el;el=Roo.id();}this.el=Roo.get(el);if(!this.el&&A&&A.autoCreate){if(typeof A.autoCreate=="object"){if(!A.autoCreate.id){A.autoCreate.id=A.id||el;}this.el=Roo.DomHelper.append(document.body,A.autoCreate,true);
2534 }else{this.el=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-layout-inactive-content",id:A.id||el},true);}}this.closable=false;this.loaded=false;this.active=false;if(typeof A=="string"){this.title=A;}else{Roo.apply(this,A);}if(this.toolbar&&!this.toolbar.el&&this.toolbar.xtype){this.wrapEl=this.el.wrap();
2535 this.toolbar.container=this.el.insertSibling(false,'before');this.toolbar=new Roo.Toolbar(this.toolbar);}if(this.footer&&!this.footer.el&&this.footer.xtype){if(!this.wrapEl){this.wrapEl=this.el.wrap();}this.footer.container=this.wrapEl.createChild();this.footer=Roo.factory(this.footer,Roo);
2536 }if(this.resizeEl){this.resizeEl=Roo.get(this.resizeEl,true);}else{this.resizeEl=this.el;}this.addEvents({"activate":true,"deactivate":true,"resize":true,"render":true});if(this.autoScroll){this.resizeEl.setStyle("overflow","auto");}else{this.el.on('scroll',function(){Roo.log('fix random scolling');
2537 this.scrollTo('top',0);});}B=B||this.content;if(B){this.setContent(B);}if(A&&A.url){this.setUrl(this.url,this.params,this.loadOnce);}Roo.ContentPanel.superclass.constructor.call(this);if(this.view&&typeof(this.view.xtype)!='undefined'){this.view.el=this.el.appendChild(document.createElement("div"));
2538 this.view=Roo.factory(this.view);this.view.render&&this.view.render(false,'');}this.fireEvent('render',this);};Roo.extend(Roo.ContentPanel,Roo.util.Observable,{tabTip:'',setRegion:function(A){this.region=A;if(A){this.el.replaceClass("x-layout-inactive-content","x-layout-active-content");
2539 }else{this.el.replaceClass("x-layout-active-content","x-layout-inactive-content");}},getToolbar:function(){return this.toolbar;},setActiveState:function(A){this.active=A;if(!A){this.fireEvent("deactivate",this);}else{this.fireEvent("activate",this);}},setContent:function(A,B){this.el.update(A,B);
2540 },ignoreResize:function(w,h){if(this.lastSize&&this.lastSize.width==w&&this.lastSize.height==h){return true;}else{this.lastSize={width:w,height:h};return false;}},getUpdateManager:function(){return this.el.getUpdateManager();},load:function(){var um=this.el.getUpdateManager();
2541 um.update.apply(um,arguments);return this;},setUrl:function(A,B,C){if(this.refreshDelegate){this.removeListener("activate",this.refreshDelegate);}this.refreshDelegate=this._handleRefresh.createDelegate(this,[A,B,C]);this.on("activate",this.refreshDelegate);
2542 return this.el.getUpdateManager();},_handleRefresh:function(A,B,C){if(!C||!this.loaded){var D=this.el.getUpdateManager();D.update(A,B,this._setLoaded.createDelegate(this));}},_setLoaded:function(){this.loaded=true;},getId:function(){return this.el.id;},getEl:function(){return this.wrapEl||this.el;
2543 },adjustForComponents:function(A,B){if(this.resizeEl!=this.el){A-=this.el.getFrameWidth('lr');B-=this.el.getFrameWidth('tb');}if(this.toolbar){var te=this.toolbar.getEl();B-=te.getHeight();te.setWidth(A);}if(this.footer){var te=this.footer.getEl();B-=te.getHeight();
2544 te.setWidth(A);}if(this.adjustments){A+=this.adjustments[0];B+=this.adjustments[1];}return {"width":A,"height":B};},setSize:function(A,B){if(this.fitToFrame&&!this.ignoreResize(A,B)){if(this.fitContainer&&this.resizeEl!=this.el){this.el.setSize(A,B);}var C=this.adjustForComponents(A,B);
2545 this.resizeEl.setSize(this.autoWidth?"auto":C.width,this.autoHeight?"auto":C.height);this.fireEvent('resize',this,C.width,C.height);}},getTitle:function(){return this.title;},setTitle:function(A){this.title=A;if(this.region){this.region.updatePanelTitle(this,A);
2546 }},isClosable:function(){return this.closable;},beforeSlide:function(){this.el.clip();this.resizeEl.clip();},afterSlide:function(){this.el.unclip();this.resizeEl.unclip();},refresh:function(){if(this.refreshDelegate){this.loaded=false;this.refreshDelegate();
2547 }},destroy:function(){this.el.removeAllListeners();var A=document.createElement("span");A.appendChild(this.el.dom);A.innerHTML="";this.el.remove();this.el=null;},form:false,view:false,addxtype:function(A){if(A.xtype.match(/^Form$/)){var el;el=this.el.createChild();
2548 this.form=new Roo.form.Form(A);if(this.form.allItems.length){this.form.render(el.dom);}return this.form;}if(['View','JsonView','DatePicker'].indexOf(A.xtype)>-1){A.el=this.el.appendChild(document.createElement("div"));var B=new Roo.factory(A);B.render&&B.render(false,'');
2549 this.view=B;return B;}return false;}});
2550 // Roo/GridPanel.js
2551 Roo.GridPanel=function(A,B){if(typeof(A.grid)!='undefined'){B=A;A=B.grid;}this.wrapper=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-layout-grid-wrapper x-layout-inactive-content"},true);this.wrapper.dom.appendChild(A.getGridEl().dom);Roo.GridPanel.superclass.constructor.call(this,this.wrapper,B);
2552 if(this.toolbar){this.toolbar.el.insertBefore(this.wrapper.dom.firstChild);}if(this.footer&&!this.footer.el&&this.footer.xtype){this.footer.container=this.grid.getView().getFooterPanel(true);this.footer.dataSource=this.grid.dataSource;this.footer=Roo.factory(this.footer,Roo);
2553 }A.monitorWindowResize=false;A.autoHeight=false;A.autoWidth=false;this.grid=A;this.grid.getGridEl().replaceClass("x-layout-inactive-content","x-layout-component-panel");};Roo.extend(Roo.GridPanel,Roo.ContentPanel,{getId:function(){return this.grid.id;},getGrid:function(){return this.grid;
2554 },setSize:function(A,B){if(!this.ignoreResize(A,B)){var C=this.grid;var D=this.adjustForComponents(A,B);C.getGridEl().setSize(D.width,D.height);C.autoSize();}},beforeSlide:function(){this.grid.getView().scroller.clip();},afterSlide:function(){this.grid.getView().scroller.unclip();
2555 },destroy:function(){this.grid.destroy();delete this.grid;Roo.GridPanel.superclass.destroy.call(this);}});
2556 // Roo/NestedLayoutPanel.js
2557 Roo.NestedLayoutPanel=function(A,B){Roo.NestedLayoutPanel.superclass.constructor.call(this,A.getEl(),B);A.monitorWindowResize=false;this.layout=A;this.layout.getEl().addClass("x-layout-nested-layout");};Roo.extend(Roo.NestedLayoutPanel,Roo.ContentPanel,{layout:false,setSize:function(A,B){if(!this.ignoreResize(A,B)){var C=this.adjustForComponents(A,B);
2558 var el=this.layout.getEl();el.setSize(C.width,C.height);var D=el.dom.offsetWidth;this.layout.layout();if(Roo.isIE&&!this.initialized){this.initialized=true;this.layout.layout();}}},setActiveState:function(A){this.active=A;if(!A){this.fireEvent("deactivate",this);
2559 return;}this.fireEvent("activate",this);if(!this.layout){return;}var B=false;for(var r in this.layout.regions){B=this.layout.getRegion(r);if(B.getActivePanel()){B.setActivePanel(B.getActivePanel());continue;}if(!B.panels.length){continue;}B.showPanel(B.getPanel(0));
2560 }},getLayout:function(){return this.layout;},addxtype:function(A){return this.layout.addxtype(A);}});
2561 // Roo/ScrollPanel.js
2562 Roo.ScrollPanel=function(el,A,B){A=A||{};A.fitToFrame=true;Roo.ScrollPanel.superclass.constructor.call(this,el,A,B);this.el.dom.style.overflow="hidden";var C=this.el.wrap({cls:"x-scroller x-layout-inactive-content"});this.el.removeClass("x-layout-inactive-content");
2563 this.el.on("mousewheel",this.onWheel,this);var up=C.createChild({cls:"x-scroller-up",html:"&#160;"},this.el.dom);var D=C.createChild({cls:"x-scroller-down",html:"&#160;"});up.unselectable();D.unselectable();up.on("click",this.scrollUp,this);D.on("click",this.scrollDown,this);
2564 up.addClassOnOver("x-scroller-btn-over");D.addClassOnOver("x-scroller-btn-over");up.addClassOnClick("x-scroller-btn-click");D.addClassOnClick("x-scroller-btn-click");this.adjustments=[0,-(up.getHeight()+D.getHeight())];this.resizeEl=this.el;this.el=C;this.up=up;
2565 this.down=D;};Roo.extend(Roo.ScrollPanel,Roo.ContentPanel,{increment:100,wheelIncrement:5,scrollUp:function(){this.resizeEl.scroll("up",this.increment,{callback:this.afterScroll,scope:this});},scrollDown:function(){this.resizeEl.scroll("down",this.increment,{callback:this.afterScroll,scope:this}
2566 );},afterScroll:function(){var el=this.resizeEl;var t=el.dom.scrollTop,h=el.dom.scrollHeight,ch=el.dom.clientHeight;this.up[t==0?"addClass":"removeClass"]("x-scroller-btn-disabled");this.down[h-t<=ch?"addClass":"removeClass"]("x-scroller-btn-disabled");},setSize:function(){Roo.ScrollPanel.superclass.setSize.apply(this,arguments);
2567 this.afterScroll();},onWheel:function(e){var d=e.getWheelDelta();this.resizeEl.dom.scrollTop-=(d*this.wheelIncrement);this.afterScroll();e.stopEvent();},setContent:function(A,B){this.resizeEl.update(A,B);}});
2568 // Roo/TreePanel.js
2569 Roo.TreePanel=function(A){var el=A.el;var B=A.tree;delete A.tree;delete A.el;var C=el.createChild();A.resizeEl=C;Roo.TreePanel.superclass.constructor.call(this,el,A);this.tree=new Roo.tree.TreePanel(C,B);this.on('activate',function(){if(this.tree.rendered){return;
2570 }this.tree.render();});};Roo.extend(Roo.TreePanel,Roo.ContentPanel,{fitToFrame:true,autoScroll:true,tree:false});
2571 // Roo/ReaderLayout.js
2572 Roo.ReaderLayout=function(A,B){var c=A||{size:{}};Roo.ReaderLayout.superclass.constructor.call(this,B||document.body,{north:c.north!==false?Roo.apply({split:false,initialSize:32,titlebar:false},c.north):false,west:c.west!==false?Roo.apply({split:true,initialSize:200,minSize:175,maxSize:400,titlebar:true,collapsible:true,animate:true,margins:{left:5,right:0,bottom:5,top:5}
2573 ,cmargins:{left:5,right:5,bottom:5,top:5}},c.west):false,east:c.east!==false?Roo.apply({split:true,initialSize:200,minSize:175,maxSize:400,titlebar:true,collapsible:true,animate:true,margins:{left:0,right:5,bottom:5,top:5},cmargins:{left:5,right:5,bottom:5,top:5}
2574 },c.east):false,center:Roo.apply({tabPosition:'top',autoScroll:false,closeOnTab:true,titlebar:false,margins:{left:c.west!==false?0:5,right:c.east!==false?0:5,bottom:5,top:2}},c.center)});this.el.addClass('x-reader');this.beginUpdate();var C=new Roo.BorderLayout(Roo.get(document.body).createChild(),{south:c.preview!==false?Roo.apply({split:true,initialSize:200,minSize:100,autoScroll:true,collapsible:true,titlebar:true,cmargins:{top:5,left:0,right:0,bottom:0}
2575 },c.preview):false,center:Roo.apply({autoScroll:false,titlebar:false,minHeight:200},c.listView)});this.add('center',new Roo.NestedLayoutPanel(C,Roo.apply({title:c.mainTitle||'',tabTip:''},c.innerPanelCfg)));this.endUpdate();this.regions.preview=C.getRegion('south');
2576 this.regions.listView=C.getRegion('center');};Roo.extend(Roo.ReaderLayout,Roo.BorderLayout);
2577 // Roo/grid/Grid.js
2578 Roo.grid.Grid=function(A,B){this.container=Roo.get(A);this.container.update("");this.container.setStyle("overflow","hidden");this.container.addClass('x-grid-container');this.id=this.container.id;Roo.apply(this,B);if(this.ds){this.dataSource=this.ds;delete this.ds;
2579 }if(this.cm){this.colModel=this.cm;delete this.cm;}if(this.sm){this.selModel=this.sm;delete this.sm;}if(this.selModel){this.selModel=Roo.factory(this.selModel,Roo.grid);this.sm=this.selModel;this.sm.xmodule=this.xmodule||false;}if(typeof(this.colModel.config)=='undefined'){this.colModel=new Roo.grid.ColumnModel(this.colModel);
2580 this.cm=this.colModel;this.cm.xmodule=this.xmodule||false;}if(this.dataSource){this.dataSource=Roo.factory(this.dataSource,Roo.data);this.ds=this.dataSource;this.ds.xmodule=this.xmodule||false;}if(this.width){this.container.setWidth(this.width);}if(this.height){this.container.setHeight(this.height);
2581 }this.addEvents({"click":true,"dblclick":true,"contextmenu":true,"mousedown":true,"mouseup":true,"mouseover":true,"mouseout":true,"keypress":true,"keydown":true,"cellclick":true,"celldblclick":true,"rowclick":true,"rowdblclick":true,"headerclick":true,"headerdblclick":true,"rowcontextmenu":true,"cellcontextmenu":true,"headercontextmenu":true,"bodyscroll":true,"columnresize":true,"columnmove":true,"startdrag":true,"enddrag":true,"dragdrop":true,"dragover":true,"dragenter":true,"dragout":true,'rowclass':true,'render':true}
2582 );Roo.grid.Grid.superclass.constructor.call(this);};Roo.extend(Roo.grid.Grid,Roo.util.Observable,{minColumnWidth:25,autoSizeColumns:false,autoSizeHeaders:true,monitorWindowResize:true,maxRowsToMeasure:0,trackMouseOver:true,enableDragDrop:false,enableColumnMove:true,enableColumnHide:true,enableRowHeightSync:false,stripeRows:true,autoHeight:false,autoExpandColumn:false,autoExpandMin:50,autoExpandMax:1000,view:null,loadMask:false,dropTarget:false,sortColMenu:false,rendered:false,ddText:"{0} selected row{1}",render:function(){var c=this.container;
2583 if((!c.dom.offsetHeight||c.dom.offsetHeight<20)||c.getStyle("height")=="auto"){this.autoHeight=true;}var A=this.getView();A.init(this);c.on("click",this.onClick,this);c.on("dblclick",this.onDblClick,this);c.on("contextmenu",this.onContextMenu,this);c.on("keydown",this.onKeyDown,this);
2584 if(Roo.isTouch){c.on("touchstart",this.onTouchStart,this);}this.relayEvents(c,["mousedown","mouseup","mouseover","mouseout","keypress"]);this.getSelectionModel().init(this);A.render();if(this.loadMask){this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:this.dataSource}
2585 ,this.loadMask));}if(this.toolbar&&this.toolbar.xtype){this.toolbar.container=this.getView().getHeaderPanel(true);this.toolbar=new Roo.Toolbar(this.toolbar);}if(this.footer&&this.footer.xtype){this.footer.dataSource=this.getDataSource();this.footer.container=this.getView().getFooterPanel(true);
2586 this.footer=Roo.factory(this.footer,Roo);}if(this.dropTarget&&this.dropTarget.xtype){delete this.dropTarget.xtype;this.dropTarget=new Roo.dd.DropTarget(this.getView().mainBody,this.dropTarget);}this.rendered=true;this.fireEvent('render',this);return this;
2587 },reconfigure:function(A,B){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:A},this.loadMask));}this.view.bind(A,B);this.dataSource=A;this.colModel=B;this.view.refresh(true);},addColumns:function(A,ar){for(var i=0;
2588 i<ar.length;i++){var B=ar[i];B.id=typeof(B.id)=='undefined'?Roo.id():B.id;this.cm.lookup[B.id]=B;}if(typeof(A)=='undefined'||A>=this.cm.config.length){A=this.cm.config.length;}A=Math.max(0,A);ar.unshift(0);ar.unshift(A);this.cm.config.splice.apply(this.cm.config,ar);
2589 this.view.generateRules(this.cm);this.view.refresh(true);},onKeyDown:function(e){this.fireEvent("keydown",e);},destroy:function(A,B){if(this.loadMask){this.loadMask.destroy();}var c=this.container;c.removeAllListeners();this.view.destroy();this.colModel.purgeListeners();
2590 if(!B){this.purgeListeners();}c.update("");if(A===true){c.remove();}},processEvent:function(A,e){if(A!='touchstart'){this.fireEvent(A,e);}var t=e.getTarget();var v=this.view;var B=v.findHeaderIndex(t);if(B!==false){var C=A=='touchstart'?'click':A;this.fireEvent("header"+C,this,B,e);
2591 }else{var D=v.findRowIndex(t);var E=v.findCellIndex(t);if(A=='touchstart'){A=false;if(typeof(this.selModel.getSelectedCell)!='undefined'){var cs=this.selModel.getSelectedCell();if(D==cs[0]&&E==cs[1]){A='dblclick';}}if(typeof(this.selModel.getSelections)!='undefined'){var cs=this.selModel.getSelections();
2592 var ds=this.dataSource;if(cs.length==1&&ds.getAt(D)==cs[0]){A='dblclick';}}if(!A){return;}}if(D!==false){this.fireEvent("row"+A,this,D,e);if(E!==false){this.fireEvent("cell"+A,this,D,E,e);}}}},onClick:function(e){this.processEvent("click",e);},onTouchStart:function(e){this.processEvent("touchstart",e);
2593 },onContextMenu:function(e,t){this.processEvent("contextmenu",e);},onDblClick:function(e){this.processEvent("dblclick",e);},walkCells:function(A,B,C,fn,D){var cm=this.colModel,E=cm.getColumnCount();var ds=this.dataSource,F=ds.getCount(),G=true;if(C<0){if(B<0){A--;
2594 G=false;}while(A>=0){if(!G){B=E-1;}G=false;while(B>=0){if(fn.call(D||this,A,B,cm)===true){return [A,B];}B--;}A--;}}else{if(B>=E){A++;G=false;}while(A<F){if(!G){B=0;}G=false;while(B<E){if(fn.call(D||this,A,B,cm)===true){return [A,B];}B++;}A++;}}return null;
2595 },getSelections:function(){return this.selModel.getSelections();},autoSize:function(){if(this.rendered){this.view.layout();if(this.view.adjustForScroll){this.view.adjustForScroll();}}},getGridEl:function(){return this.container;},stopEditing:function(){},getSelectionModel:function(){if(!this.selModel){this.selModel=new Roo.grid.RowSelectionModel();
2596 }return this.selModel;},getDataSource:function(){return this.dataSource;},getColumnModel:function(){return this.colModel;},getView:function(){if(!this.view){this.view=new Roo.grid.GridView(this.viewConfig);this.relayEvents(this.view,["beforerowremoved","beforerowsinserted","beforerefresh","rowremoved","rowsinserted","rowupdated","refresh"]);
2597 }return this.view;},getDragDropText:function(){var A=this.selModel.getCount();return String.format(this.ddText,A,A==1?'':'s');}});
2598 // Roo/grid/AbstractGridView.js
2599 Roo.grid.AbstractGridView=function(){this.grid=null;this.events={"beforerowremoved":true,"beforerowsinserted":true,"beforerefresh":true,"rowremoved":true,"rowsinserted":true,"rowupdated":true,"refresh":true};Roo.grid.AbstractGridView.superclass.constructor.call(this);
2600 };Roo.extend(Roo.grid.AbstractGridView,Roo.util.Observable,{rowClass:"x-grid-row",cellClass:"x-grid-cell",tdClass:"x-grid-td",hdClass:"x-grid-hd",splitClass:"x-grid-hd-split",init:function(A){this.grid=A;var B=this.grid.getGridEl().id;this.colSelector="#"+B+" ."+this.cellClass+"-";
2601 this.tdSelector="#"+B+" ."+this.tdClass+"-";this.hdSelector="#"+B+" ."+this.hdClass+"-";this.splitSelector="#"+B+" ."+this.splitClass+"-";},getColumnRenderers:function(){var A=[];var cm=this.grid.colModel;var B=cm.getColumnCount();for(var i=0;i<B;i++){A[i]=cm.getRenderer(i);
2602 }return A;},getColumnIds:function(){var A=[];var cm=this.grid.colModel;var B=cm.getColumnCount();for(var i=0;i<B;i++){A[i]=cm.getColumnId(i);}return A;},getDataIndexes:function(){if(!this.indexMap){this.indexMap=this.buildIndexMap();}return this.indexMap.colToData;
2603 },getColumnIndexByDataIndex:function(A){if(!this.indexMap){this.indexMap=this.buildIndexMap();}return this.indexMap.dataToCol[A];},setCSSStyle:function(A,B,C){var D="#"+this.grid.id+" .x-grid-col-"+A;Roo.util.CSS.updateRule(D,B,C);},generateRules:function(cm){var A=[],B=this.grid.id+'-cssrules';
2604 Roo.util.CSS.removeStyleSheet(B);for(var i=0,C=cm.getColumnCount();i<C;i++){var D=cm.getColumnId(i);A.push(this.colSelector,D," {\n",cm.config[i].css,"}\n",this.tdSelector,D," {\n}\n",this.hdSelector,D," {\n}\n",this.splitSelector,D," {\n}\n");}return Roo.util.CSS.createStyleSheet(A.join(""),B);
2605 }});
2606 // Roo/grid/HeaderDragZone.js
2607 Roo.grid.HeaderDragZone=function(A,hd,B){this.grid=A;this.view=A.getView();this.ddGroup="gridHeader"+this.grid.getGridEl().id;Roo.grid.HeaderDragZone.superclass.constructor.call(this,hd);if(B){this.setHandleElId(Roo.id(hd));this.setOuterHandleElId(Roo.id(B));
2608 }this.scroll=false;};Roo.extend(Roo.grid.HeaderDragZone,Roo.dd.DragZone,{maxDragWidth:120,getDragData:function(e){var t=Roo.lib.Event.getTarget(e);var h=this.view.findHeaderCell(t);if(h){return {ddel:h.firstChild,header:h};}return false;},onInitDrag:function(e){this.view.headersDisabled=true;
2609 var A=this.dragData.ddel.cloneNode(true);A.id=Roo.id();A.style.width=Math.min(this.dragData.header.offsetWidth,this.maxDragWidth)+"px";this.proxy.update(A);return true;},afterValidDrop:function(){var v=this.view;setTimeout(function(){v.headersDisabled=false;
2610 },50);},afterInvalidDrop:function(){var v=this.view;setTimeout(function(){v.headersDisabled=false;},50);}});
2611 // Roo/grid/HeaderDropZone.js
2612 Roo.grid.HeaderDropZone=function(A,hd,B){this.grid=A;this.view=A.getView();this.proxyTop=Roo.DomHelper.append(document.body,{cls:"col-move-top",html:"&#160;"},true);this.proxyBottom=Roo.DomHelper.append(document.body,{cls:"col-move-bottom",html:"&#160;"},true);
2613 this.proxyTop.hide=this.proxyBottom.hide=function(){this.setLeftTop(-100,-100);this.setStyle("visibility","hidden");};this.ddGroup="gridHeader"+this.grid.getGridEl().id;Roo.grid.HeaderDropZone.superclass.constructor.call(this,A.getGridEl().dom);};Roo.extend(Roo.grid.HeaderDropZone,Roo.dd.DropZone,{proxyOffsets:[-4,-9],fly:Roo.Element.fly,getTargetFromEvent:function(e){var t=Roo.lib.Event.getTarget(e);
2614 var A=this.view.findCellIndex(t);if(A!==false){return this.view.getHeaderCell(A);}return null;},nextVisible:function(h){var v=this.view,cm=this.grid.colModel;h=h.nextSibling;while(h){if(!cm.isHidden(v.getCellIndex(h))){return h;}h=h.nextSibling;}return null;
2615 },prevVisible:function(h){var v=this.view,cm=this.grid.colModel;h=h.prevSibling;while(h){if(!cm.isHidden(v.getCellIndex(h))){return h;}h=h.prevSibling;}return null;},positionIndicator:function(h,n,e){var x=Roo.lib.Event.getPageX(e);var r=Roo.lib.Dom.getRegion(n.firstChild);
2616 var px,pt,py=r.top+this.proxyOffsets[1];if((r.right-x)<=(r.right-r.left)/2){px=r.right+this.view.borderWidth;pt="after";}else{px=r.left;pt="before";}var A=this.view.getCellIndex(h);var B=this.view.getCellIndex(n);if(this.grid.colModel.isFixed(B)){return false;
2617 }var C=this.grid.colModel.isLocked(B);if(pt=="after"){B++;}if(A<B){B--;}if(A==B&&(C==this.grid.colModel.isLocked(A))){return false;}px+=this.proxyOffsets[0];this.proxyTop.setLeftTop(px,py);this.proxyTop.show();if(!this.bottomOffset){this.bottomOffset=this.view.mainHd.getHeight();
2618 }this.proxyBottom.setLeftTop(px,py+this.proxyTop.dom.offsetHeight+this.bottomOffset);this.proxyBottom.show();return pt;},onNodeEnter:function(n,dd,e,A){if(A.header!=n){this.positionIndicator(A.header,n,e);}},onNodeOver:function(n,dd,e,A){var B=false;if(A.header!=n){B=this.positionIndicator(A.header,n,e);
2619 }if(!B){this.proxyTop.hide();this.proxyBottom.hide();}return B?this.dropAllowed:this.dropNotAllowed;},onNodeOut:function(n,dd,e,A){this.proxyTop.hide();this.proxyBottom.hide();},onNodeDrop:function(n,dd,e,A){var h=A.header;if(h!=n){var cm=this.grid.colModel;
2620 var x=Roo.lib.Event.getPageX(e);var r=Roo.lib.Dom.getRegion(n.firstChild);var pt=(r.right-x)<=((r.right-r.left)/2)?"after":"before";var B=this.view.getCellIndex(h);var C=this.view.getCellIndex(n);var D=cm.isLocked(C);if(pt=="after"){C++;}if(B<C){C--;}if(B==C&&(D==cm.isLocked(B))){return false;
2621 }cm.setLocked(B,D,true);cm.moveColumn(B,C);this.grid.fireEvent("columnmove",B,C);return true;}return false;}});
2622 // Roo/grid/GridView.js
2623 Roo.grid.GridView=function(A){Roo.grid.GridView.superclass.constructor.call(this);this.el=null;Roo.apply(this,A);};Roo.extend(Roo.grid.GridView,Roo.grid.AbstractGridView,{unselectable:'unselectable="on"',unselectableCls:'x-unselectable',rowClass:"x-grid-row",cellClass:"x-grid-col",tdClass:"x-grid-td",hdClass:"x-grid-hd",splitClass:"x-grid-split",sortClasses:["sort-asc","sort-desc"],enableMoveAnim:false,hlColor:"C3DAF9",dh:Roo.DomHelper,fly:Roo.Element.fly,css:Roo.util.CSS,borderWidth:1,splitOffset:3,scrollIncrement:22,cellRE:/(?:.*?)x-grid-(?:hd|cell|csplit)-(?:[\d]+)-([\d]+)(?:.*?)/,findRE:/\s?(?:x-grid-hd|x-grid-col|x-grid-csplit)\s/,bind:function(ds,cm){if(this.ds){this.ds.un("load",this.onLoad,this);
2624 this.ds.un("datachanged",this.onDataChange,this);this.ds.un("add",this.onAdd,this);this.ds.un("remove",this.onRemove,this);this.ds.un("update",this.onUpdate,this);this.ds.un("clear",this.onClear,this);}if(ds){ds.on("load",this.onLoad,this);ds.on("datachanged",this.onDataChange,this);
2625 ds.on("add",this.onAdd,this);ds.on("remove",this.onRemove,this);ds.on("update",this.onUpdate,this);ds.on("clear",this.onClear,this);}this.ds=ds;if(this.cm){this.cm.un("widthchange",this.onColWidthChange,this);this.cm.un("headerchange",this.onHeaderChange,this);
2626 this.cm.un("hiddenchange",this.onHiddenChange,this);this.cm.un("columnmoved",this.onColumnMove,this);this.cm.un("columnlockchange",this.onColumnLock,this);}if(cm){this.generateRules(cm);cm.on("widthchange",this.onColWidthChange,this);cm.on("headerchange",this.onHeaderChange,this);
2627 cm.on("hiddenchange",this.onHiddenChange,this);cm.on("columnmoved",this.onColumnMove,this);cm.on("columnlockchange",this.onColumnLock,this);}this.cm=cm;},init:function(A){Roo.grid.GridView.superclass.init.call(this,A);this.bind(A.dataSource,A.colModel);A.on("headerclick",this.handleHeaderClick,this);
2628 if(A.trackMouseOver){A.on("mouseover",this.onRowOver,this);A.on("mouseout",this.onRowOut,this);}A.cancelTextSelection=function(){};this.gridId=A.id;var B=this.templates||{};if(!B.master){B.master=new Roo.Template('<div class="x-grid" hidefocus="true">','<a href="#" class="x-grid-focus" tabIndex="-1"></a>','<div class="x-grid-topbar"></div>','<div class="x-grid-scroller"><div></div></div>','<div class="x-grid-locked">','<div class="x-grid-header">{lockedHeader}</div>','<div class="x-grid-body">{lockedBody}</div>',"</div>",'<div class="x-grid-viewport">','<div class="x-grid-header">{header}</div>','<div class="x-grid-body">{body}</div>',"</div>",'<div class="x-grid-bottombar"></div>','<div class="x-grid-resize-proxy">&#160;</div>',"</div>");
2629 B.master.disableformats=true;}if(!B.header){B.header=new Roo.Template('<table border="0" cellspacing="0" cellpadding="0">','<tbody><tr class="x-grid-hd-row">{cells}</tr></tbody>',"</table>{splits}");B.header.disableformats=true;}B.header.compile();if(!B.hcell){B.hcell=new Roo.Template('<td class="x-grid-hd x-grid-td-{id} {cellId}"><div title="{title}" class="x-grid-hd-inner x-grid-hd-{id}">','<div class="x-grid-hd-text '+this.unselectableCls+'" '+this.unselectable+'>{value}<img class="x-grid-sort-icon" src="',Roo.BLANK_IMAGE_URL,'" /></div>',"</div></td>");
2630 B.hcell.disableFormats=true;}B.hcell.compile();if(!B.hsplit){B.hsplit=new Roo.Template('<div class="x-grid-split {splitId} x-grid-split-{id}" style="{style} '+this.unselectableCls+'" '+this.unselectable+'>&#160;</div>');B.hsplit.disableFormats=true;}B.hsplit.compile();
2631 if(!B.body){B.body=new Roo.Template('<table border="0" cellspacing="0" cellpadding="0">',"<tbody>{rows}</tbody>","</table>");B.body.disableFormats=true;}B.body.compile();if(!B.row){B.row=new Roo.Template('<tr class="x-grid-row {alt}">{cells}</tr>');B.row.disableFormats=true;
2632 }B.row.compile();if(!B.cell){B.cell=new Roo.Template('<td class="x-grid-col x-grid-td-{id} {cellId} {css}" tabIndex="0">','<div class="x-grid-col-{id} x-grid-cell-inner"><div class="x-grid-cell-text '+this.unselectableCls+'" '+this.unselectable+'" {attr}>{value}</div></div>',"</td>");
2633 B.cell.disableFormats=true;}B.cell.compile();this.templates=B;},onColWidthChange:function(){this.updateColumns.apply(this,arguments);},onHeaderChange:function(){this.updateHeaders.apply(this,arguments);},onHiddenChange:function(){this.handleHiddenChange.apply(this,arguments);
2634 },onColumnMove:function(){this.handleColumnMove.apply(this,arguments);},onColumnLock:function(){this.handleLockChange.apply(this,arguments);},onDataChange:function(){this.refresh();this.updateHeaderSortState();},onClear:function(){this.refresh();},onUpdate:function(ds,A){this.refreshRow(A);
2635 },refreshRow:function(A){var ds=this.ds,B;if(typeof A=='number'){B=A;A=ds.getAt(B);}else{B=ds.indexOf(A);}this.insertRows(ds,B,B,true);this.onRemove(ds,A,B+1,true);this.syncRowHeights(B,B);this.layout();this.fireEvent("rowupdated",this,B,A);},onAdd:function(ds,A,B){this.insertRows(ds,B,B+(A.length-1));
2636 },onRemove:function(ds,A,B,C){if(C!==true){this.fireEvent("beforerowremoved",this,B,A);}var bt=this.getBodyTable(),lt=this.getLockedTable();if(bt.rows[B]){bt.firstChild.removeChild(bt.rows[B]);}if(lt.rows[B]){lt.firstChild.removeChild(lt.rows[B]);}if(C!==true){this.stripeRows(B);
2637 this.syncRowHeights(B,B);this.layout();this.fireEvent("rowremoved",this,B,A);}},onLoad:function(){this.scrollToTop();},scrollToTop:function(){if(this.scroller){this.scroller.dom.scrollTop=0;this.syncScroll();}},getHeaderPanel:function(A){if(A){this.headerPanel.show();
2638 }return this.headerPanel;},getFooterPanel:function(A){if(A){this.footerPanel.show();}return this.footerPanel;},initElements:function(){var E=Roo.Element;var el=this.grid.getGridEl().dom.firstChild;var cs=el.childNodes;this.el=new E(el);this.focusEl=new E(el.firstChild);
2639 this.focusEl.swallowEvent("click",true);this.headerPanel=new E(cs[1]);this.headerPanel.enableDisplayMode("block");this.scroller=new E(cs[2]);this.scrollSizer=new E(this.scroller.dom.firstChild);this.lockedWrap=new E(cs[3]);this.lockedHd=new E(this.lockedWrap.dom.firstChild);
2640 this.lockedBody=new E(this.lockedWrap.dom.childNodes[1]);this.mainWrap=new E(cs[4]);this.mainHd=new E(this.mainWrap.dom.firstChild);this.mainBody=new E(this.mainWrap.dom.childNodes[1]);this.footerPanel=new E(cs[5]);this.footerPanel.enableDisplayMode("block");
2641 this.resizeProxy=new E(cs[6]);this.headerSelector=String.format('#{0} td.x-grid-hd, #{1} td.x-grid-hd',this.lockedHd.id,this.mainHd.id);this.splitterSelector=String.format('#{0} div.x-grid-split, #{1} div.x-grid-split',this.idToCssName(this.lockedHd.id),this.idToCssName(this.mainHd.id));
2642 },idToCssName:function(s){return s.replace(/[^a-z0-9]+/ig,'-');},getHeaderCell:function(A){return Roo.DomQuery.select(this.headerSelector)[A];},getHeaderCellMeasure:function(A){return this.getHeaderCell(A).firstChild;},getHeaderCellText:function(A){return this.getHeaderCell(A).firstChild.firstChild;
2643 },getLockedTable:function(){return this.lockedBody.dom.firstChild;},getBodyTable:function(){return this.mainBody.dom.firstChild;},getLockedRow:function(A){return this.getLockedTable().rows[A];},getRow:function(A){return this.getBodyTable().rows[A];},getRowComposite:function(A){if(!this.rowEl){this.rowEl=new Roo.CompositeElementLite();
2644 }var B=[],C,D;if(C=this.getLockedRow(A)){B.push(C);}if(D=this.getRow(A)){B.push(D);}this.rowEl.elements=B;return this.rowEl;},getCell:function(A,B){var C=this.cm.getLockedCount();var D;if(B<C){D=this.lockedBody.dom.firstChild;}else{D=this.mainBody.dom.firstChild;
2645 B-=C;}return D.rows[A].childNodes[B];},getCellText:function(A,B){return this.getCell(A,B).firstChild.firstChild;},getCellBox:function(A){var b=this.fly(A).getBox();if(Roo.isOpera){b.y=A.offsetTop+this.mainBody.getY();}return b;},getCellIndex:function(A){var id=String(A.className).match(this.cellRE);
2646 if(id){return parseInt(id[1],10);}return 0;},findHeaderIndex:function(n){var r=Roo.fly(n).findParent("td."+this.hdClass,6);return r?this.getCellIndex(r):false;},findHeaderCell:function(n){var r=Roo.fly(n).findParent("td."+this.hdClass,6);return r?r:false;
2647 },findRowIndex:function(n){if(!n){return false;}var r=Roo.fly(n).findParent("tr."+this.rowClass,6);return r?r.rowIndex:false;},findCellIndex:function(A){var B=this.el.dom;while(A&&A!=B){if(this.findRE.test(A.className)){return this.getCellIndex(A);}A=A.parentNode;
2648 }return false;},getColumnId:function(A){return this.cm.getColumnId(A);},getSplitters:function(){if(this.splitterSelector){return Roo.DomQuery.select(this.splitterSelector);}else{return null;}},getSplitter:function(A){return this.getSplitters()[A];},onRowOver:function(e,t){var A;
2649 if((A=this.findRowIndex(t))!==false){this.getRowComposite(A).addClass("x-grid-row-over");}},onRowOut:function(e,t){var A;if((A=this.findRowIndex(t))!==false&&A!==this.findRowIndex(e.getRelatedTarget())){this.getRowComposite(A).removeClass("x-grid-row-over");
2650 }},renderHeaders:function(){var cm=this.cm;var ct=this.templates.hcell,ht=this.templates.header,st=this.templates.hsplit;var cb=[],lb=[],sb=[],A=[],p={};for(var i=0,B=cm.getColumnCount();i<B;i++){p.cellId="x-grid-hd-0-"+i;p.splitId="x-grid-csplit-0-"+i;p.id=cm.getColumnId(i);
2651 p.value=cm.getColumnHeader(i)||"";p.title=cm.getColumnTooltip(i)||(''+p.value).match(/\</)?'':p.value||"";p.style=(this.grid.enableColumnResize===false||!cm.isResizable(i)||cm.isFixed(i))?'cursor:default':'';if(!cm.isLocked(i)){cb[cb.length]=ct.apply(p);sb[sb.length]=st.apply(p);
2652 }else{lb[lb.length]=ct.apply(p);A[A.length]=st.apply(p);}}return [ht.apply({cells:lb.join(""),splits:A.join("")}),ht.apply({cells:cb.join(""),splits:sb.join("")})];},updateHeaders:function(){var A=this.renderHeaders();this.lockedHd.update(A[0]);this.mainHd.update(A[1]);
2653 },focusRow:function(A){var x=this.scroller.dom.scrollLeft;this.focusCell(A,0,false);this.scroller.dom.scrollLeft=x;},focusCell:function(A,B,C){var el=this.ensureVisible(A,B,C);this.focusEl.alignTo(el,"tl-tl");if(Roo.isGecko){this.focusEl.focus();}else{this.focusEl.focus.defer(1,this.focusEl);
2654 }},ensureVisible:function(A,B,C){if(typeof A!="number"){A=A.rowIndex;}if(A<0&&A>=this.ds.getCount()){return null;}B=(B!==undefined?B:0);var cm=this.grid.colModel;while(cm.isHidden(B)){B++;}var el=this.getCell(A,B);if(!el){return null;}var c=this.scroller.dom;
2655 var D=parseInt(el.offsetTop,10);var E=parseInt(el.offsetLeft,10);var F=D+el.offsetHeight;var G=E+el.offsetWidth;var ch=c.clientHeight-this.mainHd.dom.offsetHeight;var H=parseInt(c.scrollTop,10);var I=parseInt(c.scrollLeft,10);var J=H+ch;var K=I+c.clientWidth;
2656 if(D<H){c.scrollTop=D;}else if(F>J){c.scrollTop=F-ch;}if(C!==false){if(E<I){c.scrollLeft=E;}else if(G>K){c.scrollLeft=G-c.clientWidth;}}return el;},updateColumns:function(){this.grid.stopEditing();var cm=this.grid.colModel,A=this.getColumnIds();var B=0;for(var i=0,C=cm.getColumnCount();
2657 i<C;i++){var w=cm.getColumnWidth(i);this.css.updateRule(this.colSelector+this.idToCssName(A[i]),"width",(w-this.borderWidth)+"px");this.css.updateRule(this.hdSelector+this.idToCssName(A[i]),"width",(w-this.borderWidth)+"px");}this.updateSplitters();},generateRules:function(cm){var A=[],B=this.idToCssName(this.grid.id)+'-cssrules';
2658 Roo.util.CSS.removeStyleSheet(B);for(var i=0,C=cm.getColumnCount();i<C;i++){var D=cm.getColumnId(i);var E='';if(cm.config[i].align){E='text-align:'+cm.config[i].align+';';}var F='';if(cm.isHidden(i)){F='display:none;';}var G="width:"+(cm.getColumnWidth(i)-this.borderWidth)+"px;";
2659 A.push(this.colSelector,D," {\n",cm.config[i].css,E,G,"\n}\n",this.hdSelector,D," {\n",E,G,"}\n",this.tdSelector,D," {\n",F,"\n}\n",this.splitSelector,D," {\n",F,"\n}\n");}return Roo.util.CSS.createStyleSheet(A.join(""),B);},updateSplitters:function(){var cm=this.cm,s=this.getSplitters();
2660 if(s){var A=0,B=true;for(var i=0,C=cm.getColumnCount();i<C;i++){if(cm.isHidden(i)){continue;}var w=cm.getColumnWidth(i);if(!cm.isLocked(i)&&B){A=0;B=false;}A+=w;s[i].style.left=(A-this.splitOffset)+"px";}}},handleHiddenChange:function(A,B,C){if(C){this.hideColumn(B);
2661 }else{this.unhideColumn(B);}},hideColumn:function(A){var B=this.getColumnId(A);this.css.updateRule(this.tdSelector+this.idToCssName(B),"display","none");this.css.updateRule(this.splitSelector+this.idToCssName(B),"display","none");if(Roo.isSafari){this.updateHeaders();
2662 }this.updateSplitters();this.layout();},unhideColumn:function(A){var B=this.getColumnId(A);this.css.updateRule(this.tdSelector+this.idToCssName(B),"display","");this.css.updateRule(this.splitSelector+this.idToCssName(B),"display","");if(Roo.isSafari){this.updateHeaders();
2663 }this.updateSplitters();this.layout();},insertRows:function(dm,A,B,C){if(A==0&&B==dm.getCount()-1){this.refresh();}else{if(!C){this.fireEvent("beforerowsinserted",this,A,B);}var s=this.getScrollState();var D=this.renderRows(A,B);this.bufferRows(D[0],this.getLockedTable(),A);
2664 this.bufferRows(D[1],this.getBodyTable(),A);this.restoreScroll(s);if(!C){this.fireEvent("rowsinserted",this,A,B);this.syncRowHeights(A,B);this.stripeRows(A);this.layout();}}},bufferRows:function(A,B,C){var D=null,E=B.rows,F=B.tBodies[0];if(C<E.length){D=E[C];
2665 }var b=document.createElement("div");b.innerHTML="<table><tbody>"+A+"</tbody></table>";var G=b.firstChild.rows;for(var i=0,H=G.length;i<H;i++){if(D){F.insertBefore(G[0],D);}else{F.appendChild(G[0]);}}b.innerHTML="";b=null;},deleteRows:function(dm,A,B){if(dm.getRowCount()<1){this.fireEvent("beforerefresh",this);
2666 this.mainBody.update("");this.lockedBody.update("");this.fireEvent("refresh",this);}else{this.fireEvent("beforerowsdeleted",this,A,B);var bt=this.getBodyTable();var C=bt.firstChild;var D=bt.rows;for(var E=A;E<=B;E++){C.removeChild(D[A]);}this.stripeRows(A);
2667 this.fireEvent("rowsdeleted",this,A,B);}},updateRows:function(A,B,C){var s=this.getScrollState();this.refresh();this.restoreScroll(s);},handleSort:function(A,B,C,D){if(!D){this.refresh();}this.updateHeaderSortState();},getScrollState:function(){var sb=this.scroller.dom;
2668 return {left:sb.scrollLeft,top:sb.scrollTop};},stripeRows:function(A){if(!this.grid.stripeRows||this.ds.getCount()<1){return;}A=A||0;var B=this.getBodyTable().rows;var C=this.getLockedTable().rows;var D=' x-grid-row-alt ';for(var i=A,E=B.length;i<E;i++){var F=B[i],G=C[i];
2669 var H=((i+1)%2==0);var I=(' '+F.className+' ').indexOf(D)!=-1;if(H==I){continue;}if(H){F.className+=" x-grid-row-alt";}else{F.className=F.className.replace("x-grid-row-alt","");}if(G){G.className=F.className;}}},restoreScroll:function(A){var sb=this.scroller.dom;
2670 sb.scrollLeft=A.left;sb.scrollTop=A.top;this.syncScroll();},syncScroll:function(){var sb=this.scroller.dom;var sh=this.mainHd.dom;var bs=this.mainBody.dom;var lv=this.lockedBody.dom;sh.scrollLeft=bs.scrollLeft=sb.scrollLeft;lv.scrollTop=bs.scrollTop=sb.scrollTop;
2671 },handleScroll:function(e){this.syncScroll();var sb=this.scroller.dom;this.grid.fireEvent("bodyscroll",sb.scrollLeft,sb.scrollTop);e.stopEvent();},handleWheel:function(e){var d=e.getWheelDelta();this.scroller.dom.scrollTop-=d*22;this.lockedBody.dom.scrollTop=this.mainBody.dom.scrollTop=this.scroller.dom.scrollTop;
2672 e.stopEvent();},renderRows:function(A,B){var g=this.grid,cm=g.colModel,ds=g.dataSource,C=g.stripeRows;var D=cm.getColumnCount();if(ds.getCount()<1){return ["",""];}var cs=[];for(var i=0;i<D;i++){var E=cm.getDataIndex(i);cs[i]={name:typeof E=='undefined'?ds.fields.get(i).name:E,renderer:cm.getRenderer(i),id:cm.getColumnId(i),locked:cm.isLocked(i),has_editor:cm.isCellEditable(i)}
2673 ;}A=A||0;B=typeof B=="undefined"?ds.getCount()-1:B;var rs=ds.getRange(A,B);return this.doRender(cs,rs,ds,A,D,C);},doRender:Roo.isGecko?function(cs,rs,ds,A,B,C){var ts=this.templates,ct=ts.cell,rt=ts.row;var D="",E="",cb,F,c,p={},rp={},r,G;var H=this.grid.hasListener('rowclass');
2674 var I={};for(var j=0,J=rs.length;j<J;j++){r=rs[j];cb="";F="";G=(j+A);for(var i=0;i<B;i++){c=cs[i];p.cellId="x-grid-cell-"+G+"-"+i;p.id=c.id;p.css=p.attr="";p.value=c.renderer(r.data[c.name],p,r,G,i,ds);if(p.value==undefined||p.value===""){p.value="&#160;";
2675 }if(c.has_editor){p.css+=' x-grid-editable-cell';}if(c.dirty&&typeof r.modified[c.name]!=='undefined'){p.css+=' x-grid-dirty-cell';}var K=ct.apply(p);if(!c.locked){cb+=K;}else{F+=K;}}var L=[];if(C&&((G+1)%2==0)){L.push("x-grid-row-alt")}if(r.dirty){L.push(" x-grid-dirty-row");
2676 }rp.cells=F;if(this.getRowClass){L.push(this.getRowClass(r,G));}if(H){I={record:r,rowIndex:G,rowClass:''};this.grid.fireEvent('rowclass',this,I);L.push(I.rowClass);}rp.alt=L.join(" ");E+=rt.apply(rp);rp.cells=cb;D+=rt.apply(rp);}return [E,D];}:function(cs,rs,ds,A,B,C){var ts=this.templates,ct=ts.cell,rt=ts.row;
2677 var D=[],E=[],cb,F,c,p={},rp={},r,G;var H=this.grid.hasListener('rowclass');var I={};for(var j=0,J=rs.length;j<J;j++){r=rs[j];cb=[];F=[];G=(j+A);for(var i=0;i<B;i++){c=cs[i];p.cellId="x-grid-cell-"+G+"-"+i;p.id=c.id;p.css=p.attr="";p.value=c.renderer(r.data[c.name],p,r,G,i,ds);
2678 if(p.value==undefined||p.value===""){p.value="&#160;";}if(c.has_editor){p.css+=' x-grid-editable-cell';}if(r.dirty&&typeof r.modified[c.name]!=='undefined'){p.css+=' x-grid-dirty-cell'}var K=ct.apply(p);if(!c.locked){cb[cb.length]=K;}else{F[F.length]=K;}}
2679 var L=[];if(C&&((G+1)%2==0)){L.push("x-grid-row-alt");}if(r.dirty){L.push(" x-grid-dirty-row");}rp.cells=F;if(this.getRowClass){L.push(this.getRowClass(r,G));}if(H){I={record:r,rowIndex:G,rowClass:''};this.grid.fireEvent('rowclass',this,I);L.push(I.rowClass);
2680 }rp.alt=L.join(" ");rp.cells=F.join("");E[E.length]=rt.apply(rp);rp.cells=cb.join("");D[D.length]=rt.apply(rp);}return [E.join(""),D.join("")];},renderBody:function(){var A=this.renderRows();var bt=this.templates.body;return [bt.apply({rows:A[0]}),bt.apply({rows:A[1]}
2681 )];},refresh:function(A){this.fireEvent("beforerefresh",this);this.grid.stopEditing();var B=this.renderBody();this.lockedBody.update(B[0]);this.mainBody.update(B[1]);if(A===true){this.updateHeaders();this.updateColumns();this.updateSplitters();this.updateHeaderSortState();
2682 }this.syncRowHeights();this.layout();this.fireEvent("refresh",this);},handleColumnMove:function(cm,A,B){this.indexMap=null;var s=this.getScrollState();this.refresh(true);this.restoreScroll(s);this.afterMove(B);},afterMove:function(A){if(this.enableMoveAnim&&Roo.enableFx){this.fly(this.getHeaderCell(A).firstChild).highlight(this.hlColor);
2683 }if(this.grid.dataSource.multiSort){var dm=this.grid.dataSource;var cm=this.grid.colModel;var so=[];for(var i=0;i<cm.config.length;i++){if((typeof(dm.sortToggle[cm.config[i].dataIndex])=='undefined')){continue;}so.push(cm.config[i].dataIndex);};dm.sortOrder=so;
2684 dm.load(dm.lastOptions);}},updateCell:function(dm,A,B){var C=this.getColumnIndexByDataIndex(B);if(typeof C=="undefined"){return;}var cm=this.grid.colModel;var D=this.getCell(A,C);var E=this.getCellText(A,C);var p={cellId:"x-grid-cell-"+A+"-"+C,id:cm.getColumnId(C),css:C==cm.getColumnCount()-1?"x-grid-col-last":""}
2685 ;var F=cm.getRenderer(C);var G=F(dm.getValueAt(A,B),p,A,C,dm);if(typeof G=="undefined"||G===""){G="&#160;";}E.innerHTML=G;D.className=this.cellClass+" "+this.idToCssName(p.cellId)+" "+p.css;this.syncRowHeights(A,A);},calcColumnWidth:function(A,B){var C=0;
2686 if(this.grid.autoSizeHeaders){var h=this.getHeaderCellMeasure(A);C=Math.max(C,h.scrollWidth);}var tb,D;if(this.cm.isLocked(A)){tb=this.getLockedTable();D=A;}else{tb=this.getBodyTable();D=A-this.cm.getLockedCount();}if(tb&&tb.rows){var E=tb.rows;var F=Math.min(B||E.length,E.length);
2687 for(var i=0;i<F;i++){var G=E[i].childNodes[D].firstChild;C=Math.max(C,G.scrollWidth);}}return C+5;},autoSizeColumn:function(A,B,C){if(this.cm.isHidden(A)){return;}if(B){var D=this.cm.getColumnId(A);this.css.updateRule(this.colSelector+this.idToCssName(D),"width",this.grid.minColumnWidth+"px");
2688 if(this.grid.autoSizeHeaders){this.css.updateRule(this.hdSelector+this.idToCssName(D),"width",this.grid.minColumnWidth+"px");}}var E=this.calcColumnWidth(A);this.cm.setColumnWidth(A,Math.max(this.grid.minColumnWidth,E),C);if(!C){this.grid.fireEvent("columnresize",A,E);
2689 }},autoSizeColumns:function(){var cm=this.grid.colModel;var A=cm.getColumnCount();for(var i=0;i<A;i++){this.autoSizeColumn(i,true,true);}if(cm.getTotalWidth()<this.scroller.dom.clientWidth){this.fitColumns();}else{this.updateColumns();this.layout();}},fitColumns:function(A){var cm=this.grid.colModel;
2690 var B=cm.getColumnCount();var C=[];var D=0;var i,w;for(i=0;i<B;i++){if(!cm.isHidden(i)&&!cm.isFixed(i)){w=cm.getColumnWidth(i);C.push(i);C.push(w);D+=w;}}var E=Math.min(this.scroller.dom.clientWidth,this.el.getWidth());if(A){E-=17;}var F=(E-cm.getTotalWidth())/D;
2691 while(C.length){w=C.pop();i=C.pop();cm.setColumnWidth(i,Math.floor(w+w*F),true);}this.updateColumns();this.layout();},onRowSelect:function(A){var B=this.getRowComposite(A);B.addClass("x-grid-row-selected");},onRowDeselect:function(A){var B=this.getRowComposite(A);
2692 B.removeClass("x-grid-row-selected");},onCellSelect:function(A,B){var C=this.getCell(A,B);if(C){Roo.fly(C).addClass("x-grid-cell-selected");}},onCellDeselect:function(A,B){var C=this.getCell(A,B);if(C){Roo.fly(C).removeClass("x-grid-cell-selected");}},updateHeaderSortState:function(){var A={}
2693 ;if(!this.ds.multiSort){var B=this.ds.getSortState();if(!B){return;}A[B.field]=B.direction;this.sortState=B;}else{A=this.ds.sortToggle;}var sc=this.sortClasses;var C=this.el.select(this.headerSelector).removeClass(sc);for(var f in A){var D=this.cm.findColumnIndex(f);
2694 if(D!=-1){var E=A[f];C.item(D).addClass(sc[E=="DESC"?1:0]);}}},handleHeaderClick:function(g,A,e){Roo.log("header click");if(Roo.isTouch){this.handleHdCtx(g,A,e);return;}if(this.headersDisabled){return;}var dm=g.dataSource,cm=g.colModel;if(!cm.isSortable(A)){return;
2695 }g.stopEditing();if(dm.multiSort){var so=[];for(var i=0;i<cm.config.length;i++){if((typeof(dm.sortToggle[cm.config[i].dataIndex])=='undefined')&&(A!=i)){continue;}so.push(cm.config[i].dataIndex);};dm.sortOrder=so;}dm.sort(cm.getDataIndex(A));},destroy:function(){if(this.colMenu){this.colMenu.removeAll();
2696 Roo.menu.MenuMgr.unregister(this.colMenu);this.colMenu.getEl().remove();delete this.colMenu;}if(this.hmenu){this.hmenu.removeAll();Roo.menu.MenuMgr.unregister(this.hmenu);this.hmenu.getEl().remove();delete this.hmenu;}if(this.grid.enableColumnMove){var A=Roo.dd.DDM.ids['gridHeader'+this.grid.getGridEl().id];
2697 if(A){for(var dd in A){if(!A[dd].config.isTarget&&A[dd].dragElId){var B=A[dd].dragElId;A[dd].unreg();Roo.get(B).remove();}else if(A[dd].config.isTarget){A[dd].proxyTop.remove();A[dd].proxyBottom.remove();A[dd].unreg();}if(Roo.dd.DDM.locationCache[dd]){delete Roo.dd.DDM.locationCache[dd];
2698 }}delete Roo.dd.DDM.ids['gridHeader'+this.grid.getGridEl().id];}}Roo.util.CSS.removeStyleSheet(this.idToCssName(this.grid.id)+'-cssrules');this.bind(null,null);Roo.EventManager.removeResizeListener(this.onWindowResize,this);},handleLockChange:function(){this.refresh(true);
2699 },onDenyColumnLock:function(){},onDenyColumnHide:function(){},handleHdMenuClick:function(A){var B=this.hdCtxIndex;var cm=this.cm,ds=this.ds;switch(A.id){case "asc":ds.sort(cm.getDataIndex(B),"ASC");break;case "desc":ds.sort(cm.getDataIndex(B),"DESC");break;
2700 case "lock":var lc=cm.getLockedCount();if(cm.getColumnCount(true)<=lc+1){this.onDenyColumnLock();return;}if(lc!=B){cm.setLocked(B,true,true);cm.moveColumn(B,lc);this.grid.fireEvent("columnmove",B,lc);}else{cm.setLocked(B,true);}break;case "unlock":var lc=cm.getLockedCount();
2701 if((lc-1)!=B){cm.setLocked(B,false,true);cm.moveColumn(B,lc-1);this.grid.fireEvent("columnmove",B,lc-1);}else{cm.setLocked(B,false);}break;case 'wider':case 'narrow':var cw=cm.getColumnWidth(B);cw+=(A.id=='wider'?1:-1)*50;cw=Math.max(0,cw);cw=Math.min(cw,4000);
2702 cm.setColumnWidth(B,cw);break;default:B=cm.getIndexById(A.id.substr(4));if(B!=-1){if(A.checked&&cm.getColumnCount(true)<=1){this.onDenyColumnHide();return false;}cm.setHidden(B,A.checked);}}return true;},beforeColMenuShow:function(){var cm=this.cm,A=cm.getColumnCount();
2703 this.colMenu.removeAll();var B=[];for(var i=0;i<A;i++){B.push({id:"col-"+cm.getColumnId(i),text:cm.getColumnHeader(i),checked:!cm.isHidden(i),hideOnClick:false});}if(this.grid.sortColMenu){B.sort(function(a,b){if(a.text==b.text){return 0;}return a.text.toUpperCase()>b.text.toUpperCase()?1:-1;
2704 });}for(var i=0;i<A;i++){this.colMenu.add(new Roo.menu.CheckItem(B[i]));}},handleHdCtx:function(g,A,e){e.stopEvent();var hd=this.getHeaderCell(A);this.hdCtxIndex=A;var ms=this.hmenu.items,cm=this.cm;ms.get("asc").setDisabled(!cm.isSortable(A));ms.get("desc").setDisabled(!cm.isSortable(A));
2705 if(this.grid.enableColLock!==false){ms.get("lock").setDisabled(cm.isLocked(A));ms.get("unlock").setDisabled(!cm.isLocked(A));}this.hmenu.show(hd,"tl-bl");},handleHdOver:function(e){var hd=this.findHeaderCell(e.getTarget());if(hd&&!this.headersDisabled){if(this.grid.colModel.isSortable(this.getCellIndex(hd))){this.fly(hd).addClass("x-grid-hd-over");
2706 }}},handleHdOut:function(e){var hd=this.findHeaderCell(e.getTarget());if(hd){this.fly(hd).removeClass("x-grid-hd-over");}},handleSplitDblClick:function(e,t){var i=this.getCellIndex(t);if(this.grid.enableColumnResize!==false&&this.cm.isResizable(i)&&!this.cm.isFixed(i)){this.autoSizeColumn(i,true);
2707 this.layout();}},render:function(){var cm=this.cm;var A=cm.getColumnCount();if(this.grid.monitorWindowResize===true){Roo.EventManager.onWindowResize(this.onWindowResize,this,true);}var B=this.renderHeaders();var C=this.templates.body.apply({rows:""});var D=this.templates.master.apply({lockedBody:C,body:C,lockedHeader:B[0],header:B[1]}
2708 );this.grid.getGridEl().dom.innerHTML=D;this.initElements();this.el.on("scroll",function(){this.el.dom.scrollTop=0;},this);this.scroller.on("scroll",this.handleScroll,this);this.lockedBody.on("mousewheel",this.handleWheel,this);this.mainBody.on("mousewheel",this.handleWheel,this);
2709 this.mainHd.on("mouseover",this.handleHdOver,this);this.mainHd.on("mouseout",this.handleHdOut,this);this.mainHd.on("dblclick",this.handleSplitDblClick,this,{delegate:"."+this.splitClass});this.lockedHd.on("mouseover",this.handleHdOver,this);this.lockedHd.on("mouseout",this.handleHdOut,this);
2710 this.lockedHd.on("dblclick",this.handleSplitDblClick,this,{delegate:"."+this.splitClass});if(this.grid.enableColumnResize!==false&&Roo.grid.SplitDragZone){new Roo.grid.SplitDragZone(this.grid,this.lockedHd.dom,this.mainHd.dom);}this.updateSplitters();if(this.grid.enableColumnMove&&Roo.grid.HeaderDragZone){new Roo.grid.HeaderDragZone(this.grid,this.lockedHd.dom,this.mainHd.dom);
2711 new Roo.grid.HeaderDropZone(this.grid,this.lockedHd.dom,this.mainHd.dom);}if(this.grid.enableCtxMenu!==false&&Roo.menu.Menu){this.hmenu=new Roo.menu.Menu({id:this.grid.id+"-hctx"});this.hmenu.add({id:"asc",text:this.sortAscText,cls:"xg-hmenu-sort-asc"},{id:"desc",text:this.sortDescText,cls:"xg-hmenu-sort-desc"}
2712 );if(this.grid.enableColLock!==false){this.hmenu.add('-',{id:"lock",text:this.lockText,cls:"xg-hmenu-lock"},{id:"unlock",text:this.unlockText,cls:"xg-hmenu-unlock"});}if(Roo.isTouch){this.hmenu.add('-',{id:"wider",text:this.columnsWiderText},{id:"narrow",text:this.columnsNarrowText}
2713 );}if(this.grid.enableColumnHide!==false){this.colMenu=new Roo.menu.Menu({id:this.grid.id+"-hcols-menu"});this.colMenu.on("beforeshow",this.beforeColMenuShow,this);this.colMenu.on("itemclick",this.handleHdMenuClick,this);this.hmenu.add('-',{id:"columns",text:this.columnsText,menu:this.colMenu}
2714 );}this.hmenu.on("itemclick",this.handleHdMenuClick,this);this.grid.on("headercontextmenu",this.handleHdCtx,this);}if((this.grid.enableDragDrop||this.grid.enableDrag)&&Roo.grid.GridDragZone){this.dd=new Roo.grid.GridDragZone(this.grid,{ddGroup:this.grid.ddGroup||'GridDD'}
2715 );}this.updateHeaderSortState();this.beforeInitialResize();this.layout(true);this.renderPhase2.defer(1,this);},renderPhase2:function(){this.refresh();if(this.grid.autoSizeColumns){this.autoSizeColumns();}},beforeInitialResize:function(){},onColumnSplitterMoved:function(i,w){this.userResized=true;
2716 var cm=this.grid.colModel;cm.setColumnWidth(i,w,true);var A=cm.getColumnId(i);this.css.updateRule(this.colSelector+this.idToCssName(A),"width",(w-this.borderWidth)+"px");this.css.updateRule(this.hdSelector+this.idToCssName(A),"width",(w-this.borderWidth)+"px");
2717 this.updateSplitters();this.layout();this.grid.fireEvent("columnresize",i,w);},syncRowHeights:function(A,B){if(this.grid.enableRowHeightSync===true&&this.cm.getLockedCount()>0){A=A||0;var C=this.getBodyTable().rows;var D=this.getLockedTable().rows;var E=C.length-1;
2718 B=Math.min(B||E,E);for(var i=A;i<=B;i++){var m=C[i],l=D[i];var h=Math.max(m.offsetHeight,l.offsetHeight);m.style.height=l.style.height=h+"px";}}},layout:function(A,B){var g=this.grid;var C=g.autoHeight;var D=16;var c=g.getGridEl(),cm=this.cm,E=g.autoExpandColumn,gv=this;
2719 if(!c.dom.offsetWidth){if(A){this.lockedWrap.show();this.mainWrap.show();}return;}var F=this.cm.isLocked(0);var G=this.headerPanel.getHeight();var H=this.footerPanel.getHeight();if(C){var ch=this.getBodyTable().offsetHeight+G+H+this.mainHd.getHeight();var I=ch+c.getBorderWidth("tb");
2720 if(g.maxHeight){I=Math.min(g.maxHeight,I);}c.setHeight(I);}if(g.autoWidth){c.setWidth(cm.getTotalWidth()+c.getBorderWidth('lr'));}var s=this.scroller;var J=c.getSize(true);this.el.setSize(J.width,J.height);this.headerPanel.setWidth(J.width);this.footerPanel.setWidth(J.width);
2721 var K=this.mainHd.getHeight();var vw=J.width;var vh=J.height-(G+H);s.setSize(vw,vh);var bt=this.getBodyTable();if(cm.getLockedCount()==cm.config.length){bt=this.getLockedTable();}var L=F?Math.max(this.getLockedTable().offsetWidth,this.lockedHd.dom.firstChild.offsetWidth):0;
2722 var M=bt.offsetHeight;var N=L+bt.offsetWidth;var O=false,P=false;this.scrollSizer.setSize(N,M+K);var lw=this.lockedWrap,mw=this.mainWrap;var lb=this.lockedBody,mb=this.mainBody;setTimeout(function(){var t=s.dom.offsetTop;var w=s.dom.clientWidth,h=s.dom.clientHeight;
2723 lw.setTop(t);lw.setSize(L,h);mw.setLeftTop(L,t);mw.setSize(w-L,h);lb.setHeight(h-K);mb.setHeight(h-K);if(B!==true&&!gv.userResized&&E){var ci=cm.getIndexById(E);if(ci<0){ci=cm.findColumnIndex(E);}ci=Math.max(0,ci);var Q=cm.getColumnId(ci);var tw=cm.getTotalWidth(false);
2724 var R=cm.getColumnWidth(ci);var cw=Math.min(Math.max(((w-tw)+R-2)-(w<=s.dom.offsetWidth?0:18),g.autoExpandMin),g.autoExpandMax);if(R!=cw){cm.setColumnWidth(ci,cw,true);gv.css.updateRule(gv.colSelector+gv.idToCssName(Q),"width",(cw-gv.borderWidth)+"px");gv.css.updateRule(gv.hdSelector+gv.idToCssName(Q),"width",(cw-gv.borderWidth)+"px");
2725 gv.updateSplitters();gv.layout(false,true);}}if(A){lw.show();mw.show();}},10);},onWindowResize:function(){if(!this.grid.monitorWindowResize||this.grid.autoHeight){return;}this.layout();},appendFooter:function(A){return null;},sortAscText:"Sort Ascending",sortDescText:"Sort Descending",lockText:"Lock Column",unlockText:"Unlock Column",columnsText:"Columns",columnsWiderText:"Wider",columnsNarrowText:"Thinner"}
2726 );Roo.grid.GridView.ColumnDragZone=function(A,hd){Roo.grid.GridView.ColumnDragZone.superclass.constructor.call(this,A,hd,null);this.proxy.el.addClass('x-grid3-col-dd');};Roo.extend(Roo.grid.GridView.ColumnDragZone,Roo.grid.HeaderDragZone,{handleMouseDown:function(e){}
2727 ,callHandleMouseDown:function(e){Roo.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this,e);}});
2728 // Roo/grid/SplitDragZone.js
2729 Roo.grid.SplitDragZone=function(A,hd,B){this.grid=A;this.view=A.getView();this.proxy=this.view.resizeProxy;Roo.grid.SplitDragZone.superclass.constructor.call(this,hd,"gridSplitters"+this.grid.getGridEl().id,{dragElId:Roo.id(this.proxy.dom),resizeFrame:false}
2730 );this.setHandleElId(Roo.id(hd));if(B!==false){this.setOuterHandleElId(Roo.id(B));}this.scroll=false;};Roo.extend(Roo.grid.SplitDragZone,Roo.dd.DDProxy,{fly:Roo.Element.fly,b4StartDrag:function(x,y){this.view.headersDisabled=true;var h=this.view.mainWrap?this.view.mainWrap.getHeight():(this.view.headEl.getHeight()+this.view.bodyEl.getHeight());
2731 this.proxy.setHeight(h);var w=this.cm.getColumnWidth(this.cellIndex);if(!this.view.mainWrap){w=this.view.getHeaderIndex(this.cellIndex).getWidth();}var A=Math.max(w-this.grid.minColumnWidth,0);this.resetConstraints();this.setXConstraint(A,1000);this.setYConstraint(0,0);
2732 this.minX=x-A;this.maxX=x+1000;this.startPos=x;if(!this.view.mainWrap){this.getDragEl().style.display='block';}Roo.dd.DDProxy.prototype.b4StartDrag.call(this,x,y);},handleMouseDown:function(e){ev=Roo.EventObject.setEvent(e);var t=this.fly(ev.getTarget());
2733 if(t.hasClass("x-grid-split")){this.cellIndex=this.view.getCellIndex(t.dom);this.split=t.dom;this.cm=this.grid.colModel;if(this.cm.isResizable(this.cellIndex)&&!this.cm.isFixed(this.cellIndex)){Roo.grid.SplitDragZone.superclass.handleMouseDown.apply(this,arguments);
2734 }}},endDrag:function(e){this.view.headersDisabled=false;var A=Math.max(this.minX,Roo.lib.Event.getPageX(e));var B=A-this.startPos;var w=this.cm.getColumnWidth(this.cellIndex);if(!this.view.mainWrap){w=0;}this.view.onColumnSplitterMoved(this.cellIndex,w+B);
2735 },autoOffset:function(){this.setDelta(0,0);}});
2736 // Roo/grid/GridDragZone.js
2737 Roo.grid.GridDragZone=function(A,B){this.view=A.getView();Roo.grid.GridDragZone.superclass.constructor.call(this,this.view.mainBody.dom,B);if(this.view.lockedBody){this.setHandleElId(Roo.id(this.view.mainBody.dom));this.setOuterHandleElId(Roo.id(this.view.lockedBody.dom));
2738 }this.scroll=false;this.grid=A;this.ddel=document.createElement('div');this.ddel.className='x-grid-dd-wrap';};Roo.extend(Roo.grid.GridDragZone,Roo.dd.DragZone,{ddGroup:"GridDD",getDragData:function(e){var t=Roo.lib.Event.getTarget(e);var A=this.view.findRowIndex(t);
2739 var sm=this.grid.selModel;if(sm.getSelectedCell){if(!sm.getSelectedCell()){return false;}if(A!=sm.getSelectedCell()[0]){return false;}}if(sm.getSelections&&sm.getSelections().length<1){return false;}if(A!==false){if(e.hasModifier()){sm.handleMouseDown(e,t);
2740 }Roo.log("getDragData");return {grid:this.grid,ddel:this.ddel,rowIndex:A,selections:sm.getSelections?sm.getSelections():(sm.getSelectedCell()?[this.grid.ds.getAt(sm.getSelectedCell()[0])]:[])};}return false;},onInitDrag:function(e){var A=this.dragData;this.ddel.innerHTML=this.grid.getDragDropText();
2741 this.proxy.update(this.ddel);},afterRepair:function(){this.dragging=false;},getRepairXY:function(e,A){return false;},onEndDrag:function(A,e){},onValidDrop:function(dd,e,id){this.hideProxy();},beforeInvalidDrop:function(e,id){}});
2742 // Roo/grid/ColumnModel.js
2743 Roo.grid.ColumnModel=function(A){this.config=[];this.lookup={};for(var i=0,B=A.length;i<B;i++){this.addColumn(A[i]);}this.defaultWidth=100;this.defaultSortable=false;this.addEvents({"widthchange":true,"headerchange":true,"hiddenchange":true,"columnmoved":true,"columnlockchange":true}
2744 );Roo.grid.ColumnModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.ColumnModel,Roo.util.Observable,{getColumnId:function(A){return this.config[A].id;},getColumnById:function(id){return this.lookup[id];},getColumnByDataIndex:function(A){var B=this.findColumnIndex(A);
2745 return B>-1?this.config[B]:false;},getIndexById:function(id){for(var i=0,A=this.config.length;i<A;i++){if(this.config[i].id==id){return i;}}return -1;},findColumnIndex:function(A){for(var i=0,B=this.config.length;i<B;i++){if(this.config[i].dataIndex==A){return i;
2746 }}return -1;},moveColumn:function(A,B){var c=this.config[A];this.config.splice(A,1);this.config.splice(B,0,c);this.dataMap=null;this.fireEvent("columnmoved",this,A,B);},isLocked:function(A){return this.config[A].locked===true;},setLocked:function(A,B,C){if(this.isLocked(A)==B){return;
2747 }this.config[A].locked=B;if(!C){this.fireEvent("columnlockchange",this,A,B);}},getTotalLockedWidth:function(){var A=0;for(var i=0;i<this.config.length;i++){if(this.isLocked(i)&&!this.isHidden(i)){this.totalWidth+=this.getColumnWidth(i);}}return A;},getLockedCount:function(){for(var i=0,A=this.config.length;
2748 i<A;i++){if(!this.isLocked(i)){return i;}}return this.config.length;},getColumnCount:function(A){if(A===true){var c=0;for(var i=0,B=this.config.length;i<B;i++){if(!this.isHidden(i)){c++;}}return c;}return this.config.length;},getColumnsBy:function(fn,A){var r=[];
2749 for(var i=0,B=this.config.length;i<B;i++){var c=this.config[i];if(fn.call(A||this,c,i)===true){r[r.length]=c;}}return r;},isSortable:function(A){if(typeof this.config[A].sortable=="undefined"){return this.defaultSortable;}return this.config[A].sortable;},getRenderer:function(A){if(!this.config[A].renderer){return Roo.grid.ColumnModel.defaultRenderer;
2750 }return this.config[A].renderer;},setRenderer:function(A,fn){this.config[A].renderer=fn;},getColumnWidth:function(A,B){var C=this.config[A];if(typeof(B)=='undefined'){return C.width*1||this.defaultWidth;}if(B===false){return C.width||false;}var D=['xl','lg','md','sm','xs'];
2751 for(var i=D.indexOf(B);i<D.length;i++){if(typeof(C[D[i]])=='undefined'){continue;}return C[D[i]];}return 1;},setColumnWidth:function(A,B,C){this.config[A].width=B;this.totalWidth=null;if(!C){this.fireEvent("widthchange",this,A,B);}},getTotalWidth:function(A){if(!this.totalWidth){this.totalWidth=0;
2752 for(var i=0,B=this.config.length;i<B;i++){if(A||!this.isHidden(i)){this.totalWidth+=this.getColumnWidth(i);}}}return this.totalWidth;},getColumnHeader:function(A){return this.config[A].header;},setColumnHeader:function(A,B){this.config[A].header=B;this.fireEvent("headerchange",this,A,B);
2753 },getColumnTooltip:function(A){return this.config[A].tooltip;},setColumnTooltip:function(A,B){this.config[A].tooltip=B;},getDataIndex:function(A){return this.config[A].dataIndex;},setDataIndex:function(A,B){this.config[A].dataIndex=B;},isCellEditable:function(A,B){return (this.config[A].editable||(typeof this.config[A].editable=="undefined"&&this.config[A].editor))?true:false;
2754 },getCellEditor:function(A,B){return this.config[A].editor;},setEditable:function(A,B){this.config[A].editable=B;},isHidden:function(A){return this.config[A].hidden;},isFixed:function(A){return this.config[A].fixed;},isResizable:function(A){return A>=0&&this.config[A].resizable!==false&&this.config[A].fixed!==true;
2755 },setHidden:function(A,B){this.config[A].hidden=B;this.totalWidth=null;this.fireEvent("hiddenchange",this,A,B);},setEditor:function(A,B){this.config[A].editor=B;},addColumn:function(c){var i=this.config.length;this.config[i]=c;if(typeof c.dataIndex=="undefined"){c.dataIndex=i;
2756 }if(typeof c.renderer=="string"){c.renderer=Roo.util.Format[c.renderer];}if(typeof c.id=="undefined"){c.id=Roo.id();}if(c.editor&&c.editor.xtype){c.editor=Roo.factory(c.editor,Roo.grid);}if(c.editor&&c.editor.isFormField){c.editor=new Roo.grid.GridEditor(c.editor);
2757 }this.lookup[c.id]=c;}});Roo.grid.ColumnModel.defaultRenderer=function(A){if(typeof A=="object"){return A;}if(typeof A=="string"&&A.length<1){return "&#160;";}return String.format("{0}",A);};Roo.grid.DefaultColumnModel=Roo.grid.ColumnModel;
2758 // Roo/grid/AbstractSelectionModel.js
2759 Roo.grid.AbstractSelectionModel=function(){this.locked=false;Roo.grid.AbstractSelectionModel.superclass.constructor.call(this);};Roo.extend(Roo.grid.AbstractSelectionModel,Roo.util.Observable,{init:function(A){this.grid=A;this.initEvents();},lock:function(){this.locked=true;
2760 },unlock:function(){this.locked=false;},isLocked:function(){return this.locked;}});
2761 // Roo/grid/RowSelectionModel.js
2762 Roo.grid.RowSelectionModel=function(A){Roo.apply(this,A);this.selections=new Roo.util.MixedCollection(false,function(o){return o.id;});this.last=false;this.lastActive=false;this.addEvents({"selectionchange":true,"afterselectionchange":true,"beforerowselect":true,"rowselect":true,"rowdeselect":true}
2763 );Roo.grid.RowSelectionModel.superclass.constructor.call(this);this.locked=false;};Roo.extend(Roo.grid.RowSelectionModel,Roo.grid.AbstractSelectionModel,{singleSelect:false,initEvents:function(){if(!this.grid.enableDragDrop&&!this.grid.enableDrag){this.grid.on("mousedown",this.handleMouseDown,this);
2764 }else{this.grid.on("rowclick",this.handleDragableRowClick,this);}var A=this.grid.view?this.grid.view:this.grid;this.rowNav=new Roo.KeyNav(this.grid.getGridEl(),{"up":function(e){if(!e.shiftKey){this.selectPrevious(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var B=this.last;
2765 this.selectRange(this.last,this.lastActive-1);A.focusRow(this.lastActive);if(B!==false){this.last=B;}}else{this.selectFirstRow();}this.fireEvent("afterselectionchange",this);},"down":function(e){if(!e.shiftKey){this.selectNext(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var B=this.last;
2766 this.selectRange(this.last,this.lastActive+1);A.focusRow(this.lastActive);if(B!==false){this.last=B;}}else{this.selectFirstRow();}this.fireEvent("afterselectionchange",this);},scope:this});A.on("refresh",this.onRefresh,this);A.on("rowupdated",this.onRowUpdated,this);
2767 A.on("rowremoved",this.onRemove,this);},onRefresh:function(){var ds=this.grid.ds,i,v=this.grid.view;var s=this.selections;s.each(function(r){if((i=ds.indexOfId(r.id))!=-1){v.onRowSelect(i);s.add(ds.getAt(i));}else{s.remove(r);}});},onRemove:function(v,A,r){this.selections.remove(r);
2768 },onRowUpdated:function(v,A,r){if(this.isSelected(r)){v.onRowSelect(A);}},selectRecords:function(A,B){if(!B){this.clearSelections();}var ds=this.grid.ds;for(var i=0,C=A.length;i<C;i++){this.selectRow(ds.indexOf(A[i]),true);}},getCount:function(){return this.selections.length;
2769 },selectFirstRow:function(){this.selectRow(0);},selectLastRow:function(A){this.selectRow(this.grid.ds.getCount()-1,A);},selectNext:function(A){if(this.last!==false&&(this.last+1)<this.grid.ds.getCount()){this.selectRow(this.last+1,A);var B=this.grid.view?this.grid.view:this.grid;
2770 B.focusRow(this.last);}},selectPrevious:function(A){if(this.last){this.selectRow(this.last-1,A);var B=this.grid.view?this.grid.view:this.grid;B.focusRow(this.last);}},getSelections:function(){return [].concat(this.selections.items);},getSelected:function(){return this.selections.itemAt(0);
2771 },clearSelections:function(A){if(this.locked){return;}if(A!==true){var ds=this.grid.ds;var s=this.selections;s.each(function(r){this.deselectRow(ds.indexOfId(r.id));},this);s.clear();}else{this.selections.clear();}this.last=false;},selectAll:function(){if(this.locked){return;
2772 }this.selections.clear();for(var i=0,A=this.grid.ds.getCount();i<A;i++){this.selectRow(i,true);}},hasSelection:function(){return this.selections.length>0;},isSelected:function(A){var r=typeof A=="number"?this.grid.ds.getAt(A):A;return (r&&this.selections.key(r.id)?true:false);
2773 },isIdSelected:function(id){return (this.selections.key(id)?true:false);},handleMouseDown:function(e,t){var A=this.grid.view?this.grid.view:this.grid;var B;if(this.isLocked()||(B=A.findRowIndex(t))===false){return;};if(e.shiftKey&&this.last!==false){var C=this.last;
2774 this.selectRange(C,B,e.ctrlKey);this.last=C;A.focusRow(B);}else{var D=this.isSelected(B);if(e.button!==0&&D){A.focusRow(B);}else if(e.ctrlKey&&D){this.deselectRow(B);}else if(!D){this.selectRow(B,e.button===0&&(e.ctrlKey||e.shiftKey));A.focusRow(B);}}this.fireEvent("afterselectionchange",this);
2775 },handleDragableRowClick:function(A,B,e){if(e.button===0&&!e.shiftKey&&!e.ctrlKey){this.selectRow(B,false);var C=this.grid.view?this.grid.view:this.grid;C.focusRow(B);this.fireEvent("afterselectionchange",this);}},selectRows:function(A,B){if(!B){this.clearSelections();
2776 }for(var i=0,C=A.length;i<C;i++){this.selectRow(A[i],true);}},selectRange:function(A,B,C){if(this.locked){return;}if(!C){this.clearSelections();}if(A<=B){for(var i=A;i<=B;i++){this.selectRow(i,true);}}else{for(var i=A;i>=B;i--){this.selectRow(i,true);}}},deselectRange:function(A,B,C){if(this.locked){return;
2777 }for(var i=A;i<=B;i++){this.deselectRow(i,C);}},selectRow:function(A,B,C){if(this.locked||(A<0||A>=this.grid.ds.getCount())){return;}if(this.fireEvent("beforerowselect",this,A,B)!==false){if(!B||this.singleSelect){this.clearSelections();}var r=this.grid.ds.getAt(A);
2778 this.selections.add(r);this.last=this.lastActive=A;if(!C){var D=this.grid.view?this.grid.view:this.grid;D.onRowSelect(A);}this.fireEvent("rowselect",this,A,r);this.fireEvent("selectionchange",this);}},deselectRow:function(A,B){if(this.locked){return;}if(this.last==A){this.last=false;
2779 }if(this.lastActive==A){this.lastActive=false;}var r=this.grid.ds.getAt(A);this.selections.remove(r);if(!B){var C=this.grid.view?this.grid.view:this.grid;C.onRowDeselect(A);}this.fireEvent("rowdeselect",this,A);this.fireEvent("selectionchange",this);},restoreLast:function(){if(this._last){this.last=this._last;
2780 }},acceptsNav:function(A,B,cm){return !cm.isHidden(B)&&cm.isCellEditable(B,A);},onEditorKey:function(A,e){var k=e.getKey(),B,g=this.grid,ed=g.activeEditor;if(k==e.TAB){e.stopEvent();ed.completeEdit();if(e.shiftKey){B=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);
2781 }else{B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}}else if(k==e.ENTER&&!e.ctrlKey){e.stopEvent();ed.completeEdit();if(e.shiftKey){B=g.walkCells(ed.row-1,ed.col,-1,this.acceptsNav,this);}else{B=g.walkCells(ed.row+1,ed.col,1,this.acceptsNav,this);
2782 }}else if(k==e.ESC){ed.cancelEdit();}if(B){g.startEditing(B[0],B[1]);}}});
2783 // Roo/grid/CellSelectionModel.js
2784 Roo.grid.CellSelectionModel=function(A){Roo.apply(this,A);this.selection=null;this.addEvents({"beforecellselect":true,"cellselect":true,"selectionchange":true,"tabend":true,"beforeeditnext":true});Roo.grid.CellSelectionModel.superclass.constructor.call(this);
2785 };Roo.extend(Roo.grid.CellSelectionModel,Roo.grid.AbstractSelectionModel,{enter_is_tab:false,initEvents:function(){this.grid.on("mousedown",this.handleMouseDown,this);this.grid.getGridEl().on(Roo.isIE?"keydown":"keypress",this.handleKeyDown,this);var A=this.grid.view;
2786 A.on("refresh",this.onViewChange,this);A.on("rowupdated",this.onRowUpdated,this);A.on("beforerowremoved",this.clearSelections,this);A.on("beforerowsinserted",this.clearSelections,this);if(this.grid.isEditor){this.grid.on("beforeedit",this.beforeEdit,this);
2787 }},beforeEdit:function(e){this.select(e.row,e.column,false,true,e.record);},onRowUpdated:function(v,A,r){if(this.selection&&this.selection.record==r){v.onCellSelect(A,this.selection.cell[1]);}},onViewChange:function(){this.clearSelections(true);},getSelectedCell:function(){return this.selection?this.selection.cell:null;
2788 },clearSelections:function(A){var s=this.selection;if(s){if(A!==true){this.grid.view.onCellDeselect(s.cell[0],s.cell[1]);}this.selection=null;this.fireEvent("selectionchange",this,null);}},hasSelection:function(){return this.selection?true:false;},handleMouseDown:function(e,t){var v=this.grid.getView();
2789 if(this.isLocked()){return;};var A=v.findRowIndex(t);var B=v.findCellIndex(t);if(A!==false&&B!==false){this.select(A,B);}},select:function(A,B,C,D,r){if(this.fireEvent("beforecellselect",this,A,B)!==false){this.clearSelections();r=r||this.grid.dataSource.getAt(A);
2790 this.selection={record:r,cell:[A,B]};if(!C){var v=this.grid.getView();v.onCellSelect(A,B);if(D!==true){v.focusCell(A,B);}}this.fireEvent("cellselect",this,A,B);this.fireEvent("selectionchange",this,this.selection);}},isSelectable:function(A,B,cm){return !cm.isHidden(B);
2791 },handleKeyDown:function(e){if(!e.isNavKeyPress()){return;}var g=this.grid,s=this.selection;if(!s){e.stopEvent();var A=g.walkCells(0,0,1,this.isSelectable,this);if(A){this.select(A[0],A[1]);}return;}var sm=this;var B=function(D,E,F){return g.walkCells(D,E,F,sm.isSelectable,sm);
2792 };var k=e.getKey(),r=s.cell[0],c=s.cell[1];var C;switch(k){case e.TAB:if(g.isEditor&&g.editing){return;}if(e.shiftKey){C=B(r,c-1,-1);}else{C=B(r,c+1,1);}break;case e.DOWN:C=B(r+1,c,1);break;case e.UP:C=B(r-1,c,-1);break;case e.RIGHT:C=B(r,c+1,1);break;case e.LEFT:C=B(r,c-1,-1);
2793 break;case e.ENTER:if(g.isEditor&&!g.editing){g.startEditing(r,c);e.stopEvent();return;}break;};if(C){this.select(C[0],C[1]);e.stopEvent();}},acceptsNav:function(A,B,cm){return !cm.isHidden(B)&&cm.isCellEditable(B,A);},onEditorKey:function(A,e){var k=e.getKey(),B,g=this.grid,ed=g.activeEditor,C=false;
2794 if(this.enter_is_tab&&k==e.ENTER){k=e.TAB;}if(k==e.TAB){if(e.shiftKey){B=g.walkCells(ed.row,ed.col-1,-1,this.acceptsNav,this);}else{B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);C=true;}e.stopEvent();}else if(k==e.ENTER&&!e.ctrlKey){ed.completeEdit();
2795 e.stopEvent();B=g.walkCells(ed.row,ed.col+1,1,this.acceptsNav,this);}else if(k==e.ESC){ed.cancelEdit();}if(B){var D={cell:B,forward:C};this.fireEvent('beforeeditnext',D);B=D.cell;C=D.forward;}if(B){g.startEditing.defer(100,g,[B[0],B[1]]);}else if(C){this.fireEvent.defer(100,this,['tabend',this]);
2796 }}});
2797 // Roo/grid/EditorGrid.js
2798 Roo.grid.EditorGrid=function(A,B){Roo.grid.EditorGrid.superclass.constructor.call(this,A,B);this.getGridEl().addClass("xedit-grid");if(!this.selModel){this.selModel=new Roo.grid.CellSelectionModel();}this.activeEditor=null;this.addEvents({"beforeedit":true,"afteredit":true,"validateedit":true}
2799 );this.on("bodyscroll",this.stopEditing,this);this.on(this.clicksToEdit==1?"cellclick":"celldblclick",this.onCellDblClick,this);};Roo.extend(Roo.grid.EditorGrid,Roo.grid.Grid,{clicksToEdit:2,isEditor:true,trackMouseOver:false,onCellDblClick:function(g,A,B){this.startEditing(A,B);
2800 },onEditComplete:function(ed,A,B){this.editing=false;this.activeEditor=null;ed.un("specialkey",this.selModel.onEditorKey,this.selModel);var r=ed.record;var C=this.colModel.getDataIndex(ed.col);var e={grid:this,record:r,field:C,originalValue:B,value:A,row:ed.row,column:ed.col,cancel:false,editor:ed}
2801 ;var D=Roo.get(this.view.getCell(ed.row,ed.col));D.show();if(String(A)!==String(B)){if(this.fireEvent("validateedit",e)!==false&&!e.cancel){r.set(C,e.value);if(ed.field.displayField&&ed.field.name){r.set(ed.field.name,ed.field.el.dom.value);}delete e.cancel;
2802 this.fireEvent("afteredit",e);}}else{this.fireEvent("afteredit",e);}this.view.focusCell(ed.row,ed.col);},startEditing:function(A,B){this.stopEditing();if(this.colModel.isCellEditable(B,A)){this.view.ensureVisible(A,B,true);var r=this.dataSource.getAt(A);var C=this.colModel.getDataIndex(B);
2803 var D=Roo.get(this.view.getCell(A,B));var e={grid:this,record:r,field:C,value:r.data[C],row:A,column:B,cancel:false};if(this.fireEvent("beforeedit",e)!==false&&!e.cancel){this.editing=true;var ed=this.colModel.getCellEditor(B,A);if(!ed){return;}if(!ed.rendered){ed.render(ed.parentEl||document.body);
2804 }ed.field.reset();D.hide();(function(){ed.row=A;ed.col=B;ed.record=r;ed.on("complete",this.onEditComplete,this,{single:true});ed.on("specialkey",this.selModel.onEditorKey,this.selModel);this.activeEditor=ed;var v=r.data[C];ed.startEdit(this.view.getCell(A,B),v);
2805 if(ed.field.displayField&&ed.field.name){ed.field.el.dom.value=r.data[ed.field.name];}}).defer(50,this);}}},stopEditing:function(){if(this.activeEditor){this.activeEditor.completeEdit();}this.activeEditor=null;},getDragDropText:function(){var A=this.selModel.getSelectedCell()?1:0;
2806 return String.format(this.ddText,A,A==1?'':'s');}});
2807 // Roo/grid/GridEditor.js
2808 Roo.grid.GridEditor=function(A,B){if(!B&&A.field){B=A;A=Roo.factory(B.field,Roo.form);}Roo.grid.GridEditor.superclass.constructor.call(this,A,B);A.monitorTab=false;};Roo.extend(Roo.grid.GridEditor,Roo.Editor,{alignment:"tl-tl",autoSize:"width",hideEl:false,cls:"x-small-editor x-grid-editor",shim:false,shadow:"frame"}
2809 );
2810 // Roo/grid/PropertyGrid.js
2811 Roo.grid.PropertyRecord=Roo.data.Record.create([{name:'name',type:'string'},'value']);Roo.grid.PropertyStore=function(A,B){this.grid=A;this.store=new Roo.data.Store({recordType:Roo.grid.PropertyRecord});this.store.on('update',this.onUpdate,this);if(B){this.setSource(B);
2812 }Roo.grid.PropertyStore.superclass.constructor.call(this);};Roo.extend(Roo.grid.PropertyStore,Roo.util.Observable,{setSource:function(o){this.source=o;this.store.removeAll();var A=[];for(var k in o){if(this.isEditableValue(o[k])){A.push(new Roo.grid.PropertyRecord({name:k,value:o[k]}
2813 ,k));}}this.store.loadRecords({records:A},{},true);},onUpdate:function(ds,A,B){if(B==Roo.data.Record.EDIT){var v=A.data['value'];var C=A.modified['value'];if(this.grid.fireEvent('beforepropertychange',this.source,A.id,v,C)!==false){this.source[A.id]=v;A.commit();
2814 this.grid.fireEvent('propertychange',this.source,A.id,v,C);}else{A.reject();}}},getProperty:function(A){return this.store.getAt(A);},isEditableValue:function(A){if(A&&A instanceof Date){return true;}else if(typeof A=='object'||typeof A=='function'){return false;
2815 }return true;},setValue:function(A,B){this.source[A]=B;this.store.getById(A).set('value',B);},getSource:function(){return this.source;}});Roo.grid.PropertyColumnModel=function(A,B){this.grid=A;var g=Roo.grid;g.PropertyColumnModel.superclass.constructor.call(this,[{header:this.nameText,sortable:true,dataIndex:'name',id:'name'}
2816 ,{header:this.valueText,resizable:false,dataIndex:'value',id:'value'}]);this.store=B;this.bselect=Roo.DomHelper.append(document.body,{tag:'select',style:'display:none',cls:'x-grid-editor',children:[{tag:'option',value:'true',html:'true'},{tag:'option',value:'false',html:'false'}
2817 ]});Roo.id(this.bselect);var f=Roo.form;this.editors={'date':new g.GridEditor(new f.DateField({selectOnFocus:true})),'string':new g.GridEditor(new f.TextField({selectOnFocus:true})),'number':new g.GridEditor(new f.NumberField({selectOnFocus:true,style:'text-align:left;'}
2818 )),'int':new g.GridEditor(new f.NumberField({selectOnFocus:true,allowDecimals:false,style:'text-align:left;'})),'boolean':new g.GridEditor(new f.Field({el:this.bselect,selectOnFocus:true}))};this.renderCellDelegate=this.renderCell.createDelegate(this);this.renderPropDelegate=this.renderProp.createDelegate(this);
2819 };Roo.extend(Roo.grid.PropertyColumnModel,Roo.grid.ColumnModel,{nameText:'Name',valueText:'Value',dateFormat:'m/j/Y',renderDate:function(A){return A.dateFormat(this.dateFormat);},renderBool:function(A){return A?'true':'false';},isCellEditable:function(A,B){return A==1;
2820 },getRenderer:function(A){return A==1?this.renderCellDelegate:this.renderPropDelegate;},renderProp:function(v){return this.getPropertyName(v);},renderCell:function(A){var rv=A;if(A instanceof Date){rv=this.renderDate(A);}else if(typeof A=='boolean'){rv=this.renderBool(A);
2821 }return Roo.util.Format.htmlEncode(rv);},getPropertyName:function(A){var pn=this.grid.propertyNames;return pn&&pn[A]?pn[A]:A;},getCellEditor:function(A,B){var p=this.store.getProperty(B);var n=p.data['name'],C=p.data['value'];if(typeof(this.grid.customEditors[n])=='string'){return this.editors[this.grid.customEditors[n]];
2822 }if(typeof(this.grid.customEditors[n])!='undefined'){return this.grid.customEditors[n];}if(C instanceof Date){return this.editors['date'];}else if(typeof C=='number'){return this.editors['number'];}else if(typeof C=='boolean'){return this.editors['boolean'];
2823 }else{return this.editors['string'];}}});Roo.grid.PropertyGrid=function(A,B){B=B||{};var C=new Roo.grid.PropertyStore(this);this.store=C;var cm=new Roo.grid.PropertyColumnModel(this,C);C.store.sort('name','ASC');Roo.grid.PropertyGrid.superclass.constructor.call(this,A,Roo.apply({ds:C.store,cm:cm,enableColLock:false,enableColumnMove:false,stripeRows:false,trackMouseOver:false,clicksToEdit:1}
2824 ,B));this.getGridEl().addClass('x-props-grid');this.lastEditRow=null;this.on('columnresize',this.onColumnResize,this);this.addEvents({"beforepropertychange":true,"propertychange":true});this.customEditors=this.customEditors||{};};Roo.extend(Roo.grid.PropertyGrid,Roo.grid.EditorGrid,{render:function(){Roo.grid.PropertyGrid.superclass.render.call(this);
2825 this.autoSize.defer(100,this);},autoSize:function(){Roo.grid.PropertyGrid.superclass.autoSize.call(this);if(this.view){this.view.fitColumns();}},onColumnResize:function(){this.colModel.setColumnWidth(1,this.container.getWidth(true)-this.colModel.getColumnWidth(0));
2826 this.autoSize();},setSource:function(A){this.store.setSource(A);},getSource:function(){return this.store.getSource();}});
2827 // Roo/grid/Calendar.js
2828 Roo.grid.Calendar=function(A,B){this.container=Roo.get(A);this.container.update("");this.container.setStyle("overflow","hidden");this.container.addClass('x-grid-container');this.id=this.container.id;Roo.apply(this,B);var C=[];var d=1;for(var r=0;r<6;r++){C[r]=[];
2829 for(var c=0;c<7;c++){C[r][c]='';}}if(this.eventStore){this.eventStore=Roo.factory(this.eventStore,Roo.data);this.eventStore.on('load',this.onLoad,this);this.eventStore.on('beforeload',this.clearEvents,this);}this.dataSource=new Roo.data.Store({proxy:new Roo.data.MemoryProxy(C),reader:new Roo.data.ArrayReader({}
2830 ,['weekday0','weekday1','weekday2','weekday3','weekday4','weekday5','weekday6'])});this.dataSource.load();this.ds=this.dataSource;this.ds.xmodule=this.xmodule||false;var D=function(v,x,r){return String.format('<div class="fc-day  fc-widget-content"><div>'+'<div class="fc-event-container"></div>'+'<div class="fc-day-number">{0}</div>'+'<div class="fc-day-content"><div style="position:relative"></div></div>'+'</div></div>',v);
2831 };this.colModel=new Roo.grid.ColumnModel([{xtype:'ColumnModel',xns:Roo.grid,dataIndex:'weekday0',header:'Sunday',renderer:D},{xtype:'ColumnModel',xns:Roo.grid,dataIndex:'weekday1',header:'Monday',renderer:D},{xtype:'ColumnModel',xns:Roo.grid,dataIndex:'weekday2',header:'Tuesday',renderer:D}
2832 ,{xtype:'ColumnModel',xns:Roo.grid,dataIndex:'weekday3',header:'Wednesday',renderer:D},{xtype:'ColumnModel',xns:Roo.grid,dataIndex:'weekday4',header:'Thursday',renderer:D},{xtype:'ColumnModel',xns:Roo.grid,dataIndex:'weekday5',header:'Friday',renderer:D},{xtype:'ColumnModel',xns:Roo.grid,dataIndex:'weekday6',header:'Saturday',renderer:D}
2833 ]);this.cm=this.colModel;this.cm.xmodule=this.xmodule||false;if(this.width){this.container.setWidth(this.width);}if(this.height){this.container.setHeight(this.height);}this.addEvents({"click":true,"dblclick":true,"contextmenu":true,"mousedown":true,"mouseup":true,"mouseover":true,"mouseout":true,"keypress":true,"keydown":true,"cellclick":true,"celldblclick":true,"rowclick":true,"rowdblclick":true,"headerclick":true,"headerdblclick":true,"rowcontextmenu":true,"cellcontextmenu":true,"headercontextmenu":true,"bodyscroll":true,"columnresize":true,"columnmove":true,"startdrag":true,"enddrag":true,"dragdrop":true,"dragover":true,"dragenter":true,"dragout":true,'rowclass':true,'render':true,'select':true,'monthchange':true,'evententer':true,'eventleave':true,'eventclick':true,'eventrender':true}
2834 );Roo.grid.Grid.superclass.constructor.call(this);this.on('render',function(){this.view.el.addClass('x-grid-cal');(function(){this.setDate(new Date());}).defer(100,this);},this);if(!Roo.grid.Calendar.style){Roo.grid.Calendar.style=Roo.util.CSS.createStyleSheet({'.x-grid-cal .x-grid-col':{height:'auto !important','vertical-align':'top'}
2835 ,'.x-grid-cal  .fc-event-hori':{height:'14px'}},Roo.id());}};Roo.extend(Roo.grid.Calendar,Roo.grid.Grid,{eventStore:25,activeDate:false,startDay:0,autoWidth:true,monitorWindowResize:false,resizeColumns:function(){var A=(this.view.el.getWidth()/7)-3;for(var i=0;
2836 i<7;i++){this.cm.setColumnWidth(i,A);}},setDate:function(A){Roo.log('setDate?');this.resizeColumns();var vd=this.activeDate;this.activeDate=A;var B=A.getDaysInMonth();var C=A.getFirstDateOfMonth();var D=C.getDay()-this.startDay;if(D<this.startDay){D+=7;}var pm=A.add(Date.MONTH,-1);
2837 var E=pm.getDaysInMonth()-D;this.cells=this.view.el.select('.x-grid-row .x-grid-col',true);this.textNodes=this.view.el.query('.x-grid-row .x-grid-col .x-grid-cell-text');var F=this.cells.elements;var G=this.textNodes;B+=D;var H=86400000;var d=(new Date(pm.getFullYear(),pm.getMonth(),E)).clearTime();
2838 var I=new Date().clearTime().getTime();var J=A.clearTime().getTime();var K=this.minDate?this.minDate.clearTime():Number.NEGATIVE_INFINITY;var L=this.maxDate?this.maxDate.clearTime():Number.POSITIVE_INFINITY;var M=this.disabledDatesRE;var N=this.disabledDatesText;
2839 var O=this.disabledDays?this.disabledDays.join(""):false;var P=this.disabledDaysText;var Q=this.format;var R=function(W,X){X.title="";var t=d.getTime();X.dateValue=t;if(t==I){X.className+=" fc-today";X.className+=" fc-state-highlight";X.title=W.todayText;
2840 }if(t==J){X.className+=" fc-state-highlight";}if(t<K){X.title=W.minText;return;}if(t>L){X.title=W.maxText;return;}if(O){if(O.indexOf(d.getDay())!=-1){}}if(M&&Q){var Y=d.dateFormat(Q);if(M.test(Y)){X.title=N.replace("%0",Y);X.className=" fc-state-disabled";
2841 }}if(!X.initialClassName){X.initialClassName=X.dom.className;}X.dom.className=X.initialClassName+' '+X.className;};var i=0;for(;i<D;i++){F[i].dayName=(++E);Roo.log(G[i]);d.setDate(d.getDate()+1);R(this,F[i]);}var S=0;for(;i<B;i++){S=i-D+1;F[i].dayName=(S);
2842 d.setDate(d.getDate()+1);F[i].className='';R(this,F[i]);}var T=0;for(;i<42;i++){d.setDate(d.getDate()+1);F[i].dayName=(++T);F[i].className="fc-future fc-other-month";R(this,F[i]);}var U=Math.ceil((A.getDaysInMonth()+A.getFirstDateOfMonth().getDay())/7);var V=[];
2843 var i=0;for(var r=0;r<6;r++){for(var c=0;c<7;c++){this.ds.getAt(r).set('weekday'+c,F[i++].dayName);}}this.cells=this.view.el.select('.x-grid-row .x-grid-col',true);for(i=0;i<F.length;i++){this.cells.elements[i].dayName=F[i].dayName;this.cells.elements[i].className=F[i].className;
2844 this.cells.elements[i].initialClassName=F[i].initialClassName;this.cells.elements[i].title=F[i].title;this.cells.elements[i].dateValue=F[i].dateValue;}this.fireEvent('monthchange',this,A);},getSelectionModel:function(){if(!this.selModel){this.selModel=new Roo.grid.CellSelectionModel();
2845 }return this.selModel;},load:function(){this.eventStore.load()},findCell:function(dt){dt=dt.clearTime().getTime();var A=false;this.cells.each(function(c){if(c.dateValue==dt){A=c;return false;}return true;});return A;},findCells:function(A){var s=A.data.start_dt.clone().clearTime().getTime();
2846 var e=A.data.end_dt.clone().clearTime().getTime();var B=[];this.cells.each(function(c){if(c.dateValue>e){return;}if(c.dateValue<s){return;}B.push(c);});return B;},findBestRow:function(A){var B=0;for(var i=0;i<A.length;i++){B=Math.max(A[i].rows||0,B);}return B;
2847 },addItem:function(A){var B=this.findCells(A);A.row=this.findBestRow(B);var C=false;var D=[];for(var i=0;i<B.length;i++){if(!C){C={start:B[i],end:B[i]};continue;}if(C.start.getY()==B[i].getY()){C.end=B[i];continue;}D.push(C);C={start:B[i],end:B[i]};}D.push(C);
2848 A.els=[];A.rows=D;A.cells=B;for(var i=0;i<B.length;i++){B[i].rows=Math.max(B[i].rows||0,A.row+1);}},clearEvents:function(){if(!this.eventStore.getCount()){return;}Roo.each(this.cells.elements,function(c){c.rows=0;});this.eventStore.each(function(e){this.clearEvent(e);
2849 },this);},clearEvent:function(ev){if(ev.els){Roo.each(ev.els,function(el){el.un('mouseenter',this.onEventEnter,this);el.un('mouseleave',this.onEventLeave,this);el.remove();},this);ev.els=[];}},renderEvent:function(ev,A){if(!A){A=this.view.el.select('.fc-event-container',true).first();
2850 }this.clearEvent(ev);ev.els=[];var B=ev.cells;var C=ev.rows;this.fireEvent('eventrender',this,ev);for(var i=0;i<C.length;i++){cls='';if(i==0){cls+=' fc-event-start';}if((i+1)==C.length){cls+=' fc-event-end';}var cg=this.eventTmpl.append(A,Roo.apply({fccls:cls}
2851 ,ev.data),true);cg.on('mouseenter',this.onEventEnter,this,ev);cg.on('mouseleave',this.onEventLeave,this,ev);cg.on('click',this.onEventClick,this,ev);ev.els.push(cg);var D=C[i].start.select('.fc-day-content',true).first().getBox();var E=C[i].end.select('.fc-day-content',true).first().getBox();
2852 cg.setXY([D.x+2,D.y+(ev.row*20)]);cg.setWidth(E.right-D.x-2);}},renderEvents:function(){if(!this.eventTmpl){this.eventTmpl=new Roo.Template('<div class="roo-dynamic fc-event fc-event-hori fc-event-draggable ui-draggable {fccls} {cls}"  style="position: absolute" unselectable="on">'+'<div class="fc-event-inner">'+'<span class="fc-event-time">{time}</span>'+'<span class="fc-event-title" qtip="{qtip}">{title}</span>'+'</div>'+'<div class="ui-resizable-heandle ui-resizable-e">&nbsp;&nbsp;&nbsp;</div>'+'</div>');
2853 }this.cells.each(function(c){c.select('.fc-day-content div',true).first().setHeight(Math.max(34,(c.rows||1)*20));});var A=this.view.el.select('.fc-event-container',true).first();var B;this.eventStore.each(function(ev){this.renderEvent(ev);},this);this.view.layout();
2854 },onEventEnter:function(e,el,A,d){this.fireEvent('evententer',this,el,A);},onEventLeave:function(e,el,A,d){this.fireEvent('eventleave',this,el,A);},onEventClick:function(e,el,A,d){this.fireEvent('eventclick',this,el,A);},onMonthChange:function(){this.store.load();
2855 },onLoad:function(){if(this.eventStore.getCount()>0){this.eventStore.each(function(d){var A=d.data;if(typeof(A.end_dt)=='undefined'){Roo.log("Missing End time in calendar data: ");Roo.log(d);return;}if(typeof(A.start_dt)=='undefined'){Roo.log("Missing Start time in calendar data: ");
2856 Roo.log(d);return;}A.start_dt=typeof(A.start_dt)=='string'?Date.parseDate(A.start_dt,'Y-m-d H:i:s'):A.start_dt,A.end_dt=typeof(A.end_dt)=='string'?Date.parseDate(A.end_dt,'Y-m-d H:i:s'):A.end_dt,A.id=A.id||d.id;A.title=A.title||'??';this.addItem(d);},this);
2857 }this.renderEvents();}});
2858 // Roo/LoadMask.js
2859 Roo.LoadMask=function(el,A){this.el=Roo.get(el);Roo.apply(this,A);if(this.store){this.store.on('beforeload',this.onBeforeLoad,this);this.store.on('load',this.onLoad,this);this.store.on('loadexception',this.onLoadException,this);this.removeMask=false;}else{var um=this.el.getUpdateManager();
2860 um.showLoadIndicator=false;um.on('beforeupdate',this.onBeforeLoad,this);um.on('update',this.onLoad,this);um.on('failure',this.onLoad,this);this.removeMask=true;}};Roo.LoadMask.prototype={removeMask:false,msg:'Loading...',msgCls:'x-mask-loading',disabled:false,disable:function(){this.disabled=true;
2861 },enable:function(){this.disabled=false;},onLoadException:function(){Roo.log(arguments);if(typeof(arguments[3])!='undefined'){Roo.MessageBox.alert("Error loading",arguments[3]);}(function(){this.el.unmask(this.removeMask);}).defer(50,this);},onLoad:function(){(function(){this.el.unmask(this.removeMask);
2862 }).defer(50,this);},onBeforeLoad:function(){if(!this.disabled){(function(){this.el.mask(this.msg,this.msgCls);}).defer(50,this);}},destroy:function(){if(this.store){this.store.un('beforeload',this.onBeforeLoad,this);this.store.un('load',this.onLoad,this);
2863 this.store.un('loadexception',this.onLoadException,this);}else{var um=this.el.getUpdateManager();um.un('beforeupdate',this.onBeforeLoad,this);um.un('update',this.onLoad,this);um.un('failure',this.onLoad,this);}}};
2864 // Roo/XTemplate.js
2865 Roo.XTemplate=function(){Roo.XTemplate.superclass.constructor.apply(this,arguments);if(this.html){this.compile();}};Roo.extend(Roo.XTemplate,Roo.Template,{tpls:false,re:/\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,compile:function(){var s=this.html;s=['<tpl>',s,'</tpl>'].join('');
2866 var re=/<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/,A=/^<tpl\b[^>]*?for="(.*?)"/,B=/^<tpl\b[^>]*?if="(.*?)"/,C=/^<tpl\b[^>]*?exec="(.*?)"/,D=/^<tpl\b[^>]*?name="(\w+)"/,m,id=0,E=[];while(true==!!(m=s.match(re))){var F=m[0].match(A),G=m[0].match(B),H=m[0].match(C),I=m[0].match(D),J=null,fn=null,K=null,L=F&&F[1]?F[1]:'';
2867 if(G){J=G&&G[1]?G[1]:null;if(J){fn=new Function('values','parent','with(values){ return '+(Roo.util.Format.htmlDecode(J))+'; }');}}if(H){J=H&&H[1]?H[1]:null;if(J){K=new Function('values','parent','with(values){ '+(Roo.util.Format.htmlDecode(J))+'; }');}}if(L){switch(L){case '.':L=new Function('values','parent','with(values){ return values; }');
2868 break;case '..':L=new Function('values','parent','with(values){ return parent; }');break;default:L=new Function('values','parent','with(values){ return '+L+'; }');}}var M=I?I[1]:id;E.push({id:I?I[1]:id,target:L,exec:K,test:fn,body:m[1]||''});if(I){s=s.replace(m[0],'');
2869 }else{s=s.replace(m[0],'{xtpl'+id+'}');}++id;}this.tpls=[];for(var i=E.length-1;i>=0;--i){this.compileTpl(E[i]);this.tpls[E[i].id]=E[i];}this.master=E[E.length-1];return this;},applySubTemplate:function(id,A,B){var t=this.tpls[id];try{if(t.test&&!t.test.call(this,A,B)){return '';
2870 }}catch(e){Roo.log("Xtemplate.applySubTemplate 'test': Exception thrown");Roo.log(e.toString());Roo.log(t.test);return ''}try{if(t.exec&&t.exec.call(this,A,B)){return '';}}catch(e){Roo.log("Xtemplate.applySubTemplate 'exec': Exception thrown");Roo.log(e.toString());
2871 Roo.log(t.exec);return ''}try{var vs=t.target?t.target.call(this,A,B):A;B=t.target?A:B;if(t.target&&vs instanceof Array){var C=[];for(var i=0,D=vs.length;i<D;i++){C[C.length]=t.compiled.call(this,vs[i],B);}return C.join('');}return t.compiled.call(this,vs,B);
2872 }catch(e){Roo.log("Xtemplate.applySubTemplate : Exception thrown");Roo.log(e.toString());Roo.log(t.compiled);return '';}},compileTpl:function(tpl){var fm=Roo.util.Format;var useF=this.disableFormats!==true;var A=Roo.isGecko?"+":",";var undef=function(C){Roo.log("Property not found :"+C);
2873 return '';};var fn=function(m,C,D,E){E=E?E.replace(/\\'/g,"'"):E;if(typeof(D)=='undefined'){D='htmlEncode';}if(D=='raw'){D=false;}if(C.substr(0,4)=='xtpl'){return "'"+A+'this.applySubTemplate('+C.substr(4)+', values, parent)'+A+"'";}var F=[];var G='';Roo.each(C.split('.'),function(st){G+=(G.length?'.':'')+st;
2874 F.push("(typeof("+G+") == 'undefined')");});var H='(('+F.join(" || ")+") ? undef('"+C+"') : ";if(D&&useF){E=E?','+E:"";if(D.substr(0,5)!="this."){D="fm."+D+'(';}else{D='this.call("'+D.substr(5)+'", ';E=", values";}return "'"+A+H+D+C+E+"))"+A+"'";}if(E.length){return "'"+A+H+C+'('+E+"))"+A+"'";
2875 }return "'"+A+H+C+")"+A+"'";};var B;if(Roo.isGecko){B="tpl.compiled = function(values, parent){  with(values) { return '"+tpl.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn)+"';};};";}else{B=["tpl.compiled = function(values, parent){  with (values) { return ['"];
2876 B.push(tpl.body.replace(/(\r\n|\n)/g,'\\n').replace(/'/g,"\\'").replace(this.re,fn));B.push("'].join('');};};");B=B.join('');}Roo.debug&&Roo.log(B.replace(/\\n/,'\n'));eval(B);return this;},applyTemplate:function(A){return this.master.compiled.call(this,A,{}
2877 );},apply:function(){return this.applyTemplate.apply(this,arguments);}});Roo.XTemplate.from=function(el){el=Roo.getDom(el);return new Roo.XTemplate(el.value||el.innerHTML);};