@visulima/ono 2.1.6 → 2.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## @visulima/ono [2.1.8](https://github.com/visulima/visulima/compare/@visulima/ono@2.1.7...@visulima/ono@2.1.8) (2026-09-07)
2
+
3
+ ## @visulima/ono [2.1.7](https://github.com/visulima/visulima/compare/@visulima/ono@2.1.6...@visulima/ono@2.1.7) (2026-09-06)
4
+
1
5
  ## @visulima/ono [2.1.6](https://github.com/visulima/visulima/compare/@visulima/ono@2.1.5...@visulima/ono@2.1.6) (2026-09-03)
2
6
 
3
7
  ## @visulima/ono [2.1.5](https://github.com/visulima/visulima/compare/@visulima/ono@2.1.4...@visulima/ono@2.1.5) (2026-08-19)
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import{createRequire as Co}from"node:module";import{parseStacktrace as Do}from"@visulima/error/stacktrace";import{renderError as Bo,getErrorCauses as jt}from"@visulima/error/error";import{ruleBasedFinder as Nt,errorHintFinder as Ot}from"@visulima/error/solution";import{s as E,a as C,f as Lo,p as Le,g as _o,e as zo,c as et,b as tt,h as ot,i as Mo}from"./packem_shared/sanitize-BrzdfbeT.js";import{p as Pe,g as Fo}from"./packem_shared/process-CnEDZ90T.js";import{parseStacktrace as ne,codeFrame as He}from"@visulima/error";import Pt from"@visulima/error/solution/ai/prompt";let To;const Ao=e=>(To??=Co(import.meta.url))(e),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:Pe,Se=e=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[t,o]=Q.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Q.getBuiltinModule(e)}return Ao(e)},{readFile:Ye}=Se("node:fs/promises"),{isAbsolute:Io}=Se("node:path"),{fileURLToPath:Ro}=Se("node:url"),{createHash:jo}=Se("node:crypto"),No=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Oo=12288,Po=65510,Ho=[12288,12288,65281,65376,65504,65510],Wo=8361,qo=65518,Uo=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Vo=32,Zo=10630,Go=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ko=4352,Qo=262141,Ht=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],se=(e,t)=>{let o=0,r=Math.floor(e.length/2)-1;for(;o<=r;){const n=Math.floor((o+r)/2),s=n*2;if(t<e[s])r=n-1;else if(t>e[s+1])o=n+1;else return!0}return!1},rt=19968,[Xo,Jo]=Yo(Ht);function Yo(e){let t=e[0],o=e[1];for(let r=0;r<e.length;r+=2){const n=e[r],s=e[r+1];if(rt>=n&&rt<=s)return[n,s];s-n>o-t&&(t=n,o=s)}return[t,o]}const er=e=>e<161||e>1114109?!1:se(No,e),tr=e=>e<Oo||e>Po?!1:se(Ho,e),or=e=>e<Wo||e>qo?!1:se(Uo,e),rr=e=>e<Vo||e>Zo?!1:se(Go,e),nr=e=>e>=Xo&&e<=Jo?!0:e<Ko||e>Qo?!1:se(Ht,e);function sr(e){return er(e)?"ambiguous":tr(e)?"fullwidth":or(e)?"halfwidth":rr(e)?"narrow":nr(e)?"wide":"neutral"}function ir(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Wt(e){return ir(e),sr(e)}const qt=String.raw,nt=qt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,ar=()=>new RegExp(qt`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${nt}(?:\u200D${nt})*`,"gu"),Z=new Set(["\x1B","›"]),Ee="\x07",Ut="[",We="m",te="]8;;",lr=39,cr=/[\u200B\uFEFF\u2060-\u2064]/g,dr=new RegExp(`(?:\\${Ut}(?<code>\\d+)m|\\${te}(?<uri>.*)${Ee})`),pr=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),be=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,st=/\u001B\[[\d;]*m[^\u001B]*(?:\u001B\[[\d;]*m|$)/g,it=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)[^\u001B]*\u001B\]8;;(?:\u0007|\u001B\\)/g,pe=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,hr=ar(),at=new Map,ur=e=>[e.ambiguousIsNarrow?1:0,e.control,e.fullWidth,e.regular,e.wide].join("|"),gr=e=>{const t=ur(e.width);let o=at.get(t);return o||(o=new Map,at.set(t,o)),o},he=new RegExp(be.source,"y"),Ae=new RegExp(hr.source,"uy"),ue=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,Vt=e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other",mr=(e,t)=>{const o=gr(t),r=Math.floor(e/65536),n=e%65536;let s=o.get(r);if(s||(s=new Map,o.set(r,s)),s.has(n))return s.get(n);let i;switch(Vt(e)){case"control":{i=t.width.control;break}case"latin":{i=t.width.regular;break}case"wide":{i=t.width.wide;break}case"zero":{i=0;break}default:switch(Wt(e)){case"ambiguous":{i=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{i=t.width.fullWidth;break}case"wide":{i=t.width.wide;break}default:i=t.width.regular}}return s.set(n,i),i},fr=e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,_e=(e,t={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const o={truncation:{countAnsiEscapeCodes:t.countAnsiEscapeCodes??!1,ellipsis:t.ellipsis??"",ellipsisWidth:t.ellipsisWidth??(t.ellipsis?_e(t.ellipsis,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:t.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:t.ambiguousIsNarrow??!1,ansi:t.ansiWidth??0,control:t.controlWidth??0,emoji:t.emojiWidth??2,fullWidth:t.fullWidth??2,halfWidth:t.halfWidth??1,regular:t.regularWidth??1,tab:t.tabWidth??8,wide:t.wideWidth??2}},r=Math.max(0,o.truncation.limit-o.truncation.ellipsisWidth),{length:n}=e,s=n>1e4;let i=0,a=0,l=n,c=!1;const p=e.includes("\x1B")||e.includes("›");for(;i<n;){if(p&&(e[i]==="\x1B"||e[i]==="›")){if(e.startsWith("\x1B]8;;",i)){const m="\x1B]8;;\x07",g=m.length,b=e.indexOf("\x07",i+5);if(b!==-1){const $=e.indexOf(m,b+1);if($!==-1){const x=$+g,S=e.slice(b+1,$).replace(be,""),D=_e(S,{ambiguousIsNarrow:o.width.ambiguousIsNarrow,ansiWidth:o.width.ansi,controlWidth:o.width.control,countAnsiEscapeCodes:!1,ellipsis:o.truncation.ellipsis,ellipsisWidth:o.truncation.ellipsisWidth,emojiWidth:o.width.emoji,fullWidth:o.width.fullWidth,halfWidth:o.width.halfWidth,limit:Math.max(0,r-a),regularWidth:o.width.regular,tabWidth:o.width.tab,wideWidth:o.width.wide}),K=D.width;if(D.truncated)c=!0,l=Math.min(l,i);else if(a+K>r&&(l=Math.min(l,i),c=!0,a+K>o.truncation.limit))break;if(a+=K,i=x,c&&a>=o.truncation.limit)break;continue}}}if(he.lastIndex=i,he.test(e)){const m=he.lastIndex-i,g=o.truncation.countAnsiEscapeCodes?m:o.width.ansi;if(a+g>r&&(l=Math.min(l,i),a+g>o.truncation.limit)){c=!0;break}a+=g,i=he.lastIndex;continue}}const f=e.codePointAt(i);if(f===8203||f===65279||f>=8288&&f<=8292){i+=1;continue}if(f===9){if(a+o.width.tab>r&&(l=Math.min(l,i),a+o.width.tab>o.truncation.limit)){c=!0;break}a+=o.width.tab,i+=1;continue}if(ue.lastIndex=i,ue.test(e)){const m=(ue.lastIndex-i)*o.width.regular;if(a+m>r){const g=o.width.regular>0?Math.floor((r-a)/o.width.regular):0;if(l=Math.min(l,i+g),a+m>o.truncation.limit){c=!0;break}}a+=m,i=ue.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(pe.lastIndex=i,pe.test(e))){const m=(pe.lastIndex-i)*o.width.control;if(a+m>r){const g=o.width.control>0?Math.floor((r-a)/o.width.control):0;if(l=Math.min(l,i+g),a+m>o.truncation.limit){c=!0;break}}a+=m,i=pe.lastIndex;continue}if(Ae.lastIndex=i,Ae.test(e)){if(a+o.width.emoji>r&&(l=Math.min(l,i),a+o.width.emoji>o.truncation.limit)){c=!0;break}a+=o.width.emoji,i=Ae.lastIndex;continue}const w=e.codePointAt(i)??0;if(fr(w)){i+=w>65535?2:1;continue}let h;if(s)h=mr(w,o);else switch(Vt(w)){case"control":{h=o.width.control;break}case"latin":{h=o.width.regular;break}case"wide":{h=o.width.wide;break}case"zero":{h=0;break}default:switch(Wt(w)){case"ambiguous":{h=o.width.ambiguousIsNarrow?o.width.regular:o.width.wide;break}case"fullwidth":{h=o.width.fullWidth;break}case"wide":{h=o.width.wide;break}default:h=o.width.regular}}if(a+h>r&&(l=Math.min(l,i),a+h>o.truncation.limit)){c=!0;break}a+=h,i+=w>65535?2:1}let d=a,u=!1;return c&&o.truncation.limit>=o.truncation.ellipsisWidth&&(d=o.truncation.limit,u=!0),{ellipsed:u,index:c?l:n,truncated:c,width:d}},k=(e,t={})=>_e(e,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,wr=(e,t)=>Math.floor((e-t)/2),br=(e,t)=>e-t,lt=(e,t={})=>{const o=t.align??"center";if(o==="left")return e;const r=t.split??`
2
- `,n=t.pad??" ",s=o==="right"?br:wr;let i=!1,a;Array.isArray(e)?a=e:(i=!0,a=e.split(r));let l,c=0;const p=a.map(d=>(l=k(d,t.stringWidthOptions),c=Math.max(l,c),{str:d,width:l})).map(d=>Array.from({length:s(c,d.width)+1}).join(n)+d.str);return i?p.join(r):p};let vr=class{capacity;cache;constructor(t){this.capacity=t,this.cache=new Map}get(t){if(!this.cache.has(t))return;const o=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,o),o}has(t){return this.cache.has(t)}set(t,o){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.capacity){const r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(t,o)}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}size(){return this.cache.size}};const ct=new vr(100),xr=new Intl.Segmenter("en",{granularity:"grapheme"}),kr=/^[\u0000-\u007F]*$/,yr=new Set(["0","22","23","24","27","28","29","39","49"]),$r=new Set(["1","3","4","7","8","9"]),dt=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),ge=e=>e>="30"&&e<="37"||e>="90"&&e<="97"||e.startsWith("38;"),me=e=>e>="40"&&e<="47"||e>="100"&&e<="107"||e.startsWith("48;"),Sr=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],pt=(e,t)=>{let o=-1;for(const r of t){const n=e.indexOf(r);n!==-1&&(o===-1||n<o)&&(o=n)}return o},Er=(e,t)=>{if(!e.includes("\x1B"))return[{after:"",before:"",content:e,visibleLength:k(e,t.width)}];const o=`${JSON.stringify(t.width??void 0)}\0${e}`,r=ct.get(o);if(r)return r;const n=[],s=[];let i=0,a;for(be.lastIndex=0;(a=be.exec(e))!==null;){const d=a[0];n.push(e.slice(i,a.index)),s.push(d),i=a.index+d.length}i<e.length&&n.push(e.slice(i));const l=[];for(const d of s){if(d==="\x1B[0m"||d==="\x1B]8;;\x07"){l.push(d);continue}if(d.startsWith("\x1B[")&&d.endsWith("m")){const u=d.slice(2,-1);if(yr.has(u)){l.push(d);continue}}}const c=new Set,p=[];for(const[d,u]of n.entries()){if(d>0&&s[d-1]){const h=s[d-1];if(h==="\x1B[0m")c.clear();else if(h==="\x1B]8;;\x07"){for(const m of c)if(m.startsWith("\x1B]8;;")&&!m.endsWith("\x1B]8;;\x07")){c.delete(m);break}}else if(h.startsWith("\x1B[")&&h.endsWith("m")){const m=h.slice(2,-1);if(m==="39"){for(const g of c)if(g.startsWith("\x1B[")&&g.endsWith("m")){const b=g.slice(2,-1);if(ge(b)){c.delete(g);break}}}else if(m==="49"){for(const g of c)if(g.startsWith("\x1B[")&&g.endsWith("m")){const b=g.slice(2,-1);if(me(b)){c.delete(g);break}}}else if(dt.has(m)){const g=dt.get(m);for(const b of c)if(b===`\x1B[${g}m`){c.delete(b);break}}else{if(ge(m)){for(const g of c)if(g.startsWith("\x1B[")&&g.endsWith("m")){const b=g.slice(2,-1);if(ge(b)){c.delete(g);break}}}else if(me(m)){for(const g of c)if(g.startsWith("\x1B[")&&g.endsWith("m")){const b=g.slice(2,-1);if(me(b)){c.delete(g);break}}}else if($r.has(m)){const g=`\x1B[${m}m`;c.has(g)&&c.delete(g)}c.add(h)}}else if(h.startsWith("\x1B]8;;")&&!h.endsWith("\x1B]8;;\x07")){for(const m of c)if(m.startsWith("\x1B]8;;")&&!m.endsWith("\x1B]8;;\x07")){c.delete(m);break}c.add(h)}}if(u==="")continue;let f="";if(c.size>0)if(l.includes("\x1B[0m"))f="\x1B[0m";else{const h=[];let m=!1;for(const x of c)if(x.startsWith("\x1B]8;;")&&!x.endsWith("\x1B]8;;\x07")){m=!0;break}m&&l.includes("\x1B]8;;\x07")&&h.push("\x1B]8;;\x07");let g=!1,b=!1;for(const x of c)if(x.startsWith("\x1B[")&&x.endsWith("m")){const S=x.slice(2,-1);ge(S)?g=!0:me(S)&&(b=!0)}if(g&&b){const x=pt(e,["\x1B[3","\x1B[9","\x1B[38;"]),S=pt(e,["\x1B[4","\x1B[10","\x1B[48;"]);x>=0&&S>=0?x>S?h.push("\x1B[39m","\x1B[49m"):h.push("\x1B[49m","\x1B[39m"):h.push("\x1B[39m","\x1B[49m")}else g&&h.push("\x1B[39m"),b&&h.push("\x1B[49m");g&&b&&e.includes("\x1B[39m")&&e.includes("\x1B[49m")&&(e.indexOf("\x1B[39m")<e.indexOf("\x1B[49m")?(h.length-=2,h.push("\x1B[39m","\x1B[49m")):e.indexOf("\x1B[49m")<e.indexOf("\x1B[39m")&&(h.length-=2,h.push("\x1B[49m","\x1B[39m")));const $=Sr.filter(x=>c.has(x.open)).map(x=>({position:e.indexOf(x.open),style:x})).filter(x=>x.position>=0).toSorted((x,S)=>S.position-x.position);for(const x of $){const S=x;l.includes(S.style.close)&&h.push(S.style.close)}f=h.join("")}const w=[...c].join("");p.push({after:f,before:w,content:u,visibleLength:k(u,t.width)})}return ct.set(o,p),p},ht=(e,t,o,r)=>{const n=[...r.segmenter.segment(e)],s=[];let i=0,a=!1;for(const l of n){const c=k(l.segment,r.width),p=i,d=i+c;if(!a)if(p<t){i=d;continue}else a=!0;if(p>=o||d>o)break;s.push(l.segment),i=d}return s.join("")},j=(e,t=0,o=Number.MAX_SAFE_INTEGER,r={})=>{const n={segmenter:xr,...r};if(t>=o||e==="")return"";const s=k(e,n.width);if(t===0&&o>=s)return e;if(t<0||o<0)throw new RangeError("Negative indices aren't supported");if(!e.includes("\x1B"))return kr.test(e)?e.slice(t,o):ht(e,t,o,n);if(st.lastIndex=0,it.lastIndex=0,!st.test(e)&&!it.test(e))return e;const i=Er(e,n);if(i.length===0)return"";let a=0;const l=[];for(const[d,u]of i.entries()){const f=a,w=a+u.visibleLength;if(w>t&&f<o){const h=Math.max(0,t-f),m=Math.min(u.visibleLength,o-f);l.push({end:m,index:d,segment:u,start:h})}a=w}if(l.length===0)return"";const c=[],p=l[0].segment;c.push(p.before);for(let d=0;d<l.length;d++){const{end:u,segment:f,start:w}=l[d];if(w===0&&u===f.visibleLength?c.push(f.content):c.push(ht(f.content,w,u,n)),d<l.length-1){const h=l[d+1].segment,m=f.after,g=h.before;m!==g&&(m||g)&&c.push(m,g)}}return c.push(l.at(-1).segment.after),c.join("")},Cr=/\x1B\[(\d+)m/;let Zt=class{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(t){const o=Cr.exec(t);if(!o)return;const r=Number.parseInt(o[1],10);switch(r){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(r>=30&&r<=37||r>=90&&r<=97)this.activeForeground=t;else if(r>=40&&r<=47||r>=100&&r<=107)this.activeBackground=t;else if([1,2,3,4,7,8,9].includes(r))this.activeFormatting.push(t);else if([22,23,24,27,28,29].includes(r)){const n={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];n&&(this.activeFormatting=this.activeFormatting.filter(s=>!s.includes(n)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const t=[];if(this.activeFormatting.length>0){const o={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(r=>{const n=o[r];n&&t.push(n)})}return this.activeForeground&&t.push("\x1B[39m"),this.activeBackground&&t.push("\x1B[49m"),t.join("")}};const Tr=(e,t)=>{if(!Z.has(e[t]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const o=!0,r=e.slice(t+1,t+1+te.length).join("")===te;return{isInsideEscape:o,isInsideLinkEscape:r}},Ar=(e,t={})=>{const o=new Zt;let r="",n=!1,s="",i="",a=!1;const l=[...e];for(let c=0;c<l.length;c++){const p=l[c];if(p&&Z.has(p)){if(r){const h=t.getWidth?.(r)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:r,width:h};if(a&&(m.isHyperlink=!0,m.hyperlinkUrl=i),t.onSegment?.(m,o)===!1)return;r=""}n=!0,s=p;const f=Tr(l,c),{isInsideLinkEscape:w}=f;if(w){let h=c+1;for(i="";h<l.length;){const g=l[h];if(g===Ee)break;i+=g,h+=1}i=i.slice(4);const m={hyperlinkUrl:i,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(t.onSegment?.(m,o)===!1)return;c=h,a=!0,n=!1,s="";continue}if(c+1<l.length&&l[c+1]==="\\"&&a){const h={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(t.onSegment?.(h,o)===!1)return;a=!1,i="",c+=1,n=!1,s="";continue}}if(n){if(s!==p&&(s+=p),p===We){n=!1,o.processEscape(s);const f={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};if(t.onSegment?.(f,o)===!1)return;s=""}continue}r+=p;const d=t.getWidth?.(r)??0,u={isEscapeSequence:!1,isGrapheme:!0,text:r,width:d};if(a&&(u.isHyperlink=!0,u.hyperlinkUrl=i),t.onSegment?.(u,o)===!1)return;r=""}if(r){const c=t.getWidth?.(r)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:r,width:c};a&&(p.isHyperlink=!0,p.hyperlinkUrl=i),t.onSegment?.(p,o)}if(s){const c={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};t.onSegment?.(c,o)}},ut=e=>`${Z.values().next().value}${Ut}${String(e)}${We}`,gt=e=>`${Z.values().next().value}${te}${e}${Ee}`,Dr=e=>{if(e.length===0)return"";if(e.length===1)return e[0];let t="",o,r;const n=e.join(`
3
- `),s=[...n];let i=0;for(const[a,l]of s.entries()){if(t+=l,Z.has(l)){const p=dr.exec(n.slice(i))?.groups??{};if(p.code!==void 0){const d=Number.parseFloat(p.code);o=d===lr?void 0:d}else p.uri!==void 0&&(r=p.uri.length===0?void 0:p.uri)}const c=pr.get(Number(o));s[a+1]===`
4
- `?(r&&(t+=gt("")),o&&c&&(t+=ut(c))):l===`
5
- `&&(o&&c&&(t+=ut(o)),r&&(t+=gt(r))),i+=l.length}return t},Gt=/(?=\s)|(?<=\s)/,Kt=/^\s+$/,mt=new Map,Br=e=>{const t=mt.get(e);if(t!==void 0)return t;const o=k(e);return mt.set(e,o),o},De=e=>{if(!e.includes("\x1B"))return e;let t=e;return e.includes("\x1B[30m")&&(t+="\x1B[39m"),e.includes("\x1B[42m")&&(t+="\x1B[49m"),t},P=e=>{const t=e.split(" ");let o=t.length;for(;o>0&&k(t[o-1])===0;)o--;return o===t.length?e:t.slice(0,o).join(" ")+t.slice(o).join("")},Qt=(e,t,o)=>{if(e.length===0)return[""];if(t<=0)return[e];const r=[],n=new Zt;let s="",i=0,a=!1,l=!1,c="",p=0;for(;p<e.length;){const d=e.codePointAt(p),u=String.fromCodePoint(d),f=u.length;if(Z.has(u)){a=!0,c=u,s+=u,l=e.startsWith(te,p+1),p+=1;continue}if(a){c+=u,s+=u,l?u===Ee&&(a=l=!1):u===We&&(a=!1,n.processEscape(c)),p+=1;continue}const w=Br(u),h=u===" ";if(w===0){s+=u,p+=f;continue}if(i+w>t&&(s&&r.push(s+n.getEndEscapesForAllActiveAttributes()),s=n.getStartEscapesForAllActiveAttributes(),i=k(s),h&&o)){for(;p<e.length&&e[p]===" ";)p+=1;continue}if(s+=u,i+=w,i===t&&p+f<e.length&&(r.push(s+n.getEndEscapesForAllActiveAttributes()),s=n.getStartEscapesForAllActiveAttributes(),i=k(s),p+f<e.length&&e[p+f]===" "&&o)){for(p+=f;p<e.length&&e[p]===" ";)p+=1;continue}p+=f}return s&&r.push(s+n.getEndEscapesForAllActiveAttributes()),o?r.map(d=>P(d)):r},Ir=(e,t,o)=>{if(e.length===0)return[];const r=o?e.trim():e;if(r.length===0)return[];const n=[];let s="",i=0;return Ar(r,{getWidth:k,onSegment:(a,l)=>{const c=a.text??"";if(a.isEscapeSequence)s+=c;else{const p=c===" ";if(a.width===0)return s+=c,!0;if(i+a.width>t&&(s&&n.push(s),s=l.getStartEscapesForAllActiveAttributes(),i=0,p))return o||n.push(l.getStartEscapesForAllActiveAttributes()+c),!0;s+=c,i+=a.width}return!0}}),s&&n.push(s),o?n.map(a=>P(a)):n},Rr=(e,t,o)=>{if(e.length===0)return[];const r=o?e.trim():e;if(r.length===0)return[];const n=r.split(Gt),s=[];let i="",a=0,l=0;for(;l<n.length;){const c=n[l],p=Kt.test(c),d=k(c);if(c.length===0){l+=1;continue}if(o&&p&&a===0){l+=1;continue}if(a+d>t&&a>0){o?s.push(P(i)):s.push(i),i="",a=0;continue}i+=c,a+=d,l+=1}return i&&(o?s.push(P(i)):s.push(i)),s},Lr=(e,t,o)=>{if(e.length===0)return[];const r=o?e.trim():e;if(r.length===0)return[];const n=r.split(Gt),s=[];let i="",a=0,l=0;for(;l<n.length;){const c=n[l],p=Kt.test(c),d=k(c);if(c.length===0){l+=1;continue}if(o&&p&&a===0){l+=1;continue}if(d>t){i&&s.push(De(o?P(i):i));const u=Qt(c,t,o);if(u.length>0){for(let f=0;f<u.length-1;f+=1)s.push(u[f]);i=u.at(-1),a=k(i)}else i="",a=0;l+=1;continue}if(a+d>t&&a>0&&(s.push(De(o?P(i):i)),i="",a=0,o&&p)){l+=1;continue}i+=c,a+=d,l+=1}return i&&s.push(De(o?P(i):i)),s},V={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Xt=(e,t={})=>{const{removeZeroWidthCharacters:o=!0,trim:r=!0,width:n=80,wrapMode:s=V.PRESERVE_WORDS}=t;if(r&&e.trim()==="")return"";let i=e.normalize("NFC").replaceAll(`\r
1
+ import{createRequire as Co}from"node:module";import{parseStacktrace as Do}from"@visulima/error/stacktrace";import{renderError as Bo,getErrorCauses as jt}from"@visulima/error/error";import{ruleBasedFinder as Nt,errorHintFinder as Ot}from"@visulima/error/solution";import{s as E,a as C,f as Lo,p as Le,g as _o,e as zo,c as et,b as tt,h as ot,i as Mo}from"./packem_shared/sanitize-BrzdfbeT.js";import{p as Pe,g as Fo}from"./packem_shared/process-CnEDZ90T.js";import{parseStacktrace as ne,codeFrame as He}from"@visulima/error";import Pt from"@visulima/error/solution/ai/prompt";let To;const Ao=e=>(To??=Co(import.meta.url))(e),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:Pe,Se=e=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[t,o]=Q.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Q.getBuiltinModule(e)}return Ao(e)},{readFile:Ye}=Se("node:fs/promises"),{isAbsolute:Io}=Se("node:path"),{fileURLToPath:Ro}=Se("node:url"),{createHash:jo}=Se("node:crypto"),No=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Oo=12288,Po=65510,Ho=[12288,12288,65281,65376,65504,65510],Wo=8361,qo=65518,Uo=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Vo=32,Zo=10630,Go=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ko=4352,Qo=262141,Ht=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],se=(e,t)=>{let o=0,r=Math.floor(e.length/2)-1;for(;o<=r;){const n=Math.floor((o+r)/2),s=n*2;if(t<e[s])r=n-1;else if(t>e[s+1])o=n+1;else return!0}return!1},rt=19968,[Xo,Jo]=Yo(Ht);function Yo(e){let t=e[0],o=e[1];for(let r=0;r<e.length;r+=2){const n=e[r],s=e[r+1];if(rt>=n&&rt<=s)return[n,s];s-n>o-t&&(t=n,o=s)}return[t,o]}const er=e=>e<161||e>1114109?!1:se(No,e),tr=e=>e<Oo||e>Po?!1:se(Ho,e),or=e=>e<Wo||e>qo?!1:se(Uo,e),rr=e=>e<Vo||e>Zo?!1:se(Go,e),nr=e=>e>=Xo&&e<=Jo?!0:e<Ko||e>Qo?!1:se(Ht,e);function sr(e){return er(e)?"ambiguous":tr(e)?"fullwidth":or(e)?"halfwidth":rr(e)?"narrow":nr(e)?"wide":"neutral"}function ir(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Wt(e){return ir(e),sr(e)}const qt=String.raw,nt=qt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,ar=()=>new RegExp(qt`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${nt}(?:\u200D${nt})*`,"gu"),Z=new Set(["\x1B","›"]),Ee="\x07",Ut="[",We="m",te="]8;;",lr=39,cr=/[\u200B\uFEFF\u2060-\u2064]/g,dr=new RegExp(`(?:\\${Ut}(?<code>\\d+)m|\\${te}(?<uri>.*)${Ee})`),pr=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),be=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,st=/\u001B\[[\d;]*m[^\u001B]*(?:\u001B\[[\d;]*m|$)/g,it=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)[^\u001B]*\u001B\]8;;(?:\u0007|\u001B\\)/g,pe=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,hr=ar(),at=new Map,ur=e=>[e.ambiguousIsNarrow?1:0,e.control,e.fullWidth,e.regular,e.wide].join("|"),gr=e=>{const t=ur(e.width);let o=at.get(t);return o||(o=new Map,at.set(t,o)),o},he=new RegExp(be.source,"y"),Ae=new RegExp(hr.source,"uy"),ue=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,Vt=e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other",mr=(e,t)=>{const o=gr(t),r=Math.floor(e/65536),n=e%65536;let s=o.get(r);if(s||(s=new Map,o.set(r,s)),s.has(n))return s.get(n);let i;switch(Vt(e)){case"control":{i=t.width.control;break}case"latin":{i=t.width.regular;break}case"wide":{i=t.width.wide;break}case"zero":{i=0;break}default:switch(Wt(e)){case"ambiguous":{i=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{i=t.width.fullWidth;break}case"wide":{i=t.width.wide;break}default:i=t.width.regular}}return s.set(n,i),i},fr=e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,_e=(e,t={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const o={truncation:{countAnsiEscapeCodes:t.countAnsiEscapeCodes??!1,ellipsis:t.ellipsis??"",ellipsisWidth:t.ellipsisWidth??(t.ellipsis?_e(t.ellipsis,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:t.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:t.ambiguousIsNarrow??!1,ansi:t.ansiWidth??0,control:t.controlWidth??0,emoji:t.emojiWidth??2,fullWidth:t.fullWidth??2,halfWidth:t.halfWidth??1,regular:t.regularWidth??1,tab:t.tabWidth??8,wide:t.wideWidth??2}},r=Math.max(0,o.truncation.limit-o.truncation.ellipsisWidth),{length:n}=e,s=n>1e4;let i=0,a=0,c=n,l=!1;const p=e.includes("\x1B")||e.includes("›");for(;i<n;){if(p&&(e[i]==="\x1B"||e[i]==="›")){if(e.startsWith("\x1B]8;;",i)){const m="\x1B]8;;\x07",g=m.length,b=e.indexOf("\x07",i+5);if(b!==-1){const $=e.indexOf(m,b+1);if($!==-1){const x=$+g,S=e.slice(b+1,$).replace(be,""),D=_e(S,{ambiguousIsNarrow:o.width.ambiguousIsNarrow,ansiWidth:o.width.ansi,controlWidth:o.width.control,countAnsiEscapeCodes:!1,ellipsis:o.truncation.ellipsis,ellipsisWidth:o.truncation.ellipsisWidth,emojiWidth:o.width.emoji,fullWidth:o.width.fullWidth,halfWidth:o.width.halfWidth,limit:Math.max(0,r-a),regularWidth:o.width.regular,tabWidth:o.width.tab,wideWidth:o.width.wide}),K=D.width;if(D.truncated)l=!0,c=Math.min(c,i);else if(a+K>r&&(c=Math.min(c,i),l=!0,a+K>o.truncation.limit))break;if(a+=K,i=x,l&&a>=o.truncation.limit)break;continue}}}if(he.lastIndex=i,he.test(e)){const m=he.lastIndex-i,g=o.truncation.countAnsiEscapeCodes?m:o.width.ansi;if(a+g>r&&(c=Math.min(c,i),a+g>o.truncation.limit)){l=!0;break}a+=g,i=he.lastIndex;continue}}const f=e.codePointAt(i);if(f===8203||f===65279||f>=8288&&f<=8292){i+=1;continue}if(f===9){if(a+o.width.tab>r&&(c=Math.min(c,i),a+o.width.tab>o.truncation.limit)){l=!0;break}a+=o.width.tab,i+=1;continue}if(ue.lastIndex=i,ue.test(e)){const m=(ue.lastIndex-i)*o.width.regular;if(a+m>r){const g=o.width.regular>0?Math.floor((r-a)/o.width.regular):0;if(c=Math.min(c,i+g),a+m>o.truncation.limit){l=!0;break}}a+=m,i=ue.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(pe.lastIndex=i,pe.test(e))){const m=(pe.lastIndex-i)*o.width.control;if(a+m>r){const g=o.width.control>0?Math.floor((r-a)/o.width.control):0;if(c=Math.min(c,i+g),a+m>o.truncation.limit){l=!0;break}}a+=m,i=pe.lastIndex;continue}if(Ae.lastIndex=i,Ae.test(e)){if(a+o.width.emoji>r&&(c=Math.min(c,i),a+o.width.emoji>o.truncation.limit)){l=!0;break}a+=o.width.emoji,i=Ae.lastIndex;continue}const w=e.codePointAt(i)??0;if(fr(w)){i+=w>65535?2:1;continue}let h;if(s)h=mr(w,o);else switch(Vt(w)){case"control":{h=o.width.control;break}case"latin":{h=o.width.regular;break}case"wide":{h=o.width.wide;break}case"zero":{h=0;break}default:switch(Wt(w)){case"ambiguous":{h=o.width.ambiguousIsNarrow?o.width.regular:o.width.wide;break}case"fullwidth":{h=o.width.fullWidth;break}case"wide":{h=o.width.wide;break}default:h=o.width.regular}}if(a+h>r&&(c=Math.min(c,i),a+h>o.truncation.limit)){l=!0;break}a+=h,i+=w>65535?2:1}let d=a,u=!1;return l&&o.truncation.limit>=o.truncation.ellipsisWidth&&(d=o.truncation.limit,u=!0),{ellipsed:u,index:l?c:n,truncated:l,width:d}},k=(e,t={})=>_e(e,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,wr=(e,t)=>Math.floor((e-t)/2),br=(e,t)=>e-t,lt=(e,t={})=>{const o=t.align??"center";if(o==="left")return e;const r=t.split??`
2
+ `,n=t.pad??" ",s=o==="right"?br:wr;let i=!1,a;Array.isArray(e)?a=e:(i=!0,a=e.split(r));let c,l=0;const p=a.map(d=>(c=k(d,t.stringWidthOptions),l=Math.max(c,l),{str:d,width:c})).map(d=>Array.from({length:s(l,d.width)+1}).join(n)+d.str);return i?p.join(r):p};let vr=class{capacity;cache;constructor(t){this.capacity=t,this.cache=new Map}get(t){if(!this.cache.has(t))return;const o=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,o),o}has(t){return this.cache.has(t)}set(t,o){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.capacity){const r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(t,o)}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}size(){return this.cache.size}};const ct=new vr(100),xr=new Intl.Segmenter("en",{granularity:"grapheme"}),kr=/^[\u0000-\u007F]*$/,yr=new Set(["0","22","23","24","27","28","29","39","49"]),$r=new Set(["1","3","4","7","8","9"]),dt=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),ge=e=>e>="30"&&e<="37"||e>="90"&&e<="97"||e.startsWith("38;"),me=e=>e>="40"&&e<="47"||e>="100"&&e<="107"||e.startsWith("48;"),Sr=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],pt=(e,t)=>{let o=-1;for(const r of t){const n=e.indexOf(r);n!==-1&&(o===-1||n<o)&&(o=n)}return o},Er=(e,t)=>{if(!e.includes("\x1B"))return[{after:"",before:"",content:e,visibleLength:k(e,t.width)}];const o=`${JSON.stringify(t.width??void 0)}\0${e}`,r=ct.get(o);if(r)return r;const n=[],s=[];let i=0,a;for(be.lastIndex=0;(a=be.exec(e))!==null;){const d=a[0];n.push(e.slice(i,a.index)),s.push(d),i=a.index+d.length}i<e.length&&n.push(e.slice(i));const c=[];for(const d of s){if(d==="\x1B[0m"||d==="\x1B]8;;\x07"){c.push(d);continue}if(d.startsWith("\x1B[")&&d.endsWith("m")){const u=d.slice(2,-1);if(yr.has(u)){c.push(d);continue}}}const l=new Set,p=[];for(const[d,u]of n.entries()){if(d>0&&s[d-1]){const h=s[d-1];if(h==="\x1B[0m")l.clear();else if(h==="\x1B]8;;\x07"){for(const m of l)if(m.startsWith("\x1B]8;;")&&!m.endsWith("\x1B]8;;\x07")){l.delete(m);break}}else if(h.startsWith("\x1B[")&&h.endsWith("m")){const m=h.slice(2,-1);if(m==="39"){for(const g of l)if(g.startsWith("\x1B[")&&g.endsWith("m")){const b=g.slice(2,-1);if(ge(b)){l.delete(g);break}}}else if(m==="49"){for(const g of l)if(g.startsWith("\x1B[")&&g.endsWith("m")){const b=g.slice(2,-1);if(me(b)){l.delete(g);break}}}else if(dt.has(m)){const g=dt.get(m);for(const b of l)if(b===`\x1B[${g}m`){l.delete(b);break}}else{if(ge(m)){for(const g of l)if(g.startsWith("\x1B[")&&g.endsWith("m")){const b=g.slice(2,-1);if(ge(b)){l.delete(g);break}}}else if(me(m)){for(const g of l)if(g.startsWith("\x1B[")&&g.endsWith("m")){const b=g.slice(2,-1);if(me(b)){l.delete(g);break}}}else if($r.has(m)){const g=`\x1B[${m}m`;l.has(g)&&l.delete(g)}l.add(h)}}else if(h.startsWith("\x1B]8;;")&&!h.endsWith("\x1B]8;;\x07")){for(const m of l)if(m.startsWith("\x1B]8;;")&&!m.endsWith("\x1B]8;;\x07")){l.delete(m);break}l.add(h)}}if(u==="")continue;let f="";if(l.size>0)if(c.includes("\x1B[0m"))f="\x1B[0m";else{const h=[];let m=!1;for(const x of l)if(x.startsWith("\x1B]8;;")&&!x.endsWith("\x1B]8;;\x07")){m=!0;break}m&&c.includes("\x1B]8;;\x07")&&h.push("\x1B]8;;\x07");let g=!1,b=!1;for(const x of l)if(x.startsWith("\x1B[")&&x.endsWith("m")){const S=x.slice(2,-1);ge(S)?g=!0:me(S)&&(b=!0)}if(g&&b){const x=pt(e,["\x1B[3","\x1B[9","\x1B[38;"]),S=pt(e,["\x1B[4","\x1B[10","\x1B[48;"]);x>=0&&S>=0?x>S?h.push("\x1B[39m","\x1B[49m"):h.push("\x1B[49m","\x1B[39m"):h.push("\x1B[39m","\x1B[49m")}else g&&h.push("\x1B[39m"),b&&h.push("\x1B[49m");g&&b&&e.includes("\x1B[39m")&&e.includes("\x1B[49m")&&(e.indexOf("\x1B[39m")<e.indexOf("\x1B[49m")?(h.length-=2,h.push("\x1B[39m","\x1B[49m")):e.indexOf("\x1B[49m")<e.indexOf("\x1B[39m")&&(h.length-=2,h.push("\x1B[49m","\x1B[39m")));const $=Sr.filter(x=>l.has(x.open)).map(x=>({position:e.indexOf(x.open),style:x})).filter(x=>x.position>=0).toSorted((x,S)=>S.position-x.position);for(const x of $){const S=x;c.includes(S.style.close)&&h.push(S.style.close)}f=h.join("")}const w=[...l].join("");p.push({after:f,before:w,content:u,visibleLength:k(u,t.width)})}return ct.set(o,p),p},ht=(e,t,o,r)=>{const n=[...r.segmenter.segment(e)],s=[];let i=0,a=!1;for(const c of n){const l=k(c.segment,r.width),p=i,d=i+l;if(!a)if(p<t){i=d;continue}else a=!0;if(p>=o||d>o)break;s.push(c.segment),i=d}return s.join("")},j=(e,t=0,o=Number.MAX_SAFE_INTEGER,r={})=>{const n={segmenter:xr,...r};if(t>=o||e==="")return"";const s=k(e,n.width);if(t===0&&o>=s)return e;if(t<0||o<0)throw new RangeError("Negative indices aren't supported");if(!e.includes("\x1B"))return kr.test(e)?e.slice(t,o):ht(e,t,o,n);if(st.lastIndex=0,it.lastIndex=0,!st.test(e)&&!it.test(e))return e;const i=Er(e,n);if(i.length===0)return"";let a=0;const c=[];for(const[d,u]of i.entries()){const f=a,w=a+u.visibleLength;if(w>t&&f<o){const h=Math.max(0,t-f),m=Math.min(u.visibleLength,o-f);c.push({end:m,index:d,segment:u,start:h})}a=w}if(c.length===0)return"";const l=[],p=c[0].segment;l.push(p.before);for(let d=0;d<c.length;d++){const{end:u,segment:f,start:w}=c[d];if(w===0&&u===f.visibleLength?l.push(f.content):l.push(ht(f.content,w,u,n)),d<c.length-1){const h=c[d+1].segment,m=f.after,g=h.before;m!==g&&(m||g)&&l.push(m,g)}}return l.push(c.at(-1).segment.after),l.join("")},Cr=/\x1B\[(\d+)m/;let Zt=class{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(t){const o=Cr.exec(t);if(!o)return;const r=Number.parseInt(o[1],10);switch(r){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(r>=30&&r<=37||r>=90&&r<=97)this.activeForeground=t;else if(r>=40&&r<=47||r>=100&&r<=107)this.activeBackground=t;else if([1,2,3,4,7,8,9].includes(r))this.activeFormatting.push(t);else if([22,23,24,27,28,29].includes(r)){const n={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];n&&(this.activeFormatting=this.activeFormatting.filter(s=>!s.includes(n)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const t=[];if(this.activeFormatting.length>0){const o={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(r=>{const n=o[r];n&&t.push(n)})}return this.activeForeground&&t.push("\x1B[39m"),this.activeBackground&&t.push("\x1B[49m"),t.join("")}};const Tr=(e,t)=>{if(!Z.has(e[t]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const o=!0,r=e.slice(t+1,t+1+te.length).join("")===te;return{isInsideEscape:o,isInsideLinkEscape:r}},Ar=(e,t={})=>{const o=new Zt;let r="",n=!1,s="",i="",a=!1;const c=[...e];for(let l=0;l<c.length;l++){const p=c[l];if(p&&Z.has(p)){if(r){const h=t.getWidth?.(r)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:r,width:h};if(a&&(m.isHyperlink=!0,m.hyperlinkUrl=i),t.onSegment?.(m,o)===!1)return;r=""}n=!0,s=p;const f=Tr(c,l),{isInsideLinkEscape:w}=f;if(w){let h=l+1;for(i="";h<c.length;){const g=c[h];if(g===Ee)break;i+=g,h+=1}i=i.slice(4);const m={hyperlinkUrl:i,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(t.onSegment?.(m,o)===!1)return;l=h,a=!0,n=!1,s="";continue}if(l+1<c.length&&c[l+1]==="\\"&&a){const h={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(t.onSegment?.(h,o)===!1)return;a=!1,i="",l+=1,n=!1,s="";continue}}if(n){if(s!==p&&(s+=p),p===We){n=!1,o.processEscape(s);const f={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};if(t.onSegment?.(f,o)===!1)return;s=""}continue}r+=p;const d=t.getWidth?.(r)??0,u={isEscapeSequence:!1,isGrapheme:!0,text:r,width:d};if(a&&(u.isHyperlink=!0,u.hyperlinkUrl=i),t.onSegment?.(u,o)===!1)return;r=""}if(r){const l=t.getWidth?.(r)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:r,width:l};a&&(p.isHyperlink=!0,p.hyperlinkUrl=i),t.onSegment?.(p,o)}if(s){const l={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};t.onSegment?.(l,o)}},ut=e=>`${Z.values().next().value}${Ut}${String(e)}${We}`,gt=e=>`${Z.values().next().value}${te}${e}${Ee}`,Dr=e=>{if(e.length===0)return"";if(e.length===1)return e[0];let t="",o,r;const n=e.join(`
3
+ `),s=[...n];let i=0;for(const[a,c]of s.entries()){if(t+=c,Z.has(c)){const p=dr.exec(n.slice(i))?.groups??{};if(p.code!==void 0){const d=Number.parseFloat(p.code);o=d===lr?void 0:d}else p.uri!==void 0&&(r=p.uri.length===0?void 0:p.uri)}const l=pr.get(Number(o));s[a+1]===`
4
+ `?(r&&(t+=gt("")),o&&l&&(t+=ut(l))):c===`
5
+ `&&(o&&l&&(t+=ut(o)),r&&(t+=gt(r))),i+=c.length}return t},Gt=/(?=\s)|(?<=\s)/,Kt=/^\s+$/,mt=new Map,Br=e=>{const t=mt.get(e);if(t!==void 0)return t;const o=k(e);return mt.set(e,o),o},De=e=>{if(!e.includes("\x1B"))return e;let t=e;return e.includes("\x1B[30m")&&(t+="\x1B[39m"),e.includes("\x1B[42m")&&(t+="\x1B[49m"),t},P=e=>{const t=e.split(" ");let o=t.length;for(;o>0&&k(t[o-1])===0;)o--;return o===t.length?e:t.slice(0,o).join(" ")+t.slice(o).join("")},Qt=(e,t,o)=>{if(e.length===0)return[""];if(t<=0)return[e];const r=[],n=new Zt;let s="",i=0,a=!1,c=!1,l="",p=0;for(;p<e.length;){const d=e.codePointAt(p),u=String.fromCodePoint(d),f=u.length;if(Z.has(u)){a=!0,l=u,s+=u,c=e.startsWith(te,p+1),p+=1;continue}if(a){l+=u,s+=u,c?u===Ee&&(a=c=!1):u===We&&(a=!1,n.processEscape(l)),p+=1;continue}const w=Br(u),h=u===" ";if(w===0){s+=u,p+=f;continue}if(i+w>t&&(s&&r.push(s+n.getEndEscapesForAllActiveAttributes()),s=n.getStartEscapesForAllActiveAttributes(),i=k(s),h&&o)){for(;p<e.length&&e[p]===" ";)p+=1;continue}if(s+=u,i+=w,i===t&&p+f<e.length&&(r.push(s+n.getEndEscapesForAllActiveAttributes()),s=n.getStartEscapesForAllActiveAttributes(),i=k(s),p+f<e.length&&e[p+f]===" "&&o)){for(p+=f;p<e.length&&e[p]===" ";)p+=1;continue}p+=f}return s&&r.push(s+n.getEndEscapesForAllActiveAttributes()),o?r.map(d=>P(d)):r},Ir=(e,t,o)=>{if(e.length===0)return[];const r=o?e.trim():e;if(r.length===0)return[];const n=[];let s="",i=0;return Ar(r,{getWidth:k,onSegment:(a,c)=>{const l=a.text??"";if(a.isEscapeSequence)s+=l;else{const p=l===" ";if(a.width===0)return s+=l,!0;if(i+a.width>t&&(s&&n.push(s),s=c.getStartEscapesForAllActiveAttributes(),i=0,p))return o||n.push(c.getStartEscapesForAllActiveAttributes()+l),!0;s+=l,i+=a.width}return!0}}),s&&n.push(s),o?n.map(a=>P(a)):n},Rr=(e,t,o)=>{if(e.length===0)return[];const r=o?e.trim():e;if(r.length===0)return[];const n=r.split(Gt),s=[];let i="",a=0,c=0;for(;c<n.length;){const l=n[c],p=Kt.test(l),d=k(l);if(l.length===0){c+=1;continue}if(o&&p&&a===0){c+=1;continue}if(a+d>t&&a>0){o?s.push(P(i)):s.push(i),i="",a=0;continue}i+=l,a+=d,c+=1}return i&&(o?s.push(P(i)):s.push(i)),s},Lr=(e,t,o)=>{if(e.length===0)return[];const r=o?e.trim():e;if(r.length===0)return[];const n=r.split(Gt),s=[];let i="",a=0,c=0;for(;c<n.length;){const l=n[c],p=Kt.test(l),d=k(l);if(l.length===0){c+=1;continue}if(o&&p&&a===0){c+=1;continue}if(d>t){i&&s.push(De(o?P(i):i));const u=Qt(l,t,o);if(u.length>0){for(let f=0;f<u.length-1;f+=1)s.push(u[f]);i=u.at(-1),a=k(i)}else i="",a=0;c+=1;continue}if(a+d>t&&a>0&&(s.push(De(o?P(i):i)),i="",a=0,o&&p)){c+=1;continue}i+=l,a+=d,c+=1}return i&&s.push(De(o?P(i):i)),s},V={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Xt=(e,t={})=>{const{removeZeroWidthCharacters:o=!0,trim:r=!0,width:n=80,wrapMode:s=V.PRESERVE_WORDS}=t;if(r&&e.trim()==="")return"";let i=e.normalize("NFC").replaceAll(`\r
6
6
  `,`
7
7
  `);return o&&(i=i.replaceAll(cr,"")),i.split(`
8
- `).map(a=>{if(r&&a.trim()==="")return"";let l;switch(s){case V.BREAK_AT_CHARACTERS:{l=Ir(a,n,r);break}case V.BREAK_WORDS:{l=Lr(a,n,r);break}case V.STRICT_WIDTH:{l=Qt(a,n,r);break}default:l=Rr(a,n,r)}return Dr(l)}).join(`
8
+ `).map(a=>{if(r&&a.trim()==="")return"";let c;switch(s){case V.BREAK_AT_CHARACTERS:{c=Ir(a,n,r);break}case V.BREAK_WORDS:{c=Lr(a,n,r);break}case V.STRICT_WIDTH:{c=Qt(a,n,r);break}default:c=Rr(a,n,r)}return Dr(c)}).join(`
9
9
  `)},_r={arrow:{bottom:"↑",bottomLeft:"↗",bottomRight:"↖",left:"→",right:"←",top:"↓",topLeft:"↘",topRight:"↙"},bold:{bottom:"━",bottomLeft:"┗",bottomRight:"┛",left:"┃",right:"┃",top:"━",topLeft:"┏",topRight:"┓"},classic:{bottom:"-",bottomLeft:"+",bottomRight:"+",left:"|",right:"|",top:"-",topLeft:"+",topRight:"+"},double:{bottom:"═",bottomLeft:"╚",bottomRight:"╝",left:"║",right:"║",top:"═",topLeft:"╔",topRight:"╗"},doubleSingle:{bottom:"═",bottomLeft:"╘",bottomRight:"╛",left:"│",right:"│",top:"═",topLeft:"╒",topRight:"╕"},none:{bottom:"",bottomLeft:"",bottomRight:"",left:"",right:"",top:"",topLeft:"",topRight:""},round:{bottom:"─",bottomLeft:"╰",bottomRight:"╯",left:"│",right:"│",top:"─",topLeft:"╭",topRight:"╮"},single:{bottom:"─",bottomLeft:"└",bottomRight:"┘",left:"│",right:"│",top:"─",topLeft:"┌",topRight:"┐"},singleDouble:{bottom:"─",bottomLeft:"╙",bottomRight:"╜",left:"║",right:"║",top:"─",topLeft:"╓",topRight:"╖"}},Jt=80,Yt=24,ie=()=>globalThis.process,ve=e=>{const t=ie();if(typeof t?.getBuiltinModule=="function")try{return t.getBuiltinModule(e)}catch{return}},we=(e,t)=>({columns:Number.parseInt(String(e),10),rows:Number.parseInt(String(t),10)}),eo=(e,t)=>{const{columns:o,rows:r}=we(e,t);if(!(Number.isNaN(o)||Number.isNaN(r))&&!(o===Jt&&r===Yt))return{columns:o,rows:r}},ze=(e,t,o)=>{const r=ve("node:child_process");if(r?.execFileSync!==void 0)return r.execFileSync(e,t,{encoding:"utf8",env:o,stdio:["ignore","pipe","ignore"],timeout:500}).trim()},zr=()=>{if(ie()?.platform!=="linux")return!0;try{const e=ve("node:fs");if(e===void 0)return!1;const t=e.readFileSync("/proc/self/stat","utf8"),o=t.lastIndexOf(") ");if(o===-1)return!1;const r=t.slice(o+2).trim().split(/\s+/),n=Number.parseInt(r[2],10),s=Number.parseInt(r[5],10);return Number.isNaN(n)||Number.isNaN(s)||s<=0?!1:n===s}catch{return!1}},ft=()=>{try{const e=ve("node:fs"),t=ve("node:tty");if(e===void 0||t===void 0)return;const o=ie()?.platform==="darwin"?e.constants.O_EVTONLY|e.constants.O_NONBLOCK:e.constants.O_NONBLOCK,{columns:r,rows:n}=t.WriteStream(e.openSync("/dev/tty",o));return r===void 0||n===void 0?void 0:{columns:r,rows:n}}catch{return}},Be=()=>{try{const e={TERM:"dumb",...ie()?.env},t=ze("tput",["cols"],e),o=ze("tput",["lines"],e);return t&&o?eo(t,o):void 0}catch{return}},Mr=()=>{try{if(!zr())return;const e=ze("resize",["-u"])?.match(/\d+/g);return e?.length===2?eo(e[0],e[1]):void 0}catch{return}},Fr=()=>{const e=ie(),{env:t,stderr:o,stdout:r}=e??{};if(r?.columns&&r?.rows)return we(r.columns,r.rows);if(o?.columns&&o?.rows)return we(o.columns,o.rows);if(t?.COLUMNS&&t?.LINES)return we(t.COLUMNS,t.LINES);const n={columns:Jt,rows:Yt};return typeof e?.getBuiltinModule!="function"?n:e.platform==="win32"?Be()??n:e.platform==="darwin"?ft()??Be()??n:ft()??Be()??Mr()??n},to=e=>{let t=0;for(const o of e.split(`
10
10
  `))t=Math.max(t,k(o));return t},N=`
11
- `,A=" ",oe="none";let wt;const jr=()=>(wt??=Fr(),wt),M=e=>Math.max(0,Math.floor(e)),bt=e=>{if(typeof e=="number")return{bottom:M(e),left:M(e*3),right:M(e*3),top:M(e)};const t={bottom:0,left:0,right:0,top:0,...e};return{bottom:M(t.bottom),left:M(t.left),right:M(t.right),top:M(t.top)}},re=e=>e===oe?0:2,Nr=e=>{const t=["topLeft","topRight","bottomRight","bottomLeft","left","right","top","bottom"];let o;if(e===oe){e={};for(const r of t)e[r]=""}if(typeof e=="string"){const r=_r[e];if(r===void 0)throw new TypeError(`Invalid border style: ${e}`);o=r}else{e={...e},typeof e.vertical=="string"&&(e.left=e.vertical,e.right=e.vertical),typeof e.horizontal=="string"&&(e.top=e.horizontal,e.bottom=e.horizontal);for(const r of t)if(typeof e[r]!="string")throw new TypeError(`Invalid border style: ${r}`);o=e}return o},vt=(e,t,o,r,n)=>{e=t(e);const s=k(e);let i;switch(n){case"left":{const a=j(o,s);i=e+r(a,k(a));break}case"right":{const a=j(o,s+2);i=`${r(a,k(a))} ${e} `;break}default:{if(o=o.slice(s),k(o)%2===1)o=j(o,Math.floor(k(o)/2)),i=r(j(o,1),k(j(o,1)))+e+r(o,k(o));else{o=j(o,k(o)/2);const a=k(o);i=r(o,a)+e+r(o,a)}break}}return i},Or=(e,{height:t,padding:o,textAlignment:r,verticalAlignment:n,width:s})=>{e=lt(e,{align:r});let i=e.split(N);const a=to(e),l=s-o.left-o.right;if(a>l){const d=[];for(const u of i){const f=Xt(u,{width:l,wrapMode:V.BREAK_WORDS}),w=lt(f,{align:r}).split(`
12
- `),h=Math.max(...w.map(m=>k(m)));for(const m of w){let g;switch(r){case"center":{g=A.repeat(Math.max(0,(l-h)/2))+m;break}case"right":{g=A.repeat(Math.max(0,l-h))+m;break}default:{g=m;break}}d.push(g)}}i=d}r==="center"&&a<l?i=i.map(d=>A.repeat((l-a)/2)+d):r==="right"&&a<l&&(i=i.map(d=>A.repeat(l-a)+d));const c=A.repeat(o.left),p=A.repeat(o.right);if(i=i.map(d=>{const u=c+d+p,f=s-k(u);return u+A.repeat(Math.max(f,0))}),o.top>0&&(i=[...Array.from({length:o.top}).fill(A.repeat(s)),...i]),o.bottom>0&&(i=[...i,...Array.from({length:o.bottom}).fill(A.repeat(s))]),t&&i.length>t)i=i.slice(0,t);else if(t&&i.length<t){const d=t-i.length,u=A.repeat(s);switch(n){case"bottom":{i=[...Array.from({length:d}).fill(u),...i];break}case"center":{const f=Math.floor(d/2),w=d-f;i=[...Array.from({length:f}).fill(u),...i,...Array.from({length:w}).fill(u)];break}default:{i=[...i,...Array.from({length:d}).fill(u)];break}}}return i.join(N)},Pr=(e,t,o,r)=>{const n=(g,b,$)=>r.borderColor?r.borderColor(g,b,$):g,s=g=>r.headerTextColor?r.headerTextColor(g):g,i=g=>r.footerTextColor?r.footerTextColor(g):g,a=g=>r.textColor?r.textColor(g):g,l=g=>r.backgroundColor?r.backgroundColor(g):g,c=Nr(r.borderStyle);let p=A.repeat(r.margin.left);if(r.float==="center"){const g=Math.max((o-t-re(r.borderStyle))/2,0);p=A.repeat(g)}else if(r.float==="right"){const g=Math.max(o-t-r.margin.right-re(r.borderStyle),0);p=A.repeat(g)}let d="";if(r.margin.top&&(d+=N.repeat(r.margin.top)),r.borderStyle!==oe||r.headerText){let g=n(c.top.repeat(t),"top",t);r.headerText&&(g=vt(r.headerText,s,c.top.repeat(t),($,x)=>n($,"top",x),r.headerAlignment));const b=p+n(c.topLeft,"topLeft",k(c.topLeft));d+=b+g+n(c.topRight,"topRight",k(c.topRight))+N}const u=e.split(N),f=k(c.left),w=k(c.right),h=p+n(c.left,"left",f),m=n(c.right,"right",w);if(d+=u.map(g=>h+l(a(g))+m).join(N),r.borderStyle!==oe||r.footerText){const g=N+p+n(c.bottomLeft,"bottomLeft",k(c.bottomLeft));let b=n(c.bottom.repeat(t),"bottom",t);r.footerText&&(b=vt(r.footerText,i,c.bottom.repeat(t),($,x)=>n($,"bottom",x),r.footerAlignment)),d+=g+b+n(c.bottomRight,"bottomRight",k(c.bottomRight))}return r.margin.bottom&&(d+=N.repeat(r.margin.bottom)),d},Hr=e=>{let t,o;if(Array.isArray(e))[t,o]=e;else if(e&&typeof e=="object")({columns:t,rows:o}=e);else throw new TypeError(`"fullscreen" callback must return a [width, height] tuple or { columns, rows } object, got ${typeof e}`);if(typeof t!="number"||typeof o!="number"||Number.isNaN(t)||Number.isNaN(o))throw new TypeError('"fullscreen" callback returned invalid dimensions; both width and height must be numbers');return{columns:t,rows:o}},Wr=(e,t)=>{if(e.fullscreen){const{columns:o,rows:r}=typeof e.fullscreen=="function"?Hr(e.fullscreen(t.columns,t.rows)):t;e.width??=o,e.height??=r}return e.width&&(e.width=Math.max(1,e.width-re(e.borderStyle))),e.height&&(e.height=Math.max(1,e.height-re(e.borderStyle))),e},xt=(e,t)=>t===oe?e:` ${e} `,qr=(e,t,o,r)=>{o=Wr(o,r);const n=o.width!==void 0,s=re(o.borderStyle),i=t-o.margin.left-o.margin.right-s,a=n?0:to(Xt(e,{trim:!1,width:t-s,wrapMode:V.BREAK_WORDS}))+o.padding.left+o.padding.right;if(o.headerText&&n?(o.headerText=j(o.headerText,0,Math.max(0,o.width-2)),o.headerText&&(o.headerText=xt(o.headerText,o.borderStyle))):o.headerText&&(o.headerText=j(o.headerText,0,Math.max(0,i-2)),o.headerText&&(o.headerText=xt(o.headerText,o.borderStyle),k(o.headerText)>a&&(o.width=k(o.headerText)))),o.width=o.width??a,!n){if(o.margin.left&&o.margin.right&&o.width>i){const l=(t-o.width-s)/(o.margin.left+o.margin.right);o.margin.left=Math.max(0,Math.floor(o.margin.left*l)),o.margin.right=Math.max(0,Math.floor(o.margin.right*l))}o.width=Math.min(o.width,t-s-o.margin.left-o.margin.right)}return o.width-(o.padding.left+o.padding.right)<=0&&(o.padding.left=0,o.padding.right=0),o.height&&o.height-(o.padding.top+o.padding.bottom)<=0&&(o.padding.top=0,o.padding.bottom=0),o},Ur=e=>e===null?"null":typeof e,X=(e,t)=>{if(e!==void 0&&typeof e!="function")throw new TypeError(`"${t}" must be a function, got ${Ur(e)}`)},Vr=(e,t={})=>{if(X(t.borderColor,"borderColor"),X(t.textColor,"textColor"),X(t.backgroundColor,"backgroundColor"),X(t.headerTextColor,"headerTextColor"),X(t.footerTextColor,"footerTextColor"),t.fullscreen!==void 0&&typeof t.fullscreen!="boolean"&&typeof t.fullscreen!="function")throw new TypeError(`"fullscreen" must be a boolean or a function, got ${typeof t.fullscreen}`);let o={borderStyle:"single",float:"left",footerAlignment:"right",headerAlignment:"left",textAlignment:"left",transformTabToSpace:4,verticalAlignment:"top",...t};o.padding=bt(t.padding??0),o.margin=bt(t.margin),o.transformTabToSpace&&(e=e.replaceAll(" "," ".repeat(o.transformTabToSpace)));const r=t.terminalColumns===void 0||o.fullscreen&&t.terminalRows===void 0?jr():{columns:0,rows:0},n={columns:t.terminalColumns??r.columns,rows:t.terminalRows??r.rows},{columns:s}=n;return o=qr(e,s,o,n),Pr(Or(e,o),o.width,s,o)},Zr=new Set(["cjs","mjs"]),Gr=new Set(["cts","mts"]),Kr=new Set(["mdoc"]),ae=e=>{const o=(e.split("?")[0]??e).split(".").pop()?.toLowerCase();if(!o)return"text";if(Zr.has(o))return"javascript";if(Gr.has(o))return"typescript";if(Kr.has(o))return"markdown";switch(o){case"js":return"javascript";case"json":return"json";case"json5":return"json5";case"jsonc":return"jsonc";case"jsx":return"jsx";case"sql":return"sql";case"ts":return"typescript";case"tsx":return"tsx";case"xml":return"xml";case"md":return"markdown";case"mdx":return"mdx";case"svelte":return"svelte";case"vue":return"vue";case"html":return"html";case"css":return"css";case"scss":return"scss";case"less":return"less";case"sass":return"sass";case"stylus":return"stylus";case"styl":return"styl";case"yaml":case"yml":return"yaml";case"toml":return"toml";case"py":return"python";case"go":return"go";case"rs":return"rust";case"rb":return"ruby";case"php":return"php";case"graphql":case"gql":return"graphql";case"dockerfile":return"dockerfile";case"sh":case"bash":return"bash";case"txt":return"text";default:return"text"}},Qr=50,_=new Map,Xr=e=>{const t=_.get(e);if(t!==void 0)return _.delete(e),_.set(e,t),t},Ie=(e,t)=>{if(_.has(e))_.delete(e);else if(_.size>=Qr){const o=_.keys().next().value;o!==void 0&&_.delete(o)}_.set(e,t)},le=async(e,t={})=>{const{allowRemote:o=!1}=t,r=Xr(e);if(r!==void 0)return r;if(e.startsWith("file:"))try{const n=await Ye(Ro(e),"utf8");return Ie(e,n),n}catch{return}if(/^(?:https?|data):/.test(e)){if(!o)return;try{const n=await fetch(e);if(!n.ok)return;const s=await n.text();return Ie(e,s),s}catch{return}}if(Io(e))try{const n=await Ye(e,"utf8");return Ie(e,n),n}catch{return}},Jr=e=>e.replace(/^\s*#+\s*/,"").trim(),Yr=async(e,t,o=!1,r)=>{const n=[...t,Nt,Ot].toSorted((a,l)=>l.priority-a.priority),s=Do(e,{frameLimit:1})[0]??{},i=s.file?await le(s.file):"";for(const a of n){const{handle:l,name:c}=a;if(o&&console.log(`[solution-finder] running: ${c??"anonymous"}`),typeof l!="function")continue;const p=await l(e,{file:s.file??"",language:ae(s.file??""),line:s.line??0,snippet:i});if(p)return o&&console.log(`[solution-finder] matched: ${c??"anonymous"}`),p}},en=async(e,t,o)=>{const{solutionFinders:r=[],solutionTitle:n,color:s,debug:i=!1,...a}=t,l=Bo(e,{...a,color:s?.codeFrame}),c=await Yr(e,r,i);if(!c)return{errorAnsi:l,solutionBox:void 0};const p=Jr(c.header??n??"A possible solution to this error"),d=Vr(c.body,{borderStyle:"round",padding:{top:1,right:2,bottom:1,left:2},margin:{top:0,right:0,bottom:0,left:0},headerText:`💡 ${p}`,headerAlignment:"left",textAlignment:"left",...s?.boxen});return{errorAnsi:l,solutionBox:d}},kt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-help-circle%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%2210%22%20%2F%3E%20%3Cpath%20d%3D%22M9.09%209a3%203%200%200%201%205.83%201c0%202-3%203-3%203%22%20%2F%3E%20%3Cpath%20d%3D%22M12%2017h.01%22%20%2F%3E%20%3C%2Fsvg%3E",yt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-keyboard%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M10%208h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M12%2012h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M14%208h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2012h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M18%208h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M6%208h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M7%2016h10%22%20%2F%3E%20%3Cpath%20d%3D%22M8%2012h.01%22%20%2F%3E%20%3Crect%20width%3D%2220%22%20height%3D%2216%22%20x%3D%222%22%20y%3D%224%22%20rx%3D%222%22%20%2F%3E%20%3C%2Fsvg%3E",tn=`
11
+ `,A=" ",oe="none";let wt;const jr=()=>(wt??=Fr(),wt),M=e=>Math.max(0,Math.floor(e)),bt=e=>{if(typeof e=="number")return{bottom:M(e),left:M(e*3),right:M(e*3),top:M(e)};const t={bottom:0,left:0,right:0,top:0,...e};return{bottom:M(t.bottom),left:M(t.left),right:M(t.right),top:M(t.top)}},re=e=>e===oe?0:2,Nr=e=>{const t=["topLeft","topRight","bottomRight","bottomLeft","left","right","top","bottom"];let o;if(e===oe){e={};for(const r of t)e[r]=""}if(typeof e=="string"){const r=_r[e];if(r===void 0)throw new TypeError(`Invalid border style: ${e}`);o=r}else{e={...e},typeof e.vertical=="string"&&(e.left=e.vertical,e.right=e.vertical),typeof e.horizontal=="string"&&(e.top=e.horizontal,e.bottom=e.horizontal);for(const r of t)if(typeof e[r]!="string")throw new TypeError(`Invalid border style: ${r}`);o=e}return o},vt=(e,t,o,r,n)=>{e=t(e);const s=k(e);let i;switch(n){case"left":{const a=j(o,s);i=e+r(a,k(a));break}case"right":{const a=j(o,s+2);i=`${r(a,k(a))} ${e} `;break}default:{if(o=o.slice(s),k(o)%2===1)o=j(o,Math.floor(k(o)/2)),i=r(j(o,1),k(j(o,1)))+e+r(o,k(o));else{o=j(o,k(o)/2);const a=k(o);i=r(o,a)+e+r(o,a)}break}}return i},Or=(e,{height:t,padding:o,textAlignment:r,verticalAlignment:n,width:s})=>{e=lt(e,{align:r});let i=e.split(N);const a=to(e),c=s-o.left-o.right;if(a>c){const d=[];for(const u of i){const f=Xt(u,{width:c,wrapMode:V.BREAK_WORDS}),w=lt(f,{align:r}).split(`
12
+ `),h=Math.max(...w.map(m=>k(m)));for(const m of w){let g;switch(r){case"center":{g=A.repeat(Math.max(0,(c-h)/2))+m;break}case"right":{g=A.repeat(Math.max(0,c-h))+m;break}default:{g=m;break}}d.push(g)}}i=d}r==="center"&&a<c?i=i.map(d=>A.repeat((c-a)/2)+d):r==="right"&&a<c&&(i=i.map(d=>A.repeat(c-a)+d));const l=A.repeat(o.left),p=A.repeat(o.right);if(i=i.map(d=>{const u=l+d+p,f=s-k(u);return u+A.repeat(Math.max(f,0))}),o.top>0&&(i=[...Array.from({length:o.top}).fill(A.repeat(s)),...i]),o.bottom>0&&(i=[...i,...Array.from({length:o.bottom}).fill(A.repeat(s))]),t&&i.length>t)i=i.slice(0,t);else if(t&&i.length<t){const d=t-i.length,u=A.repeat(s);switch(n){case"bottom":{i=[...Array.from({length:d}).fill(u),...i];break}case"center":{const f=Math.floor(d/2),w=d-f;i=[...Array.from({length:f}).fill(u),...i,...Array.from({length:w}).fill(u)];break}default:{i=[...i,...Array.from({length:d}).fill(u)];break}}}return i.join(N)},Pr=(e,t,o,r)=>{const n=(g,b,$)=>r.borderColor?r.borderColor(g,b,$):g,s=g=>r.headerTextColor?r.headerTextColor(g):g,i=g=>r.footerTextColor?r.footerTextColor(g):g,a=g=>r.textColor?r.textColor(g):g,c=g=>r.backgroundColor?r.backgroundColor(g):g,l=Nr(r.borderStyle);let p=A.repeat(r.margin.left);if(r.float==="center"){const g=Math.max((o-t-re(r.borderStyle))/2,0);p=A.repeat(g)}else if(r.float==="right"){const g=Math.max(o-t-r.margin.right-re(r.borderStyle),0);p=A.repeat(g)}let d="";if(r.margin.top&&(d+=N.repeat(r.margin.top)),r.borderStyle!==oe||r.headerText){let g=n(l.top.repeat(t),"top",t);r.headerText&&(g=vt(r.headerText,s,l.top.repeat(t),($,x)=>n($,"top",x),r.headerAlignment));const b=p+n(l.topLeft,"topLeft",k(l.topLeft));d+=b+g+n(l.topRight,"topRight",k(l.topRight))+N}const u=e.split(N),f=k(l.left),w=k(l.right),h=p+n(l.left,"left",f),m=n(l.right,"right",w);if(d+=u.map(g=>h+c(a(g))+m).join(N),r.borderStyle!==oe||r.footerText){const g=N+p+n(l.bottomLeft,"bottomLeft",k(l.bottomLeft));let b=n(l.bottom.repeat(t),"bottom",t);r.footerText&&(b=vt(r.footerText,i,l.bottom.repeat(t),($,x)=>n($,"bottom",x),r.footerAlignment)),d+=g+b+n(l.bottomRight,"bottomRight",k(l.bottomRight))}return r.margin.bottom&&(d+=N.repeat(r.margin.bottom)),d},Hr=e=>{let t,o;if(Array.isArray(e))[t,o]=e;else if(e&&typeof e=="object")({columns:t,rows:o}=e);else throw new TypeError(`"fullscreen" callback must return a [width, height] tuple or { columns, rows } object, got ${typeof e}`);if(typeof t!="number"||typeof o!="number"||Number.isNaN(t)||Number.isNaN(o))throw new TypeError('"fullscreen" callback returned invalid dimensions; both width and height must be numbers');return{columns:t,rows:o}},Wr=(e,t)=>{if(e.fullscreen){const{columns:o,rows:r}=typeof e.fullscreen=="function"?Hr(e.fullscreen(t.columns,t.rows)):t;e.width??=o,e.height??=r}return e.width&&(e.width=Math.max(1,e.width-re(e.borderStyle))),e.height&&(e.height=Math.max(1,e.height-re(e.borderStyle))),e},xt=(e,t)=>t===oe?e:` ${e} `,qr=(e,t,o,r)=>{o=Wr(o,r);const n=o.width!==void 0,s=re(o.borderStyle),i=t-o.margin.left-o.margin.right-s,a=n?0:to(Xt(e,{trim:!1,width:t-s,wrapMode:V.BREAK_WORDS}))+o.padding.left+o.padding.right;if(o.headerText&&n?(o.headerText=j(o.headerText,0,Math.max(0,o.width-2)),o.headerText&&(o.headerText=xt(o.headerText,o.borderStyle))):o.headerText&&(o.headerText=j(o.headerText,0,Math.max(0,i-2)),o.headerText&&(o.headerText=xt(o.headerText,o.borderStyle),k(o.headerText)>a&&(o.width=k(o.headerText)))),o.width=o.width??a,!n){if(o.margin.left&&o.margin.right&&o.width>i){const c=(t-o.width-s)/(o.margin.left+o.margin.right);o.margin.left=Math.max(0,Math.floor(o.margin.left*c)),o.margin.right=Math.max(0,Math.floor(o.margin.right*c))}o.width=Math.min(o.width,t-s-o.margin.left-o.margin.right)}return o.width-(o.padding.left+o.padding.right)<=0&&(o.padding.left=0,o.padding.right=0),o.height&&o.height-(o.padding.top+o.padding.bottom)<=0&&(o.padding.top=0,o.padding.bottom=0),o},Ur=e=>e===null?"null":typeof e,X=(e,t)=>{if(e!==void 0&&typeof e!="function")throw new TypeError(`"${t}" must be a function, got ${Ur(e)}`)},Vr=(e,t={})=>{if(X(t.borderColor,"borderColor"),X(t.textColor,"textColor"),X(t.backgroundColor,"backgroundColor"),X(t.headerTextColor,"headerTextColor"),X(t.footerTextColor,"footerTextColor"),t.fullscreen!==void 0&&typeof t.fullscreen!="boolean"&&typeof t.fullscreen!="function")throw new TypeError(`"fullscreen" must be a boolean or a function, got ${typeof t.fullscreen}`);let o={borderStyle:"single",float:"left",footerAlignment:"right",headerAlignment:"left",textAlignment:"left",transformTabToSpace:4,verticalAlignment:"top",...t};o.padding=bt(t.padding??0),o.margin=bt(t.margin),o.transformTabToSpace&&(e=e.replaceAll(" "," ".repeat(o.transformTabToSpace)));const r=t.terminalColumns===void 0||o.fullscreen&&t.terminalRows===void 0?jr():{columns:0,rows:0},n={columns:t.terminalColumns??r.columns,rows:t.terminalRows??r.rows},{columns:s}=n;return o=qr(e,s,o,n),Pr(Or(e,o),o.width,s,o)},Zr=new Set(["cjs","mjs"]),Gr=new Set(["cts","mts"]),Kr=new Set(["mdoc"]),ae=e=>{const o=(e.split("?")[0]??e).split(".").pop()?.toLowerCase();if(!o)return"text";if(Zr.has(o))return"javascript";if(Gr.has(o))return"typescript";if(Kr.has(o))return"markdown";switch(o){case"js":return"javascript";case"json":return"json";case"json5":return"json5";case"jsonc":return"jsonc";case"jsx":return"jsx";case"sql":return"sql";case"ts":return"typescript";case"tsx":return"tsx";case"xml":return"xml";case"md":return"markdown";case"mdx":return"mdx";case"svelte":return"svelte";case"vue":return"vue";case"html":return"html";case"css":return"css";case"scss":return"scss";case"less":return"less";case"sass":return"sass";case"stylus":return"stylus";case"styl":return"styl";case"yaml":case"yml":return"yaml";case"toml":return"toml";case"py":return"python";case"go":return"go";case"rs":return"rust";case"rb":return"ruby";case"php":return"php";case"graphql":case"gql":return"graphql";case"dockerfile":return"dockerfile";case"sh":case"bash":return"bash";case"txt":return"text";default:return"text"}},Qr=50,_=new Map,Xr=e=>{const t=_.get(e);if(t!==void 0)return _.delete(e),_.set(e,t),t},Ie=(e,t)=>{if(_.has(e))_.delete(e);else if(_.size>=Qr){const o=_.keys().next().value;o!==void 0&&_.delete(o)}_.set(e,t)},le=async(e,t={})=>{const{allowRemote:o=!1}=t,r=Xr(e);if(r!==void 0)return r;if(e.startsWith("file:"))try{const n=await Ye(Ro(e),"utf8");return Ie(e,n),n}catch{return}if(/^(?:https?|data):/.test(e)){if(!o)return;try{const n=await fetch(e);if(!n.ok)return;const s=await n.text();return Ie(e,s),s}catch{return}}if(Io(e))try{const n=await Ye(e,"utf8");return Ie(e,n),n}catch{return}},Jr=e=>e.replace(/^\s*#+\s*/,"").trim(),Yr=async(e,t,o=!1,r)=>{const n=[...t,Nt,Ot].toSorted((a,c)=>c.priority-a.priority),s=Do(e,{frameLimit:1})[0]??{},i=s.file?await le(s.file):"";for(const a of n){const{handle:c,name:l}=a;if(o&&console.log(`[solution-finder] running: ${l??"anonymous"}`),typeof c!="function")continue;const p=await c(e,{file:s.file??"",language:ae(s.file??""),line:s.line??0,snippet:i});if(p)return o&&console.log(`[solution-finder] matched: ${l??"anonymous"}`),p}},en=async(e,t,o)=>{const{solutionFinders:r=[],solutionTitle:n,color:s,debug:i=!1,...a}=t,c=Bo(e,{...a,color:s?.codeFrame}),l=await Yr(e,r,i);if(!l)return{errorAnsi:c,solutionBox:void 0};const p=Jr(l.header??n??"A possible solution to this error"),d=Vr(l.body,{borderStyle:"round",padding:{top:1,right:2,bottom:1,left:2},margin:{top:0,right:0,bottom:0,left:0},headerText:`💡 ${p}`,headerAlignment:"left",textAlignment:"left",...s?.boxen});return{errorAnsi:c,solutionBox:d}},kt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-help-circle%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%2210%22%20%2F%3E%20%3Cpath%20d%3D%22M9.09%209a3%203%200%200%201%205.83%201c0%202-3%203-3%203%22%20%2F%3E%20%3Cpath%20d%3D%22M12%2017h.01%22%20%2F%3E%20%3C%2Fsvg%3E",yt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-keyboard%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M10%208h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M12%2012h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M14%208h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2012h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M18%208h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M6%208h.01%22%20%2F%3E%20%3Cpath%20d%3D%22M7%2016h10%22%20%2F%3E%20%3Cpath%20d%3D%22M8%2012h.01%22%20%2F%3E%20%3Crect%20width%3D%2220%22%20height%3D%2216%22%20x%3D%222%22%20y%3D%224%22%20rx%3D%222%22%20%2F%3E%20%3C%2Fsvg%3E",tn=`
13
13
  <div id="ono-shortcuts-modal" class="fixed inset-0 z-50 hidden backdrop-blur-xl items-center justify-center p-2" role="dialog" aria-modal="true" aria-hidden="true" aria-labelledby="ono-shortcuts-title">
14
14
  <div class="bg-[var(--ono-surface)] rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-2)] max-w-md w-full max-h-[90vh] overflow-auto">
15
15
  <div class="flex items-center justify-between px-4 py-2 border-b border-[var(--ono-border)]">
@@ -327,7 +327,7 @@ ready(function () { bindShortcutsModal(); });
327
327
  <path d="M21 14v1" />
328
328
  </svg>
329
329
  `,ro=(...e)=>e.filter(t=>typeof t=="string"&&t.length>0).join(" "),dn=e=>{const t=r=>{if(r.icon)return C(r.icon);switch(r.id){case"context":return an;case"stack":return ln;default:return cn}};return{html:`<nav class="flex gap-1 p-1 rounded-[var(--ono-radius-md)] bg-[var(--ono-surface-muted)] shadow-[var(--ono-elevation-1)]" role="tablist">
330
- ${e.map(r=>{const i=ro("relative px-3 py-1.5 rounded-[var(--ono-radius-md)] text-sm font-medium cursor-pointer text-[var(--ono-text-muted)] dark:text-[var(--ono-neutral)] transition-all duration-150 hover:text-[var(--ono-text)] hover:bg-[var(--ono-surface)] focus:outline-hidden focus:ring-2 ring-[var(--ono-red-orange)] inline-flex gap-2 items-center","active:bg-[var(--ono-surface)] active:text-[var(--ono-text)] active:shadow-[var(--ono-elevation-1)] active:ring-2",r.selected?"active":"","[:>svg]:size-4"),a=E(r.id),l=C(r.name);return`<button type="button" class="${i}" id="ono-tab-${a}" aria-selected="${r.selected?"true":"false"}" data-ono-tab="#ono-section-${a}" aria-controls="ono-section-${a}" role="tab" title="${l}">${t(r)}<span>${l}</span></button>`}).join("")}
330
+ ${e.map(r=>{const i=ro("relative px-3 py-1.5 rounded-[var(--ono-radius-md)] text-sm font-medium cursor-pointer text-[var(--ono-text-muted)] dark:text-[var(--ono-neutral)] transition-all duration-150 hover:text-[var(--ono-text)] hover:bg-[var(--ono-surface)] focus:outline-hidden focus:ring-2 ring-[var(--ono-red-orange)] inline-flex gap-2 items-center","active:bg-[var(--ono-surface)] active:text-[var(--ono-text)] active:shadow-[var(--ono-elevation-1)] active:ring-2",r.selected?"active":"","[:>svg]:size-4"),a=E(r.id),c=C(r.name);return`<button type="button" class="${i}" id="ono-tab-${a}" aria-selected="${r.selected?"true":"false"}" data-ono-tab="#ono-section-${a}" aria-controls="ono-section-${a}" role="tab" title="${c}">${t(r)}<span>${c}</span></button>`}).join("")}
331
331
  </nav>`,script:`
332
332
  // Tabs system initialization
333
333
  (function() {
@@ -433,7 +433,7 @@ ready(function () { bindShortcutsModal(); });
433
433
  }
434
434
  try { document.addEventListener('DOMContentLoaded', listener); } catch (_) {}
435
435
  }
436
- `,Et=(e,t)=>`<script${t?` nonce="${ee(t)}"`:""}>${e}<\/script>`,un=(e,t)=>`<style${t?` nonce="${ee(t)}"`:""}>${e}</style>`,gn=({content:e,cspNonce:t,css:o,description:r,error:n,scripts:s,theme:i,title:a})=>{const l=Lo(t),c=ee(a),p=ee(r),d=n.stack??n.toString(),u=d.includes(`
436
+ `,Et=(e,t)=>`<script${t?` nonce="${ee(t)}"`:""}>${e}<\/script>`,un=(e,t)=>`<style${t?` nonce="${ee(t)}"`:""}>${e}</style>`,gn=({content:e,cspNonce:t,css:o,description:r,error:n,scripts:s,theme:i,title:a})=>{const c=Lo(t),l=ee(a),p=ee(r),d=n.stack??n.toString(),u=d.includes(`
437
437
  `)?d.replaceAll(`
438
438
  `,`
439
439
  `):d,f=Le(u)??ee(u);return`<!--
@@ -443,12 +443,12 @@ ready(function () { bindShortcutsModal(); });
443
443
  <html lang="en" class="${i==="dark"?"dark":""}">
444
444
  <head>
445
445
  <meta charset="UTF-8">
446
- <title>${c}</title>
446
+ <title>${l}</title>
447
447
  <meta name="viewport" content="width=device-width, initial-scale=1">
448
448
  <meta name="description" content="${p}">
449
- ${un(o,l)}
450
- ${Et(hn.trim(),l)}
451
- ${s.filter(Boolean).map(w=>Et(w,l)).join(`
449
+ ${un(o,c)}
450
+ ${Et(hn.trim(),c)}
451
+ ${s.filter(Boolean).map(w=>Et(w,c)).join(`
452
452
  `)}
453
453
  </head>
454
454
  <body>
@@ -472,7 +472,7 @@ ready(function () { bindShortcutsModal(); });
472
472
  ${Te}
473
473
  </div>
474
474
  <div class="p-6">${D}</div>
475
- </div>`,tab:So}})),i=s.map(h=>h.tab),a=s.map(h=>h.sourceCode),l=vn(i),c=l.map((h,m)=>{if(Array.isArray(h)){const g=h[0];let b;switch(g.type){case"bun":{b="bun";break}case"internal":{b="internal";break}case"native":{b="native";break}case"node_modules":{b="node_modules";break}case"webpack":{b="webpack";break}default:b="application"}const $=`small-switch-${o}-${String(m)}`,x=`stack-trace-group-${o}-${String(m)}`;return`<div class="flex items-center gap-2">
475
+ </div>`,tab:So}})),i=s.map(h=>h.tab),a=s.map(h=>h.sourceCode),c=vn(i),l=c.map((h,m)=>{if(Array.isArray(h)){const g=h[0];let b;switch(g.type){case"bun":{b="bun";break}case"internal":{b="internal";break}case"native":{b="native";break}case"node_modules":{b="node_modules";break}case"webpack":{b="webpack";break}default:b="application"}const $=`small-switch-${o}-${String(m)}`,x=`stack-trace-group-${o}-${String(m)}`;return`<div class="flex items-center gap-2">
476
476
  <label for="${$}" class="relative text-sm text-[var(--ono-text)] flex gap-2 items-center">
477
477
  <div class="relative inline-flex h-5 w-9 cursor-pointer items-center">
478
478
  <input type="checkbox" id="${$}" data-group-toggle="${o}" data-target-id="${x}" class="peer sr-only">
@@ -481,15 +481,15 @@ ready(function () { bindShortcutsModal(); });
481
481
  </div>
482
482
  <span class="cursor-pointer" title="Toggle visibility of ${b} frames">${b}</span>
483
483
  </label>
484
- </div>`}return""}).join(""),p=c.trim().length>0,f=`<section class="container rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-2)] bg-[var(--ono-surface)]" aria-label="Stack trace viewer">
484
+ </div>`}return""}).join(""),p=l.trim().length>0,f=`<section class="container rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-2)] bg-[var(--ono-surface)]" aria-label="Stack trace viewer">
485
485
  <main id="stack-trace-viewer" class="flex flex-row">
486
486
  <div class="w-4/12 rounded-tl-lg rounded-bl-lg overflow-hidden">
487
487
  <div class="${p?"p-6":"p-0"}">
488
488
  ${p?'<span class="block text-xs mb-2 text-[var(--ono-text-muted)]">Show or Hide collapsed frames</span>':""}
489
- <div class="flex flex-row items-center gap-2">${c}</div>
489
+ <div class="flex flex-row items-center gap-2">${l}</div>
490
490
  </div>
491
491
  <nav class="flex flex-col" aria-label="Frames">
492
- ${l.map((h,m)=>{if(Array.isArray(h)){const g=h[0];let b;switch(g.type){case"bun":{b="bun";break}case"internal":{b="internal";break}case"native":{b="native";break}case"node_modules":{b="node_modules";break}case"webpack":{b="webpack";break}default:b="application"}return`<details id="stack-trace-group-${o}-${String(m)}">
492
+ ${c.map((h,m)=>{if(Array.isArray(h)){const g=h[0];let b;switch(g.type){case"bun":{b="bun";break}case"internal":{b="internal";break}case"native":{b="native";break}case"node_modules":{b="node_modules";break}case"webpack":{b="webpack";break}default:b="application"}return`<details id="stack-trace-group-${o}-${String(m)}">
493
493
  <summary class="py-3 px-6 cursor-pointer flex items-center justify-between text-sm hover:bg-[var(--ono-hover-overlay)] focus:outline-hidden focus:ring-1 focus:ring-gray-600 text-[var(--ono-text)]">
494
494
  <span class="flex items-center gap-2">
495
495
  <span class="uppercase tracking-wide text-[10px] text-[var(--ono-text-muted)]">${b}</span>
@@ -735,7 +735,7 @@ ready(function () { bindShortcutsModal(); });
735
735
  })();
736
736
  `;return{html:f,script:w}},Fe="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-info%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%2210%22%20%2F%3E%20%3Cpath%20d%3D%22M12%2016v-4%22%20%2F%3E%20%3Cpath%20d%3D%22M12%208h.01%22%20%2F%3E%20%3C%2Fsvg%3E",io=({message:e}={})=>e?`<span class="inline-flex justify-center items-center text-[var(--ono-text)] cursor-help" title="${C(e)}">
737
737
  <span class="dui" style="-webkit-mask-image: url('${Fe}'); mask-image: url('${Fe}')"></span>
738
- </span>`:"",kn=async(e,t={})=>{if(e.length===0)return{html:"",script:""};const o=[],r=[];for(const[s,i]of e.entries())if(i instanceof Error){const{html:a,script:l}=await so(i,{openInEditorUrl:t.openInEditorUrl});o.push(`<details aria-label="Cause ${String(s+1)}" class="relative rounded-[var(--ono-radius-lg)] mb-2 last:mb-0 group shadow-[var(--ono-elevation-1)] bg-[var(--ono-surface)]">
738
+ </span>`:"",kn=async(e,t={})=>{if(e.length===0)return{html:"",script:""};const o=[],r=[];for(const[s,i]of e.entries())if(i instanceof Error){const{html:a,script:c}=await so(i,{openInEditorUrl:t.openInEditorUrl});o.push(`<details aria-label="Cause ${String(s+1)}" class="relative rounded-[var(--ono-radius-lg)] mb-2 last:mb-0 group shadow-[var(--ono-elevation-1)] bg-[var(--ono-surface)]">
739
739
  <summary class="pl-5 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] transition-all inline-flex justify-between items-center gap-x-3 w-full font-semibold text-start py-4 px-5 disabled:opacity-50 disabled:pointer-events-none cursor-pointer text-[var(--ono-text)]">
740
740
  ${C(i.name)}: ${C(i.message)}
741
741
  <span class="dui ono-expand-icon-closed size-4" style="-webkit-mask-image:url('${Tt}'); mask-image:url('${Tt}')"></span>
@@ -744,7 +744,7 @@ ready(function () { bindShortcutsModal(); });
744
744
  <section class="w-full overflow-hidden transition-[height] duration-300 p-5 pt-0">
745
745
  ${a}
746
746
  </section>
747
- </details>`),r.push(l)}else typeof i=="string"?o.push(`<div class="container rounded-lg mt-2 py-4 px-5 shadow-xl bg-[var(--ono-white-smoke)] text-[var(--ono-text)]">${C(i)}</div>`):o.push(`<div class="container rounded-lg mt-2 py-4 px-5 shadow-xl bg-[var(--ono-white-smoke)] text-[var(--ono-text)]">${C(JSON.stringify(i))}</div>`);return{html:`<style>
747
+ </details>`),r.push(c)}else typeof i=="string"?o.push(`<div class="container rounded-lg mt-2 py-4 px-5 shadow-xl bg-[var(--ono-white-smoke)] text-[var(--ono-text)]">${C(i)}</div>`):o.push(`<div class="container rounded-lg mt-2 py-4 px-5 shadow-xl bg-[var(--ono-white-smoke)] text-[var(--ono-text)]">${C(JSON.stringify(i))}</div>`);return{html:`<style>
748
748
  /* Toggle plus/minus icons inside <details> */
749
749
  details summary .ono-expand-icon-open { display: none !important; }
750
750
  details[open] summary .ono-expand-icon-open { display: inline-block !important; }
@@ -759,12 +759,12 @@ ready(function () { bindShortcutsModal(); });
759
759
  <div class="mt-6">${o.join(`
760
760
  `)}</div>
761
761
  </section>`,script:r.join(`
762
- `)}},At="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-external-link%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M15%203h6v6%22%20%2F%3E%20%3Cpath%20d%3D%22M10%2014%2021%203%22%20%2F%3E%20%3Cpath%20d%3D%22M18%2013v6a2%202%200%200%201-2%202H5a2%202%200%200%201-2-2V8a2%202%200%200%201%202-2h6%22%20%2F%3E%20%3C%2Fsvg%3E",yn=/^#/,ao=({label:e="Copy",secondaryLabel:t="Copy fix prompt",secondaryText:o,successText:r="Copied!",targetId:n})=>{const s=C(t),i=E(o),a=E(n),l=E(e),c=C(e);return{html:`
762
+ `)}},At="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-external-link%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M15%203h6v6%22%20%2F%3E%20%3Cpath%20d%3D%22M10%2014%2021%203%22%20%2F%3E%20%3Cpath%20d%3D%22M18%2013v6a2%202%200%200%201-2%202H5a2%202%200%200%201-2-2V8a2%202%200%200%201%202-2h6%22%20%2F%3E%20%3C%2Fsvg%3E",yn=/^#/,ao=({label:e="Copy",secondaryLabel:t="Copy fix prompt",secondaryText:o,successText:r="Copied!",targetId:n})=>{const s=C(t),i=E(o),a=E(n),c=E(e),l=C(e);return{html:`
763
763
  <div class="ono-dropdown relative inline-block">
764
764
  <button
765
765
  type="button"
766
- aria-label="${l}"
767
- title="${l}"
766
+ aria-label="${c}"
767
+ title="${c}"
768
768
  aria-haspopup="menu"
769
769
  aria-expanded="false"
770
770
  aria-controls="${E(`ono-copy-menu-${n.replace(yn,"")}`)}"
@@ -772,7 +772,7 @@ ready(function () { bindShortcutsModal(); });
772
772
  >
773
773
  <span class="ono-copy-default dui size-4 transition" style="-webkit-mask-image: url('${et}'); mask-image: url('${et}')"></span>
774
774
  <span class="ono-copy-success dui hidden size-4 text-[var(--ono-red-orange)]" style="-webkit-mask-image: url('${tt}'); mask-image: url('${tt}')"></span>
775
- <span class="sr-only">${c}</span>
775
+ <span class="sr-only">${l}</span>
776
776
  <span class="dui size-4 transition-transform duration-200 [&.ono-dropdown-open]:rotate-180" style="-webkit-mask-image:url('${xe}'); mask-image:url('${xe}')"></span>
777
777
  </button>
778
778
 
@@ -784,7 +784,7 @@ ready(function () { bindShortcutsModal(); });
784
784
  data-target="#${a}"
785
785
  data-success-text="${E(r)}"
786
786
  >
787
- ${c}
787
+ ${l}
788
788
  </button>
789
789
  <button
790
790
  type="button"
@@ -797,38 +797,38 @@ ready(function () { bindShortcutsModal(); });
797
797
  </button>
798
798
  </div>
799
799
  </div>
800
- `}},Re="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-x%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M18%206%206%2018%22%20%2F%3E%20%3Cpath%20d%3D%22m6%206%2012%2012%22%20%2F%3E%20%3C%2Fsvg%3E";function qe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var W=qe();function lo(e){W=e}var O={exec:()=>null};function U(e){let t=[];return o=>{let r=Math.max(0,Math.min(3,o-1)),n=t[r];return n||(n=e(r),t[r]=n),n}}function v(e,t=""){let o=typeof e=="string"?e:e.source,r={replace:(n,s)=>{let i=typeof s=="string"?s:s.source;return i=i.replace(T.caret,"$1"),o=o.replace(n,i),r},getRegex:()=>new RegExp(o,t)};return r}var $n=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),T={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:U(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:U(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:U(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:U(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:U(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:U(e=>new RegExp(`^ {0,${e}}>`))},Sn=/^(?:[ \t]*(?:\n|$))+/,En=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Cn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ce=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Tn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ue=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,co=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,po=v(co).replace(/bull/g,Ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),An=v(co).replace(/bull/g,Ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ve=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Dn=/^[^\n]+/,Ze=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Bn=v(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ze).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),In=v(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ue).getRegex(),Ce="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ge=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Rn=v("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ge).replace("tag",Ce).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ho=e=>v(Ve).replace("hr",ce).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ce).getRegex(),Ln=ho(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),_n=ho(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),zn=v(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",_n).getRegex(),Ke={blockquote:zn,code:En,def:Bn,fences:Cn,heading:Tn,hr:ce,html:Rn,lheading:po,list:In,newline:Sn,paragraph:Ln,table:O,text:Dn},Dt=v("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ce).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ce).getRegex(),Mn={...Ke,lheading:An,table:Dt,paragraph:v(Ve).replace("hr",ce).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Dt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ce).getRegex()},Fn={...Ke,html:v(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ge).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:O,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:v(Ve).replace("hr",ce).replace("heading",` *#{1,6} *[^
801
- ]`).replace("lheading",po).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},jn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Nn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,uo=/^( {2,}|\\)\n(?!\s*$)/,On=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,z=/[\p{P}\p{S}]/u,G=/[\s\p{P}\p{S}]/u,de=/[^\s\p{P}\p{S}]/u,Pn=v(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,G).getRegex(),Hn=/[\p{Pi}\p{Ps}"']/u,go=/(?!~)[\p{P}\p{S}]/u,Wn=/(?!~)[\s\p{P}\p{S}]/u,qn=/(?:[^\s\p{P}\p{S}]|~)/u,Un=v(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",$n?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),mo=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Vn=v(mo,"u").replace(/punct/g,z).getRegex(),Zn=v(mo,"u").replace(/punct/g,go).getRegex(),Gn=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Kn=v(Gn,"u").replace(/openQuote/g,Hn).replace(/punct/g,z).getRegex(),fo="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Qn=v(fo,"gu").replace(/notPunctSpace/g,de).replace(/punctSpace/g,G).replace(/punct/g,z).getRegex(),Xn=v(fo,"gu").replace(/notPunctSpace/g,qn).replace(/punctSpace/g,Wn).replace(/punct/g,go).getRegex(),Jn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Yn=v(Jn,"gu").replace(/notPunctSpace/g,de).replace(/punctSpace/g,G).replace(/punct/g,z).getRegex(),es=v("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,de).replace(/punctSpace/g,G).replace(/punct/g,z).getRegex(),ts="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",os=v(ts,"gu").replace(/notPunctSpace/g,de).replace(/punctSpace/g,G).replace(/punct/g,z).getRegex(),rs=v(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,z).getRegex(),ns="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ss=v(ns,"gu").replace(/notPunctSpace/g,de).replace(/punctSpace/g,G).replace(/punct/g,z).getRegex(),is=v(/\\(punct)/,"gu").replace(/punct/g,z).getRegex(),as=v(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ls=v(Ge).replace("(?:-->|$)","-->").getRegex(),cs=v("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ls).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ke=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ds=v(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ke).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),wo=v(/^!?\[(label)\]\[(ref)\]/).replace("label",ke).replace("ref",Ze).getRegex(),bo=v(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ze).getRegex(),ps=v("reflink|nolink(?!\\()","g").replace("reflink",wo).replace("nolink",bo).getRegex(),Bt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Qe={_backpedal:O,anyPunctuation:is,autolink:as,blockSkip:Un,br:uo,code:Nn,del:O,delLDelim:O,delRDelim:O,emStrongLDelim:Vn,emStrongRDelimAst:Qn,emStrongRDelimUnd:es,escape:jn,link:ds,nolink:bo,punctuation:Pn,reflink:wo,reflinkSearch:ps,tag:cs,text:On,url:O},hs={...Qe,emStrongLDelim:Kn,emStrongRDelimAst:Yn,emStrongRDelimUnd:os,link:v(/^!?\[(label)\]\((.*?)\)/).replace("label",ke).getRegex(),reflink:v(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ke).getRegex()},je={...Qe,emStrongRDelimAst:Xn,emStrongLDelim:Zn,delLDelim:rs,delRDelim:ss,url:v(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Bt).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:v(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Bt).getRegex()},us={...je,br:v(uo).replace("{2,}","*").getRegex(),text:v(je.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},fe={normal:Ke,gfm:Mn,pedantic:Fn},J={normal:Qe,gfm:je,breaks:us,pedantic:hs},gs={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},It=e=>gs[e];function R(e,t){if(t){if(T.escapeTest.test(e))return e.replace(T.escapeReplace,It)}else if(T.escapeTestNoEncode.test(e))return e.replace(T.escapeReplaceNoEncode,It);return e}function Rt(e){try{e=encodeURI(e).replace(T.percentDecode,"%")}catch{return null}return e}function Lt(e,t){let o=e.replace(T.findPipe,(s,i,a)=>{let l=!1,c=i;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=o.split(T.splitPipe),n=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(T.slashPipe,"|");return r}function F(e,t,o){let r=e.length;if(r===0)return"";let n=0;for(;n<r&&e.charAt(r-n-1)===t;)n++;return e.slice(0,r-n)}function _t(e){let t=e.split(`
800
+ `}},Re="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-x%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M18%206%206%2018%22%20%2F%3E%20%3Cpath%20d%3D%22m6%206%2012%2012%22%20%2F%3E%20%3C%2Fsvg%3E";function qe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var W=qe();function lo(e){W=e}var O={exec:()=>null};function U(e){let t=[];return o=>{let r=Math.max(0,Math.min(3,o-1)),n=t[r];return n||(n=e(r),t[r]=n),n}}function v(e,t=""){let o=typeof e=="string"?e:e.source,r={replace:(n,s)=>{let i=typeof s=="string"?s:s.source;return i=i.replace(T.caret,"$1"),o=o.replace(n,i),r},getRegex:()=>new RegExp(o,t)};return r}var $n=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),T={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:U(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:U(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:U(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:U(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:U(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:U(e=>new RegExp(`^ {0,${e}}>`))},Sn=/^(?:[ \t]*(?:\n|$))+/,En=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Cn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ce=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Tn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ue=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,co=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,po=v(co).replace(/bull/g,Ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),An=v(co).replace(/bull/g,Ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ve=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Dn=/^[^\n]+/,Ze=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Bn=v(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ze).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),In=v(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ue).getRegex(),Ce="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ge=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Rn=v("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ge).replace("tag",Ce).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ho=e=>v(Ve).replace("hr",ce).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ce).getRegex(),Ln=ho(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),_n=ho(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),zn=v(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",_n).getRegex(),Ke={blockquote:zn,code:En,def:Bn,fences:Cn,heading:Tn,hr:ce,html:Rn,lheading:po,list:In,newline:Sn,paragraph:Ln,table:O,text:Dn},Dt=v("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ce).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ce).getRegex(),Mn={...Ke,lheading:An,table:Dt,paragraph:v(Ve).replace("hr",ce).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Dt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ce).getRegex()},Fn={...Ke,html:v(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ge).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:O,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:v(Ve).replace("hr",ce).replace("heading",` *#{1,6} *[^
801
+ ]`).replace("lheading",po).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},jn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Nn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,uo=/^( {2,}|\\)\n(?!\s*$)/,On=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,z=/[\p{P}\p{S}]/u,G=/[\s\p{P}\p{S}]/u,de=/[^\s\p{P}\p{S}]/u,Pn=v(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,G).getRegex(),Hn=/[\p{Pi}\p{Ps}"']/u,go=/(?!~)[\p{P}\p{S}]/u,Wn=/(?!~)[\s\p{P}\p{S}]/u,qn=/(?:[^\s\p{P}\p{S}]|~)/u,Un=v(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",$n?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),mo=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Vn=v(mo,"u").replace(/punct/g,z).getRegex(),Zn=v(mo,"u").replace(/punct/g,go).getRegex(),Gn=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Kn=v(Gn,"u").replace(/openQuote/g,Hn).replace(/punct/g,z).getRegex(),fo="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Qn=v(fo,"gu").replace(/notPunctSpace/g,de).replace(/punctSpace/g,G).replace(/punct/g,z).getRegex(),Xn=v(fo,"gu").replace(/notPunctSpace/g,qn).replace(/punctSpace/g,Wn).replace(/punct/g,go).getRegex(),Jn="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Yn=v(Jn,"gu").replace(/notPunctSpace/g,de).replace(/punctSpace/g,G).replace(/punct/g,z).getRegex(),es=v("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,de).replace(/punctSpace/g,G).replace(/punct/g,z).getRegex(),ts="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",os=v(ts,"gu").replace(/notPunctSpace/g,de).replace(/punctSpace/g,G).replace(/punct/g,z).getRegex(),rs=v(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,z).getRegex(),ns="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ss=v(ns,"gu").replace(/notPunctSpace/g,de).replace(/punctSpace/g,G).replace(/punct/g,z).getRegex(),is=v(/\\(punct)/,"gu").replace(/punct/g,z).getRegex(),as=v(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ls=v(Ge).replace("(?:-->|$)","-->").getRegex(),cs=v("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ls).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ke=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ds=v(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ke).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),wo=v(/^!?\[(label)\]\[(ref)\]/).replace("label",ke).replace("ref",Ze).getRegex(),bo=v(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ze).getRegex(),ps=v("reflink|nolink(?!\\()","g").replace("reflink",wo).replace("nolink",bo).getRegex(),Bt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Qe={_backpedal:O,anyPunctuation:is,autolink:as,blockSkip:Un,br:uo,code:Nn,del:O,delLDelim:O,delRDelim:O,emStrongLDelim:Vn,emStrongRDelimAst:Qn,emStrongRDelimUnd:es,escape:jn,link:ds,nolink:bo,punctuation:Pn,reflink:wo,reflinkSearch:ps,tag:cs,text:On,url:O},hs={...Qe,emStrongLDelim:Kn,emStrongRDelimAst:Yn,emStrongRDelimUnd:os,link:v(/^!?\[(label)\]\((.*?)\)/).replace("label",ke).getRegex(),reflink:v(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ke).getRegex()},je={...Qe,emStrongRDelimAst:Xn,emStrongLDelim:Zn,delLDelim:rs,delRDelim:ss,url:v(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Bt).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:v(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Bt).getRegex()},us={...je,br:v(uo).replace("{2,}","*").getRegex(),text:v(je.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},fe={normal:Ke,gfm:Mn,pedantic:Fn},J={normal:Qe,gfm:je,breaks:us,pedantic:hs},gs={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},It=e=>gs[e];function R(e,t){if(t){if(T.escapeTest.test(e))return e.replace(T.escapeReplace,It)}else if(T.escapeTestNoEncode.test(e))return e.replace(T.escapeReplaceNoEncode,It);return e}function Rt(e){try{e=encodeURI(e).replace(T.percentDecode,"%")}catch{return null}return e}function Lt(e,t){let o=e.replace(T.findPipe,(s,i,a)=>{let c=!1,l=i;for(;--l>=0&&a[l]==="\\";)c=!c;return c?"|":" |"}),r=o.split(T.splitPipe),n=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(T.slashPipe,"|");return r}function F(e,t,o){let r=e.length;if(r===0)return"";let n=0;for(;n<r&&e.charAt(r-n-1)===t;)n++;return e.slice(0,r-n)}function _t(e){let t=e.split(`
802
802
  `),o=t.length-1;for(;o>=0&&T.blankLine.test(t[o]);)o--;return t.length-o<=2?e:t.slice(0,o+1).join(`
803
- `)}function ms(e,t){if(e.indexOf(t[1])===-1)return-1;let o=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])o++;else if(e[r]===t[1]&&(o--,o<0))return r;return o>0?-2:-1}function fs(e,t=0){let o=t,r="";for(let n of e)if(n===" "){let s=4-o%4;r+=" ".repeat(s),o+=s}else r+=n,o++;return r}function zt(e,t,o,r,n){let s=t.href,i=t.title||null,a=e[1].replace(n.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:o,href:s,title:i,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function ws(e,t,o){let r=e.match(o.other.indentCodeCompensation);if(r===null)return t;let n=r[1];return t.split(`
803
+ `)}function ms(e,t){if(e.indexOf(t[1])===-1)return-1;let o=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])o++;else if(e[r]===t[1]&&(o--,o<0))return r;return o>0?-2:-1}function fs(e,t=0){let o=t,r="";for(let n of e)if(n===" "){let s=4-o%4;r+=" ".repeat(s),o+=s}else r+=n,o++;return r}function zt(e,t,o,r,n){let s=t.href,i=t.title||null,a=e[1].replace(n.other.outputLinkReplace,"$1"),c=e[0].charAt(0)==="!";r.state.inLink=!0;let l=r.state.linkEmitted,p=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(a),u=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(u){r.state.inRawBlock=p;return}r.state.linkEmitted=!0}return{type:c?"image":"link",raw:o,href:s,title:i,text:a,tokens:d}}function ws(e,t,o){let r=e.match(o.other.indentCodeCompensation);if(r===null)return t;let n=r[1];return t.split(`
804
804
  `).map(s=>{let i=s.match(o.other.beginningSpace);if(i===null)return s;let[a]=i;return a.length>=n.length?s.slice(n.length):s}).join(`
805
805
  `)}var ye=class{options;rules;lexer;constructor(e){this.options=e||W}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let o=this.options.pedantic?t[0]:_t(t[0]),r=o.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:o,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let o=t[0],r=ws(o,t[3]||"",this.rules);return{type:"code",raw:o,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let o=t[2].trim();if(this.rules.other.endingHash.test(o)){let r=F(o,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(o=r.trim())}return{type:"heading",raw:F(t[0],`
806
806
  `),depth:t[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:F(t[0],`
807
807
  `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let o=F(t[0],`
808
808
  `).split(`
809
- `),r="",n="",s=[];for(;o.length>0;){let i=!1,a=[],l;for(l=0;l<o.length;l++)if(this.rules.other.blockquoteStart.test(o[l]))a.push(o[l]),i=!0;else if(!i)a.push(o[l]);else break;o=o.slice(l);let c=a.join(`
810
- `),p=c.replace(this.rules.other.blockquoteSetextReplace,`
809
+ `),r="",n="",s=[];for(;o.length>0;){let i=!1,a=[],c;for(c=0;c<o.length;c++)if(this.rules.other.blockquoteStart.test(o[c]))a.push(o[c]),i=!0;else if(!i)a.push(o[c]);else break;o=o.slice(c);let l=a.join(`
810
+ `),p=l.replace(this.rules.other.blockquoteSetextReplace,`
811
811
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
812
- ${c}`:c,n=n?`${n}
812
+ ${l}`:l,n=n?`${n}
813
813
  ${p}`:p;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,s,!0),this.lexer.state.top=d,o.length===0)break;let u=s.at(-1);if(u?.type==="code")break;if(u?.type==="blockquote"){let f=u,w=o.join(`
814
814
  `),h=f.raw+`
815
815
  `+w.replace(this.rules.other.blockquoteSetextReplace2,""),m=this.blockquote(h);s[s.length-1]=m,r=`${r}
816
816
  ${w}`,n=n.substring(0,n.length-f.text.length)+m.text;break}else if(u?.type==="list"){let f=u,w=f.raw+`
817
817
  `+o.join(`
818
818
  `),h=this.list(w);s[s.length-1]=h,r=r.substring(0,r.length-u.raw.length)+h.raw,n=n.substring(0,n.length-f.raw.length)+h.raw,o=w.substring(s.at(-1).raw.length).split(`
819
- `);continue}}return{type:"blockquote",raw:r,tokens:s,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let o=t[1].trim(),r=o.length>1,n={type:"list",raw:"",ordered:r,start:r?+o.slice(0,-1):"",loose:!1,items:[]};o=r?`\\d{1,9}\\${o.slice(-1)}`:`\\${o}`,this.options.pedantic&&(o=r?o:"[*+-]");let s=this.rules.other.listItemRegex(o),i=!1;for(;e;){let l=!1,c="",p="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let d=fs(t[2].split(`
819
+ `);continue}}return{type:"blockquote",raw:r,tokens:s,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let o=t[1].trim(),r=o.length>1,n={type:"list",raw:"",ordered:r,start:r?+o.slice(0,-1):"",loose:!1,items:[]};o=r?`\\d{1,9}\\${o.slice(-1)}`:`\\${o}`,this.options.pedantic&&(o=r?o:"[*+-]");let s=this.rules.other.listItemRegex(o),i=!1;for(;e;){let c=!1,l="",p="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;l=t[0],e=e.substring(l.length);let d=fs(t[2].split(`
820
820
  `,1)[0],t[1].length),u=e.split(`
821
- `,1)[0],f=!d.trim(),w=0;if(this.options.pedantic?(w=2,p=d.trimStart()):f?w=t[1].length+1:(w=d.search(this.rules.other.nonSpaceChar),w=w>4?1:w,p=d.slice(w),w+=t[1].length),f&&this.rules.other.blankLine.test(u)&&(c+=u+`
822
- `,e=e.substring(u.length+1),l=!0),!l){let h=this.rules.other.nextBulletRegex(w),m=this.rules.other.hrRegex(w),g=this.rules.other.fencesBeginRegex(w),b=this.rules.other.headingBeginRegex(w),$=this.rules.other.htmlBeginRegex(w),x=this.rules.other.blockquoteBeginRegex(w);for(;e;){let S=e.split(`
821
+ `,1)[0],f=!d.trim(),w=0;if(this.options.pedantic?(w=2,p=d.trimStart()):f?w=t[1].length+1:(w=d.search(this.rules.other.nonSpaceChar),w=w>4?1:w,p=d.slice(w),w+=t[1].length),f&&this.rules.other.blankLine.test(u)&&(l+=u+`
822
+ `,e=e.substring(u.length+1),c=!0),!c){let h=this.rules.other.nextBulletRegex(w),m=this.rules.other.hrRegex(w),g=this.rules.other.fencesBeginRegex(w),b=this.rules.other.headingBeginRegex(w),$=this.rules.other.htmlBeginRegex(w),x=this.rules.other.blockquoteBeginRegex(w);for(;e;){let S=e.split(`
823
823
  `,1)[0],D;if(u=S,this.options.pedantic?(u=u.replace(this.rules.other.listReplaceNesting," "),D=u):D=u.replace(this.rules.other.tabCharGlobal," "),g.test(u)||b.test(u)||$.test(u)||x.test(u)||h.test(u)||m.test(u))break;if(D.search(this.rules.other.nonSpaceChar)>=w||!u.trim())p+=`
824
824
  `+D.slice(w);else{if(f||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||g.test(d)||b.test(d)||m.test(d))break;p+=`
825
- `+u}f=!u.trim(),c+=S+`
826
- `,e=e.substring(S.length+1),d=D.slice(w)}}n.loose||(i?n.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(i=!0)),n.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),n.raw+=c}let a=n.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let l of n.items){this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]);let c=l.tokens[0];if(l.task&&(c?.type==="text"||c?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(l.raw);if(p){let d={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};l.checked=d.checked,n.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=d.raw+l.tokens[0].raw,l.tokens[0].text=d.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(d)):l.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):l.tokens.unshift(d)}}else l.task&&(l.task=!1);if(!n.loose){let p=l.tokens.filter(u=>u.type==="space"),d=p.length>0&&p.some(u=>this.rules.other.anyLine.test(u.raw));n.loose=d}}if(n.loose)for(let l of n.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return n}}html(e){let t=this.rules.block.html.exec(e);if(t){let o=_t(t[0]);return{type:"html",block:!0,raw:o,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:o}}}def(e){let t=this.rules.block.def.exec(e);if(t){let o=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:o,raw:F(t[0],`
825
+ `+u}f=!u.trim(),l+=S+`
826
+ `,e=e.substring(S.length+1),d=D.slice(w)}}n.loose||(i?n.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(i=!0)),n.items.push({type:"list_item",raw:l,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),n.raw+=l}let a=n.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let c of n.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!n.loose){let l=c.tokens.filter(d=>d.type==="space"),p=l.length>0&&l.some(d=>this.rules.other.anyLine.test(d.raw));n.loose=p}for(let c of n.items){let l=c.tokens[0];if(c.task&&(l?.type==="text"||l?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),l.raw=l.raw.replace(this.rules.other.listReplaceTask,""),l.text=l.text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(c.raw);if(p){let d={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=d.checked,n.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=d.raw+c.tokens[0].raw,c.tokens[0].text=d.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(d)):c.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):c.tokens.unshift(d)}}else c.task&&(c.task=!1)}if(n.loose)for(let c of n.items){c.loose=!0;for(let l of c.tokens)l.type==="text"&&(l.type="paragraph")}return n}}html(e){let t=this.rules.block.html.exec(e);if(t){let o=_t(t[0]);return{type:"html",block:!0,raw:o,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:o}}}def(e){let t=this.rules.block.def.exec(e);if(t){let o=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:o,raw:F(t[0],`
827
827
  `),href:r,title:n}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let o=Lt(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
828
828
  `):[],s={type:"table",raw:F(t[0],`
829
- `),header:[],align:[],rows:[]};if(o.length===r.length){for(let i of r)this.rules.other.tableAlignRight.test(i)?s.align.push("right"):this.rules.other.tableAlignCenter.test(i)?s.align.push("center"):this.rules.other.tableAlignLeft.test(i)?s.align.push("left"):s.align.push(null);for(let i=0;i<o.length;i++)s.header.push({text:o[i],tokens:this.lexer.inline(o[i]),header:!0,align:s.align[i]});for(let i of n)s.rows.push(Lt(i,s.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[l]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let o=t[1].trim();return{type:"heading",raw:F(t[0],`
829
+ `),header:[],align:[],rows:[]};if(o.length===r.length){for(let i of r)this.rules.other.tableAlignRight.test(i)?s.align.push("right"):this.rules.other.tableAlignCenter.test(i)?s.align.push("center"):this.rules.other.tableAlignLeft.test(i)?s.align.push("left"):s.align.push(null);for(let i=0;i<o.length;i++)s.header.push({text:o[i],tokens:this.lexer.inline(o[i]),header:!0,align:s.align[i]});for(let i of n)s.rows.push(Lt(i,s.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[c]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let o=t[1].trim();return{type:"heading",raw:F(t[0],`
830
830
  `),depth:t[2].charAt(0)==="="?1:2,text:o,tokens:this.lexer.inline(o)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let o=t[1].charAt(t[1].length-1)===`
831
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:o,tokens:this.lexer.inline(o)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let o=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(o)){if(!this.rules.other.endAngleBracket.test(o))return;let s=F(o.slice(0,-1),"\\");if((o.length-s.length)%2===0)return}else{let s=ms(t[2],"()");if(s===-2)return;if(s>-1){let i=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,i).trim(),t[3]=""}}let r=t[2],n="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],n=s[3])}else n=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(o)?r=r.slice(1):r=r.slice(1,-1)),zt(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let o;if((o=this.rules.inline.reflink.exec(e))||(o=this.rules.inline.nolink.exec(e))){let r=(o[2]||o[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[r.toLowerCase()];if(!n){let s=o[0].charAt(0);return{type:"text",raw:s,text:s}}return zt(o,n,o[0],this.lexer,this.rules)}}emStrong(e,t,o=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&o.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!o||this.rules.inline.punctuation.exec(o))){let n=[...r[0]].length-1,s,i,a=n,l=0,c=r[0][0],p=o===c,d=c==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+n);(r=d.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(i=[...s].length,r[3]||r[4]){a+=i;continue}else if(r[5]||r[6]){if(n%3&&!((n+i)%3)){l+=i;continue}if(p)break}if(a-=i,a>0)continue;i=Math.min(i,i+a+l);let u=[...r[0]][0].length,f=e.slice(0,n+r.index+u+i);if(Math.min(n,i)%2){let h=f.slice(1,-1);return{type:"em",raw:f,text:h,tokens:this.lexer.inlineTokens(h)}}let w=f.slice(2,-2);return{type:"strong",raw:f,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let o=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(o),n=this.rules.other.startingSpaceChar.test(o)&&this.rules.other.endingSpaceChar.test(o);return r&&n&&(o=o.substring(1,o.length-1)),{type:"codespan",raw:t[0],text:o}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,o=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!o||this.rules.inline.punctuation.exec(o))){let n=[...r[0]].length-1,s,i,a=n,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+n);(r=l.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(i=[...s].length,i!==n))continue;if(r[3]||r[4]){a+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a);let c=[...r[0]][0].length,p=e.slice(0,n+r.index+c+i),d=p.slice(n,-n);return{type:"del",raw:p,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let o,r;return t[2]==="@"?(o=t[1],r="mailto:"+o):(o=t[1],r=o),{type:"link",raw:t[0],text:o,href:r,tokens:[{type:"text",raw:o,text:o}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let o,r;if(t[2]==="@")o=t[0],r="mailto:"+o;else{let n;do n=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(n!==t[0]);o=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0]}return{type:"link",raw:t[0],text:o,href:r,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let o=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:o}}}},B=class Ne{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||W,this.options.tokenizer=this.options.tokenizer||new ye,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let o={other:T,block:fe.normal,inline:J.normal};this.options.pedantic?(o.block=fe.pedantic,o.inline=J.pedantic):this.options.gfm&&(o.block=fe.gfm,this.options.breaks?o.inline=J.breaks:o.inline=J.gfm),this.tokenizer.rules=o}static get rules(){return{block:fe,inline:J}}static lex(t,o){return new Ne(o).lex(t)}static lexInline(t,o){return new Ne(o).inlineTokens(t)}lex(t){t=t.replace(T.carriageReturn,`
831
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:o,tokens:this.lexer.inline(o)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let o=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(o)){if(!this.rules.other.endAngleBracket.test(o))return;let s=F(o.slice(0,-1),"\\");if((o.length-s.length)%2===0)return}else{let s=ms(t[2],"()");if(s===-2)return;if(s>-1){let i=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,i).trim(),t[3]=""}}let r=t[2],n="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],n=s[3])}else n=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(o)?r=r.slice(1):r=r.slice(1,-1)),zt(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let o;if((o=this.rules.inline.reflink.exec(e))||(o=this.rules.inline.nolink.exec(e))){let r=(o[2]||o[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[r.toLowerCase()];if(!n){let s=o[0].charAt(0);return{type:"text",raw:s,text:s}}return zt(o,n,o[0],this.lexer,this.rules)}}emStrong(e,t,o=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&o.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!o||this.rules.inline.punctuation.exec(o))){let n=[...r[0]].length-1,s,i,a=n,c=0,l=r[0][0],p=o===l,d=l==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+n);(r=d.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(i=[...s].length,r[3]||r[4]){a+=i;continue}else if(r[5]||r[6]){if(n%3&&!((n+i)%3)){c+=i;continue}if(p)break}if(a-=i,a>0)continue;i=Math.min(i,i+a+c);let u=[...r[0]][0].length,f=e.slice(0,n+r.index+u+i);if(Math.min(n,i)%2){let h=f.slice(1,-1);return{type:"em",raw:f,text:h,tokens:this.lexer.inlineTokens(h)}}let w=f.slice(2,-2);return{type:"strong",raw:f,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let o=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(o),n=this.rules.other.startingSpaceChar.test(o)&&this.rules.other.endingSpaceChar.test(o);return r&&n&&(o=o.substring(1,o.length-1)),{type:"codespan",raw:t[0],text:o}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,o=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!o||this.rules.inline.punctuation.exec(o))){let n=[...r[0]].length-1,s,i,a=n,c=this.rules.inline.delRDelim;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(i=[...s].length,i!==n))continue;if(r[3]||r[4]){a+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a);let l=[...r[0]][0].length,p=e.slice(0,n+r.index+l+i),d=p.slice(n,-n);return{type:"del",raw:p,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let o,r;return t[2]==="@"?(o=t[1],r="mailto:"+o):(o=t[1],r=o),{type:"link",raw:t[0],text:o,href:r,tokens:[{type:"text",raw:o,text:o}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let o,r;if(t[2]==="@")o=t[0],r="mailto:"+o;else{let n;do n=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(n!==t[0]);o=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0]}return{type:"link",raw:t[0],text:o,href:r,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let o=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:o}}}},B=class Ne{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||W,this.options.tokenizer=this.options.tokenizer||new ye,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let o={other:T,block:fe.normal,inline:J.normal};this.options.pedantic?(o.block=fe.pedantic,o.inline=J.pedantic):this.options.gfm&&(o.block=fe.gfm,this.options.breaks?o.inline=J.breaks:o.inline=J.gfm),this.tokenizer.rules=o}static get rules(){return{block:fe,inline:J}}static lex(t,o){return new Ne(o).lex(t)}static lexInline(t,o){return new Ne(o).inlineTokens(t)}lex(t){t=t.replace(T.carriageReturn,`
832
832
  `),this.blockTokens(t,this.tokens);for(let o=0;o<this.inlineQueue.length;o++){let r=this.inlineQueue[o];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,o=[],r=!1){this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(T.tabCharGlobal," ").replace(T.spaceLine,""));let n=1/0;for(;t;){if(t.length<n)n=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let s;if(this.options.extensions?.block?.some(a=>(s=a.call({lexer:this},t,o))?(t=t.substring(s.raw.length),o.push(s),!0):!1))continue;if(s=this.tokenizer.space(t)){t=t.substring(s.raw.length);let a=o.at(-1);s.raw.length===1&&a!==void 0?a.raw+=`
833
833
  `:o.push(s);continue}if(s=this.tokenizer.code(t)){t=t.substring(s.raw.length);let a=o.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
834
834
  `)?"":`
@@ -836,13 +836,13 @@ ${w}`,n=n.substring(0,n.length-f.text.length)+m.text;break}else if(u?.type==="li
836
836
  `+s.text,this.inlineQueue.at(-1).src=a.text):o.push(s);continue}if(s=this.tokenizer.fences(t)){t=t.substring(s.raw.length),o.push(s);continue}if(s=this.tokenizer.heading(t)){t=t.substring(s.raw.length),o.push(s);continue}if(s=this.tokenizer.hr(t)){t=t.substring(s.raw.length),o.push(s);continue}if(s=this.tokenizer.blockquote(t)){t=t.substring(s.raw.length),o.push(s);continue}if(s=this.tokenizer.list(t)){t=t.substring(s.raw.length),o.push(s);continue}if(s=this.tokenizer.html(t)){t=t.substring(s.raw.length),o.push(s);continue}if(s=this.tokenizer.def(t)){t=t.substring(s.raw.length);let a=o.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
837
837
  `)?"":`
838
838
  `)+s.raw,a.text+=`
839
- `+s.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},o.push(s));continue}if(s=this.tokenizer.table(t)){t=t.substring(s.raw.length),o.push(s);continue}if(s=this.tokenizer.lheading(t)){t=t.substring(s.raw.length),o.push(s);continue}let i=t;if(this.options.extensions?.startBlock){let a=1/0,l=t.slice(1),c;this.options.extensions.startBlock.forEach(p=>{c=p.call({lexer:this},l),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),a<1/0&&a>=0&&(i=t.substring(0,a+1))}if(this.state.top&&(s=this.tokenizer.paragraph(i))){let a=o.at(-1);r&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
839
+ `+s.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},o.push(s));continue}if(s=this.tokenizer.table(t)){t=t.substring(s.raw.length),o.push(s);continue}if(s=this.tokenizer.lheading(t)){t=t.substring(s.raw.length),o.push(s);continue}let i=t;if(this.options.extensions?.startBlock){let a=1/0,c=t.slice(1),l;this.options.extensions.startBlock.forEach(p=>{l=p.call({lexer:this},c),typeof l=="number"&&l>=0&&(a=Math.min(a,l))}),a<1/0&&a>=0&&(i=t.substring(0,a+1))}if(this.state.top&&(s=this.tokenizer.paragraph(i))){let a=o.at(-1);r&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
840
840
  `)?"":`
841
841
  `)+s.raw,a.text+=`
842
842
  `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):o.push(s),r=i.length!==t.length,t=t.substring(s.raw.length);continue}if(s=this.tokenizer.text(t)){t=t.substring(s.raw.length);let a=o.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
843
843
  `)?"":`
844
844
  `)+s.raw,a.text+=`
845
- `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):o.push(s);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,o}inline(t,o=[]){return this.inlineQueue.push({src:t,tokens:o}),o}inlineTokens(t,o=[]){this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let a=Object.keys(this.tokens.links);a.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,l=>a.includes(l.slice(l.lastIndexOf("[")+1,-1))?"["+"a".repeat(l.length-2)+"]":l))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(a,l,c)=>{let p=c?c.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let n=!1,s="",i=1/0;for(;t;){if(t.length<i)i=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}n||(s=""),n=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},t,o))?(t=t.substring(a.raw.length),o.push(a),!0):!1))continue;if(a=this.tokenizer.escape(t)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.tag(t)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.link(t)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(a.raw.length);let c=o.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):o.push(a);continue}if(a=this.tokenizer.emStrong(t,r,s)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.codespan(t)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.br(t)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.del(t,r,s)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.autolink(t)){t=t.substring(a.raw.length),o.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(t))){t=t.substring(a.raw.length),o.push(a);continue}let l=t;if(this.options.extensions?.startInline){let c=1/0,p=t.slice(1),d;this.options.extensions.startInline.forEach(u=>{d=u.call({lexer:this},p),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(l=t.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){t=t.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(s=a.raw.slice(-1)),n=!0;let c=o.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):o.push(a);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return o}infiniteLoopError(t){let o="Infinite loop on byte: "+t;if(this.options.silent)console.error(o);else throw new Error(o)}},$e=class{options;parser;constructor(e){this.options=e||W}space(e){return""}code({text:e,lang:t,escaped:o}){let r=(t||"").match(T.notSpaceStart)?.[0],n=e.replace(T.endingNewline,"")+`
845
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):o.push(s);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,o}inline(t,o=[]){return this.inlineQueue.push({src:t,tokens:o}),o}linkInText(t){if(!t.includes("["))return!1;let o=this.tokenizer.rules.inline.link;for(let r of t.matchAll(this.tokenizer.rules.inline.blockSkip))if(o.test(r[0])&&t.charAt(r.index-1)!=="!")return!0;for(let r of t.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let n=r[0],s=n.lastIndexOf("[");if(!(n.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,n.slice(s+1,-1)))&&!(s>1&&this.linkInText(n.slice(1,s-1))))return!0}return!1}inlineTokens(t,o=[]){this.tokenizer.lexer=this;let r=t;if(this.tokens.links&&t.includes("[")){let a=this.tokenizer.rules.inline.reflinkSearch,c=l=>{let p=l.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,l.slice(p+1,-1)))return l;if(p>1&&l.charAt(0)!=="!"){let d=l.slice(1,p-1);if(this.linkInText(d))return"["+d.replace(a,c)+"]["+"a".repeat(l.length-p-2)+"]"}return"["+"a".repeat(l.length-2)+"]"};r=r.replace(a,c)}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,a=>"+".repeat(a.length)),r=r.replace(this.tokenizer.rules.inline.blockSkip,(a,c,l)=>{let p=l?l.length:0;return a.slice(0,p)+"["+"a".repeat(a.length-p-2)+"]"}),r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let n=!1,s="",i=1/0;for(;t;){if(t.length<i)i=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}n||(s=""),n=!1;let a;if(this.options.extensions?.inline?.some(l=>(a=l.call({lexer:this},t,o))?(t=t.substring(a.raw.length),o.push(a),!0):!1))continue;if(a=this.tokenizer.escape(t)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.tag(t)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.link(t)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(a.raw.length);let l=o.at(-1);a.type==="text"&&l?.type==="text"?(l.raw+=a.raw,l.text+=a.text):o.push(a);continue}if(a=this.tokenizer.emStrong(t,r,s)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.codespan(t)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.br(t)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.del(t,r,s)){t=t.substring(a.raw.length),o.push(a);continue}if(a=this.tokenizer.autolink(t)){t=t.substring(a.raw.length),o.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(t))){t=t.substring(a.raw.length),o.push(a);continue}let c=t;if(this.options.extensions?.startInline){let l=1/0,p=t.slice(1),d;this.options.extensions.startInline.forEach(u=>{d=u.call({lexer:this},p),typeof d=="number"&&d>=0&&(l=Math.min(l,d))}),l<1/0&&l>=0&&(c=t.substring(0,l+1))}if(a=this.tokenizer.inlineText(c)){t=t.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(s=a.raw.slice(-1)),n=!0;let l=o.at(-1);l?.type==="text"?(l.raw+=a.raw,l.text+=a.text):o.push(a);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return o}infiniteLoopError(t){let o="Infinite loop on byte: "+t;if(this.options.silent)console.error(o);else throw new Error(o)}},$e=class{options;parser;constructor(e){this.options=e||W}space(e){return""}code({text:e,lang:t,escaped:o}){let r=(t||"").match(T.notSpaceStart)?.[0],n=e.replace(T.endingNewline,"")+`
846
846
  `;return r?'<pre><code class="language-'+R(r)+'">'+(o?n:R(n,!0))+`</code></pre>
847
847
  `:"<pre><code>"+(o?n:R(n,!0))+`</code></pre>
848
848
  `}blockquote({tokens:e}){return`<blockquote>
@@ -860,7 +860,7 @@ ${this.parser.parse(e)}</blockquote>
860
860
  `}tablerow({text:e}){return`<tr>
861
861
  ${e}</tr>
862
862
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),o=e.header?"th":"td";return(e.align?`<${o} align="${e.align}">`:`<${o}>`)+t+`</${o}>
863
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${R(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:o}){let r=this.parser.parseInline(o),n=Rt(e);if(n===null)return r;e=n;let s='<a href="'+e+'"';return t&&(s+=' title="'+R(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:o,tokens:r}){r&&(o=this.parser.parseInline(r,this.parser.textRenderer));let n=Rt(e);if(n===null)return R(o);e=n;let s=`<img src="${e}" alt="${R(o)}"`;return t&&(s+=` title="${R(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:R(e.text)}},Xe=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},I=class Oe{options;renderer;textRenderer;constructor(t){this.options=t||W,this.options.renderer=this.options.renderer||new $e,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Xe}static parse(t,o){return new Oe(o).parse(t)}static parseInline(t,o){return new Oe(o).parseInline(t)}parse(t){this.renderer.parser=this;let o="";for(let r=0;r<t.length;r++){let n=t[r];if(this.options.extensions?.renderers?.[n.type]){let i=n,a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(i.type)){o+=a||"";continue}}let s=n;switch(s.type){case"space":{o+=this.renderer.space(s);break}case"hr":{o+=this.renderer.hr(s);break}case"heading":{o+=this.renderer.heading(s);break}case"code":{o+=this.renderer.code(s);break}case"table":{o+=this.renderer.table(s);break}case"blockquote":{o+=this.renderer.blockquote(s);break}case"list":{o+=this.renderer.list(s);break}case"checkbox":{o+=this.renderer.checkbox(s);break}case"html":{o+=this.renderer.html(s);break}case"def":{o+=this.renderer.def(s);break}case"paragraph":{o+=this.renderer.paragraph(s);break}case"text":{o+=this.renderer.text(s);break}default:{let i='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return o}parseInline(t,o=this.renderer){this.renderer.parser=this;let r="";for(let n=0;n<t.length;n++){let s=t[n];if(this.options.extensions?.renderers?.[s.type]){let a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(s.type)){r+=a||"";continue}}let i=s;switch(i.type){case"escape":{r+=o.text(i);break}case"html":{r+=o.html(i);break}case"link":{r+=o.link(i);break}case"image":{r+=o.image(i);break}case"checkbox":{r+=o.checkbox(i);break}case"strong":{r+=o.strong(i);break}case"em":{r+=o.em(i);break}case"codespan":{r+=o.codespan(i);break}case"br":{r+=o.br(i);break}case"del":{r+=o.del(i);break}case"text":{r+=o.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Y=class{options;block;constructor(e){this.options=e||W}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?B.lex:B.lexInline}provideParser(e=this.block){return e?I.parse:I.parseInline}},bs=class{defaults=qe();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=I;Renderer=$e;TextRenderer=Xe;Lexer=B;Tokenizer=ye;Hooks=Y;constructor(...e){this.use(...e)}walkTokens(e,t){let o=[];for(let r of e)switch(o=o.concat(t.call(this,r)),r.type){case"table":{let n=r;for(let s of n.header)o=o.concat(this.walkTokens(s.tokens,t));for(let s of n.rows)for(let i of s)o=o.concat(this.walkTokens(i.tokens,t));break}case"list":{let n=r;o=o.concat(this.walkTokens(n.items,t));break}default:{let n=r;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(s=>{let i=n[s].flat(1/0);o=o.concat(this.walkTokens(i,t))}):n.tokens&&(o=o.concat(this.walkTokens(n.tokens,t)))}}return o}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(o=>{let r={...o};if(r.async=this.defaults.async||r.async||!1,o.extensions&&(o.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let s=t.renderers[n.name];s?t.renderers[n.name]=function(...i){let a=n.renderer.apply(this,i);return a===!1&&(a=s.apply(this,i)),a}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[n.level];s?s.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),r.extensions=t),o.renderer){let n=this.defaults.renderer||new $e(this.defaults);for(let s in o.renderer){if(!(s in n))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let i=s,a=o.renderer[i],l=n[i];n[i]=(...c)=>{let p=a.apply(n,c);return p===!1&&(p=l.apply(n,c)),p||""}}r.renderer=n}if(o.tokenizer){let n=this.defaults.tokenizer||new ye(this.defaults);for(let s in o.tokenizer){if(!(s in n))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let i=s,a=o.tokenizer[i],l=n[i];n[i]=(...c)=>{let p=a.apply(n,c);return p===!1&&(p=l.apply(n,c)),p}}r.tokenizer=n}if(o.hooks){let n=this.defaults.hooks||new Y;for(let s in o.hooks){if(!(s in n))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let i=s,a=o.hooks[i],l=n[i];Y.passThroughHooks.has(s)?n[i]=c=>{if(this.defaults.async&&Y.passThroughHooksRespectAsync.has(s))return(async()=>{let d=await a.call(n,c);return l.call(n,d)})();let p=a.call(n,c);return l.call(n,p)}:n[i]=(...c)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(n,c);return d===!1&&(d=await l.apply(n,c)),d})();let p=a.apply(n,c);return p===!1&&(p=l.apply(n,c)),p}}r.hooks=n}if(o.walkTokens){let n=this.defaults.walkTokens,s=o.walkTokens;r.walkTokens=function(i){let a=[];return a.push(s.call(this,i)),n&&(a=a.concat(n.call(this,i))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return B.lex(e,t??this.defaults)}parser(e,t){return I.parse(e,t??this.defaults)}parseMarkdown(e){return(t,o)=>{let r={...o},n={...this.defaults,...r},s=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=e),n.async)return(async()=>{let i=n.hooks?await n.hooks.preprocess(t):t,a=await(n.hooks?await n.hooks.provideLexer(e):e?B.lex:B.lexInline)(i,n),l=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(l,n.walkTokens));let c=await(n.hooks?await n.hooks.provideParser(e):e?I.parse:I.parseInline)(l,n);return n.hooks?await n.hooks.postprocess(c):c})().catch(s);try{n.hooks&&(t=n.hooks.preprocess(t));let i=(n.hooks?n.hooks.provideLexer(e):e?B.lex:B.lexInline)(t,n);n.hooks&&(i=n.hooks.processAllTokens(i)),n.walkTokens&&this.walkTokens(i,n.walkTokens);let a=(n.hooks?n.hooks.provideParser(e):e?I.parse:I.parseInline)(i,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(i){return s(i)}}}onError(e,t){return o=>{if(o.message+=`
863
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${R(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:o}){let r=this.parser.parseInline(o),n=Rt(e);if(n===null)return r;e=n;let s='<a href="'+e+'"';return t&&(s+=' title="'+R(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:o,tokens:r}){r&&(o=this.parser.parseInline(r,this.parser.textRenderer));let n=Rt(e);if(n===null)return R(o);e=n;let s=`<img src="${e}" alt="${R(o)}"`;return t&&(s+=` title="${R(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:R(e.text)}},Xe=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},I=class Oe{options;renderer;textRenderer;constructor(t){this.options=t||W,this.options.renderer=this.options.renderer||new $e,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Xe}static parse(t,o){return new Oe(o).parse(t)}static parseInline(t,o){return new Oe(o).parseInline(t)}parse(t){this.renderer.parser=this;let o="";for(let r=0;r<t.length;r++){let n=t[r];if(this.options.extensions?.renderers?.[n.type]){let i=n,a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(i.type)){o+=a||"";continue}}let s=n;switch(s.type){case"space":{o+=this.renderer.space(s);break}case"hr":{o+=this.renderer.hr(s);break}case"heading":{o+=this.renderer.heading(s);break}case"code":{o+=this.renderer.code(s);break}case"table":{o+=this.renderer.table(s);break}case"blockquote":{o+=this.renderer.blockquote(s);break}case"list":{o+=this.renderer.list(s);break}case"checkbox":{o+=this.renderer.checkbox(s);break}case"html":{o+=this.renderer.html(s);break}case"def":{o+=this.renderer.def(s);break}case"paragraph":{o+=this.renderer.paragraph(s);break}case"text":{o+=this.renderer.text(s);break}default:{let i='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return o}parseInline(t,o=this.renderer){this.renderer.parser=this;let r="";for(let n=0;n<t.length;n++){let s=t[n];if(this.options.extensions?.renderers?.[s.type]){let a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(s.type)){r+=a||"";continue}}let i=s;switch(i.type){case"escape":{r+=o.text(i);break}case"html":{r+=o.html(i);break}case"link":{r+=o.link(i);break}case"image":{r+=o.image(i);break}case"checkbox":{r+=o.checkbox(i);break}case"strong":{r+=o.strong(i);break}case"em":{r+=o.em(i);break}case"codespan":{r+=o.codespan(i);break}case"br":{r+=o.br(i);break}case"del":{r+=o.del(i);break}case"text":{r+=o.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Y=class{options;block;constructor(e){this.options=e||W}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?B.lex:B.lexInline}provideParser(e=this.block){return e?I.parse:I.parseInline}},bs=class{defaults=qe();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=I;Renderer=$e;TextRenderer=Xe;Lexer=B;Tokenizer=ye;Hooks=Y;constructor(...e){this.use(...e)}walkTokens(e,t){let o=[];for(let r of e)switch(o=o.concat(t.call(this,r)),r.type){case"table":{let n=r;for(let s of n.header)o=o.concat(this.walkTokens(s.tokens,t));for(let s of n.rows)for(let i of s)o=o.concat(this.walkTokens(i.tokens,t));break}case"list":{let n=r;o=o.concat(this.walkTokens(n.items,t));break}default:{let n=r;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(s=>{let i=n[s].flat(1/0);o=o.concat(this.walkTokens(i,t))}):n.tokens&&(o=o.concat(this.walkTokens(n.tokens,t)))}}return o}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(o=>{let r={...o};if(r.async=this.defaults.async||r.async||!1,o.extensions&&(o.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let s=t.renderers[n.name];s?t.renderers[n.name]=function(...i){let a=n.renderer.apply(this,i);return a===!1&&(a=s.apply(this,i)),a}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[n.level];s?s.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),r.extensions=t),o.renderer){let n=this.defaults.renderer||new $e(this.defaults);for(let s in o.renderer){if(!(s in n))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let i=s,a=o.renderer[i],c=n[i];n[i]=(...l)=>{let p=a.apply(n,l);return p===!1&&(p=c.apply(n,l)),p||""}}r.renderer=n}if(o.tokenizer){let n=this.defaults.tokenizer||new ye(this.defaults);for(let s in o.tokenizer){if(!(s in n))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let i=s,a=o.tokenizer[i],c=n[i];n[i]=(...l)=>{let p=a.apply(n,l);return p===!1&&(p=c.apply(n,l)),p}}r.tokenizer=n}if(o.hooks){let n=this.defaults.hooks||new Y;for(let s in o.hooks){if(!(s in n))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let i=s,a=o.hooks[i],c=n[i];Y.passThroughHooks.has(s)?n[i]=l=>{if(this.defaults.async&&Y.passThroughHooksRespectAsync.has(s))return(async()=>{let d=await a.call(n,l);return c.call(n,d)})();let p=a.call(n,l);return c.call(n,p)}:n[i]=(...l)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(n,l);return d===!1&&(d=await c.apply(n,l)),d})();let p=a.apply(n,l);return p===!1&&(p=c.apply(n,l)),p}}r.hooks=n}if(o.walkTokens){let n=this.defaults.walkTokens,s=o.walkTokens;r.walkTokens=function(i){let a=[];return a.push(s.call(this,i)),n&&(a=a.concat(n.call(this,i))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return B.lex(e,t??this.defaults)}parser(e,t){return I.parse(e,t??this.defaults)}parseMarkdown(e){return(t,o)=>{let r={...o},n={...this.defaults,...r},s=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=e),n.async)return(async()=>{let i=n.hooks?await n.hooks.preprocess(t):t,a=await(n.hooks?await n.hooks.provideLexer(e):e?B.lex:B.lexInline)(i,n),c=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(c,n.walkTokens));let l=await(n.hooks?await n.hooks.provideParser(e):e?I.parse:I.parseInline)(c,n);return n.hooks?await n.hooks.postprocess(l):l})().catch(s);try{n.hooks&&(t=n.hooks.preprocess(t));let i=(n.hooks?n.hooks.provideLexer(e):e?B.lex:B.lexInline)(t,n);n.hooks&&(i=n.hooks.processAllTokens(i)),n.walkTokens&&this.walkTokens(i,n.walkTokens);let a=(n.hooks?n.hooks.provideParser(e):e?I.parse:I.parseInline)(i,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(i){return s(i)}}}onError(e,t){return o=>{if(o.message+=`
864
864
  Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+R(o.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(o);throw o}}},H=new bs;function y(e,t){return H.parse(e,t)}y.options=y.setOptions=function(e){return H.setOptions(e),y.defaults=H.defaults,lo(y.defaults),y};y.getDefaults=qe;y.defaults=W;function vs(...e){return H.use(...e),y.defaults=H.defaults,lo(y.defaults),y}y.use=vs;y.walkTokens=function(e,t){return H.walkTokens(e,t)};y.parseInline=H.parseInline;y.Parser=I;y.parser=I.parse;y.Renderer=$e;y.TextRenderer=Xe;y.Lexer=B;y.lexer=B.lex;y.Tokenizer=ye;y.Hooks=Y;y.parse=y;y.options;y.setOptions;y.walkTokens;y.parseInline;var Mt=y;I.parse;B.lex;const vo=async(e,t=[])=>{const o=[...t,Nt,Ot],r=ne(e,{frameLimit:1})[0];for(const n of o.toSorted((s,i)=>i.priority-s.priority)){const{handle:s,name:i}=n;if(Pe.env?.DEBUG&&console.debug(`Running solution finder: ${i}`),typeof s=="function")try{const a=await s(e,{file:r?.file??"",language:ae(r?.file??""),line:r?.line??0,snippet:r?.file?await le(r.file):""});if(a)return a}catch{continue}}},xs=async(e,t=[])=>{const o=await vo(e,t);return o?{html:`<div id="ono-solution-wrapper" class="relative w-full transition-all duration-300 ease-in-out overflow-visible">
865
865
  <button id="ono-solution-button" type="button" aria-label="Toggle solutions" aria-controls="ono-solution-content" aria-expanded="true" title="Toggle solution details" class="bg-[var(--ono-success-bg)] text-[var(--ono-text)] rounded-[var(--ono-radius-md)] p-2 absolute top-2 right-2 z-10 h-9 w-8 cursor-pointer shadow-[var(--ono-elevation-1)]">
866
866
  <span id="ono-solution-icon" class="dui" style="-webkit-mask-image: url('${Re}'); mask-image: url('${Re}')"></span>
@@ -977,7 +977,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
977
977
  // Add event listeners
978
978
  button.addEventListener('click', handleClick);
979
979
  button.addEventListener('keydown', handleKeydown);
980
- });`}:{html:"",script:""}},ks=async e=>{const t=C(e.name),o=C(e.message),r=E(`${e.name}: ${e.message}`),n=ne(e,{frameLimit:1})[0],s=n?.file??"",i=n?.line??0,a=s?await le(s):"",l=a?He(a,{start:{column:n?.column,line:i}},{linesAbove:9,linesBelow:10,showGutter:!0}):"",c=Pt({applicationType:void 0,error:e,file:{file:s,language:ae(s),line:i,snippet:l}}),p=oo(),d=ao({label:"Copy error title",secondaryLabel:"Copy fix prompt",secondaryText:c,targetId:"clipboard-sticky-error-title"});return{html:`<div id="error-card-sticky-header" class="fixed invisible container px-6 py-4 -top-40 z-10 rounded-[var(--ono-radius-lg)] transition-all duration-300 shadow-[var(--ono-elevation-1)] bg-[var(--ono-surface)]">
980
+ });`}:{html:"",script:""}},ks=async e=>{const t=C(e.name),o=C(e.message),r=E(`${e.name}: ${e.message}`),n=ne(e,{frameLimit:1})[0],s=n?.file??"",i=n?.line??0,a=s?await le(s):"",c=a?He(a,{start:{column:n?.column,line:i}},{linesAbove:9,linesBelow:10,showGutter:!0}):"",l=Pt({applicationType:void 0,error:e,file:{file:s,language:ae(s),line:i,snippet:c}}),p=oo(),d=ao({label:"Copy error title",secondaryLabel:"Copy fix prompt",secondaryText:l,targetId:"clipboard-sticky-error-title"});return{html:`<div id="error-card-sticky-header" class="fixed invisible container px-6 py-4 -top-40 z-10 rounded-[var(--ono-radius-lg)] transition-all duration-300 shadow-[var(--ono-elevation-1)] bg-[var(--ono-surface)]">
981
981
  <input type="hidden" id="clipboard-sticky-error-title" value="${r}">
982
982
  <div class="flex items-center gap-2">
983
983
  <h1 class="text-sm font-semibold py-1 px-2 text-[var(--ono-chip-text)] bg-[var(--ono-chip-bg)] rounded-[var(--ono-radius-md)] shadow-[var(--ono-elevation-1)]" aria-label="Error name">${t}</h1>
@@ -1025,13 +1025,13 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1025
1025
  }
1026
1026
  } catch (_) {}
1027
1027
  });
1028
- })();`}},ys=async({error:e,runtimeName:t,solutionFinders:o,version:r})=>{let n=`${t?.toUpperCase()??""} ${r??""}`;n.includes("NODE")&&(n=`<a href="https://nodejs.org/dist/latest-${r?.split(".")[0]??""}.x/docs/api/" class="text-blue-500 hover:underline inline-flex items-center text-sm" target="_blank" rel="noopener noreferrer">${n.replace("NODE","Node.js")}<span class="dui ml-1" style="-webkit-mask-image: url('${At}'); mask-image: url('${At}')" title="Open Node.js documentation"></span></a>`);const{html:s,script:i}=await xs(e,o),{html:a,script:l}=await ks(e),c=C(e.name),p=C(e.message),d=E(`${e.name}: ${e.message}`),u=ne(e,{frameLimit:1})[0],f=u?.file??"",w=u?.line??0,h=f?await le(f):"",m=h?He(h,{start:{column:u?.column,line:w}},{linesAbove:9,linesBelow:10,showGutter:!0}):"",g=Pt({applicationType:void 0,error:e,file:{file:f,language:ae(f),line:w,snippet:m}}),b=ao({label:"Copy error title",secondaryLabel:"Copy fix prompt",secondaryText:g,targetId:"clipboard-error-title"});return{html:`<section id="error-card" class="container rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-2)] bg-[var(--ono-surface)]">
1028
+ })();`}},ys=async({error:e,runtimeName:t,solutionFinders:o,version:r})=>{let n=`${t?.toUpperCase()??""} ${r??""}`;n.includes("NODE")&&(n=`<a href="https://nodejs.org/dist/latest-${r?.split(".")[0]??""}.x/docs/api/" class="text-blue-500 hover:underline inline-flex items-center text-sm" target="_blank" rel="noopener noreferrer">${n.replace("NODE","Node.js")}<span class="dui ml-1" style="-webkit-mask-image: url('${At}'); mask-image: url('${At}')" title="Open Node.js documentation"></span></a>`);const{html:s,script:i}=await xs(e,o),{html:a,script:c}=await ks(e),l=C(e.name),p=C(e.message),d=E(`${e.name}: ${e.message}`),u=ne(e,{frameLimit:1})[0],f=u?.file??"",w=u?.line??0,h=f?await le(f):"",m=h?He(h,{start:{column:u?.column,line:w}},{linesAbove:9,linesBelow:10,showGutter:!0}):"",g=Pt({applicationType:void 0,error:e,file:{file:f,language:ae(f),line:w,snippet:m}}),b=ao({label:"Copy error title",secondaryLabel:"Copy fix prompt",secondaryText:g,targetId:"clipboard-error-title"});return{html:`<section id="error-card" class="container rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-2)] bg-[var(--ono-surface)]">
1029
1029
  <input type="hidden" id="clipboard-error-title" value="${d}">
1030
1030
  <div class="flex flex-row">
1031
1031
  <div class="flex flex-col gap-3 grow min-w-6/12 w-full p-6 pt-5">
1032
1032
  <div class="flex flex-row items-center gap-2">
1033
1033
  <h1 class="text-lg font-semibold py-1 px-2 text-[var(--ono-chip-text)] bg-[var(--ono-chip-bg)] rounded-[var(--ono-radius-md)] shadow-[var(--ono-elevation-1)]">
1034
- ${c}
1034
+ ${l}
1035
1035
  </h1>
1036
1036
  ${b.html}
1037
1037
  <div class="grow"></div>
@@ -1046,14 +1046,14 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1046
1046
  ${s}
1047
1047
  </div>
1048
1048
  </section>
1049
- ${a}`,scripts:[i,l]}},$s=e=>{const t=io({message:"The orginal stack trace from the main error."}),o=C(e);return`<section>
1049
+ ${a}`,scripts:[i,c]}},$s=e=>{const t=io({message:"The orginal stack trace from the main error."}),o=C(e);return`<section>
1050
1050
  <h3 class="text-xl font-bold inline-flex justify-center items-center text-[var(--ono-text)]">Stack Trace</h3>
1051
1051
  ${t}
1052
1052
  <div class="container rounded-[var(--ono-radius-lg)] shadow-[var(--ono-elevation-1)] my-6 bg-[var(--ono-surface)]">
1053
1053
  <main id="raw-stack-trace" class="p-6 prose prose-sm max-w-full text-[var(--ono-text)]">${o}</main>
1054
1054
  </div>
1055
1055
  </section>`},Ss=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.name=="string"&&typeof t.message=="string"&&(t.stack===void 0||typeof t.stack=="string")},Es=e=>{if(e.length===0)throw new TypeError("No errors found in the error stack");const t=e[0];if(t instanceof Error)return t;if(Ss(t)){const o=new Error(t.message);return o.name=t.name,typeof t.stack=="string"&&(o.stack=t.stack),o}throw new TypeError("Main cause is not a valid Error object")},Cs=(e,t,o,r)=>['<div class="flex flex-col gap-6">',e,t,o,r,"</div>"].join(""),Ts=(e,t,o)=>[e,t,...o].filter(Boolean).join(`
1056
- `),As=async(e,t=[],o={})=>{if(!Array.isArray(t))throw new TypeError("solutionFinders must be an array");const r=jt(e),n=Es(r),s=r.length>1?r.slice(1):[],[i,a,l]=await Promise.all([ys({error:n,runtimeName:no,solutionFinders:t,version:Fo()}),so(n,{openInEditorUrl:o.openInEditorUrl}),kn(s,o)]),{html:c,scripts:p}=i,{html:d,script:u}=a,{html:f,script:w}=l,h=Cs(c,d,f,$s(n.stack)),m=Ts(u,w,p);return{code:{html:h,script:m},defaultSelected:!0,id:"stack",name:"Stack"}},Ds=`
1056
+ `),As=async(e,t=[],o={})=>{if(!Array.isArray(t))throw new TypeError("solutionFinders must be an array");const r=jt(e),n=Es(r),s=r.length>1?r.slice(1):[],[i,a,c]=await Promise.all([ys({error:n,runtimeName:no,solutionFinders:t,version:Fo()}),so(n,{openInEditorUrl:o.openInEditorUrl}),kn(s,o)]),{html:l,scripts:p}=i,{html:d,script:u}=a,{html:f,script:w}=c,h=Cs(l,d,f,$s(n.stack)),m=Ts(u,w,p);return{code:{html:h,script:m},defaultSelected:!0,id:"stack",name:"Stack"}},Ds=`
1057
1057
  // DOM utility functions
1058
1058
  function ready(fn) {
1059
1059
  if (document.readyState !== 'loading') {
@@ -1250,4 +1250,4 @@ document.addEventListener('click', function(e) {
1250
1250
  }
1251
1251
  }
1252
1252
  });
1253
- `,Rs=async(e,t=[],o={})=>{if(!Array.isArray(t))throw new TypeError("solutionFinders must be an array");const r=Mo(o),{code:{html:n,script:s},id:i,name:a}=await As(e,t,r),l=Array.isArray(r.content)?r.content:[],c=l.some(h=>h.defaultSelected),p=[{id:i,name:a,selected:!c}];l.forEach(h=>{p.push({id:h.id,name:h.name,selected:!!h.defaultSelected})});const d=dn(p),u=sn(r),f=['<div class="flex flex-row gap-6 w-full mb-6">',d.html,u.html,"</div>"],w=E(i);return f.push(`<div id="ono-section-${w}" class="${c?"hidden relative":"relative"}" role="tabpanel" aria-labelledby="ono-tab-${w}">${n}</div>`),l.forEach(h=>{const m=E(h.id),g=h.defaultSelected?"":" hidden";f.push(`<div id="ono-section-${m}" class="${g} relative" role="tabpanel" aria-labelledby="ono-tab-${m}">${h.code.html}</div>`)}),f.push(tn),gn({content:f.join("").trim(),cspNonce:o.cspNonce,css:pn,description:"Error",error:e,scripts:[Ds,Bs,Is,d.script,u.script,s,...l.map(h=>h.code.script??"")].filter(Boolean),theme:o.theme,title:"Error"})},Ft=e=>e instanceof Error?e:new Error(String(e)),Ls=e=>({column:e.column,file:e.file,line:e.line,methodName:e.methodName,raw:e.raw,type:e.type}),xo=async(e,t={})=>{const o=Ft(e),n=jt(o).map(i=>{const a=Ft(i);return{frames:ne(a).map(l=>Ls(l)),message:a.message,name:a.name}}),s=await vo(o,t.solutionFinders??[]);return{runtime:no,solution:s?{body:s.body,header:s.header??""}:void 0,stack:n}},ko=e=>e instanceof Error?e:new Error(String(e)),_s=async(e,t)=>{const o=ko(e),{solutionFinders:r=[],...n}=t??{};return Rs(o,r,n)},zs=async(e,t={})=>{const o=ko(e);return en(o,t)},Gs=xo;class Ks{async toHTML(t,o){return _s(t,o)}async toANSI(t,o={}){return zs(t,o)}async toJSON(t,o){return xo(t,o)}}export{Ks as Ono,zs as renderAnsi,_s as renderHtml,Gs as renderJson};
1253
+ `,Rs=async(e,t=[],o={})=>{if(!Array.isArray(t))throw new TypeError("solutionFinders must be an array");const r=Mo(o),{code:{html:n,script:s},id:i,name:a}=await As(e,t,r),c=Array.isArray(r.content)?r.content:[],l=c.some(h=>h.defaultSelected),p=[{id:i,name:a,selected:!l}];c.forEach(h=>{p.push({id:h.id,name:h.name,selected:!!h.defaultSelected})});const d=dn(p),u=sn(r),f=['<div class="flex flex-row gap-6 w-full mb-6">',d.html,u.html,"</div>"],w=E(i);return f.push(`<div id="ono-section-${w}" class="${l?"hidden relative":"relative"}" role="tabpanel" aria-labelledby="ono-tab-${w}">${n}</div>`),c.forEach(h=>{const m=E(h.id),g=h.defaultSelected?"":" hidden";f.push(`<div id="ono-section-${m}" class="${g} relative" role="tabpanel" aria-labelledby="ono-tab-${m}">${h.code.html}</div>`)}),f.push(tn),gn({content:f.join("").trim(),cspNonce:o.cspNonce,css:pn,description:"Error",error:e,scripts:[Ds,Bs,Is,d.script,u.script,s,...c.map(h=>h.code.script??"")].filter(Boolean),theme:o.theme,title:"Error"})},Ft=e=>e instanceof Error?e:new Error(String(e)),Ls=e=>({column:e.column,file:e.file,line:e.line,methodName:e.methodName,raw:e.raw,type:e.type}),xo=async(e,t={})=>{const o=Ft(e),n=jt(o).map(i=>{const a=Ft(i);return{frames:ne(a).map(c=>Ls(c)),message:a.message,name:a.name}}),s=await vo(o,t.solutionFinders??[]);return{runtime:no,solution:s?{body:s.body,header:s.header??""}:void 0,stack:n}},ko=e=>e instanceof Error?e:new Error(String(e)),_s=async(e,t)=>{const o=ko(e),{solutionFinders:r=[],...n}=t??{};return Rs(o,r,n)},zs=async(e,t={})=>{const o=ko(e);return en(o,t)},Gs=xo;class Ks{async toHTML(t,o){return _s(t,o)}async toANSI(t,o={}){return zs(t,o)}async toJSON(t,o){return xo(t,o)}}export{Ks as Ono,zs as renderAnsi,_s as renderHtml,Gs as renderJson};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/ono",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "description": "Ono is an error-parsing library that pretty prints JavaScript errors on a web page or the terminal.",
5
5
  "keywords": [
6
6
  "anolilab",