"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=e=>{let[,t]=/([a-f\d]{3,6})/i.exec(e)||[],r=t?t.length:0;if(3===r)t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2];else if(6!==r)return[0,0,0];let n=parseInt(t,16);return[n>>16&255,n>>8&255,255&n]},t=(e,t,r)=>t>e?t:e>r?r:e,r=(e,t,r)=>{let n=e.indexOf(t);if(n<0)return e;let o=t.length,i=0,l="";for(;~n;)l+=e.slice(i,n)+r,i=n+o,n=e.indexOf(t,i);return l+e.slice(i)},n=(e=>{const t=e=>!!l.find((t=>e.test(t))),r=e||("undefined"!=typeof process?process:{}),{stdout:n,platform:o}=r,i=r.env||{},l=r.argv||[],s="FORCE_COLOR"in i,g=i.FORCE_COLOR,c="true"===g||parseInt(g)>0,a="NO_COLOR"in i||s&&!c||t(/^-{1,2}(no-color|color=false|color=never)$/),p=s&&c||t(/^-{1,2}(color|color=true|color=always)$/),b=n&&"isTTY"in n&&/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(i.TERM);return!a&&(p||b||"win32"===o||"CI"in i)})(),o={open:"",close:""},i=n?(e,t)=>({open:`[${e}m`,close:`[${t}m`}):()=>o,l=n?e=>({open:`[38;5;${e}m`,close:"[39m"}):()=>o,s=n?e=>({open:`[48;5;${e}m`,close:"[49m"}):()=>o,g=n?(e,t,r)=>({open:`[38;2;${e};${t};${r}m`,close:"[39m"}):()=>o,c=n?(e,t,r)=>({open:`[48;2;${e};${t};${r}m`,close:"[49m"}):()=>o,a={visible:o,reset:i(0,0),inverse:i(7,27),hidden:i(8,28),bold:i(1,22),dim:i(2,22),faint:i(2,22),italic:i(3,23),underline:i(4,24),doubleUnderline:i(21,24),strikethrough:i(9,29),strike:i(9,29),frame:i(51,54),encircle:i(52,54),overline:i(53,55),black:i(30,39),red:i(31,39),green:i(32,39),yellow:i(33,39),blue:i(34,39),magenta:i(35,39),cyan:i(36,39),white:i(37,39),gray:i(90,39),grey:i(90,39),blackBright:i(90,39),redBright:i(91,39),greenBright:i(92,39),yellowBright:i(93,39),blueBright:i(94,39),magentaBright:i(95,39),cyanBright:i(96,39),whiteBright:i(97,39),bgBlack:i(40,49),bgRed:i(41,49),bgGreen:i(42,49),bgYellow:i(43,49),bgBlue:i(44,49),bgMagenta:i(45,49),bgCyan:i(46,49),bgWhite:i(47,49),bgBlackBright:i(100,49),bgRedBright:i(101,49),bgGreenBright:i(102,49),bgYellowBright:i(103,49),bgBlueBright:i(104,49),bgMagentaBright:i(105,49),bgCyanBright:i(106,49),bgWhiteBright:i(107,49)},{defineProperty:p,defineProperties:b,setPrototypeOf:u}=Object,d=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,f=/(\r*\n)/g,h=function(){const t=e=>e;return t.strip=e=>e.replace(d,""),t.extend=r=>{for(let t in r){let n=r[t],o=null!=n.open?n:g(...e(n));x[t]={get(){const e=B(this,o);return p(this,t,{value:e}),e}}}y=b((()=>{}),x),u(t,y)},t.extend(a),t},B=({props:e},{open:t,close:r})=>{const n=(e,...t)=>O(e,t,n.props);let o=t,i=r;return void 0!==e&&(o=e.openStack+t,i=r+e.closeStack),u(n,y),n.props={open:t,close:r,openStack:o,closeStack:i,parent:e},n.open=o,n.close=i,n},O=(e,t,n)=>{if(!e)return"";const{openStack:o,closeStack:i}=n;let l=null!=e.raw?String.raw(e,...t):e;if(~l.indexOf(""))for(;void 0!==n;)l=r(l,n.close,n.open),n=n.parent;return~l.indexOf("\n")&&(l=l.replace(f,i+"$1"+o)),o+l+i},m={ansi:e=>l(t(e,0,255)),bgAnsi:e=>s(t(e,0,255)),hex:t=>g(...e(t)),bgHex:t=>c(...e(t)),rgb:(e,r,n)=>g(t(e,0,255),t(r,0,255),t(n,0,255)),bgRgb:(e,r,n)=>c(t(e,0,255),t(r,0,255),t(n,0,255))},x={};let y;for(let e in m)x[e]={get(){return(...t)=>B(this,m[e](...t))}};x.ansi256=x.fg=x.ansi,x.bgAnsi256=x.bg=x.bgAnsi;const v=new h;exports.Ansis=h,exports.default=v;
