@visulima/packem 2.0.0-alpha.92 → 2.0.0-alpha.93

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,10 @@
1
+ ## @visulima/packem [2.0.0-alpha.93](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.92...@visulima/packem@2.0.0-alpha.93) (2026-06-20)
2
+
3
+
4
+ ### Dependencies
5
+
6
+ * **@visulima/packem-rollup:** upgraded to 1.0.0-alpha.75
7
+
1
8
  ## @visulima/packem [2.0.0-alpha.92](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.91...@visulima/packem@2.0.0-alpha.92) (2026-06-16)
2
9
 
3
10
  ### Features
package/dist/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{createCerebro as Q}from"@visulima/cerebro";import Z from"@visulima/cerebro/logger/pail";import{e as A,S as q,m as ee,f as te,g as se,i as ae,B as ie,T as ne,j as T,v as re,l as oe,d as ce}from"../packem_shared/index-BXEUcumB.js";import k,{cwd as O,exit as le}from"node:process";import{installPackage as h}from"@antfu/install-pkg";import{spinner as D,confirm as f,cancel as B,select as g,multiselect as G,intro as K,log as E,outro as U,isCancel as W}from"@clack/prompts";import{a as de,b as ue,q as pe,s as N,T as me,S as fe}from"../packem_shared/create-or-update-key-storage-DHOKZmnD.js";import{P as L,w as b}from"../packem_shared/utils-Bsoe7qJG.js";import ge from"magic-string";import{exec as ye}from"tinyexec";import{PRODUCTION_ENV as F,DEVELOPMENT_ENV as we}from"@visulima/packem-share/constants";import{createJiti as be}from"jiti";import{writeFile as z,readFile as he}from"node:fs/promises";import{existsSync as V}from"node:fs";import{parseEnv as J}from"node:util";import{createInterface as ve}from"node:readline/promises";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
+ import{createCerebro as Q}from"@visulima/cerebro";import Z from"@visulima/cerebro/logger/pail";import{e as A,S as q,m as ee,f as te,g as se,i as ae,B as ie,T as ne,j as T,v as re,l as oe,d as ce}from"../packem_shared/index-DiAPKNwF.js";import k,{cwd as O,exit as le}from"node:process";import{installPackage as h}from"@antfu/install-pkg";import{spinner as D,confirm as f,cancel as B,select as g,multiselect as G,intro as K,log as E,outro as U,isCancel as W}from"@clack/prompts";import{a as de,b as ue,q as pe,s as N,T as me,S as fe}from"../packem_shared/create-or-update-key-storage-DHOKZmnD.js";import{P as L,w as b}from"../packem_shared/utils-Bsoe7qJG.js";import ge from"magic-string";import{exec as ye}from"tinyexec";import{PRODUCTION_ENV as F,DEVELOPMENT_ENV as we}from"@visulima/packem-share/constants";import{createJiti as be}from"jiti";import{writeFile as z,readFile as he}from"node:fs/promises";import{existsSync as V}from"node:fs";import{parseEnv as J}from"node:util";import{createInterface as ve}from"node:readline/promises";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
3
3
  const require = __cjs_mod__.createRequire(import.meta.url);
4
4
  const _={less:["less"],lightningcss:["lightningcss"],"node-sass":["node-sass"],postcss:["postcss","postcss-load-config","postcss-modules-extract-imports","postcss-modules-local-by-default","postcss-modules-scope","postcss-modules-values","postcss-value-parser","@csstools/css-parser-algorithms","@csstools/css-tokenizer","@csstools/postcss-slow-plugins","icss-utils","@visulima/css-style-inject"],sass:["sass"],"sass-embedded":["sass-embedded"],stylus:["stylus"],tailwindcss:["@tailwindcss/node","@tailwindcss/oxide","tailwindcss"]},ke=/defineConfig\s*\(\s*\{/,$e=/preset:\s*['"][^'"]+['"]/,Se=["typedoc","typedoc-plugin-markdown","typedoc-plugin-rename-defaults"],Ce=["@babel/core","@babel/preset-react"],je=["react","react-dom"],xe=["@babel/core","babel-preset-solid"],Pe=["solid-js"],Ee=["@babel/core","@babel/preset-react","babel-plugin-transform-hook-names"],De=["preact"],Le=["unplugin-vue"],Ie=["vue"],Me=["rollup-plugin-svelte"],Ne=["svelte"],$=(t,e,a)=>t.includes(`preset: '${e}'`)||t.includes(`preset: "${e}"`)||t.includes(`preset: '${e}',`)||t.includes(`preset: "${e}",`)||t.includes(a)||t.includes(`@visulima/packem/config/preset/${e}`),S=(t,e)=>{const{logger:a,magic:s,packemConfig:i}=t,n=ke.exec(i);if(n?.index!==void 0){const r=n.index+n[0].length;if(i.includes("preset:")){const o=$e.exec(i);if(o)s.replace(o[0],`preset: '${e}'`);else throw a.warn(`A preset already exists in the config. Please manually set it to '${e}'.`),new Error("Preset exists but is not a string")}else s.appendLeft(r,`
5
5
  preset: '${e}',`)}else if(i.includes("transformer:"))s.replace("transformer:",`preset: '${e}',
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{createRequire as He}from"node:module";import{n as Ht,Z as xe,Y as Jt,J as Je,h as Se,y as yt,X as Gt,q as Ut,M as zt,a as Kt,A as be,K as Yt,k as Qt,b as Zt,c as Be,d as Xt,T as er}from"./packem_shared/index-BXEUcumB.js";import{g as wt}from"./packem_shared/create-or-update-key-storage-DHOKZmnD.js";const tr=He(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:Q,Ge=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,r]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ie.getBuiltinModule(t)}return tr(t)},Q=ie,{execFileSync:rr}=Ge("node:child_process"),ue=Ge("node:fs"),sr=Ge("node:tty"),Ue=[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],ze=[12288,12288,65281,65376,65504,65510],Ke=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Ye=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ae=[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],ge=(t,e)=>{let r=0,s=Math.floor(t.length/2)-1;for(;r<=s;){const i=Math.floor((r+s)/2),o=i*2;if(e<t[o])s=i-1;else if(e>t[o+1])r=i+1;else return!0}return!1},ir=Ue[0],nr=Ue.at(-1),or=ze[0],ar=ze.at(-1),lr=Ke[0],cr=Ke.at(-1),ur=Ye[0],fr=Ye.at(-1),hr=Ae[0],gr=Ae.at(-1),nt=19968,[dr,pr]=mr(Ae);function mr(t){let e=t[0],r=t[1];for(let s=0;s<t.length;s+=2){const i=t[s],o=t[s+1];if(nt>=i&&nt<=o)return[i,o];o-i>r-e&&(e=i,r=o)}return[e,r]}const br=t=>t<ir||t>nr?!1:ge(Ue,t),yr=t=>t<or||t>ar?!1:ge(ze,t),wr=t=>t<lr||t>cr?!1:ge(Ke,t),$r=t=>t<ur||t>fr?!1:ge(Ye,t),vr=t=>t>=dr&&t<=pr?!0:t<hr||t>gr?!1:ge(Ae,t);function xr(t){return br(t)?"ambiguous":yr(t)?"fullwidth":wr(t)?"halfwidth":$r(t)?"narrow":vr(t)?"wide":"neutral"}function Sr(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function $t(t){return Sr(t),xr(t)}const vt=String.raw,ot=vt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,kr=()=>new RegExp(vt`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${ot}(?:\u200D${ot})*`,"gu"),ae=new Set(["\x1B","›"]),Le="\x07",xt="[",Qe="m",ke="]8;;",Er=39,Tr=/[\u200B\uFEFF\u2060-\u2064]/g,Ar=new RegExp(`(?:\\${xt}(?<code>\\d+)m|\\${ke}(?<uri>.*)${Le})`),Lr=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]])),le=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ye=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,je=kr(),at=new Map,we=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,$e=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Mr=(t,e)=>{const r=Math.floor(t/65536),s=t%65536;let i=at.get(r);if(i||(i=new Map,at.set(r,i)),i.has(s))return i.get(s);let o;if($e(t)==="latin")o=e.width.regular;else if($e(t)==="control")o=e.width.control;else if($e(t)==="wide")o=e.width.wide;else switch($t(t)){case"ambiguous":{o=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{o=e.width.fullWidth;break}case"wide":{o=e.width.wide;break}default:o=e.width.regular}return i.set(s,o),o},Or=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,Ce=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Ce(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},s=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:i}=t,o=i>1e4;let a=0,n=0,c=i,u=!1;const l=t.includes("\x1B")||t.includes("›");for(;a<i;){if(l&&(t[a]==="\x1B"||t[a]==="›")){if(t.startsWith("\x1B]8;;",a)){const v="\x1B]8;;\x07",B=v.length,V=t.indexOf("\x07",a+5);if(V!==-1){const H=t.indexOf(v,V+1);if(H!==-1){const d=H+B,g=t.slice(V+1,H).replace(le,""),$=Ce(g,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,s-n),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),I=$.width;if($.truncated)u=!0,c=Math.min(c,a);else if(n+I>s&&(c=Math.min(c,a),u=!0,n+I>r.truncation.limit))break;if(n+=I,a=d,u&&n>=r.truncation.limit)break;continue}}}if(le.lastIndex=a,le.test(t)){const v=le.lastIndex-a,B=r.truncation.countAnsiEscapeCodes?v:r.width.ansi;if(n+B>s&&(c=Math.min(c,a),n+B>r.truncation.limit)){u=!0;break}n+=B,a=le.lastIndex;continue}}const w=t.codePointAt(a);if(w===8203||w===65279||w>=8288&&w<=8292){a+=1;continue}if(w===9){if(n+r.width.tab>s&&(c=Math.min(c,a),n+r.width.tab>r.truncation.limit)){u=!0;break}n+=r.width.tab,a+=1;continue}if(we.lastIndex=a,we.test(t)){const v=(we.lastIndex-a)*r.width.regular;if(n+v>s){const B=Math.floor((s-n)/r.width.regular);if(c=Math.min(c,a+B),n+v>r.truncation.limit){u=!0;break}}n+=v,a=we.lastIndex;continue}if((w<=31||w>=127&&w<=159)&&(ye.lastIndex=a,ye.test(t))){const v=(ye.lastIndex-a)*r.width.control;if(n+v>s&&(c=Math.min(c,a+Math.floor((s-n)/r.width.control)),n+v>r.truncation.limit)){u=!0;break}n+=v,a=ye.lastIndex;continue}if(je.lastIndex=a,je.test(t)){if(n+r.width.emoji>s&&(c=Math.min(c,a),n+r.width.emoji>r.truncation.limit)){u=!0;break}n+=r.width.emoji,a=je.lastIndex;continue}const N=t.codePointAt(a)??0;if(Or(N)){a+=N>65535?2:1;continue}let k;if(o)k=Mr(N,r);else switch($e(N)){case"control":{k=r.width.control;break}case"latin":{k=r.width.regular;break}case"wide":{k=r.width.wide;break}case"zero":{k=0;break}default:switch($t(N)){case"ambiguous":{k=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{k=r.width.fullWidth;break}case"wide":{k=r.width.wide;break}default:k=r.width.regular}}if(n+k>s&&(c=Math.min(c,a),n+k>r.truncation.limit)){u=!0;break}n+=k,a+=N>65535?2:1}let h=n,p=!1;return u&&r.truncation.limit>=r.truncation.ellipsisWidth&&(h=r.truncation.limit,p=!0),{ellipsed:p,index:u?c:i,truncated:u,width:h}},Z=(t,e={})=>Ce(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Br=/\x1B\[(\d+)m/;class St{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const r=Br.exec(e);if(!r)return;const s=Number.parseInt(r[1],10);switch(s){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(s>=30&&s<=37||s>=90&&s<=97)this.activeForeground=e;else if(s>=40&&s<=47||s>=100&&s<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(s))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(s)){const i={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[s];i&&(this.activeFormatting=this.activeFormatting.filter(o=>!o.includes(i)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const r={"\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(s=>{const i=r[s];i&&e.push(i)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}const kt=(t,e)=>{if(!ae.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const r=!0,s=t.slice(e+1,e+1+ke.length).join("")===ke;return{isInsideEscape:r,isInsideLinkEscape:s}},jr=(t,e={})=>{const r=new St;let s="",i=!1,o="",a="",n=!1;const c=[...t];for(let u=0;u<c.length;u++){const l=c[u];if(l&&ae.has(l)){if(s){const k=e.getWidth?.(s)??0,v={isEscapeSequence:!1,isGrapheme:!0,text:s,width:k};if(n&&(v.isHyperlink=!0,v.hyperlinkUrl=a),e.onSegment?.(v,r)===!1)return;s=""}i=!0,o=l;const w=kt(c,u),{isInsideLinkEscape:N}=w;if(N){let k=u+1;for(a="";k<c.length;){const B=c[k];if(B===Le)break;a+=B,k+=1}a=a.slice(4);const v={hyperlinkUrl:a,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(v,r)===!1)return;u=k,n=!0,i=!1,o="";continue}if(u+1<c.length&&c[u+1]==="\\"&&n){const k={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(k,r)===!1)return;n=!1,a="",u+=1,i=!1,o="";continue}}if(i){if(o!==l&&(o+=l),l===Qe){i=!1,r.processEscape(o);const w={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};if(e.onSegment?.(w,r)===!1)return;o=""}continue}s+=l;const h=e.getWidth?.(s)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:s,width:h};if(n&&(p.isHyperlink=!0,p.hyperlinkUrl=a),e.onSegment?.(p,r)===!1)return;s=""}if(s){const u=e.getWidth?.(s)??0,l={isEscapeSequence:!1,isGrapheme:!0,text:s,width:u};n&&(l.isHyperlink=!0,l.hyperlinkUrl=a),e.onSegment?.(l,r)}if(o){const u={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};e.onSegment?.(u,r)}},lt=t=>`${ae.values().next().value}${xt}${String(t)}${Qe}`,ct=t=>`${ae.values().next().value}${ke}${t}${Le}`,Nr=t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",r,s;const i=t.join(`
1
+ import{createRequire as He}from"node:module";import{n as Ht,Z as xe,Y as Jt,J as Je,h as Se,y as yt,X as Gt,q as Ut,M as zt,a as Kt,A as be,K as Yt,k as Qt,b as Zt,c as Be,d as Xt,T as er}from"./packem_shared/index-DiAPKNwF.js";import{g as wt}from"./packem_shared/create-or-update-key-storage-DHOKZmnD.js";const tr=He(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:Q,Ge=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,r]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ie.getBuiltinModule(t)}return tr(t)},Q=ie,{execFileSync:rr}=Ge("node:child_process"),ue=Ge("node:fs"),sr=Ge("node:tty"),Ue=[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],ze=[12288,12288,65281,65376,65504,65510],Ke=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Ye=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ae=[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],ge=(t,e)=>{let r=0,s=Math.floor(t.length/2)-1;for(;r<=s;){const i=Math.floor((r+s)/2),o=i*2;if(e<t[o])s=i-1;else if(e>t[o+1])r=i+1;else return!0}return!1},ir=Ue[0],nr=Ue.at(-1),or=ze[0],ar=ze.at(-1),lr=Ke[0],cr=Ke.at(-1),ur=Ye[0],fr=Ye.at(-1),hr=Ae[0],gr=Ae.at(-1),nt=19968,[dr,pr]=mr(Ae);function mr(t){let e=t[0],r=t[1];for(let s=0;s<t.length;s+=2){const i=t[s],o=t[s+1];if(nt>=i&&nt<=o)return[i,o];o-i>r-e&&(e=i,r=o)}return[e,r]}const br=t=>t<ir||t>nr?!1:ge(Ue,t),yr=t=>t<or||t>ar?!1:ge(ze,t),wr=t=>t<lr||t>cr?!1:ge(Ke,t),$r=t=>t<ur||t>fr?!1:ge(Ye,t),vr=t=>t>=dr&&t<=pr?!0:t<hr||t>gr?!1:ge(Ae,t);function xr(t){return br(t)?"ambiguous":yr(t)?"fullwidth":wr(t)?"halfwidth":$r(t)?"narrow":vr(t)?"wide":"neutral"}function Sr(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function $t(t){return Sr(t),xr(t)}const vt=String.raw,ot=vt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,kr=()=>new RegExp(vt`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${ot}(?:\u200D${ot})*`,"gu"),ae=new Set(["\x1B","›"]),Le="\x07",xt="[",Qe="m",ke="]8;;",Er=39,Tr=/[\u200B\uFEFF\u2060-\u2064]/g,Ar=new RegExp(`(?:\\${xt}(?<code>\\d+)m|\\${ke}(?<uri>.*)${Le})`),Lr=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]])),le=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ye=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,je=kr(),at=new Map,we=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,$e=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Mr=(t,e)=>{const r=Math.floor(t/65536),s=t%65536;let i=at.get(r);if(i||(i=new Map,at.set(r,i)),i.has(s))return i.get(s);let o;if($e(t)==="latin")o=e.width.regular;else if($e(t)==="control")o=e.width.control;else if($e(t)==="wide")o=e.width.wide;else switch($t(t)){case"ambiguous":{o=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{o=e.width.fullWidth;break}case"wide":{o=e.width.wide;break}default:o=e.width.regular}return i.set(s,o),o},Or=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,Ce=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Ce(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},s=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:i}=t,o=i>1e4;let a=0,n=0,c=i,u=!1;const l=t.includes("\x1B")||t.includes("›");for(;a<i;){if(l&&(t[a]==="\x1B"||t[a]==="›")){if(t.startsWith("\x1B]8;;",a)){const v="\x1B]8;;\x07",B=v.length,V=t.indexOf("\x07",a+5);if(V!==-1){const H=t.indexOf(v,V+1);if(H!==-1){const d=H+B,g=t.slice(V+1,H).replace(le,""),$=Ce(g,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,s-n),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),I=$.width;if($.truncated)u=!0,c=Math.min(c,a);else if(n+I>s&&(c=Math.min(c,a),u=!0,n+I>r.truncation.limit))break;if(n+=I,a=d,u&&n>=r.truncation.limit)break;continue}}}if(le.lastIndex=a,le.test(t)){const v=le.lastIndex-a,B=r.truncation.countAnsiEscapeCodes?v:r.width.ansi;if(n+B>s&&(c=Math.min(c,a),n+B>r.truncation.limit)){u=!0;break}n+=B,a=le.lastIndex;continue}}const w=t.codePointAt(a);if(w===8203||w===65279||w>=8288&&w<=8292){a+=1;continue}if(w===9){if(n+r.width.tab>s&&(c=Math.min(c,a),n+r.width.tab>r.truncation.limit)){u=!0;break}n+=r.width.tab,a+=1;continue}if(we.lastIndex=a,we.test(t)){const v=(we.lastIndex-a)*r.width.regular;if(n+v>s){const B=Math.floor((s-n)/r.width.regular);if(c=Math.min(c,a+B),n+v>r.truncation.limit){u=!0;break}}n+=v,a=we.lastIndex;continue}if((w<=31||w>=127&&w<=159)&&(ye.lastIndex=a,ye.test(t))){const v=(ye.lastIndex-a)*r.width.control;if(n+v>s&&(c=Math.min(c,a+Math.floor((s-n)/r.width.control)),n+v>r.truncation.limit)){u=!0;break}n+=v,a=ye.lastIndex;continue}if(je.lastIndex=a,je.test(t)){if(n+r.width.emoji>s&&(c=Math.min(c,a),n+r.width.emoji>r.truncation.limit)){u=!0;break}n+=r.width.emoji,a=je.lastIndex;continue}const N=t.codePointAt(a)??0;if(Or(N)){a+=N>65535?2:1;continue}let k;if(o)k=Mr(N,r);else switch($e(N)){case"control":{k=r.width.control;break}case"latin":{k=r.width.regular;break}case"wide":{k=r.width.wide;break}case"zero":{k=0;break}default:switch($t(N)){case"ambiguous":{k=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{k=r.width.fullWidth;break}case"wide":{k=r.width.wide;break}default:k=r.width.regular}}if(n+k>s&&(c=Math.min(c,a),n+k>r.truncation.limit)){u=!0;break}n+=k,a+=N>65535?2:1}let h=n,p=!1;return u&&r.truncation.limit>=r.truncation.ellipsisWidth&&(h=r.truncation.limit,p=!0),{ellipsed:p,index:u?c:i,truncated:u,width:h}},Z=(t,e={})=>Ce(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Br=/\x1B\[(\d+)m/;class St{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const r=Br.exec(e);if(!r)return;const s=Number.parseInt(r[1],10);switch(s){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(s>=30&&s<=37||s>=90&&s<=97)this.activeForeground=e;else if(s>=40&&s<=47||s>=100&&s<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(s))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(s)){const i={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[s];i&&(this.activeFormatting=this.activeFormatting.filter(o=>!o.includes(i)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const r={"\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(s=>{const i=r[s];i&&e.push(i)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}const kt=(t,e)=>{if(!ae.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const r=!0,s=t.slice(e+1,e+1+ke.length).join("")===ke;return{isInsideEscape:r,isInsideLinkEscape:s}},jr=(t,e={})=>{const r=new St;let s="",i=!1,o="",a="",n=!1;const c=[...t];for(let u=0;u<c.length;u++){const l=c[u];if(l&&ae.has(l)){if(s){const k=e.getWidth?.(s)??0,v={isEscapeSequence:!1,isGrapheme:!0,text:s,width:k};if(n&&(v.isHyperlink=!0,v.hyperlinkUrl=a),e.onSegment?.(v,r)===!1)return;s=""}i=!0,o=l;const w=kt(c,u),{isInsideLinkEscape:N}=w;if(N){let k=u+1;for(a="";k<c.length;){const B=c[k];if(B===Le)break;a+=B,k+=1}a=a.slice(4);const v={hyperlinkUrl:a,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(v,r)===!1)return;u=k,n=!0,i=!1,o="";continue}if(u+1<c.length&&c[u+1]==="\\"&&n){const k={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(k,r)===!1)return;n=!1,a="",u+=1,i=!1,o="";continue}}if(i){if(o!==l&&(o+=l),l===Qe){i=!1,r.processEscape(o);const w={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};if(e.onSegment?.(w,r)===!1)return;o=""}continue}s+=l;const h=e.getWidth?.(s)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:s,width:h};if(n&&(p.isHyperlink=!0,p.hyperlinkUrl=a),e.onSegment?.(p,r)===!1)return;s=""}if(s){const u=e.getWidth?.(s)??0,l={isEscapeSequence:!1,isGrapheme:!0,text:s,width:u};n&&(l.isHyperlink=!0,l.hyperlinkUrl=a),e.onSegment?.(l,r)}if(o){const u={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};e.onSegment?.(u,r)}},lt=t=>`${ae.values().next().value}${xt}${String(t)}${Qe}`,ct=t=>`${ae.values().next().value}${ke}${t}${Le}`,Nr=t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",r,s;const i=t.join(`
2
2
  `),o=[...i];let a=0;for(const[n,c]of o.entries()){if(e+=c,ae.has(c)){const l=Ar.exec(i.slice(a))?.groups??{};if(l.code!==void 0){const h=Number.parseFloat(l.code);r=h===Er?void 0:h}else l.uri!==void 0&&(s=l.uri.length===0?void 0:l.uri)}const u=Lr.get(Number(r));o[n+1]===`
3
3
  `?(s&&(e+=ct("")),r&&u&&(e+=lt(u))):c===`
4
4
  `&&(r&&u&&(e+=lt(r)),s&&(e+=ct(s))),a+=c.length}return e},Et=/(?=\s)|(?<=\s)/,Tt=/^\s+$/,Ne=t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},te=t=>{const e=t.split(" ");let r=e.length;for(;r>0&&Z(e[r-1])===0;)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},At=(t,e,r)=>{if(t.length===0)return[""];if(e<=0)return[t];const s=[],i=new St;let o="",a=0,n=!1,c=!1,u="",l=0;for(;l<t.length;){const h=t[l];if(ae.has(h)){n=!0,u=h,o+=h,c=kt([...t],l).isInsideLinkEscape,l+=1;continue}if(n){u+=h,o+=h,c?h===Le&&(n=c=!1):h===Qe&&(n=!1,i.processEscape(u)),l+=1;continue}const p=Z(h),w=h===" ";if(p===0){o+=h,l+=1;continue}if(a+p>e&&(o&&s.push(o+i.getEndEscapesForAllActiveAttributes()),o=i.getStartEscapesForAllActiveAttributes(),a=Z(o),w&&r)){for(;l<t.length&&t[l]===" ";)l+=1;continue}if(o+=h,a+=p,a===e&&l<t.length-1&&(s.push(o+i.getEndEscapesForAllActiveAttributes()),o=i.getStartEscapesForAllActiveAttributes(),a=Z(o),l+1<t.length&&t[l+1]===" "&&r)){for(l+=1;l<t.length&&t[l]===" ";)l+=1;continue}l+=1}return o&&s.push(o+i.getEndEscapesForAllActiveAttributes()),r?s.map(h=>te(h)):s},Ir=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=[];let o="",a=0;return jr(s,{getWidth:Z,onSegment:(n,c)=>{const u=n.text??"";if(n.isEscapeSequence)o+=u;else{const l=u===" ";if(n.width===0)return o+=u,!0;if(a+n.width>e&&(o&&i.push(o),o=c.getStartEscapesForAllActiveAttributes(),a=0,l))return r||i.push(c.getStartEscapesForAllActiveAttributes()+u),!0;o+=u,a+=n.width}return!0}}),o&&i.push(o),r?i.map(n=>te(n)):i},Pr=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=s.split(Et),o=[];let a="",n=0,c=0;for(;c<i.length;){const u=i[c],l=Tt.test(u),h=Z(u);if(u.length===0){c+=1;continue}if(r&&l&&n===0){c+=1;continue}if(n+h>e&&n>0){r?o.push(te(a)):o.push(a),a="",n=0;continue}a+=u,n+=h,c+=1}return a&&(r?o.push(te(a)):o.push(a)),o},Fr=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=s.split(Et),o=[];let a="",n=0,c=0;for(;c<i.length;){const u=i[c],l=Tt.test(u),h=Z(u);if(u.length===0){c+=1;continue}if(r&&l&&n===0){c+=1;continue}if(h>e){a&&o.push(Ne(r?te(a):a));const p=At(u,e,r);if(p.length>0){for(let w=0;w<p.length-1;w+=1)o.push(p[w]);a=p.at(-1),n=Z(a)}else a="",n=0;c+=1;continue}if(n+h>e&&n>0&&(o.push(Ne(r?te(a):a)),a="",n=0,r&&l)){c+=1;continue}a+=u,n+=h,c+=1}return a&&o.push(Ne(r?te(a):a)),o},fe={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Rr=(t,e={})=>{const{removeZeroWidthCharacters:r=!0,trim:s=!0,width:i=80,wrapMode:o=fe.PRESERVE_WORDS}=e;if(s&&t.trim()==="")return"";let a=t.normalize("NFC").replaceAll(`\r
@@ -44,7 +44,7 @@ ${Ko(k,{...this.#n,filterStacktrace:es,prefix:b})}`;if(typeof k=="object")return
44
44
 
45
45
  ${Ko($,{...this.#n,filterStacktrace:es,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:b})}`),h&&v.push(` ${b}${vt(this.styles.underline.suffix?Ol(h):h)}`),l){const j=(l.name??"")+(l.line?`:${String(l.line)}`:""),k=Math.max(0,E-Ne("Caller: "));v.push(`
46
46
  `,vt("Caller: ")," ".repeat(k),j,`
47
- `)}return v.join("")}};var NO="@visulima/packem",of="2.0.0-alpha.91";const PO={version:of};var kb=Object.defineProperty,sf=(e,t)=>kb(e,"name",{value:t,configurable:!0}),jb=Object.defineProperty,Ab=sf((e,t)=>jb(e,"name",{value:t,configurable:!0}),"o");let _O=class extends Error{static{sf(this,"n")}static{Ab(this,"DirectoryError")}constructor(t){super(`EISDIR: Illegal operation on a directory, ${t}`)}get code(){return"EISDIR"}set code(t){throw new Error("Cannot overwrite code EISDIR")}get name(){return"DirectoryError"}set name(t){throw new Error("Cannot overwrite name of DirectoryError")}};var Ob=Object.defineProperty,af=(e,t)=>Ob(e,"name",{value:t,configurable:!0}),Rb=Object.defineProperty,Cb=af((e,t)=>Rb(e,"name",{value:t,configurable:!0}),"t");let IO=class extends Error{static{af(this,"n")}static{Cb(this,"NotEmptyError")}constructor(t){super(`ENOTEMPTY: Directory not empty, ${t}`)}get code(){return"ENOTEMPTY"}set code(t){throw new Error("Cannot overwrite code ENOTEMPTY")}get name(){return"NotEmptyError"}set name(t){throw new Error("Cannot overwrite name of NotEmptyError")}};var Tb=Object.defineProperty,lf=(e,t)=>Tb(e,"name",{value:t,configurable:!0}),Nb=Object.defineProperty,Pb=lf((e,t)=>Nb(e,"name",{value:t,configurable:!0}),"o");let Mt=class extends Error{static{lf(this,"n")}static{Pb(this,"NotFoundError")}constructor(t){super(`ENOENT: ${t}`)}get code(){return"ENOENT"}set code(t){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(t){throw new Error("Cannot overwrite name of NotFoundError")}};var _b=Object.defineProperty,Mb=(e,t)=>_b(e,"name",{value:t,configurable:!0}),Ib=Object.defineProperty,Wb=Mb((e,t)=>Ib(e,"name",{value:t,configurable:!0}),"n");Wb((e,{whitespace:t=!0}={})=>e.replace(Sm,r=>r.startsWith('"')||r[1]==="*"&&!r.endsWith("*/")?r:t?r.replaceAll(/\S/g," "):""),"stripJsonComments");var Bb=Object.defineProperty,cf=(e,t)=>Bb(e,"name",{value:t,configurable:!0}),Db=Object.defineProperty,Lb=cf((e,t)=>Db(e,"name",{value:t,configurable:!0}),"r");async function Ro(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=await Hu(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Hn(l,t,a):Hn(l,a)}cf(Ro,"l");Lb(Ro,"readYaml");var Fb=Object.defineProperty,uf=(e,t)=>Fb(e,"name",{value:t,configurable:!0}),Hb=Object.defineProperty,qb=uf((e,t)=>Hb(e,"name",{value:t,configurable:!0}),"t");function Co(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=Fi(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Hn(l,t,a):Hn(l,a)}uf(Co,"l");qb(Co,"readYamlSync");var Jb=Object.defineProperty,pf=(e,t)=>Jb(e,"name",{value:t,configurable:!0}),zb=Object.defineProperty,Ub=pf((e,t)=>zb(e,"name",{value:t,configurable:!0}),"a");async function ff(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Xu(t,s,i??o);await km(e,a,o)}pf(ff,"c");Ub(ff,"writeYaml");var Gb=Object.defineProperty,df=(e,t)=>Gb(e,"name",{value:t,configurable:!0}),Vb=Object.defineProperty,Kb=df((e,t)=>Vb(e,"name",{value:t,configurable:!0}),"a");function mf(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Xu(t,s,i??o);po(e,a,o)}df(mf,"c");Kb(mf,"writeYamlSync");var Yb=Object.defineProperty,Xb=(e,t)=>Yb(e,"name",{value:t,configurable:!0}),Zb=Object.defineProperty,ur=Xb((e,t)=>Zb(e,"name",{value:t,configurable:!0}),"c");const hf=ur((e,t,r)=>{const n=Z(e),o=Z(t),s=o===n?".":ke(n,o);return r.some(i=>{const a=i.startsWith("./")?i.slice(2):i,l=s.startsWith("./")?s.slice(2):s;if(a==="."&&l===".")return!0;if(a.endsWith("/**")){const u=a.slice(0,-3);return l===u||l.startsWith(`${u}/`)}if(a.endsWith("/*")){const u=a.slice(0,-2);return u===""?l!=="."&&!l.includes("/"):l.startsWith(`${u}/`)||l===u}return l===a||l.startsWith(`${a}/`)})},"isPackageInWorkspace"),gf=ur(async e=>{const t=await ft("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=await Ro(t),n=Array.isArray(r.packages)?r.packages:[];if(!hf(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogs"),yf=ur(e=>{const t=dt("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=Co(t),n=Array.isArray(r.packages)?r.packages:[];if(!hf(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogsSync"),Qb=ur((e,t,r)=>{if(t==="catalog:")return r.catalog?.[e];if(t.startsWith("catalog:")){const n=t.slice(8);return r.catalogs?.[n]?.[e]}},"resolveCatalogReference"),e1=ur((e,t)=>{for(const[r,n]of Object.entries(e)){if(typeof n!="string")continue;const o=Qb(r,n,t);o&&(e[r]=o)}},"resolveDependenciesCatalogReferences"),To=ur((e,t)=>{const r=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const n of r){if(!e[n]||typeof e[n]!="object")continue;const o=e[n];e1(o,t)}},"resolveCatalogReferences");var t1=Object.defineProperty,ye=(e,t)=>t1(e,"name",{value:t,configurable:!0});const r1=Me(import.meta.url),yr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,pa=ye(e=>{if(typeof yr<"u"&&yr.versions&&yr.versions.node){const[t,r]=yr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return yr.getBuiltinModule(e)}return r1(e)},"__cjs_getBuiltinModule"),{existsSync:$f}=pa("node:fs"),{createInterface:n1}=pa("node:readline"),{styleText:Te}=pa("node:util");var o1=Object.defineProperty,we=ye((e,t)=>o1(e,"name",{value:t,configurable:!0}),"f");const Ye=we(e=>{const t=typeof e;return e!==null&&(t==="object"||t==="function")},"isObject"),s1=we(e=>{if(!Ye(e))return!1;for(const t in e)if(Object.hasOwn(e,t))return!1;return!0},"isEmptyObject"),bf=new Set(["__proto__","prototype","constructor"]),wf=1e6,i1=we(e=>e>="0"&&e<="9","isDigit");function pr(e){if(e==="0")return!0;if(/^[1-9]\d*$/.test(e)){const t=Number.parseInt(e,10);return t<=Number.MAX_SAFE_INTEGER&&t<=wf}return!1}ye(pr,"p$1");we(pr,"shouldCoerceToNumber");function Dr(e,t){return bf.has(e)?!1:(e&&pr(e)?t.push(Number.parseInt(e,10)):t.push(e),!0)}ye(Dr,"y");we(Dr,"processSegment");function fa(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);const t=[];let r="",n="start",o=!1,s=0;for(const i of e){if(s++,o){r+=i,o=!1;continue}if(i==="\\"){if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);o=!0,n=n==="start"?"property":n;continue}switch(i){case".":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="property";break}if(!Dr(r,t))return[];r="",n="property";break}case"[":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="index";break}if(n==="property"||n==="start"){if((r||n==="property")&&!Dr(r,t))return[];r=""}n="index";break}case"]":{if(n==="index"){if(r==="")r=(t.pop()||"")+"[]",n="property";else{const a=Number.parseInt(r,10);!Number.isNaN(a)&&Number.isFinite(a)&&a>=0&&a<=Number.MAX_SAFE_INTEGER&&a<=wf&&r===String(a)?t.push(a):t.push(r),r="",n="indexEnd"}break}if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);r+=i;break}default:{if(n==="index"&&!i1(i))throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);n==="start"&&(n="property"),r+=i}}}switch(o&&(r+="\\"),n){case"property":{if(!Dr(r,t))return[];break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}ye(fa,"parsePath");we(fa,"parsePath");function fr(e){if(typeof e=="string")return fa(e);if(Array.isArray(e)){const t=[];for(const[r,n]of e.entries()){if(typeof n!="string"&&typeof n!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof n}`);if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`Path segment at index ${r} must be a finite number, got ${n}`);if(bf.has(n))return[];typeof n=="string"&&pr(n)?t.push(Number.parseInt(n,10)):t.push(n)}return t}return[]}ye(fr,"d");we(fr,"normalizePath");function nt(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return r===void 0?e:r;const n=fr(t);if(n.length===0)return r;for(let o=0;o<n.length;o++){const s=n[o];if(e=e[s],e==null){if(o!==n.length-1)return r;break}}return e===void 0?r:e}ye(nt,"getProperty");we(nt,"getProperty");function da(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return e;const n=e,o=fr(t);if(o.length===0)return e;for(let s=0;s<o.length;s++){const i=o[s];if(s===o.length-1)e[i]=r;else if(!Ye(e[i])){const a=typeof o[s+1]=="number";e[i]=a?[]:{}}e=e[i]}return n}ye(da,"setProperty");we(da,"setProperty");function vf(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(let n=0;n<r.length;n++){const o=r[n];if(n===r.length-1)return Object.hasOwn(e,o)?(delete e[o],!0):!1;if(e=e[o],!Ye(e))return!1}}ye(vf,"deleteProperty");we(vf,"deleteProperty");function Ot(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(const n of r){if(!Ye(e)||!(n in e))return!1;e=e[n]}return!0}ye(Ot,"hasProperty");we(Ot,"hasProperty");function Gn(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return e.replaceAll(/[\\.[]/g,String.raw`\$&`)}ye(Gn,"escapePath");we(Gn,"escapePath");function ma(e){const t=Object.entries(e);return Array.isArray(e)?t.map(([r,n])=>[pr(r)?Number.parseInt(r,10):r,n]):t}ye(ma,"m$2");we(ma,"normalizeEntries");function ha(e,t={}){if(!Array.isArray(e))throw new TypeError(`Expected an array, got ${typeof e}`);const{preferDotForIndices:r=!1}=t,n=[];for(const[o,s]of e.entries()){if(typeof s!="string"&&typeof s!="number")throw new TypeError(`Expected a string or number for path segment at index ${o}, got ${typeof s}`);if(typeof s=="number")if(!Number.isInteger(s)||s<0){const i=Gn(String(s));n.push(o===0?i:`.${i}`)}else r&&o>0?n.push(`.${s}`):n.push(`[${s}]`);else if(typeof s=="string")if(s==="")o===0||n.push(".");else if(pr(s)){const i=Number.parseInt(s,10);r&&o>0?n.push(`.${i}`):n.push(`[${i}]`)}else{const i=Gn(s);n.push(o===0?i:`.${i}`)}}return n.join("")}ye(ha,"stringifyPath");we(ha,"stringifyPath");function*No(e,t=[],r=new Set){if(!Ye(e)||s1(e)){t.length>0&&(yield ha(t));return}if(!r.has(e)){r.add(e);for(const[n,o]of ma(e))t.push(n),yield*No(o,t,r),t.pop();r.delete(e)}}ye(No,"x");we(No,"deepKeysIterator");function xf(e){return[...No(e)]}ye(xf,"deepKeys");we(xf,"deepKeys");function Ef(e){const t={};if(!Ye(e))return t;for(const[r,n]of Object.entries(e))da(t,r,n);return t}ye(Ef,"unflatten");we(Ef,"unflatten");var a1=Object.defineProperty,ts=ye((e,t)=>a1(e,"name",{value:t,configurable:!0}),"i");const l1=ts(async e=>{const{default:t=!1,message:r,transformer:n}=e,o=ts(i=>{const a=Te(["cyan","bold"],"?"),l=Te(["bold"],i),u=t?`${Te(["greenBright"],"Y")}${Te(["gray"],"/n")}`:`y/${Te(["yellowBright"],"N")}`;return`${a} ${l} ${Te(["gray"],`(${u})`)}`},"formatMessage"),s=ts(i=>n?n(i):i?Te(["greenBright"],"Yes"):Te(["yellowBright"],"No"),"formatAnswer");return new Promise(i=>{const a=n1({input:process.stdin,output:process.stdout}),l=o(r);a.question(l,u=>{a.close();const c=u.trim().toLowerCase();if(c===""){i(t);return}if(c==="y"||c==="yes"){console.log(`${Te(["greenBright"],"✓")} ${s(!0)}`),i(!0);return}if(c==="n"||c==="no"){console.log(`${Te(["yellowBright"],"✗")} ${s(!1)}`),i(!1);return}console.log(`${Te(["gray"],"→")} ${s(t)}`),i(t)}),a.on("SIGINT",()=>{a.close(),console.log(`
47
+ `)}return v.join("")}};var NO="@visulima/packem",of="2.0.0-alpha.92";const PO={version:of};var kb=Object.defineProperty,sf=(e,t)=>kb(e,"name",{value:t,configurable:!0}),jb=Object.defineProperty,Ab=sf((e,t)=>jb(e,"name",{value:t,configurable:!0}),"o");let _O=class extends Error{static{sf(this,"n")}static{Ab(this,"DirectoryError")}constructor(t){super(`EISDIR: Illegal operation on a directory, ${t}`)}get code(){return"EISDIR"}set code(t){throw new Error("Cannot overwrite code EISDIR")}get name(){return"DirectoryError"}set name(t){throw new Error("Cannot overwrite name of DirectoryError")}};var Ob=Object.defineProperty,af=(e,t)=>Ob(e,"name",{value:t,configurable:!0}),Rb=Object.defineProperty,Cb=af((e,t)=>Rb(e,"name",{value:t,configurable:!0}),"t");let IO=class extends Error{static{af(this,"n")}static{Cb(this,"NotEmptyError")}constructor(t){super(`ENOTEMPTY: Directory not empty, ${t}`)}get code(){return"ENOTEMPTY"}set code(t){throw new Error("Cannot overwrite code ENOTEMPTY")}get name(){return"NotEmptyError"}set name(t){throw new Error("Cannot overwrite name of NotEmptyError")}};var Tb=Object.defineProperty,lf=(e,t)=>Tb(e,"name",{value:t,configurable:!0}),Nb=Object.defineProperty,Pb=lf((e,t)=>Nb(e,"name",{value:t,configurable:!0}),"o");let Mt=class extends Error{static{lf(this,"n")}static{Pb(this,"NotFoundError")}constructor(t){super(`ENOENT: ${t}`)}get code(){return"ENOENT"}set code(t){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(t){throw new Error("Cannot overwrite name of NotFoundError")}};var _b=Object.defineProperty,Mb=(e,t)=>_b(e,"name",{value:t,configurable:!0}),Ib=Object.defineProperty,Wb=Mb((e,t)=>Ib(e,"name",{value:t,configurable:!0}),"n");Wb((e,{whitespace:t=!0}={})=>e.replace(Sm,r=>r.startsWith('"')||r[1]==="*"&&!r.endsWith("*/")?r:t?r.replaceAll(/\S/g," "):""),"stripJsonComments");var Bb=Object.defineProperty,cf=(e,t)=>Bb(e,"name",{value:t,configurable:!0}),Db=Object.defineProperty,Lb=cf((e,t)=>Db(e,"name",{value:t,configurable:!0}),"r");async function Ro(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=await Hu(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Hn(l,t,a):Hn(l,a)}cf(Ro,"l");Lb(Ro,"readYaml");var Fb=Object.defineProperty,uf=(e,t)=>Fb(e,"name",{value:t,configurable:!0}),Hb=Object.defineProperty,qb=uf((e,t)=>Hb(e,"name",{value:t,configurable:!0}),"t");function Co(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=Fi(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Hn(l,t,a):Hn(l,a)}uf(Co,"l");qb(Co,"readYamlSync");var Jb=Object.defineProperty,pf=(e,t)=>Jb(e,"name",{value:t,configurable:!0}),zb=Object.defineProperty,Ub=pf((e,t)=>zb(e,"name",{value:t,configurable:!0}),"a");async function ff(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Xu(t,s,i??o);await km(e,a,o)}pf(ff,"c");Ub(ff,"writeYaml");var Gb=Object.defineProperty,df=(e,t)=>Gb(e,"name",{value:t,configurable:!0}),Vb=Object.defineProperty,Kb=df((e,t)=>Vb(e,"name",{value:t,configurable:!0}),"a");function mf(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Xu(t,s,i??o);po(e,a,o)}df(mf,"c");Kb(mf,"writeYamlSync");var Yb=Object.defineProperty,Xb=(e,t)=>Yb(e,"name",{value:t,configurable:!0}),Zb=Object.defineProperty,ur=Xb((e,t)=>Zb(e,"name",{value:t,configurable:!0}),"c");const hf=ur((e,t,r)=>{const n=Z(e),o=Z(t),s=o===n?".":ke(n,o);return r.some(i=>{const a=i.startsWith("./")?i.slice(2):i,l=s.startsWith("./")?s.slice(2):s;if(a==="."&&l===".")return!0;if(a.endsWith("/**")){const u=a.slice(0,-3);return l===u||l.startsWith(`${u}/`)}if(a.endsWith("/*")){const u=a.slice(0,-2);return u===""?l!=="."&&!l.includes("/"):l.startsWith(`${u}/`)||l===u}return l===a||l.startsWith(`${a}/`)})},"isPackageInWorkspace"),gf=ur(async e=>{const t=await ft("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=await Ro(t),n=Array.isArray(r.packages)?r.packages:[];if(!hf(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogs"),yf=ur(e=>{const t=dt("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=Co(t),n=Array.isArray(r.packages)?r.packages:[];if(!hf(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogsSync"),Qb=ur((e,t,r)=>{if(t==="catalog:")return r.catalog?.[e];if(t.startsWith("catalog:")){const n=t.slice(8);return r.catalogs?.[n]?.[e]}},"resolveCatalogReference"),e1=ur((e,t)=>{for(const[r,n]of Object.entries(e)){if(typeof n!="string")continue;const o=Qb(r,n,t);o&&(e[r]=o)}},"resolveDependenciesCatalogReferences"),To=ur((e,t)=>{const r=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const n of r){if(!e[n]||typeof e[n]!="object")continue;const o=e[n];e1(o,t)}},"resolveCatalogReferences");var t1=Object.defineProperty,ye=(e,t)=>t1(e,"name",{value:t,configurable:!0});const r1=Me(import.meta.url),yr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,pa=ye(e=>{if(typeof yr<"u"&&yr.versions&&yr.versions.node){const[t,r]=yr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return yr.getBuiltinModule(e)}return r1(e)},"__cjs_getBuiltinModule"),{existsSync:$f}=pa("node:fs"),{createInterface:n1}=pa("node:readline"),{styleText:Te}=pa("node:util");var o1=Object.defineProperty,we=ye((e,t)=>o1(e,"name",{value:t,configurable:!0}),"f");const Ye=we(e=>{const t=typeof e;return e!==null&&(t==="object"||t==="function")},"isObject"),s1=we(e=>{if(!Ye(e))return!1;for(const t in e)if(Object.hasOwn(e,t))return!1;return!0},"isEmptyObject"),bf=new Set(["__proto__","prototype","constructor"]),wf=1e6,i1=we(e=>e>="0"&&e<="9","isDigit");function pr(e){if(e==="0")return!0;if(/^[1-9]\d*$/.test(e)){const t=Number.parseInt(e,10);return t<=Number.MAX_SAFE_INTEGER&&t<=wf}return!1}ye(pr,"p$1");we(pr,"shouldCoerceToNumber");function Dr(e,t){return bf.has(e)?!1:(e&&pr(e)?t.push(Number.parseInt(e,10)):t.push(e),!0)}ye(Dr,"y");we(Dr,"processSegment");function fa(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);const t=[];let r="",n="start",o=!1,s=0;for(const i of e){if(s++,o){r+=i,o=!1;continue}if(i==="\\"){if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);o=!0,n=n==="start"?"property":n;continue}switch(i){case".":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="property";break}if(!Dr(r,t))return[];r="",n="property";break}case"[":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="index";break}if(n==="property"||n==="start"){if((r||n==="property")&&!Dr(r,t))return[];r=""}n="index";break}case"]":{if(n==="index"){if(r==="")r=(t.pop()||"")+"[]",n="property";else{const a=Number.parseInt(r,10);!Number.isNaN(a)&&Number.isFinite(a)&&a>=0&&a<=Number.MAX_SAFE_INTEGER&&a<=wf&&r===String(a)?t.push(a):t.push(r),r="",n="indexEnd"}break}if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);r+=i;break}default:{if(n==="index"&&!i1(i))throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);n==="start"&&(n="property"),r+=i}}}switch(o&&(r+="\\"),n){case"property":{if(!Dr(r,t))return[];break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}ye(fa,"parsePath");we(fa,"parsePath");function fr(e){if(typeof e=="string")return fa(e);if(Array.isArray(e)){const t=[];for(const[r,n]of e.entries()){if(typeof n!="string"&&typeof n!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof n}`);if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`Path segment at index ${r} must be a finite number, got ${n}`);if(bf.has(n))return[];typeof n=="string"&&pr(n)?t.push(Number.parseInt(n,10)):t.push(n)}return t}return[]}ye(fr,"d");we(fr,"normalizePath");function nt(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return r===void 0?e:r;const n=fr(t);if(n.length===0)return r;for(let o=0;o<n.length;o++){const s=n[o];if(e=e[s],e==null){if(o!==n.length-1)return r;break}}return e===void 0?r:e}ye(nt,"getProperty");we(nt,"getProperty");function da(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return e;const n=e,o=fr(t);if(o.length===0)return e;for(let s=0;s<o.length;s++){const i=o[s];if(s===o.length-1)e[i]=r;else if(!Ye(e[i])){const a=typeof o[s+1]=="number";e[i]=a?[]:{}}e=e[i]}return n}ye(da,"setProperty");we(da,"setProperty");function vf(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(let n=0;n<r.length;n++){const o=r[n];if(n===r.length-1)return Object.hasOwn(e,o)?(delete e[o],!0):!1;if(e=e[o],!Ye(e))return!1}}ye(vf,"deleteProperty");we(vf,"deleteProperty");function Ot(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(const n of r){if(!Ye(e)||!(n in e))return!1;e=e[n]}return!0}ye(Ot,"hasProperty");we(Ot,"hasProperty");function Gn(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return e.replaceAll(/[\\.[]/g,String.raw`\$&`)}ye(Gn,"escapePath");we(Gn,"escapePath");function ma(e){const t=Object.entries(e);return Array.isArray(e)?t.map(([r,n])=>[pr(r)?Number.parseInt(r,10):r,n]):t}ye(ma,"m$2");we(ma,"normalizeEntries");function ha(e,t={}){if(!Array.isArray(e))throw new TypeError(`Expected an array, got ${typeof e}`);const{preferDotForIndices:r=!1}=t,n=[];for(const[o,s]of e.entries()){if(typeof s!="string"&&typeof s!="number")throw new TypeError(`Expected a string or number for path segment at index ${o}, got ${typeof s}`);if(typeof s=="number")if(!Number.isInteger(s)||s<0){const i=Gn(String(s));n.push(o===0?i:`.${i}`)}else r&&o>0?n.push(`.${s}`):n.push(`[${s}]`);else if(typeof s=="string")if(s==="")o===0||n.push(".");else if(pr(s)){const i=Number.parseInt(s,10);r&&o>0?n.push(`.${i}`):n.push(`[${i}]`)}else{const i=Gn(s);n.push(o===0?i:`.${i}`)}}return n.join("")}ye(ha,"stringifyPath");we(ha,"stringifyPath");function*No(e,t=[],r=new Set){if(!Ye(e)||s1(e)){t.length>0&&(yield ha(t));return}if(!r.has(e)){r.add(e);for(const[n,o]of ma(e))t.push(n),yield*No(o,t,r),t.pop();r.delete(e)}}ye(No,"x");we(No,"deepKeysIterator");function xf(e){return[...No(e)]}ye(xf,"deepKeys");we(xf,"deepKeys");function Ef(e){const t={};if(!Ye(e))return t;for(const[r,n]of Object.entries(e))da(t,r,n);return t}ye(Ef,"unflatten");we(Ef,"unflatten");var a1=Object.defineProperty,ts=ye((e,t)=>a1(e,"name",{value:t,configurable:!0}),"i");const l1=ts(async e=>{const{default:t=!1,message:r,transformer:n}=e,o=ts(i=>{const a=Te(["cyan","bold"],"?"),l=Te(["bold"],i),u=t?`${Te(["greenBright"],"Y")}${Te(["gray"],"/n")}`:`y/${Te(["yellowBright"],"N")}`;return`${a} ${l} ${Te(["gray"],`(${u})`)}`},"formatMessage"),s=ts(i=>n?n(i):i?Te(["greenBright"],"Yes"):Te(["yellowBright"],"No"),"formatAnswer");return new Promise(i=>{const a=n1({input:process.stdin,output:process.stdout}),l=o(r);a.question(l,u=>{a.close();const c=u.trim().toLowerCase();if(c===""){i(t);return}if(c==="y"||c==="yes"){console.log(`${Te(["greenBright"],"✓")} ${s(!0)}`),i(!0);return}if(c==="n"||c==="no"){console.log(`${Te(["yellowBright"],"✗")} ${s(!1)}`),i(!1);return}console.log(`${Te(["gray"],"→")} ${s(t)}`),i(t)}),a.on("SIGINT",()=>{a.close(),console.log(`
48
48
  ${Te(["gray"],"→")} ${s(t)}`),i(t)})})},"confirm"),c1=typeof process.stdout<"u"&&!process.versions.deno&&!globalThis.window;var u1=Object.defineProperty,be=ye((e,t)=>u1(e,"name",{value:t,configurable:!0}),"l");const Sf=/, ([^,]*)$/,Vn=new Map,kf=new Map;let p1=class extends Error{static{ye(this,"M")}static{be(this,"PackageJsonValidationError")}constructor(t){super(`The following warnings were encountered while normalizing package data:
49
49
  - ${t.join(`
50
50
  - `)}`),this.name="PackageJsonValidationError"}};const Po=be((e,t,r=[])=>{const n=[];if(Im(e,o=>{n.push(o)},t),t&&n.length>0){const o=n.filter(s=>!r.some(i=>i instanceof RegExp?i.test(s):i===s));if(o.length>0)throw new p1(o)}return e},"normalizeInput"),f1=be(async e=>await Ro(e),"parseYamlFile"),d1=be(e=>Co(e),"parseYamlFileSync"),m1=be(async e=>{const t=await Hu(e);return Zu.parse(t)},"parseJson5File"),h1=be(e=>{const t=Fi(e);return Zu.parse(t)},"parseJson5FileSync"),jf=be(async(e,t)=>t?.yaml!==!1&&(e.endsWith(".yaml")||e.endsWith(".yml"))?f1(e):t?.json5!==!1&&e.endsWith(".json5")?m1(e):fo(e),"parsePackageFile"),Af=be((e,t)=>t?.yaml!==!1&&(e.endsWith(".yaml")||e.endsWith(".yml"))?d1(e):t?.json5!==!1&&e.endsWith(".json5")?h1(e):Hi(e),"parsePackageFileSync");be(async(e,t={})=>{const r={type:"file"};e&&(r.cwd=e);const n=["package.json"];t.yaml!==!1&&n.push("package.yaml","package.yml"),t.json5!==!1&&n.push("package.json5");let o;for(const l of n)if(o=await ft(l,r),o)break;if(!o)throw new Mt(`No such file or directory, for ${n.join(", ").replace(Sf," or $1")} found.`);const s=t.cache&&typeof t.cache!="boolean"?t.cache:kf;if(t.cache&&s.has(o))return s.get(o);const i=await jf(o,t);if(t.resolveCatalogs){const l=await gf(o);l&&To(i,l)}Po(i,t.strict??!1,t.ignoreWarnings);const a={packageJson:i,path:o};return t.cache&&s.set(o,a),a},"findPackageJson");be((e,t={})=>{const r={type:"file"};e&&(r.cwd=e);const n=["package.json"];t.yaml!==!1&&n.push("package.yaml","package.yml"),t.json5!==!1&&n.push("package.json5");let o;for(const l of n)if(o=dt(l,r),o)break;if(!o)throw new Mt(`No such file or directory, for ${n.join(", ").replace(Sf," or $1")} found.`);const s=t.cache&&typeof t.cache!="boolean"?t.cache:kf;if(t.cache&&s.has(o))return s.get(o);const i=Af(o,t);if(t.resolveCatalogs){const l=yf(o);l&&To(i,l)}Po(i,t.strict??!1,t.ignoreWarnings);const a={packageJson:i,path:o};return t.cache&&s.set(o,a),a},"findPackageJsonSync");be(async(e,t={})=>{const{cwd:r,...n}=t,o=Fr(r??process.cwd());await Ju(G(o,"package.json"),e,n)},"writePackageJson");be((e,t={})=>{const{cwd:r,...n}=t,o=Fr(r??process.cwd());jm(G(o,"package.json"),e,n)},"writePackageJsonSync");const ga=be((e,t)=>{const r=typeof e=="object"&&!Array.isArray(e);if(!r&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");let n,o=!1,s;if(r)n=structuredClone(e);else if($f(e)){s=e;const a=t?.cache&&typeof t.cache!="boolean"?t.cache:Vn;if(t?.cache&&a.has(s))return a.get(s);n=Af(s,t),o=!0}else n=qu(e);if(t?.resolveCatalogs)if(o){const a=yf(e);a&&To(n,a)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");Po(n,t?.strict??!1,t?.ignoreWarnings);const i=n;return o&&t?.cache&&(typeof t.cache=="boolean"?Vn:t.cache).set(s,i),i},"parsePackageJsonSync"),LO=be(async(e,t)=>{const r=typeof e=="object"&&!Array.isArray(e);if(!r&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");let n,o=!1,s;if(r)n=structuredClone(e);else if($f(e)){s=e;const a=t?.cache&&typeof t.cache!="boolean"?t.cache:Vn;if(t?.cache&&a.has(s))return a.get(s);n=await jf(s,t),o=!0}else n=qu(e);if(t?.resolveCatalogs)if(o){const a=await gf(e);a&&To(n,a)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");Po(n,t?.strict??!1,t?.ignoreWarnings);const i=n;return o&&t?.cache&&(typeof t.cache=="boolean"?Vn:t.cache).set(s,i),i},"parsePackageJson");be((e,t,r)=>nt(e,t,r),"getPackageJsonProperty");be((e,t)=>Ot(e,t),"hasPackageJsonProperty");const Of=be((e,t,r)=>{const n=nt(e,"dependencies",{}),o=nt(e,"devDependencies",{}),s=nt(e,"peerDependencies",{}),i={...n,...o,...r?.peerDeps===!1?{}:s};for(const a of t)if(Ot(i,a))return!0;return!1},"hasPackageJsonAnyDependency"),g1=be(async(e,t,r="dependencies",n={})=>{const o=nt(e,"dependencies",{}),s=nt(e,"devDependencies",{}),i=nt(e,"peerDependencies",{}),a=[],l={deps:!0,devDeps:!0,peerDeps:!1,...n};for(const u of t)l.deps&&Ot(o,u)||l.devDeps&&Ot(s,u)||l.peerDeps&&Ot(i,u)||a.push(u);if(a.length!==0){if(process.env.CI||c1&&!process.stdout.isTTY){const u=`Skipping package installation for [${t.join(", ")}] because the process is not interactive.`;if(n.throwOnWarn)throw new Error(u);n.logger?.warn?n.logger.warn(u):console.warn(u);return}if(typeof l.confirm?.message=="function"&&(l.confirm.message=l.confirm.message(a)),l.confirm?.message===void 0){const u=`${a.length===1?"Package is":"Packages are"} required for this config: ${a.join(", ")}. Do you want to install them?`;l.confirm===void 0?l.confirm={message:u}:l.confirm.message=u}await l1(l.confirm)&&await Yu(a,{...l.installPackage,cwd:l.cwd?Fr(l.cwd):void 0,dev:r==="devDependencies"})}},"ensurePackages"),Kn=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"],y1=/\.(?:js|mjs|cjs|ts|cts|mts)$/,FO=async(e,t="")=>{if(t){const r=Tt(t)?t:G(e,t);if(!y1.test(r))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");if(!await Ct(r))throw new Error(`The packem config file "${t}" could not be found at "${r}".`);return r}for(const r of Kn){const n=G(e,r);if(await Ct(n))return n}throw new Error(`No packem config file found in "${e}". Expected one of: ${Kn.join(", ")}.`)},HO=async e=>{for(const t of Kn)if(await Ct(G(e,t)))return!0;return!1},$1={esbuild:"esbuild",oxc:"oxc-transform",sucrase:"sucrase",swc:"@swc/core"},Rl=async(e,t)=>{const r=Array.isArray(e)?e:[e],n=await Mm(t).catch(()=>{});let o;return n==="yarn"||n==="bun"?o=`${n} add -D`:n==="pnpm"?o="pnpm add -D":o="npm install -D",`${o} ${r.join(" ")}`},Yn=e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},ki=(e,t,r,n)=>{if(e==="module-sync")return"esm";if(n){const i=Yn(n);if(i)return i}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return r;const[o,...s]=t;return ki(o,s,r,n)},b1=new Set(["browser","bun","default","deno","electron","import","module-sync","node","node-addons","require","types","workerd",...op,...sp]),ya=(e,t,r,n,o)=>{if(!e)return[];if(typeof e=="string"){const s=Yn(e);if(s&&s!==t)throw new Error(`Exported file "${e}" has an extension that does not match the package.json type "${t==="esm"?"module":"commonjs"}".`);return[{file:e,key:"exports",type:s??t}]}if(typeof e=="object"){const s=Object.entries(e).filter(([a])=>!a.endsWith(".json"));let i=[];for(const[a,l]of s){const u=a.replace("./",""),c=o.some(p=>u===p||u.startsWith(`${p}/`));if(typeof l=="string"){let p;Number.isInteger(+a)?p={exportKey:"*"}:a.startsWith("./")?p={exportKey:a.replace("./","")}:p={exportKey:a==="."?".":"*",subKey:a},i.push({...p,file:l,key:"exports",type:ki(a,n,t,l),...c&&{ignored:!0}})}else if(typeof l=="object"&&l!==null)for(const[p,f]of Object.entries(l)){if(r===!1&&p==="types")continue;const d=Number.isInteger(+a)?p:a;if(typeof f=="string")i.push({exportKey:d.replace("./",""),file:f,key:"exports",...b1.has(p)?{subKey:p}:{},type:ki(p,n,t,f),...c&&{ignored:!0}});else{const m=d.replace("./",""),h=c||o.some(y=>m===y||m.startsWith(`${y}/`)),$=ya({[d]:f},t,r,[...n,p],o);h&&$.forEach(y=>{y.ignored=!0}),i=[...i,...$]}}}return i}return[]},ji=new Map,nr=/\.[^./]+$/,Ce=/\.d\.[mc]?ts$/,Ai=/\.d\.mts$/,Oi=/\.d\.cts$/,Cl=/\.d\.[mc]ts$/,w1=/^\.\/dist\//,Ri=/^dist\//,v1=/^\//,_r=/^\.\//,x1=/\/$/,Tl=/\.\w+$/,Nl=/\*.*$/,E1=/\.(?:tsx?|cts|mts)$/,S1=/\.[cm]?tsx?$/,k1=/^(.+?)\.[^.]*$/,j1=/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,Re=e=>e===void 0||e==="node16",Rf=(e,t)=>{const r=Ce.exec(e);if(r!==null)return r[0];if(t)for(const n of Object.values(t)){const o=n.startsWith(".")?n:`.${n}`;if(e.endsWith(o))return o}return tr(e)},A1=async e=>{try{return await lp.readdir(e,{withFileTypes:!0})}catch(t){const{code:r}=t;if(r==="ENOENT")return[];throw t}},Cf=async(e,t)=>{const r=await A1(e);return(await Promise.all(r.map(async n=>{const o=ll.join(e,n.name);return n.isDirectory()?Cf(o,t):n.isFile()?ll.relative(t,o):[]}))).flat()},O1=async e=>{let t=ji.get(e);return t||(t=Cf(e,e),ji.set(e,t)),t},Pl=(e,t,r)=>{const n=e.replace(nr,"");if(t==="*"){const i=n.split("/").filter(Boolean);return i.length===0?void 0:r&&r>1?i:[i[0]]}const o=t.replaceAll(/[.+?^${}()|[\]\\]/g,String.raw`\$&`).replaceAll("*","(.*)"),s=new RegExp(`^${o}$`).exec(n);return s?s.slice(1):void 0},xt=(e,t)=>{let r=e;for(const n of t)r=r.replace("*",n);return r},R1=e=>e.endsWith(".d.mts")?"d.mts":e.endsWith(".d.cts")?"d.cts":"d.ts",C1=(e,t)=>e.key==="exports"&&e.subKey===Wr?Wr:e.key==="exports"&&e.subKey===sl?sl:t,T1=e=>{const t=e.replace(w1,"").replace(Ri,"").replace(nr,"").split("/"),r=t.at(-1)??"",n=[".browser",".server",".development",".production",".node",".workerd"];for(const s of n)if(r.includes(s)){const i=r.replace(s,""),a=t.length>1?t.slice(0,-1).join("/"):"";return{baseName:a?`${a}/${i}`:i,pattern:s}}const o=r.split(".");if(o.length>2){const s=o.slice(0,-2).join("."),i=`.${o[o.length-2]}`,a=t.length>1?t.slice(0,-1).join("/"):"";return{baseName:a?`${a}/${s}`:s,pattern:i}}},N1=(e,t,r,n)=>{const o=`${t.replace(new RegExp(`^${n}/?`),"")}${r}`,s=o.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),i=new RegExp(String.raw`${s}\.([cm]?[tj]sx?|ts|js)$`),a=e.find(u=>{const c=u.replace(n,"").replace(v1,"");return i.test(c)});if(a)return a;const l=`${n}/${o}`;return e.find(u=>{const c=u.replace(nr,"");return c===l||c.endsWith(`/${o}`)})??void 0},at=(e,t,r,n,o,s,i,a)=>{const l=C1(o,s.environment);let{runtime:u}=s.options;const c=o.subKey==="browser"||typeof o.subKey=="string"&&o.subKey.includes("browser"),p=o.file.includes(".browser");if(c||p)u="browser";else{for(const b of op)if(o.file.includes(`.${b}.`)||o.subKey===b){u=b;break}(o.subKey==="node"||o.subKey==="workerd"||o.file.includes(".node")||o.file.includes(".workerd")||o.file.includes(".server"))&&(u="node")}const f=Rf(o.file,s.options.outputExtensionMap),d=o.file.replace(f,""),m=s.options.outDir.replace(_r,""),h=d.replace(new RegExp(`^(./)?${m}/`),""),$=t.replace(nr,"").split("/").pop()??"",y=h.split("/").pop()??"",g=!t.includes(h)&&$!==y;let w=e.find(b=>b.input===t&&b.environment===l&&b.runtime===u&&b.fileAlias===(g?h:void 0));if(w===void 0?w=e[e.push({environment:l,exportKey:new Set([o.exportKey].filter(Boolean)),fileAlias:g?h:void 0,input:t,runtime:u})-1]:w.exportKey&&o.exportKey&&w.exportKey.add(o.exportKey),i&&(w.isGlob=!0),r&&(w.outDir=n),o.isExecutable)w.executable=!0,w.declaration=!1,o.type==="cjs"?w.cjs=!0:o.type==="esm"&&(w.esm=!0);else{const b=Ce.test(o.file),v=a.filter(x=>x.exportKey===o.exportKey),S=v.length>0&&v.every(x=>Ce.test(x.file));if(b&&s.options.declaration!==!1){w.declaration=s.options.declaration;const x=R1(o.file);w.declarationExtensions??=new Set,w.declarationExtensions.add(x)}if(b||S){S&&s.options.declaration!==!1&&(w.declaration=s.options.declaration);const x=v.some(j=>Ai.test(j.file)),E=v.some(j=>Oi.test(j.file));if(x&&E?(Re(s.options.declaration)&&(s.options.declaration="compatible"),s.options.emitCJS=!0,s.options.emitESM=!0):E?(s.options.emitCJS=!0,Re(s.options.declaration)&&(s.options.declaration="compatible")):x&&(s.options.emitESM=!0,Re(s.options.declaration)&&(s.options.declaration="compatible")),S){const j=a.filter(P=>Ce.test(P.file)),k=j.some(P=>Ai.test(P.file)),R=j.some(P=>Oi.test(P.file));v.every(P=>!P.subKey||P.subKey==="types")?(R&&(w.cjs=!0),k&&(w.esm=!0)):(R&&(w.declarationCjs=!0),k&&(w.declarationEsm=!0))}}else o.type==="cjs"?w.cjs=!0:o.type==="esm"&&(w.esm=!0)}g&&!w.fileAlias&&(w.fileAlias=h)};let rs=!1;const _l=e=>{if(e.pkg.dependencies?.typescript===void 0&&e.pkg.devDependencies?.typescript===void 0)throw new Error("You tried to use a `.ts`, `.cts` or `.mts` file but `typescript` was not found in your package.json.")},P1=async(e,t,r)=>{const n=e.types||e.typings;ji.clear(),rs=!1;const o=[];t.sort((d,m)=>d.split("/").length-m.split("/").length);const s=e.type==="module"?"esm":"cjs",i=r.options.declaration??"node16",a=ya(e.exports,s,i,[],r.options.ignoreExportKeys??[]).filter(d=>!d.ignored),l=new Set;for(const d of a){const m=a.filter(h=>h.exportKey===d.exportKey);if(m.length>0&&m.every(h=>Ce.test(h.file))&&!l.has(d.exportKey)){l.add(d.exportKey);const h=m.some(y=>y.file.endsWith(".d.mts")),$=m.some(y=>y.file.endsWith(".d.cts"));h&&$?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0,r.options.emitESM=!0):$?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0):h&&(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitESM=!0)}}r.options.declaration??="node16";const u=a.some(d=>d.type==="esm"&&!Ai.test(d.file)),c=a.some(d=>d.type==="cjs"&&!Oi.test(d.file));u&&c?(r.options.emitESM=!0,r.options.emitCJS=!0):u?r.options.emitESM=!0:c?r.options.emitCJS=!0:s==="esm"?r.options.emitESM=!0:r.options.emitCJS=!0;const p=r.options.emitCJS&&r.options.emitESM;if(r.options.declaration==="node16"&&p&&(r.options.declaration="compatible"),e.bin){const d=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const m of d){const h=Yn(m);if(h&&h!==s)throw new Error(`Exported file "${m}" has an extension that does not match the package.json type "${e.type??"commonjs"}".`);a.push({file:m,isExecutable:!0,key:"bin",type:h??s})}}e.main&&a.push({file:e.main,key:"main",type:Yn(e.main)??s}),e.module&&a.push({file:e.module,key:"module",type:"esm"}),n&&(_l(r),Re(r.options.declaration)&&p&&(r.options.declaration="compatible"),a.push({file:n,key:"types"}));const f=[];if(!r.options.outputExtensionMap){const d=a.some($=>!$.isExecutable&&!Ce.test($.file)&&$.file.endsWith(".mjs")),m=a.some($=>!$.isExecutable&&!Ce.test($.file)&&$.file.endsWith(".cjs")),h=a.some($=>!$.isExecutable&&!Ce.test($.file)&&$.file.endsWith(".js"));d&&!m&&!h?r.options.outputExtensionMap={esm:"mjs"}:m&&!d&&!h&&(r.options.outputExtensionMap={cjs:"cjs"})}for(const d of a){const m=Ce.test(d.file),h=Rf(d.file,r.options.outputExtensionMap),$=[...ho];if(r.options.outputExtensionMap)for(const k of Object.values(r.options.outputExtensionMap)){const R=k.startsWith(".")?k:`.${k}`;$.includes(R)||$.push(R)}if(!m&&h!==""&&!$.includes(h)||!m&&E1.test(d.file))continue;let y=d.type;if(!y&&m){if(d.file.endsWith(".d.mts"))y="esm";else if(d.file.endsWith(".d.cts"))y="cjs";else if(d.file.endsWith(".d.ts")){const k=a.some(P=>P.subKey==="import"&&P.file.endsWith(".d.mts")),R=a.some(P=>P.subKey==="require"&&P.file.endsWith(".d.cts"));k&&R?y=void 0:y=r.pkg.type==="module"?"esm":"cjs"}}if(Ce.test(d.file)||(r.options.emitCJS===void 0&&(y==="cjs"||d.type==="cjs")&&(r.options.emitCJS=!0),r.options.emitESM===void 0&&(y==="esm"||d.type==="esm")&&(r.options.emitESM=!0)),Re(r.options.declaration)){const k=r.options.emitCJS&&r.options.emitESM;r.options.declaration=k?"compatible":"node16"}let g=d.file;if(r.options.outputExtensionMap)for(const k of Object.values(r.options.outputExtensionMap)){const R=k.startsWith(".")?k:`.${k}`;if(d.file.endsWith(R)){g=d.file.slice(0,-R.length);break}}g===d.file&&(g=d.file.replace(j1,""));const w=g.endsWith("/");if(w&&["./","/"].includes(g))continue;const b=g.replace(new RegExp(`(./)?${r.options.outDir}`),r.options.sourceDir).replace("./",""),v=w?"":String.raw`(\.d\.[cm]?ts|(\.[cm]?[tj]sx?))$`,S="(?:^|/)";if((d.file.includes("/*")||g.includes("*"))&&d.key==="exports"){rs||(r.logger?.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),rs=!0);let k;d.exportKey?k=d.exportKey.startsWith("./")?d.exportKey.slice(2):d.exportKey:k=(d.file.startsWith("./")?d.file.slice(2):d.file).replace(Ri,"");const R=d.file,P=Tl.exec(R);if(R.includes("*")&&!P&&d.exportKey&&!d.subKey){const _=R.replace(Nl,"").replace(_r,""),M=k.replace(Nl,"").replace(_r,"");if(_!==M){const H=`package.json#exports["${d.exportKey==="."?".":`./${d.exportKey}`}"]`;o.push(`Wildcard pattern must include a file extension: ${R} at ${H}`);continue}}const z=r.options.sourceDir.replace(_r,""),U=X(r.options.rootDir,z),J=[],N=await O1(U),O=R.split("*").length-1,F=k.split("*").length-1;for(const _ of N){const M=Pl(_,k,O);if(M){if(O>F&&O>1){if(M.length>=O){const B=M[0];if(M.every(D=>D===B)){const D=xt(R,M.slice(0,O));D.includes("*")||J.push({input:X(U,_),output:D})}continue}const V=_.replace(nr,"").split("/").filter(Boolean);if(V.length>=O){const B=Math.floor(V.length/O),D=[];for(let q=0;q<O;q+=1){const A=q*B,le=q===O-1?V.length:(q+1)*B;D.push(V.slice(A,le).join("/"))}const K=D[0];if(D.every(q=>q===K)){const q=xt(R,D);q.includes("*")||J.push({input:X(U,_),output:q})}}else if(V.length>0){const B=V[0];if(V.every(D=>D===B)){const D=Array.from({length:O}).fill(B),K=xt(R,D);K.includes("*")||J.push({input:X(U,_),output:K})}}continue}if(M.length<O)continue;if(F>0&&F<O&&O>1&&M.length>1){const V=M[0];if(!M.every(B=>B===V))continue}const H=xt(R,M);if(H.includes("*"))continue;J.push({input:X(U,_),output:H})}}if(J.length===0&&R.includes("*")){let _=(d.file.startsWith("./")?d.file.slice(2):d.file).replace(Ri,"");_=_.replace(Tl,"");for(const M of N){const H=Pl(M,_,O);if(H){if(O>1&&F<O){if(H.length>=O){const D=H[0];if(H.every(K=>K===D)){const K=xt(R,H);K.includes("*")||J.push({input:X(U,M),output:K});continue}}const V=M.replace(nr,""),B=_.split("*");if(B.length>=2){const D=B.map(A=>A.replaceAll(/[.+?^${}()|[\]\\]/g,String.raw`\$&`));let K=`${D[0]}(.+)`;for(let A=1;A<D.length;A+=1)K+=D[A],A<D.length-1&&(K+=String.raw`\1`);const q=new RegExp(`^${K}$`).exec(V);if(q){const A=q[1],le=xt(R,Array.from({length:O}).fill(A));le.includes("*")||J.push({input:X(U,M),output:le})}}continue}if(H.length>=O){if(F>0&&F<O&&O>1&&H.length>1){const B=H[0];if(!H.every(D=>D===B))continue}const V=xt(R,H);V.includes("*")||J.push({input:X(U,M),output:V})}}}}if(J.length===0){a.length>1||o.push(`Could not find entrypoints matching pattern \`${k}\` for output \`${R}\``);continue}const I=a.filter(_=>_.exportKey===d.exportKey);if(I.length>0&&I.every(_=>Ce.test(_.file))){const _=I.some(D=>D.file.endsWith(".d.ts")),M=I.some(D=>D.file.endsWith(".d.mts")),H=I.some(D=>D.file.endsWith(".d.cts"));M&&H?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0,r.options.emitESM=!0):H?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0):M&&(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitESM=!0);const V=I.find(D=>D.file.endsWith(".d.ts")),B=V??I.find(D=>D.file.endsWith(".d.mts"))??I.find(D=>D.file.endsWith(".d.cts"))??d;if(!(B===d||V!==void 0&&d===V||V===void 0&&B===d))continue;for(const{input:D,output:K}of J){let q=K;if(K.endsWith(".d.mts")||K.endsWith(".d.cts"))q=K.replace(Cl,".d.ts");else if(!K.endsWith(".d.ts")){const le=K.replace(Cl,".d.ts");_&&(q=le)}const A={...B,file:q,subKey:"types",type:void 0};at(f,D,!1,g,A,r,!0,a)}}else for(const{input:_,output:M}of J){const H=Ce.test(M);let V=d.type;H||(M.endsWith(".mjs")?V="esm":M.endsWith(".cjs")?V="cjs":M.endsWith(".js")&&!V&&(V=r.pkg.type==="module"?"esm":"cjs"));const B={...d,file:M,...!H&&V&&{type:V}};at(f,_,!1,g,B,r,!0,a)}continue}const x=new RegExp(S+b.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+v);let E=t.find(k=>x.test(k));if(E===void 0){const k=r.options.sourceDir.replace(_r,""),R=X(r.options.rootDir,k),P=T1(d.file);if(P){const z=N1(t,P.baseName,P.pattern,R);if(z)E=z;else{const U=P.baseName,J=new RegExp(S+U.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+v);E=t.find(N=>J.test(N))}}else{const z=b.replace(k1,"$1").replace(x1,"");if(sp.has(d.subKey)){const U=new RegExp(S+z.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+v);E=t.find(J=>U.test(J))}}}if(E===void 0){rt(X(r.options.rootDir,d.file))||o.push(`Could not find entrypoint for \`${d.file}\``);continue}rt(E)&&S1.test(E)&&_l(r);const j=a.filter(k=>k.exportKey===d.exportKey);if(j.length>0&&j.every(k=>Ce.test(k.file))){const k=j.some(z=>z.file.endsWith(".d.mts")),R=j.some(z=>z.file.endsWith(".d.cts"));k&&R?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0,r.options.emitESM=!0):R?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0):k&&(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitESM=!0);const P={...d,subKey:"types",type:void 0};at(f,E,w,g,P,r,!1,a)}else{const k=Pm(E.replace(Ki,"")),R=`${k}.cts`,P=`${k}.mts`,z=rt(R),U=rt(P),J=d.file.endsWith(".d.mts")||d.file.endsWith(".mjs"),N=d.file.endsWith(".d.cts")||d.file.endsWith(".cjs");J&&U?at(f,P,w,g,{...d,type:"esm"},r,!1,a):N&&z?at(f,R,w,g,{...d,type:"cjs"},r,!1,a):z&&U?(at(f,R,w,g,{...d,type:"cjs"},r,!1,a),at(f,P,w,g,{...d,type:"esm"},r,!1,a)):at(f,E,w,g,d,r,!1,a)}}return{entries:f,warnings:o}},$r=e=>typeof e=="string"&&e!=="",_1=(e,t)=>{const{publishConfig:r}=e;return r&&(r.bin&&(typeof r.bin=="object"||typeof r.bin=="string")&&(e.bin=r.bin),$r(r.type)&&(e.type=r.type),$r(r.main)&&(e.main=r.main),$r(r.module)&&(e.module=r.module),t===void 0&&$r(r.types)?e.types=r.types:t===void 0&&$r(r.typings)&&(e.typings=r.typings),r.exports&&typeof r.exports=="object"&&(e.exports=r.exports)),e},Tf=/.*\/dist\/.*/,Ml=/\/$/,M1=/\.mjs$/,I1=/\.cjs$/,W1=/\.d\.[mc]?ts$/,B1=/(?<!\.d)\.js$/,D1=e=>{const t=[],r=new Set,n=o=>{if(typeof o=="string"){t.push(o);return}if(Array.isArray(o)){for(const s of o)n(s);return}if(o&&typeof o=="object")for(const[s,i]of Object.entries(o))s.startsWith(".")||r.add(s),n(i)};e.exports&&n(e.exports);for(const o of[e.main,e.module,e.types])typeof o=="string"&&t.push(o);return{conditions:r,files:t}},L1=(e,t,r)=>{if(e.options.emitESM!==void 0||e.options.emitCJS!==void 0)return;const n=e.pkg.type==="module"?"esm":"cjs",o=r.some(a=>B1.test(a));let s=r.some(a=>M1.test(a))||t.has("import")||t.has("module"),i=r.some(a=>I1.test(a))||t.has("require");(o||!s&&!i)&&n==="esm"?s=!0:(o||!s&&!i)&&(i=!0),e.options.emitESM=s,e.options.emitCJS=i},F1=(e,t,r)=>{if(e.options.declaration!==void 0)return;const n=!!e.pkg.types||t.has("types")||r.some(o=>W1.test(o));e.options.declaration=n?"node16":!1},H1=e=>{e.options.entries.length=0;const t=G(e.options.rootDir,e.options.sourceDir);if(!rt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const r=zu(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[kt,Tf]}).filter(u=>Et.test(u)&&!u.endsWith(".d.ts")),{conditions:n,files:o}=D1(e.pkg);L1(e,n,o),F1(e,n,o);const s=e.options.emitESM??!1,i=e.options.emitCJS??!1;for(const u of r){const c=u.replace(`${t}/`,"").replace(Et,"").replaceAll("\\","/");e.options.entries.push({cjs:i,declaration:e.options.declaration,esm:s,input:u,name:c})}const a=[];s&&a.push("[esm]"),i&&a.push("[cjs]"),e.options.declaration&&a.push("[dts]");const l=e.options.entries.length;e.logger.info("Unbundle mode: preserving source structure for",ne(`${String(l)} ${l===1?"entry":"entries"}`),De(a.join(" ")))},q1={hooks:{"build:prepare":async function(e){if(e.options.unbundle){H1(e);return}if(e.options.entries.length>0)return;const t=G(e.options.rootDir,e.options.sourceDir);if(!rt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const r=zu(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[kt,Tf]});if(r.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");const n=e.logger;let o={...e.pkg};o.publishConfig&&(n.info(`Using publishConfig found in package.json, to override the default key-value pairs of "${Object.keys(o.publishConfig).join(", ")}".`),n.debug(o.publishConfig),o=_1(o,e.options.declaration));const s=await P1(o,r,e);for(const i of s.warnings)n.warn(i);if(e.options.entries.push(...s.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");n.info("Automatically detected entries:",ne(e.options.entries.map(i=>i.fileAlias?`${Ae(i.fileAlias)} => ${Ae(i.input.replace(`${e.options.rootDir}/`,"").replace(Ml,"/*"))}`:Ae(i.input.replace(`${e.options.rootDir}/`,"").replace(Ml,"/*"))).join(", ")),De([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(i=>`[${i}]`).join(" ")))}}},J1=Me(import.meta.url),Ut=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$a=e=>{if(typeof Ut<"u"&&Ut.versions&&Ut.versions.node){const[t,r]=Ut.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return Ut.getBuiltinModule(e)}return J1(e)},{existsSync:ns}=$a("node:fs"),{env:os,cwd:z1}=Ut,{createRequire:nn}=$a("node:module"),U1=0,ss=2,G1=Symbol("findUpStop"),Nf=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},Il=e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"},V1=nn(import.meta.url),br=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,K1=e=>{if(typeof br<"u"&&br.versions&&br.versions.node){const[t,r]=br.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return br.getBuiltinModule(e)}return V1(e)},{lstatSync:Wl,mkdirSync:Y1}=K1("node:fs"),X1=e=>{Nf(e);try{const t=Wl(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(Il(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{Y1(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const r=Wl(e);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(Il(r))}'`,{cause:t})}},Z1=/^[A-Z]:\//i,on=(e="")=>e&&e.replaceAll("\\","/").replace(Z1,t=>t.toUpperCase()),Q1=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ew=/^[A-Z]:$/i,tw=/.(\.[^./]+)$/,rw=/^[/\\]|^[a-z]:[/\\]/i,nw=/\/$/,ow=()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/",sw=(e,t)=>{let r="",n=0,o=-1,s=0,i;for(let a=0;a<=e.length;++a){if(a<e.length)i=e[a];else{if(i==="/")break;i="/"}if(i==="/"){if(!(o===a-1||s===1))if(s===2){if(r.length<2||n!==2||!r.endsWith(".")||r.at(-2)!=="."){if(r.length>2){const l=r.lastIndexOf("/");l===-1?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),o=a,s=0;continue}else if(r.length>0){r="",n=0,o=a,s=0;continue}}t&&(r+=r.length>0?"/..":"..",n=2)}else r.length>0?r+=`/${e.slice(o+1,a)}`:r=e.slice(o+1,a),n=a-o-1;o=a,s=0}else i==="."&&s!==-1?++s:s=-1}return r},Xn=e=>Q1.test(e),is=function(...e){e=e.map(n=>on(n));let t="",r=!1;for(let n=e.length-1;n>=-1&&!r;n--){const o=n>=0?e[n]:ow();!o||o.length===0||(t=`${o}/${t}`,r=Xn(o))}return t=sw(t,!r),r&&!Xn(t)?`/${t}`:t.length>0?t:"."},iw=function(e){return tw.exec(on(e))?.[1]??""},Pf=e=>{const t=on(e).replace(nw,"").split("/").slice(0,-1);return t.length===1&&ew.test(t[0])&&(t[0]=`${t[0]}/`),t.join("/")||(Xn(e)?"/":".")},aw=(e,t)=>on(e).split("/").pop(),lw=function(e){const t=rw.exec(e)?.[0]?.replaceAll("\\","/")??"",r=aw(e),n=iw(r);return{base:r,dir:Pf(e),ext:n,name:r.slice(0,r.length-n.length),root:t}},cw=nn(import.meta.url),wr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,uw=e=>{if(typeof wr<"u"&&wr.versions&&wr.versions.node){const[t,r]=wr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return wr.getBuiltinModule(e)}return cw(e)},{fileURLToPath:pw}=uw("node:url");function fw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bl,Dl;function dw(){return Dl||(Dl=1,Bl=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),Bl}var mw=dw();const hw=fw(mw);new Set(hw);const Ci=e=>on(e instanceof URL?pw(e):e),gw=nn(import.meta.url),vr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_f=e=>{if(typeof vr<"u"&&vr.versions&&vr.versions.node){const[t,r]=vr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return vr.getBuiltinModule(e)}return gw(e)};_f("node:fs/promises");_f("node:url");const yw=nn(import.meta.url),xr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Mf=e=>{if(typeof xr<"u"&&xr.versions&&xr.versions.node){const[t,r]=xr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return xr.getBuiltinModule(e)}return yw(e)},{statSync:$w,lstatSync:bw}=Mf("node:fs"),{fileURLToPath:ww}=Mf("node:url"),vw=(e,t={})=>{const r=t.cwd?Ci(t.cwd):process.cwd();let n=is(r);const{root:o}=lw(n),s=Ci(t.stopAt??o),i=is(n,s),a=t.type??"file",l=function(c){return[e]};t.allowSymlinks??=!0;const u=t.allowSymlinks?$w:bw;for(;n&&n!==i&&n!==o;){for(let c of l()){if(c===G1)return;if(c===void 0)continue;Buffer.isBuffer(c)?c=c.toString():c instanceof URL&&(c=ww(c));const p=Xn(c)?c:is(n,c);try{const f=u(p);if(a==="file"&&f.isFile()||a==="directory"&&f.isDirectory())return p}catch{}}n=Pf(n)}},xw=nn(import.meta.url),Er=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ew=e=>{if(typeof Er<"u"&&Er.versions&&Er.versions.node){const[t,r]=Er.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return Er.getBuiltinModule(e)}return xw(e)};Ew("node:fs/promises");const{accessSync:Sw}=$a("node:fs");function as(e,t=U1){Nf(e),e=Ci(e);try{return Sw(e,t),!0}catch{return!1}}let kw=class extends Error{constructor(t){super(`ENOENT: ${t}`)}get code(){return"ENOENT"}set code(t){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(t){throw new Error("Cannot overwrite name of NotFoundError")}};const jw=/^[A-Z]:\//i,If=(e="")=>e&&e.replaceAll("\\","/").replace(jw,t=>t.toUpperCase()),Aw=/^[/\\]{2}/,Ow=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Wf=/^[A-Z]:$/i,Rw=/\/$/,Cw=(e,t)=>{let r="",n=0,o=-1,s=0,i;for(let a=0;a<=e.length;++a){if(a<e.length)i=e[a];else{if(i==="/")break;i="/"}if(i==="/"){if(!(o===a-1||s===1))if(s===2){if(r.length<2||n!==2||!r.endsWith(".")||r.at(-2)!=="."){if(r.length>2){const l=r.lastIndexOf("/");l===-1?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),o=a,s=0;continue}else if(r.length>0){r="",n=0,o=a,s=0;continue}}t&&(r+=r.length>0?"/..":"..",n=2)}else r.length>0?r+=`/${e.slice(o+1,a)}`:r=e.slice(o+1,a),n=a-o-1;o=a,s=0}else i==="."&&s!==-1?++s:s=-1}return r},Ti=e=>Ow.test(e),Tw=function(e){if(e.length===0)return".";e=If(e);const t=Aw.exec(e),r=Ti(e),n=e.at(-1)==="/";return e=Cw(e,!r),e.length===0?r?"/":n?"./":".":(n&&(e+="/"),Wf.test(e)&&(e+="/"),t?r?`//${e}`:`//./${e}`:r&&!Ti(e)?`/${e}`:e)},$n=(...e)=>{let t="";for(const r of e)if(r)if(t.length>0){const n=t.at(-1)==="/",o=r[0]==="/";n&&o?t+=r.slice(1):t+=n||o?r:`/${r}`}else t+=r;return Tw(t)},Nw=e=>{const t=If(e).replace(Rw,"").split("/").slice(0,-1);return t.length===1&&Wf.test(t[0])&&(t[0]=`${t[0]}/`),t.join("/")||(Ti(e)?"/":".")},Ll=(e,t)=>(t?.create&&X1(e),e),Pw=(e,t)=>{if(os.CACHE_DIR&&!["0","1","false","true"].includes(os.CACHE_DIR))return Ll($n(os.CACHE_DIR,e),t);const r=vw("package.json",{cwd:t?.cwd??z1(),type:"file"});if(!r){if(t?.throwError)throw new kw("No such file or directory found.");return}const n=$n(Nw(r),"node_modules"),o=$n(n,".cache"),s=$n(o,e);if(!(ns(s)&&!as(s,ss))&&!(ns(o)&&!as(o,ss))&&!(ns(n)&&!as(n,ss)))return Ll(s,t)},_w=Pw,Mw=/^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i,Iw=/^KIBI/,Ww=/^MIBI/,Bw=/^GIBI/,Dw=/^TEBI/,Lw=/^PEBI/,Fw=/^EXBI/,Hw=/^ZEBI/,qw=/^YIBI/,Jw=/^(.)IB$/,Bf={iec:[{long:"Bytes",short:"B"},{long:"Kibibytes",short:"KiB"},{long:"Mebibytes",short:"MiB"},{long:"Gibibytes",short:"GiB"},{long:"Tebibytes",short:"TiB"},{long:"Pebibytes",short:"PiB"},{long:"Exbibytes",short:"EiB"},{long:"Zebibytes",short:"ZiB"},{long:"Yobibytes",short:"YiB"}],iec_octet:[{long:"Octets",short:"o"},{long:"Kibioctets",short:"Kio"},{long:"Mebioctets",short:"Mio"},{long:"Gibioctets",short:"Gio"},{long:"Tebioctets",short:"Tio"},{long:"Pebioctets",short:"Pio"},{long:"Exbioctets",short:"Eio"},{long:"Zebioctets",short:"Zio"},{long:"Yobioctets",short:"Yio"}],metric:[{long:"Bytes",short:"Bytes"},{long:"Kilobytes",short:"KB"},{long:"Megabytes",short:"MB"},{long:"Gigabytes",short:"GB"},{long:"Terabytes",short:"TB"},{long:"Petabytes",short:"PB"},{long:"Exabytes",short:"EB"},{long:"Zettabytes",short:"ZB"},{long:"Yottabytes",short:"YB"}],metric_octet:[{long:"Octets",short:"o"},{long:"Kilo-octets",short:"ko"},{long:"Mega-octets",short:"Mo"},{long:"Giga-octets",short:"Go"},{long:"Tera-octets",short:"To"},{long:"Peta-octets",short:"Po"},{long:"Exa-octets",short:"Eo"},{long:"Zetta-octets",short:"Zo"},{long:"Yotta-octets",short:"Yo"}]},zw=(e,t)=>{const r=new Intl.NumberFormat(t).format(11111).replaceAll(new RegExp("\\p{Number}","gu"),""),n=new Intl.NumberFormat(t).format(1.1).replaceAll(new RegExp("\\p{Number}","gu"),"");return Number.parseFloat(e.replaceAll(new RegExp(`\\${r}`,"g"),"").replace(new RegExp(`\\${n}`),"."))},Df=e=>{switch(e){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},Uw=(e,t)=>{const r={base:2,locale:"en-US",units:"metric",...t};if(typeof e!="string"||e.length===0)throw new TypeError("Value is not a string or is empty.");if(e.length>100)throw new TypeError("Value exceeds the maximum length of 100 characters.");const n=Mw.exec(e)?.groups;if(!n)return Number.NaN;const o=zw(n.value,r.locale),s=(n.type??"Bytes").toUpperCase().replace(Iw,"KILO").replace(Ww,"MEGA").replace(Bw,"GIGA").replace(Dw,"TERA").replace(Lw,"PETA").replace(Fw,"EXA").replace(Hw,"ZETTA").replace(qw,"YOTTA").replace(Jw,"$1B"),i=Bf[r.units].findIndex(l=>l.short[0].toUpperCase()===s[0]),a=Df(r.base);return o*a**i},je=(e,t)=>{if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("Bytesize is not a number.");const{base:r,decimals:n,locale:o,long:s,unit:i,units:a,...l}={base:2,decimals:0,locale:"en-US",long:!1,units:"metric",...t},u=Df(r),c=Math.abs(e),p=t?.space??!0?" ":"",f=Bf[a],d=f.findIndex(g=>g.short===i);if(e===0){const g=Math.min(0,Math.max(d,f.length-1));return"0"+p+f[g][s?"long":"short"]}const m=d===-1?Math.min(Math.floor(Math.log(c)/Math.log(u)),f.length-1):d,h=f[m][s?"long":"short"],$=e/u**m,y=n<0?void 0:n;return new Intl.NumberFormat(o,{maximumFractionDigits:y,minimumFractionDigits:y,...l}).format($)+p+h},Gw=(e,t,r,n,o,s,i,a,l,u,c,p,f,d)=>{const m={d:n,h:o,m:s,mo:t,ms:a,s:i,w:r,y:e};return m.future=l,m.past=u,m.decimal=c,p!==void 0&&(m.unitMap=p),m.groupSeparator=f,m.placeholderSeparator=d,m},Vw={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Kw=Gw(e=>`year${e===1?"":"s"}`,e=>`month${e===1?"":"s"}`,e=>`week${e===1?"":"s"}`,e=>`day${e===1?"":"s"}`,e=>`hour${e===1?"":"s"}`,e=>`minute${e===1?"":"s"}`,e=>`second${e===1?"":"s"}`,e=>`millisecond${e===1?"":"s"}`,"in %s","%s ago",".",Vw,",","_"),Yw=e=>{const t=["y","mo","w","d","h","m","s","ms","future","past"];for(const n of t)if(!Object.hasOwn(e,n))throw new TypeError(`Missing required property: ${n}`);if(typeof e.future!="string"||typeof e.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const n of r)if(typeof e[n]!="string"&&typeof e[n]!="function")throw new TypeError(`Property ${n} must be of type string or function`);if(e.decimal&&typeof e.decimal!="string")throw new TypeError("Property decimal must be of type string");if(e.delimiter&&typeof e.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(e._digitReplacements&&!Array.isArray(e._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(e._numberFirst&&typeof e._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(e.unitMap&&typeof e.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(e.unitMap&&Object.values(e.unitMap).some(n=>typeof n!="string"))throw new TypeError("All values in unitMap must be of type string")},Lf=(e,t)=>{t=t||-1;const r=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(t)}})?`).exec(e.toString());return r===null?e:Number.parseFloat(r[0])},Fl=({unitCount:e,unitName:t},r,n)=>{let{spacer:o}=n;const{maxDecimalPoints:s}=n;let i=".";n.decimal!==void 0?i=n.decimal:r.decimal!==void 0&&(i=r.decimal);let a;"digitReplacements"in n?a=n.digitReplacements:"_digitReplacements"in r&&(a=r._digitReplacements);let l,u=e;s!==void 0&&(u=Lf(e,s));const c=u.toString();if(!r._hideCountIf2||e!==2)if(a){l="";for(const d of c)l+=d==="."?i:a[d]}else l=c.replace(".",i);else l="";const p=r[t];let f=p;return typeof p=="function"&&(f=p(e)),r._hideCountIf2&&e===2&&(o=""),r._numberFirst?f+o+l:l+o+f},Xw=(e,t)=>{const{units:r}=t;if(r.length===0)return[];const{unitMeasures:n}=t,o=t.largest??Number.POSITIVE_INFINITY,s={};let i,a,l,u=e;for(a=0;a<r.length;a++){i=r[a];const p=n[i];l=a===r.length-1?u/p:Math.floor(u/p),s[i]=l,u-=l*p}if(t.round){let p=o;for(a=0;a<r.length;a++)if(i=r[a],l=s[i],l!==0&&(p--,p===0)){for(let f=a+1;f<r.length;f++){const d=r[f],m=s[d];s[i]=(s[i]??0)+m*n[d]/n[i],s[d]=0}break}for(a=r.length-1;a>=0;a--){if(i=r[a],l=s[i],l===0)continue;const f=Math.round(l);if(s[i]=f,a===0)break;const d=r[a-1],m=n[d],h=Math.floor(f*n[i]/m);if(h)s[d]=(s[d]??0)+h,s[i]=0;else break}}const c=[];for(a=0;a<r.length&&c.length<o;a++){if(i=r[a],l=s[i],l&&!t.round&&c.length===o-1){let p,f=0;for(p=a+1,r.length;p<r.length;p++){const d=r[p];f+=s[d]*(t.unitMeasures[d]/t.unitMeasures[i])}l+=f,t.maxDecimalPoints!==void 0&&(l=Lf(l,t.maxDecimalPoints))}l&&c.push({unitCount:l,unitName:i})}return c},Zw=(e,t,r)=>{const{language:n,units:o}=t;if(e.length===0){const p=o.at(-1);return Fl({unitCount:0,unitName:p},n,t)}const{conjunction:s,serialComma:i}=t;let a=", ";t.delimiter!==void 0?a=t.delimiter:n.delimiter!==void 0&&(a=n.delimiter);let l="";t.timeAdverb&&r!==0&&(l=n.future??"",r<0&&(l=n.past??""));const u=e.map(p=>Fl(p,n,t));let c;return!s||e.length===1?c=u.join(a):e.length===2?c=u.join(s):c=u.slice(0,-1).join(a)+(i?",":"")+s+(u.at(-1)??""),l&&(c=l.replace("%s",c)),c},Hl=(e,t)=>{if(Number.isNaN(e))throw new TypeError("Expected a valid number");if(typeof e!="number")throw new TypeError("Expected a number for milliseconds input");const r={conjunction:"",language:Kw,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...t};Yw(r.language);const n=Math.abs(e),o=Xw(n,r);return Zw(o,r,e)};var Qw=Object.defineProperty,Ff=(e,t)=>Qw(e,"name",{value:t,configurable:!0});const ev=Me(import.meta.url),Sr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Hf=Ff(e=>{if(typeof Sr<"u"&&Sr.versions&&Sr.versions.node){const[t,r]=Sr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return Sr.getBuiltinModule(e)}return ev(e)},"__cjs_getBuiltinModule"),{execSync:tv}=Hf("node:child_process"),{existsSync:ql,readFileSync:rv}=Hf("node:fs");var nv=Object.defineProperty,Xe=Ff((e,t)=>nv(e,"name",{value:t,configurable:!0}),"r");const ba=["yarn.lock","package-lock.json","pnpm-lock.yaml","npm-shrinkwrap.json","bun.lockb"],qf=Xe(e=>{let t;if(ba.forEach(n=>{!t&&ql(G(e,n))&&(t=G(e,n))}),t)return t;const r=G(e,"package.json");if(ql(r)&&ga(rv(r,"utf8")).packageManager!==void 0)return r},"packageMangerFindUpMatcher"),Jf=Xe(e=>{if(!e)throw new Mt("Could not find a package manager");if(e.endsWith("package.json")){const t=ga(e);if(t.packageManager){const r=["npm","yarn","pnpm","bun"].find(n=>t.packageManager.startsWith(n));if(r)return{packageManager:r,path:Z(e)}}}if(e.endsWith("yarn.lock"))return{packageManager:"yarn",path:Z(e)};if(e.endsWith("package-lock.json")||e.endsWith("npm-shrinkwrap.json"))return{packageManager:"npm",path:Z(e)};if(e.endsWith("pnpm-lock.yaml"))return{packageManager:"pnpm",path:Z(e)};if(e.endsWith("bun.lockb"))return{packageManager:"bun",path:Z(e)};throw new Mt("Could not find a package manager")},"resolvePackageManagerFromFile"),ov=Xe(async e=>{const t=await ft(ba,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find lock file");return t},"findLockFile"),sv=Xe(e=>{const t=dt(ba,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find lock file");return t},"findLockFileSync"),iv=Xe(async e=>{const t=await ft(qf,{...e&&{cwd:e}});return Jf(t)},"findPackageManager"),zf=Xe(e=>{const t=dt(qf,{...e&&{cwd:e}});return Jf(t)},"findPackageManagerSync");Xe(e=>tv(`${e} --version`).toString("utf8").trim(),"getPackageManagerVersion");Xe(()=>{if(!process.env.npm_config_user_agent)return;const e=process.env.npm_config_user_agent.split(" ")[0],t=e.lastIndexOf("/"),r=e.slice(0,Math.max(0,t));return{name:r==="npminstall"?"cnpm":r,version:e.slice(Math.max(0,t+1))}},"identifyInitiatingPackageManager");Xe((e,t,r)=>{const n=t.length===1?"":"s";if(r.packageManagers??=["npm","pnpm","yarn"],r.packageManagers.length===0)throw new Error("No package managers provided, please provide at least one package manager");if(t.length===0)throw new Error("No missing packages provided, please provide at least one missing package");let o=`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/packem",
3
- "version": "2.0.0-alpha.92",
3
+ "version": "2.0.0-alpha.93",
4
4
  "description": "A fast and modern bundler for Node.js and TypeScript.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -202,7 +202,7 @@
202
202
  "@swc/core": ">=1.15.40",
203
203
  "@tailwindcss/node": "4.3.0",
204
204
  "@tailwindcss/oxide": "4.3.0",
205
- "@visulima/packem-rollup": "1.0.0-alpha.74",
205
+ "@visulima/packem-rollup": "1.0.0-alpha.75",
206
206
  "cssnano": ">=8.0.1",
207
207
  "esbuild": ">=0.28.0",
208
208
  "icss-utils": ">=5.1.0",