@visulima/packem 2.0.0-alpha.90 → 2.0.0-alpha.91
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 +15 -0
- package/README.md +33 -2
- package/dist/cli/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/packem_shared/{index-bcxmFLOh.js → index-UxllEEEe.js} +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## @visulima/packem [2.0.0-alpha.91](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.90...@visulima/packem@2.0.0-alpha.91) (2026-06-16)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **packem:** reject size helpers on read-stream errors ([12c9e18](https://github.com/visulima/packem/commit/12c9e18a6a728360503546a3cec878291906f2f9))
|
|
6
|
+
|
|
7
|
+
### Performance Improvements
|
|
8
|
+
|
|
9
|
+
* **packem:** use a map for build-entry lookup in the size loop ([a2d18ac](https://github.com/visulima/packem/commit/a2d18ace4963be0cff4192d15e09a8fc14f65754))
|
|
10
|
+
|
|
11
|
+
### Documentation
|
|
12
|
+
|
|
13
|
+
* **packem:** align option and guide pages with current API ([65f76d8](https://github.com/visulima/packem/commit/65f76d8c9aed552a1bd604f7d65af8a076cdd6e6))
|
|
14
|
+
* **packem:** document the rolldown bundler backend in the readme ([d49fc7d](https://github.com/visulima/packem/commit/d49fc7dc86f63e887f903375c26c93fc681f0b96))
|
|
15
|
+
|
|
1
16
|
## @visulima/packem [2.0.0-alpha.90](https://github.com/visulima/packem/compare/@visulima/packem@2.0.0-alpha.89...@visulima/packem@2.0.0-alpha.90) (2026-06-16)
|
|
2
17
|
|
|
3
18
|
### Features
|
package/README.md
CHANGED
|
@@ -35,6 +35,8 @@ It enables you to generate multiple bundles (CommonJS or ESModule) simultaneousl
|
|
|
35
35
|
|
|
36
36
|
It uses the `exports` configuration in `package.json` and recognizes entry file conventions to match your exports and build them into bundles.
|
|
37
37
|
|
|
38
|
+
Rollup is the default and full-featured backend. An experimental [Rolldown](https://rolldown.rs) backend is also selectable via the `bundler` option (or `--bundler` CLI flag) — see [Rolldown backend (experimental)](#rolldown-backend-experimental).
|
|
39
|
+
|
|
38
40
|
## Features
|
|
39
41
|
|
|
40
42
|
- ✅ package.json#exports, package.json#main, package.json#module to define entry-points
|
|
@@ -56,6 +58,7 @@ It uses the `exports` configuration in `package.json` and recognizes entry file
|
|
|
56
58
|
- ✅ Supports `tsconfig.json` paths and `package.json`, `package.yml`, `package.yaml` and `package.json5` imports resolution
|
|
57
59
|
- ✅ ESM ⇄ CJS interoperability
|
|
58
60
|
- ✅ Supports isolated declaration types (experimental) (Typescript version 5.5 or higher)
|
|
61
|
+
- ✅ Selectable bundler backend: Rollup (default) or [Rolldown](https://rolldown.rs) (experimental)
|
|
59
62
|
- ✅ Supports wasm [WebAssembly modules](http://webassembly.org)
|
|
60
63
|
- ✅ Supports css, [sass](https://github.com/sass/sass), [less](https://github.com/less/less.js), [stylus](https://github.com/stylus/stylus) and Up-to-date [CSS Modules](https://github.com/css-modules/css-modules) (experimental)
|
|
61
64
|
- ✅ [TypeDoc](https://github.com/TypeStrong/TypeDoc) documentation generation
|
|
@@ -595,8 +598,8 @@ import { defineConfig } from "@visulima/packem/config";
|
|
|
595
598
|
|
|
596
599
|
export default defineConfig({
|
|
597
600
|
// ...
|
|
598
|
-
|
|
599
|
-
|
|
601
|
+
validation: {
|
|
602
|
+
bundleLimit: {
|
|
600
603
|
limit: 1024 * 1024, // 1MB
|
|
601
604
|
// or / and limits per file
|
|
602
605
|
limits: {
|
|
@@ -613,6 +616,34 @@ export default defineConfig({
|
|
|
613
616
|
|
|
614
617
|
## Experimental Features
|
|
615
618
|
|
|
619
|
+
### Rolldown backend (experimental)
|
|
620
|
+
|
|
621
|
+
By default `packem` bundles with [Rollup](https://rollupjs.org). You can opt into the experimental [Rolldown](https://rolldown.rs) backend — a Rust-based, oxc-powered bundler — with the `bundler` option:
|
|
622
|
+
|
|
623
|
+
```ts
|
|
624
|
+
import { defineConfig } from "@visulima/packem/config";
|
|
625
|
+
|
|
626
|
+
export default defineConfig({
|
|
627
|
+
// ...
|
|
628
|
+
bundler: "rolldown", // "rollup" (default) | "rolldown"
|
|
629
|
+
// ...
|
|
630
|
+
});
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
Or from the CLI, without touching the config file:
|
|
634
|
+
|
|
635
|
+
```sh
|
|
636
|
+
packem build --bundler rolldown
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
Notes and current limitations:
|
|
640
|
+
|
|
641
|
+
- **Experimental.** Rolldown is opt-in and not yet at full feature parity with the Rollup backend. Rollup remains the default and the fully-supported path; the Rolldown backend is not deprecating it.
|
|
642
|
+
- **No `transformer` option.** When `bundler` is `"rolldown"`, omit the `transformer` option — Rolldown ships its own oxc-based transform and always uses it. The `esbuild`/`swc`/`sucrase`/`oxc` transformer adapters only apply under the default `"rollup"` bundler.
|
|
643
|
+
- **Declaration files route through Rollup.** Even with `bundler: "rolldown"`, `.d.ts` generation (and DTS watching) still runs through Rollup. Rollup is pulled in automatically when Rolldown is combined with `declaration: true`.
|
|
644
|
+
|
|
645
|
+
For the detailed support matrix and the criteria for graduating Rolldown out of experimental status, see [`docs/rolldown-status.md`](https://github.com/visulima/packem/blob/main/docs/rolldown-status.md).
|
|
646
|
+
|
|
616
647
|
### OXC Resolver
|
|
617
648
|
|
|
618
649
|
`packem` supports the [oxc-resolver](https://github.com/oxc-project/oxc-resolver) resolver to resolve modules in your project.
|
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createCerebro as Q}from"@visulima/cerebro";import Z from"@visulima/cerebro/logger/pail";import{e as A,S as q,m as ee,f as te,g as se,i as ae,B as ne,T as ie,j as R,v as re,l as oe,d as ce}from"../packem_shared/index-
|
|
2
|
+
import{createCerebro as Q}from"@visulima/cerebro";import Z from"@visulima/cerebro/logger/pail";import{e as A,S as q,m as ee,f as te,g as se,i as ae,B as ne,T as ie,j as R,v as re,l as oe,d as ce}from"../packem_shared/index-UxllEEEe.js";import k,{cwd as O,exit as le}from"node:process";import{installPackage as h}from"@antfu/install-pkg";import{spinner as D,confirm as f,cancel as B,select as g,multiselect as G,intro as K,log as E,outro as U,isCancel as W}from"@clack/prompts";import{a as de,b as ue,q as pe,s as N,T as me,S as fe}from"../packem_shared/create-or-update-key-storage-DHOKZmnD.js";import{P as L,w as b}from"../packem_shared/utils-Bsoe7qJG.js";import ge from"magic-string";import{exec as ye}from"tinyexec";import{PRODUCTION_ENV as F,DEVELOPMENT_ENV as we}from"@visulima/packem-share/constants";import{createJiti as be}from"jiti";import{writeFile as z,readFile as he}from"node:fs/promises";import{existsSync as V}from"node:fs";import{parseEnv as J}from"node:util";import{createInterface as ve}from"node:readline/promises";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
3
3
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
4
4
|
const _={less:["less"],lightningcss:["lightningcss"],"node-sass":["node-sass"],postcss:["postcss","postcss-load-config","postcss-modules-extract-imports","postcss-modules-local-by-default","postcss-modules-scope","postcss-modules-values","postcss-value-parser","@csstools/css-parser-algorithms","@csstools/css-tokenizer","@csstools/postcss-slow-plugins","icss-utils","@visulima/css-style-inject"],sass:["sass"],"sass-embedded":["sass-embedded"],stylus:["stylus"],tailwindcss:["@tailwindcss/node","@tailwindcss/oxide","tailwindcss"]},ke=/defineConfig\s*\(\s*\{/,$e=/preset:\s*['"][^'"]+['"]/,Se=["typedoc","typedoc-plugin-markdown","typedoc-plugin-rename-defaults"],Ce=["@babel/core","@babel/preset-react"],je=["react","react-dom"],xe=["@babel/core","babel-preset-solid"],Pe=["solid-js"],Ee=["@babel/core","@babel/preset-react","babel-plugin-transform-hook-names"],De=["preact"],Le=["unplugin-vue"],Ie=["vue"],Me=["rollup-plugin-svelte"],Ne=["svelte"],$=(t,e,a)=>t.includes(`preset: '${e}'`)||t.includes(`preset: "${e}"`)||t.includes(`preset: '${e}',`)||t.includes(`preset: "${e}",`)||t.includes(a)||t.includes(`@visulima/packem/config/preset/${e}`),S=(t,e)=>{const{logger:a,magic:s,packemConfig: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-bcxmFLOh.js";import{g as wt}from"./packem_shared/create-or-update-key-storage-DHOKZmnD.js";const tr=He(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:Q,Ge=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,r]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ie.getBuiltinModule(t)}return tr(t)},Q=ie,{execFileSync:rr}=Ge("node:child_process"),ue=Ge("node:fs"),sr=Ge("node:tty"),Ue=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ze=[12288,12288,65281,65376,65504,65510],Ke=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Ye=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ae=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],ge=(t,e)=>{let r=0,s=Math.floor(t.length/2)-1;for(;r<=s;){const i=Math.floor((r+s)/2),o=i*2;if(e<t[o])s=i-1;else if(e>t[o+1])r=i+1;else return!0}return!1},ir=Ue[0],nr=Ue.at(-1),or=ze[0],ar=ze.at(-1),lr=Ke[0],cr=Ke.at(-1),ur=Ye[0],fr=Ye.at(-1),hr=Ae[0],gr=Ae.at(-1),nt=19968,[dr,pr]=mr(Ae);function mr(t){let e=t[0],r=t[1];for(let s=0;s<t.length;s+=2){const i=t[s],o=t[s+1];if(nt>=i&&nt<=o)return[i,o];o-i>r-e&&(e=i,r=o)}return[e,r]}const br=t=>t<ir||t>nr?!1:ge(Ue,t),yr=t=>t<or||t>ar?!1:ge(ze,t),wr=t=>t<lr||t>cr?!1:ge(Ke,t),$r=t=>t<ur||t>fr?!1:ge(Ye,t),vr=t=>t>=dr&&t<=pr?!0:t<hr||t>gr?!1:ge(Ae,t);function xr(t){return br(t)?"ambiguous":yr(t)?"fullwidth":wr(t)?"halfwidth":$r(t)?"narrow":vr(t)?"wide":"neutral"}function Sr(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function $t(t){return Sr(t),xr(t)}const vt=String.raw,ot=vt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,kr=()=>new RegExp(vt`\p{RI}{2}|(?)${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-UxllEEEe.js";import{g as wt}from"./packem_shared/create-or-update-key-storage-DHOKZmnD.js";const tr=He(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:Q,Ge=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,r]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ie.getBuiltinModule(t)}return tr(t)},Q=ie,{execFileSync:rr}=Ge("node:child_process"),ue=Ge("node:fs"),sr=Ge("node:tty"),Ue=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ze=[12288,12288,65281,65376,65504,65510],Ke=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Ye=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Ae=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],ge=(t,e)=>{let r=0,s=Math.floor(t.length/2)-1;for(;r<=s;){const i=Math.floor((r+s)/2),o=i*2;if(e<t[o])s=i-1;else if(e>t[o+1])r=i+1;else return!0}return!1},ir=Ue[0],nr=Ue.at(-1),or=ze[0],ar=ze.at(-1),lr=Ke[0],cr=Ke.at(-1),ur=Ye[0],fr=Ye.at(-1),hr=Ae[0],gr=Ae.at(-1),nt=19968,[dr,pr]=mr(Ae);function mr(t){let e=t[0],r=t[1];for(let s=0;s<t.length;s+=2){const i=t[s],o=t[s+1];if(nt>=i&&nt<=o)return[i,o];o-i>r-e&&(e=i,r=o)}return[e,r]}const br=t=>t<ir||t>nr?!1:ge(Ue,t),yr=t=>t<or||t>ar?!1:ge(ze,t),wr=t=>t<lr||t>cr?!1:ge(Ke,t),$r=t=>t<ur||t>fr?!1:ge(Ye,t),vr=t=>t>=dr&&t<=pr?!0:t<hr||t>gr?!1:ge(Ae,t);function xr(t){return br(t)?"ambiguous":yr(t)?"fullwidth":wr(t)?"halfwidth":$r(t)?"narrow":vr(t)?"wide":"neutral"}function Sr(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function $t(t){return Sr(t),xr(t)}const vt=String.raw,ot=vt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,kr=()=>new RegExp(vt`\p{RI}{2}|(?)${ot}(?:\u200D${ot})*`,"gu"),ae=new Set(["\x1B",""]),Le="\x07",xt="[",Qe="m",ke="]8;;",Er=39,Tr=/[\u200B\uFEFF\u2060-\u2064]/g,Ar=new RegExp(`(?:\\${xt}(?<code>\\d+)m|\\${ke}(?<uri>.*)${Le})`),Lr=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),le=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ye=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,je=kr(),at=new Map,we=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,$e=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Mr=(t,e)=>{const r=Math.floor(t/65536),s=t%65536;let i=at.get(r);if(i||(i=new Map,at.set(r,i)),i.has(s))return i.get(s);let o;if($e(t)==="latin")o=e.width.regular;else if($e(t)==="control")o=e.width.control;else if($e(t)==="wide")o=e.width.wide;else switch($t(t)){case"ambiguous":{o=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{o=e.width.fullWidth;break}case"wide":{o=e.width.wide;break}default:o=e.width.regular}return i.set(s,o),o},Or=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,Ce=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Ce(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},s=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:i}=t,o=i>1e4;let a=0,n=0,c=i,u=!1;const l=t.includes("\x1B")||t.includes("");for(;a<i;){if(l&&(t[a]==="\x1B"||t[a]==="")){if(t.startsWith("\x1B]8;;",a)){const v="\x1B]8;;\x07",B=v.length,V=t.indexOf("\x07",a+5);if(V!==-1){const H=t.indexOf(v,V+1);if(H!==-1){const d=H+B,g=t.slice(V+1,H).replace(le,""),$=Ce(g,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,s-n),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),I=$.width;if($.truncated)u=!0,c=Math.min(c,a);else if(n+I>s&&(c=Math.min(c,a),u=!0,n+I>r.truncation.limit))break;if(n+=I,a=d,u&&n>=r.truncation.limit)break;continue}}}if(le.lastIndex=a,le.test(t)){const v=le.lastIndex-a,B=r.truncation.countAnsiEscapeCodes?v:r.width.ansi;if(n+B>s&&(c=Math.min(c,a),n+B>r.truncation.limit)){u=!0;break}n+=B,a=le.lastIndex;continue}}const w=t.codePointAt(a);if(w===8203||w===65279||w>=8288&&w<=8292){a+=1;continue}if(w===9){if(n+r.width.tab>s&&(c=Math.min(c,a),n+r.width.tab>r.truncation.limit)){u=!0;break}n+=r.width.tab,a+=1;continue}if(we.lastIndex=a,we.test(t)){const v=(we.lastIndex-a)*r.width.regular;if(n+v>s){const B=Math.floor((s-n)/r.width.regular);if(c=Math.min(c,a+B),n+v>r.truncation.limit){u=!0;break}}n+=v,a=we.lastIndex;continue}if((w<=31||w>=127&&w<=159)&&(ye.lastIndex=a,ye.test(t))){const v=(ye.lastIndex-a)*r.width.control;if(n+v>s&&(c=Math.min(c,a+Math.floor((s-n)/r.width.control)),n+v>r.truncation.limit)){u=!0;break}n+=v,a=ye.lastIndex;continue}if(je.lastIndex=a,je.test(t)){if(n+r.width.emoji>s&&(c=Math.min(c,a),n+r.width.emoji>r.truncation.limit)){u=!0;break}n+=r.width.emoji,a=je.lastIndex;continue}const N=t.codePointAt(a)??0;if(Or(N)){a+=N>65535?2:1;continue}let k;if(o)k=Mr(N,r);else switch($e(N)){case"control":{k=r.width.control;break}case"latin":{k=r.width.regular;break}case"wide":{k=r.width.wide;break}case"zero":{k=0;break}default:switch($t(N)){case"ambiguous":{k=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{k=r.width.fullWidth;break}case"wide":{k=r.width.wide;break}default:k=r.width.regular}}if(n+k>s&&(c=Math.min(c,a),n+k>r.truncation.limit)){u=!0;break}n+=k,a+=N>65535?2:1}let h=n,p=!1;return u&&r.truncation.limit>=r.truncation.ellipsisWidth&&(h=r.truncation.limit,p=!0),{ellipsed:p,index:u?c:i,truncated:u,width:h}},Z=(t,e={})=>Ce(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Br=/\x1B\[(\d+)m/;class St{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const r=Br.exec(e);if(!r)return;const s=Number.parseInt(r[1],10);switch(s){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(s>=30&&s<=37||s>=90&&s<=97)this.activeForeground=e;else if(s>=40&&s<=47||s>=100&&s<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(s))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(s)){const i={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[s];i&&(this.activeFormatting=this.activeFormatting.filter(o=>!o.includes(i)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const r={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(s=>{const i=r[s];i&&e.push(i)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}const kt=(t,e)=>{if(!ae.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const r=!0,s=t.slice(e+1,e+1+ke.length).join("")===ke;return{isInsideEscape:r,isInsideLinkEscape:s}},jr=(t,e={})=>{const r=new St;let s="",i=!1,o="",a="",n=!1;const c=[...t];for(let u=0;u<c.length;u++){const l=c[u];if(l&&ae.has(l)){if(s){const k=e.getWidth?.(s)??0,v={isEscapeSequence:!1,isGrapheme:!0,text:s,width:k};if(n&&(v.isHyperlink=!0,v.hyperlinkUrl=a),e.onSegment?.(v,r)===!1)return;s=""}i=!0,o=l;const w=kt(c,u),{isInsideLinkEscape:N}=w;if(N){let k=u+1;for(a="";k<c.length;){const B=c[k];if(B===Le)break;a+=B,k+=1}a=a.slice(4);const v={hyperlinkUrl:a,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(v,r)===!1)return;u=k,n=!0,i=!1,o="";continue}if(u+1<c.length&&c[u+1]==="\\"&&n){const k={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(k,r)===!1)return;n=!1,a="",u+=1,i=!1,o="";continue}}if(i){if(o!==l&&(o+=l),l===Qe){i=!1,r.processEscape(o);const w={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};if(e.onSegment?.(w,r)===!1)return;o=""}continue}s+=l;const h=e.getWidth?.(s)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:s,width:h};if(n&&(p.isHyperlink=!0,p.hyperlinkUrl=a),e.onSegment?.(p,r)===!1)return;s=""}if(s){const u=e.getWidth?.(s)??0,l={isEscapeSequence:!1,isGrapheme:!0,text:s,width:u};n&&(l.isHyperlink=!0,l.hyperlinkUrl=a),e.onSegment?.(l,r)}if(o){const u={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};e.onSegment?.(u,r)}},lt=t=>`${ae.values().next().value}${xt}${String(t)}${Qe}`,ct=t=>`${ae.values().next().value}${ke}${t}${Le}`,Nr=t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",r,s;const i=t.join(`
|
|
2
2
|
`),o=[...i];let a=0;for(const[n,c]of o.entries()){if(e+=c,ae.has(c)){const l=Ar.exec(i.slice(a))?.groups??{};if(l.code!==void 0){const h=Number.parseFloat(l.code);r=h===Er?void 0:h}else l.uri!==void 0&&(s=l.uri.length===0?void 0:l.uri)}const u=Lr.get(Number(r));o[n+1]===`
|
|
3
3
|
`?(s&&(e+=ct("")),r&&u&&(e+=lt(u))):c===`
|
|
4
4
|
`&&(r&&u&&(e+=lt(r)),s&&(e+=ct(s))),a+=c.length}return e},Et=/(?=\s)|(?<=\s)/,Tt=/^\s+$/,Ne=t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},te=t=>{const e=t.split(" ");let r=e.length;for(;r>0&&Z(e[r-1])===0;)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},At=(t,e,r)=>{if(t.length===0)return[""];if(e<=0)return[t];const s=[],i=new St;let o="",a=0,n=!1,c=!1,u="",l=0;for(;l<t.length;){const h=t[l];if(ae.has(h)){n=!0,u=h,o+=h,c=kt([...t],l).isInsideLinkEscape,l+=1;continue}if(n){u+=h,o+=h,c?h===Le&&(n=c=!1):h===Qe&&(n=!1,i.processEscape(u)),l+=1;continue}const p=Z(h),w=h===" ";if(p===0){o+=h,l+=1;continue}if(a+p>e&&(o&&s.push(o+i.getEndEscapesForAllActiveAttributes()),o=i.getStartEscapesForAllActiveAttributes(),a=Z(o),w&&r)){for(;l<t.length&&t[l]===" ";)l+=1;continue}if(o+=h,a+=p,a===e&&l<t.length-1&&(s.push(o+i.getEndEscapesForAllActiveAttributes()),o=i.getStartEscapesForAllActiveAttributes(),a=Z(o),l+1<t.length&&t[l+1]===" "&&r)){for(l+=1;l<t.length&&t[l]===" ";)l+=1;continue}l+=1}return o&&s.push(o+i.getEndEscapesForAllActiveAttributes()),r?s.map(h=>te(h)):s},Ir=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=[];let o="",a=0;return jr(s,{getWidth:Z,onSegment:(n,c)=>{const u=n.text??"";if(n.isEscapeSequence)o+=u;else{const l=u===" ";if(n.width===0)return o+=u,!0;if(a+n.width>e&&(o&&i.push(o),o=c.getStartEscapesForAllActiveAttributes(),a=0,l))return r||i.push(c.getStartEscapesForAllActiveAttributes()+u),!0;o+=u,a+=n.width}return!0}}),o&&i.push(o),r?i.map(n=>te(n)):i},Pr=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=s.split(Et),o=[];let a="",n=0,c=0;for(;c<i.length;){const u=i[c],l=Tt.test(u),h=Z(u);if(u.length===0){c+=1;continue}if(r&&l&&n===0){c+=1;continue}if(n+h>e&&n>0){r?o.push(te(a)):o.push(a),a="",n=0;continue}a+=u,n+=h,c+=1}return a&&(r?o.push(te(a)):o.push(a)),o},Fr=(t,e,r)=>{if(t.length===0)return[];const s=r?t.trim():t;if(s.length===0)return[];const i=s.split(Et),o=[];let a="",n=0,c=0;for(;c<i.length;){const u=i[c],l=Tt.test(u),h=Z(u);if(u.length===0){c+=1;continue}if(r&&l&&n===0){c+=1;continue}if(h>e){a&&o.push(Ne(r?te(a):a));const p=At(u,e,r);if(p.length>0){for(let w=0;w<p.length-1;w+=1)o.push(p[w]);a=p.at(-1),n=Z(a)}else a="",n=0;c+=1;continue}if(n+h>e&&n>0&&(o.push(Ne(r?te(a):a)),a="",n=0,r&&l)){c+=1;continue}a+=u,n+=h,c+=1}return a&&o.push(Ne(r?te(a):a)),o},fe={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Rr=(t,e={})=>{const{removeZeroWidthCharacters:r=!0,trim:s=!0,width:i=80,wrapMode:o=fe.PRESERVE_WORDS}=e;if(s&&t.trim()==="")return"";let a=t.normalize("NFC").replaceAll(`\r
|
|
@@ -44,7 +44,7 @@ ${Ko(k,{...this.#n,filterStacktrace:es,prefix:b})}`;if(typeof k=="object")return
|
|
|
44
44
|
|
|
45
45
|
${Ko($,{...this.#n,filterStacktrace:es,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:b})}`),h&&v.push(` ${b}${vt(this.styles.underline.suffix?Ol(h):h)}`),l){const j=(l.name??"")+(l.line?`:${String(l.line)}`:""),k=Math.max(0,E-Ne("Caller: "));v.push(`
|
|
46
46
|
`,vt("Caller: ")," ".repeat(k),j,`
|
|
47
|
-
`)}return v.join("")}};var NO="@visulima/packem",of="2.0.0-alpha.89";const PO={version:of};var kb=Object.defineProperty,sf=(e,t)=>kb(e,"name",{value:t,configurable:!0}),jb=Object.defineProperty,Ab=sf((e,t)=>jb(e,"name",{value:t,configurable:!0}),"o");let _O=class extends Error{static{sf(this,"n")}static{Ab(this,"DirectoryError")}constructor(t){super(`EISDIR: Illegal operation on a directory, ${t}`)}get code(){return"EISDIR"}set code(t){throw new Error("Cannot overwrite code EISDIR")}get name(){return"DirectoryError"}set name(t){throw new Error("Cannot overwrite name of DirectoryError")}};var Ob=Object.defineProperty,af=(e,t)=>Ob(e,"name",{value:t,configurable:!0}),Rb=Object.defineProperty,Cb=af((e,t)=>Rb(e,"name",{value:t,configurable:!0}),"t");let IO=class extends Error{static{af(this,"n")}static{Cb(this,"NotEmptyError")}constructor(t){super(`ENOTEMPTY: Directory not empty, ${t}`)}get code(){return"ENOTEMPTY"}set code(t){throw new Error("Cannot overwrite code ENOTEMPTY")}get name(){return"NotEmptyError"}set name(t){throw new Error("Cannot overwrite name of NotEmptyError")}};var Tb=Object.defineProperty,lf=(e,t)=>Tb(e,"name",{value:t,configurable:!0}),Nb=Object.defineProperty,Pb=lf((e,t)=>Nb(e,"name",{value:t,configurable:!0}),"o");let Mt=class extends Error{static{lf(this,"n")}static{Pb(this,"NotFoundError")}constructor(t){super(`ENOENT: ${t}`)}get code(){return"ENOENT"}set code(t){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(t){throw new Error("Cannot overwrite name of NotFoundError")}};var _b=Object.defineProperty,Mb=(e,t)=>_b(e,"name",{value:t,configurable:!0}),Ib=Object.defineProperty,Wb=Mb((e,t)=>Ib(e,"name",{value:t,configurable:!0}),"n");Wb((e,{whitespace:t=!0}={})=>e.replace(Sm,r=>r.startsWith('"')||r[1]==="*"&&!r.endsWith("*/")?r:t?r.replaceAll(/\S/g," "):""),"stripJsonComments");var Bb=Object.defineProperty,cf=(e,t)=>Bb(e,"name",{value:t,configurable:!0}),Db=Object.defineProperty,Lb=cf((e,t)=>Db(e,"name",{value:t,configurable:!0}),"r");async function Ro(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=await Hu(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Hn(l,t,a):Hn(l,a)}cf(Ro,"l");Lb(Ro,"readYaml");var Fb=Object.defineProperty,uf=(e,t)=>Fb(e,"name",{value:t,configurable:!0}),Hb=Object.defineProperty,qb=uf((e,t)=>Hb(e,"name",{value:t,configurable:!0}),"t");function Co(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=Fi(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Hn(l,t,a):Hn(l,a)}uf(Co,"l");qb(Co,"readYamlSync");var Jb=Object.defineProperty,pf=(e,t)=>Jb(e,"name",{value:t,configurable:!0}),zb=Object.defineProperty,Ub=pf((e,t)=>zb(e,"name",{value:t,configurable:!0}),"a");async function ff(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Xu(t,s,i??o);await km(e,a,o)}pf(ff,"c");Ub(ff,"writeYaml");var Gb=Object.defineProperty,df=(e,t)=>Gb(e,"name",{value:t,configurable:!0}),Vb=Object.defineProperty,Kb=df((e,t)=>Vb(e,"name",{value:t,configurable:!0}),"a");function mf(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Xu(t,s,i??o);po(e,a,o)}df(mf,"c");Kb(mf,"writeYamlSync");var Yb=Object.defineProperty,Xb=(e,t)=>Yb(e,"name",{value:t,configurable:!0}),Zb=Object.defineProperty,ur=Xb((e,t)=>Zb(e,"name",{value:t,configurable:!0}),"c");const hf=ur((e,t,r)=>{const n=Z(e),o=Z(t),s=o===n?".":ke(n,o);return r.some(i=>{const a=i.startsWith("./")?i.slice(2):i,l=s.startsWith("./")?s.slice(2):s;if(a==="."&&l===".")return!0;if(a.endsWith("/**")){const u=a.slice(0,-3);return l===u||l.startsWith(`${u}/`)}if(a.endsWith("/*")){const u=a.slice(0,-2);return u===""?l!=="."&&!l.includes("/"):l.startsWith(`${u}/`)||l===u}return l===a||l.startsWith(`${a}/`)})},"isPackageInWorkspace"),gf=ur(async e=>{const t=await ft("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=await Ro(t),n=Array.isArray(r.packages)?r.packages:[];if(!hf(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogs"),yf=ur(e=>{const t=dt("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=Co(t),n=Array.isArray(r.packages)?r.packages:[];if(!hf(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogsSync"),Qb=ur((e,t,r)=>{if(t==="catalog:")return r.catalog?.[e];if(t.startsWith("catalog:")){const n=t.slice(8);return r.catalogs?.[n]?.[e]}},"resolveCatalogReference"),e1=ur((e,t)=>{for(const[r,n]of Object.entries(e)){if(typeof n!="string")continue;const o=Qb(r,n,t);o&&(e[r]=o)}},"resolveDependenciesCatalogReferences"),To=ur((e,t)=>{const r=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const n of r){if(!e[n]||typeof e[n]!="object")continue;const o=e[n];e1(o,t)}},"resolveCatalogReferences");var t1=Object.defineProperty,ye=(e,t)=>t1(e,"name",{value:t,configurable:!0});const r1=Me(import.meta.url),yr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,pa=ye(e=>{if(typeof yr<"u"&&yr.versions&&yr.versions.node){const[t,r]=yr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return yr.getBuiltinModule(e)}return r1(e)},"__cjs_getBuiltinModule"),{existsSync:$f}=pa("node:fs"),{createInterface:n1}=pa("node:readline"),{styleText:Te}=pa("node:util");var o1=Object.defineProperty,we=ye((e,t)=>o1(e,"name",{value:t,configurable:!0}),"f");const Ye=we(e=>{const t=typeof e;return e!==null&&(t==="object"||t==="function")},"isObject"),s1=we(e=>{if(!Ye(e))return!1;for(const t in e)if(Object.hasOwn(e,t))return!1;return!0},"isEmptyObject"),bf=new Set(["__proto__","prototype","constructor"]),wf=1e6,i1=we(e=>e>="0"&&e<="9","isDigit");function pr(e){if(e==="0")return!0;if(/^[1-9]\d*$/.test(e)){const t=Number.parseInt(e,10);return t<=Number.MAX_SAFE_INTEGER&&t<=wf}return!1}ye(pr,"p$1");we(pr,"shouldCoerceToNumber");function Dr(e,t){return bf.has(e)?!1:(e&&pr(e)?t.push(Number.parseInt(e,10)):t.push(e),!0)}ye(Dr,"y");we(Dr,"processSegment");function fa(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);const t=[];let r="",n="start",o=!1,s=0;for(const i of e){if(s++,o){r+=i,o=!1;continue}if(i==="\\"){if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);o=!0,n=n==="start"?"property":n;continue}switch(i){case".":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="property";break}if(!Dr(r,t))return[];r="",n="property";break}case"[":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="index";break}if(n==="property"||n==="start"){if((r||n==="property")&&!Dr(r,t))return[];r=""}n="index";break}case"]":{if(n==="index"){if(r==="")r=(t.pop()||"")+"[]",n="property";else{const a=Number.parseInt(r,10);!Number.isNaN(a)&&Number.isFinite(a)&&a>=0&&a<=Number.MAX_SAFE_INTEGER&&a<=wf&&r===String(a)?t.push(a):t.push(r),r="",n="indexEnd"}break}if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);r+=i;break}default:{if(n==="index"&&!i1(i))throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);n==="start"&&(n="property"),r+=i}}}switch(o&&(r+="\\"),n){case"property":{if(!Dr(r,t))return[];break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}ye(fa,"parsePath");we(fa,"parsePath");function fr(e){if(typeof e=="string")return fa(e);if(Array.isArray(e)){const t=[];for(const[r,n]of e.entries()){if(typeof n!="string"&&typeof n!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof n}`);if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`Path segment at index ${r} must be a finite number, got ${n}`);if(bf.has(n))return[];typeof n=="string"&&pr(n)?t.push(Number.parseInt(n,10)):t.push(n)}return t}return[]}ye(fr,"d");we(fr,"normalizePath");function nt(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return r===void 0?e:r;const n=fr(t);if(n.length===0)return r;for(let o=0;o<n.length;o++){const s=n[o];if(e=e[s],e==null){if(o!==n.length-1)return r;break}}return e===void 0?r:e}ye(nt,"getProperty");we(nt,"getProperty");function da(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return e;const n=e,o=fr(t);if(o.length===0)return e;for(let s=0;s<o.length;s++){const i=o[s];if(s===o.length-1)e[i]=r;else if(!Ye(e[i])){const a=typeof o[s+1]=="number";e[i]=a?[]:{}}e=e[i]}return n}ye(da,"setProperty");we(da,"setProperty");function vf(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(let n=0;n<r.length;n++){const o=r[n];if(n===r.length-1)return Object.hasOwn(e,o)?(delete e[o],!0):!1;if(e=e[o],!Ye(e))return!1}}ye(vf,"deleteProperty");we(vf,"deleteProperty");function Ot(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(const n of r){if(!Ye(e)||!(n in e))return!1;e=e[n]}return!0}ye(Ot,"hasProperty");we(Ot,"hasProperty");function Gn(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return e.replaceAll(/[\\.[]/g,String.raw`\$&`)}ye(Gn,"escapePath");we(Gn,"escapePath");function ma(e){const t=Object.entries(e);return Array.isArray(e)?t.map(([r,n])=>[pr(r)?Number.parseInt(r,10):r,n]):t}ye(ma,"m$2");we(ma,"normalizeEntries");function ha(e,t={}){if(!Array.isArray(e))throw new TypeError(`Expected an array, got ${typeof e}`);const{preferDotForIndices:r=!1}=t,n=[];for(const[o,s]of e.entries()){if(typeof s!="string"&&typeof s!="number")throw new TypeError(`Expected a string or number for path segment at index ${o}, got ${typeof s}`);if(typeof s=="number")if(!Number.isInteger(s)||s<0){const i=Gn(String(s));n.push(o===0?i:`.${i}`)}else r&&o>0?n.push(`.${s}`):n.push(`[${s}]`);else if(typeof s=="string")if(s==="")o===0||n.push(".");else if(pr(s)){const i=Number.parseInt(s,10);r&&o>0?n.push(`.${i}`):n.push(`[${i}]`)}else{const i=Gn(s);n.push(o===0?i:`.${i}`)}}return n.join("")}ye(ha,"stringifyPath");we(ha,"stringifyPath");function*No(e,t=[],r=new Set){if(!Ye(e)||s1(e)){t.length>0&&(yield ha(t));return}if(!r.has(e)){r.add(e);for(const[n,o]of ma(e))t.push(n),yield*No(o,t,r),t.pop();r.delete(e)}}ye(No,"x");we(No,"deepKeysIterator");function xf(e){return[...No(e)]}ye(xf,"deepKeys");we(xf,"deepKeys");function Ef(e){const t={};if(!Ye(e))return t;for(const[r,n]of Object.entries(e))da(t,r,n);return t}ye(Ef,"unflatten");we(Ef,"unflatten");var a1=Object.defineProperty,ts=ye((e,t)=>a1(e,"name",{value:t,configurable:!0}),"i");const l1=ts(async e=>{const{default:t=!1,message:r,transformer:n}=e,o=ts(i=>{const a=Te(["cyan","bold"],"?"),l=Te(["bold"],i),u=t?`${Te(["greenBright"],"Y")}${Te(["gray"],"/n")}`:`y/${Te(["yellowBright"],"N")}`;return`${a} ${l} ${Te(["gray"],`(${u})`)}`},"formatMessage"),s=ts(i=>n?n(i):i?Te(["greenBright"],"Yes"):Te(["yellowBright"],"No"),"formatAnswer");return new Promise(i=>{const a=n1({input:process.stdin,output:process.stdout}),l=o(r);a.question(l,u=>{a.close();const c=u.trim().toLowerCase();if(c===""){i(t);return}if(c==="y"||c==="yes"){console.log(`${Te(["greenBright"],"✓")} ${s(!0)}`),i(!0);return}if(c==="n"||c==="no"){console.log(`${Te(["yellowBright"],"✗")} ${s(!1)}`),i(!1);return}console.log(`${Te(["gray"],"→")} ${s(t)}`),i(t)}),a.on("SIGINT",()=>{a.close(),console.log(`
|
|
47
|
+
`)}return v.join("")}};var NO="@visulima/packem",of="2.0.0-alpha.90";const PO={version:of};var kb=Object.defineProperty,sf=(e,t)=>kb(e,"name",{value:t,configurable:!0}),jb=Object.defineProperty,Ab=sf((e,t)=>jb(e,"name",{value:t,configurable:!0}),"o");let _O=class extends Error{static{sf(this,"n")}static{Ab(this,"DirectoryError")}constructor(t){super(`EISDIR: Illegal operation on a directory, ${t}`)}get code(){return"EISDIR"}set code(t){throw new Error("Cannot overwrite code EISDIR")}get name(){return"DirectoryError"}set name(t){throw new Error("Cannot overwrite name of DirectoryError")}};var Ob=Object.defineProperty,af=(e,t)=>Ob(e,"name",{value:t,configurable:!0}),Rb=Object.defineProperty,Cb=af((e,t)=>Rb(e,"name",{value:t,configurable:!0}),"t");let IO=class extends Error{static{af(this,"n")}static{Cb(this,"NotEmptyError")}constructor(t){super(`ENOTEMPTY: Directory not empty, ${t}`)}get code(){return"ENOTEMPTY"}set code(t){throw new Error("Cannot overwrite code ENOTEMPTY")}get name(){return"NotEmptyError"}set name(t){throw new Error("Cannot overwrite name of NotEmptyError")}};var Tb=Object.defineProperty,lf=(e,t)=>Tb(e,"name",{value:t,configurable:!0}),Nb=Object.defineProperty,Pb=lf((e,t)=>Nb(e,"name",{value:t,configurable:!0}),"o");let Mt=class extends Error{static{lf(this,"n")}static{Pb(this,"NotFoundError")}constructor(t){super(`ENOENT: ${t}`)}get code(){return"ENOENT"}set code(t){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(t){throw new Error("Cannot overwrite name of NotFoundError")}};var _b=Object.defineProperty,Mb=(e,t)=>_b(e,"name",{value:t,configurable:!0}),Ib=Object.defineProperty,Wb=Mb((e,t)=>Ib(e,"name",{value:t,configurable:!0}),"n");Wb((e,{whitespace:t=!0}={})=>e.replace(Sm,r=>r.startsWith('"')||r[1]==="*"&&!r.endsWith("*/")?r:t?r.replaceAll(/\S/g," "):""),"stripJsonComments");var Bb=Object.defineProperty,cf=(e,t)=>Bb(e,"name",{value:t,configurable:!0}),Db=Object.defineProperty,Lb=cf((e,t)=>Db(e,"name",{value:t,configurable:!0}),"r");async function Ro(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=await Hu(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Hn(l,t,a):Hn(l,a)}cf(Ro,"l");Lb(Ro,"readYaml");var Fb=Object.defineProperty,uf=(e,t)=>Fb(e,"name",{value:t,configurable:!0}),Hb=Object.defineProperty,qb=uf((e,t)=>Hb(e,"name",{value:t,configurable:!0}),"t");function Co(e,t,r){const{buffer:n,compression:o,encoding:s="utf8",flag:i,...a}=r??{},l=Fi(e,{buffer:n,compression:o,encoding:s,flag:i});return typeof t=="function"?Hn(l,t,a):Hn(l,a)}uf(Co,"l");qb(Co,"readYamlSync");var Jb=Object.defineProperty,pf=(e,t)=>Jb(e,"name",{value:t,configurable:!0}),zb=Object.defineProperty,Ub=pf((e,t)=>zb(e,"name",{value:t,configurable:!0}),"a");async function ff(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Xu(t,s,i??o);await km(e,a,o)}pf(ff,"c");Ub(ff,"writeYaml");var Gb=Object.defineProperty,df=(e,t)=>Gb(e,"name",{value:t,configurable:!0}),Vb=Object.defineProperty,Kb=df((e,t)=>Vb(e,"name",{value:t,configurable:!0}),"a");function mf(e,t,r,n){let o,s,i;typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r!="function"?(o=r,s=o.replacer,i=o.space):typeof n=="object"?(o=n,s=r,i=o.space):(s=r,i=n);const a=Xu(t,s,i??o);po(e,a,o)}df(mf,"c");Kb(mf,"writeYamlSync");var Yb=Object.defineProperty,Xb=(e,t)=>Yb(e,"name",{value:t,configurable:!0}),Zb=Object.defineProperty,ur=Xb((e,t)=>Zb(e,"name",{value:t,configurable:!0}),"c");const hf=ur((e,t,r)=>{const n=Z(e),o=Z(t),s=o===n?".":ke(n,o);return r.some(i=>{const a=i.startsWith("./")?i.slice(2):i,l=s.startsWith("./")?s.slice(2):s;if(a==="."&&l===".")return!0;if(a.endsWith("/**")){const u=a.slice(0,-3);return l===u||l.startsWith(`${u}/`)}if(a.endsWith("/*")){const u=a.slice(0,-2);return u===""?l!=="."&&!l.includes("/"):l.startsWith(`${u}/`)||l===u}return l===a||l.startsWith(`${a}/`)})},"isPackageInWorkspace"),gf=ur(async e=>{const t=await ft("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=await Ro(t),n=Array.isArray(r.packages)?r.packages:[];if(!hf(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogs"),yf=ur(e=>{const t=dt("pnpm-workspace.yaml",{cwd:Z(e),type:"file"});if(!t)return;const r=Co(t),n=Array.isArray(r.packages)?r.packages:[];if(!hf(t,e,n))return;const o={};return r.catalog&&typeof r.catalog=="object"&&(o.catalog=r.catalog),r.catalogs&&typeof r.catalogs=="object"&&(o.catalogs=r.catalogs),Object.keys(o).length>0?o:void 0},"readPnpmCatalogsSync"),Qb=ur((e,t,r)=>{if(t==="catalog:")return r.catalog?.[e];if(t.startsWith("catalog:")){const n=t.slice(8);return r.catalogs?.[n]?.[e]}},"resolveCatalogReference"),e1=ur((e,t)=>{for(const[r,n]of Object.entries(e)){if(typeof n!="string")continue;const o=Qb(r,n,t);o&&(e[r]=o)}},"resolveDependenciesCatalogReferences"),To=ur((e,t)=>{const r=["dependencies","devDependencies","peerDependencies","optionalDependencies"];for(const n of r){if(!e[n]||typeof e[n]!="object")continue;const o=e[n];e1(o,t)}},"resolveCatalogReferences");var t1=Object.defineProperty,ye=(e,t)=>t1(e,"name",{value:t,configurable:!0});const r1=Me(import.meta.url),yr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,pa=ye(e=>{if(typeof yr<"u"&&yr.versions&&yr.versions.node){const[t,r]=yr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return yr.getBuiltinModule(e)}return r1(e)},"__cjs_getBuiltinModule"),{existsSync:$f}=pa("node:fs"),{createInterface:n1}=pa("node:readline"),{styleText:Te}=pa("node:util");var o1=Object.defineProperty,we=ye((e,t)=>o1(e,"name",{value:t,configurable:!0}),"f");const Ye=we(e=>{const t=typeof e;return e!==null&&(t==="object"||t==="function")},"isObject"),s1=we(e=>{if(!Ye(e))return!1;for(const t in e)if(Object.hasOwn(e,t))return!1;return!0},"isEmptyObject"),bf=new Set(["__proto__","prototype","constructor"]),wf=1e6,i1=we(e=>e>="0"&&e<="9","isDigit");function pr(e){if(e==="0")return!0;if(/^[1-9]\d*$/.test(e)){const t=Number.parseInt(e,10);return t<=Number.MAX_SAFE_INTEGER&&t<=wf}return!1}ye(pr,"p$1");we(pr,"shouldCoerceToNumber");function Dr(e,t){return bf.has(e)?!1:(e&&pr(e)?t.push(Number.parseInt(e,10)):t.push(e),!0)}ye(Dr,"y");we(Dr,"processSegment");function fa(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);const t=[];let r="",n="start",o=!1,s=0;for(const i of e){if(s++,o){r+=i,o=!1;continue}if(i==="\\"){if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);o=!0,n=n==="start"?"property":n;continue}switch(i){case".":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="property";break}if(!Dr(r,t))return[];r="",n="property";break}case"[":{if(n==="index")throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd"){n="index";break}if(n==="property"||n==="start"){if((r||n==="property")&&!Dr(r,t))return[];r=""}n="index";break}case"]":{if(n==="index"){if(r==="")r=(t.pop()||"")+"[]",n="property";else{const a=Number.parseInt(r,10);!Number.isNaN(a)&&Number.isFinite(a)&&a>=0&&a<=Number.MAX_SAFE_INTEGER&&a<=wf&&r===String(a)?t.push(a):t.push(r),r="",n="indexEnd"}break}if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);r+=i;break}default:{if(n==="index"&&!i1(i))throw new Error(`Invalid character '${i}' in an index at position ${s}`);if(n==="indexEnd")throw new Error(`Invalid character '${i}' after an index at position ${s}`);n==="start"&&(n="property"),r+=i}}}switch(o&&(r+="\\"),n){case"property":{if(!Dr(r,t))return[];break}case"index":throw new Error("Index was not closed");case"start":{t.push("");break}}return t}ye(fa,"parsePath");we(fa,"parsePath");function fr(e){if(typeof e=="string")return fa(e);if(Array.isArray(e)){const t=[];for(const[r,n]of e.entries()){if(typeof n!="string"&&typeof n!="number")throw new TypeError(`Expected a string or number for path segment at index ${r}, got ${typeof n}`);if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`Path segment at index ${r} must be a finite number, got ${n}`);if(bf.has(n))return[];typeof n=="string"&&pr(n)?t.push(Number.parseInt(n,10)):t.push(n)}return t}return[]}ye(fr,"d");we(fr,"normalizePath");function nt(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return r===void 0?e:r;const n=fr(t);if(n.length===0)return r;for(let o=0;o<n.length;o++){const s=n[o];if(e=e[s],e==null){if(o!==n.length-1)return r;break}}return e===void 0?r:e}ye(nt,"getProperty");we(nt,"getProperty");function da(e,t,r){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return e;const n=e,o=fr(t);if(o.length===0)return e;for(let s=0;s<o.length;s++){const i=o[s];if(s===o.length-1)e[i]=r;else if(!Ye(e[i])){const a=typeof o[s+1]=="number";e[i]=a?[]:{}}e=e[i]}return n}ye(da,"setProperty");we(da,"setProperty");function vf(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(let n=0;n<r.length;n++){const o=r[n];if(n===r.length-1)return Object.hasOwn(e,o)?(delete e[o],!0):!1;if(e=e[o],!Ye(e))return!1}}ye(vf,"deleteProperty");we(vf,"deleteProperty");function Ot(e,t){if(!Ye(e)||typeof t!="string"&&!Array.isArray(t))return!1;const r=fr(t);if(r.length===0)return!1;for(const n of r){if(!Ye(e)||!(n in e))return!1;e=e[n]}return!0}ye(Ot,"hasProperty");we(Ot,"hasProperty");function Gn(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return e.replaceAll(/[\\.[]/g,String.raw`\$&`)}ye(Gn,"escapePath");we(Gn,"escapePath");function ma(e){const t=Object.entries(e);return Array.isArray(e)?t.map(([r,n])=>[pr(r)?Number.parseInt(r,10):r,n]):t}ye(ma,"m$2");we(ma,"normalizeEntries");function ha(e,t={}){if(!Array.isArray(e))throw new TypeError(`Expected an array, got ${typeof e}`);const{preferDotForIndices:r=!1}=t,n=[];for(const[o,s]of e.entries()){if(typeof s!="string"&&typeof s!="number")throw new TypeError(`Expected a string or number for path segment at index ${o}, got ${typeof s}`);if(typeof s=="number")if(!Number.isInteger(s)||s<0){const i=Gn(String(s));n.push(o===0?i:`.${i}`)}else r&&o>0?n.push(`.${s}`):n.push(`[${s}]`);else if(typeof s=="string")if(s==="")o===0||n.push(".");else if(pr(s)){const i=Number.parseInt(s,10);r&&o>0?n.push(`.${i}`):n.push(`[${i}]`)}else{const i=Gn(s);n.push(o===0?i:`.${i}`)}}return n.join("")}ye(ha,"stringifyPath");we(ha,"stringifyPath");function*No(e,t=[],r=new Set){if(!Ye(e)||s1(e)){t.length>0&&(yield ha(t));return}if(!r.has(e)){r.add(e);for(const[n,o]of ma(e))t.push(n),yield*No(o,t,r),t.pop();r.delete(e)}}ye(No,"x");we(No,"deepKeysIterator");function xf(e){return[...No(e)]}ye(xf,"deepKeys");we(xf,"deepKeys");function Ef(e){const t={};if(!Ye(e))return t;for(const[r,n]of Object.entries(e))da(t,r,n);return t}ye(Ef,"unflatten");we(Ef,"unflatten");var a1=Object.defineProperty,ts=ye((e,t)=>a1(e,"name",{value:t,configurable:!0}),"i");const l1=ts(async e=>{const{default:t=!1,message:r,transformer:n}=e,o=ts(i=>{const a=Te(["cyan","bold"],"?"),l=Te(["bold"],i),u=t?`${Te(["greenBright"],"Y")}${Te(["gray"],"/n")}`:`y/${Te(["yellowBright"],"N")}`;return`${a} ${l} ${Te(["gray"],`(${u})`)}`},"formatMessage"),s=ts(i=>n?n(i):i?Te(["greenBright"],"Yes"):Te(["yellowBright"],"No"),"formatAnswer");return new Promise(i=>{const a=n1({input:process.stdin,output:process.stdout}),l=o(r);a.question(l,u=>{a.close();const c=u.trim().toLowerCase();if(c===""){i(t);return}if(c==="y"||c==="yes"){console.log(`${Te(["greenBright"],"✓")} ${s(!0)}`),i(!0);return}if(c==="n"||c==="no"){console.log(`${Te(["yellowBright"],"✗")} ${s(!1)}`),i(!1);return}console.log(`${Te(["gray"],"→")} ${s(t)}`),i(t)}),a.on("SIGINT",()=>{a.close(),console.log(`
|
|
48
48
|
${Te(["gray"],"→")} ${s(t)}`),i(t)})})},"confirm"),c1=typeof process.stdout<"u"&&!process.versions.deno&&!globalThis.window;var u1=Object.defineProperty,be=ye((e,t)=>u1(e,"name",{value:t,configurable:!0}),"l");const Sf=/, ([^,]*)$/,Vn=new Map,kf=new Map;let p1=class extends Error{static{ye(this,"M")}static{be(this,"PackageJsonValidationError")}constructor(t){super(`The following warnings were encountered while normalizing package data:
|
|
49
49
|
- ${t.join(`
|
|
50
50
|
- `)}`),this.name="PackageJsonValidationError"}};const Po=be((e,t,r=[])=>{const n=[];if(Im(e,o=>{n.push(o)},t),t&&n.length>0){const o=n.filter(s=>!r.some(i=>i instanceof RegExp?i.test(s):i===s));if(o.length>0)throw new p1(o)}return e},"normalizeInput"),f1=be(async e=>await Ro(e),"parseYamlFile"),d1=be(e=>Co(e),"parseYamlFileSync"),m1=be(async e=>{const t=await Hu(e);return Zu.parse(t)},"parseJson5File"),h1=be(e=>{const t=Fi(e);return Zu.parse(t)},"parseJson5FileSync"),jf=be(async(e,t)=>t?.yaml!==!1&&(e.endsWith(".yaml")||e.endsWith(".yml"))?f1(e):t?.json5!==!1&&e.endsWith(".json5")?m1(e):fo(e),"parsePackageFile"),Af=be((e,t)=>t?.yaml!==!1&&(e.endsWith(".yaml")||e.endsWith(".yml"))?d1(e):t?.json5!==!1&&e.endsWith(".json5")?h1(e):Hi(e),"parsePackageFileSync");be(async(e,t={})=>{const r={type:"file"};e&&(r.cwd=e);const n=["package.json"];t.yaml!==!1&&n.push("package.yaml","package.yml"),t.json5!==!1&&n.push("package.json5");let o;for(const l of n)if(o=await ft(l,r),o)break;if(!o)throw new Mt(`No such file or directory, for ${n.join(", ").replace(Sf," or $1")} found.`);const s=t.cache&&typeof t.cache!="boolean"?t.cache:kf;if(t.cache&&s.has(o))return s.get(o);const i=await jf(o,t);if(t.resolveCatalogs){const l=await gf(o);l&&To(i,l)}Po(i,t.strict??!1,t.ignoreWarnings);const a={packageJson:i,path:o};return t.cache&&s.set(o,a),a},"findPackageJson");be((e,t={})=>{const r={type:"file"};e&&(r.cwd=e);const n=["package.json"];t.yaml!==!1&&n.push("package.yaml","package.yml"),t.json5!==!1&&n.push("package.json5");let o;for(const l of n)if(o=dt(l,r),o)break;if(!o)throw new Mt(`No such file or directory, for ${n.join(", ").replace(Sf," or $1")} found.`);const s=t.cache&&typeof t.cache!="boolean"?t.cache:kf;if(t.cache&&s.has(o))return s.get(o);const i=Af(o,t);if(t.resolveCatalogs){const l=yf(o);l&&To(i,l)}Po(i,t.strict??!1,t.ignoreWarnings);const a={packageJson:i,path:o};return t.cache&&s.set(o,a),a},"findPackageJsonSync");be(async(e,t={})=>{const{cwd:r,...n}=t,o=Fr(r??process.cwd());await Ju(G(o,"package.json"),e,n)},"writePackageJson");be((e,t={})=>{const{cwd:r,...n}=t,o=Fr(r??process.cwd());jm(G(o,"package.json"),e,n)},"writePackageJsonSync");const ga=be((e,t)=>{const r=typeof e=="object"&&!Array.isArray(e);if(!r&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");let n,o=!1,s;if(r)n=structuredClone(e);else if($f(e)){s=e;const a=t?.cache&&typeof t.cache!="boolean"?t.cache:Vn;if(t?.cache&&a.has(s))return a.get(s);n=Af(s,t),o=!0}else n=qu(e);if(t?.resolveCatalogs)if(o){const a=yf(e);a&&To(n,a)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");Po(n,t?.strict??!1,t?.ignoreWarnings);const i=n;return o&&t?.cache&&(typeof t.cache=="boolean"?Vn:t.cache).set(s,i),i},"parsePackageJsonSync"),LO=be(async(e,t)=>{const r=typeof e=="object"&&!Array.isArray(e);if(!r&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");let n,o=!1,s;if(r)n=structuredClone(e);else if($f(e)){s=e;const a=t?.cache&&typeof t.cache!="boolean"?t.cache:Vn;if(t?.cache&&a.has(s))return a.get(s);n=await jf(s,t),o=!0}else n=qu(e);if(t?.resolveCatalogs)if(o){const a=await gf(e);a&&To(n,a)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");Po(n,t?.strict??!1,t?.ignoreWarnings);const i=n;return o&&t?.cache&&(typeof t.cache=="boolean"?Vn:t.cache).set(s,i),i},"parsePackageJson");be((e,t,r)=>nt(e,t,r),"getPackageJsonProperty");be((e,t)=>Ot(e,t),"hasPackageJsonProperty");const Of=be((e,t,r)=>{const n=nt(e,"dependencies",{}),o=nt(e,"devDependencies",{}),s=nt(e,"peerDependencies",{}),i={...n,...o,...r?.peerDeps===!1?{}:s};for(const a of t)if(Ot(i,a))return!0;return!1},"hasPackageJsonAnyDependency"),g1=be(async(e,t,r="dependencies",n={})=>{const o=nt(e,"dependencies",{}),s=nt(e,"devDependencies",{}),i=nt(e,"peerDependencies",{}),a=[],l={deps:!0,devDeps:!0,peerDeps:!1,...n};for(const u of t)l.deps&&Ot(o,u)||l.devDeps&&Ot(s,u)||l.peerDeps&&Ot(i,u)||a.push(u);if(a.length!==0){if(process.env.CI||c1&&!process.stdout.isTTY){const u=`Skipping package installation for [${t.join(", ")}] because the process is not interactive.`;if(n.throwOnWarn)throw new Error(u);n.logger?.warn?n.logger.warn(u):console.warn(u);return}if(typeof l.confirm?.message=="function"&&(l.confirm.message=l.confirm.message(a)),l.confirm?.message===void 0){const u=`${a.length===1?"Package is":"Packages are"} required for this config: ${a.join(", ")}. Do you want to install them?`;l.confirm===void 0?l.confirm={message:u}:l.confirm.message=u}await l1(l.confirm)&&await Yu(a,{...l.installPackage,cwd:l.cwd?Fr(l.cwd):void 0,dev:r==="devDependencies"})}},"ensurePackages"),Kn=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"],y1=/\.(?:js|mjs|cjs|ts|cts|mts)$/,FO=async(e,t="")=>{if(t){const r=Tt(t)?t:G(e,t);if(!y1.test(r))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");if(!await Ct(r))throw new Error(`The packem config file "${t}" could not be found at "${r}".`);return r}for(const r of Kn){const n=G(e,r);if(await Ct(n))return n}throw new Error(`No packem config file found in "${e}". Expected one of: ${Kn.join(", ")}.`)},HO=async e=>{for(const t of Kn)if(await Ct(G(e,t)))return!0;return!1},$1={esbuild:"esbuild",oxc:"oxc-transform",sucrase:"sucrase",swc:"@swc/core"},Rl=async(e,t)=>{const r=Array.isArray(e)?e:[e],n=await Mm(t).catch(()=>{});let o;return n==="yarn"||n==="bun"?o=`${n} add -D`:n==="pnpm"?o="pnpm add -D":o="npm install -D",`${o} ${r.join(" ")}`},Yn=e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},ki=(e,t,r,n)=>{if(e==="module-sync")return"esm";if(n){const i=Yn(n);if(i)return i}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return r;const[o,...s]=t;return ki(o,s,r,n)},b1=new Set(["browser","bun","default","deno","electron","import","module-sync","node","node-addons","require","types","workerd",...op,...sp]),ya=(e,t,r,n,o)=>{if(!e)return[];if(typeof e=="string"){const s=Yn(e);if(s&&s!==t)throw new Error(`Exported file "${e}" has an extension that does not match the package.json type "${t==="esm"?"module":"commonjs"}".`);return[{file:e,key:"exports",type:s??t}]}if(typeof e=="object"){const s=Object.entries(e).filter(([a])=>!a.endsWith(".json"));let i=[];for(const[a,l]of s){const u=a.replace("./",""),c=o.some(p=>u===p||u.startsWith(`${p}/`));if(typeof l=="string"){let p;Number.isInteger(+a)?p={exportKey:"*"}:a.startsWith("./")?p={exportKey:a.replace("./","")}:p={exportKey:a==="."?".":"*",subKey:a},i.push({...p,file:l,key:"exports",type:ki(a,n,t,l),...c&&{ignored:!0}})}else if(typeof l=="object"&&l!==null)for(const[p,f]of Object.entries(l)){if(r===!1&&p==="types")continue;const d=Number.isInteger(+a)?p:a;if(typeof f=="string")i.push({exportKey:d.replace("./",""),file:f,key:"exports",...b1.has(p)?{subKey:p}:{},type:ki(p,n,t,f),...c&&{ignored:!0}});else{const m=d.replace("./",""),h=c||o.some(y=>m===y||m.startsWith(`${y}/`)),$=ya({[d]:f},t,r,[...n,p],o);h&&$.forEach(y=>{y.ignored=!0}),i=[...i,...$]}}}return i}return[]},ji=new Map,nr=/\.[^./]+$/,Ce=/\.d\.[mc]?ts$/,Ai=/\.d\.mts$/,Oi=/\.d\.cts$/,Cl=/\.d\.[mc]ts$/,w1=/^\.\/dist\//,Ri=/^dist\//,v1=/^\//,_r=/^\.\//,x1=/\/$/,Tl=/\.\w+$/,Nl=/\*.*$/,E1=/\.(?:tsx?|cts|mts)$/,S1=/\.[cm]?tsx?$/,k1=/^(.+?)\.[^.]*$/,j1=/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,Re=e=>e===void 0||e==="node16",Rf=(e,t)=>{const r=Ce.exec(e);if(r!==null)return r[0];if(t)for(const n of Object.values(t)){const o=n.startsWith(".")?n:`.${n}`;if(e.endsWith(o))return o}return tr(e)},A1=async e=>{try{return await lp.readdir(e,{withFileTypes:!0})}catch(t){const{code:r}=t;if(r==="ENOENT")return[];throw t}},Cf=async(e,t)=>{const r=await A1(e);return(await Promise.all(r.map(async n=>{const o=ll.join(e,n.name);return n.isDirectory()?Cf(o,t):n.isFile()?ll.relative(t,o):[]}))).flat()},O1=async e=>{let t=ji.get(e);return t||(t=Cf(e,e),ji.set(e,t)),t},Pl=(e,t,r)=>{const n=e.replace(nr,"");if(t==="*"){const i=n.split("/").filter(Boolean);return i.length===0?void 0:r&&r>1?i:[i[0]]}const o=t.replaceAll(/[.+?^${}()|[\]\\]/g,String.raw`\$&`).replaceAll("*","(.*)"),s=new RegExp(`^${o}$`).exec(n);return s?s.slice(1):void 0},xt=(e,t)=>{let r=e;for(const n of t)r=r.replace("*",n);return r},R1=e=>e.endsWith(".d.mts")?"d.mts":e.endsWith(".d.cts")?"d.cts":"d.ts",C1=(e,t)=>e.key==="exports"&&e.subKey===Wr?Wr:e.key==="exports"&&e.subKey===sl?sl:t,T1=e=>{const t=e.replace(w1,"").replace(Ri,"").replace(nr,"").split("/"),r=t.at(-1)??"",n=[".browser",".server",".development",".production",".node",".workerd"];for(const s of n)if(r.includes(s)){const i=r.replace(s,""),a=t.length>1?t.slice(0,-1).join("/"):"";return{baseName:a?`${a}/${i}`:i,pattern:s}}const o=r.split(".");if(o.length>2){const s=o.slice(0,-2).join("."),i=`.${o[o.length-2]}`,a=t.length>1?t.slice(0,-1).join("/"):"";return{baseName:a?`${a}/${s}`:s,pattern:i}}},N1=(e,t,r,n)=>{const o=`${t.replace(new RegExp(`^${n}/?`),"")}${r}`,s=o.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),i=new RegExp(String.raw`${s}\.([cm]?[tj]sx?|ts|js)$`),a=e.find(u=>{const c=u.replace(n,"").replace(v1,"");return i.test(c)});if(a)return a;const l=`${n}/${o}`;return e.find(u=>{const c=u.replace(nr,"");return c===l||c.endsWith(`/${o}`)})??void 0},at=(e,t,r,n,o,s,i,a)=>{const l=C1(o,s.environment);let{runtime:u}=s.options;const c=o.subKey==="browser"||typeof o.subKey=="string"&&o.subKey.includes("browser"),p=o.file.includes(".browser");if(c||p)u="browser";else{for(const b of op)if(o.file.includes(`.${b}.`)||o.subKey===b){u=b;break}(o.subKey==="node"||o.subKey==="workerd"||o.file.includes(".node")||o.file.includes(".workerd")||o.file.includes(".server"))&&(u="node")}const f=Rf(o.file,s.options.outputExtensionMap),d=o.file.replace(f,""),m=s.options.outDir.replace(_r,""),h=d.replace(new RegExp(`^(./)?${m}/`),""),$=t.replace(nr,"").split("/").pop()??"",y=h.split("/").pop()??"",g=!t.includes(h)&&$!==y;let w=e.find(b=>b.input===t&&b.environment===l&&b.runtime===u&&b.fileAlias===(g?h:void 0));if(w===void 0?w=e[e.push({environment:l,exportKey:new Set([o.exportKey].filter(Boolean)),fileAlias:g?h:void 0,input:t,runtime:u})-1]:w.exportKey&&o.exportKey&&w.exportKey.add(o.exportKey),i&&(w.isGlob=!0),r&&(w.outDir=n),o.isExecutable)w.executable=!0,w.declaration=!1,o.type==="cjs"?w.cjs=!0:o.type==="esm"&&(w.esm=!0);else{const b=Ce.test(o.file),v=a.filter(x=>x.exportKey===o.exportKey),S=v.length>0&&v.every(x=>Ce.test(x.file));if(b&&s.options.declaration!==!1){w.declaration=s.options.declaration;const x=R1(o.file);w.declarationExtensions??=new Set,w.declarationExtensions.add(x)}if(b||S){S&&s.options.declaration!==!1&&(w.declaration=s.options.declaration);const x=v.some(j=>Ai.test(j.file)),E=v.some(j=>Oi.test(j.file));if(x&&E?(Re(s.options.declaration)&&(s.options.declaration="compatible"),s.options.emitCJS=!0,s.options.emitESM=!0):E?(s.options.emitCJS=!0,Re(s.options.declaration)&&(s.options.declaration="compatible")):x&&(s.options.emitESM=!0,Re(s.options.declaration)&&(s.options.declaration="compatible")),S){const j=a.filter(P=>Ce.test(P.file)),k=j.some(P=>Ai.test(P.file)),R=j.some(P=>Oi.test(P.file));v.every(P=>!P.subKey||P.subKey==="types")?(R&&(w.cjs=!0),k&&(w.esm=!0)):(R&&(w.declarationCjs=!0),k&&(w.declarationEsm=!0))}}else o.type==="cjs"?w.cjs=!0:o.type==="esm"&&(w.esm=!0)}g&&!w.fileAlias&&(w.fileAlias=h)};let rs=!1;const _l=e=>{if(e.pkg.dependencies?.typescript===void 0&&e.pkg.devDependencies?.typescript===void 0)throw new Error("You tried to use a `.ts`, `.cts` or `.mts` file but `typescript` was not found in your package.json.")},P1=async(e,t,r)=>{const n=e.types||e.typings;ji.clear(),rs=!1;const o=[];t.sort((d,m)=>d.split("/").length-m.split("/").length);const s=e.type==="module"?"esm":"cjs",i=r.options.declaration??"node16",a=ya(e.exports,s,i,[],r.options.ignoreExportKeys??[]).filter(d=>!d.ignored),l=new Set;for(const d of a){const m=a.filter(h=>h.exportKey===d.exportKey);if(m.length>0&&m.every(h=>Ce.test(h.file))&&!l.has(d.exportKey)){l.add(d.exportKey);const h=m.some(y=>y.file.endsWith(".d.mts")),$=m.some(y=>y.file.endsWith(".d.cts"));h&&$?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0,r.options.emitESM=!0):$?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0):h&&(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitESM=!0)}}r.options.declaration??="node16";const u=a.some(d=>d.type==="esm"&&!Ai.test(d.file)),c=a.some(d=>d.type==="cjs"&&!Oi.test(d.file));u&&c?(r.options.emitESM=!0,r.options.emitCJS=!0):u?r.options.emitESM=!0:c?r.options.emitCJS=!0:s==="esm"?r.options.emitESM=!0:r.options.emitCJS=!0;const p=r.options.emitCJS&&r.options.emitESM;if(r.options.declaration==="node16"&&p&&(r.options.declaration="compatible"),e.bin){const d=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const m of d){const h=Yn(m);if(h&&h!==s)throw new Error(`Exported file "${m}" has an extension that does not match the package.json type "${e.type??"commonjs"}".`);a.push({file:m,isExecutable:!0,key:"bin",type:h??s})}}e.main&&a.push({file:e.main,key:"main",type:Yn(e.main)??s}),e.module&&a.push({file:e.module,key:"module",type:"esm"}),n&&(_l(r),Re(r.options.declaration)&&p&&(r.options.declaration="compatible"),a.push({file:n,key:"types"}));const f=[];if(!r.options.outputExtensionMap){const d=a.some($=>!$.isExecutable&&!Ce.test($.file)&&$.file.endsWith(".mjs")),m=a.some($=>!$.isExecutable&&!Ce.test($.file)&&$.file.endsWith(".cjs")),h=a.some($=>!$.isExecutable&&!Ce.test($.file)&&$.file.endsWith(".js"));d&&!m&&!h?r.options.outputExtensionMap={esm:"mjs"}:m&&!d&&!h&&(r.options.outputExtensionMap={cjs:"cjs"})}for(const d of a){const m=Ce.test(d.file),h=Rf(d.file,r.options.outputExtensionMap),$=[...ho];if(r.options.outputExtensionMap)for(const k of Object.values(r.options.outputExtensionMap)){const R=k.startsWith(".")?k:`.${k}`;$.includes(R)||$.push(R)}if(!m&&h!==""&&!$.includes(h)||!m&&E1.test(d.file))continue;let y=d.type;if(!y&&m){if(d.file.endsWith(".d.mts"))y="esm";else if(d.file.endsWith(".d.cts"))y="cjs";else if(d.file.endsWith(".d.ts")){const k=a.some(P=>P.subKey==="import"&&P.file.endsWith(".d.mts")),R=a.some(P=>P.subKey==="require"&&P.file.endsWith(".d.cts"));k&&R?y=void 0:y=r.pkg.type==="module"?"esm":"cjs"}}if(Ce.test(d.file)||(r.options.emitCJS===void 0&&(y==="cjs"||d.type==="cjs")&&(r.options.emitCJS=!0),r.options.emitESM===void 0&&(y==="esm"||d.type==="esm")&&(r.options.emitESM=!0)),Re(r.options.declaration)){const k=r.options.emitCJS&&r.options.emitESM;r.options.declaration=k?"compatible":"node16"}let g=d.file;if(r.options.outputExtensionMap)for(const k of Object.values(r.options.outputExtensionMap)){const R=k.startsWith(".")?k:`.${k}`;if(d.file.endsWith(R)){g=d.file.slice(0,-R.length);break}}g===d.file&&(g=d.file.replace(j1,""));const w=g.endsWith("/");if(w&&["./","/"].includes(g))continue;const b=g.replace(new RegExp(`(./)?${r.options.outDir}`),r.options.sourceDir).replace("./",""),v=w?"":String.raw`(\.d\.[cm]?ts|(\.[cm]?[tj]sx?))$`,S="(?:^|/)";if((d.file.includes("/*")||g.includes("*"))&&d.key==="exports"){rs||(r.logger?.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),rs=!0);let k;d.exportKey?k=d.exportKey.startsWith("./")?d.exportKey.slice(2):d.exportKey:k=(d.file.startsWith("./")?d.file.slice(2):d.file).replace(Ri,"");const R=d.file,P=Tl.exec(R);if(R.includes("*")&&!P&&d.exportKey&&!d.subKey){const _=R.replace(Nl,"").replace(_r,""),M=k.replace(Nl,"").replace(_r,"");if(_!==M){const H=`package.json#exports["${d.exportKey==="."?".":`./${d.exportKey}`}"]`;o.push(`Wildcard pattern must include a file extension: ${R} at ${H}`);continue}}const z=r.options.sourceDir.replace(_r,""),U=X(r.options.rootDir,z),J=[],N=await O1(U),O=R.split("*").length-1,F=k.split("*").length-1;for(const _ of N){const M=Pl(_,k,O);if(M){if(O>F&&O>1){if(M.length>=O){const B=M[0];if(M.every(D=>D===B)){const D=xt(R,M.slice(0,O));D.includes("*")||J.push({input:X(U,_),output:D})}continue}const V=_.replace(nr,"").split("/").filter(Boolean);if(V.length>=O){const B=Math.floor(V.length/O),D=[];for(let q=0;q<O;q+=1){const A=q*B,le=q===O-1?V.length:(q+1)*B;D.push(V.slice(A,le).join("/"))}const K=D[0];if(D.every(q=>q===K)){const q=xt(R,D);q.includes("*")||J.push({input:X(U,_),output:q})}}else if(V.length>0){const B=V[0];if(V.every(D=>D===B)){const D=Array.from({length:O}).fill(B),K=xt(R,D);K.includes("*")||J.push({input:X(U,_),output:K})}}continue}if(M.length<O)continue;if(F>0&&F<O&&O>1&&M.length>1){const V=M[0];if(!M.every(B=>B===V))continue}const H=xt(R,M);if(H.includes("*"))continue;J.push({input:X(U,_),output:H})}}if(J.length===0&&R.includes("*")){let _=(d.file.startsWith("./")?d.file.slice(2):d.file).replace(Ri,"");_=_.replace(Tl,"");for(const M of N){const H=Pl(M,_,O);if(H){if(O>1&&F<O){if(H.length>=O){const D=H[0];if(H.every(K=>K===D)){const K=xt(R,H);K.includes("*")||J.push({input:X(U,M),output:K});continue}}const V=M.replace(nr,""),B=_.split("*");if(B.length>=2){const D=B.map(A=>A.replaceAll(/[.+?^${}()|[\]\\]/g,String.raw`\$&`));let K=`${D[0]}(.+)`;for(let A=1;A<D.length;A+=1)K+=D[A],A<D.length-1&&(K+=String.raw`\1`);const q=new RegExp(`^${K}$`).exec(V);if(q){const A=q[1],le=xt(R,Array.from({length:O}).fill(A));le.includes("*")||J.push({input:X(U,M),output:le})}}continue}if(H.length>=O){if(F>0&&F<O&&O>1&&H.length>1){const B=H[0];if(!H.every(D=>D===B))continue}const V=xt(R,H);V.includes("*")||J.push({input:X(U,M),output:V})}}}}if(J.length===0){a.length>1||o.push(`Could not find entrypoints matching pattern \`${k}\` for output \`${R}\``);continue}const I=a.filter(_=>_.exportKey===d.exportKey);if(I.length>0&&I.every(_=>Ce.test(_.file))){const _=I.some(D=>D.file.endsWith(".d.ts")),M=I.some(D=>D.file.endsWith(".d.mts")),H=I.some(D=>D.file.endsWith(".d.cts"));M&&H?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0,r.options.emitESM=!0):H?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0):M&&(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitESM=!0);const V=I.find(D=>D.file.endsWith(".d.ts")),B=V??I.find(D=>D.file.endsWith(".d.mts"))??I.find(D=>D.file.endsWith(".d.cts"))??d;if(!(B===d||V!==void 0&&d===V||V===void 0&&B===d))continue;for(const{input:D,output:K}of J){let q=K;if(K.endsWith(".d.mts")||K.endsWith(".d.cts"))q=K.replace(Cl,".d.ts");else if(!K.endsWith(".d.ts")){const le=K.replace(Cl,".d.ts");_&&(q=le)}const A={...B,file:q,subKey:"types",type:void 0};at(f,D,!1,g,A,r,!0,a)}}else for(const{input:_,output:M}of J){const H=Ce.test(M);let V=d.type;H||(M.endsWith(".mjs")?V="esm":M.endsWith(".cjs")?V="cjs":M.endsWith(".js")&&!V&&(V=r.pkg.type==="module"?"esm":"cjs"));const B={...d,file:M,...!H&&V&&{type:V}};at(f,_,!1,g,B,r,!0,a)}continue}const x=new RegExp(S+b.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+v);let E=t.find(k=>x.test(k));if(E===void 0){const k=r.options.sourceDir.replace(_r,""),R=X(r.options.rootDir,k),P=T1(d.file);if(P){const z=N1(t,P.baseName,P.pattern,R);if(z)E=z;else{const U=P.baseName,J=new RegExp(S+U.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+v);E=t.find(N=>J.test(N))}}else{const z=b.replace(k1,"$1").replace(x1,"");if(sp.has(d.subKey)){const U=new RegExp(S+z.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+v);E=t.find(J=>U.test(J))}}}if(E===void 0){rt(X(r.options.rootDir,d.file))||o.push(`Could not find entrypoint for \`${d.file}\``);continue}rt(E)&&S1.test(E)&&_l(r);const j=a.filter(k=>k.exportKey===d.exportKey);if(j.length>0&&j.every(k=>Ce.test(k.file))){const k=j.some(z=>z.file.endsWith(".d.mts")),R=j.some(z=>z.file.endsWith(".d.cts"));k&&R?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0,r.options.emitESM=!0):R?(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitCJS=!0):k&&(Re(r.options.declaration)&&(r.options.declaration="compatible"),r.options.emitESM=!0);const P={...d,subKey:"types",type:void 0};at(f,E,w,g,P,r,!1,a)}else{const k=Pm(E.replace(Ki,"")),R=`${k}.cts`,P=`${k}.mts`,z=rt(R),U=rt(P),J=d.file.endsWith(".d.mts")||d.file.endsWith(".mjs"),N=d.file.endsWith(".d.cts")||d.file.endsWith(".cjs");J&&U?at(f,P,w,g,{...d,type:"esm"},r,!1,a):N&&z?at(f,R,w,g,{...d,type:"cjs"},r,!1,a):z&&U?(at(f,R,w,g,{...d,type:"cjs"},r,!1,a),at(f,P,w,g,{...d,type:"esm"},r,!1,a)):at(f,E,w,g,d,r,!1,a)}}return{entries:f,warnings:o}},$r=e=>typeof e=="string"&&e!=="",_1=(e,t)=>{const{publishConfig:r}=e;return r&&(r.bin&&(typeof r.bin=="object"||typeof r.bin=="string")&&(e.bin=r.bin),$r(r.type)&&(e.type=r.type),$r(r.main)&&(e.main=r.main),$r(r.module)&&(e.module=r.module),t===void 0&&$r(r.types)?e.types=r.types:t===void 0&&$r(r.typings)&&(e.typings=r.typings),r.exports&&typeof r.exports=="object"&&(e.exports=r.exports)),e},Tf=/.*\/dist\/.*/,Ml=/\/$/,M1=/\.mjs$/,I1=/\.cjs$/,W1=/\.d\.[mc]?ts$/,B1=/(?<!\.d)\.js$/,D1=e=>{const t=[],r=new Set,n=o=>{if(typeof o=="string"){t.push(o);return}if(Array.isArray(o)){for(const s of o)n(s);return}if(o&&typeof o=="object")for(const[s,i]of Object.entries(o))s.startsWith(".")||r.add(s),n(i)};e.exports&&n(e.exports);for(const o of[e.main,e.module,e.types])typeof o=="string"&&t.push(o);return{conditions:r,files:t}},L1=(e,t,r)=>{if(e.options.emitESM!==void 0||e.options.emitCJS!==void 0)return;const n=e.pkg.type==="module"?"esm":"cjs",o=r.some(a=>B1.test(a));let s=r.some(a=>M1.test(a))||t.has("import")||t.has("module"),i=r.some(a=>I1.test(a))||t.has("require");(o||!s&&!i)&&n==="esm"?s=!0:(o||!s&&!i)&&(i=!0),e.options.emitESM=s,e.options.emitCJS=i},F1=(e,t,r)=>{if(e.options.declaration!==void 0)return;const n=!!e.pkg.types||t.has("types")||r.some(o=>W1.test(o));e.options.declaration=n?"node16":!1},H1=e=>{e.options.entries.length=0;const t=G(e.options.rootDir,e.options.sourceDir);if(!rt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const r=zu(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[kt,Tf]}).filter(u=>Et.test(u)&&!u.endsWith(".d.ts")),{conditions:n,files:o}=D1(e.pkg);L1(e,n,o),F1(e,n,o);const s=e.options.emitESM??!1,i=e.options.emitCJS??!1;for(const u of r){const c=u.replace(`${t}/`,"").replace(Et,"").replaceAll("\\","/");e.options.entries.push({cjs:i,declaration:e.options.declaration,esm:s,input:u,name:c})}const a=[];s&&a.push("[esm]"),i&&a.push("[cjs]"),e.options.declaration&&a.push("[dts]");const l=e.options.entries.length;e.logger.info("Unbundle mode: preserving source structure for",ne(`${String(l)} ${l===1?"entry":"entries"}`),De(a.join(" ")))},q1={hooks:{"build:prepare":async function(e){if(e.options.unbundle){H1(e);return}if(e.options.entries.length>0)return;const t=G(e.options.rootDir,e.options.sourceDir);if(!rt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const r=zu(t,{extensions:[],includeDirs:!1,includeSymlinks:!1,skip:[kt,Tf]});if(r.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");const n=e.logger;let o={...e.pkg};o.publishConfig&&(n.info(`Using publishConfig found in package.json, to override the default key-value pairs of "${Object.keys(o.publishConfig).join(", ")}".`),n.debug(o.publishConfig),o=_1(o,e.options.declaration));const s=await P1(o,r,e);for(const i of s.warnings)n.warn(i);if(e.options.entries.push(...s.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");n.info("Automatically detected entries:",ne(e.options.entries.map(i=>i.fileAlias?`${Ae(i.fileAlias)} => ${Ae(i.input.replace(`${e.options.rootDir}/`,"").replace(Ml,"/*"))}`:Ae(i.input.replace(`${e.options.rootDir}/`,"").replace(Ml,"/*"))).join(", ")),De([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(i=>`[${i}]`).join(" ")))}}},J1=Me(import.meta.url),Ut=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$a=e=>{if(typeof Ut<"u"&&Ut.versions&&Ut.versions.node){const[t,r]=Ut.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return Ut.getBuiltinModule(e)}return J1(e)},{existsSync:ns}=$a("node:fs"),{env:os,cwd:z1}=Ut,{createRequire:nn}=$a("node:module"),U1=0,ss=2,G1=Symbol("findUpStop"),Nf=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},Il=e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"},V1=nn(import.meta.url),br=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,K1=e=>{if(typeof br<"u"&&br.versions&&br.versions.node){const[t,r]=br.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return br.getBuiltinModule(e)}return V1(e)},{lstatSync:Wl,mkdirSync:Y1}=K1("node:fs"),X1=e=>{Nf(e);try{const t=Wl(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(Il(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{Y1(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const r=Wl(e);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(Il(r))}'`,{cause:t})}},Z1=/^[A-Z]:\//i,on=(e="")=>e&&e.replaceAll("\\","/").replace(Z1,t=>t.toUpperCase()),Q1=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ew=/^[A-Z]:$/i,tw=/.(\.[^./]+)$/,rw=/^[/\\]|^[a-z]:[/\\]/i,nw=/\/$/,ow=()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/",sw=(e,t)=>{let r="",n=0,o=-1,s=0,i;for(let a=0;a<=e.length;++a){if(a<e.length)i=e[a];else{if(i==="/")break;i="/"}if(i==="/"){if(!(o===a-1||s===1))if(s===2){if(r.length<2||n!==2||!r.endsWith(".")||r.at(-2)!=="."){if(r.length>2){const l=r.lastIndexOf("/");l===-1?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),o=a,s=0;continue}else if(r.length>0){r="",n=0,o=a,s=0;continue}}t&&(r+=r.length>0?"/..":"..",n=2)}else r.length>0?r+=`/${e.slice(o+1,a)}`:r=e.slice(o+1,a),n=a-o-1;o=a,s=0}else i==="."&&s!==-1?++s:s=-1}return r},Xn=e=>Q1.test(e),is=function(...e){e=e.map(n=>on(n));let t="",r=!1;for(let n=e.length-1;n>=-1&&!r;n--){const o=n>=0?e[n]:ow();!o||o.length===0||(t=`${o}/${t}`,r=Xn(o))}return t=sw(t,!r),r&&!Xn(t)?`/${t}`:t.length>0?t:"."},iw=function(e){return tw.exec(on(e))?.[1]??""},Pf=e=>{const t=on(e).replace(nw,"").split("/").slice(0,-1);return t.length===1&&ew.test(t[0])&&(t[0]=`${t[0]}/`),t.join("/")||(Xn(e)?"/":".")},aw=(e,t)=>on(e).split("/").pop(),lw=function(e){const t=rw.exec(e)?.[0]?.replaceAll("\\","/")??"",r=aw(e),n=iw(r);return{base:r,dir:Pf(e),ext:n,name:r.slice(0,r.length-n.length),root:t}},cw=nn(import.meta.url),wr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,uw=e=>{if(typeof wr<"u"&&wr.versions&&wr.versions.node){const[t,r]=wr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return wr.getBuiltinModule(e)}return cw(e)},{fileURLToPath:pw}=uw("node:url");function fw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bl,Dl;function dw(){return Dl||(Dl=1,Bl=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),Bl}var mw=dw();const hw=fw(mw);new Set(hw);const Ci=e=>on(e instanceof URL?pw(e):e),gw=nn(import.meta.url),vr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_f=e=>{if(typeof vr<"u"&&vr.versions&&vr.versions.node){const[t,r]=vr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return vr.getBuiltinModule(e)}return gw(e)};_f("node:fs/promises");_f("node:url");const yw=nn(import.meta.url),xr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Mf=e=>{if(typeof xr<"u"&&xr.versions&&xr.versions.node){const[t,r]=xr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return xr.getBuiltinModule(e)}return yw(e)},{statSync:$w,lstatSync:bw}=Mf("node:fs"),{fileURLToPath:ww}=Mf("node:url"),vw=(e,t={})=>{const r=t.cwd?Ci(t.cwd):process.cwd();let n=is(r);const{root:o}=lw(n),s=Ci(t.stopAt??o),i=is(n,s),a=t.type??"file",l=function(c){return[e]};t.allowSymlinks??=!0;const u=t.allowSymlinks?$w:bw;for(;n&&n!==i&&n!==o;){for(let c of l()){if(c===G1)return;if(c===void 0)continue;Buffer.isBuffer(c)?c=c.toString():c instanceof URL&&(c=ww(c));const p=Xn(c)?c:is(n,c);try{const f=u(p);if(a==="file"&&f.isFile()||a==="directory"&&f.isDirectory())return p}catch{}}n=Pf(n)}},xw=nn(import.meta.url),Er=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ew=e=>{if(typeof Er<"u"&&Er.versions&&Er.versions.node){const[t,r]=Er.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return Er.getBuiltinModule(e)}return xw(e)};Ew("node:fs/promises");const{accessSync:Sw}=$a("node:fs");function as(e,t=U1){Nf(e),e=Ci(e);try{return Sw(e,t),!0}catch{return!1}}let kw=class extends Error{constructor(t){super(`ENOENT: ${t}`)}get code(){return"ENOENT"}set code(t){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(t){throw new Error("Cannot overwrite name of NotFoundError")}};const jw=/^[A-Z]:\//i,If=(e="")=>e&&e.replaceAll("\\","/").replace(jw,t=>t.toUpperCase()),Aw=/^[/\\]{2}/,Ow=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Wf=/^[A-Z]:$/i,Rw=/\/$/,Cw=(e,t)=>{let r="",n=0,o=-1,s=0,i;for(let a=0;a<=e.length;++a){if(a<e.length)i=e[a];else{if(i==="/")break;i="/"}if(i==="/"){if(!(o===a-1||s===1))if(s===2){if(r.length<2||n!==2||!r.endsWith(".")||r.at(-2)!=="."){if(r.length>2){const l=r.lastIndexOf("/");l===-1?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),o=a,s=0;continue}else if(r.length>0){r="",n=0,o=a,s=0;continue}}t&&(r+=r.length>0?"/..":"..",n=2)}else r.length>0?r+=`/${e.slice(o+1,a)}`:r=e.slice(o+1,a),n=a-o-1;o=a,s=0}else i==="."&&s!==-1?++s:s=-1}return r},Ti=e=>Ow.test(e),Tw=function(e){if(e.length===0)return".";e=If(e);const t=Aw.exec(e),r=Ti(e),n=e.at(-1)==="/";return e=Cw(e,!r),e.length===0?r?"/":n?"./":".":(n&&(e+="/"),Wf.test(e)&&(e+="/"),t?r?`//${e}`:`//./${e}`:r&&!Ti(e)?`/${e}`:e)},$n=(...e)=>{let t="";for(const r of e)if(r)if(t.length>0){const n=t.at(-1)==="/",o=r[0]==="/";n&&o?t+=r.slice(1):t+=n||o?r:`/${r}`}else t+=r;return Tw(t)},Nw=e=>{const t=If(e).replace(Rw,"").split("/").slice(0,-1);return t.length===1&&Wf.test(t[0])&&(t[0]=`${t[0]}/`),t.join("/")||(Ti(e)?"/":".")},Ll=(e,t)=>(t?.create&&X1(e),e),Pw=(e,t)=>{if(os.CACHE_DIR&&!["0","1","false","true"].includes(os.CACHE_DIR))return Ll($n(os.CACHE_DIR,e),t);const r=vw("package.json",{cwd:t?.cwd??z1(),type:"file"});if(!r){if(t?.throwError)throw new kw("No such file or directory found.");return}const n=$n(Nw(r),"node_modules"),o=$n(n,".cache"),s=$n(o,e);if(!(ns(s)&&!as(s,ss))&&!(ns(o)&&!as(o,ss))&&!(ns(n)&&!as(n,ss)))return Ll(s,t)},_w=Pw,Mw=/^(?<value>-?\d+(?:[.,]\d+)*) *(?<type>[a-z]+)?$/i,Iw=/^KIBI/,Ww=/^MIBI/,Bw=/^GIBI/,Dw=/^TEBI/,Lw=/^PEBI/,Fw=/^EXBI/,Hw=/^ZEBI/,qw=/^YIBI/,Jw=/^(.)IB$/,Bf={iec:[{long:"Bytes",short:"B"},{long:"Kibibytes",short:"KiB"},{long:"Mebibytes",short:"MiB"},{long:"Gibibytes",short:"GiB"},{long:"Tebibytes",short:"TiB"},{long:"Pebibytes",short:"PiB"},{long:"Exbibytes",short:"EiB"},{long:"Zebibytes",short:"ZiB"},{long:"Yobibytes",short:"YiB"}],iec_octet:[{long:"Octets",short:"o"},{long:"Kibioctets",short:"Kio"},{long:"Mebioctets",short:"Mio"},{long:"Gibioctets",short:"Gio"},{long:"Tebioctets",short:"Tio"},{long:"Pebioctets",short:"Pio"},{long:"Exbioctets",short:"Eio"},{long:"Zebioctets",short:"Zio"},{long:"Yobioctets",short:"Yio"}],metric:[{long:"Bytes",short:"Bytes"},{long:"Kilobytes",short:"KB"},{long:"Megabytes",short:"MB"},{long:"Gigabytes",short:"GB"},{long:"Terabytes",short:"TB"},{long:"Petabytes",short:"PB"},{long:"Exabytes",short:"EB"},{long:"Zettabytes",short:"ZB"},{long:"Yottabytes",short:"YB"}],metric_octet:[{long:"Octets",short:"o"},{long:"Kilo-octets",short:"ko"},{long:"Mega-octets",short:"Mo"},{long:"Giga-octets",short:"Go"},{long:"Tera-octets",short:"To"},{long:"Peta-octets",short:"Po"},{long:"Exa-octets",short:"Eo"},{long:"Zetta-octets",short:"Zo"},{long:"Yotta-octets",short:"Yo"}]},zw=(e,t)=>{const r=new Intl.NumberFormat(t).format(11111).replaceAll(new RegExp("\\p{Number}","gu"),""),n=new Intl.NumberFormat(t).format(1.1).replaceAll(new RegExp("\\p{Number}","gu"),"");return Number.parseFloat(e.replaceAll(new RegExp(`\\${r}`,"g"),"").replace(new RegExp(`\\${n}`),"."))},Df=e=>{switch(e){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},Uw=(e,t)=>{const r={base:2,locale:"en-US",units:"metric",...t};if(typeof e!="string"||e.length===0)throw new TypeError("Value is not a string or is empty.");if(e.length>100)throw new TypeError("Value exceeds the maximum length of 100 characters.");const n=Mw.exec(e)?.groups;if(!n)return Number.NaN;const o=zw(n.value,r.locale),s=(n.type??"Bytes").toUpperCase().replace(Iw,"KILO").replace(Ww,"MEGA").replace(Bw,"GIGA").replace(Dw,"TERA").replace(Lw,"PETA").replace(Fw,"EXA").replace(Hw,"ZETTA").replace(qw,"YOTTA").replace(Jw,"$1B"),i=Bf[r.units].findIndex(l=>l.short[0].toUpperCase()===s[0]),a=Df(r.base);return o*a**i},je=(e,t)=>{if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("Bytesize is not a number.");const{base:r,decimals:n,locale:o,long:s,unit:i,units:a,...l}={base:2,decimals:0,locale:"en-US",long:!1,units:"metric",...t},u=Df(r),c=Math.abs(e),p=t?.space??!0?" ":"",f=Bf[a],d=f.findIndex(g=>g.short===i);if(e===0){const g=Math.min(0,Math.max(d,f.length-1));return"0"+p+f[g][s?"long":"short"]}const m=d===-1?Math.min(Math.floor(Math.log(c)/Math.log(u)),f.length-1):d,h=f[m][s?"long":"short"],$=e/u**m,y=n<0?void 0:n;return new Intl.NumberFormat(o,{maximumFractionDigits:y,minimumFractionDigits:y,...l}).format($)+p+h},Gw=(e,t,r,n,o,s,i,a,l,u,c,p,f,d)=>{const m={d:n,h:o,m:s,mo:t,ms:a,s:i,w:r,y:e};return m.future=l,m.past=u,m.decimal=c,p!==void 0&&(m.unitMap=p),m.groupSeparator=f,m.placeholderSeparator=d,m},Vw={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Kw=Gw(e=>`year${e===1?"":"s"}`,e=>`month${e===1?"":"s"}`,e=>`week${e===1?"":"s"}`,e=>`day${e===1?"":"s"}`,e=>`hour${e===1?"":"s"}`,e=>`minute${e===1?"":"s"}`,e=>`second${e===1?"":"s"}`,e=>`millisecond${e===1?"":"s"}`,"in %s","%s ago",".",Vw,",","_"),Yw=e=>{const t=["y","mo","w","d","h","m","s","ms","future","past"];for(const n of t)if(!Object.hasOwn(e,n))throw new TypeError(`Missing required property: ${n}`);if(typeof e.future!="string"||typeof e.past!="string")throw new TypeError("Properties future and past must be of type string");const r=["y","mo","w","d","h","m","s","ms"];for(const n of r)if(typeof e[n]!="string"&&typeof e[n]!="function")throw new TypeError(`Property ${n} must be of type string or function`);if(e.decimal&&typeof e.decimal!="string")throw new TypeError("Property decimal must be of type string");if(e.delimiter&&typeof e.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(e._digitReplacements&&!Array.isArray(e._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(e._numberFirst&&typeof e._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(e.unitMap&&typeof e.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(e.unitMap&&Object.values(e.unitMap).some(n=>typeof n!="string"))throw new TypeError("All values in unitMap must be of type string")},Lf=(e,t)=>{t=t||-1;const r=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(t)}})?`).exec(e.toString());return r===null?e:Number.parseFloat(r[0])},Fl=({unitCount:e,unitName:t},r,n)=>{let{spacer:o}=n;const{maxDecimalPoints:s}=n;let i=".";n.decimal!==void 0?i=n.decimal:r.decimal!==void 0&&(i=r.decimal);let a;"digitReplacements"in n?a=n.digitReplacements:"_digitReplacements"in r&&(a=r._digitReplacements);let l,u=e;s!==void 0&&(u=Lf(e,s));const c=u.toString();if(!r._hideCountIf2||e!==2)if(a){l="";for(const d of c)l+=d==="."?i:a[d]}else l=c.replace(".",i);else l="";const p=r[t];let f=p;return typeof p=="function"&&(f=p(e)),r._hideCountIf2&&e===2&&(o=""),r._numberFirst?f+o+l:l+o+f},Xw=(e,t)=>{const{units:r}=t;if(r.length===0)return[];const{unitMeasures:n}=t,o=t.largest??Number.POSITIVE_INFINITY,s={};let i,a,l,u=e;for(a=0;a<r.length;a++){i=r[a];const p=n[i];l=a===r.length-1?u/p:Math.floor(u/p),s[i]=l,u-=l*p}if(t.round){let p=o;for(a=0;a<r.length;a++)if(i=r[a],l=s[i],l!==0&&(p--,p===0)){for(let f=a+1;f<r.length;f++){const d=r[f],m=s[d];s[i]=(s[i]??0)+m*n[d]/n[i],s[d]=0}break}for(a=r.length-1;a>=0;a--){if(i=r[a],l=s[i],l===0)continue;const f=Math.round(l);if(s[i]=f,a===0)break;const d=r[a-1],m=n[d],h=Math.floor(f*n[i]/m);if(h)s[d]=(s[d]??0)+h,s[i]=0;else break}}const c=[];for(a=0;a<r.length&&c.length<o;a++){if(i=r[a],l=s[i],l&&!t.round&&c.length===o-1){let p,f=0;for(p=a+1,r.length;p<r.length;p++){const d=r[p];f+=s[d]*(t.unitMeasures[d]/t.unitMeasures[i])}l+=f,t.maxDecimalPoints!==void 0&&(l=Lf(l,t.maxDecimalPoints))}l&&c.push({unitCount:l,unitName:i})}return c},Zw=(e,t,r)=>{const{language:n,units:o}=t;if(e.length===0){const p=o.at(-1);return Fl({unitCount:0,unitName:p},n,t)}const{conjunction:s,serialComma:i}=t;let a=", ";t.delimiter!==void 0?a=t.delimiter:n.delimiter!==void 0&&(a=n.delimiter);let l="";t.timeAdverb&&r!==0&&(l=n.future??"",r<0&&(l=n.past??""));const u=e.map(p=>Fl(p,n,t));let c;return!s||e.length===1?c=u.join(a):e.length===2?c=u.join(s):c=u.slice(0,-1).join(a)+(i?",":"")+s+(u.at(-1)??""),l&&(c=l.replace("%s",c)),c},Hl=(e,t)=>{if(Number.isNaN(e))throw new TypeError("Expected a valid number");if(typeof e!="number")throw new TypeError("Expected a number for milliseconds input");const r={conjunction:"",language:Kw,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...t};Yw(r.language);const n=Math.abs(e),o=Xw(n,r);return Zw(o,r,e)};var Qw=Object.defineProperty,Ff=(e,t)=>Qw(e,"name",{value:t,configurable:!0});const ev=Me(import.meta.url),Sr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Hf=Ff(e=>{if(typeof Sr<"u"&&Sr.versions&&Sr.versions.node){const[t,r]=Sr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return Sr.getBuiltinModule(e)}return ev(e)},"__cjs_getBuiltinModule"),{execSync:tv}=Hf("node:child_process"),{existsSync:ql,readFileSync:rv}=Hf("node:fs");var nv=Object.defineProperty,Xe=Ff((e,t)=>nv(e,"name",{value:t,configurable:!0}),"r");const ba=["yarn.lock","package-lock.json","pnpm-lock.yaml","npm-shrinkwrap.json","bun.lockb"],qf=Xe(e=>{let t;if(ba.forEach(n=>{!t&&ql(G(e,n))&&(t=G(e,n))}),t)return t;const r=G(e,"package.json");if(ql(r)&&ga(rv(r,"utf8")).packageManager!==void 0)return r},"packageMangerFindUpMatcher"),Jf=Xe(e=>{if(!e)throw new Mt("Could not find a package manager");if(e.endsWith("package.json")){const t=ga(e);if(t.packageManager){const r=["npm","yarn","pnpm","bun"].find(n=>t.packageManager.startsWith(n));if(r)return{packageManager:r,path:Z(e)}}}if(e.endsWith("yarn.lock"))return{packageManager:"yarn",path:Z(e)};if(e.endsWith("package-lock.json")||e.endsWith("npm-shrinkwrap.json"))return{packageManager:"npm",path:Z(e)};if(e.endsWith("pnpm-lock.yaml"))return{packageManager:"pnpm",path:Z(e)};if(e.endsWith("bun.lockb"))return{packageManager:"bun",path:Z(e)};throw new Mt("Could not find a package manager")},"resolvePackageManagerFromFile"),ov=Xe(async e=>{const t=await ft(ba,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find lock file");return t},"findLockFile"),sv=Xe(e=>{const t=dt(ba,{type:"file",...e&&{cwd:e}});if(!t)throw new Error("Could not find lock file");return t},"findLockFileSync"),iv=Xe(async e=>{const t=await ft(qf,{...e&&{cwd:e}});return Jf(t)},"findPackageManager"),zf=Xe(e=>{const t=dt(qf,{...e&&{cwd:e}});return Jf(t)},"findPackageManagerSync");Xe(e=>tv(`${e} --version`).toString("utf8").trim(),"getPackageManagerVersion");Xe(()=>{if(!process.env.npm_config_user_agent)return;const e=process.env.npm_config_user_agent.split(" ")[0],t=e.lastIndexOf("/"),r=e.slice(0,Math.max(0,t));return{name:r==="npminstall"?"cnpm":r,version:e.slice(Math.max(0,t+1))}},"identifyInitiatingPackageManager");Xe((e,t,r)=>{const n=t.length===1?"":"s";if(r.packageManagers??=["npm","pnpm","yarn"],r.packageManagers.length===0)throw new Error("No package managers provided, please provide at least one package manager");if(t.length===0)throw new Error("No missing packages provided, please provide at least one missing package");let o=`
|
|
@@ -147,7 +147,7 @@ ${k.map(([J,N])=>` ${J===N?N:`${J}: ${N}`}`).join(`,
|
|
|
147
147
|
|
|
148
148
|
`,b=d.toString();if(b[0]==="#"){const v=b.indexOf(`
|
|
149
149
|
`)+1;d.appendLeft(v,w)}else d.prepend(w)}const y=new Se(Dk(d.toString()));return{code:y.toString(),map:y.generateMap()}},order:i}}},"requireCJSTransformerPlugin");var Hk=44,Gc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qk=new Uint8Array(64),Rd=new Uint8Array(128);for(let e=0;e<Gc.length;e++){const t=Gc.charCodeAt(e);qk[e]=t,Rd[t]=e}function Or(e,t){let r=0,n=0,o=0;do{const i=e.next();o=Rd[i],r|=(o&31)<<n,n+=5}while(o&32);const s=r&1;return r>>>=1,s&&(r=-2147483648|-r),t+r}function Vc(e,t){return e.pos>=t?!1:e.peek()!==Hk}typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u";var Jk=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){const{buffer:t,pos:r}=this,n=t.indexOf(e,r);return n===-1?t.length:n}};function zk(e){const{length:t}=e,r=new Jk(e),n=[];let o=0,s=0,i=0,a=0,l=0;do{const u=r.indexOf(";"),c=[];let p=!0,f=0;for(o=0;r.pos<u;){let d;o=Or(r,o),o<f&&(p=!1),f=o,Vc(r,u)?(s=Or(r,s),i=Or(r,i),a=Or(r,a),Vc(r,u)?(l=Or(r,l),d=[o,s,i,a,l]):d=[o,s,i,a]):d=[o],c.push(d),r.pos++}p||Uk(c),n.push(c),r.pos=u+1}while(r.pos<=t);return n}function Uk(e){e.sort(Gk)}function Gk(e,t){return e[0]-t[0]}var Bn={exports:{}},Vk=Bn.exports,Kc;function Kk(){return Kc||(Kc=1,(function(e,t){(function(r,n){e.exports=n()})(Vk,(function(){const r=/^[\w+.-]+:\/\//,n=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,o=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function s(g){return r.test(g)}function i(g){return g.startsWith("//")}function a(g){return g.startsWith("/")}function l(g){return g.startsWith("file:")}function u(g){return/^[.?#]/.test(g)}function c(g){const w=n.exec(g);return f(w[1],w[2]||"",w[3],w[4]||"",w[5]||"/",w[6]||"",w[7]||"")}function p(g){const w=o.exec(g),b=w[2];return f("file:","",w[1]||"","",a(b)?b:"/"+b,w[3]||"",w[4]||"")}function f(g,w,b,v,S,x,E){return{scheme:g,user:w,host:b,port:v,path:S,query:x,hash:E,type:7}}function d(g){if(i(g)){const b=c("http:"+g);return b.scheme="",b.type=6,b}if(a(g)){const b=c("http://foo.com"+g);return b.scheme="",b.host="",b.type=5,b}if(l(g))return p(g);if(s(g))return c(g);const w=c("http://foo.com/"+g);return w.scheme="",w.host="",w.type=g?g.startsWith("?")?3:g.startsWith("#")?2:4:1,w}function m(g){if(g.endsWith("/.."))return g;const w=g.lastIndexOf("/");return g.slice(0,w+1)}function h(g,w){$(w,w.type),g.path==="/"?g.path=w.path:g.path=m(w.path)+g.path}function $(g,w){const b=w<=4,v=g.path.split("/");let S=1,x=0,E=!1;for(let k=1;k<v.length;k++){const R=v[k];if(!R){E=!0;continue}if(E=!1,R!=="."){if(R===".."){x?(E=!0,x--,S--):b&&(v[S++]=R);continue}v[S++]=R,x++}}let j="";for(let k=1;k<S;k++)j+="/"+v[k];(!j||E&&!j.endsWith("/.."))&&(j+="/"),g.path=j}function y(g,w){if(!g&&!w)return"";const b=d(g);let v=b.type;if(w&&v!==7){const x=d(w),E=x.type;switch(v){case 1:b.hash=x.hash;case 2:b.query=x.query;case 3:case 4:h(b,x);case 5:b.user=x.user,b.host=x.host,b.port=x.port;case 6:b.scheme=x.scheme}E>v&&(v=E)}$(b,v);const S=b.query+b.hash;switch(v){case 2:case 3:return S;case 4:{const x=b.path.slice(1);return x?u(w||g)&&!u(x)?"./"+x+S:x+S:S||"."}case 5:return b.path+S;default:return b.scheme+"//"+b.user+b.host+b.port+b.path+S}}return y}))})(Bn)),Bn.exports}var Yk=Kk();const Xk=Zr(Yk);function Zk(e){if(!e)return"";const t=e.lastIndexOf("/");return e.slice(0,t+1)}function Qk(e,t){const r=Zk(e),n=t?t+"/":"";return o=>Xk(n+(o||""),r)}var Kr=0,ej=1,tj=2,rj=3,nj=4;function oj(e,t){const r=Yc(e,0);if(r===e.length)return e;t||(e=e.slice());for(let n=r;n<e.length;n=Yc(e,n+1))e[n]=ij(e[n],t);return e}function Yc(e,t){for(let r=t;r<e.length;r++)if(!sj(e[r]))return r;return e.length}function sj(e){for(let t=1;t<e.length;t++)if(e[t][Kr]<e[t-1][Kr])return!1;return!0}function ij(e,t){return t||(e=e.slice()),e.sort(aj)}function aj(e,t){return e[Kr]-t[Kr]}function lj(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function Ja(e){return typeof e=="string"?JSON.parse(e):e}var cj=function(e,t){const r=Ja(e);if(!("sections"in r))return new za(r,t);const n=[],o=[],s=[],i=[],a=[];Cd(r,t,n,o,s,i,a,0,0,1/0,1/0);const l={version:3,file:r.file,names:i,sources:o,sourcesContent:s,mappings:n,ignoreList:a};return dj(l)};function Cd(e,t,r,n,o,s,i,a,l,u,c){const{sections:p}=e;for(let f=0;f<p.length;f++){const{map:d,offset:m}=p[f];let h=u,$=c;if(f+1<p.length){const y=p[f+1].offset;h=Math.min(u,a+y.line),h===u?$=Math.min(c,l+y.column):h<u&&($=l+y.column)}uj(d,t,r,n,o,s,i,a+m.line,l+m.column,h,$)}}function uj(e,t,r,n,o,s,i,a,l,u,c){const p=Ja(e);if("sections"in p)return Cd(...arguments);const f=new za(p,t),d=n.length,m=s.length,h=fj(f),{resolvedSources:$,sourcesContent:y,ignoreList:g}=f;if(Qs(n,$),Qs(s,f.names),y)Qs(o,y);else for(let w=0;w<$.length;w++)o.push(null);if(g)for(let w=0;w<g.length;w++)i.push(g[w]+d);for(let w=0;w<h.length;w++){const b=a+w;if(b>u)return;const v=pj(r,b),S=w===0?l:0,x=h[w];for(let E=0;E<x.length;E++){const j=x[E],k=S+j[Kr];if(b===u&&k>=c)return;if(j.length===1){v.push([k]);continue}const R=d+j[ej],P=j[tj],z=j[rj];v.push(j.length===4?[k,R,P,z]:[k,R,P,z,m+j[nj]])}}}function Qs(e,t){for(let r=0;r<t.length;r++)e.push(t[r])}function pj(e,t){for(let r=e.length;r<=t;r++)e[r]=[];return e[t]}var za=class{constructor(t,r){const n=typeof t=="string";if(!n&&t._decodedMemo)return t;const o=Ja(t),{version:s,file:i,names:a,sourceRoot:l,sources:u,sourcesContent:c}=o;this.version=s,this.file=i,this.names=a||[],this.sourceRoot=l,this.sources=u,this.sourcesContent=c,this.ignoreList=o.ignoreList||o.x_google_ignoreList||void 0;const p=Qk(r,l);this.resolvedSources=u.map(p);const{mappings:f}=o;if(typeof f=="string")this._encoded=f,this._decoded=void 0;else if(Array.isArray(f))this._encoded=void 0,this._decoded=oj(f,n);else throw o.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(o)}`);this._decodedMemo=lj(),this._bySources=void 0,this._bySourceMemos=void 0}};function fj(e){var t;return(t=e)._decoded||(t._decoded=zk(e._encoded))}function dj(e,t){const r=new za(mj(e,[]),t);return r._decoded=e.mappings,r}function mj(e,t){return{version:e.version,file:e.file,names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,mappings:t,ignoreList:e.ignoreList||e.x_google_ignoreList}}var hj=Object.defineProperty,Td=(e,t)=>hj(e,"name",{value:t,configurable:!0});const gj=Me(import.meta.url),Rr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Nd=Td(e=>{if(typeof Rr<"u"&&Rr.versions&&Rr.versions.node){const[t,r]=Rr.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return Rr.getBuiltinModule(e)}return gj(e)},"__cjs_getBuiltinModule"),{readFileSync:Xc}=Nd("node:fs"),{resolve:yj,toNamespacedPath:ei,dirname:$j}=Nd("node:path");var bj=Object.defineProperty,cn=Td((e,t)=>bj(e,"name",{value:t,configurable:!0}),"s");const wj=/^data:application\/json[^,]+base64,/,vj=/\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+)[ \t]*$|\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*\*\/[ \t]*$/,xj=/\r?\n/,Pd=cn(e=>wj.test(e),"isInlineMap"),ti=cn((e,t)=>{const r=e instanceof Error?e.message:String(e),n=`${t}:
|
|
150
|
-
${r}`;throw new Error(n)},"enhanceError"),Ej=cn((e,t)=>{const r=e.split(xj);let n;for(let s=r.length-1;s>=0&&!n;s--)n=vj.exec(r[s])??void 0;if(!n)return;const o=n[1]??n[2];if(o)return Pd(o)?o:yj(t,o)},"resolveSourceMapUrl"),Sj=cn(e=>{const t=e.slice(e.indexOf(",")+1);return Buffer.from(t,"base64").toString()},"decodeInlineMap"),kj=cn(e=>{let t;try{t=Xc(e,{encoding:"utf8"})}catch(o){ti(o,`Error reading sourcemap for file "${ei(e)}"`)}const r=Ej(t,$j(e));if(!r)return;let n;if(Pd(r))n=Sj(r);else try{n=Xc(r,{encoding:"utf8"})}catch(o){ti(o,`Error reading sourcemap for file "${ei(e)}"`)}try{return new cj(n,r)}catch(o){ti(o,`Error parsing sourcemap for file "${ei(e)}"`)}},"loadSourceMap");var jj=Object.defineProperty,Aj=(e,t)=>jj(e,"name",{value:t,configurable:!0}),Oj=Object.defineProperty,Rj=Aj((e,t)=>Oj(e,"name",{value:t,configurable:!0}),"s");const Cj=/\?[^?]*$/,Tj=Rj(({exclude:e,include:t}={})=>{const r=Ze(t,e);return{async load(n){if(!r(n))return;let o;try{o=await Nt(n,{buffer:!1}),this.addWatchFile(n)}catch(i){try{const a=n.replace(Cj,"");o=await Nt(a,{buffer:!1}),this.addWatchFile(a)}catch{this.warn(`Failed reading file "${n}": ${i instanceof Error?i.message:String(i)}`);return}}if(!o.includes("sourceMappingURL"))return o;let s;try{const i=kj(n);if(i===void 0)return o;s=i}catch(i){return this.warn(`Failed resolving source map for "${n}": ${i instanceof Error?i.message:String(i)}`),{code:o}}return{code:o,map:s}},name:"packem:sourcemaps"}},"sourcemapsPlugin");var Nj=Object.defineProperty,Pj=(e,t)=>Nj(e,"name",{value:t,configurable:!0}),_j=Object.defineProperty,_d=Pj((e,t)=>_j(e,"name",{value:t,configurable:!0}),"
|
|
150
|
+
${r}`;throw new Error(n)},"enhanceError"),Ej=cn((e,t)=>{const r=e.split(xj);let n;for(let s=r.length-1;s>=0&&!n;s--)n=vj.exec(r[s])??void 0;if(!n)return;const o=n[1]??n[2];if(o)return Pd(o)?o:yj(t,o)},"resolveSourceMapUrl"),Sj=cn(e=>{const t=e.slice(e.indexOf(",")+1);return Buffer.from(t,"base64").toString()},"decodeInlineMap"),kj=cn(e=>{let t;try{t=Xc(e,{encoding:"utf8"})}catch(o){ti(o,`Error reading sourcemap for file "${ei(e)}"`)}const r=Ej(t,$j(e));if(!r)return;let n;if(Pd(r))n=Sj(r);else try{n=Xc(r,{encoding:"utf8"})}catch(o){ti(o,`Error reading sourcemap for file "${ei(e)}"`)}try{return new cj(n,r)}catch(o){ti(o,`Error parsing sourcemap for file "${ei(e)}"`)}},"loadSourceMap");var jj=Object.defineProperty,Aj=(e,t)=>jj(e,"name",{value:t,configurable:!0}),Oj=Object.defineProperty,Rj=Aj((e,t)=>Oj(e,"name",{value:t,configurable:!0}),"s");const Cj=/\?[^?]*$/,Tj=Rj(({exclude:e,include:t}={})=>{const r=Ze(t,e);return{async load(n){if(!r(n))return;let o;try{o=await Nt(n,{buffer:!1}),this.addWatchFile(n)}catch(i){try{const a=n.replace(Cj,"");o=await Nt(a,{buffer:!1}),this.addWatchFile(a)}catch{this.warn(`Failed reading file "${n}": ${i instanceof Error?i.message:String(i)}`);return}}if(!o.includes("sourceMappingURL"))return o;let s;try{const i=kj(n);if(i===void 0)return o;s=i}catch(i){return this.warn(`Failed resolving source map for "${n}": ${i instanceof Error?i.message:String(i)}`),{code:o}}return{code:o,map:s}},name:"packem:sourcemaps"}},"sourcemapsPlugin");var Nj=Object.defineProperty,Pj=(e,t)=>Nj(e,"name",{value:t,configurable:!0}),_j=Object.defineProperty,_d=Pj((e,t)=>_j(e,"name",{value:t,configurable:!0}),"d");const Mj=_d(async(e,t)=>{await new Promise((r,n)=>{const o=Zi(e),s=wh(t);o.on("error",i=>{s.destroy(),n(i)}),s.on("error",i=>{o.destroy(),n(i)}),s.on("finish",()=>{r(void 0)}),o.pipe(s)})},"copy"),Ij=_d(({destDir:e,emitFiles:t,exclude:r,fileName:n,include:o,limit:s,publicPath:i,sourceDir:a})=>{const l=Ze(o,r),u={};return{async generateBundle(c){if(!t)return;const p=e??c.dir??Z(c.file??"");await yi(p),await Promise.all(Object.keys(u).map(async f=>{const d=u[f],m=G(p,Z(d));await yi(m),await Mj(f,G(p,d))}))},async load(c){if(!l(c))return;this.addWatchFile(c);const[p,f]=await Promise.all([Qr(c),Jn(c)]);let d;if(s&&p.size>s||s===0){const m=Fh.createHash("sha1").update(f).digest("hex").slice(0,16),h=tr(c),$=Fe(c,h),y=a?ke(a,Z(c)):Fe(Z(c)),g=n.replaceAll("[hash]",m).replaceAll("[extname]",h).replaceAll("[dirname]",y===""?"":`${y}/`).replaceAll("[name]",$);d=G(i??"",g),u[c]=g}else{const m=hp.getType(c);if(m===null)throw new Error(`Could not determine mimetype for ${c}`);d=m==="image/svg+xml"?dh(f):f.toString("base64"),d=`data:${m};base64,${d}`}return`export default ${JSON.stringify(d)}`},name:"packem:url"}},"urlPlugin"),un=(e,t={},r={})=>({...t,...e,values:e.values?{...e.values}:{...r}}),Yr=e=>!!e?.endsWith(".d"),so=(e,t)=>{if(e!==void 0)return typeof e=="string"||typeof e=="function"?t==="js"?e:void 0:e[t]},te=e=>e.logger,Wj=/Circular dependency:[\s\S]*node_modules/,Bj=/\.mts$/,Dj=/\.(?:m|c)?(?:j|t)sx?$/,Lj=/^['|"](use (\w+))['|"]$/,Md=/\.(?:[cm]?jsx?|[cm]?tsx?|json)$/,Fj=e=>e instanceof RegExp?e.source:e,Id=e=>{if(typeof e=="boolean")return String(e);const t=[];for(const r of e)t.push(Fj(r));return t.toSorted((r,n)=>r.localeCompare(n)).join(",")},Zc=(e,t)=>t?r=>{if(!Yr(r.name))return`${r.name}.${e()}`}:r=>{if(!Yr(r.name))return Br(r,e())},Qc=(e,t)=>t?r=>{const{name:n}=r;if(!Yr(n))return`${n??"[name]"}.${e(r)}`}:r=>{const{name:n}=r;if(!Yr(n))return mh(r,e(r))},Wd=e=>{const t=`node${Fn.node.split(".")[0]}`;if(!e.pkg.engines?.node)return t;const r=Le.minVersion(e.pkg.engines.node);return r?`node${String(r.major)}`:t},Bd=(e,t,r)=>{const n=e.options.browserTargets&&e.options.browserTargets.length>0?e.options.browserTargets:e.options.resolvedBrowserTargets??e.options.browserTargets??[];if(t){const o=ih(t);return e.options.runtime==="node"?[...new Set([r,...o])]:e.options.runtime==="browser"?[...new Set([...ol(n),...o])]:o}return e.options.runtime==="node"?[r]:ol(n)},Hj=(e,t)=>{if(!e.options.rollup.esbuild)throw new Error("No esbuild options found in your configuration.");const r=e.tsconfig?.config.compilerOptions?.target?.toLowerCase()==="es3";r&&te(e).warn(["ES3 target is not supported by esbuild, so ES5 will be used instead..","Please set 'target' option in tsconfig to at least ES5 to disable this error"].join(" "));const n=r?"es5":Bd(e,e.options.rollup.esbuild.target,t);let o=e.options.rollup.esbuild.keepNames;return e.options.minify||(o=!1,te(e).debug("Disabling keepNames because minify is disabled")),(r||e.tsconfig?.config.compilerOptions?.target==="es5")&&(o=!1,te(e).debug("Disabling keepNames because target is set to es5")),{logger:te(e),minify:e.options.minify,minifyWhitespace:e.options.minify,sourceMap:e.options.sourcemap,...e.options.rollup.esbuild,keepNames:o,target:n}},qj=e=>{if(!e.options.rollup.swc)throw new Error("No swc options found in your configuration.");return{minify:e.options.minify,...e.options.rollup.swc,jsc:{minify:{compress:{directives:!1,passes:2},format:{comments:"some"},mangle:{topLevel:!0},sourceMap:e.options.sourcemap,toplevel:e.options.emitCJS??e.options.emitESM},...e.options.rollup.swc.jsc},sourceMaps:e.options.sourcemap}},Dd=(e,t)=>{if(!e.options.rollup.oxc)throw new Error("No oxc options found in your configuration.");const{jsx:r}=e.options.rollup.oxc;let n;return typeof r=="string"?n=r:r?n={...r,refresh:!1}:n=void 0,e.options.rollup.oxc={...e.options.rollup.oxc,cwd:e.options.rootDir,jsx:n,sourcemap:e.options.sourcemap,typescript:e.tsconfig?.config?{allowDeclareFields:!0,allowNamespaces:!0,declaration:void 0,jsxPragma:e.tsconfig.config.compilerOptions?.jsxFactory,jsxPragmaFrag:e.tsconfig.config.compilerOptions?.jsxFragmentFactory,onlyRemoveTypeImports:!0,rewriteImportExtensions:!1}:void 0},e.options.rollup.oxc.target=Bd(e,e.options.rollup.oxc.target,t),e.options.rollup.oxc},Jj=(e,t,r)=>{if(r)return"js";if(t.facadeModuleId?.endsWith(".mts")){const n=t.facadeModuleId.replace(Bj,".cts");if(Xi(n))return"mjs"}return!e.options.emitCJS&&e.options.emitESM&&e.pkg.main?.endsWith(".cjs")?"mjs":Pe(e,"esm")},zj=(e,t)=>{const r=Wd(t);if(e==="esbuild")return Hj(t,r);if(e==="swc")return qj(t);if(e==="sucrase"){if(!t.options.rollup.sucrase)throw new Error("No sucrase options found in your configuration.");return t.options.rollup.sucrase}if(e==="oxc")return Dd(t,r);throw new Error("A Unknown transformer was provided")},Uj=e=>{const{browser:t,exportConditions:r}=e,n={...e};delete n.allowExportsFolderMapping,delete n.browser,delete n.exportConditions,delete n.preferBuiltins,delete n.unresolvedImportBehavior;const o=new Set(Array.isArray(n.conditionNames)?n.conditionNames:[]);return Array.isArray(r)&&(n.conditionNames=[...new Set([...r,...o])]),t&&(n.conditionNames=[...new Set(["browser",...n.conditionNames??[]])],n.aliasFields=[["browser"],...n.aliasFields??[]]),n},Ua=e=>{const{resolve:t}=e.options.rollup;if(t)return Um(Uj(t),e.options.rootDir,te(e),e.tsconfig?.path)},Ga=(e,t)=>{if(e.code==="CIRCULAR_DEPENDENCY"&&Wj.test(e.message))return!0;if(e.code==="UNRESOLVED_IMPORT"){const{resolve:r}=t.options.rollup;if(r&&r.unresolvedImportBehavior==="warn")return!1;const n=new Error(`Failed to resolve the module "${e.exporter??""}" imported by "${ne(ke(X(),e.id??""))}"
|
|
151
151
|
Is the module installed? Note:
|
|
152
152
|
↳ to inline a module into your bundle, install it to "devDependencies".
|
|
153
153
|
↳ to depend on a module via import/require, install it to "dependencies".`);throw n.id=e.id,n}return e.code==="MODULE_LEVEL_DIRECTIVE"?!0:e.code==="MIXED_EXPORTS"&&(t.options.cjsInterop??!1)},Ld=e=>{const t={};for(const r of e.options.entries){if(r.name===void 0)continue;const{name:n}=r,o=X(e.options.rootDir,r.input);if(t[n]!==void 0&&t[n]!==o)throw new Error(`Duplicate rollup input name "${n}" — one maps to "${t[n]}", another to "${o}". Each entry must have a unique name.`);t[n]=o}return t},Gj=e=>e.stack?`${e.message}
|
|
@@ -196,7 +196,7 @@ ${w.join(`
|
|
|
196
196
|
${n}`)}r.declaration&&t.warn("Generating .d.ts files with the `exe` option is not recommended since they won't be included in the executable. Consider separating your library and executable targets if you need type declarations."),t.info("`exe` option is experimental and may change in future releases.")},u3=(e,t)=>e.endsWith(".cjs")?"commonjs":e.endsWith(".mjs")||t==="module"?"module":"commonjs",Du=er==="win32"?"win":er,Lu=(e,t,r,n,o)=>{let s;return e.fileName?s=typeof e.fileName=="function"?e.fileName(t):e.fileName:s=Fe(r,tr(r)),o&&(s+=o),n==="win"&&(s+=".exe"),s},Fu=async(e,t,r,n,o,s,i)=>{const{logger:a,options:l,packageType:u}=e,c=X(l.rootDir,t.outDir??"build");await pp(c,{recursive:!0});const p=G(c,o);Kt("Building SEA executable: %s -> %s",n,p);const f=performance.now(),d=await up(G(mp(),"packem-sea-"));try{const h={disableExperimentalSEAWarning:!0,...t.seaConfig,main:n,mainFormat:u3(r.path,u),output:p};i&&(h.executable=i);const $=G(d,"sea-config.json");await fp($,JSON.stringify(h)),Kt("Wrote sea-config.json: %O -> %s",h,$),Kt("Running: %s --build-sea %s",process.execPath,$),await qn(process.execPath,["--build-sea",$],{nodeOptions:{stdio:["ignore","ignore","inherit"]},throwOnError:!0})}finally{Kt.enabled?Kt("Preserving temp directory for debugging: %s",d):await $o(d,{force:!0,recursive:!0})}if(s==="darwin")try{await qn("codesign",["--sign","-",p],{nodeOptions:{stdio:"inherit"},throwOnError:!0})}catch{const h=er==="darwin"?`You can sign it manually using:
|
|
197
197
|
codesign --sign - "${p}"`:`Automatic code signing is not supported on ${er}.`;a.warn(`Failed to code-sign the executable. ${h}`)}if(await Ct(p)){const h=await Qr(p),$=je(h.size,{decimals:2});a.info(`${Ae(ke(l.rootDir,p))} ${Gu($)}`)}const m=Math.round(performance.now()-f);a.success(`Built executable: ${qt(ke(l.rootDir,p))} ${De(`(${String(m)}ms)`)}`)},p3=async e=>{const t=l3(e),{buildEntries:r,logger:n,options:o}=t,s=o.exe;if(!s)return;const i=typeof s=="object"?s:{};c3(t);const a=r.filter(p=>p.type==="entry"&&!a3.test(p.path));if(a.length===0)throw new Error("The `exe` feature requires a built entry, but no entry chunks were found.");if(a.length>1){const p=a.map(f=>`- ${f.path}`).join(`
|
|
198
198
|
`);throw new Error(`The \`exe\` feature only supports single-chunk outputs. Found ${String(a.length)} chunks:
|
|
199
|
-
${p}`)}const l=a[0],u=G(o.rootDir,o.outDir,l.path);Kt("Building executable with SEA for chunk: %s",l.path);const{targets:c}=i;if(c!==void 0&&c.length>0){i.seaConfig?.executable&&n.warn("`seaConfig.executable` is ignored when `targets` is specified.");for(const p of c){const f=await i3(p,n),d=r3(p),m=Lu(i,l,u,p.platform,d);await Fu(t,i,l,u,m,p.platform,f)}}else{const p=Lu(i,l,u,Du);await Fu(t,i,l,u,p,Du)}},f3=async(e,t)=>{if(e.length===0)return[];const r=t<=0||!Number.isFinite(t)?1/0:t,n=Array.from({length:e.length});let o=0;const s=async()=>{for(;o<e.length;){const a=o;o+=1;const l=e[a];l&&(n[a]=await l())}},i=Array.from({length:Math.min(r,e.length)},()=>s());return await Promise.all(i),n},d3=async e=>await new Promise((t,r)=>{let n=0;const o=Zi(e).pipe(rg({params:{[ng.BROTLI_PARAM_QUALITY]:4}}));o.on("error",r),
|
|
199
|
+
${p}`)}const l=a[0],u=G(o.rootDir,o.outDir,l.path);Kt("Building executable with SEA for chunk: %s",l.path);const{targets:c}=i;if(c!==void 0&&c.length>0){i.seaConfig?.executable&&n.warn("`seaConfig.executable` is ignored when `targets` is specified.");for(const p of c){const f=await i3(p,n),d=r3(p),m=Lu(i,l,u,p.platform,d);await Fu(t,i,l,u,m,p.platform,f)}}else{const p=Lu(i,l,u,Du);await Fu(t,i,l,u,p,Du)}},f3=async(e,t)=>{if(e.length===0)return[];const r=t<=0||!Number.isFinite(t)?1/0:t,n=Array.from({length:e.length});let o=0;const s=async()=>{for(;o<e.length;){const a=o;o+=1;const l=e[a];l&&(n[a]=await l())}},i=Array.from({length:Math.min(r,e.length)},()=>s());return await Promise.all(i),n},d3=async e=>await new Promise((t,r)=>{let n=0;const o=Zi(e),s=o.pipe(rg({params:{[ng.BROTLI_PARAM_QUALITY]:4}}));o.on("error",r),s.on("error",r),s.on("data",i=>{n+=i.length}),s.on("end",()=>{t(n)})}),di=e=>e==null?"undefined":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"||typeof e=="symbol"?e.toString():JSON.stringify(e),mi=(e,t,r)=>{let n=e.get(t);return n===void 0&&(n=r(),e.set(t,n)),n},m3=(e,t,r,n)=>{{const o=new Map;for(const i of e){const a=mi(o,di(i[t]),()=>new Map),l=mi(a,di(i[r]),()=>new Map);mi(l,di(i[n]),()=>[]).push(i)}const s={};for(const[i,a]of o){const l={};for(const[u,c]of a)l[u]=Object.fromEntries(c);s[i]=l}return s}},h3=async e=>await new Promise((t,r)=>{let n=0;const o=Zi(e),s=o.pipe(og({level:9}));o.on("error",r),s.on("error",r),s.on("data",i=>{n+=i.length}),s.on("end",()=>{t(n)})}),g3=2,y3=/\.js$/,$3=/\.d\.[m|c]ts$/,b3=(e,t,r)=>[`total size: ${ne(je(t,{decimals:2}))}`,e.size?.brotli&&`brotli size: ${ne(je(e.size.brotli,{decimals:2}))}`,e.size?.gzip&&`gzip size: ${ne(je(e.size.gzip,{decimals:2}))}`,r!==0&&`chunk size: ${ne(je(r,{decimals:2}))}`].filter(Boolean).join(", "),w3=(e,t,r,n)=>{const o=Pe(t,"cjs"),s=Pe(t,"esm"),i=Ke(t,"cjs"),a=Ke(t,"esm");let l=e.path.replace(y3,".d.ts"),u="commonjs";e.path.endsWith(`.${o}`)?l=e.path.replace(new RegExp(String.raw`\.${o}$`),`.${i}`):e.path.endsWith(`.${s}`)&&(u="module",l=e.path.replace(new RegExp(String.raw`\.${s}$`),`.${a}`));const c=t.buildEntries.find(f=>f.path.endsWith(l));if(!c)return"";n.push(c.path);let p;return!l.includes(".d.ts")&&(l=l.replace($3,".d.ts"),p=t.buildEntries.find(f=>f.path.endsWith(l)),!p)?"":(p&&n.push(p.path),u==="commonjs"&&p?`
|
|
200
200
|
types:
|
|
201
201
|
${[c,p].map(f=>`${De(" └─ ")+Ae(r(f.path))} (total size: ${ne(je(f.size?.bytes??0,{decimals:2}))})`).join(`
|
|
202
202
|
`)}`:`
|
|
@@ -216,7 +216,7 @@ ${a}`:""}return t.options.declaration&&(i+=w3(e,t,r,n)),i+=`
|
|
|
216
216
|
└─ `)+Ae(r(a.path))} (total size: ${ne(je(a.size?.bytes??0,{decimals:2}))})`;i+=`
|
|
217
217
|
|
|
218
218
|
`,e.raw(i)}return n&&e.raw("Σ Total dist size (byte size):",ne(je(t.buildEntries.reduce((i,a)=>i+(a.size?.bytes??0),0),{decimals:2})),`
|
|
219
|
-
`),n},E3=/\.d\.[mc]?ts$/,hi=e=>e.filter(t=>!E3.test(t.input)),S3=(e,t)=>{const r=[];return e!=="undefined"&&r.push(`${ne(e)} environment`),t!=="undefined"&&r.push(`${ne(t)} runtime`),r.length>0?`Preparing build for ${r.join(" with ")}`:""},k3=(e,t)=>{const r={};return e!=="undefined"&&(r[["process","env","NODE_ENV"].join(".")]=JSON.stringify(e)),r[["process","env","EdgeRuntime"].join(".")]=JSON.stringify(t==="edge-light"),Object.freeze(r)},j3=(e,t)=>{const r=[];return e!=="undefined"&&r.push(e),t!=="undefined"&&r.push(t),r.length>0?`${r.join("/")}/`:""},Cn=(e,t,r,n,o,s)=>({...e,options:{...e.options,emitCJS:t,emitESM:r,entries:n,minify:o,rollup:{...e.options.rollup,replace:e.options.rollup.replace?un(e.options.rollup.replace,{},s):!1}}}),A3=async(e,t)=>{const r=e.logger,n=l=>{const u=l.name??l.fileAlias;if(!u)return"default";const c=[".browser",".server",".development",".node",".workerd"];for(const p of c)if(u.includes(p))return p.slice(1);return"default"},o=e.options.entries.map(l=>({...l,environment:l.environment??"undefined",runtime:l.runtime??"undefined",type:n(l)})),s=m3(o,"environment","runtime","type"),i=new Set,a=new Set;for(const[l,u]of Object.entries(s))for(const[c,p]of Object.entries(u))for(const[,f]of Object.entries(p)){const d={...e,environment:l==="undefined"?void 0:l,options:{...e.options,rollup:{...e.options.rollup,replace:e.options.rollup.replace?{...e.options.rollup.replace,values:{}}:e.options.rollup.replace}}};if(!e.options.dtsOnly&&(l!=="undefined"||c!=="undefined")){const k=S3(l,c);k&&r.info(k)}const m=c==="undefined"?void 0:c;d.options.runtime=m;try{await e.hooks.callHook("rollup:options",d,{})}catch(k){throw r.error(`Error calling rollup:options hook: ${String(k)}`),k}const h=d.options.rollup.replace,$=e.options.rollup.replace,y=h?k3(l,c):{};if(h){h.values??={};const k=$?un($).values:{};Object.assign(h.values,y,k)}else r.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");const g=h?h.values??y:y,w=j3(l,c);let b=d.options.minify??!1;l==="development"?b=!1:l==="production"&&(b=!0);const v=f.map(k=>{const{environment:R,runtime:P,...z}=k;return{...z,environment:R==="undefined"?void 0:R,runtime:P==="undefined"?void 0:P}}),S=[],x=[],E=[],j=[];for(const k of v){if(Yr(k.name)){k.declaration&&j.push(k);continue}k.cjs&&k.esm?S.push(k):k.cjs?E.push(k):k.esm?x.push(k):k.declaration&&j.push(k)}if(S.length>0){const k=Cn(d,!0,!0,hi(S),b,g);if(e.options.dtsOnly||i.add({context:k,fileCache:t,subDirectory:w}),e.options.declaration){const R=S.filter(P=>P.declaration);R.length>0&&a.add({context:{...k,options:{...k.options,entries:R}},fileCache:t,subDirectory:w})}}if(x.length>0){const k=Cn(d,!1,!0,hi(x),b,g);if(e.options.dtsOnly||i.add({context:k,fileCache:t,subDirectory:w}),e.options.declaration){const R=x.filter(P=>P.declaration);R.length>0&&a.add({context:{...k,options:{...k.options,entries:R}},fileCache:t,subDirectory:w})}}if(E.length>0){const k=Cn(d,!0,!1,hi(E),b,g);if(e.options.dtsOnly||i.add({context:k,fileCache:t,subDirectory:w}),e.options.declaration){const R=E.filter(P=>P.declaration);R.length>0&&a.add({context:{...k,options:{...k.options,entries:R}},fileCache:t,subDirectory:w})}}if(d.options.declaration&&j.length>0){const k=j.some(U=>U.declarationCjs),R=j.some(U=>U.declarationEsm),P=j.some(U=>U.declaration&&!U.declarationCjs&&!U.declarationEsm),z=Cn(d,k||P,R,j,b,g);a.add({context:z,fileCache:t,subDirectory:w})}}return{builders:i,typeBuilders:a}},O3=async(e,t)=>{const r=e.logger;await e.hooks.callHook("build:before",e);const{builders:n,typeBuilders:o}=await A3(e,t);if(n.size>0&&await Promise.all(Array.from(n,async({context:
|
|
219
|
+
`),n},E3=/\.d\.[mc]?ts$/,hi=e=>e.filter(t=>!E3.test(t.input)),S3=(e,t)=>{const r=[];return e!=="undefined"&&r.push(`${ne(e)} environment`),t!=="undefined"&&r.push(`${ne(t)} runtime`),r.length>0?`Preparing build for ${r.join(" with ")}`:""},k3=(e,t)=>{const r={};return e!=="undefined"&&(r[["process","env","NODE_ENV"].join(".")]=JSON.stringify(e)),r[["process","env","EdgeRuntime"].join(".")]=JSON.stringify(t==="edge-light"),Object.freeze(r)},j3=(e,t)=>{const r=[];return e!=="undefined"&&r.push(e),t!=="undefined"&&r.push(t),r.length>0?`${r.join("/")}/`:""},Cn=(e,t,r,n,o,s)=>({...e,options:{...e.options,emitCJS:t,emitESM:r,entries:n,minify:o,rollup:{...e.options.rollup,replace:e.options.rollup.replace?un(e.options.rollup.replace,{},s):!1}}}),A3=async(e,t)=>{const r=e.logger,n=l=>{const u=l.name??l.fileAlias;if(!u)return"default";const c=[".browser",".server",".development",".node",".workerd"];for(const p of c)if(u.includes(p))return p.slice(1);return"default"},o=e.options.entries.map(l=>({...l,environment:l.environment??"undefined",runtime:l.runtime??"undefined",type:n(l)})),s=m3(o,"environment","runtime","type"),i=new Set,a=new Set;for(const[l,u]of Object.entries(s))for(const[c,p]of Object.entries(u))for(const[,f]of Object.entries(p)){const d={...e,environment:l==="undefined"?void 0:l,options:{...e.options,rollup:{...e.options.rollup,replace:e.options.rollup.replace?{...e.options.rollup.replace,values:{}}:e.options.rollup.replace}}};if(!e.options.dtsOnly&&(l!=="undefined"||c!=="undefined")){const k=S3(l,c);k&&r.info(k)}const m=c==="undefined"?void 0:c;d.options.runtime=m;try{await e.hooks.callHook("rollup:options",d,{})}catch(k){throw r.error(`Error calling rollup:options hook: ${String(k)}`),k}const h=d.options.rollup.replace,$=e.options.rollup.replace,y=h?k3(l,c):{};if(h){h.values??={};const k=$?un($).values:{};Object.assign(h.values,y,k)}else r.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");const g=h?h.values??y:y,w=j3(l,c);let b=d.options.minify??!1;l==="development"?b=!1:l==="production"&&(b=!0);const v=f.map(k=>{const{environment:R,runtime:P,...z}=k;return{...z,environment:R==="undefined"?void 0:R,runtime:P==="undefined"?void 0:P}}),S=[],x=[],E=[],j=[];for(const k of v){if(Yr(k.name)){k.declaration&&j.push(k);continue}k.cjs&&k.esm?S.push(k):k.cjs?E.push(k):k.esm?x.push(k):k.declaration&&j.push(k)}if(S.length>0){const k=Cn(d,!0,!0,hi(S),b,g);if(e.options.dtsOnly||i.add({context:k,fileCache:t,subDirectory:w}),e.options.declaration){const R=S.filter(P=>P.declaration);R.length>0&&a.add({context:{...k,options:{...k.options,entries:R}},fileCache:t,subDirectory:w})}}if(x.length>0){const k=Cn(d,!1,!0,hi(x),b,g);if(e.options.dtsOnly||i.add({context:k,fileCache:t,subDirectory:w}),e.options.declaration){const R=x.filter(P=>P.declaration);R.length>0&&a.add({context:{...k,options:{...k.options,entries:R}},fileCache:t,subDirectory:w})}}if(E.length>0){const k=Cn(d,!0,!1,hi(E),b,g);if(e.options.dtsOnly||i.add({context:k,fileCache:t,subDirectory:w}),e.options.declaration){const R=E.filter(P=>P.declaration);R.length>0&&a.add({context:{...k,options:{...k.options,entries:R}},fileCache:t,subDirectory:w})}}if(d.options.declaration&&j.length>0){const k=j.some(U=>U.declarationCjs),R=j.some(U=>U.declarationEsm),P=j.some(U=>U.declaration&&!U.declarationCjs&&!U.declarationEsm),z=Cn(d,k||P,R,j,b,g);a.add({context:z,fileCache:t,subDirectory:w})}}return{builders:i,typeBuilders:a}},O3=async(e,t)=>{const r=e.logger;await e.hooks.callHook("build:before",e);const{builders:n,typeBuilders:o}=await A3(e,t);if(n.size>0&&await Promise.all(Array.from(n,async({context:u,fileCache:c,subDirectory:p})=>l9(u,c,p,Zd(u.options.bundler)))),o.size>0){const u=e.options.dtsConcurrency??g3;await f3(Array.from(o,({context:c,fileCache:p,subDirectory:f})=>()=>qA(c,p,f)),u)}r.success(qi(e.options.name?`Build succeeded for ${e.options.name}`:"Build succeeded"));const s=new Set;e.buildEntries=e.buildEntries.filter(u=>s.has(u.path)?!1:(s.add(u.path),!0));const i=G(e.options.rootDir,e.options.outDir),a=new Map(e.buildEntries.map(u=>[G(i,u.path),u])),l=[];for await(const u of Rm(i,{includeDirs:!1,includeFiles:!0})){let c=a.get(u.path);c||(c={chunk:!0,path:u.path},e.buildEntries.push(c)),c.size??={};const p=X(i,u.path),f=c.size;l.push((async()=>{if(!f.bytes){const h=await Qr(p);f.bytes=h.size}const[d,m]=await Promise.all([f.brotli??d3(p),f.gzip??h3(p)]);f.brotli=d,f.gzip=m})())}return await Promise.all(l),e.options.exe&&await p3(e),await e.hooks.callHook("build:done",e),x3(r,e)},R3=e=>Object.fromEntries(Object.entries(e).map(([t,r])=>{if(!r)return[t,{}];const n=Object.fromEntries(Object.entries(r).map(([o,s])=>Array.isArray(s)?[o,[...new Set(s)]]:[o,[]]));return[t,n]})),C3=async(e,t,r,n,o,s)=>{const i=e;if(s!=="*"&&Le.valid(Le.coerce(s))===null)throw new Error("Invalid typeScriptVersion option. It must be a valid semver range.");i.info({message:"Declaration node10 compatibility mode is enabled.",prefix:"plugin:packem:node10-compatibility"});const a={};for(const c of t){if(c.exportKey===void 0||c.name===void 0)continue;const{name:p}=c;for(const f of c.exportKey)a[f]=f.includes("/*")?[`./${G(r,Z(p),"*.d.ts")}`]:[...a[f]??[],`./${G(r,`${p}.d.ts`)}`]}const l=G(n,"package.json"),u=await fo(l);o==="file"&&Object.keys(a).length>0?(await Ju(l,{...u,typesVersions:R3({...u.typesVersions,[s]:a})},{detectIndent:!0}),i.info({message:'Your package.json "typesVersions" field has been updated.',prefix:"plugin:packem:node10-compatibility"})):Object.keys(a).length>0&&i.info({message:`Please add the following field into your package.json to enable node 10 compatibility:
|
|
220
220
|
|
|
221
221
|
${JSON.stringify({typesVersions:{"*":a}},void 0,4)}
|
|
222
222
|
`,prefix:"plugin:packem:node10-compatibility"})},Ht=e=>e??{},T3=/\.(md|txt|htm|html|data)$/,N3=/^@swc\/helpers(?:\/.*)?$/,P3=e=>{switch(e){case"preserve":case"react-native":return"preserve";case"react":return"transform";case"react-jsx":case"react-jsxdev":return"automatic";default:return}},_3=(e,t,r,n,o,s,i,a)=>{const l=P3(i?.config.compilerOptions?.jsx),u=a.split("."),c=_9()(q1,o,{alias:{},browserTargets:hh(),cjsInterop:!1,clean:!0,debug:n,declaration:void 0,emitCJS:void 0,emitESM:void 0,entries:[],externals:[],failOnWarn:!0,fileCache:!0,jiti:{alias:{},debug:n,interopDefault:!0},minify:r===Wr,name:(s.name??"").split("/").pop()??"default",outDir:i?.config.compilerOptions?.outDir??"dist",rollup:{alias:{},cjsInterop:{addDefaultProperty:!1},commonjs:{extensions:[".mjs",".js",".json",".node",".cjs"],ignoreTryCatch:!0,preserveSymlinks:!0,transformMixedEsModules:!0},css:{autoModules:!0,extensions:[".css",".pcss",".postcss",".sss"],namedExports:!0},dataUri:{srcset:!0},debarrel:{},detectDuplicated:{},dts:{compilerOptions:{baseUrl:i?.config.compilerOptions?.baseUrl??".",checkJs:!1,composite:!1,declaration:!0,declarationMap:!1,emitDeclarationOnly:!0,incremental:!1,moduleResolution:100,noEmit:!1,noEmitOnError:!0,preserveSymlinks:!1,skipLibCheck:!0,target:99}},dynamicVars:{errorWhenNoFilesFound:!0,exclude:kt,include:Et},esbuild:{charset:"utf8",jsx:l,jsxDev:i?.config.compilerOptions?.jsx==="react-jsxdev",jsxFactory:i?.config.compilerOptions?.jsxFactory,jsxFragment:Ht(i?.config.compilerOptions).jsxFragmentFactory,jsxImportSource:Ht(i?.config.compilerOptions).jsxImportSource,jsxSideEffects:!0,keepNames:!1,sourcesContent:!1,supported:{"import-attributes":!0},target:i?.config.compilerOptions?.target,treeShaking:!0,tsconfigRaw:i?.config},json:{preferConst:!1},license:{dependenciesTemplate:(d,m,h)=>`
|