var Pathology={evaluate:function(t,e,s,n,i){i=i||new Pathology.XPathResult(n);var o=Pathology.XPathParser.parse(t);return o.evaluate(e,e,n,i),i},atomize:function(t,e,s){var n=t.evaluate(e,s);return n&&n.atomize&&(n=n.atomize()),n},array:function(t){if(!t)return[];for(var e=[],s=t.length;s--;)e[s]=t[s];return e},indexOf:function(t,e){if(t.indexOf)return t.indexOf(e);for(var s=0,n=t.length;n>s;s++)if(t[s]===e)return s;return-1}};"undefined"==typeof XPathResult&&(XPathResult={ANY_TYPE:0,NUMBER_TYPE:1,STRING_TYPE:2,BOOLEAN_TYPE:3,UNORDERED_NODE_ITERATOR_TYPE:4,ORDERED_NODE_ITERATOR_TYPE:5,UNORDERED_NODE_SNAPSHOT_TYPE:6,ORDERED_NODE_SNAPSHOT_TYPE:7,ANY_UNORDERED_NODE_TYPE:8,FIRST_ORDERED_NODE_TYPE:9}),document.evaluate===void 0&&(document.evaluate=function(){return Pathology.evaluate.apply(Pathology,arguments)}),Pathology.XPathResult=function(t){this._type=t,this._nodes=[],this._index=0},Pathology.XPathResult.prototype.push=function(t){(0===this._type||t.nodeType===this._type)&&(Pathology.indexOf(this._nodes,t)>=0||this._nodes.push(t))},Pathology.XPathResult.prototype.iterateNext=function(){var t=this._nodes[this._index];return t?(this._index+=1,t):null},Pathology.XPathResult.prototype.atomize=function(){if(0===this._nodes.length)return null;if(1===this._nodes.length){var t=this._nodes[0];return void 0===t.nodeValue||null===t.nodeValue?t:t.nodeValue}for(var e=[],s=0,n=this._nodes.length;n>s;s++)e.push(this._nodes[s].nodeValue);return e},Pathology.XPathResult.prototype.makeString=function(){var t=this._nodes[0];if(!t)return"";switch(t.nodeType){case XPathResult.STRING_TYPE:return this.atomize();case XPathResult.BOOLEAN_TYPE:for(var e=[],s=0,n=this._nodes.length;n>s;s++)e.push(this._nodes[s].nodeValue);return e.join("");default:var i=document.evaluate("//text()",t,null,XPathResult.ANY_TYPE,null);return i.makeString()}},function(){var t=function(t,e){if(!t||!e)return t;for(var s in e)t[s]!==e[s]&&(t[s]=e[s]);return t},e=function(t,e){for(var s,n=e.split(".");s=n.shift();)if(t=t[s],void 0===t)throw Error("Cannot find object named "+e);return t},s=function(t){for(var e=t.input.split(/\n/g),s=0,n=0;t.offset+1>n;)n+=e[s].length+1,s+=1;var i="Line "+s+": expected "+t.expected+"\n",o=e[s-1];for(i+=o+"\n",n-=o.length+1;t.offset>n;)i+=" ",n+=1;return i+"^"},n={__consume__union_expression:function(){var s=null,n=this._offset;this._nodeCache.union_expression=this._nodeCache.union_expression||{};var i=this._nodeCache.union_expression[n];if(i)return this._offset+=i.textValue.length,i;var o=this._offset,r=[],f={},u="",l=null;if(l=this.__consume__location_path()){r.push(l),u+=l.textValue,f.head=l;for(var h=null,a=0,c=this._offset,_=[],p="",d=!0;d;){var y=this._offset,g=[],m={},v="",k=null;if(k=this.__consume__space()){g.push(k),v+=k.textValue,m.space=k;var b=null,x=null;if(x=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"|"===x){var w=this.constructor.SyntaxNode,S=null;b=new w("|",this._offset,[]),"object"==typeof S&&t(b,S),this._offset+=1}else{b=null;var N=null;N=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"|"'})}if(b){g.push(b),v+=b.textValue;var C=null;if(C=this.__consume__space()){g.push(C),v+=C.textValue,m.space=C;var E=null;E=this.__consume__location_path(),E?(g.push(E),v+=E.textValue,m.location_path=E):(g=null,this._offset=y)}else g=null,this._offset=y}else g=null,this._offset=y}else g=null,this._offset=y;if(g){this._offset=y;var P=this.constructor.SyntaxNode,T=null;d=new P(v,this._offset,g,m),"object"==typeof T&&t(d,T),this._offset+=v.length}else d=null;d&&(_.push(d),p+=d.textValue,a-=1)}if(0>=a){this._offset=c;var V=this.constructor.SyntaxNode,j=null;h=new V(p,this._offset,_),"object"==typeof j&&t(h,j),this._offset+=p.length}else h=null;h?(r.push(h),u+=h.textValue,f.rest=h):(r=null,this._offset=o)}else r=null,this._offset=o;if(r){this._offset=o;var X=this.constructor.SyntaxNode,R=e(this.constructor,"Union");s=new X(u,this._offset,r,f),"object"==typeof R&&t(s,R),this._offset+=u.length}else s=null;return this._nodeCache.union_expression[n]=s},__consume__location_path:function(){var s=null,n=this._offset;this._nodeCache.location_path=this._nodeCache.location_path||{};var i=this._nodeCache.location_path[n];if(i)return this._offset+=i.textValue.length,i;var o=this._offset,r=[],f={},u="",l=null;if(l=this.__consume__location_step()){r.push(l),u+=l.textValue,f.head=l;for(var h=null,a=0,c=this._offset,_=[],p="",d=!0;d;)d=this.__consume__location_step(),d&&(_.push(d),p+=d.textValue,a-=1);if(0>=a){this._offset=c;var y=this.constructor.SyntaxNode,g=null;h=new y(p,this._offset,_),"object"==typeof g&&t(h,g),this._offset+=p.length}else h=null;h?(r.push(h),u+=h.textValue,f.rest=h):(r=null,this._offset=o)}else r=null,this._offset=o;if(r){this._offset=o;var m=this.constructor.SyntaxNode,v=e(this.constructor,"LocationPath");s=new m(u,this._offset,r,f),"object"==typeof v&&t(s,v),this._offset+=u.length}else s=null;return this._nodeCache.location_path[n]=s},__consume__location_step:function(){var s=null,n=this._offset;this._nodeCache.location_step=this._nodeCache.location_step||{};var i=this._nodeCache.location_step[n];if(i)return this._offset+=i.textValue.length,i;var o=this._offset,r=[],f={},u="",l=null,h=this._offset,a=null;if(a=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"/"===a){var c=this.constructor.SyntaxNode,_=null;l=new c("/",this._offset,[]),"object"==typeof _&&t(l,_),this._offset+=1}else{l=null;var p=null;p=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"/"'})}if(l);else{this._offset=h;var d=this.constructor.SyntaxNode,y=null;l=new d("",this._offset,[]),"object"==typeof y&&t(l,y),this._offset+=0}if(l){r.push(l),u+=l.textValue;var g=null,m=this._offset,v=this._offset,k=[],b={},x="",w=null;if(w=this.__consume__axis()){k.push(w),x+=w.textValue,b.axis=w;var S=null,N=this._offset;if(S=this.__consume__node_test());else{this._offset=N;var C=this.constructor.SyntaxNode,E=null;S=new C("",this._offset,[]),"object"==typeof E&&t(S,E),this._offset+=0}S?(k.push(S),x+=S.textValue,b.test=S):(k=null,this._offset=v)}else k=null,this._offset=v;if(k){this._offset=v;var P=this.constructor.SyntaxNode,T=null;g=new P(x,this._offset,k,b),"object"==typeof T&&t(g,T),this._offset+=x.length}else g=null;if(g);else{this._offset=m;var V=this._offset,j=[],X={},R="",A=null,Y=this._offset;if(A=this.__consume__axis());else{this._offset=Y;var O=this.constructor.SyntaxNode,I=null;A=new O("",this._offset,[]),"object"==typeof I&&t(A,I),this._offset+=0}if(A){j.push(A),R+=A.textValue,X.axis=A;var D=null;D=this.__consume__node_test(),D?(j.push(D),R+=D.textValue,X.test=D):(j=null,this._offset=V)}else j=null,this._offset=V;if(j){this._offset=V;var L=this.constructor.SyntaxNode,z=null;g=new L(R,this._offset,j,X),"object"==typeof z&&t(g,z),this._offset+=R.length}else g=null;g||(this._offset=m)}if(g){r.push(g),u+=g.textValue,f.selector=g;for(var W=null,F=0,H=this._offset,M=[],K="",U=!0;U;)U=this.__consume__node_predicate(),U&&(M.push(U),K+=U.textValue,F-=1);if(0>=F){this._offset=H;var B=this.constructor.SyntaxNode,q=null;W=new B(K,this._offset,M),"object"==typeof q&&t(W,q),this._offset+=K.length}else W=null;W?(r.push(W),u+=W.textValue,f.predicates=W):(r=null,this._offset=o)}else r=null,this._offset=o}else r=null,this._offset=o;if(r){this._offset=o;var Q=this.constructor.SyntaxNode,G=e(this.constructor,"LocationStep");s=new Q(u,this._offset,r,f),"object"==typeof G&&t(s,G),this._offset+=u.length}else s=null;return this._nodeCache.location_step[n]=s},__consume__axis:function(){var e=null,s=this._offset;this._nodeCache.axis=this._nodeCache.axis||{};var n=this._nodeCache.axis[s];if(n)return this._offset+=n.textValue.length,n;for(var i=this._offset,o=this._offset,r=[],f={},u="",l=null,h=1,a=this._offset,c=[],_="",p=!0;p;){var d=null;if(d=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,d&&/^[a-z\-]/.test(d)){var y=this.constructor.SyntaxNode,g=null;p=new y(d,this._offset,[]),"object"==typeof g&&t(p,g),this._offset+=1}else{p=null;var m=null;m=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:"[a-z\\-]"})}p&&(c.push(p),_+=p.textValue,h-=1)}if(0>=h){this._offset=a;var v=this.constructor.SyntaxNode,k=null;l=new v(_,this._offset,c),"object"==typeof k&&t(l,k),this._offset+=_.length}else l=null;if(l){r.push(l),u+=l.textValue,f.axis_name=l;var b=null,x=null;if(x=this._input.length>this._offset?this._input.substring(this._offset,this._offset+2):null,"::"===x){var w=this.constructor.SyntaxNode,S=null;b=new w("::",this._offset,[]),"object"==typeof S&&t(b,S),this._offset+=2}else{b=null;var N=null;N=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"::"'})}b?(r.push(b),u+=b.textValue):(r=null,this._offset=o)}else r=null,this._offset=o;if(r){this._offset=o;var C=this.constructor.SyntaxNode,E=null;e=new C(u,this._offset,r,f),"object"==typeof E&&t(e,E),this._offset+=u.length}else e=null;return e||(this._offset=i,e=this.__consume__axis_shorthand(),e||(this._offset=i)),this._nodeCache.axis[s]=e},__consume__axis_shorthand:function(){var e=null,s=this._offset;this._nodeCache.axis_shorthand=this._nodeCache.axis_shorthand||{};var n=this._nodeCache.axis_shorthand[s];if(n)return this._offset+=n.textValue.length,n;var i=this._offset,o=null;if(o=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"@"===o){var r=this.constructor.SyntaxNode,f=null;e=new r("@",this._offset,[]),"object"==typeof f&&t(e,f),this._offset+=1}else{e=null;var u=null;u=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"@"'})}if(e);else{this._offset=i;var l=null;if(l=this._input.length>this._offset?this._input.substring(this._offset,this._offset+2):null,".."===l){var h=this.constructor.SyntaxNode,a=null;e=new h("..",this._offset,[]),"object"==typeof a&&t(e,a),this._offset+=2}else{e=null;var c=null;c=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'".."'})}if(e);else{this._offset=i;var _=null;if(_=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"."===_){var p=this.constructor.SyntaxNode,d=null;e=new p(".",this._offset,[]),"object"==typeof d&&t(e,d),this._offset+=1}else{e=null;var y=null;y=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"."'})}if(e);else{this._offset=i;var g=null;if(g=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"/"===g){var m=this.constructor.SyntaxNode,v=null;e=new m("/",this._offset,[]),"object"==typeof v&&t(e,v),this._offset+=1}else{e=null;var k=null;k=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"/"'})}e||(this._offset=i)}}}return this._nodeCache.axis_shorthand[s]=e},__consume__node_test:function(){var s=null,n=this._offset;this._nodeCache.node_test=this._nodeCache.node_test||{};var i=this._nodeCache.node_test[n];if(i)return this._offset+=i.textValue.length,i;var o=this._offset,r=[],f={},u="",l=null,h=this._offset;if(l=this.__consume__node_condition());else if(this._offset=h,l=this.__consume__node_name());else{this._offset=h;var a=null;if(a=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"*"===a){var c=this.constructor.SyntaxNode,_=null;l=new c("*",this._offset,[]),"object"==typeof _&&t(l,_),this._offset+=1}else{l=null;var p=null;p=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"*"'})}l||(this._offset=h)}if(l){r.push(l),u+=l.textValue;var d=null,y=this._offset;if(d=this.__consume__subscript());else{this._offset=y;var g=this.constructor.SyntaxNode,m=null;d=new g("",this._offset,[]),"object"==typeof m&&t(d,m),this._offset+=0}d?(r.push(d),u+=d.textValue,f.subscript=d):(r=null,this._offset=o)}else r=null,this._offset=o;if(r){this._offset=o;var v=this.constructor.SyntaxNode,k=e(this.constructor,"NodeTest");s=new v(u,this._offset,r,f),"object"==typeof k&&t(s,k),this._offset+=u.length}else s=null;return this._nodeCache.node_test[n]=s},__consume__node_condition:function(){var e=null,s=this._offset;this._nodeCache.node_condition=this._nodeCache.node_condition||{};var n=this._nodeCache.node_condition[s];if(n)return this._offset+=n.textValue.length,n;for(var i=this._offset,o=[],r={},f="",u=null,l=1,h=this._offset,a=[],c="",_=!0;_;){var p=null;if(p=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,p&&/^[a-z\-]/.test(p)){var d=this.constructor.SyntaxNode,y=null;_=new d(p,this._offset,[]),"object"==typeof y&&t(_,y),this._offset+=1}else{_=null;var g=null;g=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:"[a-z\\-]"})}_&&(a.push(_),c+=_.textValue,l-=1)}if(0>=l){this._offset=h;var m=this.constructor.SyntaxNode,v=null;u=new m(c,this._offset,a),"object"==typeof v&&t(u,v),this._offset+=c.length}else u=null;if(u){o.push(u),f+=u.textValue,r.condition_name=u;var k=null,b=null;if(b=this._input.length>this._offset?this._input.substring(this._offset,this._offset+2):null,"()"===b){var x=this.constructor.SyntaxNode,w=null;k=new x("()",this._offset,[]),"object"==typeof w&&t(k,w),this._offset+=2}else{k=null;var S=null;S=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"()"'})}k?(o.push(k),f+=k.textValue):(o=null,this._offset=i)}else o=null,this._offset=i;if(o){this._offset=i;var N=this.constructor.SyntaxNode,C=null;e=new N(f,this._offset,o,r),"object"==typeof C&&t(e,C),this._offset+=f.length}else e=null;return this._nodeCache.node_condition[s]=e},__consume__node_name:function(){var e=null,s=this._offset;this._nodeCache.node_name=this._nodeCache.node_name||{};var n=this._nodeCache.node_name[s];if(n)return this._offset+=n.textValue.length,n;for(var i=1,o=this._offset,r=[],f="",u=!0;u;){var l=null;if(l=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,l&&/^[A-Za-z0-9\-]/.test(l)){var h=this.constructor.SyntaxNode,a=null;u=new h(l,this._offset,[]),"object"==typeof a&&t(u,a),this._offset+=1}else{u=null;var c=null;c=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:"[A-Za-z0-9\\-]"})}u&&(r.push(u),f+=u.textValue,i-=1)}if(0>=i){this._offset=o;var _=this.constructor.SyntaxNode,p=null;e=new _(f,this._offset,r),"object"==typeof p&&t(e,p),this._offset+=f.length}else e=null;return this._nodeCache.node_name[s]=e},__consume__subscript:function(){var e=null,s=this._offset;this._nodeCache.subscript=this._nodeCache.subscript||{};var n=this._nodeCache.subscript[s];if(n)return this._offset+=n.textValue.length,n;var i=this._offset,o=[],r={},f="",u=null,l=null;if(l=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"["===l){var h=this.constructor.SyntaxNode,a=null;u=new h("[",this._offset,[]),"object"==typeof a&&t(u,a),this._offset+=1}else{u=null;var c=null;c=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"["'})}if(u){o.push(u),f+=u.textValue;var _=null;if(_=this.__consume__space()){o.push(_),f+=_.textValue,r.space=_;var p=null;if(p=this.__consume__integer()){o.push(p),f+=p.textValue,r.integer=p;var d=null;if(d=this.__consume__space()){o.push(d),f+=d.textValue,r.space=d;var y=null,g=null;if(g=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"]"===g){var m=this.constructor.SyntaxNode,v=null;y=new m("]",this._offset,[]),"object"==typeof v&&t(y,v),this._offset+=1}else{y=null;var k=null;k=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"]"'})}y?(o.push(y),f+=y.textValue):(o=null,this._offset=i)}else o=null,this._offset=i}else o=null,this._offset=i}else o=null,this._offset=i}else o=null,this._offset=i;if(o){this._offset=i;var b=this.constructor.SyntaxNode,x=null;e=new b(f,this._offset,o,r),"object"==typeof x&&t(e,x),this._offset+=f.length}else e=null;return this._nodeCache.subscript[s]=e},__consume__node_predicate:function(){var e=null,s=this._offset;this._nodeCache.node_predicate=this._nodeCache.node_predicate||{};var n=this._nodeCache.node_predicate[s];if(n)return this._offset+=n.textValue.length,n;var i=this._offset,o=[],r={},f="",u=null,l=null;if(l=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"["===l){var h=this.constructor.SyntaxNode,a=null;u=new h("[",this._offset,[]),"object"==typeof a&&t(u,a),this._offset+=1}else{u=null;var c=null;c=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"["'})}if(u){o.push(u),f+=u.textValue;var _=null;if(_=this.__consume__expression()){o.push(_),f+=_.textValue,r.expression=_;var p=null,d=null;if(d=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"]"===d){var y=this.constructor.SyntaxNode,g=null;p=new y("]",this._offset,[]),"object"==typeof g&&t(p,g),this._offset+=1}else{p=null;var m=null;m=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"]"'})}if(p){o.push(p),f+=p.textValue;var v=null,k=this._offset;if(v=this.__consume__subscript());else{this._offset=k;var b=this.constructor.SyntaxNode,x=null;v=new b("",this._offset,[]),"object"==typeof x&&t(v,x),this._offset+=0}v?(o.push(v),f+=v.textValue,r.subscript=v):(o=null,this._offset=i)}else o=null,this._offset=i}else o=null,this._offset=i}else o=null,this._offset=i;if(o){this._offset=i;var w=this.constructor.SyntaxNode,S=null;e=new w(f,this._offset,o,r),"object"==typeof S&&t(e,S),this._offset+=f.length}else e=null;return this._nodeCache.node_predicate[s]=e},__consume__expression:function(){var t=null,e=this._offset;this._nodeCache.expression=this._nodeCache.expression||{};var s=this._nodeCache.expression[e];if(s)return this._offset+=s.textValue.length,s;var n=this._offset;return t=this.__consume__or_expression(),t||(this._offset=n,t=this.__consume__and_expression(),t||(this._offset=n,t=this.__consume__comparison(),t||(this._offset=n,t=this.__consume__atom(),t||(this._offset=n)))),this._nodeCache.expression[e]=t},__consume__or_expression:function(){var s=null,n=this._offset;this._nodeCache.or_expression=this._nodeCache.or_expression||{};var i=this._nodeCache.or_expression[n];if(i)return this._offset+=i.textValue.length,i;var o=this._offset,r=this._offset,f=[],u={},l="",h=null;if(h=this.__consume__and_expression()){f.push(h),l+=h.textValue,u.left=h;var a=null,c=null;if(c=this._input.length>this._offset?this._input.substring(this._offset,this._offset+2):null,"or"===c){var _=this.constructor.SyntaxNode,p=null;a=new _("or",this._offset,[]),"object"==typeof p&&t(a,p),this._offset+=2}else{a=null;var d=null;d=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"or"'})}if(a){f.push(a),l+=a.textValue;var y=null;y=this.__consume__or_expression(),y?(f.push(y),l+=y.textValue,u.right=y):(f=null,this._offset=r)}else f=null,this._offset=r}else f=null,this._offset=r;if(f){this._offset=r;var g=this.constructor.SyntaxNode,m=e(this.constructor,"Or");s=new g(l,this._offset,f,u),"object"==typeof m&&t(s,m),this._offset+=l.length}else s=null;return s||(this._offset=o,s=this.__consume__and_expression(),s||(this._offset=o)),this._nodeCache.or_expression[n]=s},__consume__and_expression:function(){var s=null,n=this._offset;this._nodeCache.and_expression=this._nodeCache.and_expression||{};var i=this._nodeCache.and_expression[n];if(i)return this._offset+=i.textValue.length,i;var o=this._offset,r=this._offset,f=[],u={},l="",h=null;if(h=this.__consume__comparison()){f.push(h),l+=h.textValue,u.left=h;var a=null,c=null;if(c=this._input.length>this._offset?this._input.substring(this._offset,this._offset+3):null,"and"===c){var _=this.constructor.SyntaxNode,p=null;a=new _("and",this._offset,[]),"object"==typeof p&&t(a,p),this._offset+=3}else{a=null;var d=null;d=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"and"'})}if(a){f.push(a),l+=a.textValue;var y=null;y=this.__consume__and_expression(),y?(f.push(y),l+=y.textValue,u.right=y):(f=null,this._offset=r)}else f=null,this._offset=r}else f=null,this._offset=r;if(f){this._offset=r;var g=this.constructor.SyntaxNode,m=e(this.constructor,"And");s=new g(l,this._offset,f,u),"object"==typeof m&&t(s,m),this._offset+=l.length}else s=null;return s||(this._offset=o,s=this.__consume__comparison(),s||(this._offset=o)),this._nodeCache.and_expression[n]=s},__consume__comparison:function(){var s=null,n=this._offset;this._nodeCache.comparison=this._nodeCache.comparison||{};var i=this._nodeCache.comparison[n];if(i)return this._offset+=i.textValue.length,i;var o=this._offset,r=this._offset,f=[],u={},l="",h=null;if(h=this.__consume__atom()){f.push(h),l+=h.textValue,u.left=h;var a=null;if(a=this.__consume__comparator()){f.push(a),l+=a.textValue,u.comparator=a;var c=null;c=this.__consume__comparison(),c?(f.push(c),l+=c.textValue,u.right=c):(f=null,this._offset=r)}else f=null,this._offset=r}else f=null,this._offset=r;if(f){this._offset=r;var _=this.constructor.SyntaxNode,p=e(this.constructor,"Comparison");s=new _(l,this._offset,f,u),"object"==typeof p&&t(s,p),this._offset+=l.length}else s=null;return s||(this._offset=o,s=this.__consume__atom(),s||(this._offset=o)),this._nodeCache.comparison[n]=s},__consume__comparator:function(){var e=null,s=this._offset;this._nodeCache.comparator=this._nodeCache.comparator||{};var n=this._nodeCache.comparator[s];if(n)return this._offset+=n.textValue.length,n;var i=this._offset,o=null;if(o=this._input.length>this._offset?this._input.substring(this._offset,this._offset+2):null,"!="===o){var r=this.constructor.SyntaxNode,f=null;e=new r("!=",this._offset,[]),"object"==typeof f&&t(e,f),this._offset+=2}else{e=null;var u=null;u=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"!="'})}if(e);else{this._offset=i;var l=null;if(l=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"="===l){var h=this.constructor.SyntaxNode,a=null;e=new h("=",this._offset,[]),"object"==typeof a&&t(e,a),this._offset+=1}else{e=null;var c=null;c=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"="'})}e||(this._offset=i)}return this._nodeCache.comparator[s]=e},__consume__atom:function(){var s=null,n=this._offset;this._nodeCache.atom=this._nodeCache.atom||{};var i=this._nodeCache.atom[n];if(i)return this._offset+=i.textValue.length,i;var o=this._offset,r=[],f={},u="",l=null;if(l=this.__consume__space()){r.push(l),u+=l.textValue,f.space=l;var h=null,a=this._offset,c=this._offset,_=[],p={},d="",y=null,g=null;if(g=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"("===g){var m=this.constructor.SyntaxNode,v=null;y=new m("(",this._offset,[]),"object"==typeof v&&t(y,v),this._offset+=1}else{y=null;var k=null;k=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"("'})}if(y){_.push(y),d+=y.textValue;var b=null;if(b=this.__consume__expression()){_.push(b),d+=b.textValue,p.in_parens=b;var x=null,w=null;if(w=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,")"===w){var S=this.constructor.SyntaxNode,N=null;x=new S(")",this._offset,[]),"object"==typeof N&&t(x,N),this._offset+=1}else{x=null;var C=null;C=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'")"'})}x?(_.push(x),d+=x.textValue):(_=null,this._offset=c)}else _=null,this._offset=c}else _=null,this._offset=c;if(_){this._offset=c;var E=this.constructor.SyntaxNode,P=null;h=new E(d,this._offset,_,p),"object"==typeof P&&t(h,P),this._offset+=d.length}else h=null;if(h||(this._offset=a,h=this.__consume__value(),h||(this._offset=a)),h){r.push(h),u+=h.textValue,f.expression=h;var T=null;T=this.__consume__space(),T?(r.push(T),u+=T.textValue,f.space=T):(r=null,this._offset=o)}else r=null,this._offset=o}else r=null,this._offset=o;if(r){this._offset=o;var V=this.constructor.SyntaxNode,j=e(this.constructor,"Atom");s=new V(u,this._offset,r,f),"object"==typeof j&&t(s,j),this._offset+=u.length}else s=null;return this._nodeCache.atom[n]=s},__consume__value:function(){var t=null,e=this._offset;this._nodeCache.value=this._nodeCache.value||{};var s=this._nodeCache.value[e];if(s)return this._offset+=s.textValue.length,s;var n=this._offset;return t=this.__consume__function_call(),t||(this._offset=n,t=this.__consume__string(),t||(this._offset=n,t=this.__consume__union_expression(),t||(this._offset=n))),this._nodeCache.value[e]=t},__consume__function_call:function(){var s=null,n=this._offset;this._nodeCache.function_call=this._nodeCache.function_call||{};var i=this._nodeCache.function_call[n];if(i)return this._offset+=i.textValue.length,i;var o=this._offset,r=[],f={},u="",l=null;if(l=this.__consume__function_name()){r.push(l),u+=l.textValue,f.function_name=l;var h=null,a=null;if(a=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"("===a){var c=this.constructor.SyntaxNode,_=null;h=new c("(",this._offset,[]),"object"==typeof _&&t(h,_),this._offset+=1}else{h=null;var p=null;p=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"("'})}if(h){r.push(h),u+=h.textValue;var d=null;if(d=this.__consume__function_args()){r.push(d),u+=d.textValue,f.function_args=d;var y=null,g=null;if(g=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,")"===g){var m=this.constructor.SyntaxNode,v=null;y=new m(")",this._offset,[]),"object"==typeof v&&t(y,v),this._offset+=1}else{y=null;var k=null;k=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'")"'})}y?(r.push(y),u+=y.textValue):(r=null,this._offset=o)}else r=null,this._offset=o}else r=null,this._offset=o}else r=null,this._offset=o;if(r){this._offset=o;var b=this.constructor.SyntaxNode,x=e(this.constructor,"FunctionCall");s=new b(u,this._offset,r,f),"object"==typeof x&&t(s,x),this._offset+=u.length}else s=null;return this._nodeCache.function_call[n]=s},__consume__function_name:function(){var e=null,s=this._offset;this._nodeCache.function_name=this._nodeCache.function_name||{};var n=this._nodeCache.function_name[s];if(n)return this._offset+=n.textValue.length,n;for(var i=1,o=this._offset,r=[],f="",u=!0;u;){var l=null;if(l=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,l&&/^[a-z\-]/.test(l)){var h=this.constructor.SyntaxNode,a=null;u=new h(l,this._offset,[]),"object"==typeof a&&t(u,a),this._offset+=1}else{u=null;var c=null;c=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:"[a-z\\-]"})}u&&(r.push(u),f+=u.textValue,i-=1)}if(0>=i){this._offset=o;var _=this.constructor.SyntaxNode,p=null;e=new _(f,this._offset,r),"object"==typeof p&&t(e,p),this._offset+=f.length}else e=null;return this._nodeCache.function_name[s]=e},__consume__function_args:function(){var e=null,s=this._offset;this._nodeCache.function_args=this._nodeCache.function_args||{};var n=this._nodeCache.function_args[s];if(n)return this._offset+=n.textValue.length,n;var i=this._offset,o=this._offset,r=[],f={},u="",l=null;if(l=this.__consume__expression()){r.push(l),u+=l.textValue,f.first=l;for(var h=null,a=0,c=this._offset,_=[],p="",d=!0;d;){var y=this._offset,g=[],m={},v="",k=null,b=null;if(b=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,","===b){var x=this.constructor.SyntaxNode,w=null;k=new x(",",this._offset,[]),"object"==typeof w&&t(k,w),this._offset+=1}else{k=null;var S=null;S=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'","'})}if(k){g.push(k),v+=k.textValue;var N=null;N=this.__consume__expression(),N?(g.push(N),v+=N.textValue,m.expression=N):(g=null,this._offset=y)}else g=null,this._offset=y;if(g){this._offset=y;var C=this.constructor.SyntaxNode,E=null;d=new C(v,this._offset,g,m),"object"==typeof E&&t(d,E),this._offset+=v.length}else d=null;d&&(_.push(d),p+=d.textValue,a-=1)}if(0>=a){this._offset=c;var P=this.constructor.SyntaxNode,T=null;h=new P(p,this._offset,_),"object"==typeof T&&t(h,T),this._offset+=p.length}else h=null;h?(r.push(h),u+=h.textValue,f.rest=h):(r=null,this._offset=o)}else r=null,this._offset=o;if(r){this._offset=o;var V=this.constructor.SyntaxNode,j=null;
e=new V(u,this._offset,r,f),"object"==typeof j&&t(e,j),this._offset+=u.length}else e=null;if(e);else{this._offset=i;var X=this.constructor.SyntaxNode,R=null;e=new X("",this._offset,[]),"object"==typeof R&&t(e,R),this._offset+=0}return this._nodeCache.function_args[s]=e},__consume__integer:function(){var s=null,n=this._offset;this._nodeCache.integer=this._nodeCache.integer||{};var i=this._nodeCache.integer[n];if(i)return this._offset+=i.textValue.length,i;var o=this._offset,r=[],f={},u="",l=null,h=null;if(h=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,h&&/^[1-9]/.test(h)){var a=this.constructor.SyntaxNode,c=null;l=new a(h,this._offset,[]),"object"==typeof c&&t(l,c),this._offset+=1}else{l=null;var _=null;_=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:"[1-9]"})}if(l){r.push(l),u+=l.textValue;for(var p=null,d=0,y=this._offset,g=[],m="",v=!0;v;){var k=null;if(k=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,k&&/^[0-9]/.test(k)){var b=this.constructor.SyntaxNode,x=null;v=new b(k,this._offset,[]),"object"==typeof x&&t(v,x),this._offset+=1}else{v=null;var w=null;w=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:"[0-9]"})}v&&(g.push(v),m+=v.textValue,d-=1)}if(0>=d){this._offset=y;var S=this.constructor.SyntaxNode,N=null;p=new S(m,this._offset,g),"object"==typeof N&&t(p,N),this._offset+=m.length}else p=null;p?(r.push(p),u+=p.textValue):(r=null,this._offset=o)}else r=null,this._offset=o;if(r){this._offset=o;var C=this.constructor.SyntaxNode,E=e(this.constructor,"Integer");s=new C(u,this._offset,r,f),"object"==typeof E&&t(s,E),this._offset+=u.length}else s=null;return this._nodeCache.integer[n]=s},__consume__string:function(){var s=null,n=this._offset;this._nodeCache.string=this._nodeCache.string||{};var i=this._nodeCache.string[n];if(i)return this._offset+=i.textValue.length,i;var o=this._offset,r=this._offset,f=[],u={},l="",h=null,a=null;if(a=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"'"===a){var c=this.constructor.SyntaxNode,_=null;h=new c("'",this._offset,[]),"object"==typeof _&&t(h,_),this._offset+=1}else{h=null;var p=null;p=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"\'"'})}if(h){f.push(h),l+=h.textValue;for(var d=null,y=0,g=this._offset,m=[],v="",k=!0;k;){var b=this._offset,x=this._offset,w=[],S={},N="",C=null,E=null;if(E=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"\\"===E){var P=this.constructor.SyntaxNode,T=null;C=new P("\\",this._offset,[]),"object"==typeof T&&t(C,T),this._offset+=1}else{C=null;var V=null;V=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"\\\\"'})}if(C){w.push(C),N+=C.textValue;var j=null,X=null;X=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null;var R=X;if(null===R){j=null;var A=null;A=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:"<any char>"})}else{var Y=this.constructor.SyntaxNode,O=null;j=new Y(R,this._offset,[]),"object"==typeof O&&t(j,O),this._offset+=1}j?(w.push(j),N+=j.textValue):(w=null,this._offset=x)}else w=null,this._offset=x;if(w){this._offset=x;var I=this.constructor.SyntaxNode,D=null;k=new I(N,this._offset,w,S),"object"==typeof D&&t(k,D),this._offset+=N.length}else k=null;if(k);else{this._offset=b;var L=null;if(L=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,L&&/^[^']/.test(L)){var z=this.constructor.SyntaxNode,W=null;k=new z(L,this._offset,[]),"object"==typeof W&&t(k,W),this._offset+=1}else{k=null;var F=null;F=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:"[^']"})}k||(this._offset=b)}k&&(m.push(k),v+=k.textValue,y-=1)}if(0>=y){this._offset=g;var H=this.constructor.SyntaxNode,M=null;d=new H(v,this._offset,m),"object"==typeof M&&t(d,M),this._offset+=v.length}else d=null;if(d){f.push(d),l+=d.textValue;var K=null,U=null;if(U=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"'"===U){var B=this.constructor.SyntaxNode,q=null;K=new B("'",this._offset,[]),"object"==typeof q&&t(K,q),this._offset+=1}else{K=null;var Q=null;Q=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"\'"'})}K?(f.push(K),l+=K.textValue):(f=null,this._offset=r)}else f=null,this._offset=r}else f=null,this._offset=r;if(f){this._offset=r;var G=this.constructor.SyntaxNode,J=null;s=new G(l,this._offset,f,u),"object"==typeof J&&t(s,J),this._offset+=l.length}else s=null;if(s){var $=e(this.constructor,"String");"object"==typeof $&&t(s,$)}else{this._offset=o;var Z=this._offset,te=[],ee={},se="",ne=null,ie=null;if(ie=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,'"'===ie){var oe=this.constructor.SyntaxNode,re=null;ne=new oe('"',this._offset,[]),"object"==typeof re&&t(ne,re),this._offset+=1}else{ne=null;var fe=null;fe=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"\\""'})}if(ne){te.push(ne),se+=ne.textValue;for(var ue=null,le=0,he=this._offset,ae=[],ce="",_e=!0;_e;){var pe=this._offset,de=this._offset,ye=[],ge={},me="",ve=null,ke=null;if(ke=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,"\\"===ke){var be=this.constructor.SyntaxNode,xe=null;ve=new be("\\",this._offset,[]),"object"==typeof xe&&t(ve,xe),this._offset+=1}else{ve=null;var we=null;we=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"\\\\"'})}if(ve){ye.push(ve),me+=ve.textValue;var Se=null,Ne=null;Ne=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null;var Ce=Ne;if(null===Ce){Se=null;var Ee=null;Ee=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:"<any char>"})}else{var Pe=this.constructor.SyntaxNode,Te=null;Se=new Pe(Ce,this._offset,[]),"object"==typeof Te&&t(Se,Te),this._offset+=1}Se?(ye.push(Se),me+=Se.textValue):(ye=null,this._offset=de)}else ye=null,this._offset=de;if(ye){this._offset=de;var Ve=this.constructor.SyntaxNode,je=null;_e=new Ve(me,this._offset,ye,ge),"object"==typeof je&&t(_e,je),this._offset+=me.length}else _e=null;if(_e);else{this._offset=pe;var Xe=null;if(Xe=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,Xe&&/^[^"]/.test(Xe)){var Re=this.constructor.SyntaxNode,Ae=null;_e=new Re(Xe,this._offset,[]),"object"==typeof Ae&&t(_e,Ae),this._offset+=1}else{_e=null;var Ye=null;Ye=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'[^"]'})}_e||(this._offset=pe)}_e&&(ae.push(_e),ce+=_e.textValue,le-=1)}if(0>=le){this._offset=he;var Oe=this.constructor.SyntaxNode,Ie=null;ue=new Oe(ce,this._offset,ae),"object"==typeof Ie&&t(ue,Ie),this._offset+=ce.length}else ue=null;if(ue){te.push(ue),se+=ue.textValue;var De=null,Le=null;if(Le=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,'"'===Le){var ze=this.constructor.SyntaxNode,We=null;De=new ze('"',this._offset,[]),"object"==typeof We&&t(De,We),this._offset+=1}else{De=null;var Fe=null;Fe=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'"\\""'})}De?(te.push(De),se+=De.textValue):(te=null,this._offset=Z)}else te=null,this._offset=Z}else te=null,this._offset=Z;if(te){this._offset=Z;var He=this.constructor.SyntaxNode,Me=null;s=new He(se,this._offset,te,ee),"object"==typeof Me&&t(s,Me),this._offset+=se.length}else s=null;if(s){var Ke=e(this.constructor,"String");"object"==typeof Ke&&t(s,Ke)}else this._offset=o}return this._nodeCache.string[n]=s},__consume__space:function(){var e=null,s=this._offset;this._nodeCache.space=this._nodeCache.space||{};var n=this._nodeCache.space[s];if(n)return this._offset+=n.textValue.length,n;for(var i=0,o=this._offset,r=[],f="",u=!0;u;){var l=null;if(l=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null," "===l){var h=this.constructor.SyntaxNode,a=null;u=new h(" ",this._offset,[]),"object"==typeof a&&t(u,a),this._offset+=1}else{u=null;var c=null;c=this._input.length>this._offset?this._input.substring(this._offset,this._offset+1):null,(!this.error||this.error.offset<=this._offset)&&(this.error=this.constructor.lastError={input:this._input,offset:this._offset,expected:'" "'})}u&&(r.push(u),f+=u.textValue,i-=1)}if(0>=i){this._offset=o;var _=this.constructor.SyntaxNode,p=null;e=new _(f,this._offset,r),"object"==typeof p&&t(e,p),this._offset+=f.length}else e=null;return this._nodeCache.space[s]=e}},i=function(t){this._input=t,this._offset=0,this._nodeCache={}};i.prototype.parse=function(){var t=this.__consume__union_expression();if(t&&this._offset===this._input.length)return t;this.error||(this.error={input:this._input,offset:this._offset,expected:"<EOF>"});var e=s(this.error),n=Error(e);throw n},i.parse=function(t){var e=new i(t);return e.parse()},t(i.prototype,n);var o=function(t,e,s,n){if(this.textValue=t,this.offset=e,this.elements=s||[],n)for(var i in n)this[i]=n[i]};if(o.prototype.forEach=function(t,e){for(var s=0,n=this.elements.length;n>s;s++)t.call(e,this.elements[s],s)},i.SyntaxNode=o,"function"==typeof require&&"object"==typeof exports)exports.Grammar=n,exports.Parser=i,exports.parse=i.parse,Pathology!==void 0&&(Pathology.XPath=n,Pathology.XPathParser=i,Pathology.XPathParser.formatError=s);else{var r=this;r=r.Pathology=r.Pathology||{},Pathology.XPath=n,Pathology.XPathParser=i,Pathology.XPathParser.formatError=s}}(),Pathology.XPathParser.And={evaluate:function(t,e){return Pathology.atomize(this.left,t,e)&&Pathology.atomize(this.right,t,e)}},Pathology.XPathParser.Atom={evaluate:function(t,e){var s=this.expression.in_parens||this.expression;return s.evaluate(t,e)}},Pathology.Axis=function(t){this.name=t},Pathology.Axis.prototype.walk=function(t,e,s){var n,i=t.childNodes,o=Pathology.array(t.attributes);switch(t.checked&&o.push({nodeName:"checked",nodeValue:!0,nodeType:XPathResult.STRING_TYPE}),t.selected&&o.push({nodeName:"selected",nodeValue:!0,nodeType:XPathResult.STRING_TYPE}),this.name){case"attribute":for(var r=0,f=o.length;f>r;r++)e.call(s,o[r]);break;case"child":for(var r=0,f=i.length;f>r;r++)e.call(s,i[r]);break;case"descendant-or-self":e.call(s,t);for(var r=0,f=i.length;f>r;r++)this.walk(i[r],e,s);break;case"following-sibling":for(n=t.nextSibling;n;)e.call(s,n),n=n.nextSibling;break;case"parent":e.call(s,t.parentNode);break;case"self":e.call(s,t)}},Pathology.Axis.SHORTHANDS={"@":"attribute","..":"parent",".":"self","/":"descendant-or-self","":"child"},Pathology.Axis.fromAST=function(t){var e=t.axis_name?t.axis_name.textValue:t.textValue;return new this(this.SHORTHANDS[e]||e)},Pathology.XPathParser.Comparison={evaluate:function(t,e){var s,n=this.comparator.textValue,i=this.left.evaluate(t,e),o=Pathology.atomize(this.right,t,e),r=!1,f=o instanceof Array;if(i._nodes){for(var u=0,l=i._nodes.length;l>u;u++)s=i._nodes[u],"="===n?r=r||(f?Pathology.indexOf(o,s.nodeValue)>=0:s.nodeValue===o||s.innerHTML===o):"!="===n&&(r=r||(f?0>Pathology.indexOf(o,s.nodeValue):s.nodeValue!==o&&s.innerHTML!==o));return r}switch(n){case"=":return f?Pathology.indexOf(o,i.nodeValue)>=0:i==o;case"!=":return f?0>Pathology.indexOf(o,s.nodeValue):i!=o}}},Pathology.XPathParser.FunctionCall={getArguments:function(t,e){var s=[],n=this.function_args.rest;if(this.function_args.first&&this.function_args.first.evaluate&&s.push(this.function_args.first.evaluate(t,e)),n)for(var i=0,o=n.elements.length;o>i;i++)s.push(n.elements[i].expression.evaluate(t,e));return s},evaluate:function(t,e){var s=this.getArguments(t,e),n=this.REGISTER[this.function_name.textValue];return n.apply(t,s)},REGISTER:{concat:function(){for(var t="",e=0,s=arguments.length;s>e;e++)t+=arguments[e].makeString?arguments[e].makeString():arguments[e];return t},contains:function(t,e){return t?(t.makeString&&(t=t.makeString()),(""+t).indexOf(e)>=0):!1},"normalize-space":function(t){return t.makeString&&(t=t.makeString()),(""+t).replace(/^\s*/g,"").replace(/\s*$/g,"").replace(/\s+/g," ")},name:function(){return this.nodeName.toLowerCase()},not:function(t){return t&&t.atomize&&(t=t.atomize()),"string"==typeof t?!1:!t},string:function(t){return t.atomize().innerText},text:function(){return document.evaluate("/text()",this,null,XPathResult.ANY_TYPE,null)}}},Pathology.XPathParser.LocationPath={eachStep:function(t,e){for(var s=[this.head].concat(this.rest.elements),n=0,i=s.length;i>n;n++)t.call(e,s[n])},evaluate:function(t,e,s,n){n=n||new Pathology.XPathResult(XPathResult.ANY_TYPE),s=s||XPathResult.ANY_TYPE;var i,o,r,f,u,l,h=new Pathology.XPathResult(s),a=this.head.isRelative()?t:e,c=[this.head].concat(this.rest.elements);for(h.push(a),r=0,u=c.length;u>r;r++){for(i=c[r],o=new Pathology.XPathResult(s),f=0,l=h._nodes.length;l>f;f++)i.evaluate(h._nodes[f],e,s,o);h=o}for(r=0,u=h._nodes.length;u>r;r++)n.push(h._nodes[r]);return n}},Pathology.XPathParser.LocationStep={isRelative:function(){return"/"!==this.elements[0].textValue},evaluate:function(t,e,s,n){var i=this.selector.axis,o=this.selector.test,r=[[]];Pathology.Axis.fromAST(i).walk(t,function(t){return o&&o.evaluate?(o.evaluate(t,this.predicates,e,s,r,n),void 0):n.push(t)},this)}},Pathology.XPathParser.NodeTest={evaluate:function(t,e,s,n,i,o){var r=this.elements[0].condition_name,f=f=this.elements[0].textValue.toLowerCase(),u={expression:{evaluate:function(){if(r&&"node"===r.textValue)return!0;if(r&&"text"===r.textValue){if(t.nodeType!==XPathResult.BOOLEAN_TYPE)return!1}else if("*"===f){if(1!==t.nodeType)return!1}else{if(!t.nodeName)return!1;if(t.nodeName.toLowerCase()!==f)return!1}return!0}},subscript:this.subscript};e=[u].concat(e.elements);for(var l,h,a=0,c=e.length;c>a;a++){if(i[a]=i[a]||[],h=e[a],l=Pathology.atomize(h.expression,t,s),"string"==typeof l&&(l=!0),!l)return;if(i[a].push(t),h.subscript.integer&&h.subscript.integer.evaluate()!==i[a].length)return}o.push(t)}},Pathology.XPathParser.Or={evaluate:function(t,e){return Pathology.atomize(this.left,t,e)||Pathology.atomize(this.right,t,e)}},Pathology.XPathParser.Integer={evaluate:function(){return parseInt(this.textValue,10)}},Pathology.XPathParser.String={evaluate:function(context,root){return eval(this.textValue)}},Pathology.XPathParser.Union={evaluate:function(t,e,s,n){n=n||new Pathology.XPathResult(XPathResult.ANY_TYPE),s=s||XPathResult.ANY_TYPE,this.head.evaluate(t,e,s,n);for(var i=this.rest.elements,o=0,r=i.length;r>o;o++)i[o].location_path.evaluate(t,e,s,n);return n}},function(){var t,e,s,n=function(t,e){var s;for(s in e)t[s]=e[s];return t},i={msie:!(!window.attachEvent||window.opera),opera:!!window.opera,webkit:navigator.userAgent.indexOf("AppleWebKit/")>-1,safari:navigator.userAgent.indexOf("AppleWebKit/")>-1&&-1===navigator.userAgent.indexOf("Chrome/"),gecko:navigator.userAgent.indexOf("Gecko")>-1,mobilesafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/),rhino:navigator.userAgent.match(/Rhino/)&&!0},o=function(t,e,s){var i=s.ownerDocument.createEventObject();return n(i,e)},r={},f=1,u="_synthetic"+(new Date).getTime(),l=/keypress|keyup|keydown/,h=/load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll/,a=function(t,e,s,n){return new a.init(t,e,s,n)};t=function(t,e,s){return t.addEventListener?t.addEventListener(e,s,!1):t.attachEvent("on"+e,s)},e=function(t,e,s){return t.addEventListener?t.removeEventListener(e,s,!1):t.detachEvent("on"+e,s)},n(a,{init:function(t,e,s,n){var i=a.args(e,s,n),o=this;this.queue=[],this.element=i.element,"function"==typeof this[t]?this[t](i.options,i.element,function(){i.callback&&i.callback.apply(o,arguments),o.done.apply(o,arguments)}):(this.result=a.trigger(t,i.options,i.element),i.callback&&i.callback.call(this,i.element,this.result))},jquery:function(t){return window.FuncUnit&&window.FuncUnit.jQuery?window.FuncUnit.jQuery:t?a.helpers.getWindow(t).jQuery||window.jQuery:window.jQuery},args:function(){for(var t={},e=0;arguments.length>e;e++)"function"==typeof arguments[e]?t.callback=arguments[e]:arguments[e]&&arguments[e].jquery?t.element=arguments[e][0]:arguments[e]&&arguments[e].nodeName?t.element=arguments[e]:t.options&&"string"==typeof arguments[e]?t.element=document.getElementById(arguments[e]):arguments[e]&&(t.options=arguments[e]);return t},click:function(t,e,s){a("click!",t,e,s)},defaults:{focus:function(){if(!a.support.focusChanges){var s=this,n=s.nodeName.toLowerCase();a.data(s,"syntheticvalue",s.value),("input"===n||"textarea"===n)&&t(s,"blur",function(){a.data(s,"syntheticvalue")!=s.value&&a.trigger("change",{},s),e(s,"blur",arguments.callee)})}},submit:function(){a.onParents(this,function(t){return"form"===t.nodeName.toLowerCase()?(t.submit(),!1):void 0})}},changeOnBlur:function(s,n,i){t(s,"blur",function(){i!==s[n]&&a.trigger("change",{},s),e(s,"blur",arguments.callee)})},closest:function(t,e){for(;t&&t.nodeName.toLowerCase()!==e.toLowerCase();)t=t.parentNode;return t},data:function(t,e,s){var n;return t[u]||(t[u]=f++),r[t[u]]||(r[t[u]]={}),n=r[t[u]],s?(r[t[u]][e]=s,void 0):r[t[u]][e]},onParents:function(t,e){for(var s;t&&s!==!1;)s=e(t),t=t.parentNode;return t},focusable:/^(a|area|frame|iframe|label|input|select|textarea|button|html|object)$/i,isFocusable:function(t){var e;return(this.focusable.test(t.nodeName)||(e=t.getAttributeNode("tabIndex"))&&e.specified)&&a.isVisible(t)},isVisible:function(t){return t.offsetWidth&&t.offsetHeight||t.clientWidth&&t.clientHeight},tabIndex:function(t){var e=t.getAttributeNode("tabIndex");return e&&e.specified&&(parseInt(t.getAttribute("tabIndex"))||0)},bind:t,unbind:e,browser:i,helpers:{createEventObject:o,createBasicStandardEvent:function(t,e,s){var i;try{i=s.createEvent("Events")}catch(o){i=s.createEvent("UIEvents")}finally{i.initEvent(t,!0,!0),n(i,e)}return i},inArray:function(t,e){for(var s=0;e.length>s;s++)if(e[s]===t)return s;return-1},getWindow:function(t){return t.ownerDocument.defaultView||t.ownerDocument.parentWindow},extend:n,scrollOffset:function(t,e){var s=t.document.documentElement,n=t.document.body;return e?(window.scrollTo(e.left,e.top),void 0):{left:(s&&s.scrollLeft||n&&n.scrollLeft||0)+(s.clientLeft||0),top:(s&&s.scrollTop||n&&n.scrollTop||0)+(s.clientTop||0)}},scrollDimensions:function(t){var e=t.document.documentElement,s=t.document.body,n=e.clientWidth,i=e.clientHeight,o="CSS1Compat"===t.document.compatMode;return{height:o&&i||s.clientHeight||i,width:o&&n||s.clientWidth||n}},addOffset:function(t,e){var s,n=a.jquery(e);"object"==typeof t&&void 0===t.clientX&&void 0===t.clientY&&void 0===t.pageX&&void 0===t.pageY&&n&&(e=n(e),s=e.offset(),t.pageX=s.left+e.width()/2,t.pageY=s.top+e.height()/2)}},key:{ctrlKey:null,altKey:null,shiftKey:null,metaKey:null},dispatch:function(s,n,i,o){if(n.dispatchEvent&&s){var r=s.preventDefault,f=o?-1:0;return o&&t(n,i,function(t){t.preventDefault(),e(this,i,arguments.callee)}),s.preventDefault=function(){f++,++f>0&&r.apply(this,[])},n.dispatchEvent(s),0>=f}try{window.event=s}catch(u){}return 0>=n.sourceIndex||n.fireEvent&&n.fireEvent("on"+i,s)},create:{page:{event:function(t,e,s){var n,i=a.helpers.getWindow(s).document||document;if(i.createEvent)return n=i.createEvent("Events"),n.initEvent(t,!0,!0),n;try{n=o(t,e,s)}catch(r){}return n}},focus:{event:function(t,e,n){return a.onParents(n,function(t){if(a.isFocusable(t)){if("html"!==t.nodeName.toLowerCase())t.focus(),s=t;else if(s){var e=a.helpers.getWindow(n).document;if(e!==window.document)return!1;e.activeElement?(e.activeElement.blur(),s=null):(s.blur(),s=null)}return!1}}),!0}}},support:{clickChanges:!1,clickSubmits:!1,keypressSubmits:!1,mouseupSubmits:!1,radioClickChanges:!1,focusChanges:!1,linkHrefJS:!1,keyCharacters:!1,backspaceWorks:!1,mouseDownUpClicks:!1,tabKeyTabs:!1,keypressOnAnchorClicks:!1,optionClickBubbles:!1,ready:0},trigger:function(t,e,s){e||(e={});var n,i,o,r=a.create,f=r[t]&&r[t].setup,u=l.test(t)?"key":h.test(t)?"page":"mouse",c=r[t]||{},_=r[u],p=s;return 2===a.support.ready&&f&&f(t,e,s),o=e._autoPrevent,delete e._autoPrevent,c.event?i=c.event(t,e,s):(e=_.options?_.options(t,e,s):e,!a.support.changeBubbles&&/option/i.test(s.nodeName)&&(p=s.parentNode),n=_.event(t,e,p),i=a.dispatch(n,p,t,o)),i&&2===a.support.ready&&a.defaults[t]&&a.defaults[t].call(s,e,o),i},eventSupported:function(t){var e=document.createElement("div");t="on"+t;var s=t in e;return s||(e.setAttribute(t,"return;"),s="function"==typeof e[t]),e=null,s}}),n(a.init.prototype,{then:function(t,e,s,n){a.autoDelay&&this.delay();var i=a.args(e,s,n),o=this;return this.queue.unshift(function(e){return"function"!=typeof this[t]?(this.result=a.trigger(t,i.options,i.element),i.callback&&i.callback.call(this,i.element,this.result),this):(this.element=i.element||e,this[t](i.options,this.element,function(){i.callback&&i.callback.apply(o,arguments),o.done.apply(o,arguments)}),void 0)}),this},delay:function(t,e){"function"==typeof t&&(e=t,t=null),t=t||600;var s=this;return this.queue.unshift(function(){setTimeout(function(){e&&e.apply(s,[]),s.done.apply(s,arguments)},t)}),this},done:function(t,e){e&&(this.element=e),this.queue.length&&this.queue.pop().call(this,this.element,t)},_click:function(t,e,s,n){a.helpers.addOffset(t,e),a.trigger("mousedown",t,e),setTimeout(function(){a.trigger("mouseup",t,e),!a.support.mouseDownUpClicks||n?(a.trigger("click",t,e),s(!0)):(a.create.click.setup("click",t,e),a.defaults.click.call(e),setTimeout(function(){s(!0)},1))},1)},_rightClick:function(t,e,s){a.helpers.addOffset(t,e);var i=n(n({},a.mouse.browser.right.mouseup),t);a.trigger("mousedown",i,e),setTimeout(function(){a.trigger("mouseup",i,e),a.mouse.browser.right.contextmenu&&a.trigger("contextmenu",n(n({},a.mouse.browser.right.contextmenu),t),e),s(!0)},1)},_dblclick:function(t,e,s){a.helpers.addOffset(t,e);var n=this;this._click(t,e,function(){setTimeout(function(){n._click(t,e,function(){a.trigger("dblclick",t,e),s(!0)},!0)},2)})}});for(var c=["click","dblclick","move","drag","key","type","rightClick"],_=function(t){a[t]=function(e,s,n){return a("_"+t,e,s,n)},a.init.prototype[t]=function(e,s,n){return this.then("_"+t,e,s,n)}},p=0;c.length>p;p++)_(c[p]);(window.FuncUnit&&window.FuncUnit.jQuery||window.jQuery)&&((window.FuncUnit&&window.FuncUnit.jQuery||window.jQuery).fn.triggerSyn=function(t,e,s){if(!this[0])throw"Can't "+t.substring(1)+" because no element matching '"+this.selector+"' was found";return a(t,e,this[0],s),this}),window.Syn=a}(),function(){var h=Syn.helpers,getWin=h.getWindow;Syn.mouse={},h.extend(Syn.defaults,{mousedown:function(){Syn.trigger("focus",{},this)},click:function(){var element=this;try{element.nodeType}catch(e){return}var href,radioChanged=Syn.data(element,"radioChanged"),scope=getWin(element),nodeName=element.nodeName.toLowerCase();if(!Syn.support.linkHrefJS&&/^\s*javascript:/.test(element.href)){var code=element.href.replace(/^\s*javascript:/,"");"//"!=code&&-1==code.indexOf("void(0)")&&(window.selenium?eval("with(selenium.browserbot.getCurrentWindow()){"+code+"}"):eval("with(scope){"+code+"}"))}if(!Syn.support.clickSubmits&&"input"==nodeName&&"submit"==element.type||"button"==nodeName){var form=Syn.closest(element,"form");form&&Syn.trigger("submit",{},form)}"a"==nodeName&&element.href&&!/^\s*javascript:/.test(element.href)&&(scope.location.href=element.href),"input"==nodeName&&"checkbox"==element.type&&(Syn.support.clickChanges||Syn.trigger("change",{},element)),"input"==nodeName&&"radio"==element.type&&radioChanged&&!Syn.support.radioClickChanges&&Syn.trigger("change",{},element),"option"==nodeName&&Syn.data(element,"createChange")&&(Syn.trigger("change",{},element.parentNode),Syn.data(element,"createChange",!1))}}),h.extend(Syn.create,{mouse:{options:function(t,e){var s=document.documentElement,n=document.body,i=[e.pageX||0,e.pageY||0],o=Syn.mouse.browser&&Syn.mouse.browser.left[t],r=Syn.mouse.browser&&Syn.mouse.browser.right[t];return h.extend({bubbles:!0,cancelable:!0,view:window,detail:1,screenX:1,screenY:1,clientX:e.clientX||i[0]-(s&&s.scrollLeft||n&&n.scrollLeft||0)-(s.clientLeft||0),clientY:e.clientY||i[1]-(s&&s.scrollTop||n&&n.scrollTop||0)-(s.clientTop||0),ctrlKey:!!Syn.key.ctrlKey,altKey:!!Syn.key.altKey,shiftKey:!!Syn.key.shiftKey,metaKey:!!Syn.key.metaKey,button:o&&null!=o.button?o.button:r&&r.button||("contextmenu"==t?2:0),relatedTarget:document.documentElement},e)},event:function(t,e,s){var n=getWin(s).document||document;if(n.createEvent){var i;try{i=n.createEvent("MouseEvents"),i.initMouseEvent(t,e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}catch(o){i=h.createBasicStandardEvent(t,e,n)}return i.synthetic=!0,i}var i;try{i=h.createEventObject(t,e,s)}catch(o){}return i}},click:{setup:function(t,e,s){var t,n=s.nodeName.toLowerCase();if(!Syn.support.clickChecks&&!Syn.support.changeChecks&&"input"===n&&(t=s.type.toLowerCase(),"checkbox"===t&&(s.checked=!s.checked),"radio"===t&&!s.checked)){try{Syn.data(s,"radioChanged",!0)}catch(i){}s.checked=!0}if("a"==n&&s.href&&!/^\s*javascript:/.test(s.href)&&Syn.data(s,"href",s.href),/option/i.test(s.nodeName)){for(var o=s.parentNode.firstChild,r=-1;o&&(1!=o.nodeType||(r++,o!=s));)o=o.nextSibling;r!==s.parentNode.selectedIndex&&(s.parentNode.selectedIndex=r,Syn.data(s,"createChange",!0))}}},mousedown:{setup:function(t,e,s){var n=s.nodeName.toLowerCase();!Syn.browser.safari||"select"!=n&&"option"!=n||(e._autoPrevent=!0)}}}),function(){if(!document.body)return setTimeout(arguments.callee,1),void 0;var t=window.__synthTest;window.__synthTest=function(){Syn.support.linkHrefJS=!0};var e,s,n,i,o=document.createElement("div");o.innerHTML="<form id='outer'><input name='checkbox' type='checkbox'/><input name='radio' type='radio' /><input type='submit' name='submitter'/><input type='input' name='inputter'/><input name='one'><input name='two'/><a href='javascript:__synthTest()' id='synlink'></a><select><option></option></select></form>",document.documentElement.appendChild(o),n=o.firstChild,e=n.childNodes[0],s=n.childNodes[2],i=n.getElementsByTagName("select")[0],e.checked=!1,e.onchange=function(){Syn.support.clickChanges=!0},Syn.trigger("click",{},e),Syn.support.clickChecks=e.checked,e.checked=!1,Syn.trigger("change",{},e),Syn.support.changeChecks=e.checked,n.onsubmit=function(t){return t.preventDefault&&t.preventDefault(),Syn.support.clickSubmits=!0,!1},Syn.trigger("click",{},s),n.childNodes[1].onchange=function(){Syn.support.radioClickChanges=!0},Syn.trigger("click",{},n.childNodes[1]),Syn.bind(o,"click",function(){Syn.support.optionClickBubbles=!0,Syn.unbind(o,"click",arguments.callee)}),Syn.trigger("click",{},i.firstChild),Syn.support.changeBubbles=Syn.eventSupported("change"),o.onclick=function(){Syn.support.mouseDownUpClicks=!0},Syn.trigger("mousedown",{},o),Syn.trigger("mouseup",{},o),document.documentElement.removeChild(o),window.__synthTest=t,Syn.support.ready++}()}(),function(){Syn.key.browsers={webkit:{prevent:{keyup:[],keydown:["char","keypress"],keypress:["char"]},character:{keydown:[0,"key"],keypress:["char","char"],keyup:[0,"key"]},specialChars:{keydown:[0,"char"],keyup:[0,"char"]},navigation:{keydown:[0,"key"],keyup:[0,"key"]},special:{keydown:[0,"key"],keyup:[0,"key"]},tab:{keydown:[0,"char"],keyup:[0,"char"]},"pause-break":{keydown:[0,"key"],keyup:[0,"key"]},caps:{keydown:[0,"key"],keyup:[0,"key"]},escape:{keydown:[0,"key"],keyup:[0,"key"]},"num-lock":{keydown:[0,"key"],keyup:[0,"key"]},"scroll-lock":{keydown:[0,"key"],keyup:[0,"key"]},print:{keyup:[0,"key"]},"function":{keydown:[0,"key"],keyup:[0,"key"]},"\r":{keydown:[0,"key"],keypress:["char","key"],keyup:[0,"key"]}},gecko:{prevent:{keyup:[],keydown:["char"],keypress:["char"]},character:{keydown:[0,"key"],keypress:["char",0],keyup:[0,"key"]},specialChars:{keydown:[0,"key"],keypress:[0,"key"],keyup:[0,"key"]},navigation:{keydown:[0,"key"],keypress:[0,"key"],keyup:[0,"key"]},special:{keydown:[0,"key"],keyup:[0,"key"]},"	":{keydown:[0,"key"],keypress:[0,"key"],keyup:[0,"key"]},"pause-break":{keydown:[0,"key"],keypress:[0,"key"],keyup:[0,"key"]},caps:{keydown:[0,"key"],keyup:[0,"key"]},escape:{keydown:[0,"key"],keypress:[0,"key"],keyup:[0,"key"]},"num-lock":{keydown:[0,"key"],keyup:[0,"key"]},"scroll-lock":{keydown:[0,"key"],keyup:[0,"key"]},print:{keyup:[0,"key"]},"function":{keydown:[0,"key"],keyup:[0,"key"]},"\r":{keydown:[0,"key"],keypress:[0,"key"],keyup:[0,"key"]}},msie:{prevent:{keyup:[],keydown:["char","keypress"],keypress:["char"]},character:{keydown:[null,"key"],keypress:[null,"char"],keyup:[null,"key"]},specialChars:{keydown:[null,"char"],keyup:[null,"char"]},navigation:{keydown:[null,"key"],keyup:[null,"key"]},special:{keydown:[null,"key"],keyup:[null,"key"]},tab:{keydown:[null,"char"],keyup:[null,"char"]},"pause-break":{keydown:[null,"key"],keyup:[null,"key"]},caps:{keydown:[null,"key"],keyup:[null,"key"]},escape:{keydown:[null,"key"],keypress:[null,"key"],keyup:[null,"key"]},"num-lock":{keydown:[null,"key"],keyup:[null,"key"]},"scroll-lock":{keydown:[null,"key"],keyup:[null,"key"]},print:{keyup:[null,"key"]},"function":{keydown:[null,"key"],keyup:[null,"key"]},"\r":{keydown:[null,"key"],keypress:[null,"key"],keyup:[null,"key"]}},opera:{prevent:{keyup:[],keydown:[],keypress:["char"]},character:{keydown:[null,"key"],keypress:[null,"char"],keyup:[null,"key"]},specialChars:{keydown:[null,"char"],keypress:[null,"char"],keyup:[null,"char"]},navigation:{keydown:[null,"key"],keypress:[null,"key"]},special:{keydown:[null,"key"],keypress:[null,"key"],keyup:[null,"key"]},tab:{keydown:[null,"char"],keypress:[null,"char"],keyup:[null,"char"]},"pause-break":{keydown:[null,"key"],keypress:[null,"key"],keyup:[null,"key"]},caps:{keydown:[null,"key"],keyup:[null,"key"]},escape:{keydown:[null,"key"],keypress:[null,"key"]},"num-lock":{keyup:[null,"key"],keydown:[null,"key"],keypress:[null,"key"]},"scroll-lock":{keydown:[null,"key"],keypress:[null,"key"],keyup:[null,"key"]},print:{},"function":{keydown:[null,"key"],keypress:[null,"key"],keyup:[null,"key"]},"\r":{keydown:[null,"key"],keypress:[null,"key"],keyup:[null,"key"]}}},Syn.mouse.browsers={webkit:{right:{mousedown:{button:2,which:3},mouseup:{button:2,which:3},contextmenu:{button:2,which:3}},left:{mousedown:{button:0,which:1},mouseup:{button:0,which:1},click:{button:0,which:1}}},opera:{right:{mousedown:{button:2,which:3},mouseup:{button:2,which:3}},left:{mousedown:{button:0,which:1},mouseup:{button:0,which:1},click:{button:0,which:1}}},msie:{right:{mousedown:{button:2},mouseup:{button:2},contextmenu:{button:0}},left:{mousedown:{button:1},mouseup:{button:1},click:{button:0}}},chrome:{right:{mousedown:{button:2,which:3},mouseup:{button:2,which:3},contextmenu:{button:2,which:3}},left:{mousedown:{button:0,which:1},mouseup:{button:0,which:1},click:{button:0,which:1}}},gecko:{left:{mousedown:{button:0,which:1},mouseup:{button:0,which:1},click:{button:0,which:1}},right:{mousedown:{button:2,which:3},mouseup:{button:2,which:3},contextmenu:{button:2,which:3}}}},Syn.key.browser=function(){if(Syn.key.browsers[window.navigator.userAgent])return Syn.key.browsers[window.navigator.userAgent];
for(var t in Syn.browser)if(Syn.browser[t]&&Syn.key.browsers[t])return Syn.key.browsers[t];return Syn.key.browsers.gecko}(),Syn.mouse.browser=function(){if(Syn.mouse.browsers[window.navigator.userAgent])return Syn.mouse.browsers[window.navigator.userAgent];for(var t in Syn.browser)if(Syn.browser[t]&&Syn.mouse.browsers[t])return Syn.mouse.browsers[t];return Syn.mouse.browsers.gecko}()}(),function(){(function(){if(!document.body)return setTimeout(arguments.callee,1),void 0;var t=document.createElement("div");if(document.body.appendChild(t),Syn.helpers.extend(t.style,{width:"100px",height:"10000px",backgroundColor:"blue",position:"absolute",top:"10px",left:"0px",zIndex:19999}),document.body.scrollTop=11,document.elementFromPoint){var e=document.elementFromPoint(3,1);e==t?Syn.support.elementFromClient=!0:Syn.support.elementFromPage=!0,document.body.removeChild(t),document.body.scrollTop=0}})();var t=function(t,e){var s,n=t.clientX,i=t.clientY,o=Syn.helpers.getWindow(e);if(Syn.support.elementFromPage){var r=Syn.helpers.scrollOffset(o);n+=r.left,i+=r.top}return s=o.document.elementFromPoint?o.document.elementFromPoint(n,i):e,s===o.document.documentElement&&(0>t.clientY||0>t.clientX)?e:s},e=function(e,s,n){var i=t(s,n);return Syn.trigger(e,s,i||n),i},s=function(e,s,n){var i=t(e,s);if(n!=i&&i&&n){var o=Syn.helpers.extend({},e);o.relatedTarget=i,Syn.trigger("mouseout",o,n),o.relatedTarget=n,Syn.trigger("mouseover",o,i)}return Syn.trigger("mousemove",e,i||s),i},n=function(e,n,i,o,r){var f=new Date,u=n.clientX-e.clientX,l=n.clientY-e.clientY,h=Syn.helpers.getWindow(o),a=t(e,o),c=h.document.createElement("div"),_=0;move=function(){var t=new Date,p=Syn.helpers.scrollOffset(h),d=(0==_?0:t-f)/i,y={clientX:u*d+e.clientX,clientY:l*d+e.clientY};_++,1>d?(Syn.helpers.extend(c.style,{left:y.clientX+p.left+2+"px",top:y.clientY+p.top+2+"px"}),a=s(y,o,a),setTimeout(arguments.callee,15)):(a=s(n,o,a),h.document.body.removeChild(c),r())},Syn.helpers.extend(c.style,{height:"5px",width:"5px",backgroundColor:"red",position:"absolute",zIndex:19999,fontSize:"1px"}),h.document.body.appendChild(c),move()},i=function(t,s,i,o,r){e("mousedown",t,o),n(t,s,i,o,function(){e("mouseup",s,o),r()})},o=function(t){var e=Syn.jquery()(t),s=e.offset();return{pageX:s.left+e.outerWidth()/2,pageY:s.top+e.outerHeight()/2}},r=function(t,e,s){var n=/(\d+)[x ](\d+)/,i=/(\d+)X(\d+)/,r=/([+-]\d+)[xX ]([+-]\d+)/;if("string"==typeof t&&r.test(t)&&s){var f=o(s),u=t.match(r);t={pageX:f.pageX+parseInt(u[1]),pageY:f.pageY+parseInt(u[2])}}if("string"==typeof t&&n.test(t)){var u=t.match(n);t={pageX:parseInt(u[1]),pageY:parseInt(u[2])}}if("string"==typeof t&&i.test(t)){var u=t.match(i);t={clientX:parseInt(u[1]),clientY:parseInt(u[2])}}if("string"==typeof t&&(t=Syn.jquery()(t,e.document)[0]),t.nodeName&&(t=o(t)),t.pageX){var l=Syn.helpers.scrollOffset(e);t={clientX:t.pageX-l.left,clientY:t.pageY-l.top}}return t},f=function(t,e,s){if(0>t.clientY){var n=Syn.helpers.scrollOffset(s),i=(Syn.helpers.scrollDimensions(s),n.top+t.clientY-100),o=i-n.top;i>0||(i=0,o=-n.top),t.clientY=t.clientY-o,e.clientY=e.clientY-o,Syn.helpers.scrollOffset(s,{top:i,left:n.left})}};Syn.helpers.extend(Syn.init.prototype,{_move:function(t,e,s){var i=Syn.helpers.getWindow(e),o=r(t.from||e,i,e),u=r(t.to||t,i,e);t.adjust!==!1&&f(o,u,i),n(o,u,t.duration||500,e,s)},_drag:function(t,e,s){var n=Syn.helpers.getWindow(e),o=r(t.from||e,n,e),u=r(t.to||t,n,e);t.adjust!==!1&&f(o,u,n),i(o,u,t.duration||500,e,s)}})}(),Terminus={isIE:/\bMSIE\b/.test(navigator.userAgent),connect:function(t,e){if(!this._bayeux){this._host=t,this._pageId=Faye.random(),this._id=window.name=window.name||document.name||Faye.random(),this._id=this._id.split("|")[0];for(var s=document.getElementsByTagName("iframe"),n=s.length;n--;)s[n].contentDocument.name=s[n].id;this.Registry.initialize(),this.Worker.initialize(),this.AjaxMonitor.initialize(),Faye.Event.on(window,"beforeunload",function(){Terminus.disabled=!0});var i="http://"+t+":"+e+"/messaging",o=this._bayeux=new Faye.Client(i),r=this;o.addExtension({outgoing:function(t,e){t.href=window.location.href,"websocket"===t.connectionType&&(r._socketCapable=!0),e(t)}}),this.getId(function(t){var e=window.name.split("|")[1];e||o.subscribe("/terminus/sockets/"+t,function(t){window.name+="|"+t.url,this.openSocket(t.url)},this);var s=o.subscribe("/terminus/clients/"+t,this.handleMessage,this);s.callback(function(){this.ping(),e&&this.openSocket(e)},this)},this)}},browserDetails:function(t,e){this.getId(function(s){t.call(e,{host:this._host,id:s,infinite:!!window.TERMINUS_INFINITE_REDIRECT,page:this._pageId,sockets:this._socketCapable,ua:navigator.userAgent,url:window.location.href})},this)},getId:function(t,e){var s=this._id;if(this.isIE)return t.call(e,s);if(opener&&opener.Terminus)opener.Terminus.getId(function(n){t.call(e,n+"/"+s)});else if(parent&&parent!==window){var n=function(){return parent.Terminus?(parent.Terminus.getId(function(n){t.call(e,n+"/"+s)}),void 0):setTimeout(n,100)};n()}else t.call(e,s)},openSocket:function(t){if(!this.disabled&&!this._socket){var e=this,s=window.MozWebSocket||window.WebSocket,n=new s(t);n.onopen=function(){e._socket=n,up=!0},n.onclose=function(){var s=!!e._socket;e._socket=null,s?e.openSocket(t):window.name=window.name.split("|")[0]},n.onmessage=function(t){e.handleMessage(JSON.parse(t.data))}}},ping:function(){this.disabled||this.browserDetails(function(t){this._bayeux.publish("/terminus/ping",t);var e=this;setTimeout(function(){e.ping()},3e3)},this)},handleMessage:function(t){var e=t.command,s=e.shift(),n=this.Driver,i=this.Worker,o=!1,r=this;e.push(function(e){o||(r.postResult(t.commandId,e),o=!0)}),i.monitor=!0,n[s].apply(n,e),i.monitor=!1},postResult:function(t,e){return!this.disabled&&t?this._socket?this._socket.send(JSON.stringify({value:e})):(this.getId(function(s){this._bayeux.publish("/terminus/results",{id:s,commandId:t,result:e})},this),void 0):void 0},getAttribute:function(t,e){return Terminus.isIE?(t.getAttributeNode(e)||{}).nodeValue||!1:t.getAttribute(e)},hideNodes:function(t,e){if(!t)return e;e=e||[];var s="script"===(t.tagName||"").toLowerCase(),n="none"===(t.style||{}).display;if(s||n){var i=t.parentNode,o=t.nextSibling;s||e.push([t,i,o]),i&&i.removeChild(t)}else for(var r=t.childNodes||[],f=0,u=r.length;u>f;f++)this.hideNodes(r[f],e);return e},showNodes:function(t){for(var e,s,n,i,o=0,r=t.length;r>o;o++)e=t[o],s=e[0],n=e[1],i=e[2],n&&(i?n.insertBefore(s,i):n.appendChild(s))},Driver:{_node:function(t){return Terminus.Registry.get(t)},attribute:function(t,e,s){var n=this._node(t);return n?(Terminus.isIE||"checked"!==e&&"selected"!==e?"textarea"===n.tagName.toLowerCase()&&"type"===e?s("textarea"):s(Terminus.getAttribute(n,e)):s(!!n[e]),void 0):s(null)},set_attribute:function(t,e,s,n){var i=this._node(t);return i?(i.setAttribute(e,s),n(!0),void 0):n(null)},body:function(t){var e=document.getElementsByTagName("html")[0];t(e.outerHTML||"<html>\n"+e.innerHTML+"\n</html>\n")},clear_cookies:function(t){var e,s=document.cookie.split(";"),n=new Date;n.setTime(n.getTime()-864e5);for(var i=0,o=s.length;o>i;i++)e=s[i].split("=")[0],document.cookie=e+"=; expires="+n.toGMTString()+"; path=/";t(!0)},click:function(t,e,s){var n=this._node(t),i=e.resynchronization_timeout;return n?(Syn.trigger("click",{},n),e.resynchronize===!1?s(!0):(i&&Terminus.Worker._setTimeout.call(window,function(){s("failed to resynchronize, ajax request timed out")},1e3*i),Terminus.Worker.callback(function(){s(!0)}),void 0)):s(!0)},current_url:function(t){Terminus.browserDetails(function(e){t(e.url)})},drag:function(t,e){var s=this._node(t.from),n=this._node(t.to);return s&&n?(Syn.drag({to:n},s,function(){e(!0)}),void 0):e(null)},evaluate:function(expression,callback){callback(eval(expression))},execute:function(expression,callback){eval(expression),callback(!0)},find:function(t,e,s){var n=e?this._node(e):document;if(!n)return s([]);for(var i,o=document.evaluate(t,n,null,XPathResult.ANY_TYPE,null),r=[];i=o.iterateNext();)r.push(Terminus.Registry.put(i));return s(r)},is_visible:function(t,e){var s=this._node(t);if(!s)return e(null);for(;s.tagName&&"body"!==s.tagName.toLowerCase();){if("none"===s.style.display||"hidden"===s.type)return e(!1);s=s.parentNode}e(!0)},select:function(t,e){var s=this._node(t);return s?(s.selected=!0,Syn.trigger("change",{},s.parentNode),e(!0),void 0):e(null)},set:function(t,e,s){var n=this._node(t),i=Terminus.getAttribute(n,"maxlength");if(!n)return s(null);if("file"===n.type)return s("not_allowed");switch(Syn.trigger("focus",{},n),Syn.trigger("click",{},n),typeof e){case"string":i&&(e=e.substr(0,parseInt(i))),n.value=e;break;case"boolean":n.checked=e}Syn.trigger("change",{},n),s(!0)},tag_name:function(t,e){var s=this._node(t);return s?(e(s.tagName.toLowerCase()),void 0):e(null)},text:function(t,e){var s=this._node(t);if(!s)return e(null);var n=Terminus.hideNodes(s),i=document.title;document.title="";var o=s.textContent||s.innerText||"";document.title=i,Terminus.showNodes(n),o=o.replace(/^\s*|\s*$/g,"").replace(/\s+/g," "),e(o)},trigger:function(t,e,s){var n=this._node(t);return n?(Syn.trigger(e,{},n),s(!0),void 0):s(null)},unselect:function(t,e){var s=this._node(t);return s?s.parentNode.multiple?(s.selected=!1,Syn.trigger("change",{},s.parentNode),e(!0),void 0):e(!1):e(null)},value:function(t,e){var s=this._node(t);if(!s)return e(null);if("select"!==s.tagName.toLowerCase()||!s.multiple)return e(s.value);for(var n=s.children,i=[],o=0,r=n.length;r>o;o++)n[o].selected&&i.push(n[o].value);e(i)},visit:function(t,e){window.location.href=t,e(t)}},Registry:{initialize:function(){this._namespace=new Faye.Namespace,this._elements={}},get:function(t){for(var e=this._elements[t],s=e;s&&"BODY"!==s.tagName&&"HTML"!==s.tagName;)s=s.parentNode;return s?e:null},put:function(t){var e=t["data-terminus-id"];return e||(e=this._namespace.generate(),t["data-terminus-id"]=e),this._elements[e]=t,e}},Worker:{initialize:function(){this._callbacks=[],this._pending=0,Terminus.isIE||this._wrapTimeouts()},callback:function(t,e){0===this._pending?this._setTimeout?this._setTimeout.call(window,function(){t.call(e)},0):setTimeout(function(){t.call(e)},0):this._callbacks.push([t,e])},suspend:function(){this._pending+=1},resume:function(){if(0!==this._pending&&(this._pending-=1,0===this._pending)){for(var t,e=0,s=this._callbacks.length;s>e;e++)t=this._callbacks[e],t[0].call(t[1]);this._callbacks=[]}},_wrapTimeouts:function(){var timeout=window.setTimeout,clear=window.clearTimeout,timeouts={},self=this,finish=function(t){timeouts.hasOwnProperty(t)&&(delete timeouts[t],self.resume())};window.setTimeout=function(callback,delay){var id=timeout.call(window,function(){try{switch(typeof callback){case"function":callback();break;case"string":eval(callback)}}finally{finish(id)}},delay);return self.monitor&&(timeouts[id]=!0,self.suspend()),id},window.clearTimeout=function(t){return finish(t),clear(t)},this._setTimeout=timeout}},AjaxMonitor:{initialize:function(){window.jQuery&&this._patchJquery()},_patchJquery:function(){var t=jQuery.ajax;jQuery.ajax=function(e,s){var n=("string"==typeof e?s:e)||{},i=n.complete,o=Terminus.Worker.monitor;return n.complete=function(){var t;try{t=i.apply(this,arguments)}finally{o&&Terminus.Worker.resume()}return t},o&&Terminus.Worker.suspend(),"string"==typeof e?t.call(jQuery,e,n):t.call(jQuery,n)}}}};