diff --git a/dist/regulex.js b/dist/regulex.js index e3bfe01..1d03608 100644 --- a/dist/regulex.js +++ b/dist/regulex.js @@ -59,8 +59,8 @@ // │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\ // └─────────────────────────────────────────────────────────────────────┘ \\ -var requirejs,require,define;if(function(t){function e(t,e){return v.call(t,e)}function r(t,e){var r,n,i,a,s,o,c,h,u,l,f,p=e&&e.split("/"),d=g.map,x=d&&d["*"]||{};if(t&&"."===t.charAt(0))if(e){for(p=p.slice(0,p.length-1),t=t.split("/"),s=t.length-1,g.nodeIdCompat&&m.test(t[s])&&(t[s]=t[s].replace(m,"")),t=p.concat(t),u=0;u0&&(t.splice(u-1,2),u-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((p||x)&&d){for(r=t.split("/"),u=r.length;u>0;u-=1){if(n=r.slice(0,u).join("/"),p)for(l=p.length;l>0;l-=1)if((i=d[p.slice(0,l).join("/")])&&(i=i[n])){a=i,o=u;break}if(a)break;!c&&x&&x[n]&&(c=x[n],h=u)}!a&&c&&(a=c,o=h),a&&(r.splice(0,o,a),t=r.join("/"))}return t}function n(e,r){return function(){var n=y.call(arguments,0);return"string"!=typeof n[0]&&1===n.length&&n.push(null),u.apply(t,n.concat([e,r]))}}function i(t){return function(e){return r(e,t)}}function a(t){return function(e){p[t]=e}}function s(r){if(e(d,r)){var n=d[r];delete d[r],x[r]=!0,h.apply(t,n)}if(!e(p,r)&&!e(x,r))throw new Error("No "+r);return p[r]}function o(t){var e,r=t?t.indexOf("!"):-1;return r>-1&&(e=t.substring(0,r),t=t.substring(r+1,t.length)),[e,t]}function c(t){return function(){return g&&g.config&&g.config[t]||{}}}var h,u,l,f,p={},d={},g={},x={},v=Object.prototype.hasOwnProperty,y=[].slice,m=/\.js$/;l=function(t,e){var n,a=o(t),c=a[0];return t=a[1],c&&(c=r(c,e),n=s(c)),c?t=n&&n.normalize?n.normalize(t,i(e)):r(t,e):(t=r(t,e),a=o(t),c=a[0],t=a[1],c&&(n=s(c))),{f:c?c+"!"+t:t,n:t,pr:c,p:n}},f={require:function(t){return n(t)},exports:function(t){var e=p[t];return void 0!==e?e:p[t]={}},module:function(t){return{id:t,uri:"",exports:p[t],config:c(t)}}},h=function(r,i,o,c){var h,u,g,v,y,m,b=[],_=typeof o;if(c=c||r,"undefined"===_||"function"===_){for(i=!i.length&&o.length?["require","exports","module"]:i,y=0;y>1),(a=n(r,t[i]))===C)return i;a===E?c=i-1:s=i+1}while(s<=c);return-1}function n(t){var e=t.length;if(e<=1)return t;for(var r,n,a,s=1,o=e/3|0;s0;){for(r=s;r=s&&t[n]=h){c===h&&(u[h]=!0);break}var g=n(t.join("").split("")),x=Object.keys(u),v=g[0],y=Object.create(null),m=Object.create(null);for(e=0;ev)break;for(e=0,a=g.length-1;eh));r++)s[0]<=c&&h<=s[1]&&(y[s].push(v),x.push(v));if(c=g[e],h=g[e+1],u[h])for(r=0;rh));r++)s[0]<=h&&h<=s[1]&&y[s].push(h)}x=n(x);for(i in y)m[i[0]===i[1]?i[0]:i]=y[i];return{ranges:x,map:m}}function c(t){var e=String.fromCharCode(65535);t=o(t).ranges;var r=[];if(!t.length)return r;"\0"!==t[0][0]&&t.unshift(e);var n=t.length-1;return(t[n][1]||t[n][0])!==e&&t.push("\0"),t.reduce(function(t,e){var n=d(t[1]||t[0]),i=p(e[0]);return n1&&t.shift();return t.forEach(function(t){if("-"==e[0]&&e.length>1){if(e[1]>t)throw new Error("Charset range out of order:"+e[1]+"-"+t+"!");r.push(e[1]+t),e.splice(0,2)}else e.unshift(t)}),r=r.concat(e),n?c(r):o(r).ranges}function u(t){if(!t.length)return[];var e=[t[0]];return t.reduce(function(t,r){var n=e.length-1;return t[t.length-1]===p(r[0])?e[n]=e[n][0]+r[r.length-1]:(e.push(r),r)}),e.reduce(function(t,e){return 2===e.length&&e[0]===p(e[1])?(t.push(e[0]),t.push(e[1])):t.push(e),t},[])}function l(t){return String.fromCharCode(t)}function f(t){return t.charCodeAt(0)}function p(t){return String.fromCharCode(t.charCodeAt(0)-1)}function d(t){return String.fromCharCode(t.charCodeAt(0)+1)}function g(t,e){var r=/[\x00-\x1F\x7F-\x9F]/,n=/[\u009F-\uFFFF]/;return t=t.split("").map(function(t){return!e&&S.hasOwnProperty(t)?S[t]:n.test(t)?"\\u"+("00"+f(t).toString(16).toUpperCase()).slice(-4):r.test(t)?"\\x"+("0"+f(t).toString(16).toUpperCase()).slice(-2):t}).join("")}function x(t){return[].concat.apply([],t)}function v(t,e){return new Array(e+1).join(t)}function y(){var t=_.call(arguments);if(w)Function.prototype.apply.apply(console.log,[console,t]);else{var e=require("util");t.forEach(function(t){console.log(e.inspect(t,{showHidden:!1,customInspect:!0,depth:64,colors:!0}))})}}function m(t){for(var e,r=t.toString(),n=/^\s+function\s+([a-zA-Z]\w+)\s*\(/gm,i=[];e=n.exec(r);)i.push(e[1]);for(var t,a=[];t=i.pop();)a.push(t+":"+t);return"{\n"+a.join(",\n")+"\n}"}var b=Array.prototype,_=b.slice,w=function(){return"[object Window]"===this.toString()}(),E=-1,C=0,k=1,S={"\n":"\\n","\t":"\\t","\f":"\\f","\r":"\\r"," ":" ","\\":"\\\\","\0":"\\0"};return{sortUnique:n,idUnique:s,hashUnique:a,Set:t,repeats:v,negate:c,coalesce:u,classify:o,parseCharset:h,chr:l,ord:f,pred:p,succ:d,toPrint:g,flatten2:x,log:y,isBrowser:w,locals:m}}),"function"!=typeof define)var define=require("amdefine")(module);if(define("NFA",["./Kit"],function(t){function e(e){e=e.compact?c(e):e;var s,o={},h=e.trans,u={};for(s=0,n=e.accepts.length;s1)throw new Error("DFA Assertion Fail!\nFrom state `"+n[i]+"` can goto to multi ε-move states!");for(var s=e.charMove,o=Object.keys(s),c=0,h=o.length;c"+y.to),E===C-1){r+=f,o=y.to;continue t}if(b=i(e,r+f,y.to,c,h),b.acceptable)return b;p=b}if(p)return p;break}return{stack:c,lastIndex:h,lastState:o,acceptable:a.accept(o)}}r=r||0;var a=this;return i(e,r,"start",[],r-1)}function s(t,e){var r=t.indexOf(e,o);return!!~r&&t[r]}function o(t,e){var r=e[0];return t>e[1]?1:t"),n=r[0].split(","),i=r[1].split(","),a[s]={from:n,to:i,charset:e[1],action:e[2],assert:e[3]};return t.compact=!1,t}return e}),"function"!=typeof define)var define=require("amdefine")(module);if(define("parse",["./NFA","./Kit"],function(t,e){function r(){var t=Object.keys(p).map(function(t){return t+"="+JSON.stringify(p[t])}).join(";");(function(){return this})().eval(t)}function n(t){this.raw=t.raw,this.tree=t.tree,this.groupCount=t.groupCount}function i(t,e){d=e;var r,i,s,p=a();r=p.input(t,0,e),i=r.stack,i=v.endChoice(i),s=r.lastState;var g=r.acceptable&&r.lastIndex===t.length-1;if(!g){var x;switch(s){case"charsetRangeEndWithNullChar":x={type:"CharsetRangeEndWithNullChar",message:"Charset range end with NUL char does not make sense!\nBecause [a-\\0] is not a valid range.\nAnd [\\0-\\0] should be rewritten into [\\0]."};break;case"repeatErrorFinal":x={type:"NothingRepeat",message:"Nothing to repeat!"};break;case"digitFollowNullError":x={type:"DigitFollowNullError",message:"The '\\0' represents the char and cannot be followed by a decimal digit!"};break;case"charsetRangeEndClass":x={type:"CharsetRangeEndClass",message:'Charset range ends with class such as "\\w\\W\\d\\D\\s\\S" is invalid!'};break;case"charsetOctEscape":x={type:"DecimalEscape",message:"Decimal escape appears in charset is invalid.Because it can't be explained as backreference.And octal escape is deprecated!"};break;default:0===s.indexOf("charset")?x={type:"UnclosedCharset",message:"Unterminated character class!"}:")"===t[r.lastIndex]?x={type:"UnmatchedParen",message:"Unmatched end parenthesis!"}:(x={type:"UnexpectedChar",message:"Unexpected char!"},r.lastIndex++)}if(x)throw x.lastIndex=r.lastIndex,x.astStack=r.stack,x.lastState=s,new f(x)}if(i._parentGroup)throw new f({type:"UnterminatedGroup",message:"Unterminated group!",lastIndex:i._parentGroup.indices[0],lastState:s,astStack:i});if(g){var y=i.groupCounter?i.groupCounter.i:0;delete i.groupCounter,h(i,t,t.length),i=o(i);var m=new n({raw:t,groupCount:y,tree:i});return m.traverse(l,CHARSET_NODE),m.traverse(u,ASSERT_NODE),c(i),d=!1,m}}function a(){return g||(g=t(E,d)),g}function s(t,e,r){Object.defineProperty(t,e,{value:r,enumerable:d,writable:!0,configurable:!0})}function o(t){return t.filter(function(t){return t.type==EXACT_NODE&&t.concatTemp?(delete t.concatTemp,!!t.chars):(t.sub?t.sub=o(t.sub):t.branches&&(t.branches=t.branches.map(o)),!0)})}function c(t){function e(t){t.sub?c(t.sub):t.branches&&t.branches.map(c)}var r=t[0];e(r);for(var n,i=1,a=1,s=t.length;it[1])throw new f({type:"OutOfOrder",lastIndex:t.lastIndex,message:"Range ["+t.join("-")+"] out of order in character class!"});return t.join("")}))}function f(t){this.name="RegexSyntaxError",this.type=t.type,this.lastIndex=t.lastIndex,this.lastState=t.lastState,this.astStack=t.astStack,this.message=t.message,Object.defineProperty(this,"stack",{value:new Error(t.message).stack,enumerable:!1})}var p={EXACT_NODE:"exact",CHARSET_NODE:"charset",CHOICE_NODE:"choice",GROUP_NODE:"group",ASSERT_NODE:"assert",DOT_NODE:"dot",BACKREF_NODE:"backref",EMPTY_NODE:"empty",AssertLookahead:"AssertLookahead",AssertNegativeLookahead:"AssertNegativeLookahead",AssertNonWordBoundary:"AssertNonWordBoundary",AssertWordBoundary:"AssertWordBoundary",AssertEnd:"AssertEnd",AssertBegin:"AssertBegin"};r(),n.prototype.traverse=function(t,e){function r(t,n){t.forEach(function(t){e&&t.type!==e||n(t),t.sub?r(t.sub,n):t.branches&&t.branches.forEach(function(t){r(t,n)})})}r(this.tree,t)};var d;i.Constants=p,i.exportConstants=r,i.RegexSyntaxError=f,i.getNFAParser=a;var g;f.prototype.toString=function(){return this.name+" "+this.type+":"+this.message};var x={n:"\n",r:"\r",t:"\t",v:"\v",f:"\f"},v=function(){function t(t,e,r){var n=t[0];(!n||n.type!=EXACT_NODE||n.repeat||n.chars&&!n.concatTemp)&&t.unshift({type:EXACT_NODE,indices:[r]}),n&&n.concatTemp&&(n.chars+=e)}function e(t,e,r){t.unshift({type:DOT_NODE,indices:[r]})}function r(t,e,r){t.unshift({type:EXACT_NODE,chars:"\0",indices:[r-1]})}function n(t,e,r){t.unshift({type:ASSERT_NODE,indices:[r],assertionType:AssertBegin})}function i(t,e,r,n,i){t.unshift({type:ASSERT_NODE,indices:[r],assertionType:AssertEnd})}function a(t,e,r){t.unshift({type:ASSERT_NODE,indices:[r-1],assertionType:"b"==e?AssertWordBoundary:AssertNonWordBoundary})}function o(t,e,r){t[0].type!==EXACT_NODE&&t.unshift({type:EXACT_NODE,indices:[r]})}function c(t,e,r){s(t[0],"_commaIndex",r)}function h(t,e,r,n,i){var a,s=t[0],o=i.lastIndexOf("{",r),c=parseInt(i.slice(o+1,s._commaIndex||r),10);if(s._commaIndex){if((a=s._commaIndex+1==r?1/0:parseInt(i.slice(s._commaIndex+1,r),10))=o&&t.shift(),d(t,c,a,o,i)}function u(t,e,r,n,i){d(t,0,1/0,r,i)}function l(t,e,r,n,i){d(t,0,1,r,i)}function p(t,e,r,n,i){d(t,1,1/0,r,i)}function d(t,e,r,n,i){var a=t[0],o={min:e,max:r,nonGreedy:!1},c=n-1;if(a.chars&&1===a.chars.length&&(c=a.indices[0]),a.type===EXACT_NODE){var h={type:EXACT_NODE,repeat:o,chars:a.chars?a.chars:i[c],indices:[c]};a.indices[0]===c&&t.shift(),t.unshift(h)}else a.repeat=o;s(o,"beginIndex",n-t[0].indices[0])}function g(t){t[0].repeat.nonGreedy=!0}function v(t,e,r){t.unshift({concatTemp:!0,type:EXACT_NODE,chars:"",indices:[r]})}function y(t,e,r){x.hasOwnProperty(e)&&(e=x[e]),t.unshift({type:EXACT_NODE,chars:e,indices:[r-1]})}function m(t,e,r){t.unshift({type:CHARSET_NODE,indices:[r-1],chars:"",ranges:[],classes:[e],exclude:!1})}function b(t,e,r,n,i){e=String.fromCharCode(parseInt(i[r-1]+e,16)),t.shift(),t.unshift({type:EXACT_NODE,chars:e,indices:[r-3]})}function _(t,e,r,n,i){e=String.fromCharCode(parseInt(i.slice(r-3,r+1),16)),t.shift(),t.unshift({type:EXACT_NODE,chars:e,indices:[r-5]})}function w(t,e,r){var n=t.groupCounter=t.groupCounter||{i:0};n.i++;var i={type:GROUP_NODE,num:n.i,sub:[],indices:[r],_parentStack:t};return t=i.sub,s(t,"_parentGroup",i),t.groupCounter=n,t}function E(t){var e=t._parentGroup;e.nonCapture=!0,e.num=void 0,t.groupCounter.i--}function C(t,e,r){var n=t._parentGroup;n.type=ASSERT_NODE,n.assertionType="="==e?AssertLookahead:AssertNegativeLookahead,n.num=void 0,t.groupCounter.i--}function k(t,e,r,n,i){t=A(t);var a=t._parentGroup;if(!a)throw new f({type:"UnexpectedChar",lastIndex:r,lastState:n,astStack:t,message:"Unexpected end parenthesis!"});return delete t._parentGroup,delete t.groupCounter,t=a._parentStack,delete a._parentStack,t.unshift(a),a.endParenIndex=r,t}function S(t,e,r){var n,i=[];if(t._parentChoice)n=t._parentChoice,n.branches.unshift(i),s(i,"_parentChoice",n),s(i,"_parentGroup",n),i.groupCounter=t.groupCounter,delete t._parentChoice,delete t.groupCounter;else{var a=t[t.length-1];n={type:CHOICE_NODE,indices:[a?a.indices[0]:r-1],branches:[]},s(n,"_parentStack",t),n.branches.unshift(t.slice()),t.length=0,t.unshift(n),i.groupCounter=t.groupCounter,s(i,"_parentChoice",n),s(i,"_parentGroup",n),n.branches.unshift(i)}return i}function A(t){if(t._parentChoice){var e=t._parentChoice;delete t._parentChoice,delete t._parentGroup,delete t.groupCounter;var r=e._parentStack;return delete e._parentStack,r}return t}function B(t,e,r){t.unshift({type:CHARSET_NODE,indices:[r],classes:[],ranges:[],chars:""})}function N(t){t[0].exclude=!0}function O(t,e,r){t[0].chars+=e}function T(t,e,r){x.hasOwnProperty(e)&&(e=x[e]),t[0].chars+=e}function R(t,e,r){t[0].chars+="\0"}function I(t,e){t[0].classes.push(e)}function M(t,e,r,n,i){var a=t[0];e=String.fromCharCode(parseInt(a.chars.slice(-1)+e,16)),a.chars=a.chars.slice(0,-2),a.chars+=e}function F(t,e,r,n,i){var a=t[0];e=String.fromCharCode(parseInt(a.chars.slice(-3)+e,16)),a.chars=a.chars.slice(0,-4),a.chars+=e}function D(t,e,r,n,i){var a=t[0],s=a.chars.slice(-2);s=[s[0],e],s.lastIndex=r,a.ranges.push(s),a.chars=a.chars.slice(0,-2)}function P(t,e){x.hasOwnProperty(e)&&(e=x[e]),D.apply(this,arguments)}function L(t,e,r){var n=t[0],i=n.chars.slice(-3)+e;n.chars=n.chars.slice(0,-3);var a=n.ranges.pop();e=String.fromCharCode(parseInt(i,16)),a=[a[0],e],a.lastIndex=r,n.ranges.push(a)}function z(t,e,r){var n=t[0],i=n.chars.slice(-1)+e;n.chars=n.chars.slice(0,-1);var a=n.ranges.pop();e=String.fromCharCode(parseInt(i,16)),a=[a[0],e],a.lastIndex=r,n.ranges.push(a)}function j(t,e,r,n){function i(t,e){return!!e._parentGroup&&(e._parentGroup.num==t?t:i(t,e._parentGroup._parentStack))}var a=t[0],s=parseInt(e,10),o="escape"===n,c=t.groupCounter,h=c&&c.i||0;if(o?(a={type:BACKREF_NODE,indices:[r-1]},t.unshift(a)):s=parseInt(a.num+""+s,10),s>h)throw new f({type:"InvalidBackReference",lastIndex:r,astStack:t,lastState:n,message:"Back reference number("+s+") greater than current groups count("+h+")."});if(i(s,t))throw new f({type:"InvalidBackReference",lastIndex:r,astStack:t,lastState:n,message:"Recursive back reference in group ("+s+") itself."});a.num=s}return{escapeStart:v,exact:t,dot:e,nullChar:r,assertBegin:n,assertEnd:i,assertWordBoundary:a,repeatnStart:o,repeatnComma:c,repeatNonGreedy:g,repeatnEnd:h,repeat1:p,repeat01:l,repeat0:u,charClassEscape:m,normalEscape:y,unicodeEscape:_,hexEscape:b,charClassEscape:m,groupStart:w,groupNonCapture:E,backref:j,groupToAssertion:C,groupEnd:k,choice:S,endChoice:A,charsetStart:B,charsetExclude:N,charsetContent:O,charsetNullChar:R,charsetClassEscape:I,charsetHexEscape:M,charsetUnicodeEscape:F,charsetRangeEnd:D,charsetNormalEscape:T,charsetRangeEndNormalEscape:P,charsetRangeEndUnicodeEscape:L,charsetRangeEndHexEscape:z}}(),y="0-9a-fA-F",m="repeatnStart,repeatn_1,repeatn_2,repeatnErrorStart,repeatnError_1,repeatnError_2",b="hexEscape1,hexEscape2",_="unicodeEscape1,unicodeEscape2,unicodeEscape3,unicodeEscape4",w="charsetUnicodeEscape1,charsetUnicodeEscape2,charsetUnicodeEscape3,charsetUnicodeEscape4,charsetHexEscape1,charsetHexEscape2",E={compact:!0,accepts:"start,begin,end,repeat0,repeat1,exact,repeatn,repeat01,repeatNonGreedy,choice,"+m+",nullChar,digitBackref,"+_+","+b,trans:[["start,begin,end,exact,repeatNonGreedy,repeat0,repeat1,repeat01,groupStart,groupQualifiedStart,choice,repeatn>exact","^+*?^$.|(){[\\",v.exact],["hexEscape1,hexEscape2,unicodeEscape1,unicodeEscape2,unicodeEscape3,unicodeEscape4>exact","^+*?^$.|(){[\\0-9a-fA-F",v.exact],["nullChar>exact","^+*?^$.|(){[\\0-9",v.exact],[m+",nullChar,digitBackref,"+_+","+b+",start,begin,end,exact,repeatNonGreedy,repeat0,repeat1,repeat01,groupStart,groupQualifiedStart,choice,repeatn>exact",".",v.dot],["start,groupStart,groupQualifiedStart,end,begin,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,choice,"+m+",nullChar,digitBackref,"+_+","+b+">begin","^",v.assertBegin],[m+",nullChar,digitBackref,"+_+","+b+",exact>repeatnStart","{",v.repeatnStart],["start,begin,end,groupQualifiedStart,groupStart,repeat0,repeat1,repeatn,repeat01,repeatNonGreedy,choice>repeatnErrorStart","{",v.exact],["repeatnStart>repeatn_1","0-9",v.exact],["repeatn_1>repeatn_1","0-9",v.exact],["repeatn_1>repeatn_2",",",v.repeatnComma],["repeatn_2>repeatn_2","0-9",v.exact],["repeatn_1,repeatn_2>repeatn","}",v.repeatnEnd],["repeatnStart,repeatnErrorStart>exact","}",v.exact],["repeatnStart,repeatnErrorStart>exact","^+*?^$.|(){[\\0-9}",v.exact],["repeatnErrorStart>repeatnError_1","0-9",v.exact],["repeatnError_1>repeatnError_1","0-9",v.exact],["repeatnError_1>repeatnError_2",",",v.exact],["repeatnError_2>repeatnError_2","0-9",v.exact],["repeatnError_2,repeatnError_1>repeatErrorFinal","}"],["repeatn_1,repeatnError_1>exact","^+*?^$.|(){[\\0-9,}",v.exact],["repeatn_2,repeatnError_2>exact","^+*?^$.|(){[\\0-9}",v.exact],["exact,"+m+",nullChar,digitBackref,"+_+","+b+">repeat0","*",v.repeat0],["exact,"+m+",nullChar,digitBackref,"+_+","+b+">repeat1","+",v.repeat1],["exact,"+m+",nullChar,digitBackref,"+_+","+b+">repeat01","?",v.repeat01],["choice>repeatErrorFinal","*+?"],["repeat0,repeat1,repeat01,repeatn>repeatNonGreedy","?",v.repeatNonGreedy],["repeat0,repeat1,repeat01,repeatn>repeatErrorFinal","+*"],["start,begin,end,groupStart,groupQualifiedStart,exact,repeatNonGreedy,repeat0,repeat1,repeat01,repeatn,choice,"+m+",nullChar,digitBackref,"+_+","+b+">escape","\\",v.escapeStart],["escape>nullChar","0",v.nullChar],["nullChar>digitFollowNullError","0-9"],["escape>exact","^dDwWsSux0-9bB1-9",v.normalEscape],["escape>exact","bB",v.assertWordBoundary],["escape>exact","dDwWsS",v.charClassEscape],["escape>unicodeEscape1","u",v.exact],["unicodeEscape1>unicodeEscape2",y,v.exact],["unicodeEscape2>unicodeEscape3",y,v.exact],["unicodeEscape3>unicodeEscape4",y,v.exact],["unicodeEscape4>exact",y,v.unicodeEscape],["escape>hexEscape1","x",v.exact],["hexEscape1>hexEscape2",y,v.exact],["hexEscape2>exact",y,v.hexEscape],["escape>digitBackref","1-9",v.backref],["digitBackref>digitBackref","0-9",v.backref],["digitBackref>exact","^+*?^$.|(){[\\0-9",v.exact],["exact,begin,end,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,start,groupStart,groupQualifiedStart,choice,"+m+",nullChar,digitBackref,"+_+","+b+">groupStart","(",v.groupStart],["groupStart>groupQualify","?"],["groupQualify>groupQualifiedStart",":",v.groupNonCapture],["groupQualify>groupQualifiedStart","=",v.groupToAssertion],["groupQualify>groupQualifiedStart","!",v.groupToAssertion],[m+",nullChar,digitBackref,"+_+","+b+",groupStart,groupQualifiedStart,begin,end,exact,repeat1,repeat0,repeat01,repeatn,repeatNonGreedy,choice>exact",")",v.groupEnd],["start,begin,end,groupStart,groupQualifiedStart,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,choice,"+m+",nullChar,digitBackref,"+_+","+b+">choice","|",v.choice],["start,groupStart,groupQualifiedStart,begin,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,choice,"+m+",nullChar,digitBackref,"+_+","+b+">end","$",v.assertEnd],["exact,begin,end,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,groupQualifiedStart,groupStart,start,choice,"+m+",nullChar,digitBackref,"+_+","+b+">charsetStart","[",v.charsetStart],["charsetStart>charsetExclude","^",v.charsetExclude],["charsetStart>charsetContent","^\\]^",v.charsetContent],["charsetExclude>charsetContent","^\\]",v.charsetContent],["charsetContent,charsetClass>charsetContent","^\\]-",v.charsetContent],["charsetClass>charsetContent","-",v.charsetContent],[w+",charsetStart,charsetContent,charsetNullChar,charsetClass,charsetExclude,charsetRangeEnd>charsetEscape","\\"],["charsetEscape>charsetContent","^dDwWsSux0-9",v.charsetNormalEscape],["charsetEscape>charsetNullChar","0",v.charsetNullChar],["charsetEscape>charsetOctEscape","1-9"],["charsetRangeEndEscape>charsetOctEscape","1-9"],["charsetNullChar>digitFollowNullError","0-9"],["charsetNullChar>charsetContent","^0-9\\]-",v.charsetContent],["charsetEscape>charsetClass","dDwWsS",v.charsetClassEscape],["charsetEscape>charsetUnicodeEscape1","u",v.charsetContent],["charsetUnicodeEscape1>charsetUnicodeEscape2",y,v.charsetContent],["charsetUnicodeEscape2>charsetUnicodeEscape3",y,v.charsetContent],["charsetUnicodeEscape3>charsetUnicodeEscape4",y,v.charsetContent],["charsetUnicodeEscape4>charsetContent",y,v.charsetUnicodeEscape],["charsetEscape>charsetHexEscape1","x",v.charsetContent],["charsetHexEscape1>charsetHexEscape2",y,v.charsetContent],["charsetHexEscape2>charsetContent",y,v.charsetHexEscape],[w+">charsetContent","^\\]0-9a-fA-F-",v.charsetContent],[w+",charsetNullChar,charsetContent>charsetRangeStart","-",v.charsetContent],["charsetRangeStart>charsetRangeEnd","^\\]",v.charsetRangeEnd],["charsetRangeEnd>charsetContent","^\\]",v.charsetContent],["charsetRangeStart>charsetRangeEndEscape","\\"],["charsetRangeEndEscape>charsetRangeEnd","^dDwWsSux0-9bB1-9",v.charsetRangeEndNormalEscape],["charsetRangeEndEscape>charsetRangeEndWithNullChar","0"],["charsetRangeEndEscape>charsetRangeEndUnicodeEscape1","u",v.charsetRangeEnd],["charsetRangeEndUnicodeEscape1>charsetRangeEndUnicodeEscape2",y,v.charsetContent],["charsetRangeEndUnicodeEscape2>charsetRangeEndUnicodeEscape3",y,v.charsetContent],["charsetRangeEndUnicodeEscape3>charsetRangeEndUnicodeEscape4",y,v.charsetContent],["charsetRangeEndUnicodeEscape4>charsetRangeEnd",y,v.charsetRangeEndUnicodeEscape],["charsetRangeEndEscape>charsetRangeEndHexEscape1","x",v.charsetRangeEnd],["charsetRangeEndHexEscape1>charsetRangeEndHexEscape2",y,v.charsetContent],["charsetRangeEndHexEscape2>charsetRangeEnd",y,v.charsetRangeEndHexEscape],["charsetRangeEndEscape>charsetRangeEndClass","dDwWsS"],["charsetRangeEndUnicodeEscape1,charsetRangeEndHexEscape1>charsetContent","^\\]0-9a-fA-F",v.charsetContent],["charsetRangeEndUnicodeEscape2,charsetRangeEndUnicodeEscape3,charsetRangeEndUnicodeEscape4,charsetRangeEndHexEscape2>charsetRangeStart","-",v.charsetContent],[w+",charsetRangeEndUnicodeEscape1,charsetRangeEndHexEscape1,charsetRangeEndUnicodeEscape2,charsetRangeEndUnicodeEscape3,charsetRangeEndUnicodeEscape4,charsetRangeEndHexEscape2,charsetNullChar,charsetRangeStart,charsetContent,charsetClass,charsetExclude,charsetRangeEnd>exact","]"]]};return i}),"function"!=typeof define)var define=require("amdefine")(module);if(define("RegExp",["./parse","./Kit","./NFA"],function(t,e,r){function n(e,r){if(!(this instanceof n))return new n(e,r);e+="";var o={};"string"==typeof r?(r=r.toLowerCase(),~r.indexOf("i")&&(o.ignoreCase=!0),~r.indexOf("m")&&(o.multiline=!0),~r.indexOf("g")&&(o.global=!0),~r.indexOf("d")&&(o.debug=!0)):o=r;var c=this.ast=t(e);this.source=e,this.multiline=!!o.multiline,this.global=!!o.global,this.ignoreCase=!!o.ignoreCase,this.debug=!!o.debug,this.flags="",this.multiline&&(this.flags+="m"),this.ignoreCase&&(this.flags+="i"),this.global&&(this.flags+="g"),p(this,["source","options","multiline","global","ignoreCase","flags","debug"]);var h=this.ignoreCase;c.traverse(function(t){s(t,h)},CHARSET_NODE),c.traverse(function(t){i(t,h)},EXACT_NODE),this.multiline&&c.traverse(a,ASSERT_NODE)}function i(t,e){var r;r=t.chars.split(""),r=e?r.map(function(t){return/[a-z]/.test(t)?[t,t.toUpperCase()]:/[A-Z]/.test(t)?[t,t.toLowerCase()]:[t]}):r.map(function(t){return[t]}),t.explained=r}function a(t){var e=t.assertionType;e!==AssertBegin&&e!==AssertEnd||(t.multiline=!0)}function s(t,r){var n=t.chars.split("");n=n.concat(e.flatten2(t.classes.map(function(t){return g[t]}))),n=n.concat(t.ranges),r&&(n=o(n)),n=e.classify(n).ranges,t.exclude&&(n=e.negate(n)),n=e.coalesce(n),t.explained=n}function o(t){return e.flatten2(t.map(function(t){var r=e.classify([t,"az","AZ"]).map[t];return e.flatten2(r.map(function(t){return/[a-z]/.test(t)?[t,t.toUpperCase()]:/[A-Z]/.test(t)?[t,t.toLowerCase()]:[t]}))}))}function c(t,e){var r,n=[];return e=e||["start"],r=t.reduce(function(t,e){var r=h(e,t);return n=n.concat(r.trans),r.accepts},e),{accepts:r,trans:n}}function h(t,e){return t.repeat?f(t,e):m[t.type](t,e)}function u(t,e,r){for(var n,i,a,s=0,o=t.length;so;c--)r=i(t,e),h=h.concat(r.trans),e=r.accepts,u=u.concat(r.accepts);else{var f=e.slice();r=i(t,e),h=h.concat(r.trans),u=u.concat(r.accepts),h.push({from:r.accepts,to:f,charset:!1})}var p=[l()];return s.nonGreedy?(a.push({from:u,to:p,charset:!1}),a=a.concat(h)):(a=a.concat(h),a.push({from:u,to:p,charset:!1})),{accepts:p,trans:a}}function p(t,e){e.forEach(function(e){Object.defineProperty(t,e,{writable:!1,enumerable:!0})})}t.exportConstants(),n.DEBUG=n.D=1,n.MULTILINE=n.M=2,n.GLOBAL=n.G=4,n.IGNORECASE=n.I=8,n.prototype={toString:function(){return"/"+this.source+"/"+this.flags},test:function(t){return null!==this.exec(t)},exec:function(t){for(var e,r=this.getNFA(),n=this.global?this.lastIndex||0:0,i=t.length;n1?Math.max.apply(Math,o.map(function(t){return t.length})):n.length,a*=s.width;return{label:{type:"text",x:t,y:e-c/2-4,text:n,"font-size":b,"font-family":E,fill:i||"#444"},x:t-a/2,y:e-c-4,width:a,height:c+4}}function u(t,e,r){return{type:"path",x:t,y:e,path:["M",t,e,"H",r],"stroke-linecap":"butt","stroke-linejoin":"round",stroke:"#333","stroke-width":2,_translate:function(t,e){var r=this.path;r[1]+=t,r[2]+=e,r[4]+=t}}}function l(t,e,r,n){var i,a,s=t>r?-1:1,o=e>n?-1:1;return Math.abs(e-n)<15?(i=["M",t,e,"C",t+Math.min(Math.abs(r-t)/2,10)*s,e,r-(r-t)/2,n,r,n],a=function(t,e){var r=this.path;r[1]+=t,r[2]+=e,r[4]+=t,r[5]+=e,r[6]+=t,r[7]+=e,r[8]+=t,r[9]+=e}):(i=["M",t,e,"Q",t+10*s,e,t+10*s,e+10*o,"V",Math.abs(e-n)<20?e+10*o:n-10*o,"Q",t+10*s,n,t+10*s*2,n,"H",r],a=function(t,e){var r=this.path;r[1]+=t,r[2]+=e,r[4]+=t,r[5]+=e,r[6]+=t,r[7]+=e,r[9]+=e,r[11]+=t,r[12]+=e,r[13]+=t,r[14]+=e,r[16]+=t}),{type:"path",path:i,"stroke-linecap":"butt","stroke-linejoin":"round",stroke:"#333","stroke-width":2,_translate:a}}function f(t,e,r){return{items:[{type:"circle",fill:r,cx:t+10,cy:e,r:10,stroke:"none",_translate:function(t,e){this.cx+=t,this.cy+=e}}],width:20,height:20,x:t,y:e,lineInX:t,lineOutX:t+20}}function p(t){if(Array.isArray(t)){for(var e=t,r=0;r1?" to ":" or ")+n(a.max):o+=" or more times");var d=10,g=0,x=10,v=u.y+u.height-r,y=20+u.width;l=y;var m;1!==a.max?(v+=10,f+=10,m={type:"path",path:["M",u.x+10,r,"Q",e,r,e,r+x,"V",r+v-x,"Q",e,r+v,e+x,r+v,"H",e+y-x,"Q",e+y,r+v,e+y,r+v-x,"V",r+x,"Q",e+y,r,u.x+u.width+10,r],_translate:i,stroke:"maroon","stroke-width":2},a.nonGreedy&&(m.stroke="Brown",m["stroke-dasharray"]="-"),c.push(m)):o=!1;var b;if(0===a.min){var _=r-u.y+10,w=y+20;d+=10,g=-12,l=w,f+=10,b={type:"path",path:["M",e,r,"Q",e+x,r,e+x,r-x,"V",r-_+x,"Q",e+x,r-_,e+20,r-_,"H",e+w-20,"Q",e+w-x,r-_,e+w-x,r-_+x,"V",r-x,"Q",e+w-x,r,e+w,r],_translate:i,stroke:a.nonGreedy?"darkgreen":"#333","stroke-width":2},m&&s([m],10,0),c.push(b)}if(o){var E=h(e+l/2,r,o);s([E.label],0,v+E.height+4),c.push(E.label),f+=4+E.height;var C=(Math.max(E.width,l)-l)/2;C&&s(c,C,0),l=Math.max(E.width,l),d+=C}return s(u.items,d,0),c=c.concat(u.items),{items:c,width:l,height:f,x:e,y:u.y+g,lineInX:u.lineInX+d,lineOutX:u.lineOutX+d}},choice:function(t,e,r){if(p(t))return A.empty(null,e,r);var n=0,i=0,a=t.branches.map(function(t){var a=o(t,e,r);return n+=a.height,i=Math.max(i,a.width),a});n+=6*(a.length-1)+8,i+=40;var c=e+i/2,h=r-n/2+4,f=e+i,d=[];return a.forEach(function(t){var n=c-t.width/2;s(t.items,n-t.x,h-t.y),d=d.concat(t.items);var a=r+h-t.y,o=l(e,r,e+20,a),p=l(f,r,e+i-20,a);d.push(o,p),e+20!==n-t.x+t.lineInX&&d.push(u(e+20,a,n-t.x+t.lineInX)),t.lineOutX+n-t.x!=e+i-20&&d.push(u(t.lineOutX+n-t.x,a,e+i-20)),t.x=n,t.y=h,h+=t.height+6}),{items:d,width:i,height:n,x:e,y:r-n/2,lineInX:e,lineOutX:f}},charset:function(t,e,r){var n={d:"Digit",D:"NonDigit",w:"Word",W:"NonWord",s:"WhiteSpace",S:"NonWhiteSpace"},i=t.exclude?"Pink":"Khaki",a=t.exclude?"#C00":"";if(v(t)){var o=c(n[t.classes[0]],e,r,"Green","white");if(o.rect.r=5,t.exclude){var u=h(o.x+o.width/2,o.y,"None of:",a),l=o.items;l.push(u.label);var f=o.width,p=Math.max(u.width,o.width),d=(p-f)/2;return s(l,d,0),{items:l,width:p,height:o.height+u.height,x:Math.min(u.x,o.x),y:u.y,lineInX:d+o.x,lineOutX:d+o.x+o.width}}return o}if(!t.chars&&!t.ranges.length&&!t.classes.length){var o=c("AnyChar",e,r,"green","white");return o.rect.r=5,o}var g,x,y=[],p=0,m=0;t.chars&&(g=c(t.chars,e,r,"LightSkyBlue","black"),g.rect.r=5,y.push(g),p=g.width),t.ranges.forEach(function(t){t=t.split("").join("-");var n=c(t,e,r,"teal","white");n.rect.r=5,y.push(n),p=Math.max(n.width,p)}),t.classes.forEach(function(t){var i=c(n[t],e,r,"Green","white");i.rect.r=5,y.push(i),p=Math.max(i.width,p)}),x=y[0].height;var b=[],_=[];y.sort(function(t,e){return e.width-t.width}),y.forEach(function(t){2*t.width+4>p?b.push(t):_.push(t)}),y=b;for(var w,E;_.length;){if(w=_.pop(),!(E=_.pop())){y.push(w);break}w.width-E.width>2?(y.push(w),_.push(E)):(s(E.items,w.width+4,0),y.push({items:w.items.concat(E.items),width:w.width+E.width+4,height:w.height,x:w.x,y:w.y}),m-=w.height)}p+=12,m=4*(y.length-1)+y.length*x+12;var C={type:"rect",x:e,y:r-m/2,r:4,width:p,height:m,stroke:"none",fill:i},k=C.y+6,l=[C];y.forEach(function(t){s(t.items,e-t.x+(p-t.width)/2,k-t.y),l=l.concat(t.items),k+=t.height+4});var u=h(C.x+C.width/2,C.y,(t.exclude?"None":"One")+" of:",a);l.push(u.label);var f=p;p=Math.max(u.width,p);var d=(p-f)/2;return s(l,d,0),{items:l,width:p,height:m+u.height,x:Math.min(u.x,e),y:u.y,lineInX:d+e,lineOutX:d+e+C.width}},group:function(t,e,r){if(p(t))return A.empty(null,e,r);var n=o(t.sub,e,r);if(t.num){s(n.items,10,0);var i=n.width+20,a=n.height+20,c={type:"rect",x:e,y:n.y-10,r:6,width:i,height:a,"stroke-dasharray":".",stroke:"silver","stroke-width":2},u=h(c.x+c.width/2,c.y-2,"Group #"+t.num),l=n.items.concat([c,u.label]),f=Math.max(u.width,i),d=(f-i)/2;return d&&s(l,d,0),{items:l,width:f,height:a+u.height+4,x:e,y:u.y,lineInX:d+n.lineInX+10,lineOutX:d+n.lineOutX+10}}return n},assert:function(t,e,r){var n,i={AssertNonWordBoundary:{bg:"maroon",fg:"white"},AssertWordBoundary:{bg:"purple",fg:"white"},AssertEnd:{bg:"Indigo",fg:"white"},AssertBegin:{bg:"Indigo",fg:"white"}},a=t.assertionType,o=a.replace("Assert","")+"!";if(n=i[a])return!C||"AssertBegin"!==a&&"AssertEnd"!==a||(o="Line"+o),c(o,e,r,n.bg,n.fg);var u,l;a===AssertLookahead?(u="CornflowerBlue",l="darkgreen",o="Followed by:"):a===AssertNegativeLookahead&&(u="#F63",l="Purple",o="Not followed by:");var f=A.group(t,e,r),p=f.height+16,d=f.width+16,g={type:"rect",x:e,y:f.y-8,r:6,width:d,height:p,"stroke-dasharray":"-",stroke:u,"stroke-width":2},x=h(g.x+d/2,g.y,o,l),v=Math.max(d,x.width),y=(v-d)/2;return s(f.items,y+8,0),y&&s([g,x.label],y,0),{items:f.items.concat([g,x.label]),width:v,height:g.height+x.height,x:e,y:x.y,lineInX:y+f.lineInX+8,lineOutX:y+f.lineOutX+8}}},B={delimiter:"Indigo",flags:"darkgreen",exact:"#334",dot:"darkblue",backref:"teal",$:"purple","^":"purple","\\b":"#F30","\\B":"#F30","(":"blue",")":"blue","?=":"darkgreen","?!":"red","?:":"grey","[":"navy","]":"navy","|":"blue","{":"maroon",",":"maroon","}":"maroon","*":"maroon","+":"maroon","?":"maroon",repeatNonGreedy:"#F61",defaults:"black",charsetRange:"olive",charsetClass:"navy",charsetExclude:"red",charsetChars:"#534"};return i}),function(t){var e,r,n="hasOwnProperty",i=/[\.\/]/,a=function(){},s=function(t,e){return t-e},o={n:{}},c=function(t,n){t=String(t);var i,a=r,o=Array.prototype.slice.call(arguments,2),h=c.listeners(t),u=0,l=[],f={},p=[],d=e;e=t,r=0;for(var g=0,x=h.length;g=1e3&&delete o[c.shift()],c.push(s),o[s]=t[N](e,a),r?r(o[s]):o[s])}return n}function s(){return this.hex}function o(t,e){for(var r=[],n=0,i=t.length;i-2*!e>n;n+=2){var a=[{x:+t[n-2],y:+t[n-1]},{x:+t[n],y:+t[n+1]},{x:+t[n+2],y:+t[n+3]},{x:+t[n+4],y:+t[n+5]}];e?n?i-4==n?a[3]={x:+t[0],y:+t[1]}:i-2==n&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[i-2],y:+t[i-1]}:i-4==n?a[3]=a[2]:n||(a[0]={x:+t[n],y:+t[n+1]}),r.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return r}function c(t,e,r,n,i){return t*(t*(-3*e+9*r-9*n+3*i)+6*e-12*r+6*n)-3*e+3*r}function h(t,e,r,n,i,a,s,o,h){null==h&&(h=1),h=h>1?1:h<0?0:h;for(var u=h/2,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],p=0,d=0;d<12;d++){var g=u*l[d]+u,x=c(g,t,r,i,s),v=c(g,e,n,a,o),y=x*x+v*v;p+=f[d]*z.sqrt(y)}return u*p}function u(t,e,r,n,i,a,s,o,c){if(!(c<0||h(t,e,r,n,i,a,s,o).01;)l/=2,f+=(uj(i,s)||j(e,n)j(a,o))){var c=(t*n-e*r)*(i-s)-(t-r)*(i*o-a*s),h=(t*n-e*r)*(a-o)-(e-n)*(i*o-a*s),u=(t-r)*(a-o)-(e-n)*(i-s);if(u){var l=c/u,f=h/u,p=+l.toFixed(2),d=+f.toFixed(2);if(!(p<+U(t,r).toFixed(2)||p>+j(t,r).toFixed(2)||p<+U(i,s).toFixed(2)||p>+j(i,s).toFixed(2)||d<+U(e,n).toFixed(2)||d>+j(e,n).toFixed(2)||d<+U(a,o).toFixed(2)||d>+j(a,o).toFixed(2)))return{x:l,y:f}}}}function f(t,e,n){var i=r.bezierBBox(t),a=r.bezierBBox(e);if(!r.isBBoxIntersect(i,a))return n?0:[];for(var s=h.apply(0,t),o=h.apply(0,e),c=j(~~(s/5),1),u=j(~~(o/5),1),f=[],p=[],d={},g=n?0:[],x=0;x=0&&S<=1.001&&A>=0&&A<=1.001&&(n?g++:g.push({x:k.x,y:k.y,t1:U(S,1),t2:U(A,1)}))}}return g}function p(t,e,n){t=r._path2curve(t),e=r._path2curve(e);for(var i,a,s,o,c,h,u,l,p,d,g=n?0:[],x=0,v=t.length;xn)return n;for(;ra?r=i:n=i,i=(n-r)/2+r}return i}var c=3*e,h=3*(n-e)-c,u=1-c-h,l=3*r,f=3*(i-r)-l,p=1-l-f;return function(t,e){var r=o(t,e);return((p*r+f)*r+l)*r}(t,1/(200*a))}function v(t,e){var r=[],n={};if(this.ms=e,this.times=1,t){for(var i in t)t[k](i)&&(n[Z(i)]=t[i],r.push(Z(i)));r.sort(ut)}this.anim=n,this.top=r[r.length-1],this.percents=r}function y(t,n,i,a,s,o){i=Z(i);var c,h,u,l,f,p,g=t.ms,v={},y={},m={};if(a)for(_=0,E=oe.length;_a*t.top){i=t.percents[_],f=t.percents[_-1]||0,g=g/t.top*(i-f),l=t.percents[_+1],c=t.anim[i];break}a&&n.attr(t.anim[t.percents[_]])}if(c){if(h)h.initstatus=a,h.start=new Date-h.ms*a;else{for(var C in c)if(c[k](C)&&(rt[k](C)||n.paper.customAttributes[k](C)))switch(v[C]=n.attr(C),null==v[C]&&(v[C]=et[C]),y[C]=c[C],rt[C]){case H:m[C]=(y[C]-v[C])/g;break;case"colour":v[C]=r.getRGB(v[C]);var S=r.getRGB(y[C]);m[C]={r:(S.r-v[C].r)/g,g:(S.g-v[C].g)/g,b:(S.b-v[C].b)/g};break;case"path":var A=Ft(v[C],y[C]),B=A[1];for(v[C]=A[0],m[C]=[],_=0,E=v[C].length;_',vt=yt.firstChild,vt.style.behavior="url(#default#VML)",!vt||"object"!=typeof vt.adj)return r.type=R;yt=null}r.svg=!(r.vml="VML"==r.type),r._Paper=B,r.fn=_=B.prototype=r.prototype,r._id=0,r._oid=0,r.is=function(t,e){return e=L.call(e),"finite"==e?!Y[k](+t):"array"==e?t instanceof Array:"null"==e&&null===t||e==typeof t&&null!==t||"object"==e&&t===Object(t)||"array"==e&&Array.isArray&&Array.isArray(t)||V.call(t).slice(8,-1).toLowerCase()==e},r.angle=function(t,e,n,i,a,s){if(null==a){var o=t-n,c=e-i;return o||c?(180+180*z.atan2(-c,-o)/q+360)%360:0}return r.angle(t,e,a,s)-r.angle(n,i,a,s)},r.rad=function(t){return t%360*q/180},r.deg=function(t){return 180*t/q%360},r.snapTo=function(t,e,n){if(n=r.is(n,"finite")?n:10,r.is(t,W)){for(var i=t.length;i--;)if(X(t[i]-e)<=n)return t[i]}else{t=+t;var a=e%t;if(at-n)return e-a+t}return e};r.createUUID=function(t,e){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(t,e).toUpperCase()}}(/[xy]/g,function(t){var e=16*z.random()|0;return("x"==t?e:3&e|8).toString(16)});r.setWindow=function(t){e("raphael.setWindow",r,S.win,t),S.win=t,S.doc=S.win.document,r._engine.initWin&&r._engine.initWin(S.win)};var mt=function(t){if(r.vml){var e,n=/^\s+|\s+$/g;try{var i=new ActiveXObject("htmlfile");i.write(""),i.close(),e=i.body}catch(t){e=createPopup().document.body}var s=e.createTextRange();mt=a(function(t){try{e.style.color=M(t).replace(n,R);var r=s.queryCommandValue("ForeColor");return r=(255&r)<<16|65280&r|(16711680&r)>>>16,"#"+("000000"+r.toString(16)).slice(-6)}catch(t){return"none"}})}else{var o=S.doc.createElement("i");o.title="Raphaël Colour Picker",o.style.display="none",S.doc.body.appendChild(o),mt=a(function(t){return o.style.color=t,S.doc.defaultView.getComputedStyle(o,R).getPropertyValue("color")})}return mt(t)},bt=function(){return"hsb("+[this.h,this.s,this.b]+")"},_t=function(){return"hsl("+[this.h,this.s,this.l]+")"},wt=function(){return this.hex},Et=function(t,e,n){if(null==e&&r.is(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(n=t.b,e=t.g,t=t.r),null==e&&r.is(t,"string")){var i=r.getRGB(t);t=i.r,e=i.g,n=i.b}return(t>1||e>1||n>1)&&(t/=255,e/=255,n/=255),[t,e,n]},Ct=function(t,e,n,i){t*=255,e*=255,n*=255;var a={r:t,g:e,b:n,hex:r.rgb(t,e,n),toString:wt};return r.is(i,"finite")&&(a.opacity=i),a};r.color=function(t){var e;return r.is(t,"object")&&"h"in t&&"s"in t&&"b"in t?(e=r.hsb2rgb(t),t.r=e.r,t.g=e.g,t.b=e.b,t.hex=e.hex):r.is(t,"object")&&"h"in t&&"s"in t&&"l"in t?(e=r.hsl2rgb(t),t.r=e.r,t.g=e.g,t.b=e.b,t.hex=e.hex):(r.is(t,"string")&&(t=r.getRGB(t)),r.is(t,"object")&&"r"in t&&"g"in t&&"b"in t?(e=r.rgb2hsl(t),t.h=e.h,t.s=e.s,t.l=e.l,e=r.rgb2hsb(t),t.v=e.b):(t={hex:"none"},t.r=t.g=t.b=t.h=t.s=t.v=t.l=-1)),t.toString=wt,t},r.hsb2rgb=function(t,e,r,n){this.is(t,"object")&&"h"in t&&"s"in t&&"b"in t&&(r=t.b,e=t.s,t=t.h,n=t.o),t*=360;var i,a,s,o,c;return t=t%360/60,c=r*e,o=c*(1-X(t%2-1)),i=a=s=r-c,t=~~t,i+=[c,o,0,0,o,c][t],a+=[o,c,c,o,0,0][t],s+=[0,0,o,c,c,o][t],Ct(i,a,s,n)},r.hsl2rgb=function(t,e,r,n){this.is(t,"object")&&"h"in t&&"s"in t&&"l"in t&&(r=t.l,e=t.s,t=t.h),(t>1||e>1||r>1)&&(t/=360,e/=100,r/=100),t*=360;var i,a,s,o,c;return t=t%360/60,c=2*e*(r<.5?r:1-r),o=c*(1-X(t%2-1)),i=a=s=r-c/2,t=~~t,i+=[c,o,0,0,o,c][t],a+=[o,c,c,o,0,0][t],s+=[0,0,o,c,c,o][t],Ct(i,a,s,n)},r.rgb2hsb=function(t,e,r){r=Et(t,e,r),t=r[0],e=r[1],r=r[2];var n,i,a,s;return a=j(t,e,r),s=a-U(t,e,r),n=0==s?null:a==t?(e-r)/s:a==e?(r-t)/s+2:(t-e)/s+4,n=(n+360)%6*60/360,i=0==s?0:s/a,{h:n,s:i,b:a,toString:bt}},r.rgb2hsl=function(t,e,r){r=Et(t,e,r),t=r[0],e=r[1],r=r[2];var n,i,a,s,o,c;return s=j(t,e,r),o=U(t,e,r),c=s-o,n=0==c?null:s==t?(e-r)/c:s==e?(r-t)/c+2:(t-e)/c+4,n=(n+360)%6*60/360,a=(s+o)/2,i=0==c?0:a<.5?c/(2*a):c/(2-2*a),{h:n,s:i,l:a,toString:_t}},r._path2string=function(){return this.join(",").replace(at,"$1")};r._preload=function(t,e){var r=S.doc.createElement("img");r.style.cssText="position:absolute;left:-9999em;top:-9999em",r.onload=function(){e.call(this),this.onload=null,S.doc.body.removeChild(this)},r.onerror=function(){S.doc.body.removeChild(this)},S.doc.body.appendChild(r),r.src=t};r.getRGB=a(function(t){if(!t||(t=M(t)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:s};if("none"==t)return{r:-1,g:-1,b:-1,hex:"none",toString:s};!(it[k](t.toLowerCase().substring(0,2))||"#"==t.charAt())&&(t=mt(t));var e,n,i,a,o,c,h=t.match(Q);return h?(h[2]&&(i=J(h[2].substring(5),16),n=J(h[2].substring(3,5),16),e=J(h[2].substring(1,3),16)),h[3]&&(i=J((o=h[3].charAt(3))+o,16), -n=J((o=h[3].charAt(2))+o,16),e=J((o=h[3].charAt(1))+o,16)),h[4]&&(c=h[4][F](nt),e=Z(c[0]),"%"==c[0].slice(-1)&&(e*=2.55),n=Z(c[1]),"%"==c[1].slice(-1)&&(n*=2.55),i=Z(c[2]),"%"==c[2].slice(-1)&&(i*=2.55),"rgba"==h[1].toLowerCase().slice(0,4)&&(a=Z(c[3])),c[3]&&"%"==c[3].slice(-1)&&(a/=100)),h[5]?(c=h[5][F](nt),e=Z(c[0]),"%"==c[0].slice(-1)&&(e*=2.55),n=Z(c[1]),"%"==c[1].slice(-1)&&(n*=2.55),i=Z(c[2]),"%"==c[2].slice(-1)&&(i*=2.55),("deg"==c[0].slice(-3)||"°"==c[0].slice(-1))&&(e/=360),"hsba"==h[1].toLowerCase().slice(0,4)&&(a=Z(c[3])),c[3]&&"%"==c[3].slice(-1)&&(a/=100),r.hsb2rgb(e,n,i,a)):h[6]?(c=h[6][F](nt),e=Z(c[0]),"%"==c[0].slice(-1)&&(e*=2.55),n=Z(c[1]),"%"==c[1].slice(-1)&&(n*=2.55),i=Z(c[2]),"%"==c[2].slice(-1)&&(i*=2.55),("deg"==c[0].slice(-3)||"°"==c[0].slice(-1))&&(e/=360),"hsla"==h[1].toLowerCase().slice(0,4)&&(a=Z(c[3])),c[3]&&"%"==c[3].slice(-1)&&(a/=100),r.hsl2rgb(e,n,i,a)):(h={r:e,g:n,b:i,toString:s},h.hex="#"+(16777216|i|n<<8|e<<16).toString(16).slice(1),r.is(a,"finite")&&(h.opacity=a),h)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:s}},r),r.hsb=a(function(t,e,n){return r.hsb2rgb(t,e,n).hex}),r.hsl=a(function(t,e,n){return r.hsl2rgb(t,e,n).hex}),r.rgb=a(function(t,e,r){return"#"+(16777216|r|e<<8|t<<16).toString(16).slice(1)}),r.getColor=function(t){var e=this.getColor.start=this.getColor.start||{h:0,s:1,b:t||.75},r=this.hsb2rgb(e.h,e.s,e.b);return e.h+=.075,e.h>1&&(e.h=0,e.s-=.2,e.s<=0&&(this.getColor.start={h:0,s:1,b:e.b})),r.hex},r.getColor.reset=function(){delete this.start},r.parsePathString=function(t){if(!t)return null;var e=kt(t);if(e.arr)return At(e.arr);var n={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},i=[];return r.is(t,W)&&r.is(t[0],W)&&(i=At(t)),i.length||M(t).replace(st,function(t,e,r){var a=[],s=e.toLowerCase();if(r.replace(ct,function(t,e){e&&a.push(+e)}),"m"==s&&a.length>2&&(i.push([e][O](a.splice(0,2))),s="l",e="m"==e?"l":"L"),"r"==s)i.push([e][O](a));else for(;a.length>=n[s]&&(i.push([e][O](a.splice(0,n[s]))),n[s]););}),i.toString=r._path2string,e.arr=At(i),i},r.parseTransformString=a(function(t){if(!t)return null;var e=[];return r.is(t,W)&&r.is(t[0],W)&&(e=At(t)),e.length||M(t).replace(ot,function(t,r,n){var i=[];L.call(r);n.replace(ct,function(t,e){e&&i.push(+e)}),e.push([r][O](i))}),e.toString=r._path2string,e});var kt=function(t){var e=kt.ps=kt.ps||{};return e[t]?e[t].sleep=100:e[t]={sleep:100},setTimeout(function(){for(var r in e)e[k](r)&&r!=t&&!--e[r].sleep&&delete e[r]}),e[t]};r.findDotsAtSegment=function(t,e,r,n,i,a,s,o,c){var h=1-c,u=G(h,3),l=G(h,2),f=c*c,p=f*c,d=u*t+3*l*c*r+3*h*c*c*i+p*s,g=u*e+3*l*c*n+3*h*c*c*a+p*o,x=t+2*c*(r-t)+f*(i-2*r+t),v=e+2*c*(n-e)+f*(a-2*n+e),y=r+2*c*(i-r)+f*(s-2*i+r),m=n+2*c*(a-n)+f*(o-2*a+n),b=h*t+c*r,_=h*e+c*n,w=h*i+c*s,E=h*a+c*o,C=90-180*z.atan2(x-y,v-m)/q;return(x>y||v=t.x&&e<=t.x2&&r>=t.y&&r<=t.y2},r.isBBoxIntersect=function(t,e){var n=r.isPointInsideBBox;return n(e,t.x,t.y)||n(e,t.x2,t.y)||n(e,t.x,t.y2)||n(e,t.x2,t.y2)||n(t,e.x,e.y)||n(t,e.x2,e.y)||n(t,e.x,e.y2)||n(t,e.x2,e.y2)||(t.xe.x||e.xt.x)&&(t.ye.y||e.yt.y)},r.pathIntersection=function(t,e){return p(t,e)},r.pathIntersectionNumber=function(t,e){return p(t,e,1)},r.isPointInsidePath=function(t,e,n){var i=r.pathBBox(t);return r.isPointInsideBBox(i,e,n)&&p(t,[["M",e,n],["H",i.x2+10]],1)%2==1},r._removedFactory=function(t){return function(){e("raphael.log",null,"Raphaël: you are calling to method “"+t+"” of removed object",t)}};var St=r.pathBBox=function(t){var e=kt(t);if(e.bbox)return n(e.bbox);if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0};t=Ft(t);for(var r,i=0,a=0,s=[],o=[],c=0,h=t.length;c1&&(y=z.sqrt(y),r*=y,n*=y);var m=r*r,b=n*n,_=(s==o?-1:1)*z.sqrt(X((m*b-m*v*v-b*x*x)/(m*v*v+b*x*x))),w=_*r*v/n+(t+c)/2,E=_*-n*x/r+(e+h)/2,C=z.asin(((e-E)/n).toFixed(9)),k=z.asin(((h-E)/n).toFixed(9));C=tk&&(C-=2*q),!o&&k>C&&(k-=2*q)}var S=k-C;if(X(S)>f){var A=k,B=c,N=h;k=C+f*(o&&k>C?1:-1),c=w+r*z.cos(k),h=E+n*z.sin(k),d=Rt(c,h,r,n,i,0,o,B,N,[k,A,w,E])}S=k-C;var T=z.cos(C),R=z.sin(C),I=z.cos(k),M=z.sin(k),D=z.tan(S/4),P=4/3*r*D,L=4/3*n*D,j=[t,e],U=[t+P*R,e-L*T],G=[c+P*M,h-L*I],H=[c,h];if(U[0]=2*j[0]-U[0],U[1]=2*j[1]-U[1],u)return[U,G,H][O](d);d=[U,G,H][O](d).join()[F](",");for(var W=[],V=0,Q=d.length;V"1e12"&&(f=.5),X(p)>"1e12"&&(p=.5),f>0&&f<1&&(c=It(t,e,r,n,i,a,s,o,f),g.push(c.x),d.push(c.y)),p>0&&p<1&&(c=It(t,e,r,n,i,a,s,o,p),g.push(c.x),d.push(c.y)),h=a-2*n+e-(o-2*a+n),u=2*(n-e)-2*(a-n),l=e-n,f=(-u+z.sqrt(u*u-4*h*l))/2/h,p=(-u-z.sqrt(u*u-4*h*l))/2/h,X(f)>"1e12"&&(f=.5),X(p)>"1e12"&&(p=.5),f>0&&f<1&&(c=It(t,e,r,n,i,a,s,o,f),g.push(c.x),d.push(c.y)),p>0&&p<1&&(c=It(t,e,r,n,i,a,s,o,p),g.push(c.x),d.push(c.y)),{min:{x:U[N](0,g),y:U[N](0,d)},max:{x:j[N](0,g),y:j[N](0,d)}}}),Ft=r._path2curve=a(function(t,e){var r=!e&&kt(t);if(!e&&r.curve)return At(r.curve);for(var n=Nt(t),i=e&&Nt(e),a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=(function(t,e,r){var n,i,a={T:1,Q:1};if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in a)&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"][O](Rt[N](0,[e.x,e.y][O](t.slice(1))));break;case"S":"C"==r||"S"==r?(n=2*e.x-e.bx,i=2*e.y-e.by):(n=e.x,i=e.y),t=["C",n,i][O](t.slice(1));break;case"T":"Q"==r||"T"==r?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"][O](Tt(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"][O](Tt(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"L":t=["C"][O](Ot(e.x,e.y,t[1],t[2]));break;case"H":t=["C"][O](Ot(e.x,e.y,t[1],e.y));break;case"V":t=["C"][O](Ot(e.x,e.y,e.x,t[1]));break;case"Z":t=["C"][O](Ot(e.x,e.y,e.X,e.Y))}return t}),c=function(t,e){if(t[e].length>7){t[e].shift();for(var r=t[e];r.length;)t.splice(e++,0,["C"][O](r.splice(0,6)));t.splice(e,1),l=j(n.length,i&&i.length||0)}},h=function(t,e,r,a,s){t&&e&&"M"==t[s][0]&&"M"!=e[s][0]&&(e.splice(s,0,["M",a.x,a.y]),r.bx=0,r.by=0,r.x=t[s][1],r.y=t[s][2],l=j(n.length,i&&i.length||0))},u=0,l=j(n.length,i&&i.length||0);ui){if(e&&!f.start){if(u=ee(s,o,c[1],c[2],c[3],c[4],c[5],c[6],i-p),l+=["C"+u.start.x,u.start.y,u.m.x,u.m.y,u.x,u.y],a)return l;f.start=l,l=["M"+u.x,u.y+"C"+u.n.x,u.n.y,u.end.x,u.end.y,c[5],c[6]].join(),p+=h,s=+c[5],o=+c[6];continue}if(!t&&!e)return u=ee(s,o,c[1],c[2],c[3],c[4],c[5],c[6],i-p),{x:u.x,y:u.y,alpha:u.alpha}}p+=h,s=+c[5],o=+c[6]}l+=c.shift()+c}return f.end=l,u=t?p:e?f:r.findDotsAtSegment(s,o,c[0],c[1],c[2],c[3],c[4],c[5],1),u.alpha&&(u={x:u.x,y:u.y,alpha:u.alpha}),u}},ne=re(1),ie=re(),ae=re(0,1);r.getTotalLength=ne,r.getPointAtLength=ie,r.getSubpath=function(t,e,r){if(this.getTotalLength(t)-r<1e-6)return ae(t,e).end;var n=ae(t,r,1);return e?ae(n,e).end:n},Kt.getTotalLength=function(){var t=this.getPath();if(t)return this.node.getTotalLength?this.node.getTotalLength():ne(t)},Kt.getPointAtLength=function(t){var e=this.getPath();if(e)return ie(e,t)},Kt.getPath=function(){var t,e=r._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return e&&(t=e(this)),t},Kt.getSubpath=function(t,e){var n=this.getPath();if(n)return r.getSubpath(n,t,e)};var se=r.easing_formulas={linear:function(t){return t},"<":function(t){return G(t,1.7)},">":function(t){return G(t,.48)},"<>":function(t){var e=.48-t/1.04,r=z.sqrt(.1734+e*e),n=r-e,i=G(X(n),1/3)*(n<0?-1:1),a=-r-e,s=G(X(a),1/3)*(a<0?-1:1),o=i+s+.5;return 3*(1-o)*o*o+o*o*o},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){t-=1;var e=1.70158;return t*t*((e+1)*t+e)+1},elastic:function(t){return t==!!t?t:G(2,-10*t)*z.sin(2*q*(t-.075)/.3)+1},bounce:function(t){var e,r=7.5625,n=2.75;return t<1/n?e=r*t*t:t<2/n?(t-=1.5/n,e=r*t*t+.75):t<2.5/n?(t-=2.25/n,e=r*t*t+.9375):(t-=2.625/n,e=r*t*t+.984375),e}};se.easeIn=se["ease-in"]=se["<"],se.easeOut=se["ease-out"]=se[">"],se.easeInOut=se["ease-in-out"]=se["<>"],se["back-in"]=se.backIn,se["back-out"]=se.backOut;var oe=[],ce=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame||function(t){setTimeout(t,16)},he=function(){for(var t=+new Date,n=0;n1&&!i.next){for(s in f)f[k](s)&&(g[s]=i.totalOrigin[s]);i.el.attr(g),y(i.anim,i.el,i.anim.percents[0],null,i.totalOrigin,i.repeat-1)}i.next&&!i.stop&&y(i.anim,i.el,i.next,null,i.totalOrigin,i.repeat)}}}r.svg&&p&&p.paper&&p.paper.safari(),oe.length&&ce(he)},ue=function(t){return t>255?255:t<0?0:t};Kt.animateWith=function(t,e,n,i,a,s){var o=this;if(o.removed)return s&&s.call(o),o;var c=n instanceof v?n:r.animation(n,i,a,s);y(c,o,c.percents[0],null,o.attr());for(var h=0,u=oe.length;h.5)-1;c(f-.5,2)+c(p-.5,2)>.25&&(p=a.sqrt(.25-c(f-.5,2))*i+.5)&&.5!=p&&(p=p.toFixed(5)-1e-5*i)}return l}),i=i.split(/\s*\-\s*/),"linear"==h){var m=i.shift();if(m=-n(m),isNaN(m))return null;var b=[0,0,a.cos(r.rad(m)),a.sin(r.rad(m))],_=1/(s(o(b[2]),o(b[3]))||1);b[2]*=_,b[3]*=_,b[2]<0&&(b[0]=-b[2],b[2]=0),b[3]<0&&(b[1]=-b[3],b[3]=0)}var w=r._parseDots(i);if(!w)return null;if(u=u.replace(/[\(\)\s,\xb0#]/g,"_"),t.gradient&&u!=t.gradient.id&&(g.defs.removeChild(t.gradient),delete t.gradient),!t.gradient){y=x(h+"Gradient",{id:u}),t.gradient=y,x(y,"radial"==h?{fx:f,fy:p}:{x1:b[0],y1:b[1],x2:b[2],y2:b[3],gradientTransform:t.matrix.invert()}),g.defs.appendChild(y);for(var E=0,C=w.length;E1?I.opacity/100:I.opacity});case"stroke":I=r.getRGB(g),c.setAttribute(d,I.hex),"stroke"==d&&I[t]("opacity")&&x(c,{"stroke-opacity":I.opacity>1?I.opacity/100:I.opacity}),"stroke"==d&&n._.arrows&&("startString"in n._.arrows&&m(n,n._.arrows.startString),"endString"in n._.arrows&&m(n,n._.arrows.endString,1));break;case"gradient":("circle"==n.type||"ellipse"==n.type||"r"!=e(g).charAt())&&v(n,g);break;case"opacity":u.gradient&&!u[t]("stroke-opacity")&&x(c,{"stroke-opacity":g>1?g/100:g});case"fill-opacity":if(u.gradient){M=r._g.doc.getElementById(c.getAttribute("fill").replace(/^url\(#|\)$/g,l)),M&&(F=M.getElementsByTagName("stop"),x(F[F.length-1],{"stop-opacity":g}));break}default:"font-size"==d&&(g=i(g,10)+"px");var D=d.replace(/(\-.)/g,function(t){return t.substring(1).toUpperCase()});c.style[D]=g,n._.dirty=1,c.setAttribute(d,g)}}E(n,a),c.style.visibility=f},E=function(n,a){if("text"==n.type&&(a[t]("text")||a[t]("font")||a[t]("font-size")||a[t]("x")||a[t]("y"))){var s=n.attrs,o=n.node,c=o.firstChild?i(r._g.doc.defaultView.getComputedStyle(o.firstChild,l).getPropertyValue("font-size"),10):10;if(a[t]("text")){for(s.text=a.text;o.firstChild;)o.removeChild(o.firstChild);for(var h,u=e(a.text).split("\n"),f=[],p=0,d=u.length;p"));var W=q.getBoundingClientRect();v.W=p.w=(W.right-W.left)/100,v.H=p.h=(W.bottom-W.top)/100,v.X=p.x,v.Y=p.y+v.H/2,("x"in c||"y"in c)&&(v.path.v=r.format("m{0},{1}l{2},{1}",a(p.x*y),a(p.y*y),a(p.x*y)+1));for(var V=["x","y","text","font","font-family","font-weight","font-style","font-size"],Q=0,Y=V.length;Q.25&&(r=i.sqrt(.25-o(e-.5,2))*(2*(r>.5)-1)+.5),h=e+l+r),f}),a=a.split(/\s*\-\s*/),"linear"==c){var u=a.shift();if(u=-n(u),isNaN(u))return null}var p=r._parseDots(a);if(!p)return null;if(t=t.shape||t.node,p.length){t.removeChild(s),s.on=!0,s.method="none",s.color=p[0].color,s.color2=p[p.length-1].color;for(var d=[],g=0,x=p.length;g')}}catch(t){N=function(t){return e.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},r._engine.initWin(r._g.win),r._engine.create=function(){var t=r._getContainer.apply(0,arguments),e=t.container,n=t.height,i=t.width,a=t.x,s=t.y;if(!e)throw new Error("VML container not found.");var o=new r._Paper,c=o.canvas=r._g.doc.createElement("div"),h=c.style;return a=a||0,s=s||0,i=i||512,n=n||342,o.width=i,o.height=n,i==+i&&(i+="px"),n==+n&&(n+="px"),o.coordsize=216e5+l+216e5,o.coordorigin="0 0",o.span=r._g.doc.createElement("span"),o.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",c.appendChild(o.span),h.cssText=r.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",i,n),1==e?(r._g.doc.body.appendChild(c),h.left=a+"px",h.top=s+"px",h.position="absolute"):e.firstChild?e.insertBefore(c,e.firstChild):e.appendChild(c),o.renderfix=function(){},o},r.prototype.clear=function(){r.eve("raphael.clear",this),this.canvas.innerHTML=f,this.span=r._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},r.prototype.remove=function(){r.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var t in this)this[t]="function"==typeof this[t]?r._removedFactory(t):null;return!0};var O=r.st;for(var T in B)B[t](T)&&!O[t](T)&&(O[T]=function(t){return function(){var e=arguments;return this.forEach(function(r){r[t].apply(r,e)})}}(T))}}(),A.was?S.win.Raphael=r:Raphael=r,r}),"function"!=typeof define)var define=require("amdefine")(module);define("regulex",["./Kit","./NFA","./RegExp","./parse","./visualize","./libs/raphael"],function(t,e,r,n,i,a){return{Kit:t,NFA:e,RegExp:r,parse:n,Raphael:a,visualize:i}}); \ No newline at end of file +var requirejs,require,define;if(function(t){function e(t,e){return v.call(t,e)}function r(t,e){var r,n,a,i,s,o,c,h,u,l,f,p=e&&e.split("/"),d=g.map,m=d&&d["*"]||{};if(t&&"."===t.charAt(0))if(e){for(p=p.slice(0,p.length-1),t=t.split("/"),s=t.length-1,g.nodeIdCompat&&y.test(t[s])&&(t[s]=t[s].replace(y,"")),t=p.concat(t),u=0;u0&&(t.splice(u-1,2),u-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((p||m)&&d){for(r=t.split("/"),u=r.length;u>0;u-=1){if(n=r.slice(0,u).join("/"),p)for(l=p.length;l>0;l-=1)if((a=d[p.slice(0,l).join("/")])&&(a=a[n])){i=a,o=u;break}if(i)break;!c&&m&&m[n]&&(c=m[n],h=u)}!i&&c&&(i=c,o=h),i&&(r.splice(0,o,i),t=r.join("/"))}return t}function n(e,r){return function(){var n=x.call(arguments,0);return"string"!=typeof n[0]&&1===n.length&&n.push(null),u.apply(t,n.concat([e,r]))}}function a(t){return function(e){return r(e,t)}}function i(t){return function(e){p[t]=e}}function s(r){if(e(d,r)){var n=d[r];delete d[r],m[r]=!0,h.apply(t,n)}if(!e(p,r)&&!e(m,r))throw new Error("No "+r);return p[r]}function o(t){var e,r=t?t.indexOf("!"):-1;return r>-1&&(e=t.substring(0,r),t=t.substring(r+1,t.length)),[e,t]}function c(t){return function(){return g&&g.config&&g.config[t]||{}}}var h,u,l,f,p={},d={},g={},m={},v=Object.prototype.hasOwnProperty,x=[].slice,y=/\.js$/;l=function(t,e){var n,i=o(t),c=i[0];return t=i[1],c&&(c=r(c,e),n=s(c)),c?t=n&&n.normalize?n.normalize(t,a(e)):r(t,e):(t=r(t,e),i=o(t),c=i[0],t=i[1],c&&(n=s(c))),{f:c?c+"!"+t:t,n:t,pr:c,p:n}},f={require:function(t){return n(t)},exports:function(t){var e=p[t];return void 0!==e?e:p[t]={}},module:function(t){return{id:t,uri:"",exports:p[t],config:c(t)}}},h=function(r,a,o,c){var h,u,g,v,x,y,b=[],_=typeof o;if(c=c||r,"undefined"===_||"function"===_){for(a=!a.length&&o.length?["require","exports","module"]:a,x=0;x>1),(i=n(r,t[a]))===k)return a;i===E?c=a-1:s=a+1}while(s<=c);return-1}function n(t){var e=t.length;if(e<=1)return t;for(var r,n,i,s=1,o=e/3|0;s0;){for(r=s;r=s&&t[n]=h){c===h&&(u[h]=!0);break}var g=n(t.join("").split("")),m=Object.keys(u),v=g[0],x=Object.create(null),y=Object.create(null);for(e=0;ev)break;for(e=0,i=g.length-1;eh));r++)s[0]<=c&&h<=s[1]&&(x[s].push(v),m.push(v));if(c=g[e],h=g[e+1],u[h])for(r=0;rh));r++)s[0]<=h&&h<=s[1]&&x[s].push(h)}m=n(m);for(a in x)y[a[0]===a[1]?a[0]:a]=x[a];return{ranges:m,map:y}}function c(t){var e=String.fromCharCode(65535);t=o(t).ranges;var r=[];if(!t.length)return r;"\0"!==t[0][0]&&t.unshift(e);var n=t.length-1;return(t[n][1]||t[n][0])!==e&&t.push("\0"),t.reduce(function(t,e){var n=d(t[1]||t[0]),a=p(e[0]);return n1&&t.shift();return t.forEach(function(t){if("-"==e[0]&&e.length>1){if(e[1]>t)throw new Error("Charset range out of order:"+e[1]+"-"+t+"!");r.push(e[1]+t),e.splice(0,2)}else e.unshift(t)}),r=r.concat(e),n?c(r):o(r).ranges}function u(t){if(!t.length)return[];var e=[t[0]];return t.reduce(function(t,r){var n=e.length-1;return t[t.length-1]===p(r[0])?e[n]=e[n][0]+r[r.length-1]:(e.push(r),r)}),e.reduce(function(t,e){return 2===e.length&&e[0]===p(e[1])?(t.push(e[0]),t.push(e[1])):t.push(e),t},[])}function l(t){return String.fromCharCode(t)}function f(t){return t.charCodeAt(0)}function p(t){return String.fromCharCode(t.charCodeAt(0)-1)}function d(t){return String.fromCharCode(t.charCodeAt(0)+1)}function g(t,e){var r=/[\x00-\x1F\x7F-\x9F]/,n=/[\u009F-\uFFFF]/;return t=t.split("").map(function(t){return!e&&S.hasOwnProperty(t)?S[t]:n.test(t)?"\\u"+("00"+f(t).toString(16).toUpperCase()).slice(-4):r.test(t)?"\\x"+("0"+f(t).toString(16).toUpperCase()).slice(-2):t}).join("")}function m(t){return[].concat.apply([],t)}function v(t,e){return new Array(e+1).join(t)}function x(){var t=_.call(arguments);if(w)Function.prototype.apply.apply(console.log,[console,t]);else{var e=require("util");t.forEach(function(t){console.log(e.inspect(t,{showHidden:!1,customInspect:!0,depth:64,colors:!0}))})}}function y(t){for(var e,r=t.toString(),n=/^\s+function\s+([a-zA-Z]\w+)\s*\(/gm,a=[];e=n.exec(r);)a.push(e[1]);for(var t,i=[];t=a.pop();)i.push(t+":"+t);return"{\n"+i.join(",\n")+"\n}"}var b=Array.prototype,_=b.slice,w=function(){return"[object Window]"===this.toString()}(),E=-1,k=0,C=1,S={"\n":"\\n","\t":"\\t","\f":"\\f","\r":"\\r"," ":" ","\\":"\\\\","\0":"\\0"};return{sortUnique:n,idUnique:s,hashUnique:i,Set:t,repeats:v,negate:c,coalesce:u,classify:o,parseCharset:h,chr:l,ord:f,pred:p,succ:d,toPrint:g,flatten2:m,log:x,isBrowser:w,locals:y}}),"function"!=typeof define)var define=require("amdefine")(module);if(define("NFA",["./Kit"],function(t){function e(e){e=e.compact?c(e):e;var s,o={},h=e.trans,u={};for(s=0,n=e.accepts.length;s1)throw new Error("DFA Assertion Fail!\nFrom state `"+n[a]+"` can goto to multi ε-move states!");for(var s=e.charMove,o=Object.keys(s),c=0,h=o.length;c"+x.to),E===k-1){r+=f,o=x.to;continue t}if(b=a(e,r+f,x.to,c,h),b.acceptable)return b;p=b}if(p)return p;break}return{stack:c,lastIndex:h,lastState:o,acceptable:i.accept(o)}}r=r||0;var i=this;return a(e,r,"start",[],r-1)}function s(t,e){var r=t.indexOf(e,o);return!!~r&&t[r]}function o(t,e){var r=e[0];return t>e[1]?1:t"),n=r[0].split(","),a=r[1].split(","),i[s]={from:n,to:a,charset:e[1],action:e[2],assert:e[3]};return t.compact=!1,t}return e}),"function"!=typeof define)var define=require("amdefine")(module);if(define("parse",["./NFA","./Kit"],function(t,e){function r(){var t=Object.keys(p).map(function(t){return t+"="+JSON.stringify(p[t])}).join(";");(function(){return this})().eval(t)}function n(t){this.raw=t.raw,this.tree=t.tree,this.groupCount=t.groupCount}function a(t,e){d=e;var r,a,s,p=i();r=p.input(t,0,e),a=r.stack,a=v.endChoice(a),s=r.lastState;var g=r.acceptable&&r.lastIndex===t.length-1;if(!g){var m;switch(s){case"charsetRangeEndWithNullChar":m={type:"CharsetRangeEndWithNullChar",message:"Charset range end with NUL char does not make sense!\nBecause [a-\\0] is not a valid range.\nAnd [\\0-\\0] should be rewritten into [\\0]."};break;case"repeatErrorFinal":m={type:"NothingRepeat",message:"Nothing to repeat!"};break;case"digitFollowNullError":m={type:"DigitFollowNullError",message:"The '\\0' represents the char and cannot be followed by a decimal digit!"};break;case"charsetRangeEndClass":m={type:"CharsetRangeEndClass",message:'Charset range ends with class such as "\\w\\W\\d\\D\\s\\S" is invalid!'};break;case"charsetOctEscape":m={type:"DecimalEscape",message:"Decimal escape appears in charset is invalid.Because it can't be explained as backreference.And octal escape is deprecated!"};break;default:0===s.indexOf("charset")?m={type:"UnclosedCharset",message:"Unterminated character class!"}:")"===t[r.lastIndex]?m={type:"UnmatchedParen",message:"Unmatched end parenthesis!"}:(m={type:"UnexpectedChar",message:"Unexpected char!"},r.lastIndex++)}if(m)throw m.lastIndex=r.lastIndex,m.astStack=r.stack,m.lastState=s,new f(m)}if(a._parentGroup)throw new f({type:"UnterminatedGroup",message:"Unterminated group!",lastIndex:a._parentGroup.indices[0],lastState:s,astStack:a});if(g){var x=a.groupCounter?a.groupCounter.i:0;delete a.groupCounter,h(a,t,t.length),a=o(a);var y=new n({raw:t,groupCount:x,tree:a});return y.traverse(l,CHARSET_NODE),y.traverse(u,ASSERT_NODE),c(a),d=!1,y}}function i(){return g||(g=t(E,d)),g}function s(t,e,r){Object.defineProperty(t,e,{value:r,enumerable:d,writable:!0,configurable:!0})}function o(t){return t.filter(function(t){return t.type==EXACT_NODE&&t.concatTemp?(delete t.concatTemp,!!t.chars):(t.sub?t.sub=o(t.sub):t.branches&&(t.branches=t.branches.map(o)),!0)})}function c(t){function e(t){t.sub?c(t.sub):t.branches&&t.branches.map(c)}var r=t[0];e(r);for(var n,a=1,i=1,s=t.length;at[1])throw new f({type:"OutOfOrder",lastIndex:t.lastIndex,message:"Range ["+t.join("-")+"] out of order in character class!"});return t.join("")}))}function f(t){this.name="RegexSyntaxError",this.type=t.type,this.lastIndex=t.lastIndex,this.lastState=t.lastState,this.astStack=t.astStack,this.message=t.message,Object.defineProperty(this,"stack",{value:new Error(t.message).stack,enumerable:!1})}var p={EXACT_NODE:"exact",CHARSET_NODE:"charset",CHOICE_NODE:"choice",GROUP_NODE:"group",ASSERT_NODE:"assert",DOT_NODE:"dot",BACKREF_NODE:"backref",EMPTY_NODE:"empty",AssertLookahead:"AssertLookahead",AssertNegativeLookahead:"AssertNegativeLookahead",AssertLookbehind:"AssertLookbehind",AssertNegativeLookbehind:"AssertNegativeLookbehind",AssertNonWordBoundary:"AssertNonWordBoundary",AssertWordBoundary:"AssertWordBoundary",AssertEnd:"AssertEnd",AssertBegin:"AssertBegin"};r(),n.prototype.traverse=function(t,e){function r(t,n){t.forEach(function(t){e&&t.type!==e||n(t),t.sub?r(t.sub,n):t.branches&&t.branches.forEach(function(t){r(t,n)})})}r(this.tree,t)};var d;a.Constants=p,a.exportConstants=r,a.RegexSyntaxError=f,a.getNFAParser=i;var g;f.prototype.toString=function(){return this.name+" "+this.type+":"+this.message};var m={n:"\n",r:"\r",t:"\t",v:"\v",f:"\f"},v=function(){function t(t,e,r){var n=t[0];(!n||n.type!=EXACT_NODE||n.repeat||n.chars&&!n.concatTemp)&&t.unshift({type:EXACT_NODE,indices:[r]}),n&&n.concatTemp&&(n.chars+=e)}function e(t,e,r){t.unshift({type:DOT_NODE,indices:[r]})}function r(t,e,r){t.unshift({type:EXACT_NODE,chars:"\0",indices:[r-1]})}function n(t,e,r){t.unshift({type:ASSERT_NODE,indices:[r],assertionType:AssertBegin})}function a(t,e,r,n,a){t.unshift({type:ASSERT_NODE,indices:[r],assertionType:AssertEnd})}function i(t,e,r){t.unshift({type:ASSERT_NODE,indices:[r-1],assertionType:"b"==e?AssertWordBoundary:AssertNonWordBoundary})}function o(t,e,r){t[0].type!==EXACT_NODE&&t.unshift({type:EXACT_NODE,indices:[r]})}function c(t,e,r){s(t[0],"_commaIndex",r)}function h(t,e,r,n,a){var i,s=t[0],o=a.lastIndexOf("{",r),c=parseInt(a.slice(o+1,s._commaIndex||r),10);if(s._commaIndex){if((i=s._commaIndex+1==r?1/0:parseInt(a.slice(s._commaIndex+1,r),10))=o&&t.shift(),d(t,c,i,o,a)}function u(t,e,r,n,a){d(t,0,1/0,r,a)}function l(t,e,r,n,a){d(t,0,1,r,a)}function p(t,e,r,n,a){d(t,1,1/0,r,a)}function d(t,e,r,n,a){var i=t[0],o={min:e,max:r,nonGreedy:!1,possessive:!1},c=n-1;if(i.chars&&1===i.chars.length&&(c=i.indices[0]),i.type===EXACT_NODE){var h={type:EXACT_NODE,repeat:o,chars:i.chars?i.chars:a[c],indices:[c]};i.indices[0]===c&&t.shift(),t.unshift(h)}else i.repeat=o;s(o,"beginIndex",n-t[0].indices[0])}function g(t){t[0].repeat.nonGreedy=!0}function v(t){t[0].repeat.possessive=!0}function x(t,e,r){t.unshift({concatTemp:!0,type:EXACT_NODE,chars:"",indices:[r]})}function y(t,e,r){m.hasOwnProperty(e)&&(e=m[e]),t.unshift({type:EXACT_NODE,chars:e,indices:[r-1]})}function b(t,e,r){t.unshift({type:CHARSET_NODE,indices:[r-1],chars:"",ranges:[],classes:[e],exclude:!1})}function _(t,e,r,n,a){e=String.fromCharCode(parseInt(a[r-1]+e,16)),t.shift(),t.unshift({type:EXACT_NODE,chars:e,indices:[r-3]})}function w(t,e,r,n,a){e=String.fromCharCode(parseInt(a.slice(r-3,r+1),16)),t.shift(),t.unshift({type:EXACT_NODE,chars:e,indices:[r-5]})}function E(t,e,r){var n=t.groupCounter=t.groupCounter||{i:0};n.i++;var a={type:GROUP_NODE,num:n.i,sub:[],indices:[r],_parentStack:t};return t=a.sub,s(t,"_parentGroup",a),t.groupCounter=n,t}function k(t){var e=t._parentGroup;e.nonCapture=!0,e.num=void 0,t.groupCounter.i--}function C(t,e,r,n){var a=t._parentGroup;a.type=ASSERT_NODE,a.assertionType="="==e?AssertLookahead:AssertNegativeLookahead,"groupNameStart"===n&&(a.assertionType="="===e?AssertLookbehind:AssertNegativeLookbehind),a.num=void 0,t.groupCounter.i--}function S(t){var e=t._parentGroup;e.atomicGroup=!0,e.num=void 0,t.groupCounter.i--}function B(t){t._parentGroup.nameP=!0}function A(t,e,r,n,a){var i=t._parentGroup;"groupNameStart"===n?i.name=e:"groupNameStartApos"===n?(i.name=e,i.aops=!0):i.name+=e}function N(t,e,r,n,a){t=O(t);var i=t._parentGroup;if(!i)throw new f({type:"UnexpectedChar",lastIndex:r,lastState:n,astStack:t,message:"Unexpected end parenthesis!"});return delete t._parentGroup,delete t.groupCounter,t=i._parentStack,delete i._parentStack,t.unshift(i),i.endParenIndex=r,t}function T(t,e,r){var n,a=[];if(t._parentChoice)n=t._parentChoice,n.branches.unshift(a),s(a,"_parentChoice",n),s(a,"_parentGroup",n),a.groupCounter=t.groupCounter,delete t._parentChoice,delete t.groupCounter;else{var i=t[t.length-1];n={type:CHOICE_NODE,indices:[i?i.indices[0]:r-1],branches:[]},s(n,"_parentStack",t),n.branches.unshift(t.slice()),t.length=0,t.unshift(n),a.groupCounter=t.groupCounter,s(a,"_parentChoice",n),s(a,"_parentGroup",n),n.branches.unshift(a)}return a}function O(t){if(t._parentChoice){var e=t._parentChoice;delete t._parentChoice,delete t._parentGroup,delete t.groupCounter;var r=e._parentStack;return delete e._parentStack,r}return t}function R(t,e,r){t.unshift({type:CHARSET_NODE,indices:[r],classes:[],ranges:[],chars:""})}function P(t){t[0].exclude=!0}function I(t,e,r){t[0].chars+=e}function M(t,e,r){m.hasOwnProperty(e)&&(e=m[e]),t[0].chars+=e}function F(t,e,r){t[0].chars+="\0"}function D(t,e){t[0].classes.push(e)}function L(t,e,r,n,a){var i=t[0];e=String.fromCharCode(parseInt(i.chars.slice(-1)+e,16)),i.chars=i.chars.slice(0,-2),i.chars+=e}function z(t,e,r,n,a){var i=t[0];e=String.fromCharCode(parseInt(i.chars.slice(-3)+e,16)),i.chars=i.chars.slice(0,-4),i.chars+=e}function G(t,e,r,n,a){var i=t[0],s=i.chars.slice(-2);s=[s[0],e],s.lastIndex=r,i.ranges.push(s),i.chars=i.chars.slice(0,-2)}function j(t,e){m.hasOwnProperty(e)&&(e=m[e]),G.apply(this,arguments)}function U(t,e,r){var n=t[0],a=n.chars.slice(-3)+e;n.chars=n.chars.slice(0,-3);var i=n.ranges.pop();e=String.fromCharCode(parseInt(a,16)),i=[i[0],e],i.lastIndex=r,n.ranges.push(i)}function X(t,e,r){var n=t[0],a=n.chars.slice(-1)+e;n.chars=n.chars.slice(0,-1);var i=n.ranges.pop();e=String.fromCharCode(parseInt(a,16)),i=[i[0],e],i.lastIndex=r,n.ranges.push(i)}function q(t,e,r,n){function a(t,e){return!!e._parentGroup&&(e._parentGroup.num==t?t:a(t,e._parentGroup._parentStack))}var i=t[0],s=parseInt(e,10),o="escape"===n,c=t.groupCounter,h=c&&c.i||0;if(o?(i={type:BACKREF_NODE,indices:[r-1]},t.unshift(i)):s=parseInt(i.num+""+s,10),s>h)throw new f({type:"InvalidBackReference",lastIndex:r,astStack:t,lastState:n,message:"Back reference number("+s+") greater than current groups count("+h+")."});if(a(s,t))throw new f({type:"InvalidBackReference",lastIndex:r,astStack:t,lastState:n,message:"Recursive back reference in group ("+s+") itself."});i.num=s}function H(t,e,r,n){var a=t[0];if("nameBackrefStartP"===n){var i=t._parentGroup;delete t._parentGroup,delete t.groupCounter,t=i._parentStack,delete i._parentStack,a={type:BACKREF_NODE,indices:[r-4]},t.unshift(a),a.name="",t.groupCounter.i--}else"nameBackrefStart"!==n&&"nameBackrefStartAops"!==n&&"nameBackrefStartCub"!==n||(a={type:BACKREF_NODE,indices:[r-3]},t.unshift(a),a.name="");if(a.name+=e,"nameBackrefStartP"===n)return t}return{escapeStart:x,exact:t,dot:e,nullChar:r,assertBegin:n,assertEnd:a,assertWordBoundary:i,repeatnStart:o,repeatnComma:c,repeatNonGreedy:g,repeatPossessive:v,repeatnEnd:h,repeat1:p,repeat01:l,repeat0:u,charClassEscape:b,normalEscape:y,unicodeEscape:w,hexEscape:_,charClassEscape:b,groupStart:E,groupNonCapture:k,backref:q,nameBackref:H,groupAtomicGroup:S,groupToAssertion:C,groupEnd:N,groupName:A,groupNameP:B,choice:T,endChoice:O,charsetStart:R,charsetExclude:P,charsetContent:I,charsetNullChar:F,charsetClassEscape:D,charsetHexEscape:L,charsetUnicodeEscape:z,charsetRangeEnd:G,charsetNormalEscape:M,charsetRangeEndNormalEscape:j,charsetRangeEndUnicodeEscape:U,charsetRangeEndHexEscape:X}}(),x="0-9a-fA-F",y="repeatnStart,repeatn_1,repeatn_2,repeatnErrorStart,repeatnError_1,repeatnError_2",b="hexEscape1,hexEscape2",_="unicodeEscape1,unicodeEscape2,unicodeEscape3,unicodeEscape4",w="charsetUnicodeEscape1,charsetUnicodeEscape2,charsetUnicodeEscape3,charsetUnicodeEscape4,charsetHexEscape1,charsetHexEscape2",E={compact:!0,accepts:"start,begin,end,repeat0,repeat1,exact,repeatn,repeat01,repeatNonGreedy,repeatPossessive,choice,"+y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b,trans:[["start,begin,end,exact,repeatNonGreedy,repeatPossessive,repeat0,repeat1,repeat01,groupStart,groupQualifiedStart,groupNameEnd,choice,repeatn>exact","^+*?^$.|(){[\\",v.exact],["hexEscape1,hexEscape2,unicodeEscape1,unicodeEscape2,unicodeEscape3,unicodeEscape4>exact","^+*?^$.|(){[\\0-9a-fA-F",v.exact],["nullChar>exact","^+*?^$.|(){[\\0-9",v.exact],[y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+",start,begin,end,exact,repeatNonGreedy,repeatPossessive,repeat0,repeat1,repeat01,groupStart,groupQualifiedStart,groupNameEnd,choice,repeatn>exact",".",v.dot],["start,groupStart,groupQualifiedStart,groupNameEnd,end,begin,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,repeatPossessive,choice,"+y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+">begin","^",v.assertBegin],[y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+",exact>repeatnStart","{",v.repeatnStart],["start,begin,end,groupQualifiedStart,groupNameEnd,groupStart,repeat0,repeat1,repeatn,repeat01,repeatNonGreedy,repeatPossessive,choice>repeatnErrorStart","{",v.exact],["repeatnStart>repeatn_1","0-9",v.exact],["repeatn_1>repeatn_1","0-9",v.exact],["repeatn_1>repeatn_2",",",v.repeatnComma],["repeatn_2>repeatn_2","0-9",v.exact],["repeatn_1,repeatn_2>repeatn","}",v.repeatnEnd],["repeatnStart,repeatnErrorStart>exact","}",v.exact],["repeatnStart,repeatnErrorStart>exact","^+*?^$.|(){[\\0-9}",v.exact],["repeatnErrorStart>repeatnError_1","0-9",v.exact],["repeatnError_1>repeatnError_1","0-9",v.exact],["repeatnError_1>repeatnError_2",",",v.exact],["repeatnError_2>repeatnError_2","0-9",v.exact],["repeatnError_2,repeatnError_1>repeatErrorFinal","}"],["repeatn_1,repeatnError_1>exact","^+*?^$.|(){[\\0-9,}",v.exact],["repeatn_2,repeatnError_2>exact","^+*?^$.|(){[\\0-9}",v.exact],["exact,"+y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+">repeat0","*",v.repeat0],["exact,"+y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+">repeat1","+",v.repeat1],["exact,"+y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+">repeat01","?",v.repeat01],["choice>repeatErrorFinal","*+?"],["repeat0,repeat1,repeat01,repeatn>repeatNonGreedy","?",v.repeatNonGreedy],["repeat0,repeat1,repeat01,repeatn>repeatPossessive","+",v.repeatPossessive],["repeat0,repeat1,repeat01,repeatn>repeatErrorFinal","*"],["start,begin,end,groupStart,groupQualifiedStart,groupNameEnd,exact,repeatNonGreedy,repeatPossessive,repeat0,repeat1,repeat01,repeatn,choice,"+y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+">escape","\\",v.escapeStart],["escape>nullChar","0",v.nullChar],["nullChar>digitFollowNullError","0-9"],["escape>exact","^dDwWsSux0-9bB1-9kg",v.normalEscape],["escape>exact","bB",v.assertWordBoundary],["escape>exact","dDwWsS",v.charClassEscape],["escape>unicodeEscape1","u",v.exact],["unicodeEscape1>unicodeEscape2",x,v.exact],["unicodeEscape2>unicodeEscape3",x,v.exact],["unicodeEscape3>unicodeEscape4",x,v.exact],["unicodeEscape4>exact",x,v.unicodeEscape],["escape>hexEscape1","x",v.exact],["hexEscape1>hexEscape2",x,v.exact],["hexEscape2>exact",x,v.hexEscape],["escape>digitBackref","1-9",v.backref],["digitBackref>digitBackref","0-9",v.backref],["digitBackref>exact","^+*?^$.|(){[\\0-9",v.exact],["escape>nameBackrefK","k"],["nameBackrefK>nameBackrefStart","<"],["nameBackrefStart>nameBackref","a-zA-Z_",v.nameBackref],["nameBackref>nameBackref","a-zA-Z_0-9",v.nameBackref],["nameBackref>nameBackrefEnd",">"],["nameBackrefK>nameBackrefStartAops","'"],["nameBackrefStartAops>nameBackrefAops","a-zA-Z_",v.nameBackref],["nameBackrefAops>nameBackrefAops","a-zA-Z_0-9",v.nameBackref],["nameBackrefAops>nameBackrefEnd","'"],["escape>nameBackrefG","g"],["nameBackrefK,nameBackrefG>nameBackrefStartCub","{"],["nameBackrefStartCub>nameBackrefCub","a-zA-Z_",v.nameBackref],["nameBackrefCub>nameBackrefCub","a-zA-Z_0-9",v.nameBackref],["nameBackrefCub>nameBackrefEnd","}"],["groupNameP>nameBackrefStartP","="],["nameBackrefStartP>nameBackrefP","a-zA-Z_",v.nameBackref],["nameBackrefP>nameBackrefP","a-zA-Z_0-9",v.nameBackref],["nameBackrefP>nameBackrefEnd",")"],["nameBackrefEnd>exact","^+*?^$.|(){[\\0-9",v.exact],["exact,begin,end,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,repeatPossessive,start,groupStart,groupQualifiedStart,groupNameEnd,choice,"+y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+">groupStart","(",v.groupStart],["groupStart>groupQualify","?"],["groupQualify>groupQualifiedStart",":",v.groupNonCapture],["groupQualify>groupQualifiedStart","=",v.groupToAssertion],["groupQualify>groupQualifiedStart","!",v.groupToAssertion],["groupNameStart>groupQualifiedStart","=",v.groupToAssertion],["groupNameStart>groupQualifiedStart","!",v.groupToAssertion],["groupQualify>groupQualifiedStart",">",v.groupAtomicGroup],["groupQualify>groupNameP","P",v.groupNameP],["groupQualify,groupNameP>groupNameStart","<"],["groupNameStart>groupName","a-zA-Z_",v.groupName],["groupName>groupName","a-zA-Z_0-9",v.groupName],["groupQualify>groupNameStartApos","'"],["groupNameStartApos>groupNameApos","a-zA-Z_",v.groupName],["groupNameApos>groupNameApos","a-zA-Z_0-9",v.groupName],["groupNameApos>groupNameEnd","'"],["groupName>groupNameEnd",">"],[y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+",groupStart,groupQualifiedStart,groupNameEnd,begin,end,exact,repeat1,repeat0,repeat01,repeatn,repeatNonGreedy,choice>exact",")",v.groupEnd],["start,begin,end,groupStart,groupQualifiedStart,groupNameEnd,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,repeatPossessive,choice,"+y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+">choice","|",v.choice],["start,groupStart,groupQualifiedStart,groupNameEnd,begin,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,repeatPossessive,choice,"+y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+">end","$",v.assertEnd],["exact,begin,end,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,repeatPossessive,groupQualifiedStart,groupNameEnd,groupStart,start,choice,"+y+",nullChar,digitBackref,nameBackrefEnd,"+_+","+b+">charsetStart","[",v.charsetStart],["charsetStart>charsetExclude","^",v.charsetExclude],["charsetStart>charsetContent","^\\]^",v.charsetContent],["charsetExclude>charsetContent","^\\]",v.charsetContent],["charsetContent,charsetClass>charsetContent","^\\]-",v.charsetContent],["charsetClass>charsetContent","-",v.charsetContent],[w+",charsetStart,charsetContent,charsetNullChar,charsetClass,charsetExclude,charsetRangeEnd>charsetEscape","\\"],["charsetEscape>charsetContent","^dDwWsSux0-9",v.charsetNormalEscape],["charsetEscape>charsetNullChar","0",v.charsetNullChar],["charsetEscape>charsetOctEscape","1-9"],["charsetRangeEndEscape>charsetOctEscape","1-9"],["charsetNullChar>digitFollowNullError","0-9"],["charsetNullChar>charsetContent","^0-9\\]-",v.charsetContent],["charsetEscape>charsetClass","dDwWsS",v.charsetClassEscape],["charsetEscape>charsetUnicodeEscape1","u",v.charsetContent],["charsetUnicodeEscape1>charsetUnicodeEscape2",x,v.charsetContent],["charsetUnicodeEscape2>charsetUnicodeEscape3",x,v.charsetContent],["charsetUnicodeEscape3>charsetUnicodeEscape4",x,v.charsetContent],["charsetUnicodeEscape4>charsetContent",x,v.charsetUnicodeEscape],["charsetEscape>charsetHexEscape1","x",v.charsetContent],["charsetHexEscape1>charsetHexEscape2",x,v.charsetContent],["charsetHexEscape2>charsetContent",x,v.charsetHexEscape],[w+">charsetContent","^\\]0-9a-fA-F-",v.charsetContent],[w+",charsetNullChar,charsetContent>charsetRangeStart","-",v.charsetContent],["charsetRangeStart>charsetRangeEnd","^\\]",v.charsetRangeEnd],["charsetRangeEnd>charsetContent","^\\]",v.charsetContent],["charsetRangeStart>charsetRangeEndEscape","\\"],["charsetRangeEndEscape>charsetRangeEnd","^dDwWsSux0-9bB1-9kg",v.charsetRangeEndNormalEscape],["charsetRangeEndEscape>charsetRangeEndWithNullChar","0"],["charsetRangeEndEscape>charsetRangeEndUnicodeEscape1","u",v.charsetRangeEnd],["charsetRangeEndUnicodeEscape1>charsetRangeEndUnicodeEscape2",x,v.charsetContent],["charsetRangeEndUnicodeEscape2>charsetRangeEndUnicodeEscape3",x,v.charsetContent],["charsetRangeEndUnicodeEscape3>charsetRangeEndUnicodeEscape4",x,v.charsetContent],["charsetRangeEndUnicodeEscape4>charsetRangeEnd",x,v.charsetRangeEndUnicodeEscape],["charsetRangeEndEscape>charsetRangeEndHexEscape1","x",v.charsetRangeEnd],["charsetRangeEndHexEscape1>charsetRangeEndHexEscape2",x,v.charsetContent],["charsetRangeEndHexEscape2>charsetRangeEnd",x,v.charsetRangeEndHexEscape],["charsetRangeEndEscape>charsetRangeEndClass","dDwWsS"],["charsetRangeEndUnicodeEscape1,charsetRangeEndHexEscape1>charsetContent","^\\]0-9a-fA-F",v.charsetContent],["charsetRangeEndUnicodeEscape2,charsetRangeEndUnicodeEscape3,charsetRangeEndUnicodeEscape4,charsetRangeEndHexEscape2>charsetRangeStart","-",v.charsetContent],[w+",charsetRangeEndUnicodeEscape1,charsetRangeEndHexEscape1,charsetRangeEndUnicodeEscape2,charsetRangeEndUnicodeEscape3,charsetRangeEndUnicodeEscape4,charsetRangeEndHexEscape2,charsetNullChar,charsetRangeStart,charsetContent,charsetClass,charsetExclude,charsetRangeEnd>exact","]"]]};return a}),"function"!=typeof define)var define=require("amdefine")(module);if(define("RegExp",["./parse","./Kit","./NFA"],function(t,e,r){function n(e,r){if(!(this instanceof n))return new n(e,r);e+="";var o={};"string"==typeof r?(r=r.toLowerCase(),~r.indexOf("i")&&(o.ignoreCase=!0),~r.indexOf("m")&&(o.multiline=!0),~r.indexOf("g")&&(o.global=!0),~r.indexOf("d")&&(o.debug=!0)):o=r;var c=this.ast=t(e);this.source=e,this.multiline=!!o.multiline,this.global=!!o.global,this.ignoreCase=!!o.ignoreCase,this.debug=!!o.debug,this.flags="",this.multiline&&(this.flags+="m"),this.ignoreCase&&(this.flags+="i"),this.global&&(this.flags+="g"),p(this,["source","options","multiline","global","ignoreCase","flags","debug"]);var h=this.ignoreCase;c.traverse(function(t){s(t,h)},CHARSET_NODE),c.traverse(function(t){a(t,h)},EXACT_NODE), +this.multiline&&c.traverse(i,ASSERT_NODE)}function a(t,e){var r;r=t.chars.split(""),r=e?r.map(function(t){return/[a-z]/.test(t)?[t,t.toUpperCase()]:/[A-Z]/.test(t)?[t,t.toLowerCase()]:[t]}):r.map(function(t){return[t]}),t.explained=r}function i(t){var e=t.assertionType;e!==AssertBegin&&e!==AssertEnd||(t.multiline=!0)}function s(t,r){var n=t.chars.split("");n=n.concat(e.flatten2(t.classes.map(function(t){return g[t]}))),n=n.concat(t.ranges),r&&(n=o(n)),n=e.classify(n).ranges,t.exclude&&(n=e.negate(n)),n=e.coalesce(n),t.explained=n}function o(t){return e.flatten2(t.map(function(t){var r=e.classify([t,"az","AZ"]).map[t];return e.flatten2(r.map(function(t){return/[a-z]/.test(t)?[t,t.toUpperCase()]:/[A-Z]/.test(t)?[t,t.toLowerCase()]:[t]}))}))}function c(t,e){var r,n=[];return e=e||["start"],r=t.reduce(function(t,e){var r=h(e,t);return n=n.concat(r.trans),r.accepts},e),{accepts:r,trans:n}}function h(t,e){return t.repeat?f(t,e):y[t.type](t,e)}function u(t,e,r){for(var n,a,i,s=0,o=t.length;so;c--)r=a(t,e),h=h.concat(r.trans),e=r.accepts,u=u.concat(r.accepts);else{var f=e.slice();r=a(t,e),h=h.concat(r.trans),u=u.concat(r.accepts),h.push({from:r.accepts,to:f,charset:!1})}var p=[l()];return s.nonGreedy||s.possessive?(i.push({from:u,to:p,charset:!1}),i=i.concat(h)):(i=i.concat(h),i.push({from:u,to:p,charset:!1})),{accepts:p,trans:i}}function p(t,e){e.forEach(function(e){Object.defineProperty(t,e,{writable:!1,enumerable:!0})})}t.exportConstants(),n.DEBUG=n.D=1,n.MULTILINE=n.M=2,n.GLOBAL=n.G=4,n.IGNORECASE=n.I=8,n.prototype={toString:function(){return"/"+this.source+"/"+this.flags},test:function(t){return null!==this.exec(t)},exec:function(t){for(var e,r=this.getNFA(),n=this.global?this.lastIndex||0:0,a=t.length;n1?Math.max.apply(Math,o.map(function(t){return t.length})):n.length,i*=s.width;return{label:{type:"text",x:t,y:e-c/2-4,text:n,"font-size":b,"font-family":E,fill:a||"#444"},x:t-i/2,y:e-c-4,width:i,height:c+4}}function u(t,e,r){return{type:"path",x:t,y:e,path:["M",t,e,"H",r],"stroke-linecap":"butt","stroke-linejoin":"round",stroke:"#333","stroke-width":2,_translate:function(t,e){var r=this.path;r[1]+=t,r[2]+=e,r[4]+=t}}}function l(t,e,r,n){var a,i,s=t>r?-1:1,o=e>n?-1:1;return Math.abs(e-n)<15?(a=["M",t,e,"C",t+Math.min(Math.abs(r-t)/2,10)*s,e,r-(r-t)/2,n,r,n],i=function(t,e){var r=this.path;r[1]+=t,r[2]+=e,r[4]+=t,r[5]+=e,r[6]+=t,r[7]+=e,r[8]+=t,r[9]+=e}):(a=["M",t,e,"Q",t+10*s,e,t+10*s,e+10*o,"V",Math.abs(e-n)<20?e+10*o:n-10*o,"Q",t+10*s,n,t+10*s*2,n,"H",r],i=function(t,e){var r=this.path;r[1]+=t,r[2]+=e,r[4]+=t,r[5]+=e,r[6]+=t,r[7]+=e,r[9]+=e,r[11]+=t,r[12]+=e,r[13]+=t,r[14]+=e,r[16]+=t}),{type:"path",path:a,"stroke-linecap":"butt","stroke-linejoin":"round",stroke:"#333","stroke-width":2,_translate:i}}function f(t,e,r){return{items:[{type:"circle",fill:r,cx:t+10,cy:e,r:10,stroke:"none",_translate:function(t,e){this.cx+=t,this.cy+=e}}],width:20,height:20,x:t,y:e,lineInX:t,lineOutX:t+20}}function p(t){if(Array.isArray(t)){for(var e=t,r=0;r")):e.name&&r.push(m("?"+(e.nameP?"P":"")+(e.aops?"'":"<")+e.name+(e.aops?"'":">"))),r=r.concat(d(e.sub)),r.push(m(")"));else if(e.branches)e.branches.map(d).forEach(function(t){r=r.concat(t),r.push(m("|"))}),r.pop();else{var n=A[e.type]||A.defaults;switch(e.type){case CHARSET_NODE:var a=v(e);(!a||e.exclude)&&r.push(m("[")),e.exclude&&r.push(m("^",A.charsetExclude)),e.ranges.forEach(function(t){r.push(m(g(t[0]+"-"+t[1]),A.charsetRange))}),e.classes.forEach(function(t){r.push(m("\\"+t,A.charsetClass))}),r.push(m(g(e.chars),A.charsetChars)),(!a||e.exclude)&&r.push(m("]"));break;default:var i=e.raw||"";e.repeat&&(i=i.slice(0,e.repeat.beginIndex)),i=t.toPrint(i,!0),r.push(m(i,n))}}if(e.repeat){var s=e.repeat.min,o=e.repeat.max;0===s&&o===1/0?r.push(m("*")):1===s&&o===1/0?r.push(m("+")):0===s&&1===o?r.push(m("?")):(r.push(m("{")),r.push(m(s)),s===o?r.push(m("}")):(r.push(m(",")),isFinite(o)&&r.push(m(o)),r.push(m("}")))),e.repeat.nonGreedy?r.push(m("?",A.repeatNonGreedy)):e.repeat.possessive&&r.push(m("+",A.repeatPossessive))}}),r}function g(e){return e=t.toPrint(e),e.replace(/\[/g,"\\[").replace(/\]/g,"\\]")}function m(t,e){return e=e||A[t]||A.defaults,{type:"text","font-size":y,"font-family":E,text:t+"",fill:e,"text-anchor":"start","font-weight":"bold"}}function v(t){return!t.chars&&!t.ranges.length&&1===t.classes.length}e.exportConstants();var x,y=16,b=14,_=16,w="#EEE",E="DejaVu Sans Mono,monospace",k=!1,C=10,S={},B={startPoint:function(t,e,r){return f(e,r,"r(0.5,0.5)#EFE-green")},endPoint:function(t,e,r){return f(e,r,"r(0.5,0.5)#FFF-#000")},empty:function(t,e,r){return{items:[u(e,r,e+10)],width:10,height:2,x:e,y:r,lineInX:e,lineOutX:e+10}},exact:function(t,e,r){return c(t.chars,e,r,"skyblue")},dot:function(t,e,r){var n=c("AnyCharExceptNewLine",e,r,"DarkGreen","white");return n.rect.r=10,n.rect.tip="AnyChar except CR LF",n},backref:function(t,e,r){var n=c("Backref "+(void 0!==t.name?t.name:"#"+t.num),e,r,"navy","white");return n.rect.r=8,n},repeat:function(t,e,r){function n(t){return t+(t<2?" time":" times")}function a(t,e){var r=this.path;r[1]+=t,r[2]+=e,r[4]+=t,r[5]+=e,r[6]+=t,r[7]+=e,r[9]+=e,r[11]+=t,r[12]+=e,r[13]+=t,r[14]+=e,r[16]+=t,r[18]+=t,r[19]+=e,r[20]+=t,r[21]+=e,r[23]+=e,r[25]+=t,r[26]+=e,r[27]+=t,r[28]+=e}if(p(t))return B.empty(null,e,r);var i=t.repeat,o="",c=[];if(i.min===i.max&&0===i.min)return B.empty(null,e,r);var u=B[t.type](t,e,r),l=u.width,f=u.height;if(i.min===i.max&&1===i.min)return u;i.min===i.max?o+=n(i.min):(o+=i.min,isFinite(i.max)?o+=(i.max-i.min>1?" to ":" or ")+n(i.max):o+=" or more times");var d=10,g=0,m=10,v=u.y+u.height-r,x=20+u.width;l=x;var y;1!==i.max?(v+=10,f+=10,y={type:"path",path:["M",u.x+10,r,"Q",e,r,e,r+m,"V",r+v-m,"Q",e,r+v,e+m,r+v,"H",e+x-m,"Q",e+x,r+v,e+x,r+v-m,"V",r+m,"Q",e+x,r,u.x+u.width+10,r],_translate:a,stroke:"maroon","stroke-width":2},i.nonGreedy?(y.stroke="Brown",y["stroke-dasharray"]="-"):i.possessive&&(y.stroke="Sienna",y["stroke-dasharray"]="-"),c.push(y)):o=!1;var b;if(0===i.min){var _=r-u.y+10,w=x+20;d+=10,g=-12,l=w,f+=10,b={type:"path",path:["M",e,r,"Q",e+m,r,e+m,r-m,"V",r-_+m,"Q",e+m,r-_,e+20,r-_,"H",e+w-20,"Q",e+w-m,r-_,e+w-m,r-_+m,"V",r-m,"Q",e+w-m,r,e+w,r],_translate:a,stroke:i.nonGreedy?"darkgreen":i.possessive?"lightgreen":"#333","stroke-width":2},y&&s([y],10,0),c.push(b)}if(o){var E=h(e+l/2,r,o);s([E.label],0,v+E.height+4),c.push(E.label),f+=4+E.height;var k=(Math.max(E.width,l)-l)/2;k&&s(c,k,0),l=Math.max(E.width,l),d+=k}return s(u.items,d,0),c=c.concat(u.items),{items:c,width:l,height:f,x:e,y:u.y+g,lineInX:u.lineInX+d,lineOutX:u.lineOutX+d}},choice:function(t,e,r){if(p(t))return B.empty(null,e,r);var n=0,a=0,i=t.branches.map(function(t){var i=o(t,e,r);return n+=i.height,a=Math.max(a,i.width),i});n+=6*(i.length-1)+8,a+=40;var c=e+a/2,h=r-n/2+4,f=e+a,d=[];return i.forEach(function(t){var n=c-t.width/2;s(t.items,n-t.x,h-t.y),d=d.concat(t.items);var i=r+h-t.y,o=l(e,r,e+20,i),p=l(f,r,e+a-20,i);d.push(o,p),e+20!==n-t.x+t.lineInX&&d.push(u(e+20,i,n-t.x+t.lineInX)),t.lineOutX+n-t.x!=e+a-20&&d.push(u(t.lineOutX+n-t.x,i,e+a-20)),t.x=n,t.y=h,h+=t.height+6}),{items:d,width:a,height:n,x:e,y:r-n/2,lineInX:e,lineOutX:f}},charset:function(t,e,r){var n={d:"Digit",D:"NonDigit",w:"Word",W:"NonWord",s:"WhiteSpace",S:"NonWhiteSpace"},a=t.exclude?"Pink":"Khaki",i=t.exclude?"#C00":"";if(v(t)){var o=c(n[t.classes[0]],e,r,"Green","white");if(o.rect.r=5,t.exclude){var u=h(o.x+o.width/2,o.y,"None of:",i),l=o.items;l.push(u.label);var f=o.width,p=Math.max(u.width,o.width),d=(p-f)/2;return s(l,d,0),{items:l,width:p,height:o.height+u.height,x:Math.min(u.x,o.x),y:u.y,lineInX:d+o.x,lineOutX:d+o.x+o.width}}return o}if(!t.chars&&!t.ranges.length&&!t.classes.length){var o=c("AnyChar",e,r,"green","white");return o.rect.r=5,o}var g,m,x=[],p=0,y=0;t.chars&&(g=c(t.chars,e,r,"LightSkyBlue","black"),g.rect.r=5,x.push(g),p=g.width),t.ranges.forEach(function(t){t=t.split("").join("-");var n=c(t,e,r,"teal","white");n.rect.r=5,x.push(n),p=Math.max(n.width,p)}),t.classes.forEach(function(t){var a=c(n[t],e,r,"Green","white");a.rect.r=5,x.push(a),p=Math.max(a.width,p)}),m=x[0].height;var b=[],_=[];x.sort(function(t,e){return e.width-t.width}),x.forEach(function(t){2*t.width+4>p?b.push(t):_.push(t)}),x=b;for(var w,E;_.length;){if(w=_.pop(),!(E=_.pop())){x.push(w);break}w.width-E.width>2?(x.push(w),_.push(E)):(s(E.items,w.width+4,0),x.push({items:w.items.concat(E.items),width:w.width+E.width+4,height:w.height,x:w.x,y:w.y}),y-=w.height)}p+=12,y=4*(x.length-1)+x.length*m+12;var k={type:"rect",x:e,y:r-y/2,r:4,width:p,height:y,stroke:"none",fill:a},C=k.y+6,l=[k];x.forEach(function(t){s(t.items,e-t.x+(p-t.width)/2,C-t.y),l=l.concat(t.items),C+=t.height+4});var u=h(k.x+k.width/2,k.y,(t.exclude?"None":"One")+" of:",i);l.push(u.label);var f=p;p=Math.max(u.width,p);var d=(p-f)/2;return s(l,d,0),{items:l,width:p,height:y+u.height,x:Math.min(u.x,e),y:u.y,lineInX:d+e,lineOutX:d+e+k.width}},group:function(t,e,r){if(p(t))return B.empty(null,e,r);var n=o(t.sub,e,r);if(t.num){s(n.items,10,0);var a=n.width+20,i=n.height+20,c={type:"rect",x:e,y:n.y-10,r:6,width:a,height:i,"stroke-dasharray":".",stroke:"silver","stroke-width":2},u=h(c.x+c.width/2,c.y-2,"Group "+(t.name?t.name+", ":"")+"# "+t.num),l=n.items.concat([c,u.label]),f=Math.max(u.width,a),d=(f-a)/2;return d&&s(l,d,0),{items:l,width:f,height:i+u.height+4,x:e,y:u.y,lineInX:d+n.lineInX+10,lineOutX:d+n.lineOutX+10}}return n},assert:function(t,e,r){var n,a={AssertNonWordBoundary:{bg:"maroon",fg:"white"},AssertWordBoundary:{bg:"purple",fg:"white"},AssertEnd:{bg:"Indigo",fg:"white"},AssertBegin:{bg:"Indigo",fg:"white"}},i=t.assertionType,o=i.replace("Assert","")+"!";if(n=a[i])return!k||"AssertBegin"!==i&&"AssertEnd"!==i||(o="Line"+o),c(o,e,r,n.bg,n.fg);var u,l;i===AssertLookahead?(u="CornflowerBlue",l="darkgreen",o="Followed by:"):i===AssertNegativeLookahead?(u="#F63",l="Purple",o="Not followed by:"):i===AssertLookbehind?(u="LightSeaGreen",l="Brown",o="Preceded by:"):i===AssertNegativeLookbehind&&(u="#F69",l="MediumVioletRed",o="Not preceded by:");var f=B.group(t,e,r),p=f.height+16,d=f.width+16,g={type:"rect",x:e,y:f.y-8,r:6,width:d,height:p,"stroke-dasharray":"-",stroke:u,"stroke-width":2},m=h(g.x+d/2,g.y,o,l),v=Math.max(d,m.width),x=(v-d)/2;return s(f.items,x+8,0),x&&s([g,m.label],x,0),{items:f.items.concat([g,m.label]),width:v,height:g.height+m.height,x:e,y:m.y,lineInX:x+f.lineInX+8,lineOutX:x+f.lineOutX+8}}},A={delimiter:"Indigo",flags:"darkgreen",exact:"#334",dot:"darkblue",backref:"teal",$:"purple","^":"purple","\\b":"#F30","\\B":"#F30","(":"blue",")":"blue","?=":"darkgreen","?!":"red","?=1e3&&delete o[c.shift()],c.push(s),o[s]=t[N](e,i),r?r(o[s]):o[s])}return n}function s(){return this.hex}function o(t,e){for(var r=[],n=0,a=t.length;a-2*!e>n;n+=2){var i=[{x:+t[n-2],y:+t[n-1]},{x:+t[n],y:+t[n+1]},{x:+t[n+2],y:+t[n+3]},{x:+t[n+4],y:+t[n+5]}];e?n?a-4==n?i[3]={x:+t[0],y:+t[1]}:a-2==n&&(i[2]={x:+t[0],y:+t[1]},i[3]={x:+t[2],y:+t[3]}):i[0]={x:+t[a-2],y:+t[a-1]}:a-4==n?i[3]=i[2]:n||(i[0]={x:+t[n],y:+t[n+1]}),r.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[2].y])}return r}function c(t,e,r,n,a){return t*(t*(-3*e+9*r-9*n+3*a)+6*e-12*r+6*n)-3*e+3*r}function h(t,e,r,n,a,i,s,o,h){null==h&&(h=1),h=h>1?1:h<0?0:h;for(var u=h/2,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],p=0,d=0;d<12;d++){var g=u*l[d]+u,m=c(g,t,r,a,s),v=c(g,e,n,i,o),x=m*m+v*v;p+=f[d]*z.sqrt(x)}return u*p}function u(t,e,r,n,a,i,s,o,c){if(!(c<0||h(t,e,r,n,a,i,s,o).01;)l/=2,f+=(uG(a,s)||G(e,n)G(i,o))){var c=(t*n-e*r)*(a-s)-(t-r)*(a*o-i*s),h=(t*n-e*r)*(i-o)-(e-n)*(a*o-i*s),u=(t-r)*(i-o)-(e-n)*(a-s);if(u){var l=c/u,f=h/u,p=+l.toFixed(2),d=+f.toFixed(2);if(!(p<+j(t,r).toFixed(2)||p>+G(t,r).toFixed(2)||p<+j(a,s).toFixed(2)||p>+G(a,s).toFixed(2)||d<+j(e,n).toFixed(2)||d>+G(e,n).toFixed(2)||d<+j(i,o).toFixed(2)||d>+G(i,o).toFixed(2)))return{x:l,y:f}}}}function f(t,e,n){var a=r.bezierBBox(t),i=r.bezierBBox(e);if(!r.isBBoxIntersect(a,i))return n?0:[];for(var s=h.apply(0,t),o=h.apply(0,e),c=G(~~(s/5),1),u=G(~~(o/5),1),f=[],p=[],d={},g=n?0:[],m=0;m=0&&S<=1.001&&B>=0&&B<=1.001&&(n?g++:g.push({x:C.x,y:C.y,t1:j(S,1),t2:j(B,1)}))}}return g}function p(t,e,n){t=r._path2curve(t),e=r._path2curve(e);for(var a,i,s,o,c,h,u,l,p,d,g=n?0:[],m=0,v=t.length;mn)return n;for(;ri?r=a:n=a,a=(n-r)/2+r}return a}var c=3*e,h=3*(n-e)-c,u=1-c-h,l=3*r,f=3*(a-r)-l,p=1-l-f;return function(t,e){var r=o(t,e);return((p*r+f)*r+l)*r}(t,1/(200*i))}function v(t,e){var r=[],n={};if(this.ms=e,this.times=1,t){for(var a in t)t[C](a)&&(n[K(a)]=t[a],r.push(K(a)));r.sort(ut)}this.anim=n,this.top=r[r.length-1],this.percents=r}function x(t,n,a,i,s,o){a=K(a);var c,h,u,l,f,p,g=t.ms,v={},x={},y={};if(i)for(_=0,E=oe.length;_i*t.top){a=t.percents[_],f=t.percents[_-1]||0,g=g/t.top*(a-f),l=t.percents[_+1],c=t.anim[a];break}i&&n.attr(t.anim[t.percents[_]])}if(c){if(h)h.initstatus=i,h.start=new Date-h.ms*i;else{for(var k in c)if(c[C](k)&&(rt[C](k)||n.paper.customAttributes[C](k)))switch(v[k]=n.attr(k),null==v[k]&&(v[k]=et[k]),x[k]=c[k],rt[k]){case H:y[k]=(x[k]-v[k])/g;break;case"colour":v[k]=r.getRGB(v[k]);var S=r.getRGB(x[k]);y[k]={r:(S.r-v[k].r)/g,g:(S.g-v[k].g)/g,b:(S.b-v[k].b)/g};break;case"path":var B=Mt(v[k],x[k]),A=B[1];for(v[k]=B[0],y[k]=[],_=0,E=v[k].length;_',vt=xt.firstChild,vt.style.behavior="url(#default#VML)",!vt||"object"!=typeof vt.adj)return r.type=R;xt=null}r.svg=!(r.vml="VML"==r.type),r._Paper=A,r.fn=_=A.prototype=r.prototype,r._id=0,r._oid=0,r.is=function(t,e){return e=L.call(e),"finite"==e?!Y[C](+t):"array"==e?t instanceof Array:"null"==e&&null===t||e==typeof t&&null!==t||"object"==e&&t===Object(t)||"array"==e&&Array.isArray&&Array.isArray(t)||V.call(t).slice(8,-1).toLowerCase()==e}, +r.angle=function(t,e,n,a,i,s){if(null==i){var o=t-n,c=e-a;return o||c?(180+180*z.atan2(-c,-o)/q+360)%360:0}return r.angle(t,e,i,s)-r.angle(n,a,i,s)},r.rad=function(t){return t%360*q/180},r.deg=function(t){return 180*t/q%360},r.snapTo=function(t,e,n){if(n=r.is(n,"finite")?n:10,r.is(t,W)){for(var a=t.length;a--;)if(U(t[a]-e)<=n)return t[a]}else{t=+t;var i=e%t;if(it-n)return e-i+t}return e};r.createUUID=function(t,e){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(t,e).toUpperCase()}}(/[xy]/g,function(t){var e=16*z.random()|0;return("x"==t?e:3&e|8).toString(16)});r.setWindow=function(t){e("raphael.setWindow",r,S.win,t),S.win=t,S.doc=S.win.document,r._engine.initWin&&r._engine.initWin(S.win)};var yt=function(t){if(r.vml){var e,n=/^\s+|\s+$/g;try{var a=new ActiveXObject("htmlfile");a.write(""),a.close(),e=a.body}catch(t){e=createPopup().document.body}var s=e.createTextRange();yt=i(function(t){try{e.style.color=I(t).replace(n,R);var r=s.queryCommandValue("ForeColor");return r=(255&r)<<16|65280&r|(16711680&r)>>>16,"#"+("000000"+r.toString(16)).slice(-6)}catch(t){return"none"}})}else{var o=S.doc.createElement("i");o.title="Raphaël Colour Picker",o.style.display="none",S.doc.body.appendChild(o),yt=i(function(t){return o.style.color=t,S.doc.defaultView.getComputedStyle(o,R).getPropertyValue("color")})}return yt(t)},bt=function(){return"hsb("+[this.h,this.s,this.b]+")"},_t=function(){return"hsl("+[this.h,this.s,this.l]+")"},wt=function(){return this.hex},Et=function(t,e,n){if(null==e&&r.is(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(n=t.b,e=t.g,t=t.r),null==e&&r.is(t,"string")){var a=r.getRGB(t);t=a.r,e=a.g,n=a.b}return(t>1||e>1||n>1)&&(t/=255,e/=255,n/=255),[t,e,n]},kt=function(t,e,n,a){t*=255,e*=255,n*=255;var i={r:t,g:e,b:n,hex:r.rgb(t,e,n),toString:wt};return r.is(a,"finite")&&(i.opacity=a),i};r.color=function(t){var e;return r.is(t,"object")&&"h"in t&&"s"in t&&"b"in t?(e=r.hsb2rgb(t),t.r=e.r,t.g=e.g,t.b=e.b,t.hex=e.hex):r.is(t,"object")&&"h"in t&&"s"in t&&"l"in t?(e=r.hsl2rgb(t),t.r=e.r,t.g=e.g,t.b=e.b,t.hex=e.hex):(r.is(t,"string")&&(t=r.getRGB(t)),r.is(t,"object")&&"r"in t&&"g"in t&&"b"in t?(e=r.rgb2hsl(t),t.h=e.h,t.s=e.s,t.l=e.l,e=r.rgb2hsb(t),t.v=e.b):(t={hex:"none"},t.r=t.g=t.b=t.h=t.s=t.v=t.l=-1)),t.toString=wt,t},r.hsb2rgb=function(t,e,r,n){this.is(t,"object")&&"h"in t&&"s"in t&&"b"in t&&(r=t.b,e=t.s,t=t.h,n=t.o),t*=360;var a,i,s,o,c;return t=t%360/60,c=r*e,o=c*(1-U(t%2-1)),a=i=s=r-c,t=~~t,a+=[c,o,0,0,o,c][t],i+=[o,c,c,o,0,0][t],s+=[0,0,o,c,c,o][t],kt(a,i,s,n)},r.hsl2rgb=function(t,e,r,n){this.is(t,"object")&&"h"in t&&"s"in t&&"l"in t&&(r=t.l,e=t.s,t=t.h),(t>1||e>1||r>1)&&(t/=360,e/=100,r/=100),t*=360;var a,i,s,o,c;return t=t%360/60,c=2*e*(r<.5?r:1-r),o=c*(1-U(t%2-1)),a=i=s=r-c/2,t=~~t,a+=[c,o,0,0,o,c][t],i+=[o,c,c,o,0,0][t],s+=[0,0,o,c,c,o][t],kt(a,i,s,n)},r.rgb2hsb=function(t,e,r){r=Et(t,e,r),t=r[0],e=r[1],r=r[2];var n,a,i,s;return i=G(t,e,r),s=i-j(t,e,r),n=0==s?null:i==t?(e-r)/s:i==e?(r-t)/s+2:(t-e)/s+4,n=(n+360)%6*60/360,a=0==s?0:s/i,{h:n,s:a,b:i,toString:bt}},r.rgb2hsl=function(t,e,r){r=Et(t,e,r),t=r[0],e=r[1],r=r[2];var n,a,i,s,o,c;return s=G(t,e,r),o=j(t,e,r),c=s-o,n=0==c?null:s==t?(e-r)/c:s==e?(r-t)/c+2:(t-e)/c+4,n=(n+360)%6*60/360,i=(s+o)/2,a=0==c?0:i<.5?c/(2*i):c/(2-2*i),{h:n,s:a,l:i,toString:_t}},r._path2string=function(){return this.join(",").replace(it,"$1")};r._preload=function(t,e){var r=S.doc.createElement("img");r.style.cssText="position:absolute;left:-9999em;top:-9999em",r.onload=function(){e.call(this),this.onload=null,S.doc.body.removeChild(this)},r.onerror=function(){S.doc.body.removeChild(this)},S.doc.body.appendChild(r),r.src=t};r.getRGB=i(function(t){if(!t||(t=I(t)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:s};if("none"==t)return{r:-1,g:-1,b:-1,hex:"none",toString:s};!(at[C](t.toLowerCase().substring(0,2))||"#"==t.charAt())&&(t=yt(t));var e,n,a,i,o,c,h=t.match(Q);return h?(h[2]&&(a=J(h[2].substring(5),16),n=J(h[2].substring(3,5),16),e=J(h[2].substring(1,3),16)),h[3]&&(a=J((o=h[3].charAt(3))+o,16),n=J((o=h[3].charAt(2))+o,16),e=J((o=h[3].charAt(1))+o,16)),h[4]&&(c=h[4][M](nt),e=K(c[0]),"%"==c[0].slice(-1)&&(e*=2.55),n=K(c[1]),"%"==c[1].slice(-1)&&(n*=2.55),a=K(c[2]),"%"==c[2].slice(-1)&&(a*=2.55),"rgba"==h[1].toLowerCase().slice(0,4)&&(i=K(c[3])),c[3]&&"%"==c[3].slice(-1)&&(i/=100)),h[5]?(c=h[5][M](nt),e=K(c[0]),"%"==c[0].slice(-1)&&(e*=2.55),n=K(c[1]),"%"==c[1].slice(-1)&&(n*=2.55),a=K(c[2]),"%"==c[2].slice(-1)&&(a*=2.55),("deg"==c[0].slice(-3)||"°"==c[0].slice(-1))&&(e/=360),"hsba"==h[1].toLowerCase().slice(0,4)&&(i=K(c[3])),c[3]&&"%"==c[3].slice(-1)&&(i/=100),r.hsb2rgb(e,n,a,i)):h[6]?(c=h[6][M](nt),e=K(c[0]),"%"==c[0].slice(-1)&&(e*=2.55),n=K(c[1]),"%"==c[1].slice(-1)&&(n*=2.55),a=K(c[2]),"%"==c[2].slice(-1)&&(a*=2.55),("deg"==c[0].slice(-3)||"°"==c[0].slice(-1))&&(e/=360),"hsla"==h[1].toLowerCase().slice(0,4)&&(i=K(c[3])),c[3]&&"%"==c[3].slice(-1)&&(i/=100),r.hsl2rgb(e,n,a,i)):(h={r:e,g:n,b:a,toString:s},h.hex="#"+(16777216|a|n<<8|e<<16).toString(16).slice(1),r.is(i,"finite")&&(h.opacity=i),h)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:s}},r),r.hsb=i(function(t,e,n){return r.hsb2rgb(t,e,n).hex}),r.hsl=i(function(t,e,n){return r.hsl2rgb(t,e,n).hex}),r.rgb=i(function(t,e,r){return"#"+(16777216|r|e<<8|t<<16).toString(16).slice(1)}),r.getColor=function(t){var e=this.getColor.start=this.getColor.start||{h:0,s:1,b:t||.75},r=this.hsb2rgb(e.h,e.s,e.b);return e.h+=.075,e.h>1&&(e.h=0,e.s-=.2,e.s<=0&&(this.getColor.start={h:0,s:1,b:e.b})),r.hex},r.getColor.reset=function(){delete this.start},r.parsePathString=function(t){if(!t)return null;var e=Ct(t);if(e.arr)return Bt(e.arr);var n={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},a=[];return r.is(t,W)&&r.is(t[0],W)&&(a=Bt(t)),a.length||I(t).replace(st,function(t,e,r){var i=[],s=e.toLowerCase();if(r.replace(ct,function(t,e){e&&i.push(+e)}),"m"==s&&i.length>2&&(a.push([e][T](i.splice(0,2))),s="l",e="m"==e?"l":"L"),"r"==s)a.push([e][T](i));else for(;i.length>=n[s]&&(a.push([e][T](i.splice(0,n[s]))),n[s]););}),a.toString=r._path2string,e.arr=Bt(a),a},r.parseTransformString=i(function(t){if(!t)return null;var e=[];return r.is(t,W)&&r.is(t[0],W)&&(e=Bt(t)),e.length||I(t).replace(ot,function(t,r,n){var a=[];L.call(r);n.replace(ct,function(t,e){e&&a.push(+e)}),e.push([r][T](a))}),e.toString=r._path2string,e});var Ct=function(t){var e=Ct.ps=Ct.ps||{};return e[t]?e[t].sleep=100:e[t]={sleep:100},setTimeout(function(){for(var r in e)e[C](r)&&r!=t&&!--e[r].sleep&&delete e[r]}),e[t]};r.findDotsAtSegment=function(t,e,r,n,a,i,s,o,c){var h=1-c,u=X(h,3),l=X(h,2),f=c*c,p=f*c,d=u*t+3*l*c*r+3*h*c*c*a+p*s,g=u*e+3*l*c*n+3*h*c*c*i+p*o,m=t+2*c*(r-t)+f*(a-2*r+t),v=e+2*c*(n-e)+f*(i-2*n+e),x=r+2*c*(a-r)+f*(s-2*a+r),y=n+2*c*(i-n)+f*(o-2*i+n),b=h*t+c*r,_=h*e+c*n,w=h*a+c*s,E=h*i+c*o,k=90-180*z.atan2(m-x,v-y)/q;return(m>x||v=t.x&&e<=t.x2&&r>=t.y&&r<=t.y2},r.isBBoxIntersect=function(t,e){var n=r.isPointInsideBBox;return n(e,t.x,t.y)||n(e,t.x2,t.y)||n(e,t.x,t.y2)||n(e,t.x2,t.y2)||n(t,e.x,e.y)||n(t,e.x2,e.y)||n(t,e.x,e.y2)||n(t,e.x2,e.y2)||(t.xe.x||e.xt.x)&&(t.ye.y||e.yt.y)},r.pathIntersection=function(t,e){return p(t,e)},r.pathIntersectionNumber=function(t,e){return p(t,e,1)},r.isPointInsidePath=function(t,e,n){var a=r.pathBBox(t);return r.isPointInsideBBox(a,e,n)&&p(t,[["M",e,n],["H",a.x2+10]],1)%2==1},r._removedFactory=function(t){return function(){e("raphael.log",null,"Raphaël: you are calling to method “"+t+"” of removed object",t)}};var St=r.pathBBox=function(t){var e=Ct(t);if(e.bbox)return n(e.bbox);if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0};t=Mt(t);for(var r,a=0,i=0,s=[],o=[],c=0,h=t.length;c1&&(x=z.sqrt(x),r*=x,n*=x);var y=r*r,b=n*n,_=(s==o?-1:1)*z.sqrt(U((y*b-y*v*v-b*m*m)/(y*v*v+b*m*m))),w=_*r*v/n+(t+c)/2,E=_*-n*m/r+(e+h)/2,k=z.asin(((e-E)/n).toFixed(9)),C=z.asin(((h-E)/n).toFixed(9));k=tC&&(k-=2*q),!o&&C>k&&(C-=2*q)}var S=C-k;if(U(S)>f){var B=C,A=c,N=h;C=k+f*(o&&C>k?1:-1),c=w+r*z.cos(C),h=E+n*z.sin(C),d=Rt(c,h,r,n,a,0,o,A,N,[C,B,w,E])}S=C-k;var O=z.cos(k),R=z.sin(k),P=z.cos(C),I=z.sin(C),F=z.tan(S/4),D=4/3*r*F,L=4/3*n*F,G=[t,e],j=[t+D*R,e-L*O],X=[c+D*I,h-L*P],H=[c,h];if(j[0]=2*G[0]-j[0],j[1]=2*G[1]-j[1],u)return[j,X,H][T](d);d=[j,X,H][T](d).join()[M](",");for(var W=[],V=0,Q=d.length;V"1e12"&&(f=.5),U(p)>"1e12"&&(p=.5),f>0&&f<1&&(c=Pt(t,e,r,n,a,i,s,o,f),g.push(c.x),d.push(c.y)),p>0&&p<1&&(c=Pt(t,e,r,n,a,i,s,o,p),g.push(c.x),d.push(c.y)),h=i-2*n+e-(o-2*i+n),u=2*(n-e)-2*(i-n),l=e-n,f=(-u+z.sqrt(u*u-4*h*l))/2/h,p=(-u-z.sqrt(u*u-4*h*l))/2/h,U(f)>"1e12"&&(f=.5),U(p)>"1e12"&&(p=.5),f>0&&f<1&&(c=Pt(t,e,r,n,a,i,s,o,f),g.push(c.x),d.push(c.y)),p>0&&p<1&&(c=Pt(t,e,r,n,a,i,s,o,p),g.push(c.x),d.push(c.y)),{min:{x:j[N](0,g),y:j[N](0,d)},max:{x:G[N](0,g),y:G[N](0,d)}}}),Mt=r._path2curve=i(function(t,e){var r=!e&&Ct(t);if(!e&&r.curve)return Bt(r.curve);for(var n=Nt(t),a=e&&Nt(e),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=(function(t,e,r){var n,a,i={T:1,Q:1};if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in i)&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"][T](Rt[N](0,[e.x,e.y][T](t.slice(1))));break;case"S":"C"==r||"S"==r?(n=2*e.x-e.bx,a=2*e.y-e.by):(n=e.x,a=e.y),t=["C",n,a][T](t.slice(1));break;case"T":"Q"==r||"T"==r?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"][T](Ot(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"][T](Ot(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"L":t=["C"][T](Tt(e.x,e.y,t[1],t[2]));break;case"H":t=["C"][T](Tt(e.x,e.y,t[1],e.y));break;case"V":t=["C"][T](Tt(e.x,e.y,e.x,t[1]));break;case"Z":t=["C"][T](Tt(e.x,e.y,e.X,e.Y))}return t}),c=function(t,e){if(t[e].length>7){t[e].shift();for(var r=t[e];r.length;)t.splice(e++,0,["C"][T](r.splice(0,6)));t.splice(e,1),l=G(n.length,a&&a.length||0)}},h=function(t,e,r,i,s){t&&e&&"M"==t[s][0]&&"M"!=e[s][0]&&(e.splice(s,0,["M",i.x,i.y]),r.bx=0,r.by=0,r.x=t[s][1],r.y=t[s][2],l=G(n.length,a&&a.length||0))},u=0,l=G(n.length,a&&a.length||0);ua){if(e&&!f.start){if(u=ee(s,o,c[1],c[2],c[3],c[4],c[5],c[6],a-p),l+=["C"+u.start.x,u.start.y,u.m.x,u.m.y,u.x,u.y],i)return l;f.start=l,l=["M"+u.x,u.y+"C"+u.n.x,u.n.y,u.end.x,u.end.y,c[5],c[6]].join(),p+=h,s=+c[5],o=+c[6];continue}if(!t&&!e)return u=ee(s,o,c[1],c[2],c[3],c[4],c[5],c[6],a-p),{x:u.x,y:u.y,alpha:u.alpha}}p+=h,s=+c[5],o=+c[6]}l+=c.shift()+c}return f.end=l,u=t?p:e?f:r.findDotsAtSegment(s,o,c[0],c[1],c[2],c[3],c[4],c[5],1),u.alpha&&(u={x:u.x,y:u.y,alpha:u.alpha}),u}},ne=re(1),ae=re(),ie=re(0,1);r.getTotalLength=ne,r.getPointAtLength=ae,r.getSubpath=function(t,e,r){if(this.getTotalLength(t)-r<1e-6)return ie(t,e).end;var n=ie(t,r,1);return e?ie(n,e).end:n},Zt.getTotalLength=function(){var t=this.getPath();if(t)return this.node.getTotalLength?this.node.getTotalLength():ne(t)},Zt.getPointAtLength=function(t){var e=this.getPath();if(e)return ae(e,t)},Zt.getPath=function(){var t,e=r._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return e&&(t=e(this)),t},Zt.getSubpath=function(t,e){var n=this.getPath();if(n)return r.getSubpath(n,t,e)};var se=r.easing_formulas={linear:function(t){return t},"<":function(t){return X(t,1.7)},">":function(t){return X(t,.48)},"<>":function(t){var e=.48-t/1.04,r=z.sqrt(.1734+e*e),n=r-e,a=X(U(n),1/3)*(n<0?-1:1),i=-r-e,s=X(U(i),1/3)*(i<0?-1:1),o=a+s+.5;return 3*(1-o)*o*o+o*o*o},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){t-=1;var e=1.70158;return t*t*((e+1)*t+e)+1},elastic:function(t){return t==!!t?t:X(2,-10*t)*z.sin(2*q*(t-.075)/.3)+1},bounce:function(t){var e,r=7.5625,n=2.75;return t<1/n?e=r*t*t:t<2/n?(t-=1.5/n,e=r*t*t+.75):t<2.5/n?(t-=2.25/n,e=r*t*t+.9375):(t-=2.625/n,e=r*t*t+.984375),e}};se.easeIn=se["ease-in"]=se["<"],se.easeOut=se["ease-out"]=se[">"],se.easeInOut=se["ease-in-out"]=se["<>"],se["back-in"]=se.backIn,se["back-out"]=se.backOut;var oe=[],ce=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame||function(t){setTimeout(t,16)},he=function(){for(var t=+new Date,n=0;n1&&!a.next){for(s in f)f[C](s)&&(g[s]=a.totalOrigin[s]);a.el.attr(g),x(a.anim,a.el,a.anim.percents[0],null,a.totalOrigin,a.repeat-1)}a.next&&!a.stop&&x(a.anim,a.el,a.next,null,a.totalOrigin,a.repeat)}}}r.svg&&p&&p.paper&&p.paper.safari(),oe.length&&ce(he)},ue=function(t){return t>255?255:t<0?0:t};Zt.animateWith=function(t,e,n,a,i,s){var o=this;if(o.removed)return s&&s.call(o),o;var c=n instanceof v?n:r.animation(n,a,i,s);x(c,o,c.percents[0],null,o.attr());for(var h=0,u=oe.length;h.5)-1;c(f-.5,2)+c(p-.5,2)>.25&&(p=i.sqrt(.25-c(f-.5,2))*a+.5)&&.5!=p&&(p=p.toFixed(5)-1e-5*a)}return l}),a=a.split(/\s*\-\s*/),"linear"==h){var y=a.shift();if(y=-n(y),isNaN(y))return null;var b=[0,0,i.cos(r.rad(y)),i.sin(r.rad(y))],_=1/(s(o(b[2]),o(b[3]))||1);b[2]*=_,b[3]*=_,b[2]<0&&(b[0]=-b[2],b[2]=0),b[3]<0&&(b[1]=-b[3],b[3]=0)}var w=r._parseDots(a);if(!w)return null;if(u=u.replace(/[\(\)\s,\xb0#]/g,"_"),t.gradient&&u!=t.gradient.id&&(g.defs.removeChild(t.gradient),delete t.gradient),!t.gradient){x=m(h+"Gradient",{id:u}),t.gradient=x,m(x,"radial"==h?{fx:f,fy:p}:{x1:b[0],y1:b[1],x2:b[2],y2:b[3],gradientTransform:t.matrix.invert()}),g.defs.appendChild(x);for(var E=0,k=w.length;E1?P.opacity/100:P.opacity});case"stroke":P=r.getRGB(g),c.setAttribute(d,P.hex),"stroke"==d&&P[t]("opacity")&&m(c,{"stroke-opacity":P.opacity>1?P.opacity/100:P.opacity}),"stroke"==d&&n._.arrows&&("startString"in n._.arrows&&y(n,n._.arrows.startString),"endString"in n._.arrows&&y(n,n._.arrows.endString,1));break;case"gradient":("circle"==n.type||"ellipse"==n.type||"r"!=e(g).charAt())&&v(n,g);break;case"opacity":u.gradient&&!u[t]("stroke-opacity")&&m(c,{"stroke-opacity":g>1?g/100:g});case"fill-opacity":if(u.gradient){I=r._g.doc.getElementById(c.getAttribute("fill").replace(/^url\(#|\)$/g,l)),I&&(M=I.getElementsByTagName("stop"),m(M[M.length-1],{"stop-opacity":g}));break}default:"font-size"==d&&(g=a(g,10)+"px");var F=d.replace(/(\-.)/g,function(t){return t.substring(1).toUpperCase()});c.style[F]=g,n._.dirty=1,c.setAttribute(d,g)}}E(n,i),c.style.visibility=f},E=function(n,i){if("text"==n.type&&(i[t]("text")||i[t]("font")||i[t]("font-size")||i[t]("x")||i[t]("y"))){var s=n.attrs,o=n.node,c=o.firstChild?a(r._g.doc.defaultView.getComputedStyle(o.firstChild,l).getPropertyValue("font-size"),10):10;if(i[t]("text")){for(s.text=i.text;o.firstChild;)o.removeChild(o.firstChild);for(var h,u=e(i.text).split("\n"),f=[],p=0,d=u.length;p"));var W=q.getBoundingClientRect();v.W=p.w=(W.right-W.left)/100,v.H=p.h=(W.bottom-W.top)/100,v.X=p.x,v.Y=p.y+v.H/2,("x"in c||"y"in c)&&(v.path.v=r.format("m{0},{1}l{2},{1}",i(p.x*x),i(p.y*x),i(p.x*x)+1));for(var V=["x","y","text","font","font-family","font-weight","font-style","font-size"],Q=0,Y=V.length;Q.25&&(r=a.sqrt(.25-o(e-.5,2))*(2*(r>.5)-1)+.5),h=e+l+r),f}),i=i.split(/\s*\-\s*/),"linear"==c){var u=i.shift();if(u=-n(u),isNaN(u))return null}var p=r._parseDots(i);if(!p)return null;if(t=t.shape||t.node,p.length){t.removeChild(s),s.on=!0,s.method="none",s.color=p[0].color,s.color2=p[p.length-1].color;for(var d=[],g=0,m=p.length;g')}}catch(t){N=function(t){return e.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},r._engine.initWin(r._g.win),r._engine.create=function(){var t=r._getContainer.apply(0,arguments),e=t.container,n=t.height,a=t.width,i=t.x,s=t.y;if(!e)throw new Error("VML container not found.");var o=new r._Paper,c=o.canvas=r._g.doc.createElement("div"),h=c.style;return i=i||0,s=s||0,a=a||512,n=n||342,o.width=a,o.height=n,a==+a&&(a+="px"),n==+n&&(n+="px"),o.coordsize=216e5+l+216e5,o.coordorigin="0 0",o.span=r._g.doc.createElement("span"),o.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",c.appendChild(o.span),h.cssText=r.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",a,n),1==e?(r._g.doc.body.appendChild(c),h.left=i+"px",h.top=s+"px",h.position="absolute"):e.firstChild?e.insertBefore(c,e.firstChild):e.appendChild(c),o.renderfix=function(){},o},r.prototype.clear=function(){r.eve("raphael.clear",this),this.canvas.innerHTML=f,this.span=r._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},r.prototype.remove=function(){r.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var t in this)this[t]="function"==typeof this[t]?r._removedFactory(t):null;return!0};var T=r.st;for(var O in A)A[t](O)&&!T[t](O)&&(T[O]=function(t){return function(){var e=arguments;return this.forEach(function(r){r[t].apply(r,e)})}}(O))}}(),B.was?S.win.Raphael=r:Raphael=r,r}),"function"!=typeof define)var define=require("amdefine")(module);define("regulex",["./Kit","./NFA","./RegExp","./parse","./visualize","./libs/raphael"],function(t,e,r,n,a,i){return{Kit:t,NFA:e,RegExp:r,parse:n,Raphael:i,visualize:a}}); \ No newline at end of file diff --git a/index.html b/index.html index 115d848..2ecb48b 100644 --- a/index.html +++ b/index.html @@ -132,6 +132,9 @@ display:block; margin:0 auto; } +#graphCt svg text { +white-space: pre; +} footer div.normal { text-align: center; border-top:1px solid grey; diff --git a/src/RegExp.js b/src/RegExp.js index 81439f4..7f93e00 100644 --- a/src/RegExp.js +++ b/src/RegExp.js @@ -212,7 +212,7 @@ var NFABuilders=(function _() { var groupStart=[newState()]; var ts=[{ from:from,to:groupStart,charset:false, - action:!node.nonCapture && function _groupStart(stack,c,i) { + action:!node.nonCapture && !node.atomicGroup && function _groupStart(stack,c,i) { stack.unshift({type:GROUP_CAPTURE_START,num:node.num,index:i}); } }]; @@ -223,7 +223,7 @@ var NFABuilders=(function _() { var groupEnd=[newState()]; ts.push({ from:a.accepts,to:groupEnd,charset:false, - action:!node.nonCapture && function _groupEnd(stack,c,i) { + action:!node.nonCapture && !node.atomicGroup && function _groupEnd(stack,c,i) { stack.unshift({type:GROUP_CAPTURE_END,num:node.num,index:i}); } }); @@ -284,6 +284,12 @@ var NFABuilders=(function _() { case AssertNegativeLookahead: f=_negativeLookahead(node); break; + case AssertLookbehind: + f=_lookbehind(node); + break; + case AssertNegativeLookbehind: + f=_negativeLookbehind(node); + break; } return _newAssert(node,from,f); @@ -304,10 +310,21 @@ var NFABuilders=(function _() { return ret.acceptable; }; } + function _lookbehind(node) { + var m=NFA(tree2NFA(node.sub,['start'])); + return function _Lookbehind(stack,c,i,state,s) { + var ret=m.input(s,i,null,stack); + return ret.acceptable; + }; + } function _negativeLookahead(node) { var f=_lookahead(node); return function _NLookahead() {return !f.apply(this,arguments)}; } + function _negativeLookbehind(node) { + var f=_lookbehind(node); + return function _NLookbehind() {return !f.apply(this,arguments)}; + } function _isBoundary(i,s) {return !!(_isWordChar(i-1,s) ^ _isWordChar(i,s))} function _isWordChar(i,s) {return i!==-1 && i!==s.length && /\w/.test(s[i])} @@ -359,7 +376,7 @@ function repeatNFA(node,from) { }); } var endState=[newState()]; - if (repeat.nonGreedy) { + if (repeat.nonGreedy || repeat.possessive) { trans.push({ from:accepts,to:endState,charset:false }); diff --git a/src/parse.js b/src/parse.js index cf969cf..7689f3c 100644 --- a/src/parse.js +++ b/src/parse.js @@ -20,6 +20,8 @@ var Constants={ //Assertion Type Constants AssertLookahead:"AssertLookahead", AssertNegativeLookahead:"AssertNegativeLookahead", + AssertLookbehind:"AssertLookbehind", + AssertNegativeLookbehind:"AssertNegativeLookbehind", AssertNonWordBoundary:"AssertNonWordBoundary", AssertWordBoundary:"AssertWordBoundary", AssertEnd:"AssertEnd", @@ -350,8 +352,14 @@ function _checkRepeat(node) { if (node.repeat) { var astype = node.assertionType; var msg = 'Nothing to repeat! Repeat after assertion doesn\'t make sense!'; - if (astype === 'AssertLookahead' || astype === 'AssertNegativeLookahead' ) { - var assertifier = astype === 'AssertLookahead' ? '?=' : '?!'; + var assertifiers = { + 'AssertLookahead': '?=', + 'AssertNegativeLookahead': '?!', + 'AssertLookbehind': '?<=', + 'AssertNegativeLookbehind': '?)/ + var group=stack._parentGroup + group.atomicGroup=true; + group.num=undefined; + stack.groupCounter.i--; + } + function groupNameP(stack) { + var group=stack._parentGroup + group.nameP=true; + } + function groupName(stack,c,i,state,s) { + var group=stack._parentGroup + if (state === 'groupNameStart') { + group.name = c; + } else if (state === 'groupNameStartApos') { + group.name = c; + group.aops = true; + } else { + group.name += c; + } + } function groupEnd(stack,c,i,state,s) { stack=endChoice(stack); // restore group's stack from choice var group=stack._parentGroup; @@ -747,11 +780,6 @@ var actions=(function _() { type:'InvalidBackReference',lastIndex:i,astStack:stack,lastState:state, message:'Back reference number('+n+') greater than current groups count('+cn+').' }); - } else if (_isRecursive(n,stack)) { - throw new RegexSyntaxError({ - type:'InvalidBackReference',lastIndex:i,astStack:stack,lastState:state, - message:'Recursive back reference in group ('+n+') itself.' - }); } last.num=n; @@ -762,6 +790,29 @@ var actions=(function _() { } } + function nameBackref(stack,c,i,state) { + var last=stack[0]; + if (state === 'nameBackrefStartP') { + var group=stack._parentGroup; + delete stack._parentGroup; + delete stack.groupCounter; + stack=group._parentStack; + delete group._parentStack; + last={type:BACKREF_NODE,indices:[i-4]}; + stack.unshift(last); + last.name = ''; + stack.groupCounter.i--; + } else if (state === 'nameBackrefStart' || state === 'nameBackrefStartAops' || state === 'nameBackrefStartCub') { + last={type:BACKREF_NODE,indices:[i-3]}; + stack.unshift(last); + last.name = ''; + } + last.name += c; + if (state === 'nameBackrefStartP') { + return stack; + } + } + //console.log(K.locals(_)); return { @@ -769,11 +820,15 @@ var actions=(function _() { exact:exact,dot:dot,nullChar:nullChar,assertBegin:assertBegin, assertEnd:assertEnd,assertWordBoundary:assertWordBoundary, repeatnStart:repeatnStart,repeatnComma:repeatnComma,repeatNonGreedy:repeatNonGreedy, + repeatPossessive:repeatPossessive, repeatnEnd:repeatnEnd,repeat1:repeat1,repeat01:repeat01,repeat0:repeat0, charClassEscape:charClassEscape,normalEscape:normalEscape, unicodeEscape:unicodeEscape,hexEscape:hexEscape,charClassEscape:charClassEscape, groupStart:groupStart,groupNonCapture:groupNonCapture,backref:backref, + nameBackref:nameBackref, + groupAtomicGroup:groupAtomicGroup, groupToAssertion:groupToAssertion,groupEnd:groupEnd, + groupName:groupName, groupNameP:groupNameP, choice:choice,endChoice:endChoice, charsetStart:charsetStart,charsetExclude:charsetExclude, charsetContent:charsetContent,charsetNullChar:charsetNullChar, @@ -806,7 +861,8 @@ var normalEscapeInCharsetEX='^'+charClassEscape+unicodeEscape+hexEscape+'0-9'; // 'rntvf\\' escape ,others return raw // Also need exclude \b\B assertion and backref -var normalEscapeEX=normalEscapeInCharsetEX+'bB1-9'; +// Also need exclude \k\g (named backref) +var normalEscapeEX=normalEscapeInCharsetEX+'bB1-9'+'kg'; //var controlEscape;//Never TODO.Same reason as OctEscape. @@ -829,18 +885,18 @@ var charsetRangeEndIncompleteEscapeStates=charsetRangeEndIncompleteEscapeFirstSt var config={ compact:true, - accepts:'start,begin,end,repeat0,repeat1,exact,repeatn,repeat01,repeatNonGreedy,choice,'+(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates), + accepts:'start,begin,end,repeat0,repeat1,exact,repeatn,repeat01,repeatNonGreedy,repeatPossessive,choice,'+(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates), trans:[ - ['start,begin,end,exact,repeatNonGreedy,repeat0,repeat1,repeat01,groupStart,groupQualifiedStart,choice,repeatn>exact',exactEXCharset,actions.exact], + ['start,begin,end,exact,repeatNonGreedy,repeatPossessive,repeat0,repeat1,repeat01,groupStart,groupQualifiedStart,groupNameEnd,choice,repeatn>exact',exactEXCharset,actions.exact], // e.g. /\u54/ means /u54/ [allHexEscapeStates+'>exact',exactEXCharset+hexDigit,actions.exact], // e.g. /\0abc/ is exact "\0abc",but /\012/ is an error ['nullChar>exact',exactEXCharset+digit,actions.exact], //[(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+'>exact',exactEXCharset+''] - [(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+',start,begin,end,exact,repeatNonGreedy,repeat0,repeat1,repeat01,groupStart,groupQualifiedStart,choice,repeatn>exact','.',actions.dot], - ['start,groupStart,groupQualifiedStart,end,begin,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,choice,'+repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates+'>begin','^',actions.assertBegin], - [(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+',exact>repeatnStart','{',actions.repeatnStart], - ['start,begin,end,groupQualifiedStart,groupStart,repeat0,repeat1,repeatn,repeat01,repeatNonGreedy,choice>repeatnErrorStart','{',actions.exact],//No repeat,treat as exact char e.g. /{/,/^{/,/a|{/ + [(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates)+',start,begin,end,exact,repeatNonGreedy,repeatPossessive,repeat0,repeat1,repeat01,groupStart,groupQualifiedStart,groupNameEnd,choice,repeatn>exact','.',actions.dot], + ['start,groupStart,groupQualifiedStart,groupNameEnd,end,begin,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,repeatPossessive,choice,'+repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates+'>begin','^',actions.assertBegin], + [(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates)+',exact>repeatnStart','{',actions.repeatnStart], + ['start,begin,end,groupQualifiedStart,groupNameEnd,groupStart,repeat0,repeat1,repeatn,repeat01,repeatNonGreedy,repeatPossessive,choice>repeatnErrorStart','{',actions.exact],//No repeat,treat as exact char e.g. /{/,/^{/,/a|{/ ['repeatnStart>repeatn_1',digit,actions.exact], // Now maybe /a{1/ ['repeatn_1>repeatn_1',digit,actions.exact], // Could be /a{11/ ['repeatn_1>repeatn_2',',',actions.repeatnComma], // Now maybe /a{1,/ @@ -865,15 +921,16 @@ var config={ // "/a{2,a/" and "/{3,a" are valid ['repeatn_2,repeatnError_2>exact',exactEXCharset+digit+'}',actions.exact], - ['exact,'+(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+'>repeat0','*',actions.repeat0], - ['exact,'+(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+'>repeat1','+',actions.repeat1], - ['exact,'+(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+'>repeat01','?',actions.repeat01], + ['exact,'+(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates)+'>repeat0','*',actions.repeat0], + ['exact,'+(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates)+'>repeat1','+',actions.repeat1], + ['exact,'+(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates)+'>repeat01','?',actions.repeat01], ['choice>repeatErrorFinal','*+?'], ['repeat0,repeat1,repeat01,repeatn>repeatNonGreedy','?',actions.repeatNonGreedy], - ['repeat0,repeat1,repeat01,repeatn>repeatErrorFinal','+*'], + ['repeat0,repeat1,repeat01,repeatn>repeatPossessive','+',actions.repeatPossessive], + ['repeat0,repeat1,repeat01,repeatn>repeatErrorFinal','*'], // Escape - ['start,begin,end,groupStart,groupQualifiedStart,exact,repeatNonGreedy,repeat0,repeat1,repeat01,repeatn,choice,'+(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+'>escape','\\',actions.escapeStart], + ['start,begin,end,groupStart,groupQualifiedStart,groupNameEnd,exact,repeatNonGreedy,repeatPossessive,repeat0,repeat1,repeat01,repeatn,choice,'+(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates)+'>escape','\\',actions.escapeStart], ['escape>nullChar','0',actions.nullChar], ['nullChar>digitFollowNullError','0-9'], // "/\0123/" is invalid in standard ['escape>exact',normalEscapeEX,actions.normalEscape], @@ -891,22 +948,59 @@ var config={ ['escape>digitBackref','1-9',actions.backref], ['digitBackref>digitBackref',digit,actions.backref], ['digitBackref>exact',exactEXCharset+digit,actions.exact], + ['escape>nameBackrefK','k'], + // k + ['nameBackrefK>nameBackrefStart','<'], + ['nameBackrefStart>nameBackref','a-zA-Z_',actions.nameBackref], + ['nameBackref>nameBackref','a-zA-Z_0-9',actions.nameBackref], + ['nameBackref>nameBackrefEnd','>'], + // k'name' + ['nameBackrefK>nameBackrefStartAops','\''], + ['nameBackrefStartAops>nameBackrefAops','a-zA-Z_',actions.nameBackref], + ['nameBackrefAops>nameBackrefAops','a-zA-Z_0-9',actions.nameBackref], + ['nameBackrefAops>nameBackrefEnd','\''], + // k{name}, g{name} + ['escape>nameBackrefG','g'], + ['nameBackrefK,nameBackrefG>nameBackrefStartCub','{'], + ['nameBackrefStartCub>nameBackrefCub','a-zA-Z_',actions.nameBackref], + ['nameBackrefCub>nameBackrefCub','a-zA-Z_0-9',actions.nameBackref], + ['nameBackrefCub>nameBackrefEnd','}'], + // python format: (?P=...) + ['groupNameP>nameBackrefStartP','='], + ['nameBackrefStartP>nameBackrefP','a-zA-Z_',actions.nameBackref], + ['nameBackrefP>nameBackrefP','a-zA-Z_0-9',actions.nameBackref], + ['nameBackrefP>nameBackrefEnd',')'], + ['nameBackrefEnd>exact',exactEXCharset+digit,actions.exact], // Group start - ['exact,begin,end,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,start,groupStart,groupQualifiedStart,choice,'+(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+'>groupStart','(',actions.groupStart], + ['exact,begin,end,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,repeatPossessive,start,groupStart,groupQualifiedStart,groupNameEnd,choice,'+(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates)+'>groupStart','(',actions.groupStart], ['groupStart>groupQualify','?'], ['groupQualify>groupQualifiedStart',':',actions.groupNonCapture],//group non-capturing ['groupQualify>groupQualifiedStart','=',actions.groupToAssertion],//group positive lookahead ['groupQualify>groupQualifiedStart','!',actions.groupToAssertion],//group negative lookahead - [(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+',groupStart,groupQualifiedStart,begin,end,exact,repeat1,repeat0,repeat01,repeatn,repeatNonGreedy,choice>exact',')',actions.groupEnd],//group end + ['groupNameStart>groupQualifiedStart','=',actions.groupToAssertion],//group positive lookbehind + ['groupNameStart>groupQualifiedStart','!',actions.groupToAssertion],//group negative lookbehind + ['groupQualify>groupQualifiedStart','>',actions.groupAtomicGroup],//group atomic-group + // python + ['groupQualify>groupNameP','P',actions.groupNameP], + ['groupQualify,groupNameP>groupNameStart','<'], + ['groupNameStart>groupName','a-zA-Z_', actions.groupName],//group name + ['groupName>groupName','a-zA-Z_0-9', actions.groupName],//group name + // single quote + ['groupQualify>groupNameStartApos','\''], + ['groupNameStartApos>groupNameApos','a-zA-Z_', actions.groupName],//group name + ['groupNameApos>groupNameApos','a-zA-Z_0-9', actions.groupName],//group name + ['groupNameApos>groupNameEnd','\''], + ['groupName>groupNameEnd','>'], + [(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates)+',groupStart,groupQualifiedStart,groupNameEnd,begin,end,exact,repeat1,repeat0,repeat01,repeatn,repeatNonGreedy,repeatPossessive,choice>exact',')',actions.groupEnd],//group end //choice - ['start,begin,end,groupStart,groupQualifiedStart,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,choice,'+(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+'>choice','|', actions.choice], + ['start,begin,end,groupStart,groupQualifiedStart,groupNameEnd,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,repeatPossessive,choice,'+(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates)+'>choice','|', actions.choice], - ['start,groupStart,groupQualifiedStart,begin,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,choice,'+(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+'>end','$',actions.assertEnd], + ['start,groupStart,groupQualifiedStart,groupNameEnd,begin,exact,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,repeatPossessive,choice,'+(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates)+'>end','$',actions.assertEnd], // Charset [HA-HO] - ['exact,begin,end,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,groupQualifiedStart,groupStart,start,choice,'+(repeatnStates+',nullChar,digitBackref,'+unicodeEscapeStates+','+hexEscapeStates)+'>charsetStart','[',actions.charsetStart], + ['exact,begin,end,repeat0,repeat1,repeat01,repeatn,repeatNonGreedy,repeatPossessive,groupQualifiedStart,groupNameEnd,groupStart,start,choice,'+(repeatnStates+',nullChar,digitBackref,nameBackrefEnd,'+unicodeEscapeStates+','+hexEscapeStates)+'>charsetStart','[',actions.charsetStart], ['charsetStart>charsetExclude','^',actions.charsetExclude], ['charsetStart>charsetContent','^\\]^',actions.charsetContent], ['charsetExclude>charsetContent','^\\]',actions.charsetContent], // "[^^]" is valid diff --git a/src/visualize.js b/src/visualize.js index a107c13..2c32de7 100644 --- a/src/visualize.js +++ b/src/visualize.js @@ -295,7 +295,7 @@ var plotNode={ }, backref:function (node,x,y) { var bgColor='navy',textColor='white'; - var a=textRect('Backref #'+node.num,x,y,bgColor,textColor); + var a=textRect('Backref ' + (node.name !== undefined ? node.name : '#'+node.num),x,y,bgColor,textColor); a.rect.r=8; return a; }, @@ -304,6 +304,7 @@ var plotNode={ var padding=10,LABEL_MARGIN=4; var repeat=node.repeat,txt="",items=[]; var NonGreedySkipPathColor='darkgreen'; + var PossessiveSkipPathColor='lightgreen'; /*if (repeat.min===0 && !node._branched) { node._branched=true; return plotNode.choice({type:CHOICE_NODE,branches:[[{type:EMPTY_NODE}],[node]]},x,y); @@ -353,6 +354,10 @@ var plotNode={ //txt+="(NonGreedy!)"; p.stroke="Brown"; p['stroke-dasharray']="-"; + } else if (repeat.possessive) { + //txt+="(Possessive!)"; + p.stroke="Sienna"; + p['stroke-dasharray']="--"; } items.push(p); } else { // so completely remove label when /a?/ but not /a??/ @@ -377,7 +382,7 @@ var plotNode={ 'Q',x+skipRectW-r,y,x+skipRectW,y ], _translate:_curveTranslate, - stroke:repeat.nonGreedy? NonGreedySkipPathColor:'#333', + stroke:repeat.nonGreedy? NonGreedySkipPathColor: repeat.possessive? PossessiveSkipPathColor:'#333', 'stroke-width':2 }; if (p) translate([p],padding,0); @@ -598,7 +603,7 @@ var plotNode={ stroke:lineColor, 'stroke-width':strokeWidth }; - var tl=textLabel(rect.x+rect.width/2,rect.y-strokeWidth,'Group #'+node.num); + var tl=textLabel(rect.x+rect.width/2,rect.y-strokeWidth,'Group ' + (node.name ? node.name + ', ' : '') + '# ' + node.num); var items=sub.items.concat([rect,tl.label]); var width=Math.max(tl.width,rectW); var offsetX=(width-rectW)/2;//ajust label text space @@ -638,6 +643,14 @@ var plotNode={ fg="Purple"; //txt="Negative\nLookahead!"; // break line txt="Not followed by:"; + } else if (nat === AssertLookbehind) { + lineColor="LightSeaGreen"; + fg="Brown"; + txt="Preceded by:"; + } else if (nat === AssertNegativeLookbehind) { + lineColor="#F69"; + fg="MediumVioletRed"; + txt="Not preceded by:"; } var sub=plotNode.group(node,x,y); @@ -704,6 +717,8 @@ var hlColorMap={ ')':'blue', '?=':'darkgreen', '?!':'red', + '?')); + } else if (node.name) { + texts.push(text('?' + (node.nameP ? 'P' : '') + (node.aops ? '\'' : '<') + node.name + (node.aops ? '\'' : '>'))); } texts=texts.concat(highlight(node.sub)); texts.push(text(')')); @@ -788,6 +812,8 @@ function highlight(tree) { } if (node.repeat.nonGreedy) { texts.push(text('?',hlColorMap.repeatNonGreedy)); + } else if (node.repeat.possessive) { + texts.push(text('+',hlColorMap.repeatPossessive)); } } }); diff --git a/tests/RegExpTest.js b/tests/RegExpTest.js index 00ee032..6179d71 100644 --- a/tests/RegExpTest.js +++ b/tests/RegExpTest.js @@ -9,6 +9,10 @@ reMatchCases.forEach(function (c) { try { var myRe=new MyRegExp(re.source,re); var result=re.exec(s),myResult=myRe.exec(s); + if (result) { + // we have no groups + delete result.groups; + } assert.deepEqual(myResult,result,re); } catch(e) { K.log(re); diff --git a/tests/testData.js b/tests/testData.js index cba1dd4..a2a3fb6 100644 --- a/tests/testData.js +++ b/tests/testData.js @@ -148,7 +148,7 @@ var expectedFail = [ '{}{4}{5}', '[a-b][z-a]{2,6}', '[z-\\n]', '[a-zA-z]+{3}', - 'abc{3,7}+', + // 'abc{3,7}+', 'a?{1,2}', 'a+{1,2}', 'a*{1,2}', @@ -156,8 +156,8 @@ var expectedFail = [ 'a{1,4}{1,2}', "abc(def,([a-z],[0-6],([0-5]def),aaa)", "ab[abc", - "abc*+abc", - "ab++c*abc", + // "abc*+abc", + // "ab++c*abc", "\\", 'abc{42,13}' ].map(str); @@ -168,7 +168,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 3, max: 3, - nonGreedy: false }, + nonGreedy: false, + possessive: false }, chars: '\\', indices: [ 0, 5 ], raw: '\\\\{3}' } ], @@ -199,7 +200,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, chars: 'b', indices: [1, 3], @@ -231,7 +233,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: 1, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '(1|0)?' }, { @@ -306,7 +309,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, chars: 'c', indices: [3, 5], @@ -316,7 +320,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, chars: 'd', indices: [5, 7], @@ -326,7 +331,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: true + nonGreedy: true, + possessive: false }, chars: 'e', indices: [7, 10], @@ -345,7 +351,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 3, max: 110, - nonGreedy: true + nonGreedy: true, + possessive: false }, raw: '[\\n-\\rbcd]{3,110}?' }, { @@ -382,7 +389,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '(a|b)+' }], @@ -408,7 +416,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: 1, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[e-z]?' }, { @@ -458,7 +467,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, chars: 'a', indices: [1, 3], @@ -468,7 +478,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: true + nonGreedy: true, + possessive: false }, chars: 'b', indices: [3, 6], @@ -483,7 +494,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 10, max: 10, - nonGreedy: false + nonGreedy: false, + possessive: false }, chars: ',', indices: [12, 17], @@ -498,7 +510,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: true + nonGreedy: true, + possessive: false }, chars: 'b', indices: [18, 21], @@ -521,7 +534,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[\\]-a]*' }] @@ -543,7 +557,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[^]*' }] @@ -564,7 +579,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[-]*' }] @@ -585,7 +601,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[a-]*' }] @@ -625,7 +642,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '(def)+' }, { @@ -725,7 +743,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[a-z]+' }, { @@ -759,7 +778,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '([a-z]+,[abc]444,[^a-b])+' }, { @@ -809,7 +829,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[0-1]+' }, { @@ -834,7 +855,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[0-1]+' }], @@ -867,7 +889,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[a-zA-z]+' }, { @@ -885,7 +908,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[^\\s]*' }] @@ -945,7 +969,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: 1, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[01]?' }, { @@ -966,7 +991,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: 1, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '\\d?' }] @@ -987,7 +1013,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 3, max: 3, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}' }, { @@ -1040,7 +1067,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: 1, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '[01]?' }, { @@ -1061,7 +1089,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: 1, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '\\d?' }] @@ -1085,7 +1114,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '\\w+' }, { @@ -1108,7 +1138,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '\\w+' }], @@ -1117,7 +1148,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '([-+.]\\w+)*' }, { @@ -1135,7 +1167,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '\\w+' }, { @@ -1158,7 +1191,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '\\w+' }], @@ -1167,7 +1201,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '([-.]\\w+)*' }, { @@ -1185,7 +1220,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '\\w+' }, { @@ -1208,7 +1244,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '\\w+' }], @@ -1217,7 +1254,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '([-.]\\w+)*' }] @@ -1229,7 +1267,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: 2, - nonGreedy: false + nonGreedy: false, + possessive: false }, chars: 'a', indices: [0, 6], @@ -1248,7 +1287,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: 2, - nonGreedy: false + nonGreedy: false, + possessive: false }, chars: 'a', indices: [0, 6], @@ -1267,7 +1307,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: 2, - nonGreedy: false + nonGreedy: false, + possessive: false }, chars: 'a', indices: [0, 6], @@ -1277,7 +1318,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 4, max: 4, - nonGreedy: false + nonGreedy: false, + possessive: false }, chars: '{', indices: [6, 10], @@ -1291,7 +1333,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 1, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, chars: 'a', indices: [0, 2], @@ -1306,7 +1349,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 4, max: 4, - nonGreedy: false + nonGreedy: false, + possessive: false }, chars: ',', indices: [4, 8], @@ -1333,7 +1377,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '.*' }], @@ -1349,7 +1394,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '.*' }], @@ -1367,7 +1413,8 @@ var re2ast =[{ raw: '\\\\{3}', repeat: { min: 0, max: Infinity, - nonGreedy: false + nonGreedy: false, + possessive: false }, raw: '.*' },{ type: 'exact', indices: [ 12, 15 ], raw: '<\\/', chars: 'bc|d)e', + groupCount: 0, + tree: [{ + type: 'exact', + indices: [0, 1], + raw: 'a', + chars: 'a' + }, { + type: 'group', + num: undefined, + sub: [{ + type: 'choice', + indices: [4, 8], + branches: [ + [{ + type: 'exact', + indices: [4, 6], + raw: 'bc', + chars: 'bc' + }], [{ + type: 'exact', + indices: [7, 8], + raw: 'd', + chars: 'd' + }]], + raw: 'bc|d' + }], + indices: [1, 9], + atomicGroup: true, + endParenIndex: 8, + raw: '(?>bc|d)' + }, { + type: 'exact', + indices: [9, 10], + raw: 'e', + chars: 'e' + }] +}, { + raw: '(?P\\d+)a(?P=digit)b', + groupCount: 1, + tree: [{ + type: 'group', + num: 1, + sub: [{ + type: 'charset', + indices: [10, 13], + chars: '', + ranges: [], + classes: ['d'], + exclude: false, + repeat: { + min: 1, + max: Infinity, + nonGreedy: false, + possessive: false + }, + raw: '\\d+' + }], + indices: [0, 14], + nameP: true, + name: 'digit', + endParenIndex: 13, + raw: '(?P\\d+)' + }, { + type: 'exact', + indices: [14, 15], + chars: 'a', + raw: 'a' + }, { + type: 'backref', + indices: [15, 25], + name: 'digit', + raw: '(?P=digit)' + }, { + type: 'exact', + indices: [25, 26], + chars: 'b', + raw: 'b' + }], +}, { + raw: '(?\\d+)a\\kb', + groupCount: 1, + tree: [{ + type: 'group', + num: 1, + sub: [{ + type: 'charset', + indices: [9, 12], + chars: '', + ranges: [], + classes: ['d'], + exclude: false, + repeat: { + min: 1, + max: Infinity, + nonGreedy: false, + possessive: false + }, + raw: '\\d+' + }], + indices: [0, 13], + name: 'digit', + endParenIndex: 12, + raw: '(?\\d+)' + }, { + type: 'exact', + indices: [13, 14], + chars: 'a', + raw: 'a' + }, { + type: 'backref', + indices: [14, 23], + name: 'digit', + raw: '\\k' + }, { + type: 'exact', + indices: [23, 24], + chars: 'b', + raw: 'b' + }], +}, { + raw: '(?\'digit\'\\d+)a\\k\'digit\'b', + groupCount: 1, + tree: [{ + type: 'group', + num: 1, + sub: [{ + type: 'charset', + indices: [9, 12], + chars: '', + ranges: [], + classes: ['d'], + exclude: false, + repeat: { + min: 1, + max: Infinity, + nonGreedy: false, + possessive: false + }, + raw: '\\d+' + }], + indices: [0, 13], + name: 'digit', + aops: true, + endParenIndex: 12, + raw: '(?\'digit\'\\d+)' + }, { + type: 'exact', + indices: [13, 14], + chars: 'a', + raw: 'a' + }, { + type: 'backref', + indices: [14, 23], + name: 'digit', + raw: '\\k\'digit\'' + }, { + type: 'exact', + indices: [23, 24], + chars: 'b', + raw: 'b' + }], +}, { + raw: '(?\'digit\'\\d+)a\\k{digit}b', + groupCount: 1, + tree: [{ + type: 'group', + num: 1, + sub: [{ + type: 'charset', + indices: [9, 12], + chars: '', + ranges: [], + classes: ['d'], + exclude: false, + repeat: { + min: 1, + max: Infinity, + nonGreedy: false, + possessive: false + }, + raw: '\\d+' + }], + indices: [0, 13], + name: 'digit', + aops: true, + endParenIndex: 12, + raw: '(?\'digit\'\\d+)' + }, { + type: 'exact', + indices: [13, 14], + chars: 'a', + raw: 'a' + }, { + type: 'backref', + indices: [14, 23], + name: 'digit', + raw: '\\k{digit}' + }, { + type: 'exact', + indices: [23, 24], + chars: 'b', + raw: 'b' + }], +}, { + raw: '(?\'digit\'\\d+)a\\g{digit}b', + groupCount: 1, + tree: [{ + type: 'group', + num: 1, + sub: [{ + type: 'charset', + indices: [9, 12], + chars: '', + ranges: [], + classes: ['d'], + exclude: false, + repeat: { + min: 1, + max: Infinity, + nonGreedy: false, + possessive: false + }, + raw: '\\d+' + }], + indices: [0, 13], + name: 'digit', + aops: true, + endParenIndex: 12, + raw: '(?\'digit\'\\d+)' + }, { + type: 'exact', + indices: [13, 14], + chars: 'a', + raw: 'a' + }, { + type: 'backref', + indices: [14, 23], + name: 'digit', + raw: '\\g{digit}' + }, { + type: 'exact', + indices: [23, 24], + chars: 'b', + raw: 'b' + }], +}, { + raw: '(?