webhook-action/node_modules/prettier/parser-markdown.js

20 lines
134 KiB
JavaScript
Raw Normal View History

!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((r=r||self).prettierPlugins=r.prettierPlugins||{},r.prettierPlugins.markdown={}))}(this,(function(r){"use strict";var e=function(){for(var r={},e=0;e<arguments.length;e++){var u=arguments[e];for(var n in u)t.call(u,n)&&(r[n]=u[n])}return r},t=Object.prototype.hasOwnProperty;function u(r,e){return r(e={exports:{}},e.exports),e.exports}function n(r){return r&&r.default||r}var o=Object.freeze({__proto__:null,default:{}}),a=u((function(r){"function"==typeof Object.create?r.exports=function(r,e){e&&(r.super_=e,r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(r,e){if(e){r.super_=e;var t=function(){};t.prototype=e.prototype,r.prototype=new t,r.prototype.constructor=r}}})),i=n(o),c=u((function(r){try{var e=i;if("function"!=typeof e.inherits)throw"";r.exports=e.inherits}catch(e){r.exports=a}})),s=function(r){var t,u,n;for(u in c(a,r),c(o,a),t=a.prototype)(n=t[u])&&"object"==typeof n&&(t[u]="concat"in n?n.concat():e(n));return a;function o(e){return r.apply(this,e)}function a(){return this instanceof a?r.apply(this,arguments):new o(arguments)}};var l=function(r,e,t){return function(){var u=t||this,n=u[r];return u[r]=!e,function(){u[r]=n}}};var D=function(r){var e=function(r){var e=[],t=r.indexOf("\n");for(;-1!==t;)e.push(t+1),t=r.indexOf("\n",t+1);return e.push(r.length+1),e}(String(r));return{toPosition:f(e),toOffset:p(e)}};function f(r){return function(e){var t=-1,u=r.length;if(e<0)return{};for(;++t<u;)if(r[t]>e)return{line:t+1,column:e-(r[t-1]||0)+1,offset:e};return{}}}function p(r){return function(e){var t=e&&e.line,u=e&&e.column;if(!isNaN(t)&&!isNaN(u)&&t-1 in r)return(r[t-2]||0)+u-1||0;return-1}}var d=function(r,e){return function(t){var u,n=0,o=t.indexOf("\\"),a=r[e],i=[];for(;-1!==o;)i.push(t.slice(n,o)),n=o+1,(u=t.charAt(n))&&-1!==a.indexOf(u)||i.push("\\"),o=t.indexOf("\\",n);return i.push(t.slice(n)),i.join("")}};var h={AElig:"Æ",AMP:"&",Aacute:"Á",Acirc:"Â",Agrave:"À",Aring:"Å",Atilde:"Ã",Auml:"Ä",COPY:"©",Ccedil:"Ç",ETH:"Ð",Eacute:"É",Ecirc:"Ê",Egrave:"È",Euml:"Ë",GT:">",Iacute:"Í",Icirc:"Î",Igrave:"Ì",Iuml:"Ï",LT:"<",Ntilde:"Ñ",Oacute:"Ó",Ocirc:"Ô",Ograve:"Ò",Oslash:"Ø",Otilde:"Õ",Ouml:"Ö",QUOT:'"',REG:"®",THORN:"Þ",Uacute:"Ú",Ucirc:"Û",Ugrave:"Ù",Uuml:"Ü",Yacute:"Ý",aacute:"á",acirc:"â",acute:"´",aelig:"æ",agrave:"à",amp:"&",aring:"å",atilde:"ã",auml:"ä",brvbar:"¦",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",ecirc:"ê",egrave:"è",eth:"ð",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",iacute:"í",icirc:"î",iexcl:"¡",igrave:"ì",iquest:"¿",iuml:"ï",laquo:"«",lt:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",oacute:"ó",ocirc:"ô",ograve:"ò",ordf:"ª",ordm:"º",oslash:"ø",otilde:"õ",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',raquo:"»",reg:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",thorn:"þ",times:"×",uacute:"ú",ucirc:"û",ugrave:"ù",uml:"¨",uuml:"ü",yacute:"ý",yen:"¥",yuml:"ÿ"},g=Object.freeze({__proto__:null,AElig:"Æ",AMP:"&",Aacute:"Á",Acirc:"Â",Agrave:"À",Aring:"Å",Atilde:"Ã",Auml:"Ä",COPY:"©",Ccedil:"Ç",ETH:"Ð",Eacute:"É",Ecirc:"Ê",Egrave:"È",Euml:"Ë",GT:">",Iacute:"Í",Icirc:"Î",Igrave:"Ì",Iuml:"Ï",LT:"<",Ntilde:"Ñ",Oacute:"Ó",Ocirc:"Ô",Ograve:"Ò",Oslash:"Ø",Otilde:"Õ",Ouml:"Ö",QUOT:'"',REG:"®",THORN:"Þ",Uacute:"Ú",Ucirc:"Û",Ugrave:"Ù",Uuml:"Ü",Yacute:"Ý",aacute:"á",acirc:"â",acute:"´",aelig:"æ",agrave:"à",amp:"&",aring:"å",atilde:"ã",auml:"ä",brvbar:"¦",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",ecirc:"ê",egrave:"è",eth:"ð",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",iacute:"í",icirc:"î",iexcl:"¡",igrave:"ì",iquest:"¿",iuml:"ï",laquo:"«",lt:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",oacute:"ó",ocirc:"ô",ograv
/*!
* repeat-string <https://github.com/jonschlinkert/repeat-string>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/;var br,Er="",vr=function(r,e){if("string"!=typeof r)throw new TypeError("expected a string");if(1===e)return r;if(2===e)return r+r;var t=r.length*e;if(br!==r||void 0===br)br=r,Er="";else if(Er.length>=t)return Er.substr(0,t);for(;t>Er.length&&e>1;)1&e&&(Er+=r),e>>=1,r+=r;return Er=(Er+=r).substr(0,t)};var Cr=function(r){var e=String(r),t=e.length;for(;"\n"===e.charAt(--t););return e.slice(0,t+1)};var Fr=function(r,e,t){var u,n,o,a=-1,i=e.length,c="",s="",l="",D="";for(;++a<i;)if(u=e.charAt(a),o)if(o=!1,c+=l,s+=D,l="",D="","\n"===u)l=u,D=u;else for(c+=u,s+=u;++a<i;){if(!(u=e.charAt(a))||"\n"===u){D=u,l=u;break}c+=u,s+=u}else if(" "===u&&e.charAt(a+1)===u&&e.charAt(a+2)===u&&e.charAt(a+3)===u)l+=wr,a+=3,o=!0;else if("\t"===u)l+=u,o=!0;else{for(n="";"\t"===u||" "===u;)n+=u,u=e.charAt(++a);if("\n"!==u)break;l+=n+u,D+=u}if(s)return!!t||r(c)({type:"code",lang:null,value:Cr(s)})},wr=vr(" ",4);var Ar=function(r,e,t){var u,n,o,a,i,c,s,l,D,f,p,d=this.options,h=e.length+1,g=0,m="";if(!d.gfm)return;for(;g<h&&(" "===(o=e.charAt(g))||"\t"===o);)m+=o,g++;if(f=g,"~"!==(o=e.charAt(g))&&"`"!==o)return;g++,n=o,u=1,m+=o;for(;g<h&&(o=e.charAt(g))===n;)m+=o,u++,g++;if(u<3)return;for(;g<h&&(" "===(o=e.charAt(g))||"\t"===o);)m+=o,g++;a="",i="";for(;g<h&&"\n"!==(o=e.charAt(g))&&"~"!==o&&"`"!==o;)" "===o||"\t"===o?i+=o:(a+=i+o,i=""),g++;if((o=e.charAt(g))&&"\n"!==o)return;if(t)return!0;(p=r.now()).column+=m.length,p.offset+=m.length,m+=a,a=this.decode.raw(this.unescape(a),p),i&&(m+=i);i="",l="",D="",c="",s="";for(;g<h;)if(o=e.charAt(g),c+=l,s+=D,l="",D="","\n"===o){for(c?(l+=o,D+=o):m+=o,i="",g++;g<h&&" "===(o=e.charAt(g));)i+=o,g++;if(l+=i,D+=i.slice(f),!(i.length>=4)){for(i="";g<h&&(o=e.charAt(g))===n;)i+=o,g++;if(l+=i,D+=i,!(i.length<u)){for(i="";g<h&&(" "===(o=e.charAt(g))||"\t"===o);)l+=o,D+=o,g++;if(!o||"\n"===o)break}}}else c+=o,D+=o,g++;return r(m+=c+l)({type:"code",lang:a||null,value:Cr(s)})};var yr=u((function(r,e){(e=r.exports=function(r){return r.replace(/^\s*|\s*$/g,"")}).left=function(r){return r.replace(/^\s*/,"")},e.right=function(r){return r.replace(/\s*$/,"")}})),qr=(yr.left,yr.right,function(r,e,t,u){var n,o,a,i,c,s,l=["pedantic","commonmark"],D=l.length,f=r.length,p=-1;for(;++p<f;){for(n=r[p],o=n[1]||{},a=n[0],i=-1,s=!1;++i<D;)if(void 0!==o[c=l[i]]&&o[c]!==t.options[c]){s=!0;break}if(!s&&e[a].apply(t,u))return!0}return!1});var kr=function(r,e,t){var u,n,o,a,i,c,s,l,D,f=this.offset,p=this.blockTokenizers,d=this.interruptBlockquote,h=r.now(),g=h.line,m=e.length,b=[],E=[],v=[],C=0;for(;C<m&&(" "===(n=e.charAt(C))||"\t"===n);)C++;if(">"!==e.charAt(C))return;if(t)return!0;C=0;for(;C<m;){for(a=e.indexOf("\n",C),s=C,l=!1,-1===a&&(a=m);C<m&&(" "===(n=e.charAt(C))||"\t"===n);)C++;if(">"===e.charAt(C)?(C++,l=!0," "===e.charAt(C)&&C++):C=s,i=e.slice(C,a),!l&&!yr(i)){C=s;break}if(!l&&(o=e.slice(C),qr(d,p,this,[r,o,!0])))break;c=s===C?i:e.slice(s,a),v.push(C-s),b.push(c),E.push(i),C=a+1}C=-1,m=v.length,u=r(b.join("\n"));for(;++C<m;)f[g]=(f[g]||0)+v[C],g++;return D=this.enterBlock(),E=this.tokenizeBlock(E.join("\n"),h),D(),u({type:"blockquote",children:E})};var xr=function(r,e,t){var u,n,o,a=this.options,i=e.length+1,c=-1,s=r.now(),l="",D="";for(;++c<i;){if(" "!==(u=e.charAt(c))&&"\t"!==u){c--;break}l+=u}o=0;for(;++c<=i;){if("#"!==(u=e.charAt(c))){c--;break}l+=u,o++}if(o>6)return;if(!o||!a.pedantic&&"#"===e.charAt(c+1))return;i=e.length+1,n="";for(;++c<i;){if(" "!==(u=e.charAt(c))&&"\t"!==u){c--;break}n+=u}if(!a.pedantic&&0===n.length&&u&&"\n"!==u)return;if(t)return!0;l+=n,n="",D="";for(;++c<i&&(u=e.charAt(c))&&"\n"!==u;)if(" "===u||"\t"===u||"#"===u){for(;" "===u||"\t"===u;)n+=u,u=e.charAt(++c);for(;"#"===u;)n+=u,u=e.charAt(++c);for(;" "===u||"\t"===u;)n+=u,u=e.charAt(++c);c--}else D+=n+u,n="";return s.column+=l.length,s.offset+=l.length,r(l+=D+n)({type:"heading",depth:o,children:this.tokenizeInline(D,s)})};var Br=function(r,e,t){var u,n,o,a,i=-1,c=e.length+1,s="";for(;++i<c&&("\t"===(u=e.charAt(i))||" "===u);)s+=u;if("*"!==u&&"-"!==u&&"_"!==u)return;n=u,s+=u,o=1,a="";for(;++i<c;)if((u=e.charAt(i))===n)o++,s+=a+n,a="";else{if(" "!
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/;var it=Object.prototype.hasOwnProperty,ct=Object.prototype.toString,st=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,Dt=function(r){return"function"==typeof Array.isArray?Array.isArray(r):"[object Array]"===ct.call(r)},ft=function(r){if(!r||"[object Object]"!==ct.call(r))return!1;var e,t=it.call(r,"constructor"),u=r.constructor&&r.constructor.prototype&&it.call(r.constructor.prototype,"isPrototypeOf");if(r.constructor&&!t&&!u)return!1;for(e in r);return void 0===e||it.call(r,e)},pt=function(r,e){st&&"__proto__"===e.name?st(r,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):r[e.name]=e.newValue},dt=function(r,e){if("__proto__"===e){if(!it.call(r,e))return;if(lt)return lt(r,e).value}return r[e]},ht=function r(){var e,t,u,n,o,a,i=arguments[0],c=1,s=arguments.length,l=!1;for("boolean"==typeof i&&(l=i,i=arguments[1]||{},c=2),(null==i||"object"!=typeof i&&"function"!=typeof i)&&(i={});c<s;++c)if(null!=(e=arguments[c]))for(t in e)u=dt(i,t),i!==(n=dt(e,t))&&(l&&n&&(ft(n)||(o=Dt(n)))?(o?(o=!1,a=u&&Dt(u)?u:[]):a=u&&ft(u)?u:{},pt(i,{name:t,newValue:r(l,a,n)})):void 0!==n&&pt(i,{name:t,newValue:n}));return i},gt=r=>{if("[object Object]"!==Object.prototype.toString.call(r))return!1;const e=Object.getPrototypeOf(r);return null===e||e===Object.prototype},mt=[].slice,bt=function(r,e){var t;return function(){var e,o=mt.call(arguments,0),a=r.length>o.length;a&&o.push(u);try{e=r.apply(null,o)}catch(r){if(a&&t)throw r;return u(r)}a||(e&&"function"==typeof e.then?e.then(n,u):e instanceof Error?u(e):n(e))};function u(){t||(t=!0,e.apply(null,arguments))}function n(r){u(null,r)}};var Et=Ct;Ct.wrap=bt;var vt=[].slice;function Ct(){var r=[],e={run:function(){var e=-1,t=vt.call(arguments,0,-1),u=arguments[arguments.length-1];if("function"!=typeof u)throw new Error("Expected function as last argument, not "+u);function n(o){var a=r[++e],i=vt.call(arguments,0),c=i.slice(1),s=t.length,l=-1;if(o)u(o);else{for(;++l<s;)null!==c[l]&&void 0!==c[l]||(c[l]=t[l]);t=c,a?bt(a,n).apply(null,t):u.apply(null,[null].concat(t))}}n.apply(null,[null].concat(t))},use:function(t){if("function"!=typeof t)throw new Error("Expected `fn` to be a function, not "+t);return r.push(t),e}};return e}var Ft={}.hasOwnProperty,wt=function(r){if(!r||"object"!=typeof r)return"";if(Ft.call(r,"position")||Ft.call(r,"type"))return yt(r.position);if(Ft.call(r,"start")||Ft.call(r,"end"))return yt(r);if(Ft.call(r,"line")||Ft.call(r,"column"))return At(r);return""};function At(r){return r&&"object"==typeof r||(r={}),qt(r.line)+":"+qt(r.column)}function yt(r){return r&&"object"==typeof r||(r={}),At(r.start)+"-"+At(r.end)}function qt(r){return r&&"number"==typeof r?r:1}var kt=Lt;function xt(){}xt.prototype=Error.prototype,Lt.prototype=new xt;var Bt=Lt.prototype;function Lt(r,e,t){var u,n,o;"string"==typeof e&&(t=e,e=null),u=function(r){var e,t=[null,null];"string"==typeof r&&(-1===(e=r.indexOf(":"))?t[1]=r:(t[0]=r.slice(0,e),t[1]=r.slice(e+1)));return t}(t),n=wt(e)||"1:1",o={start:{line:null,column:null},end:{line:null,column:null}},e&&e.position&&(e=e.position),e&&(e.start?(o=e,e=e.start):o.start=e),r.stack&&(this.stack=r.stack,r=r.message),this.message=r,this.name=n,this.reason=r,this.line=e?e.line:null,this.column=e?e.column:null,this.location=o,this.source=u[0],this.ruleId=u[1]}Bt.file="",Bt.name="",Bt.reason="",Bt.message="",Bt.stack="",Bt.fatal=null,Bt.column=null,Bt.line=null;var St="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function Tt(){throw new Error("setTimeout has not been defined")}function Nt(){throw new Error("clearTimeout has not been defined")}var Ot=Tt,Rt=Nt;function Pt(r){if(Ot===setTimeout)return setTimeout(r,0);if((Ot===Tt||!Ot)&&setTimeout)return Ot=setTimeout,setTimeout(r,0);try{return Ot(r,0)}catch(e){try{return Ot.call(null,r,0)}catch(e){return Ot.call(this,r,0)}}}"function"==typeof St.setTimeout&&(Ot=setTimeout),"function"==typeof St.clearTimeout&&(Rt=clearTimeout);var It,Ut=[],Vt=!1,jt=-1;function zt(){Vt&&It&&(Vt=!1,It.length?Ut=It.concat(Ut):jt=-1,Ut.length&&Gt())}fu
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/function Du(r){var e,t,u;if(r){if("string"==typeof r||au(r))r={contents:r};else if("message"in r&&"messages"in r)return r}else r={};if(!(this instanceof Du))return new Du(r);for(this.data={},this.messages=[],this.history=[],this.cwd=eu.cwd(),t=-1,u=lu.length;++t<u;)e=lu[t],cu.call(r,e)&&(this[e]=r[e]);for(e in r)-1===lu.indexOf(e)&&(this[e]=r[e])}function fu(r,e){if(-1!==r.indexOf(nu.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+nu.sep+"`")}function pu(r,e){if(!r)throw new Error("`"+e+"` cannot be empty")}function du(r,e){if(!r)throw new Error("Setting `"+e+"` requires `path` to be set too")}su.toString=function(r){var e=this.contents||"";return au(e)?e.toString(r):String(e)},Object.defineProperty(su,"path",{get:function(){return this.history[this.history.length-1]},set:function(r){pu(r,"path"),r!==this.path&&this.history.push(r)}}),Object.defineProperty(su,"dirname",{get:function(){return"string"==typeof this.path?nu.dirname(this.path):void 0},set:function(r){du(this.path,"dirname"),this.path=nu.join(r||"",this.basename)}}),Object.defineProperty(su,"basename",{get:function(){return"string"==typeof this.path?nu.basename(this.path):void 0},set:function(r){pu(r,"basename"),fu(r,"basename"),this.path=nu.join(this.dirname||"",r)}}),Object.defineProperty(su,"extname",{get:function(){return"string"==typeof this.path?nu.extname(this.path):void 0},set:function(r){var e=r||"";if(fu(e,"extname"),du(this.path,"extname"),e){if("."!==e.charAt(0))throw new Error("`extname` must start with `.`");if(-1!==e.indexOf(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ou(this.path,e)}}),Object.defineProperty(su,"stem",{get:function(){return"string"==typeof this.path?nu.basename(this.path,this.extname):void 0},set:function(r){pu(r,"stem"),fu(r,"stem"),this.path=nu.join(this.dirname||"",r+(this.extname||""))}});var hu=iu,gu=iu.prototype;gu.message=function(r,e,t){var u=this.path,n=new kt(r,e,t);u&&(n.name=u+":"+n.name,n.file=u);return n.fatal=!1,this.messages.push(n),n},gu.info=function(){var r=this.message.apply(this,arguments);return r.fatal=null,r},gu.fail=function(){var r=this.message.apply(this,arguments);throw r.fatal=!0,r};var mu=function r(){var e=[],t=Et(),u={},n=!1,o=-1;return a.data=function(r,e){if("string"==typeof r)return 2===arguments.length?(Au("data",n),u[r]=e,a):Eu.call(u,r)&&u[r]||null;if(r)return Au("data",n),u=r,a;return u},a.freeze=i,a.attachers=e,a.use=function(r){var t;if(Au("use",n),null==r);else if("function"==typeof r)l.apply(null,arguments);else{if("object"!=typeof r)throw new Error("Expected usable value, not `"+r+"`");"length"in r?s(r):o(r)}t&&(u.settings=ht(u.settings||{},t));return a;function o(r){s(r.plugins),r.settings&&(t=ht(t||{},r.settings))}function i(r){if("function"==typeof r)l(r);else{if("object"!=typeof r)throw new Error("Expected usable value, not `"+r+"`");"length"in r?l.apply(null,r):o(r)}}function s(r){var e,t;if(null==r);else{if(!("object"==typeof r&&"length"in r))throw new Error("Expected a list of plugins, not `"+r+"`");for(e=r.length,t=-1;++t<e;)i(r[t])}}function l(r,t){var u=c(r);u?(gt(u[1])&&gt(t)&&(t=ht(u[1],t)),u[1]=t):e.push(bu.call(arguments))}},a.parse=function(r){var e,t=hu(r);if(i(),Fu("parse",e=a.Parser),Cu(e,"parse"))return new e(String(t),t).parse();return e(String(t),t)},a.stringify=function(r,e){var t,u=hu(e);if(i(),wu("stringify",t=a.Compiler),yu(r),Cu(t,"compile"))return new t(r,u).compile();return t(r,u)},a.run=s,a.runSync=function(r,e){var t,u=!1;return s(r,e,(function(r,e){u=!0,at(r),t=e})),qu("runSync","run",u),t},a.process=l,a.processSync=D,a;function a(){for(var t=r(),n=e.length,o=-1;++o<n;)t.use.apply(null,e[o]);return t.data(ht(!0,{},u)),t}function i(){var r,u,i,c;if(n)return a;for(;++o<e.length;)u=(r=e[o])[0],null,!1!==(i=r[1])&&(!0===i&&(r[1]=void 0),"function"==typeof(c=u.apply(a,r.slice(1)))&&t.use(c));return n=!0,o=1/0,a}function c(r){for(var t,u=e.length,n=-1;++n<u;)if((t=e[n])[0]===r)return t}function s(r,e,u){if(yu(r),i(),u||"function"!=typeof e||(u=e,e=null),!u)return new Promise(n);function n(n,o){t.run(r,hu(