正则表达式可视化工具html代码

代码语言:html

所属分类:其他

代码描述:正则表达式可视化工具html代码,输入正则表达式后,可立即生成可视化图形。

代码标签: 正则 表达式 可视化 工具 html 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<style>
body,html * {
margin:0;
padding:0;
font-family:sans-serif;
}
body {
background: #303030;
}
.code,.code * {
  font-family: "DejaVu Sans Mono",monospace;
}
h1 {
font-size:3em;
color:#40C0FF;
margin:14px 0;
padding:0 16px;
padding-top:40px;
padding-bottom: 20px;
border-bottom:2px dashed grey;
min-height:60px;
}
h1 em{
color:#BBE0E0;
font-size:small;
padding-left:2em;
font-style: normal;
font-weight:normal;
display:inline-block;
}
#inputCt,#errorBox {
margin:8px 16px;
}
#inputCt div.re {
background:#EEE;
font-size:1.2em;
line-height: 1.4em;
color:#333;
border:1px solid black;
padding:4px;
font-weight: bold;
word-break:break-all;
word-wrap:break-word;
}
#inputCt div.re table {
border:none;
padding:0;
margin:0;
width:100%;
}
#inputCt div.re .input {
color:#3030C0;
padding:0 2px;
border:none;
background:#EEE;
font-size:1.2em;
line-height: 1.4em;
height:1.4em;
font-weight: bold;
word-break:break-all;
word-wrap:break-word;
margin:0;
width:auto;
}
#inputCt div.re #input {
display:table;
width:100%;
}
#inputCt label {
  color:white;
  cursor:pointer;
  display:inline-block;
}
#inputCt label input {
  margin-right:4px;
}
#errorBox {
background:#EEE;
font-size:1.2em;
line-height: 1.4em;
border:1px solid black;
padding:4px;
color:darkred;
white-space: pre;
word-wrap:normal;
word-break:keep-all;
display: none;
overflow:auto;
}
#visualIt,#embedIt,#exportIt {
font-size: 16px;
line-height: 16px;
display: inline-block;
margin: 10px;
margin-left:0;
padding:12px;
padding-bottom:10px;
color:#EEF;
border:none;
cursor:pointer;
background: #40B0EF;
background-image: linear-gradient(to bottom, #40B0EF,#3060A0);
border-radius: 12px;
text-decoration: none;
}
#visualIt:hover,#embedIt:hover,#exportIt:hover {
color:#FEF;
background: #3CB0FD;
background-image: linear-gradient(to bottom, #3CB0FD, #3498DF);
text-decoration: none;
}
#graphCt {
padding:4px;
margin:0px 16px;
border:1px solid black;
background: #EEE;
overflow: auto;
cursor:move;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#graphCt svg {
display:block;
margin:0 auto;
}
footer div.normal {
text-align: center;
border-top:1px solid grey;
margin:1em auto;
padding:10px;
font-size:1.2em;
}
footer,footer a {
color:#EEF;
}

footer div.embed {
  display: none;
}
body.embed {
  background: #EEE;
}
body.embed,body.embed #graphCt {
  margin:0;
  padding:0;
  border:none;
}
body.embed h1,
body.embed #inputCt,
body.embed #github {
  display:none !important;
}
body.embed footer div.normal {
  display:none;
}
body.embed footer div.embed {
  display: block;
}
body.embed footer div.embed,body.embed div.footer a {
  color:white;
  font-size: 14px;
}
body.embed footer {
  display:block;
  width:auto;
  margin:0;
  padding:2px 10px;
  background:rgb(75,0,130);
  opacity: 0.85;
  position:fixed;
  right:0;
  bottom:0;
}
body.embed{height:100%;}
body.embed #graphCt {
  height: 100vh;
}
.exportCanvas {
  display:block;
  margin:0 auto;
  image-rendering: pixelated;
}
</style>
</head>
<body>
<script>
var params=getParams();
if (params.embed || params.cmd=="export") {
  document.body.className+= " embed";
}

function trim(s) {
  return s.replace(/^\s+/,'').replace(/\s+$/,'');
}

function getParams() {
  var params=location.hash;
  if (!params || params.length<2) {
    params={embed:false,re:"",highlight:true,flags:''};
  } else {
    params=params.slice(2);
    params=params.split("&").reduce(function (p,a) {
      a=a.split("=");
      p[a[0]]=a[1];
      return p;
    },{});
    params.embed=params.embed==='true';
    params.flags=params.flags || '';
    params.re=params.re?trim(decodeURIComponent(params.re)):'';
  }
  return params;
}
</script>
<h1>Regulex <em>JavaScript Regular Expression Visualizer.</em></h1>
<div id="inputCt">
<div class="re code">
<table>
<tr>
<td style="width:1em">/</td>
<td style="width:auto">
<input id="input" class="input" value="^(a|b)*?$" />
</td>
<td style="width:1em">/</td>
<td style="width:3em" id="flagBox"></td>
</tr>
</table>
</div>
<button id="visualIt">Visualize</button>
<button id="exportIt">Export Image</button>
<button id="embedIt">Embed On My Site!</button>
<label><input type="checkbox" name="flag" value="i" />IgnoreCase</label>
<label><input type="checkbox" name="flag" value="m" />Multiline</label>
<label><input type="checkbox" name="flag" value="g" />GlobalMatch</label>
</div>
<p id="errorBox" class="code">Error Message</p>
<div id="graphCt" class="code"></div>
<script type="text/javascript">
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;u<t.length;u+=1)if("."===(f=t[u]))t.splice(u,1),u-=1;else if(".."===f){if(1===u&&(".."===t[2]||".."===t[0]))break;u>0&&(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<i.length;y+=1)if(v=l(i[y],c),"require"===(u=v.f))b[y]=f.require(r);else if("exports"===u)b[y]=f.exports(r),m=!0;else if("module"===u)h=b[y]=f.module(r);else if(e(p,u)||e(d,u)||e(x,u))b[y]=s(u);else{if(!v.p)throw new Error(r+" missing "+u);v.p.load(v.n,n(c,!0),a(u),{}),b[y]=p[u]}g=o?o.apply(p[r],b):void 0,r&&(h&&h.exports!==t&&h.exports!==p[r]?p[r]=h.exports:g===t&&m||(p[r]=g))}else r&&(p[r]=o)},requirejs=require=u=function(e,r,n,i,a){if("string"==typeof e)return f[e]?f[e](r):s(l(e,r).f);if(!e.splice){if(g=e,g.deps&&u(g.deps,g.callback),!r)return;r.splice?(e=r,r=n,n=null):e=t}return r=r||function(){},"function"==typeof n&&(n=i,i=a),i?h(t,e,r,n):setTimeout(function(){h(t,e,r,n)},4),u},u.config=function(t){return u(t)},requirejs._defined=p,define=function(t,r,n){r.splice||(n=r,r=[]),e(p,t)||e(d,t)||(d[t]=[t,r,n])},define.amd={jQuery:!0}}(),define("libs/almond",function(){}),"function"!=typeof define)var define=require("amdefine")(module);if(define("Kit",[],function(){function t(e,a){return e._Set?e:(a||(e=n(e)),e.contains=function(t,n){return!!~r(e,t,n)},e.indexOf=function(t,n){return r(e,t,n)},e.toArray=function(){return i(e)},e.union=function(r){r=t(r);for(var n=e.length+r.length,a=new e.constructor(n),s=0,o=0,c=0;c<n;c++)e[s]===r[o]?(a[c]=e[s++],o++,n--):e[s]<r[o]?a[c]=e[s++]:a[c]=r[o++];return a.length=n,t(a.length===n?a:i(a,n),!0)},e.inspect=e.toArray,e._Set=!0,e)}function e(t,e){return t<e?E:t===e?C:k}function r(t,r,n){var i,a,s=0,o=t.length,c=o-1;if(o<1)return-1;if(n=n||e,1===o)return n(r,t[s])===C?s:-1;if(n(r,t[s])===E||n(r,t[c])===k)return-1;do{if(i=s+(c-s+1>>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;s<o;)s=3*s+1;for(;s>0;){for(r=s;r<e;r++)for(n=r;n>=s&&t[n]<t[n-s];n-=s)a=t[n],t[n]=t[n-s],t[n-s]=a;s=s/3|0}var c=t[0];for(r=1,n=1;r<e;r++)t[r]!==c&&(c=t[n++]=t[r]);return t.length=n,t.length===n?t:i(t,n)}function i(t,e){e=void 0===e?t.length:e;for(var r=new t.constructor(e),n=e;n--;)r[n]=t[n];return r}function a(t){for(var e,r={},n=0,i=0,a=t.length;n<a;n++)e=t[n],r.hasOwnProperty(e)||(r[e]=1,t[i++]=e);return t.length=i,t}function s(t){var e,r,n,i=t.length,a=(1e10*Math.random()).toString(32)+(+new Date).toString(32);for(e=r=0;e<i;e++)null!=(n=t[e])&&(n.hasOwnProperty(a)||(Object.defineProperty(n,a,{value:1,enumerable:!1}),t[r++]=n));for(e=r;e--;)t[e][a]=void 0;return t.length=r,t}function o(t){t=t.map(function(t){return t[1]?t:t+t});var e,r,i,a,s,o;t=n(t),o=t.length;var c,h,u=Object.create(null),l=Object.create(null),f=Object.create(null);for(e=0;e<o;e++)for(s=t[e],h=s[1],l[s[0]]=!0,f[h]=!0,r=e;r<o;r++)if((c=t[r][0])>=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;e<o;e++)y[t[e]]=[];if(u[v])for(e=0;e<o;e++)if(s=t[e],s[0]===v)y[s].push(v);else if(s[0]>v)break;for(e=0,a=g.length-1;e<a;e++){if(c=g[e],h=g[e+1],f[c]&&(c=d(c)),l[h]&&(h=p(h)),c<=h)for(v=c===h?c:c+h,r=0;r<o&&(s=t[r],!(s[0]>h));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;r<o&&(s=t[r],!(s[0]>h));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 n<i&&r.push(n+i),n===i&&r.push(n),e}),r}function h(t){t=t.split("");var e=[],r=[],n="^"===t[0]&&t.length>1&&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;s<n;s++)o[e.accepts[s]]=!0;var l;for(s=0,n=h.length;s<n;s++)l=h[s],l.charset?l.ranges="string"==typeof l.charset?t.parseCharset(l.charset):l.charset:l.eMove=!0,l.from.forEach(function(t){var e=u[t]=u[t]||{eMoveStates:[],eMove:[],charMove:{},trans:[],ranges:[]};l.eMove?e.eMoveStates=e.eMoveStates.concat(l.to):e.ranges=e.ranges.concat(l.ranges),e.trans.push(l)});return Object.keys(u).forEach(function(e){var r=u[e],n=r.trans,i=r.charMove,a=r.eMove,s=r.ranges,o=t.classify(s),c=o.map;n.forEach(function(e){e.eMove?e.to.forEach(function(t){a.push({to:t,action:e.action,assert:e.assert,eMove:!0})}):t.flatten2(e.ranges.map(function(t){return c[t]})).forEach(function(t){(i[t]=i[t]||[]).push(e)})}),s=t.Set(o.ranges.filter(function(t){return!!t[1]})),r.ranges=s,Object.keys(i).forEach(function(t){var e=i[t],r=[];n.forEach(function(t){t.to.forEach(function(n){(t.eMove||~e.indexOf(t))&&r.push({to:n,action:t.action,assert:t.assert,eMove:t.eMove})})}),i[t]=r}),delete r.trans,delete r.eMoveStates}),{accepts:o,router:u,input:a,assertDFA:i,accept:r}}function r(t){return this.accepts.hasOwnProperty(t)}function i(){for(var e,r=this.router,n=Object.keys(r),i=0,a=n.length;i<a;i++){if(e=r[n[i]],e.eMove.length>1)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<h;c++){if(1!==s[o[c]].length)throw t.log(s),new Error("DFA Assertion Fail!\nFrom state `"+n[i]+"` via charset `"+o[c]+"` can goto to multi states!")}if(o.length&&e.eMove.length)throw new Error("DFA Assertion Fail!\nFrom state `"+n[i]+"` can goto extra ε-move state!")}return!0}function a(e,r,n){function i(e,r,o,c,h){t:for(;;){var u,l,f,p,d=a.router[o];if(!d)break;var g,x=d.eMove,v=d.charMove;r<e.length?(u=e[r],g=v.hasOwnProperty(u)?v[u]:(l=s(d.ranges,u))?v[l]:x):g=x;for(var y,m,b,_=c.length,w=h,E=0,C=g.length;E<C;E++){if(y=g[E],f=y.eMove?0:1,h=w,c.splice(0,c.length-_),_=c.length,y.assert){if(!1===(m=y.assert(c,u,r,o,e)))continue;"number"==typeof m&&(r+=m,h+=m)}if(y.action&&(c=y.action(c,u,r,o,e)||c),h=y.eMove?h:r,n&&t.log(u+":"+o+">"+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<r?-1:0}function c(t){t.accepts=t.accepts.split(",");for(var e,r,n,i,a=t.trans,s=a.length;s--;)e=a[s],r=e[0].split(">"),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 <NUL> 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;i<s;i++){if(n=t[i],n.type===EXACT_NODE){if(r.type===EXACT_NODE&&!r.repeat&&!n.repeat){r.indices[1]=n.indices[1],r.raw+=n.raw,r.chars+=n.chars;continue}}else e(n);t[a++]=n,r=n}r&&(t.length=a)}function h(t,e,r){if(!t.length)return void t.push({type:EMPTY_NODE,indices:[r,r]});t.reduce(function(t,r){return r.indices.push(t),r.raw=e.slice(r.indices[0],t),r.type===GROUP_NODE||r.type===ASSERT_NODE&&r.sub?h(r.sub,e,r.endParenIndex):r.type===CHOICE_NODE?(r.branches.reduce(function(t,r){h(r,e,t);var n=r[0];return(n?n.indices[0]:t)-1},t),r.branches.reverse()):r.type===EXACT_NODE&&(r.concatTemp||(r.chars=r.chars||r.raw)),r.indices[0]},r),t.reverse()}function u(t){if(t.repeat){var e=t.assertionType,r="Nothing to repeat! Repeat after assertion doesn't make sense!";if("AssertLookahead"===e||"AssertNegativeLookahead"===e){var n="AssertLookahead"===e?"?=":"?!",i="("+n+"b)";r+="\n/a"+i+"+/、/a"+i+"{1,n}/ are the same as /a"+i+"/。\n/a"+i+"*/、/a"+i+"{0,n}/、/a"+i+"?/ are the same as /a/。"}throw new f({type:"NothingRepeat",lastIndex:t.indices[1]-1,message:r})}}function l(t){t.ranges=e.sortUnique(t.ranges.map(function(t){if(t[0]>t[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))<c)throw new f({type:"OutOfOrder",lastState:n,lastIndex:r,astStack:t,message:"Numbers out of order in {} quantifier!"});delete s._commaIndex}else a=c;s.indices[0]>=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;s<o;s++)if(a=t[s],a.num===e)if(a.type===y)i=a.index;else if(a.type===v){n=a.index;break}if(void 0!==n&&void 0!==i)return r.slice(n,i)}function l(){return"q"+x++}function f(t,e){var r,n,i=m[t.type],a=[],s=t.repeat,o=s.min,c=s.max;for(n=o;n--;)r=i(t,e),a=a.concat(r.trans),e=r.accepts;var h=[],u=[].concat(e);if(isFinite(c))for(;c>o;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;n<i&&(e=r.input(t,n),!e.acceptable);n++);if(!e||!e.acceptable)return this.lastIndex=0,null;var a=new Array(this.ast.groupCount+1);a[0]=t.slice(n,e.lastIndex+1);for(var s=e.stack,o=1,c=a.length;o<c;o++)a[o]=u(s,o,t);return this.lastIndex=e.lastIndex+1,a.index=n,a.input=t,a},getNFA:function(){if(this._nfa)return this._nfa;var t,e=this.ast;return x=1,t=c(e.tree),t=r(t,this.debug),this._nfa=t,t}};var d=e.parseCharset("^\n\r\u2028\u2029"),g={d:["09"],w:["AZ","az","09","_"],s:" \f\n\r\t\v ᠎           \u2028\u2029   ".split("")};["d","w","s"].forEach(function(t){g[t.toUpperCase()]=e.negate(g[t])});var x=0,v="GroupCaptureStart",y="GroupCaptureEnd",m=function(){function t(t,e){var r,n=[];return t.explained.forEach(function(t){n.push({from:e,to:r=[l()],charset:t}),e=r}),{accepts:r,trans:n}}function e(t,e){var r=[l()];return{accepts:r,trans:[{from:e,to:r,charset:t.explained}]}}function n(t,e){var r=[l()];return{accepts:r,trans:[{from:e,to:r,charset:d}]}}function i(t,e){var r=[l()];return{accepts:r,trans:[{from:e,to:r,charset:!1}]}}function a(t,e){var r=[l()],n=[{from:e,to:r,charset:!1,
action:!t.nonCapture&&function(e,r,n){e.unshift({type:v,num:t.num,index:n})}}];e=r;var i=c(t.sub,e);n=n.concat(i.trans);var a=[l()];return n.push({from:i.accepts,to:a,charset:!1,action:!t.nonCapture&&function(e,r,n){e.unshift({type:y,num:t.num,index:n})}}),{accepts:a,trans:n}}function s(t,e){var r=[l()],n=t.num;return{accepts:r,trans:[{from:e,to:r,charset:!1,assert:function(t,e,r,i,a){var s=u(t,n,a);return void 0===s&&(s=""),a.slice(r,r+s.length)===s&&s.length}}]}}function o(t,e){var r=[],n=[];return t.branches.forEach(function(t){var i=c(t,e);r=r.concat(i.trans),n=n.concat(i.accepts)}),{trans:r,accepts:n}}function h(t,e){function n(t){var e=r(c(t.sub,["start"]));return function(t,r,n,i,a){return e.input(a,n,null,t).acceptable}}function i(t,e){return!!(a(t-1,e)^a(t,e))}function a(t,e){return-1!==t&&t!==e.length&&/\w/.test(e[t])}function s(t,e,r,n,i){return 0===r||"\n"===i[r-1]}function o(t,e,r,n,i){return 0===r}function h(t,e,r,n,i){return r===i.length||"\n"===e}function u(t,e,r,n,i){return r===i.length}var f;switch(t.assertionType){case AssertBegin:f=t.multiline?s:o;break;case AssertEnd:f=t.multiline?h:u;break;case AssertWordBoundary:f=function(t,e,r,n,a){return i(r,a)};break;case AssertNonWordBoundary:f=function(t,e,r,n,a){return!i(r,a)};break;case AssertLookahead:f=n(t);break;case AssertNegativeLookahead:f=function(t){var e=n(t);return function(){return!e.apply(this,arguments)}}(t)}return function(t,e,r){var n=[l()];return{accepts:n,trans:[{from:e,to:n,charset:!1,assert:r}]}}(t,e,f)}return{assert:h,choice:o,backref:s,group:a,empty:i,charset:e,dot:n,exact:t}}();return n}),"function"!=typeof define)var define=require("amdefine")(module);if(define("visualize",["./Kit","./parse"],function(t,e){function r(t,e){if(e=e||"normal",S[t]&&S[t][e])return S[t][e];y.attr({"font-size":t,"font-weight":e});var r=y.getBBox();return S[t]=S[t]||{},S[t][e]={width:r.width/((y.attr("text").length-1)/2),height:r.height/2}}function n(t){y=t.text(-1e3,-1e3,"XgfTlM|.q\nXgfTlM|.q").attr({"font-family":E,"font-size":m})}function i(t,e,i){i.clear(),i.setSize(0,0);var o=i.rect(0,0,0,0);o.attr("fill",w),o.attr("stroke",w),n(i),C=!!~e.indexOf("m");var c=d(t.tree);c.unshift(x("/",B.delimiter)),c.unshift(x("RegExp: ")),c.push(x("/",B.delimiter)),e&&c.push(x(e,B.flags));var h=r(m,"bold"),u=k,l=h.height/2+k,f=0,p=0;f=c.reduce(function(t,e){return e.x=t,e.y=l,t+e.text.length*h.width},u),f+=k,p=h.height+2*k,c=i.add(c),i.setSize(f,h.height+2*k);var g=a(t.tree,0,0);p=Math.max(g.height+3*k+h.height,p),f=Math.max(g.width+2*k,f),i.setSize(f,p),o.attr("width",f),o.attr("height",p),s(g.items,k,2*k+h.height-g.y),i.add(g.items)}function a(t,e,r){return t.unshift({type:"startPoint"}),t.push({type:"endPoint"}),o(t,e,r)}function s(t,e,r){t.forEach(function(t){t._translate?t._translate(e,r):(t.x+=e,t.y+=r)})}function o(t,e,r){var n=[],i=[],a=0,s=0,o=e,c=r,h=r;if(!t.length)return A.empty(null,e,r);t.forEach(function(t){var e;e=t.repeat?A.repeat(t,o,r):A[t.type](t,o,r),n.push(e),o+=e.width+_,a+=e.width,c=Math.min(c,e.y),h=Math.max(h,e.y+e.height),i=i.concat(e.items)}),s=h-c,n.reduce(function(t,e){a+=_;var n=u(t.lineOutX,r,e.lineInX);return i.push(n),e});var l=n[0].lineInX,f=n[n.length-1].lineOutX;return{items:i,width:a,height:s,x:e,y:c,lineInX:l,lineOutX:f}}function c(e,n,i,a,s){e=t.toPrint(e);var o=r(m),c=e.length*o.width,h=o.height+12,u=c+12,l={type:"rect",x:n,y:i-h/2,width:u,height:h,stroke:"none",fill:a||"transparent"},f={type:"text",x:n+u/2,y:i,text:e,"font-size":m,"font-family":E,fill:s||"black"};return{text:f,rect:l,items:[l,f],width:u,height:h,x:n,y:l.y,lineInX:n,lineOutX:n+u}}function h(t,e,n,i){var a,s=r(b),o=n.split("\n"),c=o.length*s.height;a=o.length>1?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;r<e.length;r++)if(!p(e[r]))return!1;return!0}var n=t;return n.type===EMPTY_NODE||(n.type===GROUP_NODE&&void 0===n.num?p(n.sub):n.type===CHOICE_NODE?p(n.branches):void 0)}function d(e){var r=[];return e.forEach(function(e){if(e.sub)r.push(x("(")),e.type===ASSERT_NODE?e.assertionType===AssertLookahead?r.push(x("?=")):r.push(x("?!")):e.nonCapture&&r.push(x("?:")),r=r.concat(d(e.sub)),r.push(x(")"));else if(e.branches)e.branches.map(d).forEach(function(t){r=r.concat(t),r.push(x("|"))}),r.pop();else{var n=B[e.type]||B.defaults;switch(e.type){case CHARSET_NODE:var i=v(e);(!i||e.exclude)&&r.push(x("[")),e.exclude&&r.push(x("^",B.charsetExclude)),e.ranges.forEach(function(t){r.push(x(g(t[0]+"-"+t[1]),B.charsetRange))}),e.classes.forEach(function(t){r.push(x("\\"+t,B.charsetClass))}),r.push(x(g(e.chars),B.charsetChars)),(!i||e.exclude)&&r.push(x("]"));break;default:var a=e.raw||"";e.repeat&&(a=a.slice(0,e.repeat.beginIndex)),a=t.toPrint(a,!0),r.push(x(a,n))}}if(e.repeat){var s=e.repeat.min,o=e.repeat.max;0===s&&o===1/0?r.push(x("*")):1===s&&o===1/0?r.push(x("+")):0===s&&1===o?r.push(x("?")):(r.push(x("{")),r.push(x(s)),s===o?r.push(x("}")):(r.push(x(",")),isFinite(o)&&r.push(x(o)),r.push(x("}")))),e.repeat.nonGreedy&&r.push(x("?",B.repeatNonGreedy))}}),r}function g(e){return e=t.toPrint(e),e.replace(/\[/g,"\\[").replace(/\]/g,"\\]")}function x(t,e){return e=e||B[t]||B.defaults,{type:"text","font-size":m,"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 y,m=16,b=14,_=16,w="#EEE",E="DejaVu Sans Mono,monospace",C=!1,k=10,S={},A={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 #"+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 i(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 A.empty(null,e,r);var a=t.repeat,o="",c=[];if(a.min===a.max&&0===a.min)return A.empty(null,e,r);var u=A[t.type](t,e,r),l=u.width,f=u.height;if(a.min===a.max&&1===a.min)return u;a.min===a.max?o+=n(a.min):(o+=a.min,isFinite(a.max)?o+=(a.max-a.min>1?" 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<x;g++)"zIndex"in h[g]&&(l.push(h[g].zIndex),h[g].zIndex<0&&(f[h[g].zIndex]=h[g]));for(l.sort(s);l[u]<0;)if(i=f[l[u++]],p.push(i.apply(n,o)),r)return r=a,p;for(g=0;g<x;g++)if("zIndex"in(i=h[g]))if(i.zIndex==l[u]){if(p.push(i.apply(n,o)),r)break;do{if(u++,i=f[l[u]],i&&p.push(i.apply(n,o)),r)break}while(i)}else f[i.zIndex]=i;else if(p.push(i.apply(n,o)),r)break;return r=a,e=d,p.length?p:null};c._events=o,c.listeners=function(t){var e,r,n,a,s,c,h,u,l=t.split(i),f=o,p=[f],d=[];for(a=0,s=l.length;a<s;a++){for(u=[],c=0,h=p.length;c<h;c++)for(f=p[c].n,r=[f[l[a]],f["*"]],n=2;n--;)(e=r[n])&&(u.push(e),d=d.concat(e.f||[]));p=u}return d},c.on=function(t,e){if(t=String(t),"function"!=typeof e)return function(){};for(var r=t.split(i),n=o,s=0,c=r.length;s<c;s++)n=n.n,n=n.hasOwnProperty(r[s])&&n[r[s]]||(n[r[s]]={n:{}});for(n.f=n.f||[],s=0,c=n.f.length;s<c;s++)if(n.f[s]==e)return a;return n.f.push(e),function(t){+t==+t&&(e.zIndex=+t)}},c.f=function(t){var e=[].slice.call(arguments,1);return function(){c.apply(null,[t,null].concat(e).concat([].slice.call(arguments,0)))}},c.stop=function(){r=1},c.nt=function(t){return t?new RegExp("(?:\\.|\\/|^)"+t+"(?:\\.|\\/|$)").test(e):e},c.nts=function(){return e.split(i)},c.off=c.unbind=function(t,e){if(!t)return void(c._events=o={n:{}});var r,a,s,h,u,l,f,p=t.split(i),d=[o];for(h=0,u=p.length;h<u;h++)for(l=0;l<d.length;l+=s.length-2){if(s=[l,1],r=d[l].n,"*"!=p[h])r[p[h]]&&s.push(r[p[h]]);else for(a in r)r[n](a)&&s.push(r[a]);d.splice.apply(d,s)}for(h=0,u=d.length;h<u;h++)for(r=d[h];r.n;){if(e){if(r.f){for(l=0,f=r.f.length;l<f;l++)if(r.f[l]==e){r.f.splice(l,1);break}!r.f.length&&delete r.f}for(a in r.n)if(r.n[n](a)&&r.n[a].f){var g=r.n[a].f;for(l=0,f=g.length;l<f;l++)if(g[l]==e){g.splice(l,1);break}!g.length&&delete r.n[a].f}}else{delete r.f;for(a in r.n)r.n[n](a)&&r.n[a].f&&delete r.n[a].f}r=r.n}},c.once=function(t,e){var r=function(){return c.unbind(t,r),e.apply(this,arguments)};return c.on(t,r)},c.version="0.4.2",c.toString=function(){return"You are running Eve 0.4.2"},"undefined"!=typeof module&&module.exports?module.exports=c:void 0!==define?define("eve",[],function(){return c}):t.eve=c}(window||this),function(t,e){"function"==typeof define&&define.amd?define("libs/raphael",["eve"],function(r){return e(t,r)}):e(t,t.eve)}(this,function(t,e){function r(t){if(r.is(t,"function"))return b?t():e.on("raphael.DOMload",t);if(r.is(t,W))return r._engine.create[N](r,t.splice(0,3+r.is(t[0],H))).add(t);var n=Array.prototype.slice.call(arguments,0);if(r.is(n[n.length-1],"function")){var i=n.pop();return b?i.call(r._engine.create[N](r,n)):e.on("raphael.DOMload",function(){i.call(r._engine.create[N](r,n))})}return r._engine.create[N](r,arguments)}function n(t){if("function"==typeof t||Object(t)!==t)return t;var e=new t.constructor;for(var r in t)t[k](r)&&(e[r]=n(t[r]));return e}function i(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return t.push(t.splice(r,1)[0])}function a(t,e,r){function n(){var a=Array.prototype.slice.call(arguments,0),s=a.join("␀"),o=n.cache=n.cache||{},c=n.count=n.count||[];return o[k](s)?(i(c,s),r?r(o[s]):o[s]):(c.length>=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)<c)){var u,l=.5,f=1-l;for(u=h(t,e,r,n,i,a,s,o,f);X(u-c)>.01;)l/=2,f+=(u<c?1:-1)*l,u=h(t,e,r,n,i,a,s,o,f);return f}}function l(t,e,r,n,i,a,s,o){if(!(j(t,r)<U(i,s)||U(t,r)>j(i,s)||j(e,n)<U(a,o)||U(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<c+1;x++){var v=r.findDotsAtSegment.apply(r,t.concat(x/c));f.push({x:v.x,y:v.y,t:x/c})}for(x=0;x<u+1;x++)v=r.findDotsAtSegment.apply(r,e.concat(x/u)),p.push({x:v.x,y:v.y,t:x/u});for(x=0;x<c;x++)for(var y=0;y<u;y++){var m=f[x],b=f[x+1],_=p[y],w=p[y+1],E=X(b.x-m.x)<.001?"y":"x",C=X(w.x-_.x)<.001?"y":"x",k=l(m.x,m.y,b.x,b.y,_.x,_.y,w.x,w.y);if(k){if(d[k.x.toFixed(4)]==k.y.toFixed(4))continue;d[k.x.toFixed(4)]=k.y.toFixed(4);var S=m.t+X((k[E]-m[E])/(b[E]-m[E]))*(b.t-m.t),A=_.t+X((k[C]-_[C])/(w[C]-_[C]))*(w.t-_.t);S>=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;x<v;x++){var y=t[x];if("M"==y[0])i=c=y[1],a=h=y[2];else{"C"==y[0]?(p=[i,a].concat(y.slice(1)),i=p[6],a=p[7]):(p=[i,a,i,a,c,h,c,h],i=c,a=h);for(var m=0,b=e.length;m<b;m++){var _=e[m];if("M"==_[0])s=u=_[1],o=l=_[2];else{"C"==_[0]?(d=[s,o].concat(_.slice(1)),s=d[6],o=d[7]):(d=[s,o,s,o,u,l,u,l],s=u,o=l);var w=f(p,d,n);if(n)g+=w;else{for(var E=0,C=w.length;E<C;E++)w[E].segment1=x,w[E].segment2=m,w[E].bez1=p,w[E].bez2=d;g=g.concat(w)}}}}}return g}function d(t,e,r,n,i,a){null!=t?(this.a=+t,this.b=+e,this.c=+r,this.d=+n,this.e=+i,this.f=+a):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function g(){return this.x+I+this.y+I+this.width+" × "+this.height}function x(t,e,r,n,i,a){function s(t){return((u*t+h)*t+c)*t}function o(t,e){var r,n,i,a,o,l;for(i=t,l=0;l<8;l++){if(a=s(i)-t,X(a)<e)return i;if(o=(3*u*i+2*h)*i+c,X(o)<1e-6)break;i-=a/o}if(r=0,n=1,(i=t)<r)return r;if(i>n)return n;for(;r<n;){if(a=s(i),X(a-t)<e)return i;t>a?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;_<E;_++){var b=oe[_];if(b.el.id==n.id&&b.anim==t){b.percent!=i?(oe.splice(_,1),u=1):h=b,n.attr(b.totalOrigin);break}}else a=+y;for(var _=0,E=t.percents.length;_<E;_++){if(t.percents[_]==i||t.percents[_]>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;_<E;_++){m[C][_]=[0];for(var N=1,T=v[C][_].length;N<T;N++)m[C][_][N]=(B[_][N]-v[C][_][N])/g}break;case"transform":var R=n._,I=jt(R[C],y[C]);if(I)for(v[C]=I.from,y[C]=I.to,m[C]=[],m[C].real=!0,_=0,E=v[C].length;_<E;_++)for(m[C][_]=[v[C][_][0]],N=1,T=v[C][_].length;N<T;N++)m[C][_][N]=(y[C][_][N]-v[C][_][N])/g;else{var D=n.matrix||new d,P={_:{transform:R.transform},getBBox:function(){return n.getBBox(1)}};v[C]=[D.a,D.b,D.c,D.d,D.e,D.f],Lt(P,y[C]),y[C]=P._.transform,m[C]=[(P.matrix.a-D.a)/g,(P.matrix.b-D.b)/g,(P.matrix.c-D.c)/g,(P.matrix.d-D.d)/g,(P.matrix.e-D.e)/g,(P.matrix.f-D.f)/g]}break;case"csv":var L=M(c[C])[F](w),z=M(v[C])[F](w);if("clip-rect"==C)for(v[C]=z,m[C]=[],_=z.length;_--;)m[C][_]=(L[_]-v[C][_])/g;y[C]=L;break;default:for(L=[][O](c[C]),z=[][O](v[C]),m[C]=[],_=n.paper.customAttributes[C].length;_--;)m[C][_]=((L[_]||0)-(z[_]||0))/g}var j=c.easing,U=r.easing_formulas[j];if(!U)if((U=M(j).match($))&&5==U.length){var X=U;U=function(t){return x(t,+X[1],+X[2],+X[3],+X[4],g)}}else U=ft;if(p=c.start||t.start||+new Date,b={anim:t,percent:i,timestamp:p,start:p+(t.del||0),status:0,initstatus:a||0,stop:!1,ms:g,easing:U,from:v,diff:m,to:y,el:n,callback:c.callback,prev:f,next:l,repeat:o||t.times,origin:n.attr(),totalOrigin:s},oe.push(b),a&&!h&&!u&&(b.stop=!0,b.start=new Date-g*a,1==oe.length))return he();u&&(b.start=new Date-b.ms*a),1==oe.length&&ce(he)}e("raphael.anim.start."+n.id,n,t)}}function m(t){for(var e=0;e<oe.length;e++)oe[e].el.paper==t&&oe.splice(e--,1)}r.version="2.1.2",r.eve=e;var b,_,w=/[, ]+/,E={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},C=/\{(\d+)\}/g,k="hasOwnProperty",S={doc:document,win:t},A={was:Object.prototype[k].call(S.win,"Raphael"),is:S.win.Raphael},B=function(){this.ca=this.customAttributes={}},N="apply",O="concat",T="ontouchstart"in S.win||S.win.DocumentTouch&&S.doc instanceof DocumentTouch,R="",I=" ",M=String,F="split",D="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[F](I),P={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},L=M.prototype.toLowerCase,z=Math,j=z.max,U=z.min,X=z.abs,G=z.pow,q=z.PI,H="number",W="array",V=Object.prototype.toString,Q=(r._ISURL=/^url\(['"]?([^\)]+?)['"]?\)$/i,/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i),Y={NaN:1,Infinity:1,"-Infinity":1},$=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,K=z.round,Z=parseFloat,J=parseInt,tt=M.prototype.toUpperCase,et=r._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0},rt=r._availableAnimAttrs={blur:H,"clip-rect":"csv",cx:H,cy:H,fill:"colour","fill-opacity":H,"font-size":H,height:H,opacity:H,path:"path",r:H,rx:H,ry:H,stroke:"colour","stroke-opacity":H,"stroke-width":H,transform:"transform",width:H,x:H,y:H},nt=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,it={hs:1,rg:1},at=/,?([achlmqrstvxz]),?/gi,st=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,ot=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,ct=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/gi,ht=(r._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,{}),ut=function(t,e){return Z(t)-Z(e)},lt=function(){},ft=function(t){return t},pt=r._rectPath=function(t,e,r,n,i){return i?[["M",t+i,e],["l",r-2*i,0],["a",i,i,0,0,1,i,i],["l",0,n-2*i],["a",i,i,0,0,1,-i,i],["l",2*i-r,0],["a",i,i,0,0,1,-i,-i],["l",0,2*i-n],["a",i,i,0,0,1,i,-i],["z"]]:[["M",t,e],["l",r,0],["l",0,n],["l",-r,0],["z"]]},dt=function(t,e,r,n){return null==n&&(n=r),[["M",t,e],["m",0,-n],["a",r,n,0,1,1,0,2*n],["a",r,n,0,1,1,0,-2*n],["z"]]},gt=r._getPath={path:function(t){return t.attr("path")},circle:function(t){var e=t.attrs;return dt(e.cx,e.cy,e.r)},ellipse:function(t){var e=t.attrs;return dt(e.cx,e.cy,e.rx,e.ry)},rect:function(t){var e=t.attrs;return pt(e.x,e.y,e.width,e.height,e.r)},image:function(t){var e=t.attrs;return pt(e.x,e.y,e.width,e.height)},text:function(t){var e=t._getBBox();return pt(e.x,e.y,e.width,e.height)},set:function(t){var e=t._getBBox();return pt(e.x,e.y,e.width,e.height)}},xt=r.mapPath=function(t,e){if(!e)return t;var r,n,i,a,s,o,c;for(t=Ft(t),i=0,s=t.length;i<s;i++)for(c=t[i],a=1,o=c.length;a<o;a+=2)r=e.x(c[a],c[a+1]),n=e.y(c[a],c[a+1]),c[a]=r,c[a+1]=n;return t};if(r._g=S,r.type=S.win.SVGAngle||S.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML","VML"==r.type){var vt,yt=S.doc.createElement("div");if(yt.innerHTML='<v:shape adj="1"/>',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(a<n)return e-a;if(a>t-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("<body>"),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<m)&&(C+=180),{x:d,y:g,m:{x:x,y:v},n:{x:y,y:m},start:{x:b,y:_},end:{x:w,y:E},alpha:C}},r.bezierBBox=function(t,e,n,i,a,s,o,c){r.is(t,"array")||(t=[t,e,n,i,a,s,o,c]);var h=Mt.apply(null,t);return{x:h.min.x,y:h.min.y,x2:h.max.x,y2:h.max.y,width:h.max.x-h.min.x,height:h.max.y-h.min.y}},r.isPointInsideBBox=function(t,e,r){return e>=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.x<e.x2&&t.x>e.x||e.x<t.x2&&e.x>t.x)&&(t.y<e.y2&&t.y>e.y||e.y<t.y2&&e.y>t.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;c<h;c++)if(r=t[c],"M"==r[0])i=r[1],a=r[2],s.push(i),o.push(a);else{var u=Mt(i,a,r[1],r[2],r[3],r[4],r[5],r[6]);s=s[O](u.min.x,u.max.x),o=o[O](u.min.y,u.max.y),i=r[5],a=r[6]}var l=U[N](0,s),f=U[N](0,o),p=j[N](0,s),d=j[N](0,o),g=p-l,x=d-f,v={x:l,y:f,x2:p,y2:d,width:g,height:x,cx:l+g/2,cy:f+x/2};return e.bbox=n(v),v},At=function(t){var e=n(t);return e.toString=r._path2string,e},Bt=r._pathToRelative=function(t){var e=kt(t);if(e.rel)return At(e.rel);r.is(t,W)&&r.is(t&&t[0],W)||(t=r.parsePathString(t));var n=[],i=0,a=0,s=0,o=0,c=0;"M"==t[0][0]&&(i=t[0][1],a=t[0][2],s=i,o=a,c++,n.push(["M",i,a]));for(var h=c,u=t.length;h<u;h++){var l=n[h]=[],f=t[h];if(f[0]!=L.call(f[0]))switch(l[0]=L.call(f[0]),l[0]){case"a":l[1]=f[1],l[2]=f[2],l[3]=f[3],l[4]=f[4],l[5]=f[5],l[6]=+(f[6]-i).toFixed(3),l[7]=+(f[7]-a).toFixed(3);break;case"v":l[1]=+(f[1]-a).toFixed(3);break;case"m":s=f[1],o=f[2];default:for(var p=1,d=f.length;p<d;p++)l[p]=+(f[p]-(p%2?i:a)).toFixed(3)}else{l=n[h]=[],"m"==f[0]&&(s=f[1]+i,o=f[2]+a);for(var g=0,x=f.........完整代码请登录后点击上方下载按钮下载查看

网友评论0