markdown-more
Version:
Helpers for creating markdown-js filters
2 lines • 39.4 kB
JavaScript
!function(e){function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){var n=t(15);t(8)(n),e.exports=n},function(e,r,t){r.markdown=t(16),r.parse=r.markdown.toHTML},function(e,r){registered=!1,e.exports=function(e){if(registered)return!1;registered=!0;var r={class_prefix:"input-checkbox",id_prefix:"checkbox"};e.register("before",function(e,t){t.markdown||(t.markdown={}),t.markdown.checkbox||(t.markdown.checkbox={}),t.markdown.checkbox.ids||(t.markdown.checkbox.ids=0),t.markdown.checkbox.class_prefix&&(r.class_prefix=t.markdown.checkbox.class_prefix),t.markdown.checkbox.id_prefix&&(r.id_prefix=t.markdown.checkbox.id_prefix)}),e.registerShortcode(/(\s)|(x|\*|✓|✔|☑)|(×|X|✕|☓|✖|✗|✘)/,function(e,t,n){var i=r.id_prefix,a=r.class_prefix,o=i+n.markdown.checkbox.ids++,s=e.match(this.regExp),l=t.title||t.label||"",c={type:"checkbox",class:a,id:o,name:o};s[2]&&(c.checked=""),s[3]&&(c.checked="",c.disabled=""),l&&(c.value=l);var u=["label",{id:o+"-wrapper",for:o,class:a+"-wrapper"},["input",c],["label",{id:o+"-label",for:o,class:a+"-label-wrapper"}]];return t.label&&u[3].push(["span",{class:a+"-label-text"},t.label]),[u]})}},function(e,r){registered=!1,e.exports=function(e){if(registered)return!1;registered=!0;var r={class_prefix:"embed",providers:{"youtube.com":function(e,r,t){e=e.split("?");for(var n=0,i=e.length;n<i&&!a&&!/^v=/.test(e[n]);)n++;var a=e[n];return!!a&&(a=a.replace(/v=/,""),r=r||560,t=t||315,["iframe",{height:t+"px",width:r+"px",allowfullscreen:"allowfullscreen",src:"//www.youtube.com/embed/"+a,frameborder:"0"}])},"youtu.be":function(e,r,t){return url=e.split("?").shift(),r=r||560,t=t||315,["iframe",{src:"//www.youtube.com/embed/"+url,frameborder:"0",height:t+"px",width:r+"px",allowfullscreen:"allowfullscreen"}]},"vimeo.com":function(e,r,t){var n=e.split("/").pop();return r=r||281,t=t||500,["iframe",{src:"//player.vimeo.com/video/"+n,frameborder:"0",height:t+"px",width:r+"px",allowfullscreen:"allowfullscreen",webkitallowfullscreen:"webkitallowfullscreen",mozallowfullscreen:"mozallowfullscreen"}]}}};e.register("before",function(t,n){n.markdown||(n.markdown={}),n.markdown.embed||(n.markdown.embed={});var i=n.markdown.embed.class_prefix||r.class_prefix;n.markdown.embed.class=i+" "+i+"-";var a,o=[],s=n.markdown.embed.providers;if(s)for(a in s)r.providers[a]=s[a];o=Object.keys(r.providers).map(e.escapeRegExp).join("|");var l=new RegExp("(?:(^|\n)(?:(\\d\\d+)x(\\d\\d+):)?(?:(?:https?:)\\/\\/(?:w+\\.)?("+o+")/(.*?)))(\n|$)","g");n.markdown.embed.regExp=l}),e.registerTokenFilter(function(e){return e.markdown.embed.regExp},function(e,t,n,i,a,o,s){var l=r.providers[i],c=this.markdown.embed.class+i.replace(/\.(com|net|org)$/,"").replace(/\./,""),u=l(a,t,n);if(!u)return!1;var f=["span",{class:c},u];return f})}},function(e,r){registered=!1,e.exports=function(e){if(registered)return!1;registered=!0;var r={class_prefix:"entity",render:function(e,r){return["span",{class:e},["span",r]]},characters:{"(c)":["copyright","©"],"<3":["heart","♥"],"(tm)":["trademark","™"],"(r)":["registered","®"],"~=":["approx","≈"],">=":["greaterOrEqual","≥"],"<=":["lowerOrEqual","≤"],"!=":["notEqual","≠"],"-->>":["rightArrow","⇒"],"<<--":["leftArrow","⇐"],"<<-->>":["leftRightArr","⇔"],"->":["rightArr","→"],"<-":["leftArr","←"],"<->":["leftRightArr","↔"],"--":["dash","—"]}};e.registerTokenFilter(function(e){return e.markdown.entities.regExp},function(e){var t=this.markdown.entities.class,n=r.characters,i=this.markdown.entities.render;if(n[e]){var a=n[e];return i(t+a[0],a[1])}}),e.register("before",function(t,n){n.markdown||(n.markdown={}),n.markdown.entities||(n.markdown.entities={});var i=n.markdown.entities.class_prefix||r.class_prefix;n.markdown.entities.class=i+" "+i+"-",n.markdown.entities.render=n.markdown.entities.render||r.render;var a=n.markdown.entities.characters;if(a)for(var o in a)r.characters[o]=a[o];var s=Object.keys(r.characters).map(e.escapeRegExp).join("|");n.markdown.entities.regExp=new RegExp("("+s+")","g")})}},function(e,r){registered=!1,e.exports=function(e){if(registered)return!1;registered=!0;var r={id_prefix:"",level:3};e.registerJsonFilter("header",function(e,r){var t=r.markdown.headers.level,n=e[1].level;if(n<=t){for(var i=0,a=r.markdown.headers.id_prefix,o=r.markdown.headers.ids,s=e[2];Array.isArray(s);)s=s[3]||s[2];if(e[1].id)return void(o[e[1].id]=[n,s]);for(var l=a+s.toLowerCase().replace(/\s+/g," ").replace(/\s/,"-").replace(/:|\[|\]|\{|\}|\%|\(|\)|\^|\$/,""),c=l;o[c];)c=l+i++;o[c]=[n,s],e[1].id=c}}),e.register("before",function(e,t){t.markdown||(t.markdown={}),t.markdown.headers||(t.markdown.headers={}),t.markdown.headers.level=t.markdown.headers.level||r.level,t.markdown.headers.id_prefix=t.markdown.headers.id_prefix||r.id_prefix,t.markdown.headers.ids=t.markdown.headers.ids||{}})}},function(e,r){registered=!1,e.exports=function(e){if(registered)return!1;registered=!0;var r={class_prefix:"fa",render:function(e,r){return["i",{class:e},["span",r]]},characters:{"+":"plus-circle","-":"minus-circle","#":"check",x:"times","?":"question"}};e.registerTokenFilter(function(e){return e.markdown.icons.regExp},function(e){var t=this.markdown.icons.class,n=r.characters,i=t+(n[e]||"default"),a=this.markdown.icons.render;return a(i,e)}),e.register("before",function(t,n){n.markdown||(n.markdown={}),n.markdown.icons||(n.markdown.icons={});var i=n.markdown.icons.class_prefix||r.class_prefix;n.markdown.icons.class=i+" "+i+"-",n.markdown.icons.render=n.markdown.icons.render||r.render;var a=n.markdown.icons.characters;if(a)for(var o in a)r.characters[o]=a[o];var s=Object.keys(r.characters).map(e.escapeRegExp).join("|");n.markdown.icons.regExp=new RegExp("(?:\\(("+s+")\\))","g")})}},function(e,r){registered=!1,e.exports=function(e){if(registered)return!1;registered=!0;var r={class_prefix:"iframe",default_width:400,default_height:300,default_border:0};e.registerCommandFilter("iframe",function(e,r,t){var n,i,a=e.replace(/^https?:/,"").replace(/^\/+/,"").split("/").shift().replace(/\.(com|org|net)/,"").replace(/\.(\w+)$/,"$1").split(".").shift();r&&(r=r.split("x"),i=r.shift(),n=r.shift()||i);var o={src:e,width:(i||this.markdown.iframe.default_width)+"px",height:(n||this.markdown.iframe.default_height)+"px",frameborder:(t||this.markdown.iframe.default_border)+""},s=this.markdown.iframe.className+a;return["span",{class:s},["iframe",o]]}),e.register("before",function(e,t){t.markdown||(t.markdown={}),t.markdown.iframe||(t.markdown.iframe={});var n=t.markdown.iframe.class_prefix||r.class_prefix;t.markdown.iframe.default_height=t.markdown.iframe.default_height||r.default_height,t.markdown.iframe.default_width=t.markdown.iframe.default_width||r.default_width,t.markdown.iframe.default_border=t.markdown.iframe.default_border||r.default_border,t.markdown.iframe.className=n+" "+n+"-"})}},function(e,r,t){e.exports=function(e){t(12)(e),t(5)(e),t(2)(e),t(3)(e),t(4)(e),t(6)(e),t(7)(e),t(9)(e),t(10)(e),t(13)(e)}},function(e,r){registered=!1,e.exports=function(e){return!registered&&(registered=!0,void e.register("before",function(e){e.str=e.str.replace(/([^\s])\n/g,"$1 \n")}))}},function(e,r,t){registered=!1,e.exports=function(e){return!registered&&(registered=!0,t(11)(e),void e.modifier("@",function(e,r){return["a",{class:"mention",href:"#/mentions/"+e},["em","@"],["span",e]]})("#",function(e,r){return["a",{class:"hashtag",href:"#/hashtags/"+e},["em","#"],["span",e]]}))}},function(e,r){var t=!1;e.exports=function(e){if(t)return!1;t=!0;var r={characters:{}};e.modifier=function(t,n){return arguments.length>1?(r.characters[t]=n,e.modifier):r.characters[t]},e.registerTokenFilter(function(e){return e.markdown.modifiers.regExp},function(e,t,n){var i=r.characters[e];if("function"==typeof i)return i.call(this,t)}),e.register("before",function(t,n){n.markdown||(n.markdown={}),n.markdown.modifiers||(n.markdown.modifiers={});var i=n.markdown.modifiers.class_prefix||r.class_prefix;n.markdown.modifiers.class=i+" "+i+"-";var a=n.markdown.modifiers.characters;if(a)for(var o in a)r.characters[o]=a[o];var s=Object.keys(r.characters).map(e.escapeRegExp).join("|");n.markdown.modifiers.regExp=new RegExp("(?:("+s+")([a-zA-Z0-9-_]+))","g")})}},function(e,r){registered=!1,e.exports=function(e){function r(e){return null==e?"":(""+e).replace(l,function(e){return s[e]})}function t(e,r){var t='";\n';return t+=/\(/.test(e)?"__p+=(function(_d){try{return _d."+e+';}catch(e){return "";}})(locals)':"__p+=((__t=(locals."+e+'))===null?"":'+(r?"__escape(__t)":"__t")+")",t+=';\n__p+="'}function n(e,n){var s,l='__p="',c=0;e.replace(i.evaluate,function(r,n,s){l+=e.slice(c,s).replace(o,function(e){return"\\"+a[e]});var u;if(i.iterate.test(n)){u=i.iterate.exec(n)||[];var f=u[1],p="___parent."+u[3],h="__obj__",d="__i__",g=u[2]||"key",m="length",v="___keys___";l+='";\n(function(___parent){\n\tif(!'+p+"){return;}\n\tvar __obj__="+p+","+d+"=0,"+v+","+f+",locals={"+f+":null,first:true,last:false,odd:false,even:true};\n\tif(!Array.isArray("+h+")){"+v+"=Object.keys("+h+");"+m+"="+v+".length;}\n\telse{"+m+"="+h+".length;}\n\tfor("+d+";"+d+"<"+m+";"+d+"++){\n\t\t"+g+"= ("+v+"?"+v+"["+d+"]:"+d+");\n\t\tlocals."+g+"="+g+";locals.first=("+d+"==0);locals.last=("+d+">="+m+");locals.even=(("+d+" %2)==0);locals.odd=!locals.even;\n\t\tlocals."+f+"="+h+"["+g+'];\n\t\t__p+="'}else if(i.conditional.test(n)){u=i.conditional.exec(n)||[];var _=u[1];_&&(_=_.replace(/(^|\s|\(|\||&)((?:\w+)[\w\d]+)/g,"$1locals.$2"),l+='";\n(function(){\n\tif('+_+'){\n__p+="')}else i.conditionalElse.test(n)?l+='";\n\t}else{\n__p+="':i.end.test(n)?l+='";\n}})(locals);locals=arguments[0];\n__p+="':i.escape.test(n)?(u=i.escape.exec(n)||[],l+=t(u[1],!0)):i.interpolate.test(n)&&(u=i.interpolate.exec(n)||[],l+=t(u[1]));c=s+r.length}),c<e.length&&(l+='";__p+="'+e.slice(c).replace(o,function(e){return"\\"+a[e]})+'";__p+="'),l+='";\nreturn __p;\n';try{s=new Function("locals","__escape",l)}catch(e){throw e.source=l,console.log("-----------------------"),console.log(l),console.log("-----------------------"),e}if(n)return s(n,r);var u=function(e){return s.call(this,e,r)};return l="function(locals,__escape){\n"+l+"}",u.source=l,u}if(registered)return!1;registered=!0;var i={evaluate:/\{\{([^`'"][\s\S]+?)\}\}/g,iterate:/^(?:each|for|#) (\w+)(?:\s*?,\s*?(\w+))?\s+?in\s+([\s\S]+)$/,end:/^end$/,conditionalElse:/^else$/,conditional:/^(?:\?|if)\s+?([\s\S]+)$/,escape:/^!\s?([\s\S]+)$/,interpolate:/^([\s\S]+)$/},a={'"':'"',"\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},o=/(\\|"|\r|\n|\t|\u2028|\u2029)/g,s={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},l=/[&<>"'\/"]/g;e.register("before",function(e,r){e.str=n(e.str,r||{})})}},function(e,r){registered=!1,e.exports=function(e){function r(r){e.registerJsonFilter(r,function(e,t,n,i){return[["span",{class:r+t.markdown.wrap.class_suffix},e]]})}function t(e){var t=e.markdown.wrap.wrappers,n=0,i=t&&t.length;if(i)for(i;n<i;n++)r(t[n])}if(registered)return!1;registered=!0;var n={class_suffix:"-wrapper"};e.register("before",function(e,r){r.markdown||(r.markdown={}),r.markdown.wrap||(r.markdown.wrap={}),r.markdown.wrap.class_suffix=r.markdown.wrap.class_suffix||n.class_suffix,t(r)}),e.wrap=r}},function(e,r,t){var n=t(1).markdown,i=e.exports=n.Markdown.subclassDialect(n.Markdown.dialects.Maruku),a={js:"javascript",htm:"markup",html:"markup"};i.inline["`"]=function(e){var r=e.match(/(`+)(?:(\w+)\s*?\n)?(([\s\S]*?)\1)/);if(r&&r[3]){var t=r[1].length+r[3].length,e=r[4];if(r[1].length>2){if(r[2]){t+=r[2].length+1;var n=r[2].replace(/\s/g,"").toLowerCase();return n=a[n]?a[n]:n,[t,["code_block",{class:"language-"+n},e]]}return[t,["code_block",e]]}return[t,["inlinecode",e]]}return[1,"`"]}},function(e,r,t){var n=t(1).markdown,i=t(14);e.exports=function(){function e(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function r(e,r,t){var n,i=0,a=e.length;for(i;i<a;i++)(n=e[i])(r,t,r)}function t(e,r,t,n){return r>e.length&&(r=e.length),n||(n=t,t=0),Array.prototype.splice.apply(e,[r,t].concat(n)),e}function a(e,t){if(!e)return"";t=t||{};var a={str:e};d.before&&d.before.length&&r(d.before,a,t);var o=n.parse(a.str,t&&t.dialect||i);l(t,o),d.transform&&d.transform.length&&r(d.transform,o,t);var s=n.toHTMLTree(o);d.html&&d.html.length&&r(d.html,s,t);var c={str:n.renderJsonML(s)};return d.after&&d.after.length&&r(d.after,c,t),c.str}function o(e,r){if(!r)return s(e);if(!d[e])throw new Error('hook "'+e+'" does not exist');return d[e].push(r),s(e)}function s(e){return function(r){return o(e,r)}}function l(e,r){var n=r[1].references;!function r(i,a,o){var s,l,c,u,f=0;if("string"==typeof i){if(0==a||"inlinecode"==o[0]||!i||/^\s+?\n?$/.test(i))return;c="string"}else{if(!Array.isArray(i))return;if(c=i[0],"link"!==c||g.test(i[1].href)){if("link_ref"===c){var l=i[1].ref;n&&n[l]||(i[0]="shortcode",c="shortcode")}}else i[1].label=i[1].href,i[0]="shortcode",delete i[1].href,c="shortcode";if("shortcode"===c&&m.test(i[2])){var p=m.exec(i[2]),h=p[1];if(d.command[h]){var v=(p[2]&&p[2].split("|")||[]).concat(i[1].label&&i[1].label.split("|")||[]);ret=d.command[h](h,v,e),ret?(o[a]=ret,c="string"==typeof ret&&"string"||ret[0]):(o[a]="",c="null")}}var _=0;for(_;_<i.length;_++)r(i[_],_,i)}if((u=d.json[c])&&(s=u.length))for(f=0;f<s;f++)ret=u[f](o[a],e,o,a),ret&&(Array.isArray(ret)?t(o,a,1,ret):o[a]=ret)}(r)}function c(e,r){d.json[e]||(d.json[e]=[]),d.json[e].push(r)}function u(r,t){r instanceof RegExp||(r=new RegExp("^"+e(r)+"$","g"));var n=function(e,i,a,o){var s=e[2],l=e[1];if(r.test(s)){var c=t.call(n,s,l,i,e,a,o);return c}};n.regExp=r,c("shortcode",n)}function f(e,r){var t=function(e,t,n){return r.apply(n,t)};d.command[e]=t}function p(e){var r=function(t,n,i){if(Array.isArray(t))t=t.map(function(e,t){return r(e,n,i)});else if(t&&"string"==typeof t){var a=e.call(r,t,n,i);if(a)return a}return t};c("string",r)}function h(e,r){p(function(t,n,i){var a=e(n);if(t.match(a)){var o=[""],s=0;return t.replace(a,function(e){var i,a=1,l=arguments.length-2,c=[],u=arguments[l],f=t.slice(s,u);for(s=u+e.length,a;a<l;a++)c.push(arguments[a]);c.push(e),f&&o.push(f);var i=r.apply(n,c);i&&o.push(i)}),s<t.length&&o.push(t.slice(s)),o}})}var d={before:[],json:{},command:{},html:[],after:[],transform:[]},g=/^((((http|ftp)s?:)?\/\/)|\.\/)[^\s]+$/,m=/^([a-zA-Z0-9]+)(?:\s(.+)$)?/;return a.register=o,a.markdown=n,a.registerJsonFilter=c,a.registerShortcode=u,a.registerStringFilter=p,a.registerCommandFilter=f,a.registerTokenFilter=h,a.escapeRegExp=e,a}()},function(e,r,t){!function(e){function r(){return"Markdown.mk_block( "+uneval(this.toString())+", "+uneval(this.trailing)+", "+uneval(this.lineNumber)+" )"}function n(){var e=t(20);return"Markdown.mk_block( "+e.inspect(this.toString())+", "+e.inspect(this.trailing)+", "+e.inspect(this.lineNumber)+" )"}function i(e){for(var r=0,t=-1;(t=e.indexOf("\n",t+1))!==-1;)r++;return r}function o(e,r){function t(e){this.len_after=e,this.name="close_"+r}var n=e+"_state",i="strong"==e?"em_state":"strong_state";return function(a,o){if(this[n][0]==r)return this[n].shift(),[a.length,new t(a.length-r.length)];var s=this[i].slice(),l=this[n].slice();this[n].unshift(r);var c=this.processInline(a.substr(r.length)),u=c[c.length-1];this[n].shift();if(u instanceof t){c.pop();var f=a.length-u.len_after;return[f,[e].concat(c)]}return this[i]=s,this[n]=l,[r.length,r]}}function s(e){for(var r=e.split(""),t=[""],n=!1;r.length;){var i=r.shift();switch(i){case" ":n?t[t.length-1]+=i:t.push("");break;case"'":case'"':n=!n;break;case"\\":i=r.shift();default:t[t.length-1]+=i}}return t}function l(e){return v(e)&&e.length>1&&"object"==typeof e[1]&&!v(e[1])?e[1]:void 0}function c(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function u(e){if("string"==typeof e)return c(e);var r=e.shift(),t={},n=[];for(!e.length||"object"!=typeof e[0]||e[0]instanceof Array||(t=e.shift());e.length;)n.push(u(e.shift()));var i="";for(var a in t)i+=" "+a+'="'+c(t[a])+'"';return"img"==r||"br"==r||"hr"==r?"<"+r+i+"/>":"<"+r+i+">"+n.join("")+"</"+r+">"}function f(e,r,t){var n;t=t||{};var i=e.slice(0);"function"==typeof t.preprocessTreeNode&&(i=t.preprocessTreeNode(i,r));var a=l(i);if(a){i[1]={};for(n in a)i[1][n]=a[n];a=i[1]}if("string"==typeof i)return i;switch(i[0]){case"header":i[0]="h"+i[1].level,delete i[1].level;break;case"bulletlist":i[0]="ul";break;case"numberlist":i[0]="ol";break;case"listitem":i[0]="li";break;case"para":i[0]="p";break;case"markdown":i[0]="html",a&&delete a.references;break;case"code_block":i[0]="pre",n=a?2:1;var o=["code"];o.push.apply(o,i.splice(n,i.length-n)),i[n]=o;break;case"inlinecode":i[0]="code";break;case"img":i[1].src=i[1].href,delete i[1].href;break;case"linebreak":i[0]="br";break;case"link":i[0]="a";break;case"link_ref":i[0]="a";var s=r[a.ref];if(!s)return a.original;delete a.ref,a.href=s.href,s.title&&(a.title=s.title),delete a.original;break;case"img_ref":i[0]="img";var s=r[a.ref];if(!s)return a.original;delete a.ref,a.src=s.href,s.title&&(a.title=s.title),delete a.original}if(n=1,a){for(var c in i[1]){n=2;break}1===n&&i.splice(n,1)}for(;n<i.length;++n)i[n]=f(i[n],r,t);return i}function h(e){for(var r=l(e)?2:1;r<e.length;)"string"==typeof e[r]?r+1<e.length&&"string"==typeof e[r+1]?e[r]+=e.splice(r+1,1)[0]:++r:(h(e[r]),++r)}var d=e.Markdown=function(e){switch(typeof e){case"undefined":this.dialect=d.dialects.Gruber;break;case"object":this.dialect=e;break;default:if(!(e in d.dialects))throw new Error("Unknown Markdown dialect '"+String(e)+"'");this.dialect=d.dialects[e]}this.em_state=[],this.strong_state=[],this.debug_indent=""};e.parse=function(e,r){var t=new d(r);return t.toTree(e)},e.toHTML=function(r,t,n){var i=e.toHTMLTree(r,t,n);return e.renderJsonML(i)},e.toHTMLTree=function(e,r,t){"string"==typeof e&&(e=this.parse(e,r));var n=l(e),i={};n&&n.references&&(i=n.references);var a=f(e,i,t);return h(a),a};var g=d.mk_block=function(e,t,i){1==arguments.length&&(t="\n\n");var a=new String(e);return a.trailing=t,a.inspect=n,a.toSource=r,void 0!=i&&(a.lineNumber=i),a};d.prototype.split_blocks=function(e,r){e=e.replace(/(\r\n|\n|\r)/g,"\n");var t,n=/([\s\S]+?)($|\n#|\n(?:\s*\n|$)+)/g,a=[],o=1;for(null!=(t=/^(\s*\n)/.exec(e))&&(o+=i(t[0]),n.lastIndex=t[0].length);null!==(t=n.exec(e));)"\n#"==t[2]&&(t[2]="\n",n.lastIndex--),a.push(g(t[1],t[2],o)),o+=i(t[0]);return a},d.prototype.processBlock=function(e,r){var t=this.dialect.block,n=t.__order__;if("__call__"in t)return t.__call__.call(this,e,r);for(var i=0;i<n.length;i++){var a=t[n[i]].call(this,e,r);if(a)return(!v(a)||a.length>0&&!v(a[0]))&&this.debug(n[i],"didn't return a proper array"),a}return[]},d.prototype.processInline=function(e){return this.dialect.inline.__call__.call(this,String(e))},d.prototype.toTree=function(e,r){var t=e instanceof Array?e:this.split_blocks(e),n=this.tree;try{for(this.tree=r||this.tree||["markdown"];t.length;){var i=this.processBlock(t.shift(),t);i.length&&this.tree.push.apply(this.tree,i)}return this.tree}finally{r&&(this.tree=n)}},d.prototype.debug=function(){var e=Array.prototype.slice.call(arguments);e.unshift(this.debug_indent),"undefined"!=typeof print&&print.apply(print,e),"undefined"!=typeof console&&"undefined"!=typeof console.log&&console.log.apply(null,e)},d.prototype.loop_re_over_block=function(e,r,t){for(var n,i=r.valueOf();i.length&&null!=(n=e.exec(i));)i=i.substr(n[0].length),t.call(this,n);return i},d.dialects={},d.dialects.Gruber={block:{atxHeader:function(e,r){var t=e.match(/^(#{1,6})\s*(.*?)\s*#*\s*(?:\n|$)/);if(t){var n=["header",{level:t[1].length}];return Array.prototype.push.apply(n,this.processInline(t[2])),t[0].length<e.length&&r.unshift(g(e.substr(t[0].length),e.trailing,e.lineNumber+2)),[n]}},setextHeader:function(e,r){var t=e.match(/^(.*)\n([-=])\2\2+(?:\n|$)/);if(t){var n="="===t[2]?1:2,i=["header",{level:n},t[1]];return t[0].length<e.length&&r.unshift(g(e.substr(t[0].length),e.trailing,e.lineNumber+2)),[i]}},code:function(e,r){var t=[],n=/^(?: {0,3}\t| {4})(.*)\n?/;if(e.match(n)){e:for(;;){var i=this.loop_re_over_block(n,e.valueOf(),function(e){t.push(e[1])});if(i.length){r.unshift(g(i,e.trailing));break e}if(!r.length)break e;if(!r[0].match(n))break e;t.push(e.trailing.replace(/[^\n]/g,"").substring(2)),e=r.shift()}return[["code_block",t.join("\n")]]}},horizRule:function(e,r){var t=e.match(/^(?:([\s\S]*?)\n)?[ \t]*([-_*])(?:[ \t]*\2){2,}[ \t]*(?:\n([\s\S]*))?$/);if(t){var n=[["hr"]];return t[1]&&n.unshift.apply(n,this.processBlock(t[1],[])),t[3]&&r.unshift(g(t[3])),n}},lists:function(){function e(e){return new RegExp("(?:^("+l+"{0,"+e+"} {0,3})("+a+")\\s+)|(^"+l+"{0,"+(e-1)+"}[ ]{0,4})")}function r(e){return e.replace(/ {0,3}\t/g," ")}function t(e,r,t,n){if(r)return void e.push(["para"].concat(t));var i=e[e.length-1]instanceof Array&&"para"==e[e.length-1][0]?e[e.length-1]:e;n&&e.length>1&&t.unshift(n);for(var a=0;a<t.length;a++){var o=t[a],s="string"==typeof o;s&&i.length>1&&"string"==typeof i[i.length-1]?i[i.length-1]+=o:i.push(o)}}function n(e,r){for(var t=new RegExp("^("+l+"{"+e+"}.*?\\n?)*$"),n=new RegExp("^"+l+"{"+e+"}","gm"),i=[];r.length>0&&t.exec(r[0]);){var a=r.shift(),o=a.replace(n,"");i.push(g(o,a.trailing,a.lineNumber))}return i}function i(e,r,t){var n=e.list,i=n[n.length-1];if(!(i[1]instanceof Array&&"para"==i[1][0]))if(r+1==t.length)i.push(["para"].concat(i.splice(1,i.length-1)));else{var a=i.pop();i.push(["para"].concat(i.splice(1,i.length-1)),a)}}var a="[*+-]|\\d+\\.",o=/[*+-]/,s=new RegExp("^( {0,3})("+a+")[ \t]+"),l="(?: {0,3}\\t| {4})";return function(a,l){function c(e){var r=o.exec(e[2])?["bulletlist"]:["numberlist"];return h.push({list:r,indent:e[1]}),r}var u=a.match(s);if(u){for(var f,p,h=[],d=c(u),g=!1,v=[h[0].list];;){for(var _=a.split(/(?=\n)/),b="",k=0;k<_.length;k++){var w="",y=_[k].replace(/^\n/,function(e){return w=e,""}),x=e(h.length);if(u=y.match(x),void 0!==u[1]){b.length&&(t(f,g,this.processInline(b),w),g=!1,b=""),u[1]=r(u[1]);var E=Math.floor(u[1].length/4)+1;if(E>h.length)d=c(u),f.push(d),f=d[1]=["listitem"];else{var j=!1;for(p=0;p<h.length;p++)if(h[p].indent==u[1]){d=h[p].list,h.splice(p+1,h.length-(p+1)),j=!0;break}j||(E++,E<=h.length?(h.splice(E,h.length-E),d=h[E-1].list):(d=c(u),f.push(d))),f=["listitem"],d.push(f)}w=""}y.length>u[0].length&&(b+=w+y.substr(u[0].length))}b.length&&(t(f,g,this.processInline(b),w),g=!1,b="");var $=n(h.length,l);$.length>0&&(m(h,i,this),f.push.apply(f,this.toTree($,[])));var S=l[0]&&l[0].valueOf()||"";if(!S.match(s)&&!S.match(/^ /))break;a=l.shift();var A=this.dialect.block.horizRule(a,l);if(A){v.push.apply(v,A);break}m(h,i,this),g=!0}return v}}}(),blockquote:function(e,r){if(e.match(/^>/m)){var t=[];if(">"!=e[0]){for(var n=e.split(/\n/),i=[],a=e.lineNumber;n.length&&">"!=n[0][0];)i.push(n.shift()),a++;var o=g(i.join("\n"),"\n",e.lineNumber);t.push.apply(t,this.processBlock(o,[])),e=g(n.join("\n"),e.trailing,a)}for(;r.length&&">"==r[0][0];){var s=r.shift();e=g(e+e.trailing+s,s.trailing,e.lineNumber)}var c=e.replace(/^> ?/gm,""),u=(this.tree,this.toTree(c,["blockquote"])),f=l(u);return f&&f.references&&(delete f.references,_(f)&&u.splice(1,1)),t.push(u),t}},referenceDefn:function(e,r){var t=/^\s*\[(.*?)\]:\s*(\S+)(?:\s+(?:(['"])(.*?)\3|\((.*?)\)))?\n?/;if(e.match(t)){l(this.tree)||this.tree.splice(1,0,{});var n=l(this.tree);void 0===n.references&&(n.references={});var i=this.loop_re_over_block(t,e,function(e){e[2]&&"<"==e[2][0]&&">"==e[2][e[2].length-1]&&(e[2]=e[2].substring(1,e[2].length-1));var r=n.references[e[1].toLowerCase()]={href:e[2]};void 0!==e[4]?r.title=e[4]:void 0!==e[5]&&(r.title=e[5])});return i.length&&r.unshift(g(i,e.trailing)),[]}},para:function(e,r){return[["para"].concat(this.processInline(e))]}}},d.dialects.Gruber.inline={__oneElement__:function(e,r,t){var n,i;r=r||this.dialect.inline.__patterns__;var a=new RegExp("([\\s\\S]*?)("+(r.source||r)+")");if(n=a.exec(e),!n)return[e.length,e];if(n[1])return[n[1].length,n[1]];var i;return n[2]in this.dialect.inline&&(i=this.dialect.inline[n[2]].call(this,e.substr(n.index),n,t||[])),i=i||[n[2].length,n[2]]},__call__:function(e,r){function t(e){"string"==typeof e&&"string"==typeof i[i.length-1]?i[i.length-1]+=e:i.push(e)}for(var n,i=[];e.length>0;)n=this.dialect.inline.__oneElement__.call(this,e,r,i),e=e.substr(n.shift()),m(n,t);return i},"]":function(){},"}":function(){},__escape__:/^\\[\\`\*_{}\[\]()#\+.!\-]/,"\\":function(e){return this.dialect.inline.__escape__.exec(e)?[2,e.charAt(1)]:[1,"\\"]},"![":function(e){var r=e.match(/^!\[(.*?)\][ \t]*\([ \t]*([^")]*?)(?:[ \t]+(["'])(.*?)\3)?[ \t]*\)/);if(r){r[2]&&"<"==r[2][0]&&">"==r[2][r[2].length-1]&&(r[2]=r[2].substring(1,r[2].length-1)),r[2]=this.dialect.inline.__call__.call(this,r[2],/\\/)[0];var t={alt:r[1],href:r[2]||""};return void 0!==r[4]&&(t.title=r[4]),[r[0].length,["img",t]]}return r=e.match(/^!\[(.*?)\][ \t]*\[(.*?)\]/),r?[r[0].length,["img_ref",{alt:r[1],ref:r[2].toLowerCase(),original:r[0]}]]:[2,"!["]},"[":function e(r){var t=String(r),n=d.DialectHelpers.inline_until_char.call(this,r.substr(1),"]");if(!n)return[1,"["];var e,i,a=1+n[0],o=n[1];r=r.substr(a);var s=r.match(/^\s*\([ \t]*([^"']*)(?:[ \t]+(["'])(.*?)\2)?[ \t]*\)/);if(s){var l=s[1];if(a+=s[0].length,l&&"<"==l[0]&&">"==l[l.length-1]&&(l=l.substring(1,l.length-1)),!s[3])for(var c=1,u=0;u<l.length;u++)switch(l[u]){case"(":c++;break;case")":0==--c&&(a-=l.length-u,l=l.substring(0,u))}return l=this.dialect.inline.__call__.call(this,l,/\\/)[0],i={href:l||""},void 0!==s[3]&&(i.title=s[3]),e=["link",i].concat(o),[a,e]}return s=r.match(/^\s*\[(.*?)\]/),s?(a+=s[0].length,i={ref:(s[1]||String(o)).toLowerCase(),original:t.substr(0,a)},e=["link_ref",i].concat(o),[a,e]):1==o.length&&"string"==typeof o[0]?(i={ref:o[0].toLowerCase(),original:t.substr(0,a)},e=["link_ref",i,o[0]],[a,e]):[1,"["]},"<":function(e){var r;return null!=(r=e.match(/^<(?:((https?|ftp|mailto):[^>]+)|(.*?@.*?\.[a-zA-Z]+))>/))?r[3]?[r[0].length,["link",{href:"mailto:"+r[3]},r[3]]]:"mailto"==r[2]?[r[0].length,["link",{href:r[1]},r[1].substr("mailto:".length)]]:[r[0].length,["link",{href:r[1]},r[1]]]:[1,"<"]},"`":function(e){var r=e.match(/(`+)(([\s\S]*?)\1)/);return r&&r[2]?[r[1].length+r[2].length,["inlinecode",r[3]]]:[1,"`"]}," \n":function(e){return[3,["linebreak"]]}},d.dialects.Gruber.inline["**"]=o("strong","**"),d.dialects.Gruber.inline.__=o("strong","__"),d.dialects.Gruber.inline["*"]=o("em","*"),d.dialects.Gruber.inline._=o("em","_"),d.buildBlockOrder=function(e){var r=[];for(var t in e)"__order__"!=t&&"__call__"!=t&&r.push(t);e.__order__=r},d.buildInlinePatterns=function(e){var r=[];for(var t in e)if(!t.match(/^__.*__$/)){var n=t.replace(/([\\.*+?|()\[\]{}])/g,"\\$1").replace(/\n/,"\\n");r.push(1==t.length?n:"(?:"+n+")")}r=r.join("|"),e.__patterns__=r;var i=e.__call__;e.__call__=function(e,t){return void 0!=t?i.call(this,e,t):i.call(this,e,r)}},d.DialectHelpers={},d.DialectHelpers.inline_until_char=function(e,r){for(var t=0,n=[];;){if(e.charAt(t)==r)return t++,[t,n];if(t>=e.length)return null;var i=this.dialect.inline.__oneElement__.call(this,e.substr(t));t+=i[0],n.push.apply(n,i.slice(1))}},d.subclassDialect=function(e){function r(){}function t(){}return r.prototype=e.block,t.prototype=e.inline,{block:new r,inline:new t}},d.buildBlockOrder(d.dialects.Gruber.block),d.buildInlinePatterns(d.dialects.Gruber.inline),d.dialects.Maruku=d.subclassDialect(d.dialects.Gruber),d.dialects.Maruku.processMetaHash=function(e){for(var r=s(e),t={},n=0;n<r.length;++n)if(/^#/.test(r[n]))t.id=r[n].substring(1);else if(/^\./.test(r[n]))t.class?t.class=t.class+r[n].replace(/./," "):t.class=r[n].substring(1);else if(/\=/.test(r[n])){var i=r[n].split(/\=/);t[i[0]]=i[1]}return t},d.dialects.Maruku.block.document_meta=function(e,r){if(!(e.lineNumber>1)&&e.match(/^(?:\w+:.*\n)*\w+:.*$/)){l(this.tree)||this.tree.splice(1,0,{});var t=e.split(/\n/);for(p in t){var n=t[p].match(/(\w+):\s*(.*)$/),i=n[1].toLowerCase(),a=n[2];this.tree[1][i]=a}return[]}},d.dialects.Maruku.block.block_meta=function(e,r){var t=e.match(/(^|\n) {0,3}\{:\s*((?:\\\}|[^\}])*)\s*\}$/);if(t){var n,i=this.dialect.processMetaHash(t[2]);if(""===t[1]){var o=this.tree[this.tree.length-1];if(n=l(o),"string"==typeof o)return;n||(n={},o.splice(1,0,n));for(a in i)n[a]=i[a];return[]}var s=e.replace(/\n.*$/,""),c=this.processBlock(s,[]);n=l(c[0]),n||(n={},c[0].splice(1,0,n));for(a in i)n[a]=i[a];return c}},d.dialects.Maruku.block.definition_list=function(e,r){var t,n,i=/^((?:[^\s:].*\n)+):\s+([\s\S]+)$/,a=["dl"];if(n=e.match(i)){for(var o=[e];r.length&&i.exec(r[0]);)o.push(r.shift());for(var s=0;s<o.length;++s){var n=o[s].match(i),l=n[1].replace(/\n$/,"").split(/\n/),c=n[2].split(/\n:\s+/);for(t=0;t<l.length;++t)a.push(["dt",l[t]]);for(t=0;t<c.length;++t)a.push(["dd"].concat(this.processInline(c[t].replace(/(\n)\s+/,"$1"))))}return[a]}},d.dialects.Maruku.block.table=function e(r,t){var n,i,a=function(e,r){r=r||"\\s",r.match(/^[\\|\[\]{}?*.+^$]$/)&&(r="\\"+r);for(var t,n=[],i=new RegExp("^((?:\\\\.|[^\\\\"+r+"])*)"+r+"(.*)");t=e.match(i);)n.push(t[1]),e=t[2];return n.push(e),n},o=/^ {0,3}\|(.+)\n {0,3}\|\s*([\-:]+[\-| :]*)\n((?:\s*\|.*(?:\n|$))*)(?=\n|$)/,s=/^ {0,3}(\S(?:\\.|[^\\|])*\|.*)\n {0,3}([\-:]+\s*\|[\-| :]*)\n((?:(?:\\.|[^\\|])*\|.*(?:\n|$))*)(?=\n|$)/;if(i=r.match(o))i[3]=i[3].replace(/^\s*\|/gm,"");else if(!(i=r.match(s)))return;var e=["table",["thead",["tr"]],["tbody"]];i[2]=i[2].replace(/\|\s*$/,"").split("|");var l=[];for(m(i[2],function(e){e.match(/^\s*-+:\s*$/)?l.push({align:"right"}):e.match(/^\s*:-+\s*$/)?l.push({align:"left"}):e.match(/^\s*:-+:\s*$/)?l.push({align:"center"}):l.push({})}),i[1]=a(i[1].replace(/\|\s*$/,""),"|"),n=0;n<i[1].length;n++)e[1][1].push(["th",l[n]||{}].concat(this.processInline(i[1][n].trim())));return m(i[3].replace(/\|\s*$/gm,"").split("\n"),function(r){var t=["tr"];for(r=a(r,"|"),n=0;n<r.length;n++)t.push(["td",l[n]||{}].concat(this.processInline(r[n].trim())));e[2].push(t)},this),[e]},d.dialects.Maruku.inline["{:"]=function(e,r,t){if(!t.length)return[2,"{:"];var n=t[t.length-1];if("string"==typeof n)return[2,"{:"];var i=e.match(/^\{:\s*((?:\\\}|[^\}])*)\s*\}/);if(!i)return[2,"{:"];var a=this.dialect.processMetaHash(i[1]),o=l(n);o||(o={},n.splice(1,0,o));for(var s in a)o[s]=a[s];return[i[0].length,""]},d.dialects.Maruku.inline.__escape__=/^\\[\\`\*_{}\[\]()#\+.!\-|:]/,d.buildBlockOrder(d.dialects.Maruku.block),d.buildInlinePatterns(d.dialects.Maruku.inline);var m,v=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)};m=Array.prototype.forEach?function(e,r,t){return e.forEach(r,t)}:function(e,r,t){for(var n=0;n<e.length;n++)r.call(t||e,e[n],n,e)};var _=function(e){for(var r in e)if(hasOwnProperty.call(e,r))return!1;return!0};e.renderJsonML=function(e,r){r=r||{},r.root=r.root||!1;var t=[];if(r.root)t.push(u(e));else for(e.shift(),!e.length||"object"!=typeof e[0]||e[0]instanceof Array||e.shift();e.length;)t.push(u(e.shift()));return t.join("\n\n")}}(function(){return r}())},function(e,r){function t(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function i(e){if(u===setTimeout)return setTimeout(e,0);if((u===t||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(r){try{return u.call(null,e,0)}catch(r){return u.call(this,e,0)}}}function a(e){if(f===clearTimeout)return clearTimeout(e);if((f===n||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(r){try{return f.call(null,e)}catch(r){return f.call(this,e)}}}function o(){g&&h&&(g=!1,h.length?d=h.concat(d):m=-1,d.length&&s())}function s(){if(!g){var e=i(o);g=!0;for(var r=d.length;r;){for(h=d,d=[];++m<r;)h&&h[m].run();m=-1,r=d.length}h=null,g=!1,a(e)}}function l(e,r){this.fun=e,this.array=r}function c(){}var u,f,p=e.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:t}catch(e){u=t}try{f="function"==typeof clearTimeout?clearTimeout:n}catch(e){f=n}}();
var h,d=[],g=!1,m=-1;p.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];d.push(new l(e,r)),1!==d.length||g||i(s)},l.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,r){"function"==typeof Object.create?e.exports=function(e,r){e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,r){e.super_=r;var t=function(){};t.prototype=r.prototype,e.prototype=new t,e.prototype.constructor=e}},function(e,r){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,r,t){(function(e,n){function i(e,t){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(t)?n.showHidden=t:t&&r._extend(n,t),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),l(n,e,n.depth)}function a(e,r){var t=i.styles[r];return t?"["+i.colors[t][0]+"m"+e+"["+i.colors[t][1]+"m":e}function o(e,r){return e}function s(e){var r={};return e.forEach(function(e,t){r[e]=!0}),r}function l(e,t,n){if(e.customInspect&&t&&$(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(n,e);return b(i)||(i=l(e,i,n)),i}var a=c(e,t);if(a)return a;var o=Object.keys(t),g=s(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),j(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return u(t);if(0===o.length){if($(t)){var m=t.name?": "+t.name:"";return e.stylize("[Function"+m+"]","special")}if(y(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(E(t))return e.stylize(Date.prototype.toString.call(t),"date");if(j(t))return u(t)}var v="",_=!1,k=["{","}"];if(d(t)&&(_=!0,k=["[","]"]),$(t)){var w=t.name?": "+t.name:"";v=" [Function"+w+"]"}if(y(t)&&(v=" "+RegExp.prototype.toString.call(t)),E(t)&&(v=" "+Date.prototype.toUTCString.call(t)),j(t)&&(v=" "+u(t)),0===o.length&&(!_||0==t.length))return k[0]+v+k[1];if(n<0)return y(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var x;return x=_?f(e,t,n,g,o):o.map(function(r){return p(e,t,n,g,r,_)}),e.seen.pop(),h(x,v,k)}function c(e,r){if(w(r))return e.stylize("undefined","undefined");if(b(r)){var t="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(t,"string")}return _(r)?e.stylize(""+r,"number"):g(r)?e.stylize(""+r,"boolean"):m(r)?e.stylize("null","null"):void 0}function u(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,r,t,n,i){for(var a=[],o=0,s=r.length;o<s;++o)M(r,String(o))?a.push(p(e,r,t,n,String(o),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(p(e,r,t,n,i,!0))}),a}function p(e,r,t,n,i,a){var o,s,c;if(c=Object.getOwnPropertyDescriptor(r,i)||{value:r[i]},c.get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),M(n,i)||(o="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=m(t)?l(e,c.value,null):l(e,c.value,t-1),s.indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function h(e,r,t){var n=0,i=e.reduce(function(e,r){return n++,r.indexOf("\n")>=0&&n++,e+r.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?t[0]+(""===r?"":r+"\n ")+" "+e.join(",\n ")+" "+t[1]:t[0]+r+" "+e.join(", ")+" "+t[1]}function d(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function m(e){return null===e}function v(e){return null==e}function _(e){return"number"==typeof e}function b(e){return"string"==typeof e}function k(e){return"symbol"==typeof e}function w(e){return void 0===e}function y(e){return x(e)&&"[object RegExp]"===A(e)}function x(e){return"object"==typeof e&&null!==e}function E(e){return x(e)&&"[object Date]"===A(e)}function j(e){return x(e)&&("[object Error]"===A(e)||e instanceof Error)}function $(e){return"function"==typeof e}function S(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function A(e){return Object.prototype.toString.call(e)}function O(e){return e<10?"0"+e.toString(10):e.toString(10)}function T(){var e=new Date,r=[O(e.getHours()),O(e.getMinutes()),O(e.getSeconds())].join(":");return[e.getDate(),D[e.getMonth()],r].join(" ")}function M(e,r){return Object.prototype.hasOwnProperty.call(e,r)}var z=/%[sdj%]/g;r.format=function(e){if(!b(e)){for(var r=[],t=0;t<arguments.length;t++)r.push(i(arguments[t]));return r.join(" ")}for(var t=1,n=arguments,a=n.length,o=String(e).replace(z,function(e){if("%%"===e)return"%";if(t>=a)return e;switch(e){case"%s":return String(n[t++]);case"%d":return Number(n[t++]);case"%j":try{return JSON.stringify(n[t++])}catch(e){return"[Circular]"}default:return e}}),s=n[t];t<a;s=n[++t])o+=m(s)||!x(s)?" "+s:" "+i(s);return o},r.deprecate=function(t,i){function a(){if(!o){if(n.throwDeprecation)throw new Error(i);n.traceDeprecation?console.trace(i):console.error(i),o=!0}return t.apply(this,arguments)}if(w(e.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(n.noDeprecation===!0)return t;var o=!1;return a};var R,N={};r.debuglog=function(e){if(w(R)&&(R=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!N[e])if(new RegExp("\\b"+e+"\\b","i").test(R)){var t=n.pid;N[e]=function(){var n=r.format.apply(r,arguments);console.error("%s %d: %s",e,t,n)}}else N[e]=function(){};return N[e]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=d,r.isBoolean=g,r.isNull=m,r.isNullOrUndefined=v,r.isNumber=_,r.isString=b,r.isSymbol=k,r.isUndefined=w,r.isRegExp=y,r.isObject=x,r.isDate=E,r.isError=j,r.isFunction=$,r.isPrimitive=S,r.isBuffer=t(19);var D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",T(),r.format.apply(r,arguments))},r.inherits=t(18),r._extend=function(e,r){if(!r||!x(r))return e;for(var t=Object.keys(r),n=t.length;n--;)e[t[n]]=r[t[n]];return e}}).call(r,function(){return this}(),t(17))}]);