@zklogic/draw.io
Version:
Draw.IO - Graph Editor integration in Angular-cli
1 lines • 27.8 kB
JavaScript
(function(){"use strict";var t=this;function n(t){return"string"==typeof t}function e(t,n,e){return t.call.apply(t.bind,arguments)}function r(t,n,e){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var e=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(e,r),t.apply(n,e)}}return function(){return t.apply(n,arguments)}}function o(t,n,i){return(o=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?e:r).apply(null,arguments)}function i(t){var n=at;function e(){}e.prototype=n.prototype,t.G=n.prototype,t.prototype=new e,t.prototype.constructor=t,t.F=function(t,e,r){for(var o=Array(arguments.length-2),i=2;i<arguments.length;i++)o[i-2]=arguments[i];return n.prototype[e].apply(t,o)}}var a=String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};function u(t,n){return-1!=t.indexOf(n)}function s(t,n){return t<n?-1:t>n?1:0}var c,f=Array.prototype.indexOf?function(t,n,e){return Array.prototype.indexOf.call(t,n,e)}:function(t,e,r){if(r=null==r?0:0>r?Math.max(0,t.length+r):r,n(t))return n(e)&&1==e.length?t.indexOf(e,r):-1;for(;r<t.length;r++)if(r in t&&t[r]===e)return r;return-1},l=Array.prototype.forEach?function(t,n,e){Array.prototype.forEach.call(t,n,e)}:function(t,e,r){for(var o=t.length,i=n(t)?t.split(""):t,a=0;a<o;a++)a in i&&e.call(r,i[a],a,t)},h=Array.prototype.filter?function(t,n,e){return Array.prototype.filter.call(t,n,e)}:function(t,e,r){for(var o=t.length,i=[],a=0,u=n(t)?t.split(""):t,s=0;s<o;s++)if(s in u){var c=u[s];e.call(r,c,s,t)&&(i[a++]=c)}return i},p=Array.prototype.reduce?function(t,n,e,r){return r&&(n=o(n,r)),Array.prototype.reduce.call(t,n,e)}:function(t,n,e,r){var o=e;return l(t,(function(e,i){o=n.call(r,o,e,i,t)})),o},d=Array.prototype.some?function(t,n,e){return Array.prototype.some.call(t,n,e)}:function(t,e,r){for(var o=t.length,i=n(t)?t.split(""):t,a=0;a<o;a++)if(a in i&&e.call(r,i[a],a,t))return!0;return!1};function g(t,n,e){return 2>=arguments.length?Array.prototype.slice.call(t,n):Array.prototype.slice.call(t,n,e)}t:{var v=t.navigator;if(v){var y=v.userAgent;if(y){c=y;break t}}c=""}var w,b,m=u(c,"Opera")||u(c,"OPR"),E=u(c,"Trident")||u(c,"MSIE"),N=u(c,"Edge"),x=u(c,"Gecko")&&!(u(c.toLowerCase(),"webkit")&&!u(c,"Edge"))&&!(u(c,"Trident")||u(c,"MSIE"))&&!u(c,"Edge"),S=u(c.toLowerCase(),"webkit")&&!u(c,"Edge");function T(){var n=t.document;return n?n.documentMode:void 0}t:{var A="",I=(b=c,x?/rv\:([^\);]+)(\)|;)/.exec(b):N?/Edge\/([\d\.]+)/.exec(b):E?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(b):S?/WebKit\/(\S+)/.exec(b):m?/(?:Version)[ \/]?(\S+)/.exec(b):void 0);if(I&&(A=I?I[1]:""),E){var O=T();if(null!=O&&O>parseFloat(A)){w=String(O);break t}}w=A}var k={};function D(t){if(!k[t]){for(var n=0,e=a(String(w)).split("."),r=a(String(t)).split("."),o=Math.max(e.length,r.length),i=0;0==n&&i<o;i++){var u=e[i]||"",c=r[i]||"",f=/(\d*)(\D*)/g,l=/(\d*)(\D*)/g;do{var h=f.exec(u)||["","",""],p=l.exec(c)||["","",""];if(0==h[0].length&&0==p[0].length)break;n=s(0==h[1].length?0:parseInt(h[1],10),0==p[1].length?0:parseInt(p[1],10))||s(0==h[2].length,0==p[2].length)||s(h[2],p[2])}while(0==n)}k[t]=0<=n}}var P=t.document,R=P&&E?T()||("CSS1Compat"==P.compatMode?parseInt(w,10):5):void 0,C=E&&!(9<=Number(R)),_=E&&!(8<=Number(R));function j(t,n,e,r){this.a=t,this.nodeName=e,this.nodeValue=r,this.nodeType=2,this.parentNode=this.ownerElement=n}function M(t,n){var e=_&&"href"==n.nodeName?t.getAttribute(n.nodeName,2):n.nodeValue;return new j(n,t,n.nodeName,e)}function B(t){var n=null;if(1==(e=t.nodeType)&&(n=null==(n=null==(n=t.textContent)||null==n?t.innerText:n)||null==n?"":n),"string"!=typeof n)if(C&&"title"==t.nodeName.toLowerCase()&&1==e)n=t.text;else if(9==e||1==e){t=9==e?t.documentElement:t.firstChild;var e=0,r=[];for(n="";t;){do{1!=t.nodeType&&(n+=t.nodeValue),C&&"title"==t.nodeName.toLowerCase()&&(n+=t.text),r[e++]=t}while(t=t.firstChild);for(;e&&!(t=r[--e].nextSibling););}}else n=t.nodeValue;return""+n}function U(t,n,e){if(null===n)return!0;try{if(!t.getAttribute)return!1}catch(t){return!1}return _&&"class"==n&&(n="className"),null==e?!!t.getAttribute(n):t.getAttribute(n,2)==e}function L(t,e,r,o,i){return(C?F:V).call(null,t,e,n(r)?r:null,n(o)?o:null,i||new q)}function F(t,n,e,r,o){if(t instanceof _t||8==t.b||e&&null===t.b){var i=n.all;if(!i)return o;if("*"!=(t=$(t))&&!(i=n.getElementsByTagName(t)))return o;if(e){for(var a=[],u=0;n=i[u++];)U(n,e,r)&&a.push(n);i=a}for(u=0;n=i[u++];)"*"==t&&"!"==n.tagName||tt(o,n);return o}return X(t,n,e,r,o),o}function V(t,n,e,r,o){return n.getElementsByName&&r&&"name"==e&&!E?(n=n.getElementsByName(r),l(n,(function(n){t.a(n)&&tt(o,n)}))):n.getElementsByClassName&&r&&"class"==e?(n=n.getElementsByClassName(r),l(n,(function(n){n.className==r&&t.a(n)&&tt(o,n)}))):t instanceof Tt?X(t,n,e,r,o):n.getElementsByTagName&&(n=n.getElementsByTagName(t.f()),l(n,(function(t){U(t,e,r)&&tt(o,t)}))),o}function Y(t,n,e,r,o){var i;if((t instanceof _t||8==t.b||e&&null===t.b)&&(i=n.childNodes)){var a=$(t);return"*"==a||(i=h(i,(function(t){return t.tagName&&t.tagName.toLowerCase()==a})),i)?(e&&(i=h(i,(function(t){return U(t,e,r)}))),l(i,(function(t){"*"==a&&("!"==t.tagName||"*"==a&&1!=t.nodeType)||tt(o,t)})),o):o}return H(t,n,e,r,o)}function H(t,n,e,r,o){for(n=n.firstChild;n;n=n.nextSibling)U(n,e,r)&&t.a(n)&&tt(o,n);return o}function X(t,n,e,r,o){for(n=n.firstChild;n;n=n.nextSibling)U(n,e,r)&&t.a(n)&&tt(o,n),X(t,n,e,r,o)}function $(t){if(t instanceof Tt){if(8==t.b)return"!";if(null===t.b)return"*"}return t.f()}function G(t,n){if(!t||!n)return!1;if(t.contains&&1==n.nodeType)return t==n||t.contains(n);if(void 0!==t.compareDocumentPosition)return t==n||!!(16&t.compareDocumentPosition(n));for(;n&&t!=n;)n=n.parentNode;return n==t}function K(n,e){if(n==e)return 0;if(n.compareDocumentPosition)return 2&n.compareDocumentPosition(e)?1:-1;if(E&&!(9<=Number(R))){if(9==n.nodeType)return-1;if(9==e.nodeType)return 1}if("sourceIndex"in n||n.parentNode&&"sourceIndex"in n.parentNode){var r=1==n.nodeType,o=1==e.nodeType;if(r&&o)return n.sourceIndex-e.sourceIndex;var i=n.parentNode,a=e.parentNode;return i==a?z(n,e):!r&&G(i,e)?-1*W(n,e):!o&&G(a,n)?W(e,n):(r?n.sourceIndex:i.sourceIndex)-(o?e.sourceIndex:a.sourceIndex)}return(r=(o=9==n.nodeType?n:n.ownerDocument||n.document).createRange()).selectNode(n),r.collapse(!0),(o=o.createRange()).selectNode(e),o.collapse(!0),r.compareBoundaryPoints(t.Range.START_TO_END,o)}function W(t,n){var e=t.parentNode;if(e==n)return-1;for(var r=n;r.parentNode!=e;)r=r.parentNode;return z(r,t)}function z(t,n){for(var e=n;e=e.previousSibling;)if(e==t)return-1;return 1}function q(){this.b=this.a=null,this.l=0}function J(t){this.node=t,this.a=this.b=null}function Q(t,n){if(!t.a)return n;if(!n.a)return t;for(var e=t.a,r=n.a,o=null,i=null,a=0;e&&r;){i=e.node;var u=r.node;i==u||i instanceof j&&u instanceof j&&i.a==u.a?(i=e,e=e.a,r=r.a):0<K(e.node,r.node)?(i=r,r=r.a):(i=e,e=e.a),(i.b=o)?o.a=i:t.a=i,o=i,a++}for(i=e||r;i;)i.b=o,o=o.a=i,a++,i=i.a;return t.b=o,t.l=a,t}function Z(t,n){var e=new J(n);e.a=t.a,t.b?t.a.b=e:t.a=t.b=e,t.a=e,t.l++}function tt(t,n){var e=new J(n);e.b=t.b,t.a?t.b.a=e:t.a=t.b=e,t.b=e,t.l++}function nt(t){return(t=t.a)?t.node:null}function et(t){return(t=nt(t))?B(t):""}function rt(t,n){return new ot(t,!!n)}function ot(t,n){this.f=t,this.b=(this.c=n)?t.b:t.a,this.a=null}function it(t){var n=t.b;if(null==n)return null;var e=t.a=n;return t.b=t.c?n.b:n.a,e.node}function at(t){this.i=t,this.b=this.g=!1,this.f=null}function ut(t){return"\n "+t.toString().split("\n").join("\n ")}function st(t,n){t.g=n}function ct(t,n){t.b=n}function ft(t,n){var e=t.a(n);return e instanceof q?+et(e):+e}function lt(t,n){var e=t.a(n);return e instanceof q?et(e):""+e}function ht(t,n){var e=t.a(n);return e instanceof q?!!e.l:!!e}function pt(t,n,e){at.call(this,t.i),this.c=t,this.h=n,this.o=e,this.g=n.g||e.g,this.b=n.b||e.b,this.c==wt&&(e.b||e.g||4==e.i||0==e.i||!n.f?n.b||n.g||4==n.i||0==n.i||!e.f||(this.f={name:e.f.name,s:n}):this.f={name:n.f.name,s:e})}function dt(t,n,e,r,o){var i;if(n=n.a(r),e=e.a(r),n instanceof q&&e instanceof q){for(r=it(n=rt(n));r;r=it(n))for(i=it(o=rt(e));i;i=it(o))if(t(B(r),B(i)))return!0;return!1}if(n instanceof q||e instanceof q){n instanceof q?(o=n,r=e):(o=e,r=n);for(var a=typeof r,u=it(i=rt(o));u;u=it(i)){switch(a){case"number":u=+B(u);break;case"boolean":u=!!B(u);break;case"string":u=B(u);break;default:throw Error("Illegal primitive type for comparison.")}if(o==n&&t(u,r)||o==e&&t(r,u))return!0}return!1}return o?"boolean"==typeof n||"boolean"==typeof e?t(!!n,!!e):"number"==typeof n||"number"==typeof e?t(+n,+e):t(n,e):t(+n,+e)}function gt(t,n,e,r){this.a=t,this.w=n,this.i=e,this.m=r}!x&&!E||E&&9<=Number(R)||x&&D("1.9.1"),E&&D("9"),i(pt),pt.prototype.a=function(t){return this.c.m(this.h,this.o,t)},pt.prototype.toString=function(){return"Binary Expression: "+this.c+ut(this.h)+ut(this.o)},gt.prototype.toString=function(){return this.a};var vt={};function yt(t,n,e,r){if(vt.hasOwnProperty(t))throw Error("Binary operator already created: "+t);return t=new gt(t,n,e,r),vt[t.toString()]=t}yt("div",6,1,(function(t,n,e){return ft(t,e)/ft(n,e)})),yt("mod",6,1,(function(t,n,e){return ft(t,e)%ft(n,e)})),yt("*",6,1,(function(t,n,e){return ft(t,e)*ft(n,e)})),yt("+",5,1,(function(t,n,e){return ft(t,e)+ft(n,e)})),yt("-",5,1,(function(t,n,e){return ft(t,e)-ft(n,e)})),yt("<",4,2,(function(t,n,e){return dt((function(t,n){return t<n}),t,n,e)})),yt(">",4,2,(function(t,n,e){return dt((function(t,n){return t>n}),t,n,e)})),yt("<=",4,2,(function(t,n,e){return dt((function(t,n){return t<=n}),t,n,e)})),yt(">=",4,2,(function(t,n,e){return dt((function(t,n){return t>=n}),t,n,e)}));var wt=yt("=",3,2,(function(t,n,e){return dt((function(t,n){return t==n}),t,n,e,!0)}));function bt(t,n,e){this.a=t,this.b=n||1,this.f=e||1}function mt(t,n){if(n.a.length&&4!=t.i)throw Error("Primary expression must evaluate to nodeset if filter has predicate(s).");at.call(this,t.i),this.c=t,this.h=n,this.g=t.g,this.b=t.b}function Et(t,n){if(n.length<t.A)throw Error("Function "+t.j+" expects at least"+t.A+" arguments, "+n.length+" given");if(null!==t.v&&n.length>t.v)throw Error("Function "+t.j+" expects at most "+t.v+" arguments, "+n.length+" given");t.B&&l(n,(function(n,e){if(4!=n.i)throw Error("Argument "+e+" to function "+t.j+" is not of type Nodeset: "+n)})),at.call(this,t.i),this.h=t,this.c=n,st(this,t.g||d(n,(function(t){return t.g}))),ct(this,t.D&&!n.length||t.C&&!!n.length||d(n,(function(t){return t.b})))}function Nt(t,n,e,r,o,i,a,u,s){this.j=t,this.i=n,this.g=e,this.D=r,this.C=o,this.m=i,this.A=a,this.v=void 0!==u?u:a,this.B=!!s}yt("!=",3,2,(function(t,n,e){return dt((function(t,n){return t!=n}),t,n,e,!0)})),yt("and",2,2,(function(t,n,e){return ht(t,e)&&ht(n,e)})),yt("or",1,2,(function(t,n,e){return ht(t,e)||ht(n,e)})),i(mt),mt.prototype.a=function(t){return t=this.c.a(t),Vt(this.h,t)},mt.prototype.toString=function(){return"Filter:"+ut(this.c)+ut(this.h)},i(Et),Et.prototype.a=function(t){return this.h.m.apply(null,function(t){return Array.prototype.concat.apply(Array.prototype,arguments)}(t,this.c))},Et.prototype.toString=function(){var t="Function: "+this.h;if(this.c.length){var n=p(this.c,(function(t,n){return t+ut(n)}),"Arguments:");t+=ut(n)}return t},Nt.prototype.toString=function(){return this.j};var xt={};function St(t,n,e,r,o,i,a,u){if(xt.hasOwnProperty(t))throw Error("Function already created: "+t+".");xt[t]=new Nt(t,n,e,r,!1,o,i,a,u)}function Tt(t,n){switch(this.h=t,this.c=void 0!==n?n:null,this.b=null,t){case"comment":this.b=8;break;case"text":this.b=3;break;case"processing-instruction":this.b=7;break;case"node":break;default:throw Error("Unexpected argument")}}function At(t){return"comment"==t||"text"==t||"processing-instruction"==t||"node"==t}function It(t){this.b=t,this.a=0}St("boolean",2,!1,!1,(function(t,n){return ht(n,t)}),1),St("ceiling",1,!1,!1,(function(t,n){return Math.ceil(ft(n,t))}),1),St("concat",3,!1,!1,(function(t,n){return p(g(arguments,1),(function(n,e){return n+lt(e,t)}),"")}),2,null),St("contains",2,!1,!1,(function(t,n,e){return u(lt(n,t),lt(e,t))}),2),St("count",1,!1,!1,(function(t,n){return n.a(t).l}),1,1,!0),St("false",2,!1,!1,(function(){return!1}),0),St("floor",1,!1,!1,(function(t,n){return Math.floor(ft(n,t))}),1),St("id",4,!1,!1,(function(t,e){var r=9==(o=t.a).nodeType?o:o.ownerDocument,o=lt(e,t).split(/\s+/),i=[];l(o,(function(t){!(t=function(t){if(C){var e=r.all[t];if(e){if(e.nodeType&&t==e.id)return e;if(e.length)return function(t,e){var r;t:{r=t.length;for(var o=n(t)?t.split(""):t,i=0;i<r;i++)if(i in o&&e.call(void 0,o[i],i,t)){r=i;break t}r=-1}return 0>r?null:n(t)?t.charAt(r):t[r]}(e,(function(n){return t==n.id}))}return null}return r.getElementById(t)}(t))||0<=f(i,t)||i.push(t)})),i.sort(K);var a=new q;return l(i,(function(t){tt(a,t)})),a}),1),St("lang",2,!1,!1,(function(){return!1}),1),St("last",1,!0,!1,(function(t){if(1!=arguments.length)throw Error("Function last expects ()");return t.f}),0),St("local-name",3,!1,!0,(function(t,n){var e=n?nt(n.a(t)):t.a;return e?e.localName||e.nodeName.toLowerCase():""}),0,1,!0),St("name",3,!1,!0,(function(t,n){var e=n?nt(n.a(t)):t.a;return e?e.nodeName.toLowerCase():""}),0,1,!0),St("namespace-uri",3,!0,!1,(function(){return""}),0,1,!0),St("normalize-space",3,!1,!0,(function(t,n){return(n?lt(n,t):B(t.a)).replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")}),0,1),St("not",2,!1,!1,(function(t,n){return!ht(n,t)}),1),St("number",1,!1,!0,(function(t,n){return n?ft(n,t):+B(t.a)}),0,1),St("position",1,!0,!1,(function(t){return t.b}),0),St("round",1,!1,!1,(function(t,n){return Math.round(ft(n,t))}),1),St("starts-with",2,!1,!1,(function(t,n,e){return n=lt(n,t),t=lt(e,t),0==n.lastIndexOf(t,0)}),2),St("string",3,!1,!0,(function(t,n){return n?lt(n,t):B(t.a)}),0,1),St("string-length",1,!1,!0,(function(t,n){return(n?lt(n,t):B(t.a)).length}),0,1),St("substring",3,!1,!1,(function(t,n,e,r){if(e=ft(e,t),isNaN(e)||1/0==e||-1/0==e)return"";if(r=r?ft(r,t):1/0,isNaN(r)||-1/0===r)return"";e=Math.round(e)-1;var o=Math.max(e,0);return t=lt(n,t),1/0==r?t.substring(o):t.substring(o,e+Math.round(r))}),2,3),St("substring-after",3,!1,!1,(function(t,n,e){return n=lt(n,t),t=lt(e,t),-1==(e=n.indexOf(t))?"":n.substring(e+t.length)}),2),St("substring-before",3,!1,!1,(function(t,n,e){return n=lt(n,t),t=lt(e,t),-1==(t=n.indexOf(t))?"":n.substring(0,t)}),2),St("sum",1,!1,!1,(function(t,n){for(var e=rt(n.a(t)),r=0,o=it(e);o;o=it(e))r+=+B(o);return r}),1,1,!0),St("translate",3,!1,!1,(function(t,n,e,r){n=lt(n,t),e=lt(e,t);var o=lt(r,t);for(t={},r=0;r<e.length;r++){var i=e.charAt(r);i in t||(t[i]=o.charAt(r))}for(e="",r=0;r<n.length;r++)e+=(i=n.charAt(r))in t?t[i]:i;return e}),3),St("true",2,!1,!1,(function(){return!0}),0),Tt.prototype.a=function(t){return null===this.b||this.b==t.nodeType},Tt.prototype.f=function(){return this.h},Tt.prototype.toString=function(){var t="Kind Test: "+this.h;return null===this.c||(t+=ut(this.c)),t};var Ot=/\$?(?:(?![0-9-\.])(?:\*|[\w-\.]+):)?(?![0-9-\.])(?:\*|[\w-\.]+)|\/\/|\.\.|::|\d+(?:\.\d*)?|\.\d+|"[^"]*"|'[^']*'|[!<>]=|\s+|./g,kt=/^\s/;function Dt(t,n){return t.b[t.a+(n||0)]}function Pt(t){return t.b[t.a++]}function Rt(t){return t.b.length<=t.a}function Ct(t){at.call(this,3),this.c=t.substring(1,t.length-1)}function _t(t,n){var e;this.j=t.toLowerCase(),e="*"==this.j?"*":"http://www.w3.org/1999/xhtml",this.c=n?n.toLowerCase():e}function jt(t,n){if(at.call(this,t.i),this.h=t,this.c=n,this.g=t.g,this.b=t.b,1==this.c.length){var e=this.c[0];e.u||e.c!=Gt||"*"!=(e=e.o).f()&&(this.f={name:e.f(),s:null})}}function Mt(){at.call(this,4)}function Bt(){at.call(this,4)}function Ut(t){return"/"==t||"//"==t}function Lt(t){at.call(this,4),this.c=t,st(this,d(this.c,(function(t){return t.g}))),ct(this,d(this.c,(function(t){return t.b})))}function Ft(t,n){this.a=t,this.b=!!n}function Vt(t,n,e){for(e=e||0;e<t.a.length;e++)for(var r,o=t.a[e],i=rt(n),a=n.l,u=0;r=it(i);u++){var s=t.b?a-u:u+1;if("number"==typeof(r=o.a(new bt(r,s,a))))s=s==r;else if("string"==typeof r||"boolean"==typeof r)s=!!r;else{if(!(r instanceof q))throw Error("Predicate.evaluate returned an unexpected type.");s=0<r.l}if(!s){if(r=(s=i).f,!(f=s.a))throw Error("Next must be called at least once before remove.");var c=f.b,f=f.a;c?c.a=f:r.a=f,f?f.b=c:r.b=c,r.l--,s.a=null}}return n}function Yt(t,n,e,r){at.call(this,4),this.c=t,this.o=n,this.h=e||new Ft([]),this.u=!!r,n=0<(n=this.h).a.length?n.a[0].f:null,t.b&&n&&(t=n.name,t=C?t.toLowerCase():t,this.f={name:t,s:n.s});t:{for(t=this.h,n=0;n<t.a.length;n++)if((e=t.a[n]).g||1==e.i||0==e.i){t=!0;break t}t=!1}this.g=t}function Ht(t,n,e,r){this.j=t,this.f=n,this.a=e,this.b=r}i(Ct),Ct.prototype.a=function(){return this.c},Ct.prototype.toString=function(){return"Literal: "+this.c},_t.prototype.a=function(t){var n=t.nodeType;return!(1!=n&&2!=n||(n=void 0!==t.localName?t.localName:t.nodeName,"*"!=this.j&&this.j!=n.toLowerCase()||"*"!=this.c&&this.c!=(t.namespaceURI?t.namespaceURI.toLowerCase():"http://www.w3.org/1999/xhtml")))},_t.prototype.f=function(){return this.j},_t.prototype.toString=function(){return"Name Test: "+("http://www.w3.org/1999/xhtml"==this.c?"":this.c+":")+this.j},i(jt),i(Mt),Mt.prototype.a=function(t){var n=new q;return 9==(t=t.a).nodeType?tt(n,t):tt(n,t.ownerDocument),n},Mt.prototype.toString=function(){return"Root Helper Expression"},i(Bt),Bt.prototype.a=function(t){var n=new q;return tt(n,t.a),n},Bt.prototype.toString=function(){return"Context Helper Expression"},jt.prototype.a=function(t){var n=this.h.a(t);if(!(n instanceof q))throw Error("Filter expression must evaluate to nodeset.");for(var e=0,r=(t=this.c).length;e<r&&n.l;e++){var o,i=t[e],a=rt(n,i.c.a);if(i.g||i.c!=zt)if(i.g||i.c!=Jt)for(o=it(a),n=i.a(new bt(o));null!=(o=it(a));)n=Q(n,o=i.a(new bt(o)));else o=it(a),n=i.a(new bt(o));else{for(o=it(a);(n=it(a))&&(!o.contains||o.contains(n))&&8&n.compareDocumentPosition(o);o=n);n=i.a(new bt(o))}}return n},jt.prototype.toString=function(){var t;if(t="Path Expression:"+ut(this.h),this.c.length){var n=p(this.c,(function(t,n){return t+ut(n)}),"Steps:");t+=ut(n)}return t},i(Lt),Lt.prototype.a=function(t){var n=new q;return l(this.c,(function(e){if(!((e=e.a(t))instanceof q))throw Error("Path expression must evaluate to NodeSet.");n=Q(n,e)})),n},Lt.prototype.toString=function(){return p(this.c,(function(t,n){return t+ut(n)}),"Union Expression:")},Ft.prototype.toString=function(){return p(this.a,(function(t,n){return t+ut(n)}),"Predicates:")},i(Yt),Yt.prototype.a=function(t){var n=t.a,e=null,r=null,o=null,i=0;if((e=this.f)&&(r=e.name,o=e.s?lt(e.s,t):null,i=1),this.u)if(this.g||this.c!=Kt)if(n=it(t=rt(new Yt(Wt,new Tt("node")).a(t))))for(e=this.m(n,r,o,i);null!=(n=it(t));)e=Q(e,this.m(n,r,o,i));else e=new q;else e=L(this.o,n,r,o),e=Vt(this.h,e,i);else e=this.m(t.a,r,o,i);return e},Yt.prototype.m=function(t,n,e,r){return t=this.c.f(this.o,t,n,e),Vt(this.h,t,r)},Yt.prototype.toString=function(){var t;if(t="Step:"+ut("Operator: "+(this.u?"//":"/")),this.c.j&&(t+=ut("Axis: "+this.c)),t+=ut(this.o),this.h.a.length){var n=p(this.h.a,(function(t,n){return t+ut(n)}),"Predicates:");t+=ut(n)}return t},Ht.prototype.toString=function(){return this.j};var Xt={};function $t(t,n,e,r){if(Xt.hasOwnProperty(t))throw Error("Axis already created: "+t);return n=new Ht(t,n,e,!!r),Xt[t]=n}$t("ancestor",(function(t,n){for(var e=new q,r=n;r=r.parentNode;)t.a(r)&&Z(e,r);return e}),!0),$t("ancestor-or-self",(function(t,n){var e=new q,r=n;do{t.a(r)&&Z(e,r)}while(r=r.parentNode);return e}),!0);var Gt=$t("attribute",(function(t,n){var e=new q;if("style"==(i=t.f())&&C&&n.style)return tt(e,new j(n.style,n,"style",n.style.cssText)),e;var r=n.attributes;if(r)if(t instanceof Tt&&null===t.b||"*"==i)for(var o,i=0;o=r[i];i++)C?o.nodeValue&&tt(e,M(n,o)):tt(e,o);else(o=r.getNamedItem(i))&&(C?o.nodeValue&&tt(e,M(n,o)):tt(e,o));return e}),!1),Kt=$t("child",(function(t,e,r,o,i){return(C?Y:H).call(null,t,e,n(r)?r:null,n(o)?o:null,i||new q)}),!1,!0);$t("descendant",L,!1,!0);var Wt=$t("descendant-or-self",(function(t,n,e,r){var o=new q;return U(n,e,r)&&t.a(n)&&tt(o,n),L(t,n,e,r,o)}),!1,!0),zt=$t("following",(function(t,n,e,r){var o=new q;do{for(var i=n;i=i.nextSibling;)U(i,e,r)&&t.a(i)&&tt(o,i),o=L(t,i,e,r,o)}while(n=n.parentNode);return o}),!1,!0);$t("following-sibling",(function(t,n){for(var e=new q,r=n;r=r.nextSibling;)t.a(r)&&tt(e,r);return e}),!1),$t("namespace",(function(){return new q}),!1);var qt=$t("parent",(function(t,n){var e=new q;if(9==n.nodeType)return e;if(2==n.nodeType)return tt(e,n.ownerElement),e;var r=n.parentNode;return t.a(r)&&tt(e,r),e}),!1),Jt=$t("preceding",(function(t,n,e,r){var o=new q,i=[];do{i.unshift(n)}while(n=n.parentNode);for(var a=1,u=i.length;a<u;a++){var s=[];for(n=i[a];n=n.previousSibling;)s.unshift(n);for(var c=0,f=s.length;c<f;c++)U(n=s[c],e,r)&&t.a(n)&&tt(o,n),o=L(t,n,e,r,o)}return o}),!0,!0);$t("preceding-sibling",(function(t,n){for(var e=new q,r=n;r=r.previousSibling;)t.a(r)&&Z(e,r);return e}),!0);var Qt=$t("self",(function(t,n){var e=new q;return t.a(n)&&tt(e,n),e}),!1);function Zt(t){at.call(this,1),this.c=t,this.g=t.g,this.b=t.b}function tn(t){at.call(this,1),this.c=t}function nn(t,n){this.a=t,this.b=n}function en(t){for(var n,e=[];;){rn(t,"Missing right hand side of binary expression."),n=ln(t);var r=Pt(t.a);if(!r)break;var o=(r=vt[r]||null)&&r.w;if(!o){t.a.a--;break}for(;e.length&&o<=e[e.length-1].w;)n=new pt(e.pop(),e.pop(),n);e.push(n,r)}for(;e.length;)n=new pt(e.pop(),e.pop(),n);return n}function rn(t,n){if(Rt(t.a))throw Error(n)}function on(t,n){var e=Pt(t.a);if(e!=n)throw Error("Bad token, expected: "+n+" got: "+e)}function an(t){if(")"!=(t=Pt(t.a)))throw Error("Bad token: "+t)}function un(t){if(2>(t=Pt(t.a)).length)throw Error("Unclosed literal string");return new Ct(t)}function sn(t){var n,e,r=[];if(Ut(Dt(t.a))){if(n=Pt(t.a),e=Dt(t.a),"/"==n&&(Rt(t.a)||"."!=e&&".."!=e&&"@"!=e&&"*"!=e&&!/(?![0-9])[\w]/.test(e)))return new Mt;e=new Mt,rn(t,"Missing next location step."),n=cn(t,n),r.push(n)}else{t:{switch(e=(n=Dt(t.a)).charAt(0)){case"$":throw Error("Variable reference not allowed in HTML XPath");case"(":Pt(t.a),n=en(t),rn(t,'unclosed "("'),on(t,")");break;case'"':case"'":n=un(t);break;default:if(isNaN(+n)){if(At(n)||!/(?![0-9])[\w]/.test(e)||"("!=Dt(t.a,1)){n=null;break t}for(n=Pt(t.a),n=xt[n]||null,Pt(t.a),e=[];")"!=Dt(t.a)&&(rn(t,"Missing function argument list."),e.push(en(t)),","==Dt(t.a));)Pt(t.a);rn(t,"Unclosed function argument list."),an(t),n=new Et(n,e)}else n=new tn(+Pt(t.a))}"["==Dt(t.a)&&(n=new mt(n,e=new Ft(fn(t))))}if(n){if(!Ut(Dt(t.a)))return n;e=n}else n=cn(t,"/"),e=new Bt,r.push(n)}for(;Ut(Dt(t.a));)n=Pt(t.a),rn(t,"Missing next location step."),n=cn(t,n),r.push(n);return new jt(e,r)}function cn(t,n){var e,r,o,i;if("/"!=n&&"//"!=n)throw Error('Step op should be "/" or "//"');if("."==Dt(t.a))return r=new Yt(Qt,new Tt("node")),Pt(t.a),r;if(".."==Dt(t.a))return r=new Yt(qt,new Tt("node")),Pt(t.a),r;if("@"==Dt(t.a))i=Gt,Pt(t.a),rn(t,"Missing attribute name");else if("::"==Dt(t.a,1)){if(!/(?![0-9])[\w]/.test(Dt(t.a).charAt(0)))throw Error("Bad token: "+Pt(t.a));if(e=Pt(t.a),!(i=Xt[e]||null))throw Error("No axis with name: "+e);Pt(t.a),rn(t,"Missing node name")}else i=Kt;if(e=Dt(t.a),!/(?![0-9])[\w\*]/.test(e.charAt(0)))throw Error("Bad token: "+Pt(t.a));if("("==Dt(t.a,1)){if(!At(e))throw Error("Invalid node type: "+e);if(!At(e=Pt(t.a)))throw Error("Invalid type name: "+e);on(t,"("),rn(t,"Bad nodetype");var a=null;'"'!=(o=Dt(t.a).charAt(0))&&"'"!=o||(a=un(t)),rn(t,"Bad nodetype"),an(t),e=new Tt(e,a)}else if(-1==(o=(e=Pt(t.a)).indexOf(":")))e=new _t(e);else{var u;if("*"==(a=e.substring(0,o)))u="*";else if(!(u=t.b(a)))throw Error("Namespace prefix not declared: "+a);e=new _t(e=e.substr(o+1),u)}return o=new Ft(fn(t),i.a),r||new Yt(i,e,o,"//"==n)}function fn(t){for(var n=[];"["==Dt(t.a);){Pt(t.a),rn(t,"Missing predicate expression.");var e=en(t);n.push(e),rn(t,"Unclosed predicate expression."),on(t,"]")}return n}function ln(t){if("-"==Dt(t.a))return Pt(t.a),new Zt(ln(t));var n=sn(t);if("|"!=Dt(t.a))t=n;else{for(n=[n];"|"==Pt(t.a);)rn(t,"Missing next union location path."),n.push(sn(t));t.a.a--,t=new Lt(n)}return t}function hn(t){switch(t.nodeType){case 1:return function(t,n){var e=Array.prototype.slice.call(arguments,1);return function(){var n=e.slice();return n.push.apply(n,arguments),t.apply(this,n)}}(dn,t);case 9:return hn(t.documentElement);case 11:case 10:case 6:case 12:return pn;default:return t.parentNode?hn(t.parentNode):pn}}function pn(){return null}function dn(t,n){if(t.prefix==n)return t.namespaceURI||"http://www.w3.org/1999/xhtml";var e=t.getAttributeNode("xmlns:"+n);return e&&e.specified?e.value||null:t.parentNode&&9!=t.parentNode.nodeType?dn(t.parentNode,n):null}function gn(t,n){if(!t.length)throw Error("Empty XPath expression.");var e=function(t){t=t.match(Ot);for(var n=0;n<t.length;n++)kt.test(t[n])&&t.splice(n,1);return new It(t)}(t);if(Rt(e))throw Error("Invalid XPath expression.");n?"function"==function(t){var n=typeof t;if("object"==n){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return n;var e=Object.prototype.toString.call(t);if("[object Window]"==e)return"object";if("[object Array]"==e||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==e||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==n&&void 0===t.call)return"object";return n}(n)||(n=o(n.lookupNamespaceURI,n)):n=function(){return null};var r=en(new nn(e,n));if(!Rt(e))throw Error("Bad token: "+Pt(e));this.evaluate=function(t,n){return new vn(r.a(new bt(t)),n)}}function vn(t,n){if(0==n)if(t instanceof q)n=4;else if("string"==typeof t)n=2;else if("number"==typeof t)n=1;else{if("boolean"!=typeof t)throw Error("Unexpected evaluation result.");n=3}if(2!=n&&1!=n&&3!=n&&!(t instanceof q))throw Error("value could not be converted to the specified type");var e;switch(this.resultType=n,n){case 2:this.stringValue=t instanceof q?et(t):""+t;break;case 1:this.numberValue=t instanceof q?+et(t):+t;break;case 3:this.booleanValue=t instanceof q?0<t.l:!!t;break;case 4:case 5:case 6:case 7:var r=rt(t);e=[];for(var o=it(r);o;o=it(r))e.push(o instanceof j?o.a:o);this.snapshotLength=t.l,this.invalidIteratorState=!1;break;case 8:case 9:r=nt(t),this.singleNodeValue=r instanceof j?r.a:r;break;default:throw Error("Unknown XPathResult type.")}var i=0;this.iterateNext=function(){if(4!=n&&5!=n)throw Error("iterateNext called with wrong result type");return i>=e.length?null:e[i++]},this.snapshotItem=function(t){if(6!=n&&7!=n)throw Error("snapshotItem called with wrong result type");return t>=e.length||0>t?null:e[t]}}function yn(t){this.lookupNamespaceURI=hn(t)}function wn(n,e){var r=n||t,o=r.Document&&r.Document.prototype||r.document;o.evaluate&&!e||(r.XPathResult=vn,o.evaluate=function(t,n,e,r){return new gn(t,e).evaluate(n,r)},o.createExpression=function(t,n){return new gn(t,n)},o.createNSResolver=function(t){return new yn(t)})}i(Zt),Zt.prototype.a=function(t){return-ft(this.c,t)},Zt.prototype.toString=function(){return"Unary Expression: -"+ut(this.c)},i(tn),tn.prototype.a=function(){return this.c},tn.prototype.toString=function(){return"Number: "+this.c},vn.ANY_TYPE=0,vn.NUMBER_TYPE=1,vn.STRING_TYPE=2,vn.BOOLEAN_TYPE=3,vn.UNORDERED_NODE_ITERATOR_TYPE=4,vn.ORDERED_NODE_ITERATOR_TYPE=5,vn.UNORDERED_NODE_SNAPSHOT_TYPE=6,vn.ORDERED_NODE_SNAPSHOT_TYPE=7,vn.ANY_UNORDERED_NODE_TYPE=8,vn.FIRST_ORDERED_NODE_TYPE=9;var bn,mn=["wgxpath","install"],En=t;mn[0]in En||!En.execScript||En.execScript("var "+mn[0]);for(;mn.length&&(bn=mn.shift());)mn.length||void 0===wn?En=En[bn]?En[bn]:En[bn]={}:En[bn]=wn}).call(this);