GGD/node_modules/prettier/esm/parser-markdown.mjs

14 lines
176 KiB
JavaScript
Raw Permalink Normal View History

var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var u in r)n.call(r,u)&&(e[u]=r[u])}return e},n=Object.prototype.hasOwnProperty;var u={exports:{}},i=void 0!==i?i:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},o=[],a=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,s=!1;function l(){s=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t<r;++t)o[t]=e[t],a[e.charCodeAt(t)]=t;a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63}function f(e){return o[e>>18&63]+o[e>>12&63]+o[e>>6&63]+o[63&e]}function D(e,t,r){for(var n,u=[],i=t;i<r;i+=3)n=(e[i]<<16)+(e[i+1]<<8)+e[i+2],u.push(f(n));return u.join("")}function p(e){var t;s||l();for(var r=e.length,n=r%3,u="",i=[],a=16383,c=0,f=r-n;c<f;c+=a)i.push(D(e,c,c+a>f?f:c+a));return 1===n?(t=e[r-1],u+=o[t>>2],u+=o[t<<4&63],u+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],u+=o[t>>10],u+=o[t>>4&63],u+=o[t<<2&63],u+="="),i.push(u),i.join("")}function h(e,t,r,n,u){var i,o,a=8*u-n-1,c=(1<<a)-1,s=c>>1,l=-7,f=r?u-1:0,D=r?-1:1,p=e[t+f];for(f+=D,i=p&(1<<-l)-1,p>>=-l,l+=a;l>0;i=256*i+e[t+f],f+=D,l-=8);for(o=i&(1<<-l)-1,i>>=-l,l+=n;l>0;o=256*o+e[t+f],f+=D,l-=8);if(0===i)i=1-s;else{if(i===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),i-=s}return(p?-1:1)*o*Math.pow(2,i-n)}function d(e,t,r,n,u,i){var o,a,c,s=8*i-u-1,l=(1<<s)-1,f=l>>1,D=23===u?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,h=n?1:-1,d=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+f>=1?D/c:D*Math.pow(2,1-f))*c>=2&&(o++,c/=2),o+f>=l?(a=0,o=l):o+f>=1?(a=(t*c-1)*Math.pow(2,u),o+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,u),o=0));u>=8;e[r+p]=255&a,p+=h,a/=256,u-=8);for(o=o<<u|a,s+=u;s>0;e[r+p]=255&o,p+=h,o/=256,s-=8);e[r+p-h]|=128*d}var g={}.toString,m=Array.isArray||function(e){return"[object Array]"==g.call(e)};function E(){return y.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function v(e,t){if(E()<t)throw new RangeError("Invalid typed array length");return y.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=y.prototype:(null===e&&(e=new y(t)),e.length=t),e}function y(e,t,r){if(!(y.TYPED_ARRAY_SUPPORT||this instanceof y))return new y(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return A(this,e)}return b(this,e,t,r)}function b(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);y.TYPED_ARRAY_SUPPORT?(e=t).__proto__=y.prototype:e=w(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!y.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|O(t,r),u=(e=v(e,n)).write(t,r);u!==n&&(e=e.slice(0,u));return e}(e,t,r):function(e,t){if(k(t)){var r=0|F(t.length);return 0===(e=v(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?v(e,0):w(e,t);if("Buffer"===t.type&&m(t.data))return w(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function C(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function A(e,t){if(C(t),e=v(e,t<0?0:0|F(t)),!y.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function w(e,t){va
/*!
* repeat-string <https://github.com/jonschlinkert/repeat-string>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/;var xr,Tr="",Sr=function(e,t){if("string"!=typeof e)throw new TypeError("expected a string");if(1===t)return e;if(2===t)return e+e;var r=e.length*t;if(xr!==e||void 0===xr)xr=e,Tr="";else if(Tr.length>=r)return Tr.substr(0,r);for(;r>Tr.length&&t>1;)1&t&&(Tr+=e),t>>=1,e+=e;return Tr=(Tr+=e).substr(0,r)};var Rr=function(e){return String(e).replace(/\n+$/,"")};var Ir=Rr,Br=function(e,t,r){var n,u,i,o=-1,a=t.length,c="",s="",l="",f="";for(;++o<a;)if(n=t.charAt(o),i)if(i=!1,c+=l,s+=f,l="",f="","\n"===n)l=n,f=n;else for(c+=n,s+=n;++o<a;){if(!(n=t.charAt(o))||"\n"===n){f=n,l=n;break}c+=n,s+=n}else if(" "===n&&t.charAt(o+1)===n&&t.charAt(o+2)===n&&t.charAt(o+3)===n)l+=Nr,o+=3,i=!0;else if("\t"===n)l+=n,i=!0;else{for(u="";"\t"===n||" "===n;)u+=n,n=t.charAt(++o);if("\n"!==n)break;l+=u+n,f+=n}if(s)return!!r||e(c)({type:"code",lang:null,meta:null,value:Ir(s)})},Nr=Sr(" ",4);var Lr=function(e,t,r){var n,u,i,o,a,c,s,l,f,D,p,h,d,g=this,m=g.options.gfm,E=t.length+1,v=0,y="";if(!m)return;for(;v<E&&(" "===(i=t.charAt(v))||"\t"===i);)y+=i,v++;if(h=v,"~"!==(i=t.charAt(v))&&"`"!==i)return;v++,u=i,n=1,y+=i;for(;v<E&&(i=t.charAt(v))===u;)y+=i,n++,v++;if(n<3)return;for(;v<E&&(" "===(i=t.charAt(v))||"\t"===i);)y+=i,v++;o="",s="";for(;v<E&&"\n"!==(i=t.charAt(v))&&("`"!==u||i!==u);)" "===i||"\t"===i?s+=i:(o+=s+i,s=""),v++;if((i=t.charAt(v))&&"\n"!==i)return;if(r)return!0;(d=e.now()).column+=y.length,d.offset+=y.length,y+=o,o=g.decode.raw(g.unescape(o),d),s&&(y+=s);s="",D="",p="",l="",f="";var b=!0;for(;v<E;)if(i=t.charAt(v),l+=D,f+=p,D="",p="","\n"===i){for(b?(y+=i,b=!1):(D+=i,p+=i),s="",v++;v<E&&" "===(i=t.charAt(v));)s+=i,v++;if(D+=s,p+=s.slice(h),!(s.length>=4)){for(s="";v<E&&(i=t.charAt(v))===u;)s+=i,v++;if(D+=s,p+=s,!(s.length<n)){for(s="";v<E&&(" "===(i=t.charAt(v))||"\t"===i);)D+=i,p+=i,v++;if(!i||"\n"===i)break}}}else l+=i,p+=i,v++;y+=l+D,v=-1,E=o.length;for(;++v<E;)if(" "===(i=o.charAt(v))||"\t"===i)a||(a=o.slice(0,v));else if(a){c=o.slice(v);break}return e(y)({type:"code",lang:a||o||null,meta:c||null,value:f})};var Pr,qr={exports:{}};Pr=qr.exports,(Pr=qr.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},Pr.right=function(e){return e.replace(/\s*$/,"")};var jr=function(e,t,r,n){var u,i,o=e.length,a=-1;for(;++a<o;)if(u=e[a],(void 0===(i=u[1]||{}).pedantic||i.pedantic===r.options.pedantic)&&(void 0===i.commonmark||i.commonmark===r.options.commonmark)&&t[u[0]].apply(r,n))return!0;return!1};var _r=qr.exports,Ur=jr,Mr=function(e,t,r){var n,u,i,o,a,c,s,l,f,D=this,p=D.offset,h=D.blockTokenizers,d=D.interruptBlockquote,g=e.now(),m=g.line,E=t.length,v=[],y=[],b=[],C=0;for(;C<E&&(" "===(u=t.charAt(C))||"\t"===u);)C++;if(">"!==t.charAt(C))return;if(r)return!0;C=0;for(;C<E;){for(o=t.indexOf("\n",C),s=C,l=!1,-1===o&&(o=E);C<E&&(" "===(u=t.charAt(C))||"\t"===u);)C++;if(">"===t.charAt(C)?(C++,l=!0," "===t.charAt(C)&&C++):C=s,a=t.slice(C,o),!l&&!_r(a)){C=s;break}if(!l&&(i=t.slice(C),Ur(d,h,D,[e,i,!0])))break;c=s===C?a:t.slice(s,o),b.push(C-s),v.push(c),y.push(a),C=o+1}C=-1,E=b.length,n=e(v.join("\n"));for(;++C<E;)p[m]=(p[m]||0)+b[C],m++;return f=D.enterBlock(),y=D.tokenizeBlock(y.join("\n"),g),f(),n({type:"blockquote",children:y})};var zr=function(e,t,r){var n,u,i,o=this.options.pedantic,a=t.length+1,c=-1,s=e.now(),l="",f="";for(;++c<a;){if(" "!==(n=t.charAt(c))&&"\t"!==n){c--;break}l+=n}i=0;for(;++c<=a;){if("#"!==(n=t.charAt(c))){c--;break}l+=n,i++}if(i>6)return;if(!i||!o&&"#"===t.charAt(c+1))return;a=t.length+1,u="";for(;++c<a;){if(" "!==(n=t.charAt(c))&&"\t"!==n){c--;break}u+=n}if(!o&&0===u.length&&n&&"\n"!==n)return;if(r)return!0;l+=u,u="",f="";for(;++c<a&&(n=t.charAt(c))&&"\n"!==n;)if(" "===n||"\t"===n||"#"===n){for(;" "===n||"\t"===n;)u+=n,n=t.charAt(++c);if(o||!f||u||"#"!==n){for(;"#"===n;)u+=n,n=t.charAt(++c);for(;" "===n||"\t"===n;)u+=n,n=t.charAt(++c);c--}else f+=n}else f+=u+n,u="";return s.column+=l.length,s.offset+=l.length,e(l+=f+u)({type:"heading",depth:i,children:this.tokenizeInline(f,s)})};var Gr=function(e,t,r){var n,u,i,o,a=-1,c=t.length+1,s="";for(;++a<c&&("\t"===(n=t.charAt(a))||
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/;var Ti=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},Si=Object.prototype.hasOwnProperty,Ri=Object.prototype.toString,Ii=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,Ni=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===Ri.call(e)},Li=function(e){if(!e||"[object Object]"!==Ri.call(e))return!1;var t,r=Si.call(e,"constructor"),n=e.constructor&&e.constructor.prototype&&Si.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!n)return!1;for(t in e);return void 0===t||Si.call(e,t)},Pi=function(e,t){Ii&&"__proto__"===t.name?Ii(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},qi=function(e,t){if("__proto__"===t){if(!Si.call(e,t))return;if(Bi)return Bi(e,t).value}return e[t]},ji=[].slice;var _i=function(e,t){var r;return function(){var t,i=ji.call(arguments,0),o=e.length>i.length;o&&i.push(n);try{t=e.apply(null,i)}catch(e){if(o&&r)throw e;return n(e)}o||(t&&"function"==typeof t.then?t.then(u,n):t instanceof Error?n(t):u(t))};function n(){r||(r=!0,t.apply(null,arguments))}function u(e){n(null,e)}},Ui=zi;zi.wrap=_i;var Mi=[].slice;function zi(){var e=[],t={run:function(){var t=-1,r=Mi.call(arguments,0,-1),n=arguments[arguments.length-1];if("function"!=typeof n)throw new Error("Expected function as last argument, not "+n);function u(i){var o=e[++t],a=Mi.call(arguments,0),c=a.slice(1),s=r.length,l=-1;if(i)n(i);else{for(;++l<s;)null!==c[l]&&void 0!==c[l]||(c[l]=r[l]);r=c,o?_i(o,u).apply(null,r):n.apply(null,[null].concat(r))}}u.apply(null,[null].concat(r))},use:function(r){if("function"!=typeof r)throw new Error("Expected `fn` to be a function, not "+r);return e.push(r),t}};return t}var Gi={}.hasOwnProperty;function Vi(e){return e&&"object"==typeof e||(e={}),$i(e.line)+":"+$i(e.column)}function Yi(e){return e&&"object"==typeof e||(e={}),Vi(e.start)+"-"+Vi(e.end)}function $i(e){return e&&"number"==typeof e?e:1}var Hi=function(e){if(!e||"object"!=typeof e)return"";if(Gi.call(e,"position")||Gi.call(e,"type"))return Yi(e.position);if(Gi.call(e,"start")||Gi.call(e,"end"))return Yi(e);if(Gi.call(e,"line")||Gi.call(e,"column"))return Vi(e);return""},Xi=Ji;function Zi(){}Zi.prototype=Error.prototype,Ji.prototype=new Zi;var Wi=Ji.prototype;function Ji(e,t,r){var n,u,i;"string"==typeof t&&(r=t,t=null),n=function(e){var t,r=[null,null];"string"==typeof e&&(-1===(t=e.indexOf(":"))?r[1]=e:(r[0]=e.slice(0,t),r[1]=e.slice(t+1)));return r}(r),u=Hi(t)||"1:1",i={start:{line:null,column:null},end:{line:null,column:null}},t&&t.position&&(t=t.position),t&&(t.start?(i=t,t=t.start):i.start=t),e.stack&&(this.stack=e.stack,e=e.message),this.message=e,this.name=u,this.reason=e,this.line=t?t.line:null,this.column=t?t.column:null,this.location=i,this.source=n[0],this.ruleId=n[1]}function Ki(e,t){for(var r=0,n=e.length-1;n>=0;n--){var u=e[n];"."===u?e.splice(n,1):".."===u?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}Wi.file="",Wi.name="",Wi.reason="",Wi.message="",Wi.stack="",Wi.fatal=null,Wi.column=null,Wi.line=null;var Qi=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,eo=function(e){return Qi.exec(e).slice(1)};function to(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(e=n+"/"+e,t="/"===n.charAt(0))}return e=Ki(lo(e.split("/"),(function(e){return!!e})),!t).join("/"),(t?"/":"")+e||"."}function ro(e){var t=no(e),r="/"===fo(e,-1);return e=Ki(lo(e.split("/"),(function(e){return!!e})),!t).join("/"),e||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function no(e){return"/"===e.charAt(0)}function uo(){var e=Array.prototype.slice.call(arguments,0);return ro(lo(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))}function io(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,