@visulima/packem 2.0.0-alpha.86 → 2.0.0-alpha.87

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,9 @@
1
+ ## @visulima/packem [2.0.0-alpha.87](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.86...@visulima/packem@2.0.0-alpha.87) (2026-06-04)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **packem:** ship the bundled CJS-DTS star-export guard (re-release) ([d8669e6](https://github.com/visulima/packem/commit/d8669e60bd0b6363faff6441c890b314ca02e78c))
6
+
1
7
  ## @visulima/packem [2.0.0-alpha.86](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.85...@visulima/packem@2.0.0-alpha.86) (2026-06-04)
2
8
 
3
9
  ### Bug Fixes
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{r as A,S as q,f as ee,e as te,g as se,i as ae,B as ne,T as ie,j as B,v as oe,l as re,d as ce}from"../packem_shared/index-1y8wS5GH.js";import v,{cwd as L,exit as le}from"node:process";import{installPackage as h}from"@antfu/install-pkg";import{spinner as E,confirm as f,cancel as O,select as g,multiselect as G,intro as K,log as P,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-CRDW-Kwa.js";import{P as D,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 T}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{r as A,S as q,f as ee,e as te,g as se,i as ae,B as ne,T as ie,j as B,v as oe,l as re,d as ce}from"../packem_shared/index-BKMfJDaY.js";import v,{cwd as L,exit as le}from"node:process";import{installPackage as h}from"@antfu/install-pkg";import{spinner as E,confirm as f,cancel as O,select as g,multiselect as G,intro as K,log as P,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-CRDW-Kwa.js";import{P as D,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 T}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 J={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"],Ie=["unplugin-vue"],Me=["vue"],Ne=["rollup-plugin-svelte"],Le=["svelte"],k=(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}`),$=(t,e)=>{const{logger:a,magic:s,packemConfig:n}=t,i=ke.exec(n);if(i?.index!==void 0){const r=i.index+i[0].length;if(n.includes("preset:")){const o=$e.exec(n);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(n.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-1y8wS5GH.js";import{g as wt}from"./packem_shared/create-or-update-key-storage-CRDW-Kwa.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-BKMfJDaY.js";import{g as wt}from"./packem_shared/create-or-update-key-storage-CRDW-Kwa.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 @@ ${Xr(S,{...this.#o,filterStacktrace:ni,prefix:b})}`;if(typeof S=="object")return
44
44
 
45
45
  ${Xr(v,{...this.#o,filterStacktrace:ni,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:b})}`),h&&w.push(` ${b}${xt(this.styles.underline.suffix?gl(h):h)}`),l){const j=(l.name??"")+(l.line?`:${String(l.line)}`:""),S=Math.max(0,k-Pe("Caller: "));w.push(`
46
46
  `,xt("Caller: ")," ".repeat(S),j,`
47
- `)}return w.join("")}};var TO="@visulima/packem",Yu="2.0.0-alpha.85";const _O={version:Yu};var h$=Object.defineProperty,Xu=(e,t)=>h$(e,"name",{value:t,configurable:!0}),g$=Object.defineProperty,v$=Xu((e,t)=>g$(e,"name",{value:t,configurable:!0}),"o");let NO=class extends Error{static{Xu(this,"n")}static{v$(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 y$=Object.defineProperty,Zu=(e,t)=>y$(e,"name",{value:t,configurable:!0}),b$=Object.defineProperty,$$=Zu((e,t)=>b$(e,"name",{value:t,configurable:!0}),"t");let MO=class extends Error{static{Zu(this,"n")}static{$$(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 w$=Object.defineProperty,Qu=(e,t)=>w$(e,"name",{value:t,configurable:!0}),x$=Object.defineProperty,k$=Qu((e,t)=>x$(e,"name",{value:t,configurable:!0}),"o");let It=class extends Error{static{Qu(this,"n")}static{k$(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 E$=Object.defineProperty,S$=(e,t)=>E$(e,"name",{value:t,configurable:!0}),j$=Object.defineProperty,A$=S$((e,t)=>j$(e,"name",{value:t,configurable:!0}),"n");A$((e,{whitespace:t=!0}={})=>e.replace(gm,n=>n.startsWith('"')||n[1]==="*"&&!n.endsWith("*/")?n:t?n.replaceAll(/\S/g," "):""),"stripJsonComments");var O$=Object.defineProperty,ed=(e,t)=>O$(e,"name",{value:t,configurable:!0}),R$=Object.defineProperty,C$=ed((e,t)=>R$(e,"name",{value:t,configurable:!0}),"r");async function Tr(e,t,n){const{buffer:o,compression:r,encoding:i="utf8",flag:s,...a}=n??{},l=await Cp(e,{buffer:o,compression:r,encoding:i,flag:s});return typeof t=="function"?Vo(l,t,a):Vo(l,a)}ed(Tr,"l");C$(Tr,"readYaml");var T$=Object.defineProperty,td=(e,t)=>T$(e,"name",{value:t,configurable:!0}),_$=Object.defineProperty,N$=td((e,t)=>_$(e,"name",{value:t,configurable:!0}),"t");function _r(e,t,n){const{buffer:o,compression:r,encoding:i="utf8",flag:s,...a}=n??{},l=Fs(e,{buffer:o,compression:r,encoding:i,flag:s});return typeof t=="function"?Vo(l,t,a):Vo(l,a)}td(_r,"l");N$(_r,"readYamlSync");var P$=Object.defineProperty,nd=(e,t)=>P$(e,"name",{value:t,configurable:!0}),M$=Object.defineProperty,I$=nd((e,t)=>M$(e,"name",{value:t,configurable:!0}),"a");async function od(e,t,n,o){let r,i,s;typeof n=="object"&&n!==null&&!Array.isArray(n)&&typeof n!="function"?(r=n,i=r.replacer,s=r.space):typeof o=="object"?(r=o,i=n,s=r.space):(i=n,s=o);const a=Dp(t,i,s??r);await vm(e,a,r)}nd(od,"c");I$(od,"writeYaml");var W$=Object.defineProperty,rd=(e,t)=>W$(e,"name",{value:t,configurable:!0}),B$=Object.defineProperty,D$=rd((e,t)=>B$(e,"name",{value:t,configurable:!0}),"a");function id(e,t,n,o){let r,i,s;typeof n=="object"&&n!==null&&!Array.isArray(n)&&typeof n!="function"?(r=n,i=r.replacer,s=r.space):typeof o=="object"?(r=o,i=n,s=r.space):(i=n,s=o);const a=Dp(t,i,s??r);mr(e,a,r)}rd(id,"c");D$(id,"writeYamlSync");var L$=Object.defineProperty,F$=(e,t)=>L$(e,"name",{value:t,configurable:!0}),q$=Object.defineProperty,hn=F$((e,t)=>q$(e,"name",{value:t,configurable:!0}),"c");const sd=hn((e,t,n)=>{const o=Z(e),r=Z(t),i=r===o?".":Ae(o,r);return n.some(s=>{const a=s.startsWith("./")?s.slice(2):s,l=i.startsWith("./")?i.slice(2):i;if(a==="."&&l===".")return!0;if(a.endsWith("/**")){const p=a.slice(0,-3);return l===p||l.startsWith(`${p}/`)}if(a.endsWith("/*")){const p=a.slice(0,-2);return p===""?l!=="."&&!l.includes("/"):l.startsWith(`${p}/`)||l===p}return l===a||l.startsWith(`${a}/`)})},"isPackageInWorkspace"),ad=hn(async e=>{const t=await ft("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const n=await Tr(t),o=Array.isArray(n.packages)?n.packages:[];if(!sd(t,e,o))return;const r={};return n.catalog&&typeof n.catalog=="object"&&(r.catalog=n.catalog),n.catalogs&&typeof n.catalogs=="object"&&(r.catalogs=n.catalogs),Object.keys(r).length>0?r:void 0},"readPnpmCatalogs"),ld=hn(e=>{const t=mt("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const n=_r(t),o=Array.isArray(n.packages)?n.packages:[];if(!sd(t,e,o))return;const r={};return n.catalog&&typeof n.catalog=="object"&&(r.catalog=n.catalog),n.catalogs&&typeof n.catalogs=="object"&&(r.catalogs=n.catalogs),Object.keys(r).length>0?r:void 0},"readPnpmCatalogsSync"),z$=hn((e,t,n)=>{if(t==="catalog:")return n.catalog?.[e];if(t.startsWith("catalog:")){const o=t.slice(8);return n.catalogs?.[o]?.[e]}},"resolveCatalogReference"),H$=hn((e,t)=>{for(const[n,o]of Object.entries(e)){if(typeof o!="string")continue;const r=z$(n,o,t);r&&(e[n]=r)}},"resolveDependenciesCatalogReferences"),Nr=hn((e,t)=>{const n=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const o of n){if(!e[o]||typeof e[o]!="object")continue;const r=e[o];H$(r,t)}},"resolveCatalogReferences");var J$=Object.defineProperty,ge=(e,t)=>J$(e,"name",{value:t,configurable:!0});const G$=We(import.meta.url),xn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,aa=ge(e=>{if(typeof xn<"u"&&xn.versions&&xn.versions.node){const[t,n]=xn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return xn.getBuiltinModule(e)}return G$(e)},"__cjs_getBuiltinModule"),{existsSync:cd}=aa("node:fs"),{createInterface:U$}=aa("node:readline"),{styleText:_e}=aa("node:util");var V$=Object.defineProperty,be=ge((e,t)=>V$(e,"name",{value:t,configurable:!0}),"f");const Xe=be(e=>{const t=typeof e;return e!==null&&(t==="object"||t==="function")},"isObject"),K$=be(e=>{if(!Xe(e))return!1;for(const t in e)if(Object.hasOwn(e,t))return!1;return!0},"isEmptyObject"),pd=new Set(["__proto__","prototype","constructor"]),ud=1e6,Y$=be(e=>e>="0"&&e<="9","isDigit");function gn(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<=ud}return!1}ge(gn,"p$1");be(gn,"shouldCoerceToNumber");function Gn(e,t){return pd.has(e)?!1:(e&&gn(e)?t.push(Number.parseInt(e,10)):t.push(e),!0)}ge(Gn,"y");be(Gn,"processSegment");function la(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);const t=[];let n="",o="start",r=!1,i=0;for(const s of e){if(i++,r){n+=s,r=!1;continue}if(s==="\\"){if(o==="index")throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd")throw new Error(`Invalid character '${s}' after an index at position ${i}`);r=!0,o=o==="start"?"property":o;continue}switch(s){case".":{if(o==="index")throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd"){o="property";break}if(!Gn(n,t))return[];n="",o="property";break}case"[":{if(o==="index")throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd"){o="index";break}if(o==="property"||o==="start"){if((n||o==="property")&&!Gn(n,t))return[];n=""}o="index";break}case"]":{if(o==="index"){if(n==="")n=(t.pop()||"")+"[]",o="property";else{const a=Number.parseInt(n,10);!Number.isNaN(a)&&Number.isFinite(a)&&a>=0&&a<=Number.MAX_SAFE_INTEGER&&a<=ud&&n===String(a)?t.push(a):t.push(n),n="",o="indexEnd"}break}if(o==="indexEnd")throw new Error(`Invalid character '${s}' after an index at position ${i}`);n+=s;break}default:{if(o==="index"&&!Y$(s))throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd")throw new Error(`Invalid character '${s}' after an index at position ${i}`);o==="start"&&(o="property"),n+=s}}}switch(r&&(n+="\\"),o){case"property":{if(!Gn(n,t))return[];break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}ge(la,"parsePath");be(la,"parsePath");function vn(e){if(typeof e=="string")return la(e);if(Array.isArray(e)){const t=[];for(const[n,o]of e.entries()){if(typeof o!="string"&&typeof o!="number")throw new TypeError(`Expected a string or number for path segment at index ${n}, got ${typeof o}`);if(typeof o=="number"&&!Number.isFinite(o))throw new TypeError(`Path segment at index ${n} must be a finite number, got ${o}`);if(pd.has(o))return[];typeof o=="string"&&gn(o)?t.push(Number.parseInt(o,10)):t.push(o)}return t}return[]}ge(vn,"d");be(vn,"normalizePath");function ot(e,t,n){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return n===void 0?e:n;const o=vn(t);if(o.length===0)return n;for(let r=0;r<o.length;r++){const i=o[r];if(e=e[i],e==null){if(r!==o.length-1)return n;break}}return e===void 0?n:e}ge(ot,"getProperty");be(ot,"getProperty");function ca(e,t,n){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return e;const o=e,r=vn(t);if(r.length===0)return e;for(let i=0;i<r.length;i++){const s=r[i];if(i===r.length-1)e[s]=n;else if(!Xe(e[s])){const a=typeof r[i+1]=="number";e[s]=a?[]:{}}e=e[s]}return o}ge(ca,"setProperty");be(ca,"setProperty");function dd(e,t){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return!1;const n=vn(t);if(n.length===0)return!1;for(let o=0;o<n.length;o++){const r=n[o];if(o===n.length-1)return Object.hasOwn(e,r)?(delete e[r],!0):!1;if(e=e[r],!Xe(e))return!1}}ge(dd,"deleteProperty");be(dd,"deleteProperty");function Tt(e,t){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return!1;const n=vn(t);if(n.length===0)return!1;for(const o of n){if(!Xe(e)||!(o in e))return!1;e=e[o]}return!0}ge(Tt,"hasProperty");be(Tt,"hasProperty");function Qo(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return e.replaceAll(/[\\.[]/g,String.raw`\$&`)}ge(Qo,"escapePath");be(Qo,"escapePath");function pa(e){const t=Object.entries(e);return Array.isArray(e)?t.map(([n,o])=>[gn(n)?Number.parseInt(n,10):n,o]):t}ge(pa,"m$2");be(pa,"normalizeEntries");function ua(e,t={}){if(!Array.isArray(e))throw new TypeError(`Expected an array, got ${typeof e}`);const{preferDotForIndices:n=!1}=t,o=[];for(const[r,i]of e.entries()){if(typeof i!="string"&&typeof i!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof i}`);if(typeof i=="number")if(!Number.isInteger(i)||i<0){const s=Qo(String(i));o.push(r===0?s:`.${s}`)}else n&&r>0?o.push(`.${i}`):o.push(`[${i}]`);else if(typeof i=="string")if(i==="")r===0||o.push(".");else if(gn(i)){const s=Number.parseInt(i,10);n&&r>0?o.push(`.${s}`):o.push(`[${s}]`)}else{const s=Qo(i);o.push(r===0?s:`.${s}`)}}return o.join("")}ge(ua,"stringifyPath");be(ua,"stringifyPath");function*Pr(e,t=[],n=new Set){if(!Xe(e)||K$(e)){t.length>0&&(yield ua(t));return}if(!n.has(e)){n.add(e);for(const[o,r]of pa(e))t.push(o),yield*Pr(r,t,n),t.pop();n.delete(e)}}ge(Pr,"x");be(Pr,"deepKeysIterator");function fd(e){return[...Pr(e)]}ge(fd,"deepKeys");be(fd,"deepKeys");function md(e){const t={};if(!Xe(e))return t;for(const[n,o]of Object.entries(e))ca(t,n,o);return t}ge(md,"unflatten");be(md,"unflatten");var X$=Object.defineProperty,oi=ge((e,t)=>X$(e,"name",{value:t,configurable:!0}),"i");const Z$=oi(async e=>{const{default:t=!1,message:n,transformer:o}=e,r=oi(s=>{const a=_e(["cyan","bold"],"?"),l=_e(["bold"],s),p=t?`${_e(["greenBright"],"Y")}${_e(["gray"],"/n")}`:`y/${_e(["yellowBright"],"N")}`;return`${a} ${l} ${_e(["gray"],`(${p})`)}`},"formatMessage"),i=oi(s=>o?o(s):s?_e(["greenBright"],"Yes"):_e(["yellowBright"],"No"),"formatAnswer");return new Promise(s=>{const a=U$({input:process.stdin,output:process.stdout}),l=r(n);a.question(l,p=>{a.close();const c=p.trim().toLowerCase();if(c===""){s(t);return}if(c==="y"||c==="yes"){console.log(`${_e(["greenBright"],"✓")} ${i(!0)}`),s(!0);return}if(c==="n"||c==="no"){console.log(`${_e(["yellowBright"],"✗")} ${i(!1)}`),s(!1);return}console.log(`${_e(["gray"],"→")} ${i(t)}`),s(t)}),a.on("SIGINT",()=>{a.close(),console.log(`
47
+ `)}return w.join("")}};var TO="@visulima/packem",Yu="2.0.0-alpha.86";const _O={version:Yu};var h$=Object.defineProperty,Xu=(e,t)=>h$(e,"name",{value:t,configurable:!0}),g$=Object.defineProperty,v$=Xu((e,t)=>g$(e,"name",{value:t,configurable:!0}),"o");let NO=class extends Error{static{Xu(this,"n")}static{v$(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 y$=Object.defineProperty,Zu=(e,t)=>y$(e,"name",{value:t,configurable:!0}),b$=Object.defineProperty,$$=Zu((e,t)=>b$(e,"name",{value:t,configurable:!0}),"t");let MO=class extends Error{static{Zu(this,"n")}static{$$(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 w$=Object.defineProperty,Qu=(e,t)=>w$(e,"name",{value:t,configurable:!0}),x$=Object.defineProperty,k$=Qu((e,t)=>x$(e,"name",{value:t,configurable:!0}),"o");let It=class extends Error{static{Qu(this,"n")}static{k$(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 E$=Object.defineProperty,S$=(e,t)=>E$(e,"name",{value:t,configurable:!0}),j$=Object.defineProperty,A$=S$((e,t)=>j$(e,"name",{value:t,configurable:!0}),"n");A$((e,{whitespace:t=!0}={})=>e.replace(gm,n=>n.startsWith('"')||n[1]==="*"&&!n.endsWith("*/")?n:t?n.replaceAll(/\S/g," "):""),"stripJsonComments");var O$=Object.defineProperty,ed=(e,t)=>O$(e,"name",{value:t,configurable:!0}),R$=Object.defineProperty,C$=ed((e,t)=>R$(e,"name",{value:t,configurable:!0}),"r");async function Tr(e,t,n){const{buffer:o,compression:r,encoding:i="utf8",flag:s,...a}=n??{},l=await Cp(e,{buffer:o,compression:r,encoding:i,flag:s});return typeof t=="function"?Vo(l,t,a):Vo(l,a)}ed(Tr,"l");C$(Tr,"readYaml");var T$=Object.defineProperty,td=(e,t)=>T$(e,"name",{value:t,configurable:!0}),_$=Object.defineProperty,N$=td((e,t)=>_$(e,"name",{value:t,configurable:!0}),"t");function _r(e,t,n){const{buffer:o,compression:r,encoding:i="utf8",flag:s,...a}=n??{},l=Fs(e,{buffer:o,compression:r,encoding:i,flag:s});return typeof t=="function"?Vo(l,t,a):Vo(l,a)}td(_r,"l");N$(_r,"readYamlSync");var P$=Object.defineProperty,nd=(e,t)=>P$(e,"name",{value:t,configurable:!0}),M$=Object.defineProperty,I$=nd((e,t)=>M$(e,"name",{value:t,configurable:!0}),"a");async function od(e,t,n,o){let r,i,s;typeof n=="object"&&n!==null&&!Array.isArray(n)&&typeof n!="function"?(r=n,i=r.replacer,s=r.space):typeof o=="object"?(r=o,i=n,s=r.space):(i=n,s=o);const a=Dp(t,i,s??r);await vm(e,a,r)}nd(od,"c");I$(od,"writeYaml");var W$=Object.defineProperty,rd=(e,t)=>W$(e,"name",{value:t,configurable:!0}),B$=Object.defineProperty,D$=rd((e,t)=>B$(e,"name",{value:t,configurable:!0}),"a");function id(e,t,n,o){let r,i,s;typeof n=="object"&&n!==null&&!Array.isArray(n)&&typeof n!="function"?(r=n,i=r.replacer,s=r.space):typeof o=="object"?(r=o,i=n,s=r.space):(i=n,s=o);const a=Dp(t,i,s??r);mr(e,a,r)}rd(id,"c");D$(id,"writeYamlSync");var L$=Object.defineProperty,F$=(e,t)=>L$(e,"name",{value:t,configurable:!0}),q$=Object.defineProperty,hn=F$((e,t)=>q$(e,"name",{value:t,configurable:!0}),"c");const sd=hn((e,t,n)=>{const o=Z(e),r=Z(t),i=r===o?".":Ae(o,r);return n.some(s=>{const a=s.startsWith("./")?s.slice(2):s,l=i.startsWith("./")?i.slice(2):i;if(a==="."&&l===".")return!0;if(a.endsWith("/**")){const p=a.slice(0,-3);return l===p||l.startsWith(`${p}/`)}if(a.endsWith("/*")){const p=a.slice(0,-2);return p===""?l!=="."&&!l.includes("/"):l.startsWith(`${p}/`)||l===p}return l===a||l.startsWith(`${a}/`)})},"isPackageInWorkspace"),ad=hn(async e=>{const t=await ft("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const n=await Tr(t),o=Array.isArray(n.packages)?n.packages:[];if(!sd(t,e,o))return;const r={};return n.catalog&&typeof n.catalog=="object"&&(r.catalog=n.catalog),n.catalogs&&typeof n.catalogs=="object"&&(r.catalogs=n.catalogs),Object.keys(r).length>0?r:void 0},"readPnpmCatalogs"),ld=hn(e=>{const t=mt("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const n=_r(t),o=Array.isArray(n.packages)?n.packages:[];if(!sd(t,e,o))return;const r={};return n.catalog&&typeof n.catalog=="object"&&(r.catalog=n.catalog),n.catalogs&&typeof n.catalogs=="object"&&(r.catalogs=n.catalogs),Object.keys(r).length>0?r:void 0},"readPnpmCatalogsSync"),z$=hn((e,t,n)=>{if(t==="catalog:")return n.catalog?.[e];if(t.startsWith("catalog:")){const o=t.slice(8);return n.catalogs?.[o]?.[e]}},"resolveCatalogReference"),H$=hn((e,t)=>{for(const[n,o]of Object.entries(e)){if(typeof o!="string")continue;const r=z$(n,o,t);r&&(e[n]=r)}},"resolveDependenciesCatalogReferences"),Nr=hn((e,t)=>{const n=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const o of n){if(!e[o]||typeof e[o]!="object")continue;const r=e[o];H$(r,t)}},"resolveCatalogReferences");var J$=Object.defineProperty,ge=(e,t)=>J$(e,"name",{value:t,configurable:!0});const G$=We(import.meta.url),xn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,aa=ge(e=>{if(typeof xn<"u"&&xn.versions&&xn.versions.node){const[t,n]=xn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return xn.getBuiltinModule(e)}return G$(e)},"__cjs_getBuiltinModule"),{existsSync:cd}=aa("node:fs"),{createInterface:U$}=aa("node:readline"),{styleText:_e}=aa("node:util");var V$=Object.defineProperty,be=ge((e,t)=>V$(e,"name",{value:t,configurable:!0}),"f");const Xe=be(e=>{const t=typeof e;return e!==null&&(t==="object"||t==="function")},"isObject"),K$=be(e=>{if(!Xe(e))return!1;for(const t in e)if(Object.hasOwn(e,t))return!1;return!0},"isEmptyObject"),pd=new Set(["__proto__","prototype","constructor"]),ud=1e6,Y$=be(e=>e>="0"&&e<="9","isDigit");function gn(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<=ud}return!1}ge(gn,"p$1");be(gn,"shouldCoerceToNumber");function Gn(e,t){return pd.has(e)?!1:(e&&gn(e)?t.push(Number.parseInt(e,10)):t.push(e),!0)}ge(Gn,"y");be(Gn,"processSegment");function la(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);const t=[];let n="",o="start",r=!1,i=0;for(const s of e){if(i++,r){n+=s,r=!1;continue}if(s==="\\"){if(o==="index")throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd")throw new Error(`Invalid character '${s}' after an index at position ${i}`);r=!0,o=o==="start"?"property":o;continue}switch(s){case".":{if(o==="index")throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd"){o="property";break}if(!Gn(n,t))return[];n="",o="property";break}case"[":{if(o==="index")throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd"){o="index";break}if(o==="property"||o==="start"){if((n||o==="property")&&!Gn(n,t))return[];n=""}o="index";break}case"]":{if(o==="index"){if(n==="")n=(t.pop()||"")+"[]",o="property";else{const a=Number.parseInt(n,10);!Number.isNaN(a)&&Number.isFinite(a)&&a>=0&&a<=Number.MAX_SAFE_INTEGER&&a<=ud&&n===String(a)?t.push(a):t.push(n),n="",o="indexEnd"}break}if(o==="indexEnd")throw new Error(`Invalid character '${s}' after an index at position ${i}`);n+=s;break}default:{if(o==="index"&&!Y$(s))throw new Error(`Invalid character '${s}' in an index at position ${i}`);if(o==="indexEnd")throw new Error(`Invalid character '${s}' after an index at position ${i}`);o==="start"&&(o="property"),n+=s}}}switch(r&&(n+="\\"),o){case"property":{if(!Gn(n,t))return[];break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}ge(la,"parsePath");be(la,"parsePath");function vn(e){if(typeof e=="string")return la(e);if(Array.isArray(e)){const t=[];for(const[n,o]of e.entries()){if(typeof o!="string"&&typeof o!="number")throw new TypeError(`Expected a string or number for path segment at index ${n}, got ${typeof o}`);if(typeof o=="number"&&!Number.isFinite(o))throw new TypeError(`Path segment at index ${n} must be a finite number, got ${o}`);if(pd.has(o))return[];typeof o=="string"&&gn(o)?t.push(Number.parseInt(o,10)):t.push(o)}return t}return[]}ge(vn,"d");be(vn,"normalizePath");function ot(e,t,n){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return n===void 0?e:n;const o=vn(t);if(o.length===0)return n;for(let r=0;r<o.length;r++){const i=o[r];if(e=e[i],e==null){if(r!==o.length-1)return n;break}}return e===void 0?n:e}ge(ot,"getProperty");be(ot,"getProperty");function ca(e,t,n){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return e;const o=e,r=vn(t);if(r.length===0)return e;for(let i=0;i<r.length;i++){const s=r[i];if(i===r.length-1)e[s]=n;else if(!Xe(e[s])){const a=typeof r[i+1]=="number";e[s]=a?[]:{}}e=e[s]}return o}ge(ca,"setProperty");be(ca,"setProperty");function dd(e,t){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return!1;const n=vn(t);if(n.length===0)return!1;for(let o=0;o<n.length;o++){const r=n[o];if(o===n.length-1)return Object.hasOwn(e,r)?(delete e[r],!0):!1;if(e=e[r],!Xe(e))return!1}}ge(dd,"deleteProperty");be(dd,"deleteProperty");function Tt(e,t){if(!Xe(e)||typeof t!="string"&&!Array.isArray(t))return!1;const n=vn(t);if(n.length===0)return!1;for(const o of n){if(!Xe(e)||!(o in e))return!1;e=e[o]}return!0}ge(Tt,"hasProperty");be(Tt,"hasProperty");function Qo(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return e.replaceAll(/[\\.[]/g,String.raw`\$&`)}ge(Qo,"escapePath");be(Qo,"escapePath");function pa(e){const t=Object.entries(e);return Array.isArray(e)?t.map(([n,o])=>[gn(n)?Number.parseInt(n,10):n,o]):t}ge(pa,"m$2");be(pa,"normalizeEntries");function ua(e,t={}){if(!Array.isArray(e))throw new TypeError(`Expected an array, got ${typeof e}`);const{preferDotForIndices:n=!1}=t,o=[];for(const[r,i]of e.entries()){if(typeof i!="string"&&typeof i!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof i}`);if(typeof i=="number")if(!Number.isInteger(i)||i<0){const s=Qo(String(i));o.push(r===0?s:`.${s}`)}else n&&r>0?o.push(`.${i}`):o.push(`[${i}]`);else if(typeof i=="string")if(i==="")r===0||o.push(".");else if(gn(i)){const s=Number.parseInt(i,10);n&&r>0?o.push(`.${s}`):o.push(`[${s}]`)}else{const s=Qo(i);o.push(r===0?s:`.${s}`)}}return o.join("")}ge(ua,"stringifyPath");be(ua,"stringifyPath");function*Pr(e,t=[],n=new Set){if(!Xe(e)||K$(e)){t.length>0&&(yield ua(t));return}if(!n.has(e)){n.add(e);for(const[o,r]of pa(e))t.push(o),yield*Pr(r,t,n),t.pop();n.delete(e)}}ge(Pr,"x");be(Pr,"deepKeysIterator");function fd(e){return[...Pr(e)]}ge(fd,"deepKeys");be(fd,"deepKeys");function md(e){const t={};if(!Xe(e))return t;for(const[n,o]of Object.entries(e))ca(t,n,o);return t}ge(md,"unflatten");be(md,"unflatten");var X$=Object.defineProperty,oi=ge((e,t)=>X$(e,"name",{value:t,configurable:!0}),"i");const Z$=oi(async e=>{const{default:t=!1,message:n,transformer:o}=e,r=oi(s=>{const a=_e(["cyan","bold"],"?"),l=_e(["bold"],s),p=t?`${_e(["greenBright"],"Y")}${_e(["gray"],"/n")}`:`y/${_e(["yellowBright"],"N")}`;return`${a} ${l} ${_e(["gray"],`(${p})`)}`},"formatMessage"),i=oi(s=>o?o(s):s?_e(["greenBright"],"Yes"):_e(["yellowBright"],"No"),"formatAnswer");return new Promise(s=>{const a=U$({input:process.stdin,output:process.stdout}),l=r(n);a.question(l,p=>{a.close();const c=p.trim().toLowerCase();if(c===""){s(t);return}if(c==="y"||c==="yes"){console.log(`${_e(["greenBright"],"✓")} ${i(!0)}`),s(!0);return}if(c==="n"||c==="no"){console.log(`${_e(["yellowBright"],"✗")} ${i(!1)}`),s(!1);return}console.log(`${_e(["gray"],"→")} ${i(t)}`),s(t)}),a.on("SIGINT",()=>{a.close(),console.log(`
48
48
  ${_e(["gray"],"→")} ${i(t)}`),s(t)})})},"confirm"),Q$=typeof process.stdout<"u"&&!process.versions.deno&&!globalThis.window;var ew=Object.defineProperty,ye=ge((e,t)=>ew(e,"name",{value:t,configurable:!0}),"l");const hd=/, ([^,]*)$/,er=new Map,gd=new Map;let tw=class extends Error{static{ge(this,"M")}static{ye(this,"PackageJsonValidationError")}constructor(t){super(`The following warnings were encountered while normalizing package data:
49
49
  - ${t.join(`
50
50
  - `)}`),this.name="PackageJsonValidationError"}};const Mr=ye((e,t,n=[])=>{const o=[];if(Om(e,r=>{o.push(r)},t),t&&o.length>0){const r=o.filter(i=>!n.some(s=>s instanceof RegExp?s.test(i):s===i));if(r.length>0)throw new tw(r)}return e},"normalizeInput"),nw=ye(async e=>await Tr(e),"parseYamlFile"),ow=ye(e=>_r(e),"parseYamlFileSync"),rw=ye(async e=>{const t=await Cp(e);return Lp.parse(t)},"parseJson5File"),iw=ye(e=>{const t=Fs(e);return Lp.parse(t)},"parseJson5FileSync"),vd=ye(async(e,t)=>t?.yaml!==!1&&(e.endsWith(".yaml")||e.endsWith(".yml"))?nw(e):t?.json5!==!1&&e.endsWith(".json5")?rw(e):hr(e),"parsePackageFile"),yd=ye((e,t)=>t?.yaml!==!1&&(e.endsWith(".yaml")||e.endsWith(".yml"))?ow(e):t?.json5!==!1&&e.endsWith(".json5")?iw(e):qs(e),"parsePackageFileSync");ye(async(e,t={})=>{const n={type:"file"};e&&(n.cwd=e);const o=["package.json"];t.yaml!==!1&&o.push("package.yaml","package.yml"),t.json5!==!1&&o.push("package.json5");let r;for(const l of o)if(r=await ft(l,n),r)break;if(!r)throw new It(`No such file or directory, for ${o.join(", ").replace(hd," or $1")} found.`);const i=t.cache&&typeof t.cache!="boolean"?t.cache:gd;if(t.cache&&i.has(r))return i.get(r);const s=await vd(r,t);if(t.resolveCatalogs){const l=await ad(r);l&&Nr(s,l)}Mr(s,t.strict??!1,t.ignoreWarnings);const a={packageJson:s,path:r};return t.cache&&i.set(r,a),a},"findPackageJson");ye((e,t={})=>{const n={type:"file"};e&&(n.cwd=e);const o=["package.json"];t.yaml!==!1&&o.push("package.yaml","package.yml"),t.json5!==!1&&o.push("package.json5");let r;for(const l of o)if(r=mt(l,n),r)break;if(!r)throw new It(`No such file or directory, for ${o.join(", ").replace(hd," or $1")} found.`);const i=t.cache&&typeof t.cache!="boolean"?t.cache:gd;if(t.cache&&i.has(r))return i.get(r);const s=yd(r,t);if(t.resolveCatalogs){const l=ld(r);l&&Nr(s,l)}Mr(s,t.strict??!1,t.ignoreWarnings);const a={packageJson:s,path:r};return t.cache&&i.set(r,a),a},"findPackageJsonSync");ye(async(e,t={})=>{const{cwd:n,...o}=t,r=Vn(n??process.cwd());await _p(V(r,"package.json"),e,o)},"writePackageJson");ye((e,t={})=>{const{cwd:n,...o}=t,r=Vn(n??process.cwd());ym(V(r,"package.json"),e,o)},"writePackageJsonSync");const da=ye((e,t)=>{const n=typeof e=="object"&&!Array.isArray(e);if(!n&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");let o,r=!1,i;if(n)o=structuredClone(e);else if(cd(e)){i=e;const a=t?.cache&&typeof t.cache!="boolean"?t.cache:er;if(t?.cache&&a.has(i))return a.get(i);o=yd(i,t),r=!0}else o=Tp(e);if(t?.resolveCatalogs)if(r){const a=ld(e);a&&Nr(o,a)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");Mr(o,t?.strict??!1,t?.ignoreWarnings);const s=o;return r&&t?.cache&&(typeof t.cache=="boolean"?er:t.cache).set(i,s),s},"parsePackageJsonSync"),DO=ye(async(e,t)=>{const n=typeof e=="object"&&!Array.isArray(e);if(!n&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");let o,r=!1,i;if(n)o=structuredClone(e);else if(cd(e)){i=e;const a=t?.cache&&typeof t.cache!="boolean"?t.cache:er;if(t?.cache&&a.has(i))return a.get(i);o=await vd(i,t),r=!0}else o=Tp(e);if(t?.resolveCatalogs)if(r){const a=await ad(e);a&&Nr(o,a)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");Mr(o,t?.strict??!1,t?.ignoreWarnings);const s=o;return r&&t?.cache&&(typeof t.cache=="boolean"?er:t.cache).set(i,s),s},"parsePackageJson");ye((e,t,n)=>ot(e,t,n),"getPackageJsonProperty");ye((e,t)=>Tt(e,t),"hasPackageJsonProperty");const bd=ye((e,t,n)=>{const o=ot(e,"dependencies",{}),r=ot(e,"devDependencies",{}),i=ot(e,"peerDependencies",{}),s={...o,...r,...n?.peerDeps===!1?{}:i};for(const a of t)if(Tt(s,a))return!0;return!1},"hasPackageJsonAnyDependency"),sw=ye(async(e,t,n="dependencies",o={})=>{const r=ot(e,"dependencies",{}),i=ot(e,"devDependencies",{}),s=ot(e,"peerDependencies",{}),a=[],l={deps:!0,devDeps:!0,peerDeps:!1,...o};for(const p of t)l.deps&&Tt(r,p)||l.devDeps&&Tt(i,p)||l.peerDeps&&Tt(s,p)||a.push(p);if(a.length!==0){if(process.env.CI||Q$&&!process.stdout.isTTY){const p=`Skipping package installation for [${t.join(", ")}] because the process is not interactive.`;if(o.throwOnWarn)throw new Error(p);o.logger?.warn?o.logger.warn(p):console.warn(p);return}if(typeof l.confirm?.message=="function"&&(l.confirm.message=l.confirm.message(a)),l.confirm?.message===void 0){const p=`${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:p}:l.confirm.message=p}await Z$(l.confirm)&&await Bp(a,{...l.installPackage,cwd:l.cwd?Vn(l.cwd):void 0,dev:n==="devDependencies"})}},"ensurePackages"),fa=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"],aw=/\.(?:js|mjs|cjs|ts|cts|mts)$/,LO=async(e,t="")=>{let n=t;if(!n){for(const o of fa)if(await pn(V(e,o))){n=`./${o}`;break}}if(!aw.test(n))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return n},FO=async e=>{for(const t of fa)if(await pn(V(e,t)))return!0;return!1},lw={esbuild:"esbuild",oxc:"oxc-transform",sucrase:"sucrase",swc:"@swc/core"},vl=async(e,t)=>{const n=Array.isArray(e)?e:[e],o=await Am(t).catch(()=>{});let r;return o==="yarn"||o==="bun"?r=`${o} add -D`:o==="pnpm"?r="pnpm add -D":r="npm install -D",`${r} ${n.join(" ")}`},tr=e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},js=(e,t,n,o)=>{if(e==="module-sync")return"esm";if(o){const s=tr(o);if(s)return s}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return n;const[r,...i]=t;return js(r,i,n,o)},cw=new Set(["browser","bun","default","deno","electron","import","module-sync","node","node-addons","require","types","workerd",...Kp,...Yp]),ma=(e,t,n,o,r)=>{if(!e)return[];if(typeof e=="string"){const i=tr(e);if(i&&i!==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:i??t}]}if(typeof e=="object"){const i=Object.entries(e).filter(([a])=>!a.endsWith(".json"));let s=[];for(const[a,l]of i){const p=a.replace("./",""),c=r.some(u=>p===u||p.startsWith(`${u}/`));if(typeof l=="string"){let u;Number.isInteger(+a)?u={exportKey:"*"}:a.startsWith("./")?u={exportKey:a.replace("./","")}:u={exportKey:a==="."?".":"*",subKey:a},s.push({...u,file:l,key:"exports",type:js(a,o,t,l),...c&&{ignored:!0}})}else if(typeof l=="object"&&l!==null)for(const[u,d]of Object.entries(l)){if(n===!1&&u==="types")continue;const f=Number.isInteger(+a)?u:a;if(typeof d=="string")s.push({exportKey:f.replace("./",""),file:d,key:"exports",...cw.has(u)?{subKey:u}:{},type:js(u,o,t,d),...c&&{ignored:!0}});else{const m=f.replace("./",""),h=c||r.some(y=>m===y||m.startsWith(`${y}/`)),v=ma({[f]:d},t,n,[...o,u],r);h&&v.forEach(y=>{y.ignored=!0}),s=[...s,...v]}}}return s}return[]},As=new Map,an=/\.[^./]+$/,Te=/\.d\.[mc]?ts$/,Os=/\.d\.mts$/,Rs=/\.d\.cts$/,yl=/\.d\.[mc]ts$/,pw=/^\.\/dist\//,Cs=/^dist\//,uw=/^\//,Dn=/^\.\//,dw=/\/$/,bl=/\.\w+$/,$l=/\*.*$/,fw=/\.(?:tsx?|cts|mts)$/,mw=/\.[cm]?tsx?$/,hw=/^(.+?)\.[^.]*$/,gw=/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,Ce=e=>e===void 0||e==="node16",$d=(e,t)=>{const n=Te.exec(e);if(n!==null)return n[0];if(t)for(const o of Object.values(t)){const r=o.startsWith(".")?o:`.${o}`;if(e.endsWith(r))return r}return rn(e)},vw=async e=>{try{return await tu.readdir(e,{withFileTypes:!0})}catch(t){const{code:n}=t;if(n==="ENOENT")return[];throw t}},wd=async(e,t)=>{const n=await vw(e);return(await Promise.all(n.map(async o=>{const r=Ya.join(e,o.name);return o.isDirectory()?wd(r,t):o.isFile()?Ya.relative(t,r):[]}))).flat()},yw=async e=>{let t=As.get(e);return t||(t=wd(e,e),As.set(e,t)),t},wl=(e,t,n)=>{const o=e.replace(an,"");if(t==="*"){const s=o.split("/").filter(Boolean);return s.length===0?void 0:n&&n>1?s:[s[0]]}const r=t.replaceAll(/[.+?^${}()|[\]\\]/g,String.raw`\$&`).replaceAll("*","(.*)"),i=new RegExp(`^${r}$`).exec(o);return i?i.slice(1):void 0},kt=(e,t)=>{let n=e;for(const o of t)n=n.replace("*",o);return n},bw=e=>e.endsWith(".d.mts")?"d.mts":e.endsWith(".d.cts")?"d.cts":"d.ts",$w=(e,t)=>e.key==="exports"&&e.subKey===Hn?Hn:e.key==="exports"&&e.subKey===Ua?Ua:t,ww=e=>{const t=e.replace(pw,"").replace(Cs,"").replace(an,"").split("/"),n=t.at(-1)??"",o=[".browser",".server",".development",".production",".node",".workerd"];for(const i of o)if(n.includes(i)){const s=n.replace(i,""),a=t.length>1?t.slice(0,-1).join("/"):"";return{baseName:a?`${a}/${s}`:s,pattern:i}}const r=n.split(".");if(r.length>2){const i=r.slice(0,-2).join("."),s=`.${r[r.length-2]}`,a=t.length>1?t.slice(0,-1).join("/"):"";return{baseName:a?`${a}/${i}`:i,pattern:s}}},xw=(e,t,n,o)=>{const r=`${t.replace(new RegExp(`^${o}/?`),"")}${n}`,i=r.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),s=new RegExp(String.raw`${i}\.([cm]?[tj]sx?|ts|js)$`),a=e.find(p=>{const c=p.replace(o,"").replace(uw,"");return s.test(c)});if(a)return a;const l=`${o}/${r}`;return e.find(p=>{const c=p.replace(an,"");return c===l||c.endsWith(`/${r}`)})??void 0},lt=(e,t,n,o,r,i,s,a)=>{const l=$w(r,i.environment);let{runtime:p}=i.options;const c=r.subKey==="browser"||typeof r.subKey=="string"&&r.subKey.includes("browser"),u=r.file.includes(".browser");if(c||u)p="browser";else{for(const b of Kp)if(r.file.includes(`.${b}.`)||r.subKey===b){p=b;break}(r.subKey==="node"||r.subKey==="workerd"||r.file.includes(".node")||r.file.includes(".workerd")||r.file.includes(".server"))&&(p="node")}const d=$d(r.file,i.options.outputExtensionMap),f=r.file.replace(d,""),m=i.options.outDir.replace(Dn,""),h=f.replace(new RegExp(`^(./)?${m}/`),""),v=t.replace(an,"").split("/").pop()??"",y=h.split("/").pop()??"",g=!t.includes(h)&&v!==y;let $=e.find(b=>b.input===t&&b.environment===l&&b.runtime===p&&b.fileAlias===(g?h:void 0));if($===void 0?$=e[e.push({environment:l,exportKey:new Set([r.exportKey].filter(Boolean)),fileAlias:g?h:void 0,input:t,runtime:p})-1]:$.exportKey&&r.exportKey&&$.exportKey.add(r.exportKey),s&&($.isGlob=!0),n&&($.outDir=o),r.isExecutable)$.executable=!0,$.declaration=!1,r.type==="cjs"?$.cjs=!0:r.type==="esm"&&($.esm=!0);else{const b=Te.test(r.file),w=a.filter(x=>x.exportKey===r.exportKey),E=w.length>0&&w.every(x=>Te.test(x.file));if(b&&i.options.declaration!==!1){$.declaration=i.options.declaration;const x=bw(r.file);$.declarationExtensions??=new Set,$.declarationExtensions.add(x)}if(b||E){E&&i.options.declaration!==!1&&($.declaration=i.options.declaration);const x=w.some(j=>Os.test(j.file)),k=w.some(j=>Rs.test(j.file));if(x&&k?(Ce(i.options.declaration)&&(i.options.declaration="compatible"),i.options.emitCJS=!0,i.options.emitESM=!0):k?(i.options.emitCJS=!0,Ce(i.options.declaration)&&(i.options.declaration="compatible")):x&&(i.options.emitESM=!0,Ce(i.options.declaration)&&(i.options.declaration="compatible")),E){const j=a.filter(N=>Te.test(N.file)),S=j.some(N=>Os.test(N.file)),R=j.some(N=>Rs.test(N.file));w.every(N=>!N.subKey||N.subKey==="types")?(R&&($.cjs=!0),S&&($.esm=!0)):(R&&($.declarationCjs=!0),S&&($.declarationEsm=!0))}}else r.type==="cjs"?$.cjs=!0:r.type==="esm"&&($.esm=!0)}g&&!$.fileAlias&&($.fileAlias=h)};let ri=!1;const xl=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.")},kw=async(e,t,n)=>{const o=e.types||e.typings;As.clear(),ri=!1;const r=[];t.sort((f,m)=>f.split("/").length-m.split("/").length);const i=e.type==="module"?"esm":"cjs",s=n.options.declaration??"node16",a=ma(e.exports,i,s,[],n.options.ignoreExportKeys??[]).filter(f=>!f.ignored),l=new Set;for(const f of a){const m=a.filter(h=>h.exportKey===f.exportKey);if(m.length>0&&m.every(h=>Te.test(h.file))&&!l.has(f.exportKey)){l.add(f.exportKey);const h=m.some(y=>y.file.endsWith(".d.mts")),v=m.some(y=>y.file.endsWith(".d.cts"));h&&v?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0,n.options.emitESM=!0):v?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0):h&&(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitESM=!0)}}n.options.declaration??="node16";const p=a.some(f=>f.type==="esm"&&!Os.test(f.file)),c=a.some(f=>f.type==="cjs"&&!Rs.test(f.file));p&&c?(n.options.emitESM=!0,n.options.emitCJS=!0):p?n.options.emitESM=!0:c?n.options.emitCJS=!0:i==="esm"?n.options.emitESM=!0:n.options.emitCJS=!0;const u=n.options.emitCJS&&n.options.emitESM;if(n.options.declaration==="node16"&&u&&(n.options.declaration="compatible"),e.bin){const f=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const m of f){const h=tr(m);if(h&&h!==i)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??i})}}e.main&&a.push({file:e.main,key:"main",type:tr(e.main)??i}),e.module&&a.push({file:e.module,key:"module",type:"esm"}),o&&(xl(n),Ce(n.options.declaration)&&u&&(n.options.declaration="compatible"),a.push({file:o,key:"types"}));const d=[];if(!n.options.outputExtensionMap){const f=a.some(v=>!v.isExecutable&&!Te.test(v.file)&&v.file.endsWith(".mjs")),m=a.some(v=>!v.isExecutable&&!Te.test(v.file)&&v.file.endsWith(".cjs")),h=a.some(v=>!v.isExecutable&&!Te.test(v.file)&&v.file.endsWith(".js"));f&&!m&&!h?n.options.outputExtensionMap={esm:"mjs"}:m&&!f&&!h&&(n.options.outputExtensionMap={cjs:"cjs"})}for(const f of a){const m=Te.test(f.file),h=$d(f.file,n.options.outputExtensionMap),v=[...vr];if(n.options.outputExtensionMap)for(const S of Object.values(n.options.outputExtensionMap)){const R=S.startsWith(".")?S:`.${S}`;v.includes(R)||v.push(R)}if(!m&&h!==""&&!v.includes(h)||!m&&fw.test(f.file))continue;let y=f.type;if(!y&&m){if(f.file.endsWith(".d.mts"))y="esm";else if(f.file.endsWith(".d.cts"))y="cjs";else if(f.file.endsWith(".d.ts")){const S=a.some(N=>N.subKey==="import"&&N.file.endsWith(".d.mts")),R=a.some(N=>N.subKey==="require"&&N.file.endsWith(".d.cts"));S&&R?y=void 0:y=n.pkg.type==="module"?"esm":"cjs"}}if(Te.test(f.file)||(n.options.emitCJS===void 0&&(y==="cjs"||f.type==="cjs")&&(n.options.emitCJS=!0),n.options.emitESM===void 0&&(y==="esm"||f.type==="esm")&&(n.options.emitESM=!0)),Ce(n.options.declaration)){const S=n.options.emitCJS&&n.options.emitESM;n.options.declaration=S?"compatible":"node16"}let g=f.file;if(n.options.outputExtensionMap)for(const S of Object.values(n.options.outputExtensionMap)){const R=S.startsWith(".")?S:`.${S}`;if(f.file.endsWith(R)){g=f.file.slice(0,-R.length);break}}g===f.file&&(g=f.file.replace(gw,""));const $=g.endsWith("/");if($&&["./","/"].includes(g))continue;const b=g.replace(new RegExp(`(./)?${n.options.outDir}`),n.options.sourceDir).replace("./",""),w=$?"":String.raw`(\.d\.[cm]?ts|(\.[cm]?[tj]sx?))$`,E="(?:^|/)";if((f.file.includes("/*")||g.includes("*"))&&f.key==="exports"){ri||(n.logger?.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),ri=!0);let S;f.exportKey?S=f.exportKey.startsWith("./")?f.exportKey.slice(2):f.exportKey:S=(f.file.startsWith("./")?f.file.slice(2):f.file).replace(Cs,"");const R=f.file,N=bl.exec(R);if(R.includes("*")&&!N&&f.exportKey&&!f.subKey){const P=R.replace($l,"").replace(Dn,""),M=S.replace($l,"").replace(Dn,"");if(P!==M){const q=`package.json#exports["${f.exportKey==="."?".":`./${f.exportKey}`}"]`;r.push(`Wildcard pattern must include a file extension: ${R} at ${q}`);continue}}const J=n.options.sourceDir.replace(Dn,""),G=X(n.options.rootDir,J),H=[],_=await yw(G),O=R.split("*").length-1,F=S.split("*").length-1;for(const P of _){const M=wl(P,S,O);if(M){if(O>F&&O>1){if(M.length>=O){const B=M[0];if(M.every(D=>D===B)){const D=kt(R,M.slice(0,O));D.includes("*")||H.push({input:X(G,P),output:D})}continue}const U=P.replace(an,"").split("/").filter(Boolean);if(U.length>=O){const B=Math.floor(U.length/O),D=[];for(let z=0;z<O;z+=1){const A=z*B,ae=z===O-1?U.length:(z+1)*B;D.push(U.slice(A,ae).join("/"))}const K=D[0];if(D.every(z=>z===K)){const z=kt(R,D);z.includes("*")||H.push({input:X(G,P),output:z})}}else if(U.length>0){const B=U[0];if(U.every(D=>D===B)){const D=Array.from({length:O}).fill(B),K=kt(R,D);K.includes("*")||H.push({input:X(G,P),output:K})}}continue}if(M.length<O)continue;if(F>0&&F<O&&O>1&&M.length>1){const U=M[0];if(!M.every(B=>B===U))continue}const q=kt(R,M);if(q.includes("*"))continue;H.push({input:X(G,P),output:q})}}if(H.length===0&&R.includes("*")){let P=(f.file.startsWith("./")?f.file.slice(2):f.file).replace(Cs,"");P=P.replace(bl,"");for(const M of _){const q=wl(M,P,O);if(q){if(O>1&&F<O){if(q.length>=O){const D=q[0];if(q.every(K=>K===D)){const K=kt(R,q);K.includes("*")||H.push({input:X(G,M),output:K});continue}}const U=M.replace(an,""),B=P.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 z=new RegExp(`^${K}$`).exec(U);if(z){const A=z[1],ae=kt(R,Array.from({length:O}).fill(A));ae.includes("*")||H.push({input:X(G,M),output:ae})}}continue}if(q.length>=O){if(F>0&&F<O&&O>1&&q.length>1){const B=q[0];if(!q.every(D=>D===B))continue}const U=kt(R,q);U.includes("*")||H.push({input:X(G,M),output:U})}}}}if(H.length===0){a.length>1||r.push(`Could not find entrypoints matching pattern \`${S}\` for output \`${R}\``);continue}const I=a.filter(P=>P.exportKey===f.exportKey);if(I.length>0&&I.every(P=>Te.test(P.file))){const P=I.some(D=>D.file.endsWith(".d.ts")),M=I.some(D=>D.file.endsWith(".d.mts")),q=I.some(D=>D.file.endsWith(".d.cts"));M&&q?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0,n.options.emitESM=!0):q?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0):M&&(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitESM=!0);const U=I.find(D=>D.file.endsWith(".d.ts")),B=U??I.find(D=>D.file.endsWith(".d.mts"))??I.find(D=>D.file.endsWith(".d.cts"))??f;if(!(B===f||U!==void 0&&f===U||U===void 0&&B===f))continue;for(const{input:D,output:K}of H){let z=K;if(K.endsWith(".d.mts")||K.endsWith(".d.cts"))z=K.replace(yl,".d.ts");else if(!K.endsWith(".d.ts")){const ae=K.replace(yl,".d.ts");P&&(z=ae)}const A={...B,file:z,subKey:"types",type:void 0};lt(d,D,!1,g,A,n,!0,a)}}else for(const{input:P,output:M}of H){const q=Te.test(M);let U=f.type;q||(M.endsWith(".mjs")?U="esm":M.endsWith(".cjs")?U="cjs":M.endsWith(".js")&&!U&&(U=n.pkg.type==="module"?"esm":"cjs"));const B={...f,file:M,...!q&&U&&{type:U}};lt(d,P,!1,g,B,n,!0,a)}continue}const x=new RegExp(E+b.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+w);let k=t.find(S=>x.test(S));if(k===void 0){const S=n.options.sourceDir.replace(Dn,""),R=X(n.options.rootDir,S),N=ww(f.file);if(N){const J=xw(t,N.baseName,N.pattern,R);if(J)k=J;else{const G=N.baseName,H=new RegExp(E+G.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+w);k=t.find(_=>H.test(_))}}else{const J=b.replace(hw,"$1").replace(dw,"");if(Yp.has(f.subKey)){const G=new RegExp(E+J.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+w);k=t.find(H=>G.test(H))}}}if(k===void 0){nt(X(n.options.rootDir,f.file))||r.push(`Could not find entrypoint for \`${f.file}\``);continue}nt(k)&&mw.test(k)&&xl(n);const j=a.filter(S=>S.exportKey===f.exportKey);if(j.length>0&&j.every(S=>Te.test(S.file))){const S=j.some(J=>J.file.endsWith(".d.mts")),R=j.some(J=>J.file.endsWith(".d.cts"));S&&R?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0,n.options.emitESM=!0):R?(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitCJS=!0):S&&(Ce(n.options.declaration)&&(n.options.declaration="compatible"),n.options.emitESM=!0);const N={...f,subKey:"types",type:void 0};lt(d,k,$,g,N,n,!1,a)}else{const S=Sm(k.replace(Us,"")),R=`${S}.cts`,N=`${S}.mts`,J=nt(R),G=nt(N),H=f.file.endsWith(".d.mts")||f.file.endsWith(".mjs"),_=f.file.endsWith(".d.cts")||f.file.endsWith(".cjs");H&&G?lt(d,N,$,g,{...f,type:"esm"},n,!1,a):_&&J?lt(d,R,$,g,{...f,type:"cjs"},n,!1,a):J&&G?(lt(d,R,$,g,{...f,type:"cjs"},n,!1,a),lt(d,N,$,g,{...f,type:"esm"},n,!1,a)):lt(d,k,$,g,f,n,!1,a)}}return{entries:d,warnings:r}},kn=e=>typeof e=="string"&&e!=="",Ew=(e,t)=>{const{publishConfig:n}=e;return n&&(n.bin&&(typeof n.bin=="object"||typeof n.bin=="string")&&(e.bin=n.bin),kn(n.type)&&(e.type=n.type),kn(n.main)&&(e.main=n.main),kn(n.module)&&(e.module=n.module),t===void 0&&kn(n.types)?e.types=n.types:t===void 0&&kn(n.typings)&&(e.typings=n.typings),n.exports&&typeof n.exports=="object"&&(e.exports=n.exports)),e},xd=/.*\/dist\/.*/,kl=/\/$/,Sw=/\.mjs$/,jw=/\.cjs$/,Aw=/\.d\.[mc]?ts$/,Ow=/(?<!\.d)\.js$/,Rw=e=>{const t=[],n=new Set,o=r=>{if(typeof r=="string"){t.push(r);return}if(Array.isArray(r)){for(const i of r)o(i);return}if(r&&typeof r=="object")for(const[i,s]of Object.entries(r))i.startsWith(".")||n.add(i),o(s)};e.exports&&o(e.exports);for(const r of[e.main,e.module,e.types])typeof r=="string"&&t.push(r);return{conditions:n,files:t}},Cw=(e,t,n)=>{if(e.options.emitESM!==void 0||e.options.emitCJS!==void 0)return;const o=e.pkg.type==="module"?"esm":"cjs",r=n.some(a=>Ow.test(a));let i=n.some(a=>Sw.test(a))||t.has("import")||t.has("module"),s=n.some(a=>jw.test(a))||t.has("require");(r||!i&&!s)&&o==="esm"?i=!0:(r||!i&&!s)&&(s=!0),e.options.emitESM=i,e.options.emitCJS=s},Tw=(e,t,n)=>{if(e.options.declaration!==void 0)return;const o=!!e.pkg.types||t.has("types")||n.some(r=>Aw.test(r));e.options.declaration=o?"node16":!1},_w=e=>{e.options.entries.length=0;const t=V(e.options.rootDir,e.options.sourceDir);if(!nt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const n=Np(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[Ot,xd]}).filter(p=>jt.test(p)&&!p.endsWith(".d.ts")),{conditions:o,files:r}=Rw(e.pkg);Cw(e,o,r),Tw(e,o,r);const i=e.options.emitESM??!1,s=e.options.emitCJS??!1;for(const p of n){const c=p.replace(`${t}/`,"").replace(jt,"").replaceAll("\\","/");e.options.entries.push({cjs:s,declaration:e.options.declaration,esm:i,input:p,name:c})}const a=[];i&&a.push("[esm]"),s&&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"}`),Fe(a.join(" ")))},Nw={hooks:{"build:prepare":async function(e){if(e.options.unbundle){_w(e);return}if(e.options.entries.length>0)return;const t=V(e.options.rootDir,e.options.sourceDir);if(!nt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const n=Np(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[Ot,xd]});if(n.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");const o=e.logger;let r={...e.pkg};r.publishConfig&&(o.info(`Using publishConfig found in package.json, to override the default key-value pairs of "${Object.keys(r.publishConfig).join(", ")}".`),o.debug(r.publishConfig),r=Ew(r,e.options.declaration));const i=await kw(r,n,e);for(const s of i.warnings)o.warn(s);if(e.options.entries.push(...i.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");o.info("Automatically detected entries:",ne(e.options.entries.map(s=>s.fileAlias?`${je(s.fileAlias)} => ${je(s.input.replace(`${e.options.rootDir}/`,"").replace(kl,"/*"))}`:je(s.input.replace(`${e.options.rootDir}/`,"").replace(kl,"/*"))).join(", ")),Fe([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(s=>`[${s}]`).join(" ")))}}},Pw=We(import.meta.url),Ut=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ha=e=>{if(typeof Ut<"u"&&Ut.versions&&Ut.versions.node){const[t,n]=Ut.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Ut.getBuiltinModule(e)}return Pw(e)},{existsSync:ii}=ha("node:fs"),{env:si,cwd:Mw}=Ut,{createRequire:po}=ha("node:module"),Iw=0,ai=2,Ww=Symbol("findUpStop"),kd=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},El=e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"},Bw=po(import.meta.url),En=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Dw=e=>{if(typeof En<"u"&&En.versions&&En.versions.node){const[t,n]=En.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return En.getBuiltinModule(e)}return Bw(e)},{lstatSync:Sl,mkdirSync:Lw}=Dw("node:fs"),Fw=e=>{kd(e);try{const t=Sl(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(El(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{Lw(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const n=Sl(e);if(!n.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(El(n))}'`,{cause:t})}},qw=/^[A-Z]:\//i,uo=(e="")=>e&&e.replaceAll("\\","/").replace(qw,t=>t.toUpperCase()),zw=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Hw=/^[A-Z]:$/i,Jw=/.(\.[^./]+)$/,Gw=/^[/\\]|^[a-z]:[/\\]/i,Uw=/\/$/,Vw=()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/",Kw=(e,t)=>{let n="",o=0,r=-1,i=0,s;for(let a=0;a<=e.length;++a){if(a<e.length)s=e[a];else{if(s==="/")break;s="/"}if(s==="/"){if(!(r===a-1||i===1))if(i===2){if(n.length<2||o!==2||!n.endsWith(".")||n.at(-2)!=="."){if(n.length>2){const l=n.lastIndexOf("/");l===-1?(n="",o=0):(n=n.slice(0,l),o=n.length-1-n.lastIndexOf("/")),r=a,i=0;continue}else if(n.length>0){n="",o=0,r=a,i=0;continue}}t&&(n+=n.length>0?"/..":"..",o=2)}else n.length>0?n+=`/${e.slice(r+1,a)}`:n=e.slice(r+1,a),o=a-r-1;r=a,i=0}else s==="."&&i!==-1?++i:i=-1}return n},nr=e=>zw.test(e),li=function(...e){e=e.map(o=>uo(o));let t="",n=!1;for(let o=e.length-1;o>=-1&&!n;o--){const r=o>=0?e[o]:Vw();!r||r.length===0||(t=`${r}/${t}`,n=nr(r))}return t=Kw(t,!n),n&&!nr(t)?`/${t}`:t.length>0?t:"."},Yw=function(e){return Jw.exec(uo(e))?.[1]??""},Ed=e=>{const t=uo(e).replace(Uw,"").split("/").slice(0,-1);return t.length===1&&Hw.test(t[0])&&(t[0]=`${t[0]}/`),t.join("/")||(nr(e)?"/":".")},Xw=(e,t)=>uo(e).split("/").pop(),Zw=function(e){const t=Gw.exec(e)?.[0]?.replaceAll("\\","/")??"",n=Xw(e),o=Yw(n);return{base:n,dir:Ed(e),ext:o,name:n.slice(0,n.length-o.length),root:t}},Qw=po(import.meta.url),Sn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,e0=e=>{if(typeof Sn<"u"&&Sn.versions&&Sn.versions.node){const[t,n]=Sn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Sn.getBuiltinModule(e)}return Qw(e)},{fileURLToPath:t0}=e0("node:url");function n0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jl,Al;function o0(){return Al||(Al=1,jl=["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"]),jl}var r0=o0();const i0=n0(r0);new Set(i0);const Ts=e=>uo(e instanceof URL?t0(e):e),s0=po(import.meta.url),jn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Sd=e=>{if(typeof jn<"u"&&jn.versions&&jn.versions.node){const[t,n]=jn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return jn.getBuiltinModule(e)}return s0(e)};Sd("node:fs/promises");Sd("node:url");const a0=po(import.meta.url),An=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,jd=e=>{if(typeof An<"u"&&An.versions&&An.versions.node){const[t,n]=An.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return An.getBuiltinModule(e)}return a0(e)},{statSync:l0,lstatSync:c0}=jd("node:fs"),{fileURLToPath:p0}=jd("node:url"),u0=(e,t={})=>{const n=t.cwd?Ts(t.cwd):process.cwd();let o=li(n);const{root:r}=Zw(o),i=Ts(t.stopAt??r),s=li(o,i),a=t.type??"file",l=function(c){return[e]};t.allowSymlinks??=!0;const p=t.allowSymlinks?l0:c0;for(;o&&o!==s&&o!==r;){for(let c of l()){if(c===Ww)return;if(c===void 0)continue;Buffer.isBuffer(c)?c=c.toString():c instanceof URL&&(c=p0(c));const u=nr(c)?c:li(o,c);try{const d=p(u);if(a==="file"&&d.isFile()||a==="directory"&&d.isDirectory())return u}catch{}}o=Ed(o)}},d0=po(import.meta.url),On=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f0=e=>{if(typeof On<"u"&&On.versions&&On.versions.node){const[t,n]=On.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return On.getBuiltinModule(e)}return d0(e)};f0("node:fs/promises");const{accessSync:m0}=ha("node:fs");function ci(e,t=Iw){kd(e),e=Ts(e);try{return m0(e,t),!0}catch{return!1}}let h0=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 g0=/^[A-Z]:\//i,Ad=(e="")=>e&&e.replaceAll("\\","/").replace(g0,t=>t.toUpperCase()),v0=/^[/\\]{2}/,y0=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Od=/^[A-Z]:$/i,b0=/\/$/,$0=(e,t)=>{let n="",o=0,r=-1,i=0,s;for(let a=0;a<=e.length;++a){if(a<e.length)s=e[a];else{if(s==="/")break;s="/"}if(s==="/"){if(!(r===a-1||i===1))if(i===2){if(n.length<2||o!==2||!n.endsWith(".")||n.at(-2)!=="."){if(n.length>2){const l=n.lastIndexOf("/");l===-1?(n="",o=0):(n=n.slice(0,l),o=n.length-1-n.lastIndexOf("/")),r=a,i=0;continue}else if(n.length>0){n="",o=0,r=a,i=0;continue}}t&&(n+=n.length>0?"/..":"..",o=2)}else n.length>0?n+=`/${e.slice(r+1,a)}`:n=e.slice(r+1,a),o=a-r-1;r=a,i=0}else s==="."&&i!==-1?++i:i=-1}return n},_s=e=>y0.test(e),w0=function(e){if(e.length===0)return".";e=Ad(e);const t=v0.exec(e),n=_s(e),o=e.at(-1)==="/";return e=$0(e,!n),e.length===0?n?"/":o?"./":".":(o&&(e+="/"),Od.test(e)&&(e+="/"),t?n?`//${e}`:`//./${e}`:n&&!_s(e)?`/${e}`:e)},ko=(...e)=>{let t="";for(const n of e)if(n)if(t.length>0){const o=t.at(-1)==="/",r=n[0]==="/";o&&r?t+=n.slice(1):t+=o||r?n:`/${n}`}else t+=n;return w0(t)},x0=e=>{const t=Ad(e).replace(b0,"").split("/").slice(0,-1);return t.length===1&&Od.test(t[0])&&(t[0]=`${t[0]}/`),t.join("/")||(_s(e)?"/":".")},Ol=(e,t)=>(t?.create&&Fw(e),e),k0=(e,t)=>{if(si.CACHE_DIR&&!["0","1","false","true"].includes(si.CACHE_DIR))return Ol(ko(si.CACHE_DIR,e),t);const n=u0("package.json",{cwd:t?.cwd??Mw(),type:"file"});if(!n){if(t?.throwError)throw new h0("No such file or directory found.");return}const o=ko(x0(n),"node_modules"),r=ko(o,".cache"),i=ko(r,e);if(!(ii(i)&&!ci(i,ai))&&!(ii(r)&&!ci(r,ai))&&!(ii(o)&&!ci(o,ai)))return Ol(i,t)},E0=k0,S0=/^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i,j0=/^KIBI/,A0=/^MIBI/,O0=/^GIBI/,R0=/^TEBI/,C0=/^PEBI/,T0=/^EXBI/,_0=/^ZEBI/,N0=/^YIBI/,P0=/^(.)IB$/,Rd={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"}]},M0=(e,t)=>{const n=new Intl.NumberFormat(t).format(11111).replaceAll(new RegExp("\\p{Number}","gu"),""),o=new Intl.NumberFormat(t).format(1.1).replaceAll(new RegExp("\\p{Number}","gu"),"");return Number.parseFloat(e.replaceAll(new RegExp(`\\${n}`,"g"),"").replace(new RegExp(`\\${o}`),"."))},Cd=e=>{switch(e){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},I0=(e,t)=>{const n={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 o=S0.exec(e)?.groups;if(!o)return Number.NaN;const r=M0(o.value,n.locale),i=(o.type??"Bytes").toUpperCase().replace(j0,"KILO").replace(A0,"MEGA").replace(O0,"GIGA").replace(R0,"TERA").replace(C0,"PETA").replace(T0,"EXA").replace(_0,"ZETTA").replace(N0,"YOTTA").replace(P0,"$1B"),s=Rd[n.units].findIndex(l=>l.short[0].toUpperCase()===i[0]),a=Cd(n.base);return r*a**s},Se=(e,t)=>{if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("Bytesize is not a number.");const{base:n,decimals:o,locale:r,long:i,unit:s,units:a,...l}={base:2,decimals:0,locale:"en-US",long:!1,units:"metric",...t},p=Cd(n),c=Math.abs(e),u=t?.space??!0?" ":"",d=Rd[a],f=d.findIndex(g=>g.short===s);if(e===0){const g=Math.min(0,Math.max(f,d.length-1));return"0"+u+d[g][i?"long":"short"]}const m=f===-1?Math.min(Math.floor(Math.log(c)/Math.log(p)),d.length-1):f,h=d[m][i?"long":"short"],v=e/p**m,y=o<0?void 0:o;return new Intl.NumberFormat(r,{maximumFractionDigits:y,minimumFractionDigits:y,...l}).format(v)+u+h},W0=(e,t,n,o,r,i,s,a,l,p,c,u,d,f)=>{const m={d:o,h:r,m:i,mo:t,ms:a,s,w:n,y:e};return m.future=l,m.past=p,m.decimal=c,u!==void 0&&(m.unitMap=u),m.groupSeparator=d,m.placeholderSeparator=f,m},B0={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"},D0=W0(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",".",B0,",","_"),L0=e=>{const t=["y","mo","w","d","h","m","s","ms","future","past"];for(const o of t)if(!Object.hasOwn(e,o))throw new TypeError(`Missing required property: ${o}`);if(typeof e.future!="string"||typeof e.past!="string")throw new TypeError("Properties future and past must be of type string");const n=["y","mo","w","d","h","m","s","ms"];for(const o of n)if(typeof e[o]!="string"&&typeof e[o]!="function")throw new TypeError(`Property ${o} 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(o=>typeof o!="string"))throw new TypeError("All values in unitMap must be of type string")},Td=(e,t)=>{t=t||-1;const n=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(t)}})?`).exec(e.toString());return n===null?e:Number.parseFloat(n[0])},Rl=({unitCount:e,unitName:t},n,o)=>{let{spacer:r}=o;const{maxDecimalPoints:i}=o;let s=".";o.decimal!==void 0?s=o.decimal:n.decimal!==void 0&&(s=n.decimal);let a;"digitReplacements"in o?a=o.digitReplacements:"_digitReplacements"in n&&(a=n._digitReplacements);let l,p=e;i!==void 0&&(p=Td(e,i));const c=p.toString();if(!n._hideCountIf2||e!==2)if(a){l="";for(const f of c)l+=f==="."?s:a[f]}else l=c.replace(".",s);else l="";const u=n[t];let d=u;return typeof u=="function"&&(d=u(e)),n._hideCountIf2&&e===2&&(r=""),n._numberFirst?d+r+l:l+r+d},F0=(e,t)=>{const{units:n}=t;if(n.length===0)return[];const{unitMeasures:o}=t,r=t.largest??Number.POSITIVE_INFINITY,i={};let s,a,l,p=e;for(a=0;a<n.length;a++){s=n[a];const u=o[s];l=a===n.length-1?p/u:Math.floor(p/u),i[s]=l,p-=l*u}if(t.round){let u=r;for(a=0;a<n.length;a++)if(s=n[a],l=i[s],l!==0&&(u--,u===0)){for(let d=a+1;d<n.length;d++){const f=n[d],m=i[f];i[s]=(i[s]??0)+m*o[f]/o[s],i[f]=0}break}for(a=n.length-1;a>=0;a--){if(s=n[a],l=i[s],l===0)continue;const d=Math.round(l);if(i[s]=d,a===0)break;const f=n[a-1],m=o[f],h=Math.floor(d*o[s]/m);if(h)i[f]=(i[f]??0)+h,i[s]=0;else break}}const c=[];for(a=0;a<n.length&&c.length<r;a++){if(s=n[a],l=i[s],l&&!t.round&&c.length===r-1){let u,d=0;for(u=a+1,n.length;u<n.length;u++){const f=n[u];d+=i[f]*(t.unitMeasures[f]/t.unitMeasures[s])}l+=d,t.maxDecimalPoints!==void 0&&(l=Td(l,t.maxDecimalPoints))}l&&c.push({unitCount:l,unitName:s})}return c},q0=(e,t,n)=>{const{language:o,units:r}=t;if(e.length===0){const u=r.at(-1);return Rl({unitCount:0,unitName:u},o,t)}const{conjunction:i,serialComma:s}=t;let a=", ";t.delimiter!==void 0?a=t.delimiter:o.delimiter!==void 0&&(a=o.delimiter);let l="";t.timeAdverb&&n!==0&&(l=o.future??"",n<0&&(l=o.past??""));const p=e.map(u=>Rl(u,o,t));let c;return!i||e.length===1?c=p.join(a):e.length===2?c=p.join(i):c=p.slice(0,-1).join(a)+(s?",":"")+i+(p.at(-1)??""),l&&(c=l.replace("%s",c)),c},Cl=(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 n={conjunction:"",language:D0,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};L0(n.language);const o=Math.abs(e),r=F0(o,n);return q0(r,n,e)};var z0=Object.defineProperty,_d=(e,t)=>z0(e,"name",{value:t,configurable:!0});const H0=We(import.meta.url),Rn=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Nd=_d(e=>{if(typeof Rn<"u"&&Rn.versions&&Rn.versions.node){const[t,n]=Rn.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Rn.getBuiltinModule(e)}return H0(e)},"__cjs_getBuiltinModule"),{execSync:J0}=Nd("node:child_process"),{existsSync:Tl,readFileSync:G0}=Nd("node:fs");var U0=Object.defineProperty,Ze=_d((e,t)=>U0(e,"name",{value:t,configurable:!0}),"r");const ga=["yarn.lock","package-lock.json","pnpm-lock.yaml","npm-shrinkwrap.json","bun.lockb"],Pd=Ze(e=>{let t;if(ga.forEach(o=>{!t&&Tl(V(e,o))&&(t=V(e,o))}),t)return t;const n=V(e,"package.json");if(Tl(n)&&da(G0(n,"utf8")).packageManager!==void 0)return n},"packageMangerFindUpMatcher"),Md=Ze(e=>{if(!e)throw new It("Could not find a package manager");if(e.endsWith("package.json")){const t=da(e);if(t.packageManager){const n=["npm","yarn","pnpm","bun"].find(o=>t.packageManager.startsWith(o));if(n)return{packageManager:n,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 It("Could not find a package manager")},"resolvePackageManagerFromFile"),V0=Ze(async e=>{const t=await ft(ga,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find lock file");return t},"findLockFile"),K0=Ze(e=>{const t=mt(ga,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find lock file");return t},"findLockFileSync"),Y0=Ze(async e=>{const t=await ft(Pd,{...e&&{cwd:e}});return Md(t)},"findPackageManager"),Id=Ze(e=>{const t=mt(Pd,{...e&&{cwd:e}});return Md(t)},"findPackageManagerSync");Ze(e=>J0(`${e} --version`).toString("utf8").trim(),"getPackageManagerVersion");Ze(()=>{if(!process.env.npm_config_user_agent)return;const e=process.env.npm_config_user_agent.split(" ")[0],t=e.lastIndexOf("/"),n=e.slice(0,Math.max(0,t));return{name:n==="npminstall"?"cnpm":n,version:e.slice(Math.max(0,t+1))}},"identifyInitiatingPackageManager");Ze((e,t,n)=>{const o=t.length===1?"":"s";if(n.packageManagers??=["npm","pnpm","yarn"],n.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 r=`
@@ -122,7 +122,7 @@ ${n}`;throw new Error(o)},"enhanceError"),$S=ho((e,t)=>{const n=e.split(bS);let
122
122
  `),"cleanUnnecessaryComments"),Mc=new Map;function Pa(e,t,{identifierReplacements:n},o){const r=br(e);let i=e;for(const a of Object.keys(n??{})){const l=r.find(c=>c.specifier===a&&c.imports.includes("{"));if(!l){this.warn(`${t.fileName} does not import "${a}" for replacement`),process.exitCode=1;continue}const p=n?.[a]??{};for(const c of Object.keys(p)){if(!l.imports.includes(c))throw new Error(`${t.fileName} does not import "${c}" from "${a}" for replacement`);const u=p[c],d=VS(c);u.includes(".")&&(i=i.replace(new RegExp(String.raw`\b\w+\b as ${d},?\s?`),"")),i=i.replaceAll(new RegExp(String.raw`\b${d}\b`,"g"),u)}}const s=KS(Array.from(i.matchAll(GS),a=>a[0]));if(s.length>0){const a=s.map(p=>`
123
123
  - ${p}`).join(""),l=t.fileName.replace(YS,"");Mc.has(l)||o.warn({message:`${t.fileName} contains confusing identifier names${a}
124
124
 
125
- To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),Mc.set(l,!0)}return i}Re(Pa,"O");$t(Pa,"replaceConfusingTypeNames");function Ma(e,t){if(!e.includes("@internal"))return e;const n=new ke(e),o=$r(t.fileName,e,{lang:"dts",sourceType:"module"}),r=$t(a=>{let l=a,p=!0;for(;p;){for(p=!1;l<e.length&&qS.test(e[l]);)l+=1;for(const c of o.comments)if(c.start===l){l=c.end,p=!0;break}}return l},"skipPastCommentsAndWhitespace"),i=[];for(const a of o.comments)a.type!=="Block"||!a.value.includes("@internal")||i.push({commentStart:a.start,nextStart:r(a.end)});i.length>0&&_a(o.program,{enter(a){if(a.type==="Program")return;const{end:l,start:p}=a;if(typeof p!="number"||typeof l!="number")return;const c=i.findIndex(f=>f.nextStart===p);if(c===-1)return;const[{commentStart:u}]=i.splice(c,1),d=e[l]===","?l+1:l;n.remove(u,d),this.skip()}});const s=n.toString();if(s.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`);return s}Re(Ma,"v");$t(Ma,"stripInternalTypes");const ZS=$t((e,t)=>({name:"packem:patch-types",renderChunk(n,o){return n=Pa.call(this,n,o,e,t),n=Ma.call(this,n,o),n=XS(n),n}}),"patchTypescriptTypes");var QS=Object.defineProperty,ej=(e,t)=>QS(e,"name",{value:t,configurable:!0}),tj=Object.defineProperty,et=ej((e,t)=>tj(e,"name",{value:t,configurable:!0}),"o");const nj=/^\./,oj=/\0/,rj=42,ij=et(e=>{let t=!1;for(let n=0;n<e.length;n++)if(e.codePointAt(n)===rj){if(t)return!1;t=!0}return!0},"hasZeroOrOneAsteriskCharacter"),sj=et(e=>{const t=e.indexOf("*");return t===-1?void 0:{prefix:e.slice(0,t),suffix:e.slice(t+1)}},"tryParsePattern"),aj=et(({prefix:e,suffix:t},n)=>n.length>=e.length+t.length&&n.startsWith(e)&&n.endsWith(t),"isPatternMatch"),lj=et((e,t,n)=>{let o,r=-1;for(const i of e){const s=t(i);aj(s,n)&&s.prefix.length>r&&(r=s.prefix.length,o=i)}return o},"findBestPatternMatch"),cj=et(e=>{const t=[],n=new Set;for(const o of e){if(!ij(o))continue;const r=sj(o);r?t.push(r):n.add(o)}return{exact:n,patterns:t}},"parsePathPatterns"),pj=et((e,t)=>e.exact.has(t)?t:lj(e.patterns,n=>n,t),"matchPatternOrExact"),uj=et((e,t)=>t.substring(e.prefix.length,t.length-e.suffix.length),"matchedText"),dj=et(({prefix:e,suffix:t})=>`${e}*${t}`,"patternText"),fj=et((e,t,n)=>{let o=Z(t.path);t.config.compilerOptions?.baseUrl&&(o=X(e,t.config.compilerOptions.baseUrl)),n?.debug({message:`Resolved baseUrl to ${o}`,prefix:"plugin:resolve-tsconfig-paths"});const r=t.config.compilerOptions?.paths??{};return Object.keys(r).length===0&&n?.debug({message:"No paths found in tsconfig.json",prefix:"plugin:resolve-tsconfig-paths"}),{paths:r,resolvedBaseUrl:o}},"getTsconfigPaths"),Cf=et((e,t,n,o)=>{const{paths:r,resolvedBaseUrl:i}=fj(e,t,n),s=Object.keys(r),a=cj(s);return{name:"plugin:resolve-tsconfig-paths",resolveId:{filter:{id:{exclude:[nj,oj]}},async handler(l,p,c){if(s.length===0)return;if(l.includes("\0")){n.debug({message:`Skipping resolution of ${l} as it is a virtual module`,prefix:"plugin:resolve-tsconfig-paths"});return}if(l.includes("node_modules")){n.debug({message:`Skipping request as it is inside node_modules ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}if(!o.resolveAbsolutePath&&Hs(l)){n.debug({message:`Skipping request as it is an absolute path ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}if(Wp(l)){n.debug({message:`Skipping request as it is a relative path ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}const u=pj(a,l);if(!u){n.debug({message:`moduleName did not match any paths pattern ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}const d=typeof u=="string"?void 0:uj(u,l),f=typeof u=="string"?u:dj(u);for(const m of r[f]){const h=d?m.replace("*",d):m;if(h.endsWith(".d.ts")||h.endsWith(".d.cts")||h.endsWith(".d.mts"))continue;const v=V(i,h);try{const y=await this.resolve(v,p,{skipSelf:!0,...c});if(y)return y}catch(y){n.debug({context:[y],message:`Failed to resolve ${v} from ${l}`,prefix:"plugin:resolve-tsconfig-paths"})}}}}}},"resolveTsconfigPathsPlugin");var mj=Object.defineProperty,hj=(e,t)=>mj(e,"name",{value:t,configurable:!0}),gj=Object.defineProperty,Tf=hj((e,t)=>gj(e,"name",{value:t,configurable:!0}),"u");const vj=/^\./,yj=Tf((e,t)=>{if(!t)return;const{config:n,path:o}=t;if(!n.compilerOptions)return;const{rootDirs:r}=n.compilerOptions;if(!r)return;const i=[];for(const s of r){if(s.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${o}.`);if(s.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${o}.`);i.push(X(e,s))}return i},"getRootDirectories"),_f=Tf((e,t,n)=>{const o=yj(e,n);return{name:"packem:resolve-tsconfig-root-dirs",resolveId:{filter:{id:vj},async handler(r,i,s){if(!(o===void 0||o.length===0)&&r.startsWith("."))for(const a of o){const l=V(a,r),p=await this.resolve(l,i,{skipSelf:!0,...s});if(p)return t.debug({message:`Resolved ${r} to ${p.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),p.id}}}}},"resolveTsconfigRootDirectories");var bj=Object.defineProperty,$j=(e,t)=>bj(e,"name",{value:t,configurable:!0}),wj=Object.defineProperty,Ia=$j((e,t)=>wj(e,"name",{value:t,configurable:!0}),"l");const xj={".cjs":[".cts"],".js":[".ts",".tsx"],".jsx":[".tsx",".ts"],".mjs":[".mts"]},Ic=/\.(?:[mc]?js|jsx)$/,kj=Ia(e=>{const t=e[0];return!(t==="."||t==="/"||t==="#"||vh(e))},"isBareSpecifier"),Wc=Ia(async(e,t,n,o,r,i)=>{for(const s of t)try{const a=await e.resolve(n+s,o,r);if(a)return a}catch(a){if(!i)throw a}},"tryRewrites"),Nf=Ia(()=>({name:"packem:resolve-typescript-mjs-cjs",resolveId:{filter:{id:Ic},async handler(e,t,n){if(!t)return;const o=Ic.exec(e);if(!o)return;const r=o[0],i=xj[r];if(!i)return;const s=e.slice(0,-r.length),a={...n,skipSelf:!0};return!kj(e)&&!t.includes("/node_modules/")&&!e.includes("/node_modules/")?Wc(this,i,s,t,a,!1):await this.resolve(e,t,a)||Wc(this,i,s,t,a,!0)}}}),"resolveTypescriptMjsCts");var Ej=Object.defineProperty,Pf=(e,t)=>Ej(e,"name",{value:t,configurable:!0}),Sj=Object.defineProperty,vt=Pf((e,t)=>Sj(e,"name",{value:t,configurable:!0}),"h");const jj=/^export\s+default\s+(\w+);/m,Aj=/export\s*\{([^}]*)\}/,Oj=/\s*as\s+default\s*/,Rj=/\s+\}$/,Ao=/;$/,Cj=/(?:\r?\n\s*){2,}/g,ns=/^type\s+/,Bc=/\bas\s+default\b/,Tj=vt((e,t,n)=>{const o=Sh(e).find(l=>l.names.includes("default")),r=jj.exec(e);if(r?.[1])return{defaultAlias:r[1],defaultExport:{code:r[0],end:r.index+r[0].length,names:["default"],specifier:void 0,start:r.index,type:"default"},exports:[]};if(!o)return;const i=Aj.exec(o.code);if(!i?.length){n.warn?.(`A default export was indicated in ${t.fileName}, but its structure could not be parsed.`);return}let s;const a=[];for(const l of i[1].split(",").map(p=>p.trim())){if(l==="default"){s=l;continue}const p=Oj.exec(l);p?s=l.replace(p[0],""):a.push(l)}if(!s){n.warn?.(`A default export was indicated in ${t.fileName}, but its alias could not be determined from the export statement.`);return}return{defaultAlias:s,defaultExport:o,exports:a}},"extractExports"),_j=vt((e,t,n)=>{if("declarations"in t&&t.declarations.length>0){const o=t.declarations[0];if(o?.id.type==="Identifier"){e.set(o.id.name,{declare:t.declare===!0,end:t.end,isVariable:!0,start:t.start});return}}if("id"in t&&t.id?.type==="Identifier"){const{name:o}=t.id;e.set(o,{declare:t.declare===!0,end:t.end,isClass:t.type==="ClassDeclaration",start:t.start});return}e.set(n(),{declare:t.declare===!0,end:t.end,start:t.start})},"prepareDeclaration"),no=vt((e,t,n,o)=>{const r=$r(n.fileName,e,{astType:"ts",lang:"ts",sourceType:"module"});let i,s=0;const a=vt(()=>(s+=1,`__unnamed_${String(s)}$$`),"generateUnnamed"),l=new Map,p=new Map,{program:c}=r;for(const m of c.body)if(m.type==="ExportNamedDeclaration")for(const h of m.specifiers)h.exported.type==="Identifier"&&(h.exported.name==="default"?h.local.type==="Identifier"&&(i={end:h.end,local:h.local.name,start:h.start}):p.set(h.exported.name,{type:h.exportKind==="type"}));else{if(m.type==="ImportDeclaration")continue;switch(m.type){case"ClassDeclaration":case"FunctionDeclaration":case"TSDeclareFunction":case"TSEnumDeclaration":case"TSInterfaceDeclaration":case"TSTypeAliasDeclaration":case"VariableDeclaration":{_j(l,m,a);break}case"TSImportEqualsDeclaration":case"TSModuleDeclaration":{l.set(a(),{declare:!1,end:m.end,start:m.start});break}}}const u=[];if(i)for(const[m,h]of p.entries())m!==i.local&&h.type&&u.push(m);if(!i){const m=[...p.values()].every(h=>h.type);return t.startsWith("export type")&&p.size>0&&m||o.warn?.(`Cannot infer default export from the file: ${n.fileName}`),t}if(!l.get(i.local))return o.warn?.(`Cannot infer default export from the file: ${n.fileName}. Declaration for '${i.local}' not found.`),t;const d=t,f=new ke(`${d}
125
+ To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),Mc.set(l,!0)}return i}Re(Pa,"O");$t(Pa,"replaceConfusingTypeNames");function Ma(e,t){if(!e.includes("@internal"))return e;const n=new ke(e),o=$r(t.fileName,e,{lang:"dts",sourceType:"module"}),r=$t(a=>{let l=a,p=!0;for(;p;){for(p=!1;l<e.length&&qS.test(e[l]);)l+=1;for(const c of o.comments)if(c.start===l){l=c.end,p=!0;break}}return l},"skipPastCommentsAndWhitespace"),i=[];for(const a of o.comments)a.type!=="Block"||!a.value.includes("@internal")||i.push({commentStart:a.start,nextStart:r(a.end)});i.length>0&&_a(o.program,{enter(a){if(a.type==="Program")return;const{end:l,start:p}=a;if(typeof p!="number"||typeof l!="number")return;const c=i.findIndex(f=>f.nextStart===p);if(c===-1)return;const[{commentStart:u}]=i.splice(c,1),d=e[l]===","?l+1:l;n.remove(u,d),this.skip()}});const s=n.toString();if(s.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`);return s}Re(Ma,"v");$t(Ma,"stripInternalTypes");const ZS=$t((e,t)=>({name:"packem:patch-types",renderChunk(n,o){return n=Pa.call(this,n,o,e,t),n=Ma.call(this,n,o),n=XS(n),n}}),"patchTypescriptTypes");var QS=Object.defineProperty,ej=(e,t)=>QS(e,"name",{value:t,configurable:!0}),tj=Object.defineProperty,et=ej((e,t)=>tj(e,"name",{value:t,configurable:!0}),"o");const nj=/^\./,oj=/\0/,rj=42,ij=et(e=>{let t=!1;for(let n=0;n<e.length;n++)if(e.codePointAt(n)===rj){if(t)return!1;t=!0}return!0},"hasZeroOrOneAsteriskCharacter"),sj=et(e=>{const t=e.indexOf("*");return t===-1?void 0:{prefix:e.slice(0,t),suffix:e.slice(t+1)}},"tryParsePattern"),aj=et(({prefix:e,suffix:t},n)=>n.length>=e.length+t.length&&n.startsWith(e)&&n.endsWith(t),"isPatternMatch"),lj=et((e,t,n)=>{let o,r=-1;for(const i of e){const s=t(i);aj(s,n)&&s.prefix.length>r&&(r=s.prefix.length,o=i)}return o},"findBestPatternMatch"),cj=et(e=>{const t=[],n=new Set;for(const o of e){if(!ij(o))continue;const r=sj(o);r?t.push(r):n.add(o)}return{exact:n,patterns:t}},"parsePathPatterns"),pj=et((e,t)=>e.exact.has(t)?t:lj(e.patterns,n=>n,t),"matchPatternOrExact"),uj=et((e,t)=>t.substring(e.prefix.length,t.length-e.suffix.length),"matchedText"),dj=et(({prefix:e,suffix:t})=>`${e}*${t}`,"patternText"),fj=et((e,t,n)=>{let o=Z(t.path);t.config.compilerOptions?.baseUrl&&(o=X(e,t.config.compilerOptions.baseUrl)),n?.debug({message:`Resolved baseUrl to ${o}`,prefix:"plugin:resolve-tsconfig-paths"});const r=t.config.compilerOptions?.paths??{};return Object.keys(r).length===0&&n?.debug({message:"No paths found in tsconfig.json",prefix:"plugin:resolve-tsconfig-paths"}),{paths:r,resolvedBaseUrl:o}},"getTsconfigPaths"),Cf=et((e,t,n,o)=>{const{paths:r,resolvedBaseUrl:i}=fj(e,t,n),s=Object.keys(r),a=cj(s);return{name:"plugin:resolve-tsconfig-paths",resolveId:{filter:{id:{exclude:[nj,oj]}},async handler(l,p,c){if(s.length===0)return;if(l.includes("\0")){n.debug({message:`Skipping resolution of ${l} as it is a virtual module`,prefix:"plugin:resolve-tsconfig-paths"});return}if(l.includes("node_modules")){n.debug({message:`Skipping request as it is inside node_modules ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}if(!o.resolveAbsolutePath&&Hs(l)){n.debug({message:`Skipping request as it is an absolute path ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}if(Wp(l)){n.debug({message:`Skipping request as it is a relative path ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}const u=pj(a,l);if(!u){n.debug({message:`moduleName did not match any paths pattern ${l}`,prefix:"plugin:resolve-tsconfig-paths"});return}const d=typeof u=="string"?void 0:uj(u,l),f=typeof u=="string"?u:dj(u);for(const m of r[f]){const h=d?m.replace("*",d):m;if(h.endsWith(".d.ts")||h.endsWith(".d.cts")||h.endsWith(".d.mts"))continue;const v=V(i,h);try{const y=await this.resolve(v,p,{skipSelf:!0,...c});if(y)return y}catch(y){n.debug({context:[y],message:`Failed to resolve ${v} from ${l}`,prefix:"plugin:resolve-tsconfig-paths"})}}}}}},"resolveTsconfigPathsPlugin");var mj=Object.defineProperty,hj=(e,t)=>mj(e,"name",{value:t,configurable:!0}),gj=Object.defineProperty,Tf=hj((e,t)=>gj(e,"name",{value:t,configurable:!0}),"u");const vj=/^\./,yj=Tf((e,t)=>{if(!t)return;const{config:n,path:o}=t;if(!n.compilerOptions)return;const{rootDirs:r}=n.compilerOptions;if(!r)return;const i=[];for(const s of r){if(s.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${o}.`);if(s.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${o}.`);i.push(X(e,s))}return i},"getRootDirectories"),_f=Tf((e,t,n)=>{const o=yj(e,n);return{name:"packem:resolve-tsconfig-root-dirs",resolveId:{filter:{id:vj},async handler(r,i,s){if(!(o===void 0||o.length===0)&&r.startsWith("."))for(const a of o){const l=V(a,r),p=await this.resolve(l,i,{skipSelf:!0,...s});if(p)return t.debug({message:`Resolved ${r} to ${p.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),p.id}}}}},"resolveTsconfigRootDirectories");var bj=Object.defineProperty,$j=(e,t)=>bj(e,"name",{value:t,configurable:!0}),wj=Object.defineProperty,Ia=$j((e,t)=>wj(e,"name",{value:t,configurable:!0}),"l");const xj={".cjs":[".cts"],".js":[".ts",".tsx"],".jsx":[".tsx",".ts"],".mjs":[".mts"]},Ic=/\.(?:[mc]?js|jsx)$/,kj=Ia(e=>{const t=e[0];return!(t==="."||t==="/"||t==="#"||vh(e))},"isBareSpecifier"),Wc=Ia(async(e,t,n,o,r,i)=>{for(const s of t)try{const a=await e.resolve(n+s,o,r);if(a)return a}catch(a){if(!i)throw a}},"tryRewrites"),Nf=Ia(()=>({name:"packem:resolve-typescript-mjs-cjs",resolveId:{filter:{id:Ic},async handler(e,t,n){if(!t)return;const o=Ic.exec(e);if(!o)return;const r=o[0],i=xj[r];if(!i)return;const s=e.slice(0,-r.length),a={...n,skipSelf:!0};return!kj(e)&&!t.includes("/node_modules/")&&!e.includes("/node_modules/")?Wc(this,i,s,t,a,!1):await this.resolve(e,t,a)||Wc(this,i,s,t,a,!0)}}}),"resolveTypescriptMjsCts");var Ej=Object.defineProperty,Pf=(e,t)=>Ej(e,"name",{value:t,configurable:!0}),Sj=Object.defineProperty,vt=Pf((e,t)=>Sj(e,"name",{value:t,configurable:!0}),"h");const jj=/^export\s+default\s+(\w+);/m,Aj=/export\s*\{([^}]*)\}/,Oj=/\s*as\s+default\s*/,Rj=/\s+\}$/,Ao=/;$/,Cj=/(?:\r?\n\s*){2,}/g,ns=/^type\s+/,Bc=/\bas\s+default\b/,Tj=vt((e,t,n)=>{const o=Sh(e).find(l=>l.names?.includes("default")),r=jj.exec(e);if(r?.[1])return{defaultAlias:r[1],defaultExport:{code:r[0],end:r.index+r[0].length,names:["default"],specifier:void 0,start:r.index,type:"default"},exports:[]};if(!o)return;const i=Aj.exec(o.code);if(!i?.length){n.warn?.(`A default export was indicated in ${t.fileName}, but its structure could not be parsed.`);return}let s;const a=[];for(const l of i[1].split(",").map(p=>p.trim())){if(l==="default"){s=l;continue}const p=Oj.exec(l);p?s=l.replace(p[0],""):a.push(l)}if(!s){n.warn?.(`A default export was indicated in ${t.fileName}, but its alias could not be determined from the export statement.`);return}return{defaultAlias:s,defaultExport:o,exports:a}},"extractExports"),_j=vt((e,t,n)=>{if("declarations"in t&&t.declarations.length>0){const o=t.declarations[0];if(o?.id.type==="Identifier"){e.set(o.id.name,{declare:t.declare===!0,end:t.end,isVariable:!0,start:t.start});return}}if("id"in t&&t.id?.type==="Identifier"){const{name:o}=t.id;e.set(o,{declare:t.declare===!0,end:t.end,isClass:t.type==="ClassDeclaration",start:t.start});return}e.set(n(),{declare:t.declare===!0,end:t.end,start:t.start})},"prepareDeclaration"),no=vt((e,t,n,o)=>{const r=$r(n.fileName,e,{astType:"ts",lang:"ts",sourceType:"module"});let i,s=0;const a=vt(()=>(s+=1,`__unnamed_${String(s)}$$`),"generateUnnamed"),l=new Map,p=new Map,{program:c}=r;for(const m of c.body)if(m.type==="ExportNamedDeclaration")for(const h of m.specifiers)h.exported.type==="Identifier"&&(h.exported.name==="default"?h.local.type==="Identifier"&&(i={end:h.end,local:h.local.name,start:h.start}):p.set(h.exported.name,{type:h.exportKind==="type"}));else{if(m.type==="ImportDeclaration")continue;switch(m.type){case"ClassDeclaration":case"FunctionDeclaration":case"TSDeclareFunction":case"TSEnumDeclaration":case"TSInterfaceDeclaration":case"TSTypeAliasDeclaration":case"VariableDeclaration":{_j(l,m,a);break}case"TSImportEqualsDeclaration":case"TSModuleDeclaration":{l.set(a(),{declare:!1,end:m.end,start:m.start});break}}}const u=[];if(i)for(const[m,h]of p.entries())m!==i.local&&h.type&&u.push(m);if(!i){const m=[...p.values()].every(h=>h.type);return t.startsWith("export type")&&p.size>0&&m||o.warn?.(`Cannot infer default export from the file: ${n.fileName}`),t}if(!l.get(i.local))return o.warn?.(`Cannot infer default export from the file: ${n.fileName}. Declaration for '${i.local}' not found.`),t;const d=t,f=new ke(`${d}
126
126
  declare namespace ${i.local} {
127
127
  `);for(const[m,h]of l.entries()){if(u.includes(m)&&m!==i.local)continue;const v=e.slice(h.start,h.end).replace(Rj," }");f.append(" "),h.declare?f.append(v.replace("declare","export").replaceAll(" "," ")):f.append(`export ${v}`.replaceAll(" "," ")),f.append(`
128
128
  `)}return f.append(` import _default = ${i.local};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/packem",
3
- "version": "2.0.0-alpha.86",
3
+ "version": "2.0.0-alpha.87",
4
4
  "description": "A fast and modern bundler for Node.js and TypeScript.",
5
5
  "keywords": [
6
6
  "anolilab",