jiek 1.0.11 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cli.cjs CHANGED
@@ -141,7 +141,7 @@ async function getSelectedProjectsGraph() {
141
141
 
142
142
  var name = "jiek";
143
143
  var type = "module";
144
- var version = "1.0.10";
144
+ var version = "1.0.12";
145
145
  var description = "YiJie's personal kits.";
146
146
  var bin = {
147
147
  jiek: "bin/jiek.js",
@@ -174,7 +174,7 @@ var imports = {
174
174
  };
175
175
  var dependencies = {
176
176
  "@jiek/pkger": "workspace:^",
177
- "@jiek/rollup-plugin-dts": "^6.1.1",
177
+ "@jiek/rollup-plugin-dts": "^6.1.2",
178
178
  "@jiek/utils": "workspace:^",
179
179
  "@rollup/plugin-commonjs": "^28.0.0",
180
180
  "@rollup/plugin-json": "^6.0.1",
package/dist/cli.js CHANGED
@@ -110,7 +110,7 @@ async function getSelectedProjectsGraph() {
110
110
 
111
111
  var name = "jiek";
112
112
  var type = "module";
113
- var version = "1.0.10";
113
+ var version = "1.0.12";
114
114
  var description = "YiJie's personal kits.";
115
115
  var bin = {
116
116
  jiek: "bin/jiek.js",
@@ -143,7 +143,7 @@ var imports = {
143
143
  };
144
144
  var dependencies = {
145
145
  "@jiek/pkger": "workspace:^",
146
- "@jiek/rollup-plugin-dts": "^6.1.1",
146
+ "@jiek/rollup-plugin-dts": "^6.1.2",
147
147
  "@jiek/utils": "workspace:^",
148
148
  "@rollup/plugin-commonjs": "^28.0.0",
149
149
  "@rollup/plugin-json": "^6.0.1",
package/dist/cli.min.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("node:fs"),t=require("node:module"),n=require("node:path"),r=require("@pnpm/filter-workspace-packages"),o=require("commander"),a=require("js-yaml"),s=require("@jiek/utils/getWorkspaceDir"),i=require("cli-progress"),u=require("execa"),l=require("detect-indent"),p=require("inquirer"),c=require("jsonc-parser"),f=require("util"),d=require("path"),g=require("node:child_process"),h=require("@jiek/utils/bumper"),y=require("@jiek/pkger/entrypoints"),A="undefined"!=typeof document?document.currentScript:null;function R(e){return e&&e.__esModule?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var E=R(e),_=R(n),b=R(l),S=R(p),C=R(f),v=R(d),$=m(g);let x,w;function H(){if(x)return x;const e=o.program.getOptionValue("root");return x=e?_.default.isAbsolute(e)?e:_.default.resolve(process.cwd(),e):void 0,x}let k=!1;function O(){if(w)return{wd:w,notWorkspace:k};const e=H();if(void 0!==e){const t=s.isWorkspaceDir(e,T);return k=!t,w=e,{wd:w,notWorkspace:k}}try{w=s.getWorkspaceDir(T)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;w=e,k=!0}return{wd:w,notWorkspace:k}}let T="";try{t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href).resolve("@pnpm/filter-workspace-packages"),T="pnpm"}catch{}async function L(){let e=o.program.getOptionValue("filter");const t=H(),{wd:n,notWorkspace:s}=O();if(!s&&"pnpm"===T){const o=_.default.resolve(n,"pnpm-workspace.yaml"),s=E.default.readFileSync(o,"utf-8"),i=a.load(s);if(t===n&&!e)throw new Error("root path is workspace root, please provide a filter");if(t!==n&&!e){if(!E.default.existsSync(_.default.resolve(t,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const n=JSON.parse(E.default.readFileSync(_.default.resolve(t,"package.json"),"utf-8"));if(!n.name)throw new Error("root path is not workspace root, please provide a filter");e=n.name}const{selectedProjectsGraph:u}=await r.filterPackagesFromDir(n,[{filter:e??"",followProdDepsOnly:!0}],{prefix:t,workspaceDir:n,patterns:i.packages});return{wd:n,root:t,value:Object.entries(u).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}return{wd:n,root:t,value:{[n]:JSON.parse(E.default.readFileSync(_.default.resolve(n,"package.json"),"utf-8"))}}}""!==T&&o.program.option("-f, --filter <filter>","filter packages");var N="1.0.10",I="YiJie's personal kits.";let M;function j(){M()}function P(){new Promise((e=>M=e))}o.program.version(N).description(I).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const B=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href);function D(e){try{return B.resolve(e),!0}catch(e){return!1}}let U;const G=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of G)if(D(e)){U=e;break}const F=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href);let K="jiek.config";function q(e){const{wd:t}=O();let n=o.program.getOptionValue("configPath");if(n){if(!E.default.existsSync(n))throw new Error(`config file not found: ${n}`);_.default.isAbsolute(n)||(n=_.default.resolve(t,n))}else n=function(e,t){const n=!!U;function r(n){const r=[_.default.resolve(process.cwd(),`${K}.${n}`),_.default.resolve(process.cwd(),`.${K}.${n}`),_.default.resolve(e,`${K}.${n}`),_.default.resolve(e,`.${K}.${n}`)];t&&r.unshift(_.default.resolve(t,`${K}.${n}`),_.default.resolve(t,`.${K}.${n}`));for(const e of r)if(E.default.existsSync(e)&&E.default.lstatSync(e).isFile())return e}return K=r("js")??K,K=r("json")??K,K=r("yaml")??K,n&&(K=r("ts")??K),_.default.resolve(e,K)}(t,e);const r=_.default.extname(n);let s;switch(r){case".js":s=F(n);break;case".json":return F(n);case".yaml":return a.load(E.default.readFileSync(n,"utf-8"));case".ts":if(U){F(U),s=F(n);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":s={};break;default:throw new Error(`unsupported config file type: ${r}`)}if(!s)throw new Error("config file is empty");return s.default??s}const Q=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href);o.program.command("build").option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").option("-v, --verbose","Display debug logs.").action((async({silent:e,entries:t,verbose:n})=>{P();const{build:r}=q();e=e??r?.silent??!1;const{wd:o,value:a={}}=await L()??{};if(0===Object.keys(a).length)throw new Error("no package found");const s=_.default.resolve(o,"node_modules");E.default.existsSync(s)||E.default.mkdirSync(s);const l=(...e)=>_.default.resolve(s,".jiek",...e);E.default.existsSync(l())||E.default.mkdirSync(l());const p=Q.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup"),c=new i.MultiBar({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {input} | {message}"},i.Presets.shades_classic);let f=0;await Promise.all(Object.entries(a).map((async([r,a])=>{const s=a.name?.replace(/^@/g,"").replace(/\//g,"+"),i=l(`${s??"anonymous-"+f++}.rollup.config.js`);E.default.writeFileSync(i,(e=>`\nmodule.exports = require('jiek/rollup').template(${JSON.stringify(e,null,2)})\n`.trimStart())(a));let d="";U&&(d=`node -r ${U} `);const g=`${d}${p} --silent -c ${i}`,h=u.execaCommand(g,{ipc:!0,cwd:r,env:{...process.env,JIEK_ROOT:o,JIEK_ENTRIES:t}}),y={};let A=10;h.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!e&&h.on("message",(e=>{if("init"===e.type){const{leafMap:t,targetsLength:n}=e.data,r=Array.from(t.entries()).flatMap((([e,t])=>t.map((([t,...n])=>({input:e,path:t,conditions:n})))));console.log(`Package '${a.name}' has ${n} targets to build`),r.forEach((({input:e})=>{A=Math.max(A,e.length)})),r.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;y[n]||(y[n]=c.create(50,0,{input:e.padEnd(A),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:n,input:r,event:o,message:a}=e.data,s=y[`${r}:${t}`];if(!s)return;s.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:r.padEnd(A),status:o?.padEnd(10),message:`${n?.join(", ")}: ${a}`})}})),await new Promise(((e,t)=>{let r="";h.stderr?.on("data",(e=>{r+=e})),h.once("exit",(n=>0===n?e():t(new Error(`rollup build failed:\n${r}`)))),n&&h.stdout?.pipe(process.stdout)}))}))).finally((()=>{c.stop()})),j()}));var W,X,Z,J,z,Y,V,ee,te,ne,re,oe,ae,se,ie,ue,le,pe,ce,fe={};function de(){return W||(W=1,(e=fe).isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,o)=>!1!==o&&!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=o,e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>!("brace"!==e.type||e.commas>>0+e.ranges||(e.invalid=!0,0)),e.isInvalidBrace=e=>!("brace"!==e.type||!0!==e.invalid&&!e.dollar&&(e.commas>>0+e.ranges&&!0===e.open&&!0===e.close||(e.invalid=!0,0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||!0===e.open||!0===e.close,e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let o=e[r];Array.isArray(o)?n(o):void 0!==o&&t.push(o)}return t};return n(e),t}),fe;var e}function ge(){if(Z)return X;Z=1;const e=de();return X=(t,n={})=>{let r=(t,o={})=>{let a=n.escapeInvalid&&e.isInvalidBrace(o),s=!0===t.invalid&&!0===n.escapeInvalid,i="";if(t.value)return(a||s)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)i+=r(e);return i};return r(t)}}
1
+ "use strict";var e=require("node:fs"),t=require("node:module"),n=require("node:path"),r=require("@pnpm/filter-workspace-packages"),o=require("commander"),a=require("js-yaml"),s=require("@jiek/utils/getWorkspaceDir"),i=require("cli-progress"),u=require("execa"),l=require("detect-indent"),p=require("inquirer"),c=require("jsonc-parser"),f=require("util"),d=require("path"),g=require("node:child_process"),h=require("@jiek/utils/bumper"),y=require("@jiek/pkger/entrypoints"),A="undefined"!=typeof document?document.currentScript:null;function R(e){return e&&e.__esModule?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var E=R(e),_=R(n),b=R(l),S=R(p),C=R(f),v=R(d),$=m(g);let x,w;function H(){if(x)return x;const e=o.program.getOptionValue("root");return x=e?_.default.isAbsolute(e)?e:_.default.resolve(process.cwd(),e):void 0,x}let k=!1;function O(){if(w)return{wd:w,notWorkspace:k};const e=H();if(void 0!==e){const t=s.isWorkspaceDir(e,T);return k=!t,w=e,{wd:w,notWorkspace:k}}try{w=s.getWorkspaceDir(T)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;w=e,k=!0}return{wd:w,notWorkspace:k}}let T="";try{t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href).resolve("@pnpm/filter-workspace-packages"),T="pnpm"}catch{}async function L(){let e=o.program.getOptionValue("filter");const t=H(),{wd:n,notWorkspace:s}=O();if(!s&&"pnpm"===T){const o=_.default.resolve(n,"pnpm-workspace.yaml"),s=E.default.readFileSync(o,"utf-8"),i=a.load(s);if(t===n&&!e)throw new Error("root path is workspace root, please provide a filter");if(t!==n&&!e){if(!E.default.existsSync(_.default.resolve(t,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const n=JSON.parse(E.default.readFileSync(_.default.resolve(t,"package.json"),"utf-8"));if(!n.name)throw new Error("root path is not workspace root, please provide a filter");e=n.name}const{selectedProjectsGraph:u}=await r.filterPackagesFromDir(n,[{filter:e??"",followProdDepsOnly:!0}],{prefix:t,workspaceDir:n,patterns:i.packages});return{wd:n,root:t,value:Object.entries(u).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}return{wd:n,root:t,value:{[n]:JSON.parse(E.default.readFileSync(_.default.resolve(n,"package.json"),"utf-8"))}}}""!==T&&o.program.option("-f, --filter <filter>","filter packages");var N="1.0.12",I="YiJie's personal kits.";let M;function j(){M()}function P(){new Promise((e=>M=e))}o.program.version(N).description(I).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const B=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href);function D(e){try{return B.resolve(e),!0}catch(e){return!1}}let U;const G=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of G)if(D(e)){U=e;break}const F=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href);let K="jiek.config";function q(e){const{wd:t}=O();let n=o.program.getOptionValue("configPath");if(n){if(!E.default.existsSync(n))throw new Error(`config file not found: ${n}`);_.default.isAbsolute(n)||(n=_.default.resolve(t,n))}else n=function(e,t){const n=!!U;function r(n){const r=[_.default.resolve(process.cwd(),`${K}.${n}`),_.default.resolve(process.cwd(),`.${K}.${n}`),_.default.resolve(e,`${K}.${n}`),_.default.resolve(e,`.${K}.${n}`)];t&&r.unshift(_.default.resolve(t,`${K}.${n}`),_.default.resolve(t,`.${K}.${n}`));for(const e of r)if(E.default.existsSync(e)&&E.default.lstatSync(e).isFile())return e}return K=r("js")??K,K=r("json")??K,K=r("yaml")??K,n&&(K=r("ts")??K),_.default.resolve(e,K)}(t,e);const r=_.default.extname(n);let s;switch(r){case".js":s=F(n);break;case".json":return F(n);case".yaml":return a.load(E.default.readFileSync(n,"utf-8"));case".ts":if(U){F(U),s=F(n);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":s={};break;default:throw new Error(`unsupported config file type: ${r}`)}if(!s)throw new Error("config file is empty");return s.default??s}const Q=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href);o.program.command("build").option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").option("-v, --verbose","Display debug logs.").action((async({silent:e,entries:t,verbose:n})=>{P();const{build:r}=q();e=e??r?.silent??!1;const{wd:o,value:a={}}=await L()??{};if(0===Object.keys(a).length)throw new Error("no package found");const s=_.default.resolve(o,"node_modules");E.default.existsSync(s)||E.default.mkdirSync(s);const l=(...e)=>_.default.resolve(s,".jiek",...e);E.default.existsSync(l())||E.default.mkdirSync(l());const p=Q.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup"),c=new i.MultiBar({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {input} | {message}"},i.Presets.shades_classic);let f=0;await Promise.all(Object.entries(a).map((async([r,a])=>{const s=a.name?.replace(/^@/g,"").replace(/\//g,"+"),i=l(`${s??"anonymous-"+f++}.rollup.config.js`);E.default.writeFileSync(i,(e=>`\nmodule.exports = require('jiek/rollup').template(${JSON.stringify(e,null,2)})\n`.trimStart())(a));let d="";U&&(d=`node -r ${U} `);const g=`${d}${p} --silent -c ${i}`,h=u.execaCommand(g,{ipc:!0,cwd:r,env:{...process.env,JIEK_ROOT:o,JIEK_ENTRIES:t}}),y={};let A=10;h.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!e&&h.on("message",(e=>{if("init"===e.type){const{leafMap:t,targetsLength:n}=e.data,r=Array.from(t.entries()).flatMap((([e,t])=>t.map((([t,...n])=>({input:e,path:t,conditions:n})))));console.log(`Package '${a.name}' has ${n} targets to build`),r.forEach((({input:e})=>{A=Math.max(A,e.length)})),r.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;y[n]||(y[n]=c.create(50,0,{input:e.padEnd(A),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:n,input:r,event:o,message:a}=e.data,s=y[`${r}:${t}`];if(!s)return;s.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:r.padEnd(A),status:o?.padEnd(10),message:`${n?.join(", ")}: ${a}`})}})),await new Promise(((e,t)=>{let r="";h.stderr?.on("data",(e=>{r+=e})),h.once("exit",(n=>0===n?e():t(new Error(`rollup build failed:\n${r}`)))),n&&h.stdout?.pipe(process.stdout)}))}))).finally((()=>{c.stop()})),j()}));var W,X,Z,J,z,Y,V,ee,te,ne,re,oe,ae,se,ie,ue,le,pe,ce,fe={};function de(){return W||(W=1,(e=fe).isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,o)=>!1!==o&&!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=o,e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>!("brace"!==e.type||e.commas>>0+e.ranges||(e.invalid=!0,0)),e.isInvalidBrace=e=>!("brace"!==e.type||!0!==e.invalid&&!e.dollar&&(e.commas>>0+e.ranges&&!0===e.open&&!0===e.close||(e.invalid=!0,0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||!0===e.open||!0===e.close,e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let o=e[r];Array.isArray(o)?n(o):void 0!==o&&t.push(o)}return t};return n(e),t}),fe;var e}function ge(){if(Z)return X;Z=1;const e=de();return X=(t,n={})=>{let r=(t,o={})=>{let a=n.escapeInvalid&&e.isInvalidBrace(o),s=!0===t.invalid&&!0===n.escapeInvalid,i="";if(t.value)return(a||s)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)i+=r(e);return i};return r(t)}}
2
2
  /*!
3
3
  * is-number <https://github.com/jonschlinkert/is-number>
4
4
  *
package/dist/cli.min.js CHANGED
@@ -1,4 +1,4 @@
1
- import e from"node:fs";import{createRequire as t}from"node:module";import n,{resolve as r,relative as o}from"node:path";import{filterPackagesFromDir as s}from"@pnpm/filter-workspace-packages";import{program as a}from"commander";import{load as i}from"js-yaml";import{isWorkspaceDir as u,getWorkspaceDir as p}from"@jiek/utils/getWorkspaceDir";import{MultiBar as l,Presets as c}from"cli-progress";import{execaCommand as f}from"execa";import g from"detect-indent";import d from"inquirer";import{applyEdits as h,modify as A}from"jsonc-parser";import R from"util";import y from"path";import*as m from"node:child_process";import{bump as _}from"@jiek/utils/bumper";import{resolveEntrypoints as E,filterLeafs as b,DEFAULT_SKIP_VALUES as S,entrypoints2Exports as C}from"@jiek/pkger/entrypoints";let v,$;function x(){if(v)return v;const e=a.getOptionValue("root");return v=e?n.isAbsolute(e)?e:n.resolve(process.cwd(),e):void 0,v}let w=!1;function H(){if($)return{wd:$,notWorkspace:w};const e=x();if(void 0!==e){const t=u(e,k);return w=!t,$=e,{wd:$,notWorkspace:w}}try{$=p(k)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;$=e,w=!0}return{wd:$,notWorkspace:w}}let k="";try{t(import.meta.url).resolve("@pnpm/filter-workspace-packages"),k="pnpm"}catch{}async function O(){let t=a.getOptionValue("filter");const r=x(),{wd:o,notWorkspace:u}=H();if(!u&&"pnpm"===k){const a=n.resolve(o,"pnpm-workspace.yaml"),u=e.readFileSync(a,"utf-8"),p=i(u);if(r===o&&!t)throw new Error("root path is workspace root, please provide a filter");if(r!==o&&!t){if(!e.existsSync(n.resolve(r,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const o=JSON.parse(e.readFileSync(n.resolve(r,"package.json"),"utf-8"));if(!o.name)throw new Error("root path is not workspace root, please provide a filter");t=o.name}const{selectedProjectsGraph:l}=await s(o,[{filter:t??"",followProdDepsOnly:!0}],{prefix:r,workspaceDir:o,patterns:p.packages});return{wd:o,root:r,value:Object.entries(l).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}return{wd:o,root:r,value:{[o]:JSON.parse(e.readFileSync(n.resolve(o,"package.json"),"utf-8"))}}}""!==k&&a.option("-f, --filter <filter>","filter packages");var T="1.0.10",L="YiJie's personal kits.";let N;function I(){N()}function M(){new Promise((e=>N=e))}a.version(T).description(L).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const j=t(import.meta.url);function B(e){try{return j.resolve(e),!0}catch(e){return!1}}let P;const D=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of D)if(B(e)){P=e;break}const G=t(import.meta.url);let K="jiek.config";function U(t){const{wd:r}=H();let o=a.getOptionValue("configPath");if(o){if(!e.existsSync(o))throw new Error(`config file not found: ${o}`);n.isAbsolute(o)||(o=n.resolve(r,o))}else o=function(t,r){const o=!!P;function s(o){const s=[n.resolve(process.cwd(),`${K}.${o}`),n.resolve(process.cwd(),`.${K}.${o}`),n.resolve(t,`${K}.${o}`),n.resolve(t,`.${K}.${o}`)];r&&s.unshift(n.resolve(r,`${K}.${o}`),n.resolve(r,`.${K}.${o}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return K=s("js")??K,K=s("json")??K,K=s("yaml")??K,o&&(K=s("ts")??K),n.resolve(t,K)}(r,t);const s=n.extname(o);let u;switch(s){case".js":u=G(o);break;case".json":return G(o);case".yaml":return i(e.readFileSync(o,"utf-8"));case".ts":if(P){G(P),u=G(o);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":u={};break;default:throw new Error(`unsupported config file type: ${s}`)}if(!u)throw new Error("config file is empty");return u.default??u}const F=t(import.meta.url);a.command("build").option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").option("-v, --verbose","Display debug logs.").action((async({silent:t,entries:r,verbose:o})=>{M();const{build:s}=U();t=t??s?.silent??!1;const{wd:a,value:i={}}=await O()??{};if(0===Object.keys(i).length)throw new Error("no package found");const u=n.resolve(a,"node_modules");e.existsSync(u)||e.mkdirSync(u);const p=(...e)=>n.resolve(u,".jiek",...e);e.existsSync(p())||e.mkdirSync(p());const g=F.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup"),d=new l({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {input} | {message}"},c.shades_classic);let h=0;await Promise.all(Object.entries(i).map((async([n,s])=>{const i=s.name?.replace(/^@/g,"").replace(/\//g,"+"),u=p(`${i??"anonymous-"+h++}.rollup.config.js`);e.writeFileSync(u,(e=>`\nmodule.exports = require('jiek/rollup').template(${JSON.stringify(e,null,2)})\n`.trimStart())(s));let l="";P&&(l=`node -r ${P} `);const c=f(`${l}${g} --silent -c ${u}`,{ipc:!0,cwd:n,env:{...process.env,JIEK_ROOT:a,JIEK_ENTRIES:r}}),A={};let R=10;c.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!t&&c.on("message",(e=>{if("init"===e.type){const{leafMap:t,targetsLength:n}=e.data,r=Array.from(t.entries()).flatMap((([e,t])=>t.map((([t,...n])=>({input:e,path:t,conditions:n})))));console.log(`Package '${s.name}' has ${n} targets to build`),r.forEach((({input:e})=>{R=Math.max(R,e.length)})),r.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;A[n]||(A[n]=d.create(50,0,{input:e.padEnd(R),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:n,input:r,event:o,message:s}=e.data,a=A[`${r}:${t}`];if(!a)return;a.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:r.padEnd(R),status:o?.padEnd(10),message:`${n?.join(", ")}: ${s}`})}})),await new Promise(((e,t)=>{let n="";c.stderr?.on("data",(e=>{n+=e})),c.once("exit",(r=>0===r?e():t(new Error(`rollup build failed:\n${n}`)))),o&&c.stdout?.pipe(process.stdout)}))}))).finally((()=>{d.stop()})),I()}));var Q,W,X,q,Z,J,Y,z,V,ee,te,ne,re,oe,se,ae,ie,ue,pe,le={};function ce(){return Q||(Q=1,function(e){e.isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,o)=>!1!==o&&(!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=o),e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>"brace"===e.type&&(!(e.commas>>0+e.ranges)&&(e.invalid=!0,!0)),e.isInvalidBrace=e=>"brace"===e.type&&(!(!0!==e.invalid&&!e.dollar)||(e.commas>>0+e.ranges?(!0!==e.open||!0!==e.close)&&(e.invalid=!0,!0):(e.invalid=!0,!0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||(!0===e.open||!0===e.close),e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let o=e[r];Array.isArray(o)?n(o):void 0!==o&&t.push(o)}return t};return n(e),t}}(le)),le}function fe(){if(X)return W;X=1;const e=ce();return W=(t,n={})=>{let r=(t,o={})=>{let s=n.escapeInvalid&&e.isInvalidBrace(o),a=!0===t.invalid&&!0===n.escapeInvalid,i="";if(t.value)return(s||a)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)i+=r(e);return i};return r(t)}}
1
+ import e from"node:fs";import{createRequire as t}from"node:module";import n,{resolve as r,relative as o}from"node:path";import{filterPackagesFromDir as s}from"@pnpm/filter-workspace-packages";import{program as a}from"commander";import{load as i}from"js-yaml";import{isWorkspaceDir as u,getWorkspaceDir as p}from"@jiek/utils/getWorkspaceDir";import{MultiBar as l,Presets as c}from"cli-progress";import{execaCommand as f}from"execa";import g from"detect-indent";import d from"inquirer";import{applyEdits as h,modify as A}from"jsonc-parser";import R from"util";import y from"path";import*as m from"node:child_process";import{bump as _}from"@jiek/utils/bumper";import{resolveEntrypoints as E,filterLeafs as b,DEFAULT_SKIP_VALUES as S,entrypoints2Exports as C}from"@jiek/pkger/entrypoints";let v,$;function x(){if(v)return v;const e=a.getOptionValue("root");return v=e?n.isAbsolute(e)?e:n.resolve(process.cwd(),e):void 0,v}let w=!1;function H(){if($)return{wd:$,notWorkspace:w};const e=x();if(void 0!==e){const t=u(e,k);return w=!t,$=e,{wd:$,notWorkspace:w}}try{$=p(k)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;$=e,w=!0}return{wd:$,notWorkspace:w}}let k="";try{t(import.meta.url).resolve("@pnpm/filter-workspace-packages"),k="pnpm"}catch{}async function O(){let t=a.getOptionValue("filter");const r=x(),{wd:o,notWorkspace:u}=H();if(!u&&"pnpm"===k){const a=n.resolve(o,"pnpm-workspace.yaml"),u=e.readFileSync(a,"utf-8"),p=i(u);if(r===o&&!t)throw new Error("root path is workspace root, please provide a filter");if(r!==o&&!t){if(!e.existsSync(n.resolve(r,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const o=JSON.parse(e.readFileSync(n.resolve(r,"package.json"),"utf-8"));if(!o.name)throw new Error("root path is not workspace root, please provide a filter");t=o.name}const{selectedProjectsGraph:l}=await s(o,[{filter:t??"",followProdDepsOnly:!0}],{prefix:r,workspaceDir:o,patterns:p.packages});return{wd:o,root:r,value:Object.entries(l).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}return{wd:o,root:r,value:{[o]:JSON.parse(e.readFileSync(n.resolve(o,"package.json"),"utf-8"))}}}""!==k&&a.option("-f, --filter <filter>","filter packages");var T="1.0.12",L="YiJie's personal kits.";let N;function I(){N()}function M(){new Promise((e=>N=e))}a.version(T).description(L).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const j=t(import.meta.url);function B(e){try{return j.resolve(e),!0}catch(e){return!1}}let P;const D=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of D)if(B(e)){P=e;break}const G=t(import.meta.url);let K="jiek.config";function U(t){const{wd:r}=H();let o=a.getOptionValue("configPath");if(o){if(!e.existsSync(o))throw new Error(`config file not found: ${o}`);n.isAbsolute(o)||(o=n.resolve(r,o))}else o=function(t,r){const o=!!P;function s(o){const s=[n.resolve(process.cwd(),`${K}.${o}`),n.resolve(process.cwd(),`.${K}.${o}`),n.resolve(t,`${K}.${o}`),n.resolve(t,`.${K}.${o}`)];r&&s.unshift(n.resolve(r,`${K}.${o}`),n.resolve(r,`.${K}.${o}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return K=s("js")??K,K=s("json")??K,K=s("yaml")??K,o&&(K=s("ts")??K),n.resolve(t,K)}(r,t);const s=n.extname(o);let u;switch(s){case".js":u=G(o);break;case".json":return G(o);case".yaml":return i(e.readFileSync(o,"utf-8"));case".ts":if(P){G(P),u=G(o);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":u={};break;default:throw new Error(`unsupported config file type: ${s}`)}if(!u)throw new Error("config file is empty");return u.default??u}const F=t(import.meta.url);a.command("build").option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").option("-v, --verbose","Display debug logs.").action((async({silent:t,entries:r,verbose:o})=>{M();const{build:s}=U();t=t??s?.silent??!1;const{wd:a,value:i={}}=await O()??{};if(0===Object.keys(i).length)throw new Error("no package found");const u=n.resolve(a,"node_modules");e.existsSync(u)||e.mkdirSync(u);const p=(...e)=>n.resolve(u,".jiek",...e);e.existsSync(p())||e.mkdirSync(p());const g=F.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup"),d=new l({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {input} | {message}"},c.shades_classic);let h=0;await Promise.all(Object.entries(i).map((async([n,s])=>{const i=s.name?.replace(/^@/g,"").replace(/\//g,"+"),u=p(`${i??"anonymous-"+h++}.rollup.config.js`);e.writeFileSync(u,(e=>`\nmodule.exports = require('jiek/rollup').template(${JSON.stringify(e,null,2)})\n`.trimStart())(s));let l="";P&&(l=`node -r ${P} `);const c=f(`${l}${g} --silent -c ${u}`,{ipc:!0,cwd:n,env:{...process.env,JIEK_ROOT:a,JIEK_ENTRIES:r}}),A={};let R=10;c.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!t&&c.on("message",(e=>{if("init"===e.type){const{leafMap:t,targetsLength:n}=e.data,r=Array.from(t.entries()).flatMap((([e,t])=>t.map((([t,...n])=>({input:e,path:t,conditions:n})))));console.log(`Package '${s.name}' has ${n} targets to build`),r.forEach((({input:e})=>{R=Math.max(R,e.length)})),r.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;A[n]||(A[n]=d.create(50,0,{input:e.padEnd(R),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:n,input:r,event:o,message:s}=e.data,a=A[`${r}:${t}`];if(!a)return;a.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:r.padEnd(R),status:o?.padEnd(10),message:`${n?.join(", ")}: ${s}`})}})),await new Promise(((e,t)=>{let n="";c.stderr?.on("data",(e=>{n+=e})),c.once("exit",(r=>0===r?e():t(new Error(`rollup build failed:\n${n}`)))),o&&c.stdout?.pipe(process.stdout)}))}))).finally((()=>{d.stop()})),I()}));var Q,W,X,q,Z,J,Y,z,V,ee,te,ne,re,oe,se,ae,ie,ue,pe,le={};function ce(){return Q||(Q=1,function(e){e.isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,o)=>!1!==o&&(!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=o),e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>"brace"===e.type&&(!(e.commas>>0+e.ranges)&&(e.invalid=!0,!0)),e.isInvalidBrace=e=>"brace"===e.type&&(!(!0!==e.invalid&&!e.dollar)||(e.commas>>0+e.ranges?(!0!==e.open||!0!==e.close)&&(e.invalid=!0,!0):(e.invalid=!0,!0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||(!0===e.open||!0===e.close),e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let o=e[r];Array.isArray(o)?n(o):void 0!==o&&t.push(o)}return t};return n(e),t}}(le)),le}function fe(){if(X)return W;X=1;const e=ce();return W=(t,n={})=>{let r=(t,o={})=>{let s=n.escapeInvalid&&e.isInvalidBrace(o),a=!0===t.invalid&&!0===n.escapeInvalid,i="";if(t.value)return(s||a)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)i+=r(e);return i};return r(t)}}
2
2
  /*!
3
3
  * is-number <https://github.com/jonschlinkert/is-number>
4
4
  *
@@ -10,10 +10,10 @@ var json = require('@rollup/plugin-json');
10
10
  var pluginNodeResolve = require('@rollup/plugin-node-resolve');
11
11
  var terser = require('@rollup/plugin-terser');
12
12
  var execa = require('execa');
13
- var esbuild = require('rollup-plugin-esbuild');
14
- var ts = require('typescript');
15
13
  var require$$0 = require('util');
16
14
  var require$$0$1 = require('path');
15
+ var esbuild = require('rollup-plugin-esbuild');
16
+ var ts = require('typescript');
17
17
  var node_module = require('node:module');
18
18
  var commander = require('commander');
19
19
  var jsYaml = require('js-yaml');
@@ -28,20 +28,10 @@ var path__default = /*#__PURE__*/_interopDefault(path);
28
28
  var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
29
29
  var json__default = /*#__PURE__*/_interopDefault(json);
30
30
  var terser__default = /*#__PURE__*/_interopDefault(terser);
31
- var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
32
- var ts__default = /*#__PURE__*/_interopDefault(ts);
33
31
  var require$$0__default = /*#__PURE__*/_interopDefault(require$$0);
34
32
  var require$$0__default$1 = /*#__PURE__*/_interopDefault(require$$0$1);
35
-
36
- const recusiveListFiles = (dir) => fs__default.default.readdirSync(dir).reduce((acc, file) => {
37
- const filePath = path.resolve(dir, file);
38
- if (fs__default.default.statSync(filePath).isDirectory()) {
39
- if (filePath.endsWith("/node_modules"))
40
- return acc;
41
- return [...acc, ...recusiveListFiles(filePath)];
42
- }
43
- return [...acc, filePath];
44
- }, []);
33
+ var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
34
+ var ts__default = /*#__PURE__*/_interopDefault(ts);
45
35
 
46
36
  var utils$1 = {};
47
37
 
@@ -4149,6 +4139,16 @@ function requireMicromatch () {
4149
4139
 
4150
4140
  var micromatchExports = requireMicromatch();
4151
4141
 
4142
+ const recusiveListFiles = (dir) => fs__default.default.readdirSync(dir).reduce((acc, file) => {
4143
+ const filePath = path.resolve(dir, file);
4144
+ if (fs__default.default.statSync(filePath).isDirectory()) {
4145
+ if (filePath.endsWith("/node_modules"))
4146
+ return acc;
4147
+ return [...acc, ...recusiveListFiles(filePath)];
4148
+ }
4149
+ return [...acc, filePath];
4150
+ }, []);
4151
+
4152
4152
  const intersection = (a, b) => new Set([...a].filter((i) => b.has(i)));
4153
4153
  function getExports({
4154
4154
  entrypoints: entrypoints$1,
@@ -4591,8 +4591,14 @@ const generateConfigs = (context, options = {}) => {
4591
4591
  'input should not include "**", please read the [documentation](https://nodejs.org/api/packages.html#subpath-patterns).'
4592
4592
  );
4593
4593
  }
4594
- const inputObj = !input.includes("*") ? input : recusiveListFiles(process.cwd()).filter((p) => /(?<!\.d)\.[cm]?tsx?$/.test(p));
4595
- const globCommonDir = input.includes("*") ? input.split("*")[0] : "";
4594
+ const inputObj = !input.includes("*") ? input : recusiveListFiles(process.cwd()).filter((p) => /(?<!\.d)\.[cm]?tsx?$/.test(p)).map((p) => path.relative(process.cwd(), p)).filter((p) => micromatchExports.isMatch(p, input.slice(2)));
4595
+ const globCommonDir = input.includes("*") ? input.split("*")[0].replace("./", "") : "";
4596
+ const pathCommonDir = path$1.includes("*") ? path$1.split("*")[0].replace("./", "") : "";
4597
+ if (globCommonDir.length > 0 && pathCommonDir.length === 0 || globCommonDir.length === 0 && pathCommonDir.length > 0) {
4598
+ throw new Error('input and path should both include "*" or not include "*"');
4599
+ }
4600
+ const jsOutputSuffix = path.extname(output);
4601
+ const tsOutputSuffix = jsOutputSuffix.replace(/(\.[cm]?)js$/, ".d$1ts");
4596
4602
  return [
4597
4603
  {
4598
4604
  input: inputObj,
@@ -4602,7 +4608,7 @@ const generateConfigs = (context, options = {}) => {
4602
4608
  dir: jsOutdir,
4603
4609
  name,
4604
4610
  interop: "auto",
4605
- entryFileNames: (chunkInfo) => Array.isArray(inputObj) ? chunkInfo.facadeModuleId.replace(`${process.cwd()}/`, "./").replace(globCommonDir, "").replace(/(\.[cm]?)ts$/, "$1js") : output.replace(`${jsOutdir}/`, ""),
4611
+ entryFileNames: (chunkInfo) => Array.isArray(inputObj) ? chunkInfo.facadeModuleId.replace(`${process.cwd()}/`, "").replace(globCommonDir, pathCommonDir).replace(/(\.[cm]?)ts$/, jsOutputSuffix) : output.replace(`${jsOutdir}/`, ""),
4606
4612
  sourcemap: typeof options?.output?.sourcemap === "object" ? options.output.sourcemap.js : options?.output?.sourcemap,
4607
4613
  format: isModule ? "esm" : isCommonJS ? "cjs" : isBrowser ? "umd" : pkgIsModule ? "esm" : "cjs",
4608
4614
  strict: typeof options?.output?.strict === "object" ? options.output.strict.js : options?.output?.strict
@@ -4638,7 +4644,7 @@ const generateConfigs = (context, options = {}) => {
4638
4644
  {
4639
4645
  dir: path.resolve((typeof outdir === "object" ? outdir.dts : outdir) ?? "dist"),
4640
4646
  sourcemap: typeof options?.output?.sourcemap === "object" ? options.output.sourcemap.dts : options?.output?.sourcemap,
4641
- entryFileNames: (chunkInfo) => Array.isArray(inputObj) ? chunkInfo.facadeModuleId.replace(`${process.cwd()}/`, "./").replace(globCommonDir, "").replace(/(\.[cm]?)ts$/, ".d$1ts") : output.replace(`${jsOutdir}/`, "").replace(/(\.[cm]?)js$/, ".d$1ts"),
4647
+ entryFileNames: (chunkInfo) => Array.isArray(inputObj) ? chunkInfo.facadeModuleId.replace(`${process.cwd()}/`, "").replace(globCommonDir, pathCommonDir).replace(/(\.[cm]?)ts$/, tsOutputSuffix) : output.replace(`${jsOutdir}/`, "").replace(/(\.[cm]?)js$/, tsOutputSuffix),
4642
4648
  strict: typeof options?.output?.strict === "object" ? options.output.strict.dts : options?.output?.strict
4643
4649
  }
4644
4650
  ],
@@ -4647,7 +4653,13 @@ const generateConfigs = (context, options = {}) => {
4647
4653
  skip({ patterns: [STYLE_REGEXP] }),
4648
4654
  rollupPluginDts.dts({
4649
4655
  respectExternal: true,
4650
- compilerOptions
4656
+ compilerOptions: {
4657
+ ...compilerOptions,
4658
+ // temp directory, it not affect the output
4659
+ // but if the user not set it and `declaration`, inputs can't generate any dts files when the input relative imports of `package.json`
4660
+ outDir: "dist",
4661
+ declaration: true
4662
+ }
4651
4663
  }),
4652
4664
  progress({
4653
4665
  onEvent: (event, message) => execa.sendMessage(
@@ -1,5 +1,5 @@
1
1
  import fs from 'node:fs';
2
- import path, { resolve, relative, dirname } from 'node:path';
2
+ import path, { resolve, relative, dirname, extname } from 'node:path';
3
3
  import { resolveEntrypoints, filterLeafs, DEFAULT_SKIP_VALUES, entrypoints2Exports, getAllLeafs } from '@jiek/pkger/entrypoints';
4
4
  import { dts } from '@jiek/rollup-plugin-dts';
5
5
  import { isWorkspaceDir, getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
@@ -8,26 +8,16 @@ import json from '@rollup/plugin-json';
8
8
  import { nodeResolve } from '@rollup/plugin-node-resolve';
9
9
  import terser from '@rollup/plugin-terser';
10
10
  import { sendMessage } from 'execa';
11
- import esbuild from 'rollup-plugin-esbuild';
12
- import ts from 'typescript';
13
11
  import require$$0 from 'util';
14
12
  import require$$0$1 from 'path';
13
+ import esbuild from 'rollup-plugin-esbuild';
14
+ import ts from 'typescript';
15
15
  import { createRequire } from 'node:module';
16
16
  import { program } from 'commander';
17
17
  import { load } from 'js-yaml';
18
18
  import '@pnpm/filter-workspace-packages';
19
19
  import { parse } from 'jsonc-parser';
20
20
 
21
- const recusiveListFiles = (dir) => fs.readdirSync(dir).reduce((acc, file) => {
22
- const filePath = resolve(dir, file);
23
- if (fs.statSync(filePath).isDirectory()) {
24
- if (filePath.endsWith("/node_modules"))
25
- return acc;
26
- return [...acc, ...recusiveListFiles(filePath)];
27
- }
28
- return [...acc, filePath];
29
- }, []);
30
-
31
21
  var utils$1 = {};
32
22
 
33
23
  var hasRequiredUtils$1;
@@ -4134,6 +4124,16 @@ function requireMicromatch () {
4134
4124
 
4135
4125
  var micromatchExports = requireMicromatch();
4136
4126
 
4127
+ const recusiveListFiles = (dir) => fs.readdirSync(dir).reduce((acc, file) => {
4128
+ const filePath = resolve(dir, file);
4129
+ if (fs.statSync(filePath).isDirectory()) {
4130
+ if (filePath.endsWith("/node_modules"))
4131
+ return acc;
4132
+ return [...acc, ...recusiveListFiles(filePath)];
4133
+ }
4134
+ return [...acc, filePath];
4135
+ }, []);
4136
+
4137
4137
  const intersection = (a, b) => new Set([...a].filter((i) => b.has(i)));
4138
4138
  function getExports({
4139
4139
  entrypoints,
@@ -4576,8 +4576,14 @@ const generateConfigs = (context, options = {}) => {
4576
4576
  'input should not include "**", please read the [documentation](https://nodejs.org/api/packages.html#subpath-patterns).'
4577
4577
  );
4578
4578
  }
4579
- const inputObj = !input.includes("*") ? input : recusiveListFiles(process.cwd()).filter((p) => /(?<!\.d)\.[cm]?tsx?$/.test(p));
4580
- const globCommonDir = input.includes("*") ? input.split("*")[0] : "";
4579
+ const inputObj = !input.includes("*") ? input : recusiveListFiles(process.cwd()).filter((p) => /(?<!\.d)\.[cm]?tsx?$/.test(p)).map((p) => relative(process.cwd(), p)).filter((p) => micromatchExports.isMatch(p, input.slice(2)));
4580
+ const globCommonDir = input.includes("*") ? input.split("*")[0].replace("./", "") : "";
4581
+ const pathCommonDir = path.includes("*") ? path.split("*")[0].replace("./", "") : "";
4582
+ if (globCommonDir.length > 0 && pathCommonDir.length === 0 || globCommonDir.length === 0 && pathCommonDir.length > 0) {
4583
+ throw new Error('input and path should both include "*" or not include "*"');
4584
+ }
4585
+ const jsOutputSuffix = extname(output);
4586
+ const tsOutputSuffix = jsOutputSuffix.replace(/(\.[cm]?)js$/, ".d$1ts");
4581
4587
  return [
4582
4588
  {
4583
4589
  input: inputObj,
@@ -4587,7 +4593,7 @@ const generateConfigs = (context, options = {}) => {
4587
4593
  dir: jsOutdir,
4588
4594
  name,
4589
4595
  interop: "auto",
4590
- entryFileNames: (chunkInfo) => Array.isArray(inputObj) ? chunkInfo.facadeModuleId.replace(`${process.cwd()}/`, "./").replace(globCommonDir, "").replace(/(\.[cm]?)ts$/, "$1js") : output.replace(`${jsOutdir}/`, ""),
4596
+ entryFileNames: (chunkInfo) => Array.isArray(inputObj) ? chunkInfo.facadeModuleId.replace(`${process.cwd()}/`, "").replace(globCommonDir, pathCommonDir).replace(/(\.[cm]?)ts$/, jsOutputSuffix) : output.replace(`${jsOutdir}/`, ""),
4591
4597
  sourcemap: typeof options?.output?.sourcemap === "object" ? options.output.sourcemap.js : options?.output?.sourcemap,
4592
4598
  format: isModule ? "esm" : isCommonJS ? "cjs" : isBrowser ? "umd" : pkgIsModule ? "esm" : "cjs",
4593
4599
  strict: typeof options?.output?.strict === "object" ? options.output.strict.js : options?.output?.strict
@@ -4623,7 +4629,7 @@ const generateConfigs = (context, options = {}) => {
4623
4629
  {
4624
4630
  dir: resolve((typeof outdir === "object" ? outdir.dts : outdir) ?? "dist"),
4625
4631
  sourcemap: typeof options?.output?.sourcemap === "object" ? options.output.sourcemap.dts : options?.output?.sourcemap,
4626
- entryFileNames: (chunkInfo) => Array.isArray(inputObj) ? chunkInfo.facadeModuleId.replace(`${process.cwd()}/`, "./").replace(globCommonDir, "").replace(/(\.[cm]?)ts$/, ".d$1ts") : output.replace(`${jsOutdir}/`, "").replace(/(\.[cm]?)js$/, ".d$1ts"),
4632
+ entryFileNames: (chunkInfo) => Array.isArray(inputObj) ? chunkInfo.facadeModuleId.replace(`${process.cwd()}/`, "").replace(globCommonDir, pathCommonDir).replace(/(\.[cm]?)ts$/, tsOutputSuffix) : output.replace(`${jsOutdir}/`, "").replace(/(\.[cm]?)js$/, tsOutputSuffix),
4627
4633
  strict: typeof options?.output?.strict === "object" ? options.output.strict.dts : options?.output?.strict
4628
4634
  }
4629
4635
  ],
@@ -4632,7 +4638,13 @@ const generateConfigs = (context, options = {}) => {
4632
4638
  skip({ patterns: [STYLE_REGEXP] }),
4633
4639
  dts({
4634
4640
  respectExternal: true,
4635
- compilerOptions
4641
+ compilerOptions: {
4642
+ ...compilerOptions,
4643
+ // temp directory, it not affect the output
4644
+ // but if the user not set it and `declaration`, inputs can't generate any dts files when the input relative imports of `package.json`
4645
+ outDir: "dist",
4646
+ declaration: true
4647
+ }
4636
4648
  }),
4637
4649
  progress({
4638
4650
  onEvent: (event, message) => sendMessage(
@@ -1,19 +1,19 @@
1
- "use strict";var e=require("node:fs"),t=require("node:path"),r=require("@jiek/pkger/entrypoints"),n=require("@jiek/rollup-plugin-dts"),o=require("@jiek/utils/getWorkspaceDir"),s=require("@rollup/plugin-commonjs"),a=require("@rollup/plugin-json"),u=require("@rollup/plugin-node-resolve"),i=require("@rollup/plugin-terser"),l=require("execa"),p=require("rollup-plugin-esbuild"),c=require("typescript"),f=require("util"),d=require("path"),g=require("node:module"),h=require("commander"),A=require("js-yaml");require("@pnpm/filter-workspace-packages");var R=require("jsonc-parser"),y="undefined"!=typeof document?document.currentScript:null;function E(e){return e&&e.__esModule?e:{default:e}}var _=E(e),m=E(t),C=E(s),v=E(a),S=E(i),b=E(p),x=E(c),$=E(f),H=E(d);const w=e=>_.default.readdirSync(e).reduce(((r,n)=>{const o=t.resolve(e,n);return _.default.statSync(o).isDirectory()?o.endsWith("/node_modules")?r:[...r,...w(o)]:[...r,o]}),[]);var T,L,O,k,N,I,M,j,B,P,U,D,G,F,K,q,Q,W,X,Z={};function Y(){return T||(T=1,function(e){e.isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,r,n=1,o)=>!1!==o&&(!(!e.isInteger(t)||!e.isInteger(r))&&(Number(r)-Number(t))/Number(n)>=o),e.escapeNode=(e,t=0,r)=>{let n=e.nodes[t];n&&(r&&n.type===r||"open"===n.type||"close"===n.type)&&!0!==n.escaped&&(n.value="\\"+n.value,n.escaped=!0)},e.encloseBrace=e=>"brace"===e.type&&(!(e.commas>>0+e.ranges)&&(e.invalid=!0,!0)),e.isInvalidBrace=e=>"brace"===e.type&&(!(!0!==e.invalid&&!e.dollar)||(e.commas>>0+e.ranges?(!0!==e.open||!0!==e.close)&&(e.invalid=!0,!0):(e.invalid=!0,!0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||(!0===e.open||!0===e.close),e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],r=e=>{for(let n=0;n<e.length;n++){let o=e[n];Array.isArray(o)?r(o):void 0!==o&&t.push(o)}return t};return r(e),t}}(Z)),Z}function V(){if(O)return L;O=1;const e=Y();return L=(t,r={})=>{let n=(t,o={})=>{let s=r.escapeInvalid&&e.isInvalidBrace(o),a=!0===t.invalid&&!0===r.escapeInvalid,u="";if(t.value)return(s||a)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)u+=n(e);return u};return n(t)}}
1
+ "use strict";var e=require("node:fs"),t=require("node:path"),r=require("@jiek/pkger/entrypoints"),n=require("@jiek/rollup-plugin-dts"),o=require("@jiek/utils/getWorkspaceDir"),s=require("@rollup/plugin-commonjs"),a=require("@rollup/plugin-json"),u=require("@rollup/plugin-node-resolve"),i=require("@rollup/plugin-terser"),l=require("execa"),p=require("util"),c=require("path"),f=require("rollup-plugin-esbuild"),d=require("typescript"),g=require("node:module"),h=require("commander"),A=require("js-yaml");require("@pnpm/filter-workspace-packages");var R=require("jsonc-parser"),y="undefined"!=typeof document?document.currentScript:null;function E(e){return e&&e.__esModule?e:{default:e}}var _,m,C,v,S,b,x,$,H,w,T,L,O,k,N,I,M,j,B,P=E(e),U=E(t),D=E(s),G=E(a),F=E(i),K=E(p),q=E(c),Q=E(f),W=E(d),X={};function Z(){return _||(_=1,function(e){e.isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,r,n=1,o)=>!1!==o&&(!(!e.isInteger(t)||!e.isInteger(r))&&(Number(r)-Number(t))/Number(n)>=o),e.escapeNode=(e,t=0,r)=>{let n=e.nodes[t];n&&(r&&n.type===r||"open"===n.type||"close"===n.type)&&!0!==n.escaped&&(n.value="\\"+n.value,n.escaped=!0)},e.encloseBrace=e=>"brace"===e.type&&(!(e.commas>>0+e.ranges)&&(e.invalid=!0,!0)),e.isInvalidBrace=e=>"brace"===e.type&&(!(!0!==e.invalid&&!e.dollar)||(e.commas>>0+e.ranges?(!0!==e.open||!0!==e.close)&&(e.invalid=!0,!0):(e.invalid=!0,!0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||(!0===e.open||!0===e.close),e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],r=e=>{for(let n=0;n<e.length;n++){let o=e[n];Array.isArray(o)?r(o):void 0!==o&&t.push(o)}return t};return r(e),t}}(X)),X}function Y(){if(C)return m;C=1;const e=Z();return m=(t,r={})=>{let n=(t,o={})=>{let s=r.escapeInvalid&&e.isInvalidBrace(o),a=!0===t.invalid&&!0===r.escapeInvalid,u="";if(t.value)return(s||a)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)u+=n(e);return u};return n(t)}}
2
2
  /*!
3
3
  * is-number <https://github.com/jonschlinkert/is-number>
4
4
  *
5
5
  * Copyright (c) 2014-present, Jon Schlinkert.
6
6
  * Released under the MIT License.
7
- */function z(){return N?k:(N=1,k=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.trim()&&(Number.isFinite?Number.isFinite(+e):isFinite(+e))})}
7
+ */function V(){return S?v:(S=1,v=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.trim()&&(Number.isFinite?Number.isFinite(+e):isFinite(+e))})}
8
8
  /*!
9
9
  * to-regex-range <https://github.com/micromatch/to-regex-range>
10
10
  *
11
11
  * Copyright (c) 2015-present, Jon Schlinkert.
12
12
  * Released under the MIT License.
13
- */function J(){if(M)return I;M=1;const e=z(),t=(r,s,a)=>{if(!1===e(r))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===s||r===s)return String(r);if(!1===e(s))throw new TypeError("toRegexRange: expected the second argument to be a number.");let u={relaxZeros:!0,...a};"boolean"==typeof u.strictZeros&&(u.relaxZeros=!1===u.strictZeros);let i=r+":"+s+"="+String(u.relaxZeros)+String(u.shorthand)+String(u.capture)+String(u.wrap);if(t.cache.hasOwnProperty(i))return t.cache[i].result;let l=Math.min(r,s),p=Math.max(r,s);if(1===Math.abs(l-p)){let e=r+"|"+s;return u.capture?`(${e})`:!1===u.wrap?e:`(?:${e})`}let f=c(r)||c(s),d={min:r,max:s,a:l,b:p},g=[],h=[];if(f&&(d.isPadded=f,d.maxLen=String(d.max).length),l<0){h=n(p<0?Math.abs(p):1,Math.abs(l),d,u),l=d.a=0}return p>=0&&(g=n(l,p,d,u)),d.negatives=h,d.positives=g,d.result=function(e,t,r){let n=o(e,t,"-",!1)||[],s=o(t,e,"",!1)||[],a=o(e,t,"-?",!0)||[];return n.concat(a).concat(s).join("|")}(h,g),!0===u.capture?d.result=`(${d.result})`:!1!==u.wrap&&g.length+h.length>1&&(d.result=`(?:${d.result})`),t.cache[i]=d,d.result};function r(e,t,r){if(e===t)return{pattern:e,count:[],digits:0};let n=function(e,t){let r=[];for(let n=0;n<e.length;n++)r.push([e[n],t[n]]);return r}(e,t),o=n.length,s="",a=0;for(let e=0;e<o;e++){let[t,r]=n[e];t===r?s+=t:"0"!==t||"9"!==r?s+=p(t,r):a++}return a&&(s+=!0===r.shorthand?"\\d":"[0-9]"),{pattern:s,count:[a],digits:o}}function n(e,t,n,o){let a,p=function(e,t){let r=1,n=1,o=u(e,r),a=new Set([t]);for(;e<=o&&o<=t;)a.add(o),r+=1,o=u(e,r);for(o=i(t+1,n)-1;e<o&&o<=t;)a.add(o),n+=1,o=i(t+1,n)-1;return a=[...a],a.sort(s),a}(e,t),c=[],d=e;for(let e=0;e<p.length;e++){let t=p[e],s=r(String(d),String(t),o),u="";n.isPadded||!a||a.pattern!==s.pattern?(n.isPadded&&(u=f(t,n,o)),s.string=u+s.pattern+l(s.count),c.push(s),d=t+1,a=s):(a.count.length>1&&a.count.pop(),a.count.push(s.count[0]),a.string=a.pattern+l(a.count),d=t+1)}return c}function o(e,t,r,n,o){let s=[];for(let o of e){let{string:e}=o;n||a(t,"string",e)||s.push(r+e),n&&a(t,"string",e)&&s.push(r+e)}return s}function s(e,t){return e>t?1:t>e?-1:0}function a(e,t,r){return e.some((e=>e[t]===r))}function u(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function i(e,t){return e-e%Math.pow(10,t)}function l(e){let[t=0,r=""]=e;return r||t>1?`{${t+(r?","+r:"")}}`:""}function p(e,t,r){return`[${e}${t-e==1?"":"-"}${t}]`}function c(e){return/^-?(0+)\d/.test(e)}function f(e,t,r){if(!t.isPadded)return e;let n=Math.abs(t.maxLen-String(e).length),o=!1!==r.relaxZeros;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}return t.cache={},t.clearCache=()=>t.cache={},I=t}
13
+ */function z(){if(x)return b;x=1;const e=V(),t=(r,s,a)=>{if(!1===e(r))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===s||r===s)return String(r);if(!1===e(s))throw new TypeError("toRegexRange: expected the second argument to be a number.");let u={relaxZeros:!0,...a};"boolean"==typeof u.strictZeros&&(u.relaxZeros=!1===u.strictZeros);let i=r+":"+s+"="+String(u.relaxZeros)+String(u.shorthand)+String(u.capture)+String(u.wrap);if(t.cache.hasOwnProperty(i))return t.cache[i].result;let l=Math.min(r,s),p=Math.max(r,s);if(1===Math.abs(l-p)){let e=r+"|"+s;return u.capture?`(${e})`:!1===u.wrap?e:`(?:${e})`}let f=c(r)||c(s),d={min:r,max:s,a:l,b:p},g=[],h=[];if(f&&(d.isPadded=f,d.maxLen=String(d.max).length),l<0){h=n(p<0?Math.abs(p):1,Math.abs(l),d,u),l=d.a=0}return p>=0&&(g=n(l,p,d,u)),d.negatives=h,d.positives=g,d.result=function(e,t,r){let n=o(e,t,"-",!1)||[],s=o(t,e,"",!1)||[],a=o(e,t,"-?",!0)||[];return n.concat(a).concat(s).join("|")}(h,g),!0===u.capture?d.result=`(${d.result})`:!1!==u.wrap&&g.length+h.length>1&&(d.result=`(?:${d.result})`),t.cache[i]=d,d.result};function r(e,t,r){if(e===t)return{pattern:e,count:[],digits:0};let n=function(e,t){let r=[];for(let n=0;n<e.length;n++)r.push([e[n],t[n]]);return r}(e,t),o=n.length,s="",a=0;for(let e=0;e<o;e++){let[t,r]=n[e];t===r?s+=t:"0"!==t||"9"!==r?s+=p(t,r):a++}return a&&(s+=!0===r.shorthand?"\\d":"[0-9]"),{pattern:s,count:[a],digits:o}}function n(e,t,n,o){let a,p=function(e,t){let r=1,n=1,o=u(e,r),a=new Set([t]);for(;e<=o&&o<=t;)a.add(o),r+=1,o=u(e,r);for(o=i(t+1,n)-1;e<o&&o<=t;)a.add(o),n+=1,o=i(t+1,n)-1;return a=[...a],a.sort(s),a}(e,t),c=[],d=e;for(let e=0;e<p.length;e++){let t=p[e],s=r(String(d),String(t),o),u="";n.isPadded||!a||a.pattern!==s.pattern?(n.isPadded&&(u=f(t,n,o)),s.string=u+s.pattern+l(s.count),c.push(s),d=t+1,a=s):(a.count.length>1&&a.count.pop(),a.count.push(s.count[0]),a.string=a.pattern+l(a.count),d=t+1)}return c}function o(e,t,r,n,o){let s=[];for(let o of e){let{string:e}=o;n||a(t,"string",e)||s.push(r+e),n&&a(t,"string",e)&&s.push(r+e)}return s}function s(e,t){return e>t?1:t>e?-1:0}function a(e,t,r){return e.some((e=>e[t]===r))}function u(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function i(e,t){return e-e%Math.pow(10,t)}function l(e){let[t=0,r=""]=e;return r||t>1?`{${t+(r?","+r:"")}}`:""}function p(e,t,r){return`[${e}${t-e==1?"":"-"}${t}]`}function c(e){return/^-?(0+)\d/.test(e)}function f(e,t,r){if(!t.isPadded)return e;let n=Math.abs(t.maxLen-String(e).length),o=!1!==r.relaxZeros;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}return t.cache={},t.clearCache=()=>t.cache={},b=t}
14
14
  /*!
15
15
  * fill-range <https://github.com/jonschlinkert/fill-range>
16
16
  *
17
17
  * Copyright (c) 2014-present, Jon Schlinkert.
18
18
  * Licensed under the MIT License.
19
- */function ee(){if(B)return j;B=1;const e=$.default,t=J(),r=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),n=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,r=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++r];);return r>0},a=(e,t,r)=>{if(t>0){let r="-"===e[0]?"-":"";r&&(e=e.slice(1)),e=r+e.padStart(r?t-1:t,"0")}return!1===r?String(e):e},u=(e,t)=>{let r="-"===e[0]?"-":"";for(r&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return r?"-"+e:e},i=(e,r,n,o)=>{if(n)return t(e,r,{wrap:!1,...o});let s=String.fromCharCode(e);return e===r?s:`[${s}-${String.fromCharCode(r)}]`},l=(e,r,n)=>{if(Array.isArray(e)){let t=!0===n.wrap,r=n.capture?"":"?:";return t?`(${r}${e.join("|")})`:e.join("|")}return t(e,r,n)},p=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,r)=>{if(!0===r.strictRanges)throw p([e,t]);return[]},f=(e,t,r=1,n={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===n.strictRanges)throw p([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,d=String(e),g=String(t),h=String(r);r=Math.max(Math.abs(r),1);let A=s(d)||s(g)||s(h),R=A?Math.max(d.length,g.length,h.length):0,y=!1===A&&!1===((e,t,r)=>"string"==typeof e||"string"==typeof t||!0===r.stringify)(e,t,n),E=n.transform||(e=>t=>!0===e?Number(t):String(t))(y);if(n.toRegex&&1===r)return i(u(e,R),u(t,R),!0,n);let _={negatives:[],positives:[]},m=[],C=0;for(;f?o>=c:o<=c;)!0===n.toRegex&&r>1?_[(v=o)<0?"negatives":"positives"].push(Math.abs(v)):m.push(a(E(o,C),R,y)),o=f?o-r:o+r,C++;var v;return!0===n.toRegex?r>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let r,n=t.capture?"":"?:",o="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${n}${e.negatives.join("|")})`),r=o&&s?`${o}|${s}`:o||s,t.wrap?`(${n}${r})`:r})(_,n):l(m,null,{wrap:!1,...n}):m},d=(e,t,s,a={})=>{if(null==t&&n(e))return[e];if(!n(e)||!n(t))return c(e,t,a);if("function"==typeof s)return d(e,t,1,{transform:s});if(r(s))return d(e,t,0,s);let u={...a};return!0===u.capture&&(u.wrap=!0),s=s||u.step||1,o(s)?o(e)&&o(t)?f(e,t,s,u):((e,t,r=1,n={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,n);let s=n.transform||(e=>String.fromCharCode(e)),a=`${e}`.charCodeAt(0),u=`${t}`.charCodeAt(0),p=a>u,f=Math.min(a,u),d=Math.max(a,u);if(n.toRegex&&1===r)return i(f,d,!1,n);let g=[],h=0;for(;p?a>=u:a<=u;)g.push(s(a,h)),a=p?a-r:a+r,h++;return!0===n.toRegex?l(g,null,{wrap:!1,options:n}):g})(e,t,Math.max(Math.abs(s),1),u):null==s||r(s)?d(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,u)};return j=d}function te(){if(Q)return q;Q=1;const e=V(),{MAX_LENGTH:t,CHAR_BACKSLASH:r,CHAR_BACKTICK:n,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:a,CHAR_RIGHT_PARENTHESES:u,CHAR_LEFT_CURLY_BRACE:i,CHAR_RIGHT_CURLY_BRACE:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:d,CHAR_NO_BREAK_SPACE:g,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=K?F:(K=1,F={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return q=(A,R={})=>{if("string"!=typeof A)throw new TypeError("Expected a string");let y=R||{},E="number"==typeof y.maxLength?Math.min(t,y.maxLength):t;if(A.length>E)throw new SyntaxError(`Input length (${A.length}), exceeds max characters (${E})`);let _,m={type:"root",input:A,nodes:[]},C=[m],v=m,S=m,b=0,x=A.length,$=0,H=0;const w=()=>A[$++],T=e=>{if("text"===e.type&&"dot"===S.type&&(S.type="text"),!S||"text"!==S.type||"text"!==e.type)return v.nodes.push(e),e.parent=v,e.prev=S,S=e,e;S.value+=e.value};for(T({type:"bos"});$<x;)if(v=C[C.length-1],_=w(),_!==h&&_!==g)if(_!==r)if(_!==c)if(_!==p)if(_!==a)if(_!==u)if(_!==f&&_!==d&&_!==n)if(_!==i)if(_!==l)if(_===o&&H>0){if(v.ranges>0){v.ranges=0;let t=v.nodes.shift();v.nodes=[t,{type:"text",value:e(v)}]}T({type:"comma",value:_}),v.commas++}else if(_===s&&H>0&&0===v.commas){let e=v.nodes;if(0===H||0===e.length){T({type:"text",value:_});continue}if("dot"===S.type){if(v.range=[],S.value+=_,S.type="range",3!==v.nodes.length&&5!==v.nodes.length){v.invalid=!0,v.ranges=0,S.type="text";continue}v.ranges++,v.args=[];continue}if("range"===S.type){e.pop();let t=e[e.length-1];t.value+=S.value+_,S=t,v.ranges--;continue}T({type:"dot",value:_})}else T({type:"text",value:_});else{if("brace"!==v.type){T({type:"text",value:_});continue}let e="close";v=C.pop(),v.close=!0,T({type:e,value:_}),H--,v=C[C.length-1]}else{H++;let e=S.value&&"$"===S.value.slice(-1)||!0===v.dollar;v=T({type:"brace",open:!0,close:!1,dollar:e,depth:H,commas:0,ranges:0,nodes:[]}),C.push(v),T({type:"open",value:_})}else{let e,t=_;for(!0!==R.keepQuotes&&(_="");$<x&&(e=w());)if(e!==r){if(e===t){!0===R.keepQuotes&&(_+=e);break}_+=e}else _+=e+w();T({type:"text",value:_})}else{if("paren"!==v.type){T({type:"text",value:_});continue}v=C.pop(),T({type:"text",value:_}),v=C[C.length-1]}else v=T({type:"paren",nodes:[]}),C.push(v),T({type:"text",value:_});else{let e;for(b++;$<x&&(e=w());)if(_+=e,e!==p)if(e!==r){if(e===c&&(b--,0===b))break}else _+=w();else b++;T({type:"text",value:_})}else T({type:"text",value:"\\"+_});else T({type:"text",value:(R.keepEscaping?_:"")+w()});do{if(v=C.pop(),"root"!==v.type){v.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=C[C.length-1],t=e.nodes.indexOf(v);e.nodes.splice(t,1,...v.nodes)}}while(C.length>0);return T({type:"eos"}),m},q}function re(){if(X)return W;X=1;const e=V(),t=function(){if(U)return P;U=1;const e=ee(),t=Y();return P=(r,n={})=>{let o=(r,s={})=>{let a=t.isInvalidBrace(s),u=!0===r.invalid&&!0===n.escapeInvalid,i=!0===a||!0===u,l=!0===n.escapeInvalid?"\\":"",p="";if(!0===r.isOpen)return l+r.value;if(!0===r.isClose)return l+r.value;if("open"===r.type)return i?l+r.value:"(";if("close"===r.type)return i?l+r.value:")";if("comma"===r.type)return"comma"===r.prev.type?"":i?r.value:"|";if(r.value)return r.value;if(r.nodes&&r.ranges>0){let o=t.reduce(r.nodes),s=e(...o,{...n,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(r.nodes)for(let e of r.nodes)p+=o(e,r);return p};return o(r)}}(),r=function(){if(G)return D;G=1;const e=ee(),t=V(),r=Y(),n=(e="",t="",o=!1)=>{let s=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?r.flatten(t).map((e=>`{${e}}`)):t;for(let r of e)if(Array.isArray(r))for(let e of r)s.push(n(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?n(r,e,o):r+e);return r.flatten(s)};return D=(o,s={})=>{let a=void 0===s.rangeLimit?1e3:s.rangeLimit,u=(o,i={})=>{o.queue=[];let l=i,p=i.queue;for(;"brace"!==l.type&&"root"!==l.type&&l.parent;)l=l.parent,p=l.queue;if(o.invalid||o.dollar)return void p.push(n(p.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void p.push(n(p.pop(),["{}"]));if(o.nodes&&o.ranges>0){let u=r.reduce(o.nodes);if(r.exceedsLimit(...u,s.step,a))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let i=e(...u,s);return 0===i.length&&(i=t(o,s)),p.push(n(p.pop(),i)),void(o.nodes=[])}let c=r.encloseBrace(o),f=o.queue,d=o;for(;"brace"!==d.type&&"root"!==d.type&&d.parent;)d=d.parent,f=d.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(n(f.pop(),t.value)):t.nodes&&u(t,o):p.push(n(p.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return r.flatten(u(o))}}(),n=te(),o=(e,t={})=>{let r=[];if(Array.isArray(e))for(let n of e){let e=o.create(n,t);Array.isArray(e)?r.push(...e):r.push(e)}else r=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(r=[...new Set(r)]),r};return o.parse=(e,t={})=>n(e,t),o.stringify=(t,r={})=>e("string"==typeof t?o.parse(t,r):t,r),o.compile=(e,r={})=>("string"==typeof e&&(e=o.parse(e,r)),t(e,r)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let n=r(e,t);return!0===t.noempty&&(n=n.filter(Boolean)),!0===t.nodupes&&(n=[...new Set(n)]),n},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),W=o}var ne,oe,se,ae,ue,ie,le,pe,ce,fe,de,ge,he,Ae={};function Re(){if(oe)return ne;oe=1;const e=H.default,t="\\\\/",r=`[^${t}]`,n="\\.",o="\\/",s="[^/]",a=`(?:${o}|$)`,u=`(?:^|${o})`,i=`${n}{1,2}${a}`,l={DOT_LITERAL:n,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:a,DOTS_SLASH:i,NO_DOT:`(?!${n})`,NO_DOTS:`(?!${u}${i})`,NO_DOT_SLASH:`(?!${n}{0,1}${a})`,NO_DOTS_SLASH:`(?!${i})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:u},p={...l,SLASH_LITERAL:`[${t}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${n}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${n})`,NO_DOTS:`(?!(?:^|[${t}])${n}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${n}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return ne={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?p:l}}function ye(){return se||(se=1,function(e){const t=H.default,r="win32"===process.platform,{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:a}=Re();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(a,"\\$1"),e.toPosixSlashes=e=>e.replace(n,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===r||"\\"===t.sep,e.escapeLast=(t,r,n)=>{const o=t.lastIndexOf(r,n);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,r,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let r=e;return r.startsWith("./")&&(r=r.slice(2),t.prefix="./"),r},e.wrapOutput=(e,t={},r={})=>{let n=`${r.contains?"":"^"}(?:${e})${r.contains?"":"$"}`;return!0===t.negated&&(n=`(?:^(?!${n}).*$)`),n}}(Ae)),Ae}function Ee(){if(ce)return pe;ce=1;const e=H.default,t=function(){if(ue)return ae;ue=1;const e=ye(),{CHAR_ASTERISK:t,CHAR_AT:r,CHAR_BACKWARD_SLASH:n,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:i,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:d,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:h}=Re(),A=e=>e===u||e===n,R=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return ae=(y,E)=>{const _=E||{},m=y.length-1,C=!0===_.parts||!0===_.scanToEnd,v=[],S=[],b=[];let x,$,H=y,w=-1,T=0,L=0,O=!1,k=!1,N=!1,I=!1,M=!1,j=!1,B=!1,P=!1,U=!1,D=!1,G=0,F={value:"",depth:0,isGlob:!1};const K=()=>w>=m,q=()=>(x=$,H.charCodeAt(++w));for(;w<m;){let e;if($=q(),$!==n){if(!0===j||$===i){for(G++;!0!==K()&&($=q());)if($!==n)if($!==i){if(!0!==j&&$===s&&($=q())===s){if(O=F.isBrace=!0,N=F.isGlob=!0,D=!0,!0===C)continue;break}if(!0!==j&&$===o){if(O=F.isBrace=!0,N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===d&&(G--,0===G)){j=!1,O=F.isBrace=!0,D=!0;break}}else G++;else B=F.backslashes=!0,q();if(!0===C)continue;break}if($!==u){if(!0!==_.noext&&!0==($===c||$===r||$===t||$===f||$===a)&&H.charCodeAt(w+1)===l){if(N=F.isGlob=!0,I=F.isExtglob=!0,D=!0,$===a&&w===T&&(U=!0),!0===C){for(;!0!==K()&&($=q());)if($!==n){if($===g){N=F.isGlob=!0,D=!0;break}}else B=F.backslashes=!0,$=q();continue}break}if($===t){if(x===t&&(M=F.isGlobstar=!0),N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===f){if(N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===p){for(;!0!==K()&&(e=q());)if(e!==n){if(e===h){k=F.isBracket=!0,N=F.isGlob=!0,D=!0;break}}else B=F.backslashes=!0,q();if(!0===C)continue;break}if(!0===_.nonegate||$!==a||w!==T){if(!0!==_.noparen&&$===l){if(N=F.isGlob=!0,!0===C){for(;!0!==K()&&($=q());)if($!==l){if($===g){D=!0;break}}else B=F.backslashes=!0,$=q();continue}break}if(!0===N){if(D=!0,!0===C)continue;break}}else P=F.negated=!0,T++}else{if(v.push(w),S.push(F),F={value:"",depth:0,isGlob:!1},!0===D)continue;if(x===s&&w===T+1){T+=2;continue}L=w+1}}else B=F.backslashes=!0,$=q(),$===i&&(j=!0)}!0===_.noext&&(I=!1,N=!1);let Q=H,W="",X="";T>0&&(W=H.slice(0,T),H=H.slice(T),L-=T),Q&&!0===N&&L>0?(Q=H.slice(0,L),X=H.slice(L)):!0===N?(Q="",X=H):Q=H,Q&&""!==Q&&"/"!==Q&&Q!==H&&A(Q.charCodeAt(Q.length-1))&&(Q=Q.slice(0,-1)),!0===_.unescape&&(X&&(X=e.removeBackslashes(X)),Q&&!0===B&&(Q=e.removeBackslashes(Q)));const Z={prefix:W,input:y,start:T,base:Q,glob:X,isBrace:O,isBracket:k,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:U};if(!0===_.tokens&&(Z.maxDepth=0,A($)||S.push(F),Z.tokens=S),!0===_.parts||!0===_.tokens){let e;for(let t=0;t<v.length;t++){const r=e?e+1:T,n=v[t],o=y.slice(r,n);_.tokens&&(0===t&&0!==T?(S[t].isPrefix=!0,S[t].value=W):S[t].value=o,R(S[t]),Z.maxDepth+=S[t].depth),0===t&&""===o||b.push(o),e=n}if(e&&e+1<y.length){const t=y.slice(e+1);b.push(t),_.tokens&&(S[S.length-1].value=t,R(S[S.length-1]),Z.maxDepth+=S[S.length-1].depth)}Z.slashes=v,Z.parts=b}return Z}}(),r=function(){if(le)return ie;le=1;const e=Re(),t=ye(),{MAX_LENGTH:r,POSIX_REGEX_SOURCE:n,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=e,u=(e,r)=>{if("function"==typeof r.expandRange)return r.expandRange(...e,r);e.sort();const n=`[${e.join("-")}]`;try{new RegExp(n)}catch(r){return e.map((e=>t.escapeRegex(e))).join("..")}return n},i=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,l=(p,c)=>{if("string"!=typeof p)throw new TypeError("Expected a string");p=a[p]||p;const f={...c},d="number"==typeof f.maxLength?Math.min(r,f.maxLength):r;let g=p.length;if(g>d)throw new SyntaxError(`Input length: ${g}, exceeds maximum allowed length: ${d}`);const h={type:"bos",value:"",output:f.prepend||""},A=[h],R=f.capture?"":"?:",y=t.isWindows(c),E=e.globChars(y),_=e.extglobChars(E),{DOT_LITERAL:m,PLUS_LITERAL:C,SLASH_LITERAL:v,ONE_CHAR:S,DOTS_SLASH:b,NO_DOT:x,NO_DOT_SLASH:$,NO_DOTS_SLASH:H,QMARK:w,QMARK_NO_DOT:T,STAR:L,START_ANCHOR:O}=E,k=e=>`(${R}(?:(?!${O}${e.dot?b:m}).)*?)`,N=f.dot?"":x,I=f.dot?w:T;let M=!0===f.bash?k(f):L;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const j={input:p,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:A};p=t.removePrefix(p,j),g=p.length;const B=[],P=[],U=[];let D,G=h;const F=()=>j.index===g-1,K=j.peek=(e=1)=>p[j.index+e],q=j.advance=()=>p[++j.index]||"",Q=()=>p.slice(j.index+1),W=(e="",t=0)=>{j.consumed+=e,j.index+=t},X=e=>{j.output+=null!=e.output?e.output:e.value,W(e.value)},Z=()=>{let e=1;for(;"!"===K()&&("("!==K(2)||"?"===K(3));)q(),j.start++,e++;return e%2!=0&&(j.negated=!0,j.start++,!0)},Y=e=>{j[e]++,U.push(e)},V=e=>{j[e]--,U.pop()},z=e=>{if("globstar"===G.type){const t=j.braces>0&&("comma"===e.type||"brace"===e.type),r=!0===e.extglob||B.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||r||(j.output=j.output.slice(0,-G.output.length),G.type="star",G.value="*",G.output=M,j.output+=G.output)}if(B.length&&"paren"!==e.type&&(B[B.length-1].inner+=e.value),(e.value||e.output)&&X(e),G&&"text"===G.type&&"text"===e.type)return G.value+=e.value,void(G.output=(G.output||"")+e.value);e.prev=G,A.push(e),G=e},J=(e,t)=>{const r={..._[t],conditions:1,inner:""};r.prev=G,r.parens=j.parens,r.output=j.output;const n=(f.capture?"(":"")+r.open;Y("parens"),z({type:e,value:t,output:j.output?"":S}),z({type:"paren",extglob:!0,value:q(),output:n}),B.push(r)},ee=e=>{let t,r=e.close+(f.capture?")":"");if("negate"===e.type){let n=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(n=k(f)),(n!==M||F()||/^\)+$/.test(Q()))&&(r=e.close=`)$))${n}`),e.inner.includes("*")&&(t=Q())&&/^\.[^\\/.]+$/.test(t)){const o=l(t,{...c,fastpaths:!1}).output;r=e.close=`)${o})${n})`}"bos"===e.prev.type&&(j.negatedExtglob=!0)}z({type:"paren",extglob:!0,value:D,output:r}),V("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(p)){let e=!1,r=p.replace(s,((t,r,n,o,s,a)=>"\\"===o?(e=!0,t):"?"===o?r?r+o+(s?w.repeat(s.length):""):0===a?I+(s?w.repeat(s.length):""):w.repeat(n.length):"."===o?m.repeat(n.length):"*"===o?r?r+o+(s?M:""):M:r?t:`\\${t}`));return!0===e&&(r=!0===f.unescape?r.replace(/\\/g,""):r.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),r===p&&!0===f.contains?(j.output=p,j):(j.output=t.wrapOutput(r,j,c),j)}for(;!F();){if(D=q(),"\0"===D)continue;if("\\"===D){const e=K();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){D+="\\",z({type:"text",value:D});continue}const t=/^\\+/.exec(Q());let r=0;if(t&&t[0].length>2&&(r=t[0].length,j.index+=r,r%2!=0&&(D+="\\")),!0===f.unescape?D=q():D+=q(),0===j.brackets){z({type:"text",value:D});continue}}if(j.brackets>0&&("]"!==D||"["===G.value||"[^"===G.value)){if(!1!==f.posix&&":"===D){const e=G.value.slice(1);if(e.includes("[")&&(G.posix=!0,e.includes(":"))){const e=G.value.lastIndexOf("["),t=G.value.slice(0,e),r=G.value.slice(e+2),o=n[r];if(o){G.value=t+o,j.backtrack=!0,q(),h.output||1!==A.indexOf(G)||(h.output=S);continue}}}("["===D&&":"!==K()||"-"===D&&"]"===K())&&(D=`\\${D}`),"]"!==D||"["!==G.value&&"[^"!==G.value||(D=`\\${D}`),!0===f.posix&&"!"===D&&"["===G.value&&(D="^"),G.value+=D,X({value:D});continue}if(1===j.quotes&&'"'!==D){D=t.escapeRegex(D),G.value+=D,X({value:D});continue}if('"'===D){j.quotes=1===j.quotes?0:1,!0===f.keepQuotes&&z({type:"text",value:D});continue}if("("===D){Y("parens"),z({type:"paren",value:D});continue}if(")"===D){if(0===j.parens&&!0===f.strictBrackets)throw new SyntaxError(i("opening","("));const e=B[B.length-1];if(e&&j.parens===e.parens+1){ee(B.pop());continue}z({type:"paren",value:D,output:j.parens?")":"\\)"}),V("parens");continue}if("["===D){if(!0!==f.nobracket&&Q().includes("]"))Y("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(i("closing","]"));D=`\\${D}`}z({type:"bracket",value:D});continue}if("]"===D){if(!0===f.nobracket||G&&"bracket"===G.type&&1===G.value.length){z({type:"text",value:D,output:`\\${D}`});continue}if(0===j.brackets){if(!0===f.strictBrackets)throw new SyntaxError(i("opening","["));z({type:"text",value:D,output:`\\${D}`});continue}V("brackets");const e=G.value.slice(1);if(!0===G.posix||"^"!==e[0]||e.includes("/")||(D=`/${D}`),G.value+=D,X({value:D}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const r=t.escapeRegex(G.value);if(j.output=j.output.slice(0,-G.value.length),!0===f.literalBrackets){j.output+=r,G.value=r;continue}G.value=`(${R}${r}|${G.value})`,j.output+=G.value;continue}if("{"===D&&!0!==f.nobrace){Y("braces");const e={type:"brace",value:D,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};P.push(e),z(e);continue}if("}"===D){const e=P[P.length-1];if(!0===f.nobrace||!e){z({type:"text",value:D,output:D});continue}let t=")";if(!0===e.dots){const e=A.slice(),r=[];for(let t=e.length-1;t>=0&&(A.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&r.unshift(e[t].value);t=u(r,f),j.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const r=j.output.slice(0,e.outputIndex),n=j.tokens.slice(e.tokensIndex);e.value=e.output="\\{",D=t="\\}",j.output=r;for(const e of n)j.output+=e.output||e.value}z({type:"brace",value:D,output:t}),V("braces"),P.pop();continue}if("|"===D){B.length>0&&B[B.length-1].conditions++,z({type:"text",value:D});continue}if(","===D){let e=D;const t=P[P.length-1];t&&"braces"===U[U.length-1]&&(t.comma=!0,e="|"),z({type:"comma",value:D,output:e});continue}if("/"===D){if("dot"===G.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",A.pop(),G=h;continue}z({type:"slash",value:D,output:v});continue}if("."===D){if(j.braces>0&&"dot"===G.type){"."===G.value&&(G.output=m);const e=P[P.length-1];G.type="dots",G.output+=D,G.value+=D,e.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==G.type&&"slash"!==G.type){z({type:"text",value:D,output:m});continue}z({type:"dot",value:D,output:m});continue}if("?"===D){if((!G||"("!==G.value)&&!0!==f.noextglob&&"("===K()&&"?"!==K(2)){J("qmark",D);continue}if(G&&"paren"===G.type){const e=K();let r=D;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===G.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(Q()))&&(r=`\\${D}`),z({type:"text",value:D,output:r});continue}if(!0!==f.dot&&("slash"===G.type||"bos"===G.type)){z({type:"qmark",value:D,output:T});continue}z({type:"qmark",value:D,output:w});continue}if("!"===D){if(!0!==f.noextglob&&"("===K()&&("?"!==K(2)||!/[!=<:]/.test(K(3)))){J("negate",D);continue}if(!0!==f.nonegate&&0===j.index){Z();continue}}if("+"===D){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){J("plus",D);continue}if(G&&"("===G.value||!1===f.regex){z({type:"plus",value:D,output:C});continue}if(G&&("bracket"===G.type||"paren"===G.type||"brace"===G.type)||j.parens>0){z({type:"plus",value:D});continue}z({type:"plus",value:C});continue}if("@"===D){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){z({type:"at",extglob:!0,value:D,output:""});continue}z({type:"text",value:D});continue}if("*"!==D){"$"!==D&&"^"!==D||(D=`\\${D}`);const e=o.exec(Q());e&&(D+=e[0],j.index+=e[0].length),z({type:"text",value:D});continue}if(G&&("globstar"===G.type||!0===G.star)){G.type="star",G.star=!0,G.value+=D,G.output=M,j.backtrack=!0,j.globstar=!0,W(D);continue}let e=Q();if(!0!==f.noextglob&&/^\([^?]/.test(e)){J("star",D);continue}if("star"===G.type){if(!0===f.noglobstar){W(D);continue}const t=G.prev,r=t.prev,n="slash"===t.type||"bos"===t.type,o=r&&("star"===r.type||"globstar"===r.type);if(!0===f.bash&&(!n||e[0]&&"/"!==e[0])){z({type:"star",value:D,output:""});continue}const s=j.braces>0&&("comma"===t.type||"brace"===t.type),a=B.length&&("pipe"===t.type||"paren"===t.type);if(!n&&"paren"!==t.type&&!s&&!a){z({type:"star",value:D,output:""});continue}for(;"/**"===e.slice(0,3);){const t=p[j.index+4];if(t&&"/"!==t)break;e=e.slice(3),W("/**",3)}if("bos"===t.type&&F()){G.type="globstar",G.value+=D,G.output=k(f),j.output=G.output,j.globstar=!0,W(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&F()){j.output=j.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=k(f)+(f.strictSlashes?")":"|$)"),G.value+=D,j.globstar=!0,j.output+=t.output+G.output,W(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const r=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=`${k(f)}${v}|${v}${r})`,G.value+=D,j.output+=t.output+G.output,j.globstar=!0,W(D+q()),z({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){G.type="globstar",G.value+=D,G.output=`(?:^|${v}|${k(f)}${v})`,j.output=G.output,j.globstar=!0,W(D+q()),z({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-G.output.length),G.type="globstar",G.output=k(f),G.value+=D,j.output+=G.output,j.globstar=!0,W(D);continue}const r={type:"star",value:D,output:M};!0!==f.bash?!G||"bracket"!==G.type&&"paren"!==G.type||!0!==f.regex?(j.index!==j.start&&"slash"!==G.type&&"dot"!==G.type||("dot"===G.type?(j.output+=$,G.output+=$):!0===f.dot?(j.output+=H,G.output+=H):(j.output+=N,G.output+=N),"*"!==K()&&(j.output+=S,G.output+=S)),z(r)):(r.output=D,z(r)):(r.output=".*?","bos"!==G.type&&"slash"!==G.type||(r.output=N+r.output),z(r))}for(;j.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(i("closing","]"));j.output=t.escapeLast(j.output,"["),V("brackets")}for(;j.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(i("closing",")"));j.output=t.escapeLast(j.output,"("),V("parens")}for(;j.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(i("closing","}"));j.output=t.escapeLast(j.output,"{"),V("braces")}if(!0===f.strictSlashes||"star"!==G.type&&"bracket"!==G.type||z({type:"maybe_slash",value:"",output:`${v}?`}),!0===j.backtrack){j.output="";for(const e of j.tokens)j.output+=null!=e.output?e.output:e.value,e.suffix&&(j.output+=e.suffix)}return j};return l.fastpaths=(n,o)=>{const s={...o},u="number"==typeof s.maxLength?Math.min(r,s.maxLength):r,i=n.length;if(i>u)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${u}`);n=a[n]||n;const l=t.isWindows(o),{DOT_LITERAL:p,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:d,NO_DOT:g,NO_DOTS:h,NO_DOTS_SLASH:A,STAR:R,START_ANCHOR:y}=e.globChars(l),E=s.dot?h:g,_=s.dot?A:g,m=s.capture?"":"?:";let C=!0===s.bash?".*?":R;s.capture&&(C=`(${C})`);const v=e=>!0===e.noglobstar?C:`(${m}(?:(?!${y}${e.dot?d:p}).)*?)`,S=e=>{switch(e){case"*":return`${E}${f}${C}`;case".*":return`${p}${f}${C}`;case"*.*":return`${E}${C}${p}${f}${C}`;case"*/*":return`${E}${C}${c}${f}${_}${C}`;case"**":return E+v(s);case"**/*":return`(?:${E}${v(s)}${c})?${_}${f}${C}`;case"**/*.*":return`(?:${E}${v(s)}${c})?${_}${C}${p}${f}${C}`;case"**/.*":return`(?:${E}${v(s)}${c})?${p}${f}${C}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const r=S(t[1]);if(!r)return;return r+p+t[2]}}},b=t.removePrefix(n,{negated:!1,prefix:""});let x=S(b);return x&&!0!==s.strictSlashes&&(x+=`${c}?`),x},ie=l}(),n=ye(),o=Re(),s=(e,t,r=!1)=>{if(Array.isArray(e)){const n=e.map((e=>s(e,t,r))),o=e=>{for(const t of n){const r=t(e);if(r)return r}return!1};return o}const o=(a=e)&&"object"==typeof a&&!Array.isArray(a)&&e.tokens&&e.input;var a;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const u=t||{},i=n.isWindows(t),l=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),p=l.state;delete l.state;let c=()=>!1;if(u.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(u.ignore,e,r)}const f=(r,n=!1)=>{const{isMatch:o,match:a,output:f}=s.test(r,l,t,{glob:e,posix:i}),d={glob:e,state:p,regex:l,posix:i,input:r,output:f,match:a,isMatch:o};return"function"==typeof u.onResult&&u.onResult(d),!1===o?(d.isMatch=!1,!!n&&d):c(r)?("function"==typeof u.onIgnore&&u.onIgnore(d),d.isMatch=!1,!!n&&d):("function"==typeof u.onMatch&&u.onMatch(d),!n||d)};return r&&(f.state=p),f};return s.test=(e,t,r,{glob:o,posix:a}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const u=r||{},i=u.format||(a?n.toPosixSlashes:null);let l=e===o,p=l&&i?i(e):e;return!1===l&&(p=i?i(e):e,l=p===o),!1!==l&&!0!==u.capture||(l=!0===u.matchBase||!0===u.basename?s.matchBase(e,t,r,a):t.exec(p)),{isMatch:Boolean(l),match:l,output:p}},s.matchBase=(t,r,o,a=n.isWindows(o))=>(r instanceof RegExp?r:s.makeRe(r,o)).test(e.basename(t)),s.isMatch=(e,t,r)=>s(t,r)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):r(e,{...t,fastpaths:!1}),s.scan=(e,r)=>t(e,r),s.compileRe=(e,t,r=!1,n=!1)=>{if(!0===r)return e.output;const o=t||{},a=o.contains?"":"^",u=o.contains?"":"$";let i=`${a}(?:${e.output})${u}`;e&&!0===e.negated&&(i=`^(?!${i}).*$`);const l=s.toRegex(i,t);return!0===n&&(l.state=e),l},s.makeRe=(e,t={},n=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,o)},s.toRegex=(e,t)=>{try{const r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},s.constants=o,pe=s}function _e(){return de?fe:(de=1,fe=Ee())}var me=function(){if(he)return ge;he=1;const e=$.default,t=re(),r=_e(),n=ye(),o=e=>""===e||"./"===e,s=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,a=new Set,u=0,i=e=>{a.add(e.output),n&&n.onResult&&n.onResult(e)};for(let a=0;a<t.length;a++){let l=r(String(t[a]),{...n,onResult:i},!0),p=l.state.negated||l.state.negatedExtglob;p&&u++;for(let t of e){let e=l(t,!0);(p?!e.isMatch:e.isMatch)&&(p?o.add(e.output):(o.delete(e.output),s.add(e.output)))}}let l=(u===t.length?[...a]:[...s]).filter((e=>!o.has(e)));if(n&&0===l.length){if(!0===n.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===n.nonull||!0===n.nullglob)return n.unescape?t.map((e=>e.replace(/\\/g,""))):t}return l};return s.match=s,s.matcher=(e,t)=>r(e,t),s.any=s.isMatch=(e,t,n)=>r(t,n)(e),s.not=(e,t,r={})=>{t=[].concat(t).map(String);let n=new Set,o=[],a=new Set(s(e,t,{...r,onResult:e=>{r.onResult&&r.onResult(e),o.push(e.output)}}));for(let e of o)a.has(e)||n.add(e);return[...n]},s.contains=(t,r,n)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(r))return r.some((e=>s.contains(t,e,n)));if("string"==typeof r){if(o(t)||o(r))return!1;if(t.includes(r)||t.startsWith("./")&&t.slice(2).includes(r))return!0}return s.isMatch(t,r,{...n,contains:!0})},s.matchKeys=(e,t,r)=>{if(!n.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,r),a={};for(let t of o)a[t]=e[t];return a},s.some=(e,t,n)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=r(String(e),n);if(o.some((e=>t(e))))return!0}return!1},s.every=(e,t,n)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=r(String(e),n);if(!o.every((e=>t(e))))return!1}return!0},s.all=(t,n,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(n).every((e=>r(e,o)(t)))},s.capture=(e,t,o)=>{let s=n.isWindows(o),a=r.makeRe(String(e),{...o,capture:!0}).exec(s?n.toPosixSlashes(t):t);if(a)return a.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>r.makeRe(...e),s.scan=(...e)=>r.scan(...e),s.parse=(e,n)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),n))o.push(r.parse(e,n));return o},s.braces=(e,r)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return r&&!0===r.nobrace||!/\{.*\}/.test(e)?[e]:t(e,r)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},ge=s}();const Ce=(e,t)=>new Set([...e].filter((e=>t.has(e))));let ve;function Se(){if(ve)return ve;const e=h.program.getOptionValue("root");return ve=e?m.default.isAbsolute(e)?e:m.default.resolve(process.cwd(),e):void 0,ve}let be,xe="";try{g.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:y&&y.src||new URL("rollup/index.min.cjs",document.baseURI).href).resolve("@pnpm/filter-workspace-packages"),xe="pnpm"}catch{}""!==xe&&h.program.option("-f, --filter <filter>","filter packages");let $e=!1;const He=g.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:y&&y.src||new URL("rollup/index.min.cjs",document.baseURI).href);function we(e){try{return He.resolve(e),!0}catch(e){return!1}}let Te;const Le=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of Le)if(we(e)){Te=e;break}const Oe=g.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:y&&y.src||new URL("rollup/index.min.cjs",document.baseURI).href);let ke="jiek.config";const Ne=e=>{e=t.resolve(e);const r=t.dirname(e),{extends:n,...o}=(s=e,_.default.existsSync(s)&&_.default.statSync(s).isFile()?R.parse(_.default.readFileSync(s,"utf-8"),[],{allowTrailingComma:!0,allowEmptyContent:!0}):{});var s;const a=(u=n?Array.isArray(n)?n:[n]:[],u?.map((e=>t.resolve(r,e)))??[]);var u;return 0===a.length?o:a.map(Ne).concat(o).reduce(((e,{compilerOptions:t={},references:r,...n})=>({...e,...n,compilerOptions:{...e.compilerOptions,...t}})),{})},Ie=(e,r)=>{e=t.resolve(e),r=t.resolve(r);const n=t.dirname(e),o=Ne(e),[s,a,u,i]=[o.references?.map((({path:e})=>e)),o.files,o.include,o.exclude].map((e=>e?.map((e=>t.resolve(n,e)))??[]));if(i.length>0&&i.some((e=>me.isMatch(r,e))))return;if(0===o.files?.length&&0===o.include?.length)return;let l=!1;if(l||(l=a.length>0&&a.includes(r)),l||(l=u.length>0&&u.some((e=>me.isMatch(r,e)))),l)return o.compilerOptions??{};if(!(o.files&&o.files.length>0||o.include&&o.include.length>0)){s.reverse();for(const e of s){const t=Ie(e,r);if(t)return t}return o.compilerOptions}};var Me=(e={})=>{const{onEvent:t}=e;return{name:"progress",buildStart:()=>t?.("start","Start building..."),buildEnd:()=>t?.("end","Build completed!"),resolveId:{order:"post",handler:e=>t?.("resolve",`Resolving ${e}...`)},load:{order:"post",handler:e=>t?.("load",`Loading ${e}...`)},transform:{order:"post",handler:(e,r)=>t?.("transform",`Transforming ${r}...`)}}},je=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const Be=["te?xt","json","(css|s[ac]ss|less|styl)"];const{JIEK_ROOT:Pe,JIEK_ENTRIES:Ue}=process.env,De=Pe??o.getWorkspaceDir(),Ge={},Fe=[v.default()],Ke=function(e){const{wd:t}=function(){if(be)return{wd:be,notWorkspace:$e};const e=Se();if(void 0!==e){const t=o.isWorkspaceDir(e,xe);return $e=!t,be=e,{wd:be,notWorkspace:$e}}try{be=o.getWorkspaceDir(xe)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;be=e,$e=!0}return{wd:be,notWorkspace:$e}}();let r=h.program.getOptionValue("configPath");if(r){if(!_.default.existsSync(r))throw new Error(`config file not found: ${r}`);m.default.isAbsolute(r)||(r=m.default.resolve(t,r))}else r=function(e,t){const r=!!Te;function n(r){const n=[m.default.resolve(process.cwd(),`${ke}.${r}`),m.default.resolve(process.cwd(),`.${ke}.${r}`),m.default.resolve(e,`${ke}.${r}`),m.default.resolve(e,`.${ke}.${r}`)];t&&n.unshift(m.default.resolve(t,`${ke}.${r}`),m.default.resolve(t,`.${ke}.${r}`));for(const e of n)if(_.default.existsSync(e)&&_.default.lstatSync(e).isFile())return e}return ke=n("js")??ke,ke=n("json")??ke,ke=n("yaml")??ke,r&&(ke=n("ts")??ke),m.default.resolve(e,ke)}(t,e);const n=m.default.extname(r);let s;switch(n){case".js":s=Oe(r);break;case".json":return Oe(r);case".yaml":return A.load(_.default.readFileSync(r,"utf-8"));case".ts":if(Te){Oe(Te),s=Oe(r);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":s={};break;default:throw new Error(`unsupported config file type: ${n}`)}if(!s)throw new Error("config file is empty");return s.default??s}()??{},{build:qe={}}=Ke,Qe=`./${t.relative(process.cwd(),t.resolve(("object"==typeof qe?.output?.dir?qe.output.dir.js:qe?.output?.dir)??"dist"))}`,We=/\.(css|s[ac]ss|less|styl)$/,Xe=e=>t.resolve(De,e),Ze=e=>e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())).replace(/(?:^|-)(\w)/g,((e,t)=>t.toUpperCase())),Ye=(e,t=qe?.output?.minify)=>!1===t?[e]:"only-minify"===t?[{...e,entryFileNames:t=>"function"==typeof e.entryFileNames?e.entryFileNames(t).replace(/(\.[cm]?js)$/,".min$1"):(()=>{throw new Error("entryFileNames must be a function")})(),plugins:[...e.plugins??[],S.default()]}]:[e,{...e,entryFileNames:t=>"function"==typeof e.entryFileNames?e.entryFileNames(t).replace(/(\.[cm]?js)$/,".min$1"):(()=>{throw new Error("entryFileNames must be a function")})(),file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],S.default()]}],Ve=(e,r={})=>{const{path:o,name:s,input:a,output:i,external:p,pkgIsModule:c,conditionals:f}=e,d=f.includes("import"),g=f.includes("require"),h=f.includes("browser");let A;[Xe("tsconfig.json"),Xe("tsconfig.dts.json")].forEach((e=>{_.default.existsSync(e)&&_.default.statSync(e).isFile()&&(A=e)}));let R={};if(A){const e=Ie(A,t.resolve(a)),{options:r,errors:n}=x.default.convertCompilerOptionsFromJson(e,t.dirname(A));if(n.length>0)throw new Error(n.map((e=>e.messageText)).join("\n"));R=r,delete R.composite}const y=[...f,...R.customConditions??[]],E={type:"progress",data:{name:s,path:o,exportConditions:y,input:a}},m=r?.output?.dir,{js:v,dts:S}=((e,t)=>{if(!1===t||null==t)return{js:[],dts:[]};let r=[],n=[];switch(typeof t){case"function":r=t("js",e),n=t("dts",e);break;case"object":"js"in t||"dts"in t?(r=t.js??[],n=t.dts??[]):(r=t,n=t)}return{js:r,dts:n}})(e,qe.plugins);if(a.includes("**"))throw new Error('input should not include "**", please read the [documentation](https://nodejs.org/api/packages.html#subpath-patterns).');const $=a.includes("*")?w(process.cwd()).filter((e=>/(?<!\.d)\.[cm]?tsx?$/.test(e))):a,H=a.includes("*")?a.split("*")[0]:"";return[{input:$,external:p,output:[...Ye({dir:Qe,name:s,interop:"auto",entryFileNames:e=>Array.isArray($)?e.facadeModuleId.replace(`${process.cwd()}/`,"./").replace(H,"").replace(/(\.[cm]?)ts$/,"$1js"):i.replace(`${Qe}/`,""),sourcemap:"object"==typeof r?.output?.sourcemap?r.output.sourcemap.js:r?.output?.sourcemap,format:d?"esm":g?"cjs":h?"umd":c?"esm":"cjs",strict:"object"==typeof r?.output?.strict?r.output.strict.js:r?.output?.strict})],plugins:[u.nodeResolve({exportConditions:y}),import("rollup-plugin-postcss").then((({default:e})=>e({extract:t.resolve(i.replace(/\.[cm]?js$/,".css")),minimize:!0}))).catch((()=>{})),b.default({tsconfig:A}),C.default(),Me({onEvent:(e,t)=>l.sendMessage({...E,data:{...E.data,event:e,message:t,tags:["js"]}})}),v]},{input:$,external:p,output:[{dir:t.resolve(("object"==typeof m?m.dts:m)??"dist"),sourcemap:"object"==typeof r?.output?.sourcemap?r.output.sourcemap.dts:r?.output?.sourcemap,entryFileNames:e=>Array.isArray($)?e.facadeModuleId.replace(`${process.cwd()}/`,"./").replace(H,"").replace(/(\.[cm]?)ts$/,".d$1ts"):i.replace(`${Qe}/`,"").replace(/(\.[cm]?)js$/,".d$1ts"),strict:"object"==typeof r?.output?.strict?r.output.strict.dts:r?.output?.strict}],plugins:[u.nodeResolve({exportConditions:y}),je({patterns:[We]}),n.dts({respectExternal:!0,compilerOptions:R}),Me({onEvent:(e,t)=>l.sendMessage({...E,data:{...E.data,event:e,message:t,tags:["dts"]}})}),S]}]};exports.template=function(e){const{name:n,type:o,exports:s}=e,a="module"===o;if(!n)throw new Error("package.json name is required");if(!s)throw new Error("package.json exports is required");const u=Ue?.split(",").map((e=>e.trim())).map((e=>({index:"."}[e]??e))),i=Ze(n),p=function(e=process.cwd()){const t="string"==typeof e?_.default.existsSync(`${e}/package.json`)?JSON.parse(_.default.readFileSync(`${e}/package.json`,"utf-8")):{}:e,{name:r,dependencies:n={},peerDependencies:o={},optionalDependencies:s={}}=t;if(!r)throw new Error("package.json must have a name field");return Object.keys(n).concat(Object.keys(o)).concat(Object.keys(s)).map((e=>new RegExp(`^${e}(/.*)?$`))).concat([new RegExp(`^${r}(/.*)?(?<!${Be.map((e=>`\\.${e}`)).join("|")})$`),/^node:/])}(e),[c,f]=function({entrypoints:e,pkgIsModule:n,entries:o,config:s,dir:a,noFilter:u,isPublish:i}){const{build:l={},publish:{withSuffix:p=!1,withSource:c=!0}={}}=s??{},{crossModuleConvertor:f=!0}=l,d=`./${g=((...e)=>t.resolve(a??process.cwd(),...e))(("object"==typeof l?.output?.dir?l.output.dir.js:l?.output?.dir)??"dist"),t.relative(a??process.cwd(),g)}`;var g;const[,h]=r.resolveEntrypoints(e);o&&Object.entries(h).forEach((([e])=>{o.some((t=>me.isMatch(e,t,{matchBase:!0})))||delete h[e]}));const A=u?h:r.filterLeafs(h,{skipValue:[/(^|\/)\.jk-noentry/,...r.DEFAULT_SKIP_VALUES]}),R=f?{import:e=>!n&&0===Ce(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!n||0!==Ce(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[A,r.entrypoints2Exports(A,{outdir:d,withSuffix:i?p:void 0,withSource:i?c:void 0,withConditional:{...R}})]}({entrypoints:s,pkgIsModule:a,entries:u,config:Ke}),d=new Map;r.getAllLeafs(c,(({keys:e,value:t})=>{if("string"==typeof t){const r=d.get(t)??[];d.set(t,r),r.push(e)}return!1}));const g=[];return d.forEach(((e,t)=>e.forEach((e=>{const[n,...o]=e,s=i+("."===n?"":Ze(n)),u=((e,t)=>t.reduce(((e,t)=>{if("string"==typeof e)throw new Error("key not found in exports");if(!(t in e))throw new Error(`key ${t} not found in exports`);return e[t]}),e))(f,e),l={path:n,name:s,input:t,external:p,pkgIsModule:a};switch(typeof u){case"string":g.push(...Ve({...l,output:u,conditionals:o},qe));break;case"object":r.getAllLeafs(u,(({keys:e,value:t})=>{const r=[...new Set([...o,...e])];return"string"==typeof t&&g.push(...Ve({...l,output:t,conditionals:r},qe)),!1}))}})))),l.sendMessage({type:"init",data:{leafMap:d,targetsLength:g.length}}),g.map((e=>({...Ge,...e,plugins:[...Fe,e.plugins]})))};
19
+ */function J(){if(H)return $;H=1;const e=K.default,t=z(),r=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),n=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,r=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++r];);return r>0},a=(e,t,r)=>{if(t>0){let r="-"===e[0]?"-":"";r&&(e=e.slice(1)),e=r+e.padStart(r?t-1:t,"0")}return!1===r?String(e):e},u=(e,t)=>{let r="-"===e[0]?"-":"";for(r&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return r?"-"+e:e},i=(e,r,n,o)=>{if(n)return t(e,r,{wrap:!1,...o});let s=String.fromCharCode(e);return e===r?s:`[${s}-${String.fromCharCode(r)}]`},l=(e,r,n)=>{if(Array.isArray(e)){let t=!0===n.wrap,r=n.capture?"":"?:";return t?`(${r}${e.join("|")})`:e.join("|")}return t(e,r,n)},p=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,r)=>{if(!0===r.strictRanges)throw p([e,t]);return[]},f=(e,t,r=1,n={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===n.strictRanges)throw p([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,d=String(e),g=String(t),h=String(r);r=Math.max(Math.abs(r),1);let A=s(d)||s(g)||s(h),R=A?Math.max(d.length,g.length,h.length):0,y=!1===A&&!1===((e,t,r)=>"string"==typeof e||"string"==typeof t||!0===r.stringify)(e,t,n),E=n.transform||(e=>t=>!0===e?Number(t):String(t))(y);if(n.toRegex&&1===r)return i(u(e,R),u(t,R),!0,n);let _={negatives:[],positives:[]},m=[],C=0;for(;f?o>=c:o<=c;)!0===n.toRegex&&r>1?_[(v=o)<0?"negatives":"positives"].push(Math.abs(v)):m.push(a(E(o,C),R,y)),o=f?o-r:o+r,C++;var v;return!0===n.toRegex?r>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let r,n=t.capture?"":"?:",o="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${n}${e.negatives.join("|")})`),r=o&&s?`${o}|${s}`:o||s,t.wrap?`(${n}${r})`:r})(_,n):l(m,null,{wrap:!1,...n}):m},d=(e,t,s,a={})=>{if(null==t&&n(e))return[e];if(!n(e)||!n(t))return c(e,t,a);if("function"==typeof s)return d(e,t,1,{transform:s});if(r(s))return d(e,t,0,s);let u={...a};return!0===u.capture&&(u.wrap=!0),s=s||u.step||1,o(s)?o(e)&&o(t)?f(e,t,s,u):((e,t,r=1,n={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,n);let s=n.transform||(e=>String.fromCharCode(e)),a=`${e}`.charCodeAt(0),u=`${t}`.charCodeAt(0),p=a>u,f=Math.min(a,u),d=Math.max(a,u);if(n.toRegex&&1===r)return i(f,d,!1,n);let g=[],h=0;for(;p?a>=u:a<=u;)g.push(s(a,h)),a=p?a-r:a+r,h++;return!0===n.toRegex?l(g,null,{wrap:!1,options:n}):g})(e,t,Math.max(Math.abs(s),1),u):null==s||r(s)?d(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,u)};return $=d}function ee(){if(M)return I;M=1;const e=Y(),{MAX_LENGTH:t,CHAR_BACKSLASH:r,CHAR_BACKTICK:n,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:a,CHAR_RIGHT_PARENTHESES:u,CHAR_LEFT_CURLY_BRACE:i,CHAR_RIGHT_CURLY_BRACE:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:d,CHAR_NO_BREAK_SPACE:g,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=N?k:(N=1,k={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return I=(A,R={})=>{if("string"!=typeof A)throw new TypeError("Expected a string");let y=R||{},E="number"==typeof y.maxLength?Math.min(t,y.maxLength):t;if(A.length>E)throw new SyntaxError(`Input length (${A.length}), exceeds max characters (${E})`);let _,m={type:"root",input:A,nodes:[]},C=[m],v=m,S=m,b=0,x=A.length,$=0,H=0;const w=()=>A[$++],T=e=>{if("text"===e.type&&"dot"===S.type&&(S.type="text"),!S||"text"!==S.type||"text"!==e.type)return v.nodes.push(e),e.parent=v,e.prev=S,S=e,e;S.value+=e.value};for(T({type:"bos"});$<x;)if(v=C[C.length-1],_=w(),_!==h&&_!==g)if(_!==r)if(_!==c)if(_!==p)if(_!==a)if(_!==u)if(_!==f&&_!==d&&_!==n)if(_!==i)if(_!==l)if(_===o&&H>0){if(v.ranges>0){v.ranges=0;let t=v.nodes.shift();v.nodes=[t,{type:"text",value:e(v)}]}T({type:"comma",value:_}),v.commas++}else if(_===s&&H>0&&0===v.commas){let e=v.nodes;if(0===H||0===e.length){T({type:"text",value:_});continue}if("dot"===S.type){if(v.range=[],S.value+=_,S.type="range",3!==v.nodes.length&&5!==v.nodes.length){v.invalid=!0,v.ranges=0,S.type="text";continue}v.ranges++,v.args=[];continue}if("range"===S.type){e.pop();let t=e[e.length-1];t.value+=S.value+_,S=t,v.ranges--;continue}T({type:"dot",value:_})}else T({type:"text",value:_});else{if("brace"!==v.type){T({type:"text",value:_});continue}let e="close";v=C.pop(),v.close=!0,T({type:e,value:_}),H--,v=C[C.length-1]}else{H++;let e=S.value&&"$"===S.value.slice(-1)||!0===v.dollar;v=T({type:"brace",open:!0,close:!1,dollar:e,depth:H,commas:0,ranges:0,nodes:[]}),C.push(v),T({type:"open",value:_})}else{let e,t=_;for(!0!==R.keepQuotes&&(_="");$<x&&(e=w());)if(e!==r){if(e===t){!0===R.keepQuotes&&(_+=e);break}_+=e}else _+=e+w();T({type:"text",value:_})}else{if("paren"!==v.type){T({type:"text",value:_});continue}v=C.pop(),T({type:"text",value:_}),v=C[C.length-1]}else v=T({type:"paren",nodes:[]}),C.push(v),T({type:"text",value:_});else{let e;for(b++;$<x&&(e=w());)if(_+=e,e!==p)if(e!==r){if(e===c&&(b--,0===b))break}else _+=w();else b++;T({type:"text",value:_})}else T({type:"text",value:"\\"+_});else T({type:"text",value:(R.keepEscaping?_:"")+w()});do{if(v=C.pop(),"root"!==v.type){v.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=C[C.length-1],t=e.nodes.indexOf(v);e.nodes.splice(t,1,...v.nodes)}}while(C.length>0);return T({type:"eos"}),m},I}function te(){if(B)return j;B=1;const e=Y(),t=function(){if(T)return w;T=1;const e=J(),t=Z();return w=(r,n={})=>{let o=(r,s={})=>{let a=t.isInvalidBrace(s),u=!0===r.invalid&&!0===n.escapeInvalid,i=!0===a||!0===u,l=!0===n.escapeInvalid?"\\":"",p="";if(!0===r.isOpen)return l+r.value;if(!0===r.isClose)return l+r.value;if("open"===r.type)return i?l+r.value:"(";if("close"===r.type)return i?l+r.value:")";if("comma"===r.type)return"comma"===r.prev.type?"":i?r.value:"|";if(r.value)return r.value;if(r.nodes&&r.ranges>0){let o=t.reduce(r.nodes),s=e(...o,{...n,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(r.nodes)for(let e of r.nodes)p+=o(e,r);return p};return o(r)}}(),r=function(){if(O)return L;O=1;const e=J(),t=Y(),r=Z(),n=(e="",t="",o=!1)=>{let s=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?r.flatten(t).map((e=>`{${e}}`)):t;for(let r of e)if(Array.isArray(r))for(let e of r)s.push(n(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?n(r,e,o):r+e);return r.flatten(s)};return L=(o,s={})=>{let a=void 0===s.rangeLimit?1e3:s.rangeLimit,u=(o,i={})=>{o.queue=[];let l=i,p=i.queue;for(;"brace"!==l.type&&"root"!==l.type&&l.parent;)l=l.parent,p=l.queue;if(o.invalid||o.dollar)return void p.push(n(p.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void p.push(n(p.pop(),["{}"]));if(o.nodes&&o.ranges>0){let u=r.reduce(o.nodes);if(r.exceedsLimit(...u,s.step,a))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let i=e(...u,s);return 0===i.length&&(i=t(o,s)),p.push(n(p.pop(),i)),void(o.nodes=[])}let c=r.encloseBrace(o),f=o.queue,d=o;for(;"brace"!==d.type&&"root"!==d.type&&d.parent;)d=d.parent,f=d.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(n(f.pop(),t.value)):t.nodes&&u(t,o):p.push(n(p.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return r.flatten(u(o))}}(),n=ee(),o=(e,t={})=>{let r=[];if(Array.isArray(e))for(let n of e){let e=o.create(n,t);Array.isArray(e)?r.push(...e):r.push(e)}else r=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(r=[...new Set(r)]),r};return o.parse=(e,t={})=>n(e,t),o.stringify=(t,r={})=>e("string"==typeof t?o.parse(t,r):t,r),o.compile=(e,r={})=>("string"==typeof e&&(e=o.parse(e,r)),t(e,r)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let n=r(e,t);return!0===t.noempty&&(n=n.filter(Boolean)),!0===t.nodupes&&(n=[...new Set(n)]),n},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),j=o}var re,ne,oe,se,ae,ue,ie,le,pe,ce,fe,de,ge,he={};function Ae(){if(ne)return re;ne=1;const e=q.default,t="\\\\/",r=`[^${t}]`,n="\\.",o="\\/",s="[^/]",a=`(?:${o}|$)`,u=`(?:^|${o})`,i=`${n}{1,2}${a}`,l={DOT_LITERAL:n,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:a,DOTS_SLASH:i,NO_DOT:`(?!${n})`,NO_DOTS:`(?!${u}${i})`,NO_DOT_SLASH:`(?!${n}{0,1}${a})`,NO_DOTS_SLASH:`(?!${i})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:u},p={...l,SLASH_LITERAL:`[${t}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${n}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${n})`,NO_DOTS:`(?!(?:^|[${t}])${n}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${n}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return re={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?p:l}}function Re(){return oe||(oe=1,function(e){const t=q.default,r="win32"===process.platform,{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:a}=Ae();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(a,"\\$1"),e.toPosixSlashes=e=>e.replace(n,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===r||"\\"===t.sep,e.escapeLast=(t,r,n)=>{const o=t.lastIndexOf(r,n);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,r,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let r=e;return r.startsWith("./")&&(r=r.slice(2),t.prefix="./"),r},e.wrapOutput=(e,t={},r={})=>{let n=`${r.contains?"":"^"}(?:${e})${r.contains?"":"$"}`;return!0===t.negated&&(n=`(?:^(?!${n}).*$)`),n}}(he)),he}function ye(){if(pe)return le;pe=1;const e=q.default,t=function(){if(ae)return se;ae=1;const e=Re(),{CHAR_ASTERISK:t,CHAR_AT:r,CHAR_BACKWARD_SLASH:n,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:i,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:p,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:d,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:h}=Ae(),A=e=>e===u||e===n,R=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return se=(y,E)=>{const _=E||{},m=y.length-1,C=!0===_.parts||!0===_.scanToEnd,v=[],S=[],b=[];let x,$,H=y,w=-1,T=0,L=0,O=!1,k=!1,N=!1,I=!1,M=!1,j=!1,B=!1,P=!1,U=!1,D=!1,G=0,F={value:"",depth:0,isGlob:!1};const K=()=>w>=m,q=()=>(x=$,H.charCodeAt(++w));for(;w<m;){let e;if($=q(),$!==n){if(!0===j||$===i){for(G++;!0!==K()&&($=q());)if($!==n)if($!==i){if(!0!==j&&$===s&&($=q())===s){if(O=F.isBrace=!0,N=F.isGlob=!0,D=!0,!0===C)continue;break}if(!0!==j&&$===o){if(O=F.isBrace=!0,N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===d&&(G--,0===G)){j=!1,O=F.isBrace=!0,D=!0;break}}else G++;else B=F.backslashes=!0,q();if(!0===C)continue;break}if($!==u){if(!0!==_.noext&&!0==($===c||$===r||$===t||$===f||$===a)&&H.charCodeAt(w+1)===l){if(N=F.isGlob=!0,I=F.isExtglob=!0,D=!0,$===a&&w===T&&(U=!0),!0===C){for(;!0!==K()&&($=q());)if($!==n){if($===g){N=F.isGlob=!0,D=!0;break}}else B=F.backslashes=!0,$=q();continue}break}if($===t){if(x===t&&(M=F.isGlobstar=!0),N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===f){if(N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===p){for(;!0!==K()&&(e=q());)if(e!==n){if(e===h){k=F.isBracket=!0,N=F.isGlob=!0,D=!0;break}}else B=F.backslashes=!0,q();if(!0===C)continue;break}if(!0===_.nonegate||$!==a||w!==T){if(!0!==_.noparen&&$===l){if(N=F.isGlob=!0,!0===C){for(;!0!==K()&&($=q());)if($!==l){if($===g){D=!0;break}}else B=F.backslashes=!0,$=q();continue}break}if(!0===N){if(D=!0,!0===C)continue;break}}else P=F.negated=!0,T++}else{if(v.push(w),S.push(F),F={value:"",depth:0,isGlob:!1},!0===D)continue;if(x===s&&w===T+1){T+=2;continue}L=w+1}}else B=F.backslashes=!0,$=q(),$===i&&(j=!0)}!0===_.noext&&(I=!1,N=!1);let Q=H,W="",X="";T>0&&(W=H.slice(0,T),H=H.slice(T),L-=T),Q&&!0===N&&L>0?(Q=H.slice(0,L),X=H.slice(L)):!0===N?(Q="",X=H):Q=H,Q&&""!==Q&&"/"!==Q&&Q!==H&&A(Q.charCodeAt(Q.length-1))&&(Q=Q.slice(0,-1)),!0===_.unescape&&(X&&(X=e.removeBackslashes(X)),Q&&!0===B&&(Q=e.removeBackslashes(Q)));const Z={prefix:W,input:y,start:T,base:Q,glob:X,isBrace:O,isBracket:k,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:U};if(!0===_.tokens&&(Z.maxDepth=0,A($)||S.push(F),Z.tokens=S),!0===_.parts||!0===_.tokens){let e;for(let t=0;t<v.length;t++){const r=e?e+1:T,n=v[t],o=y.slice(r,n);_.tokens&&(0===t&&0!==T?(S[t].isPrefix=!0,S[t].value=W):S[t].value=o,R(S[t]),Z.maxDepth+=S[t].depth),0===t&&""===o||b.push(o),e=n}if(e&&e+1<y.length){const t=y.slice(e+1);b.push(t),_.tokens&&(S[S.length-1].value=t,R(S[S.length-1]),Z.maxDepth+=S[S.length-1].depth)}Z.slashes=v,Z.parts=b}return Z}}(),r=function(){if(ie)return ue;ie=1;const e=Ae(),t=Re(),{MAX_LENGTH:r,POSIX_REGEX_SOURCE:n,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=e,u=(e,r)=>{if("function"==typeof r.expandRange)return r.expandRange(...e,r);e.sort();const n=`[${e.join("-")}]`;try{new RegExp(n)}catch(r){return e.map((e=>t.escapeRegex(e))).join("..")}return n},i=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,l=(p,c)=>{if("string"!=typeof p)throw new TypeError("Expected a string");p=a[p]||p;const f={...c},d="number"==typeof f.maxLength?Math.min(r,f.maxLength):r;let g=p.length;if(g>d)throw new SyntaxError(`Input length: ${g}, exceeds maximum allowed length: ${d}`);const h={type:"bos",value:"",output:f.prepend||""},A=[h],R=f.capture?"":"?:",y=t.isWindows(c),E=e.globChars(y),_=e.extglobChars(E),{DOT_LITERAL:m,PLUS_LITERAL:C,SLASH_LITERAL:v,ONE_CHAR:S,DOTS_SLASH:b,NO_DOT:x,NO_DOT_SLASH:$,NO_DOTS_SLASH:H,QMARK:w,QMARK_NO_DOT:T,STAR:L,START_ANCHOR:O}=E,k=e=>`(${R}(?:(?!${O}${e.dot?b:m}).)*?)`,N=f.dot?"":x,I=f.dot?w:T;let M=!0===f.bash?k(f):L;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const j={input:p,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:A};p=t.removePrefix(p,j),g=p.length;const B=[],P=[],U=[];let D,G=h;const F=()=>j.index===g-1,K=j.peek=(e=1)=>p[j.index+e],q=j.advance=()=>p[++j.index]||"",Q=()=>p.slice(j.index+1),W=(e="",t=0)=>{j.consumed+=e,j.index+=t},X=e=>{j.output+=null!=e.output?e.output:e.value,W(e.value)},Z=()=>{let e=1;for(;"!"===K()&&("("!==K(2)||"?"===K(3));)q(),j.start++,e++;return e%2!=0&&(j.negated=!0,j.start++,!0)},Y=e=>{j[e]++,U.push(e)},V=e=>{j[e]--,U.pop()},z=e=>{if("globstar"===G.type){const t=j.braces>0&&("comma"===e.type||"brace"===e.type),r=!0===e.extglob||B.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||r||(j.output=j.output.slice(0,-G.output.length),G.type="star",G.value="*",G.output=M,j.output+=G.output)}if(B.length&&"paren"!==e.type&&(B[B.length-1].inner+=e.value),(e.value||e.output)&&X(e),G&&"text"===G.type&&"text"===e.type)return G.value+=e.value,void(G.output=(G.output||"")+e.value);e.prev=G,A.push(e),G=e},J=(e,t)=>{const r={..._[t],conditions:1,inner:""};r.prev=G,r.parens=j.parens,r.output=j.output;const n=(f.capture?"(":"")+r.open;Y("parens"),z({type:e,value:t,output:j.output?"":S}),z({type:"paren",extglob:!0,value:q(),output:n}),B.push(r)},ee=e=>{let t,r=e.close+(f.capture?")":"");if("negate"===e.type){let n=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(n=k(f)),(n!==M||F()||/^\)+$/.test(Q()))&&(r=e.close=`)$))${n}`),e.inner.includes("*")&&(t=Q())&&/^\.[^\\/.]+$/.test(t)){const o=l(t,{...c,fastpaths:!1}).output;r=e.close=`)${o})${n})`}"bos"===e.prev.type&&(j.negatedExtglob=!0)}z({type:"paren",extglob:!0,value:D,output:r}),V("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(p)){let e=!1,r=p.replace(s,((t,r,n,o,s,a)=>"\\"===o?(e=!0,t):"?"===o?r?r+o+(s?w.repeat(s.length):""):0===a?I+(s?w.repeat(s.length):""):w.repeat(n.length):"."===o?m.repeat(n.length):"*"===o?r?r+o+(s?M:""):M:r?t:`\\${t}`));return!0===e&&(r=!0===f.unescape?r.replace(/\\/g,""):r.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),r===p&&!0===f.contains?(j.output=p,j):(j.output=t.wrapOutput(r,j,c),j)}for(;!F();){if(D=q(),"\0"===D)continue;if("\\"===D){const e=K();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){D+="\\",z({type:"text",value:D});continue}const t=/^\\+/.exec(Q());let r=0;if(t&&t[0].length>2&&(r=t[0].length,j.index+=r,r%2!=0&&(D+="\\")),!0===f.unescape?D=q():D+=q(),0===j.brackets){z({type:"text",value:D});continue}}if(j.brackets>0&&("]"!==D||"["===G.value||"[^"===G.value)){if(!1!==f.posix&&":"===D){const e=G.value.slice(1);if(e.includes("[")&&(G.posix=!0,e.includes(":"))){const e=G.value.lastIndexOf("["),t=G.value.slice(0,e),r=G.value.slice(e+2),o=n[r];if(o){G.value=t+o,j.backtrack=!0,q(),h.output||1!==A.indexOf(G)||(h.output=S);continue}}}("["===D&&":"!==K()||"-"===D&&"]"===K())&&(D=`\\${D}`),"]"!==D||"["!==G.value&&"[^"!==G.value||(D=`\\${D}`),!0===f.posix&&"!"===D&&"["===G.value&&(D="^"),G.value+=D,X({value:D});continue}if(1===j.quotes&&'"'!==D){D=t.escapeRegex(D),G.value+=D,X({value:D});continue}if('"'===D){j.quotes=1===j.quotes?0:1,!0===f.keepQuotes&&z({type:"text",value:D});continue}if("("===D){Y("parens"),z({type:"paren",value:D});continue}if(")"===D){if(0===j.parens&&!0===f.strictBrackets)throw new SyntaxError(i("opening","("));const e=B[B.length-1];if(e&&j.parens===e.parens+1){ee(B.pop());continue}z({type:"paren",value:D,output:j.parens?")":"\\)"}),V("parens");continue}if("["===D){if(!0!==f.nobracket&&Q().includes("]"))Y("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(i("closing","]"));D=`\\${D}`}z({type:"bracket",value:D});continue}if("]"===D){if(!0===f.nobracket||G&&"bracket"===G.type&&1===G.value.length){z({type:"text",value:D,output:`\\${D}`});continue}if(0===j.brackets){if(!0===f.strictBrackets)throw new SyntaxError(i("opening","["));z({type:"text",value:D,output:`\\${D}`});continue}V("brackets");const e=G.value.slice(1);if(!0===G.posix||"^"!==e[0]||e.includes("/")||(D=`/${D}`),G.value+=D,X({value:D}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const r=t.escapeRegex(G.value);if(j.output=j.output.slice(0,-G.value.length),!0===f.literalBrackets){j.output+=r,G.value=r;continue}G.value=`(${R}${r}|${G.value})`,j.output+=G.value;continue}if("{"===D&&!0!==f.nobrace){Y("braces");const e={type:"brace",value:D,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};P.push(e),z(e);continue}if("}"===D){const e=P[P.length-1];if(!0===f.nobrace||!e){z({type:"text",value:D,output:D});continue}let t=")";if(!0===e.dots){const e=A.slice(),r=[];for(let t=e.length-1;t>=0&&(A.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&r.unshift(e[t].value);t=u(r,f),j.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const r=j.output.slice(0,e.outputIndex),n=j.tokens.slice(e.tokensIndex);e.value=e.output="\\{",D=t="\\}",j.output=r;for(const e of n)j.output+=e.output||e.value}z({type:"brace",value:D,output:t}),V("braces"),P.pop();continue}if("|"===D){B.length>0&&B[B.length-1].conditions++,z({type:"text",value:D});continue}if(","===D){let e=D;const t=P[P.length-1];t&&"braces"===U[U.length-1]&&(t.comma=!0,e="|"),z({type:"comma",value:D,output:e});continue}if("/"===D){if("dot"===G.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",A.pop(),G=h;continue}z({type:"slash",value:D,output:v});continue}if("."===D){if(j.braces>0&&"dot"===G.type){"."===G.value&&(G.output=m);const e=P[P.length-1];G.type="dots",G.output+=D,G.value+=D,e.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==G.type&&"slash"!==G.type){z({type:"text",value:D,output:m});continue}z({type:"dot",value:D,output:m});continue}if("?"===D){if((!G||"("!==G.value)&&!0!==f.noextglob&&"("===K()&&"?"!==K(2)){J("qmark",D);continue}if(G&&"paren"===G.type){const e=K();let r=D;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===G.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(Q()))&&(r=`\\${D}`),z({type:"text",value:D,output:r});continue}if(!0!==f.dot&&("slash"===G.type||"bos"===G.type)){z({type:"qmark",value:D,output:T});continue}z({type:"qmark",value:D,output:w});continue}if("!"===D){if(!0!==f.noextglob&&"("===K()&&("?"!==K(2)||!/[!=<:]/.test(K(3)))){J("negate",D);continue}if(!0!==f.nonegate&&0===j.index){Z();continue}}if("+"===D){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){J("plus",D);continue}if(G&&"("===G.value||!1===f.regex){z({type:"plus",value:D,output:C});continue}if(G&&("bracket"===G.type||"paren"===G.type||"brace"===G.type)||j.parens>0){z({type:"plus",value:D});continue}z({type:"plus",value:C});continue}if("@"===D){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){z({type:"at",extglob:!0,value:D,output:""});continue}z({type:"text",value:D});continue}if("*"!==D){"$"!==D&&"^"!==D||(D=`\\${D}`);const e=o.exec(Q());e&&(D+=e[0],j.index+=e[0].length),z({type:"text",value:D});continue}if(G&&("globstar"===G.type||!0===G.star)){G.type="star",G.star=!0,G.value+=D,G.output=M,j.backtrack=!0,j.globstar=!0,W(D);continue}let e=Q();if(!0!==f.noextglob&&/^\([^?]/.test(e)){J("star",D);continue}if("star"===G.type){if(!0===f.noglobstar){W(D);continue}const t=G.prev,r=t.prev,n="slash"===t.type||"bos"===t.type,o=r&&("star"===r.type||"globstar"===r.type);if(!0===f.bash&&(!n||e[0]&&"/"!==e[0])){z({type:"star",value:D,output:""});continue}const s=j.braces>0&&("comma"===t.type||"brace"===t.type),a=B.length&&("pipe"===t.type||"paren"===t.type);if(!n&&"paren"!==t.type&&!s&&!a){z({type:"star",value:D,output:""});continue}for(;"/**"===e.slice(0,3);){const t=p[j.index+4];if(t&&"/"!==t)break;e=e.slice(3),W("/**",3)}if("bos"===t.type&&F()){G.type="globstar",G.value+=D,G.output=k(f),j.output=G.output,j.globstar=!0,W(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&F()){j.output=j.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=k(f)+(f.strictSlashes?")":"|$)"),G.value+=D,j.globstar=!0,j.output+=t.output+G.output,W(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const r=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=`${k(f)}${v}|${v}${r})`,G.value+=D,j.output+=t.output+G.output,j.globstar=!0,W(D+q()),z({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){G.type="globstar",G.value+=D,G.output=`(?:^|${v}|${k(f)}${v})`,j.output=G.output,j.globstar=!0,W(D+q()),z({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-G.output.length),G.type="globstar",G.output=k(f),G.value+=D,j.output+=G.output,j.globstar=!0,W(D);continue}const r={type:"star",value:D,output:M};!0!==f.bash?!G||"bracket"!==G.type&&"paren"!==G.type||!0!==f.regex?(j.index!==j.start&&"slash"!==G.type&&"dot"!==G.type||("dot"===G.type?(j.output+=$,G.output+=$):!0===f.dot?(j.output+=H,G.output+=H):(j.output+=N,G.output+=N),"*"!==K()&&(j.output+=S,G.output+=S)),z(r)):(r.output=D,z(r)):(r.output=".*?","bos"!==G.type&&"slash"!==G.type||(r.output=N+r.output),z(r))}for(;j.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(i("closing","]"));j.output=t.escapeLast(j.output,"["),V("brackets")}for(;j.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(i("closing",")"));j.output=t.escapeLast(j.output,"("),V("parens")}for(;j.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(i("closing","}"));j.output=t.escapeLast(j.output,"{"),V("braces")}if(!0===f.strictSlashes||"star"!==G.type&&"bracket"!==G.type||z({type:"maybe_slash",value:"",output:`${v}?`}),!0===j.backtrack){j.output="";for(const e of j.tokens)j.output+=null!=e.output?e.output:e.value,e.suffix&&(j.output+=e.suffix)}return j};return l.fastpaths=(n,o)=>{const s={...o},u="number"==typeof s.maxLength?Math.min(r,s.maxLength):r,i=n.length;if(i>u)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${u}`);n=a[n]||n;const l=t.isWindows(o),{DOT_LITERAL:p,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:d,NO_DOT:g,NO_DOTS:h,NO_DOTS_SLASH:A,STAR:R,START_ANCHOR:y}=e.globChars(l),E=s.dot?h:g,_=s.dot?A:g,m=s.capture?"":"?:";let C=!0===s.bash?".*?":R;s.capture&&(C=`(${C})`);const v=e=>!0===e.noglobstar?C:`(${m}(?:(?!${y}${e.dot?d:p}).)*?)`,S=e=>{switch(e){case"*":return`${E}${f}${C}`;case".*":return`${p}${f}${C}`;case"*.*":return`${E}${C}${p}${f}${C}`;case"*/*":return`${E}${C}${c}${f}${_}${C}`;case"**":return E+v(s);case"**/*":return`(?:${E}${v(s)}${c})?${_}${f}${C}`;case"**/*.*":return`(?:${E}${v(s)}${c})?${_}${C}${p}${f}${C}`;case"**/.*":return`(?:${E}${v(s)}${c})?${p}${f}${C}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const r=S(t[1]);if(!r)return;return r+p+t[2]}}},b=t.removePrefix(n,{negated:!1,prefix:""});let x=S(b);return x&&!0!==s.strictSlashes&&(x+=`${c}?`),x},ue=l}(),n=Re(),o=Ae(),s=(e,t,r=!1)=>{if(Array.isArray(e)){const n=e.map((e=>s(e,t,r))),o=e=>{for(const t of n){const r=t(e);if(r)return r}return!1};return o}const o=(a=e)&&"object"==typeof a&&!Array.isArray(a)&&e.tokens&&e.input;var a;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const u=t||{},i=n.isWindows(t),l=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),p=l.state;delete l.state;let c=()=>!1;if(u.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(u.ignore,e,r)}const f=(r,n=!1)=>{const{isMatch:o,match:a,output:f}=s.test(r,l,t,{glob:e,posix:i}),d={glob:e,state:p,regex:l,posix:i,input:r,output:f,match:a,isMatch:o};return"function"==typeof u.onResult&&u.onResult(d),!1===o?(d.isMatch=!1,!!n&&d):c(r)?("function"==typeof u.onIgnore&&u.onIgnore(d),d.isMatch=!1,!!n&&d):("function"==typeof u.onMatch&&u.onMatch(d),!n||d)};return r&&(f.state=p),f};return s.test=(e,t,r,{glob:o,posix:a}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const u=r||{},i=u.format||(a?n.toPosixSlashes:null);let l=e===o,p=l&&i?i(e):e;return!1===l&&(p=i?i(e):e,l=p===o),!1!==l&&!0!==u.capture||(l=!0===u.matchBase||!0===u.basename?s.matchBase(e,t,r,a):t.exec(p)),{isMatch:Boolean(l),match:l,output:p}},s.matchBase=(t,r,o,a=n.isWindows(o))=>(r instanceof RegExp?r:s.makeRe(r,o)).test(e.basename(t)),s.isMatch=(e,t,r)=>s(t,r)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):r(e,{...t,fastpaths:!1}),s.scan=(e,r)=>t(e,r),s.compileRe=(e,t,r=!1,n=!1)=>{if(!0===r)return e.output;const o=t||{},a=o.contains?"":"^",u=o.contains?"":"$";let i=`${a}(?:${e.output})${u}`;e&&!0===e.negated&&(i=`^(?!${i}).*$`);const l=s.toRegex(i,t);return!0===n&&(l.state=e),l},s.makeRe=(e,t={},n=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,o)},s.toRegex=(e,t)=>{try{const r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},s.constants=o,le=s}function Ee(){return fe?ce:(fe=1,ce=ye())}var _e=function(){if(ge)return de;ge=1;const e=K.default,t=te(),r=Ee(),n=Re(),o=e=>""===e||"./"===e,s=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,a=new Set,u=0,i=e=>{a.add(e.output),n&&n.onResult&&n.onResult(e)};for(let a=0;a<t.length;a++){let l=r(String(t[a]),{...n,onResult:i},!0),p=l.state.negated||l.state.negatedExtglob;p&&u++;for(let t of e){let e=l(t,!0);(p?!e.isMatch:e.isMatch)&&(p?o.add(e.output):(o.delete(e.output),s.add(e.output)))}}let l=(u===t.length?[...a]:[...s]).filter((e=>!o.has(e)));if(n&&0===l.length){if(!0===n.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===n.nonull||!0===n.nullglob)return n.unescape?t.map((e=>e.replace(/\\/g,""))):t}return l};return s.match=s,s.matcher=(e,t)=>r(e,t),s.any=s.isMatch=(e,t,n)=>r(t,n)(e),s.not=(e,t,r={})=>{t=[].concat(t).map(String);let n=new Set,o=[],a=new Set(s(e,t,{...r,onResult:e=>{r.onResult&&r.onResult(e),o.push(e.output)}}));for(let e of o)a.has(e)||n.add(e);return[...n]},s.contains=(t,r,n)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(r))return r.some((e=>s.contains(t,e,n)));if("string"==typeof r){if(o(t)||o(r))return!1;if(t.includes(r)||t.startsWith("./")&&t.slice(2).includes(r))return!0}return s.isMatch(t,r,{...n,contains:!0})},s.matchKeys=(e,t,r)=>{if(!n.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,r),a={};for(let t of o)a[t]=e[t];return a},s.some=(e,t,n)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=r(String(e),n);if(o.some((e=>t(e))))return!0}return!1},s.every=(e,t,n)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=r(String(e),n);if(!o.every((e=>t(e))))return!1}return!0},s.all=(t,n,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(n).every((e=>r(e,o)(t)))},s.capture=(e,t,o)=>{let s=n.isWindows(o),a=r.makeRe(String(e),{...o,capture:!0}).exec(s?n.toPosixSlashes(t):t);if(a)return a.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>r.makeRe(...e),s.scan=(...e)=>r.scan(...e),s.parse=(e,n)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),n))o.push(r.parse(e,n));return o},s.braces=(e,r)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return r&&!0===r.nobrace||!/\{.*\}/.test(e)?[e]:t(e,r)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},de=s}();const me=e=>P.default.readdirSync(e).reduce(((r,n)=>{const o=t.resolve(e,n);return P.default.statSync(o).isDirectory()?o.endsWith("/node_modules")?r:[...r,...me(o)]:[...r,o]}),[]),Ce=(e,t)=>new Set([...e].filter((e=>t.has(e))));let ve;function Se(){if(ve)return ve;const e=h.program.getOptionValue("root");return ve=e?U.default.isAbsolute(e)?e:U.default.resolve(process.cwd(),e):void 0,ve}let be,xe="";try{g.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:y&&y.src||new URL("rollup/index.min.cjs",document.baseURI).href).resolve("@pnpm/filter-workspace-packages"),xe="pnpm"}catch{}""!==xe&&h.program.option("-f, --filter <filter>","filter packages");let $e=!1;const He=g.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:y&&y.src||new URL("rollup/index.min.cjs",document.baseURI).href);function we(e){try{return He.resolve(e),!0}catch(e){return!1}}let Te;const Le=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of Le)if(we(e)){Te=e;break}const Oe=g.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:y&&y.src||new URL("rollup/index.min.cjs",document.baseURI).href);let ke="jiek.config";const Ne=e=>{e=t.resolve(e);const r=t.dirname(e),{extends:n,...o}=(s=e,P.default.existsSync(s)&&P.default.statSync(s).isFile()?R.parse(P.default.readFileSync(s,"utf-8"),[],{allowTrailingComma:!0,allowEmptyContent:!0}):{});var s;const a=(u=n?Array.isArray(n)?n:[n]:[],u?.map((e=>t.resolve(r,e)))??[]);var u;return 0===a.length?o:a.map(Ne).concat(o).reduce(((e,{compilerOptions:t={},references:r,...n})=>({...e,...n,compilerOptions:{...e.compilerOptions,...t}})),{})},Ie=(e,r)=>{e=t.resolve(e),r=t.resolve(r);const n=t.dirname(e),o=Ne(e),[s,a,u,i]=[o.references?.map((({path:e})=>e)),o.files,o.include,o.exclude].map((e=>e?.map((e=>t.resolve(n,e)))??[]));if(i.length>0&&i.some((e=>_e.isMatch(r,e))))return;if(0===o.files?.length&&0===o.include?.length)return;let l=!1;if(l||(l=a.length>0&&a.includes(r)),l||(l=u.length>0&&u.some((e=>_e.isMatch(r,e)))),l)return o.compilerOptions??{};if(!(o.files&&o.files.length>0||o.include&&o.include.length>0)){s.reverse();for(const e of s){const t=Ie(e,r);if(t)return t}return o.compilerOptions}};var Me=(e={})=>{const{onEvent:t}=e;return{name:"progress",buildStart:()=>t?.("start","Start building..."),buildEnd:()=>t?.("end","Build completed!"),resolveId:{order:"post",handler:e=>t?.("resolve",`Resolving ${e}...`)},load:{order:"post",handler:e=>t?.("load",`Loading ${e}...`)},transform:{order:"post",handler:(e,r)=>t?.("transform",`Transforming ${r}...`)}}},je=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const Be=["te?xt","json","(css|s[ac]ss|less|styl)"];const{JIEK_ROOT:Pe,JIEK_ENTRIES:Ue}=process.env,De=Pe??o.getWorkspaceDir(),Ge={},Fe=[G.default()],Ke=function(e){const{wd:t}=function(){if(be)return{wd:be,notWorkspace:$e};const e=Se();if(void 0!==e){const t=o.isWorkspaceDir(e,xe);return $e=!t,be=e,{wd:be,notWorkspace:$e}}try{be=o.getWorkspaceDir(xe)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;be=e,$e=!0}return{wd:be,notWorkspace:$e}}();let r=h.program.getOptionValue("configPath");if(r){if(!P.default.existsSync(r))throw new Error(`config file not found: ${r}`);U.default.isAbsolute(r)||(r=U.default.resolve(t,r))}else r=function(e,t){const r=!!Te;function n(r){const n=[U.default.resolve(process.cwd(),`${ke}.${r}`),U.default.resolve(process.cwd(),`.${ke}.${r}`),U.default.resolve(e,`${ke}.${r}`),U.default.resolve(e,`.${ke}.${r}`)];t&&n.unshift(U.default.resolve(t,`${ke}.${r}`),U.default.resolve(t,`.${ke}.${r}`));for(const e of n)if(P.default.existsSync(e)&&P.default.lstatSync(e).isFile())return e}return ke=n("js")??ke,ke=n("json")??ke,ke=n("yaml")??ke,r&&(ke=n("ts")??ke),U.default.resolve(e,ke)}(t,e);const n=U.default.extname(r);let s;switch(n){case".js":s=Oe(r);break;case".json":return Oe(r);case".yaml":return A.load(P.default.readFileSync(r,"utf-8"));case".ts":if(Te){Oe(Te),s=Oe(r);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":s={};break;default:throw new Error(`unsupported config file type: ${n}`)}if(!s)throw new Error("config file is empty");return s.default??s}()??{},{build:qe={}}=Ke,Qe=`./${t.relative(process.cwd(),t.resolve(("object"==typeof qe?.output?.dir?qe.output.dir.js:qe?.output?.dir)??"dist"))}`,We=/\.(css|s[ac]ss|less|styl)$/,Xe=e=>t.resolve(De,e),Ze=e=>e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())).replace(/(?:^|-)(\w)/g,((e,t)=>t.toUpperCase())),Ye=(e,t=qe?.output?.minify)=>!1===t?[e]:"only-minify"===t?[{...e,entryFileNames:t=>"function"==typeof e.entryFileNames?e.entryFileNames(t).replace(/(\.[cm]?js)$/,".min$1"):(()=>{throw new Error("entryFileNames must be a function")})(),plugins:[...e.plugins??[],F.default()]}]:[e,{...e,entryFileNames:t=>"function"==typeof e.entryFileNames?e.entryFileNames(t).replace(/(\.[cm]?js)$/,".min$1"):(()=>{throw new Error("entryFileNames must be a function")})(),file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],F.default()]}],Ve=(e,r={})=>{const{path:o,name:s,input:a,output:i,external:p,pkgIsModule:c,conditionals:f}=e,d=f.includes("import"),g=f.includes("require"),h=f.includes("browser");let A;[Xe("tsconfig.json"),Xe("tsconfig.dts.json")].forEach((e=>{P.default.existsSync(e)&&P.default.statSync(e).isFile()&&(A=e)}));let R={};if(A){const e=Ie(A,t.resolve(a)),{options:r,errors:n}=W.default.convertCompilerOptionsFromJson(e,t.dirname(A));if(n.length>0)throw new Error(n.map((e=>e.messageText)).join("\n"));R=r,delete R.composite}const y=[...f,...R.customConditions??[]],E={type:"progress",data:{name:s,path:o,exportConditions:y,input:a}},_=r?.output?.dir,{js:m,dts:C}=((e,t)=>{if(!1===t||null==t)return{js:[],dts:[]};let r=[],n=[];switch(typeof t){case"function":r=t("js",e),n=t("dts",e);break;case"object":"js"in t||"dts"in t?(r=t.js??[],n=t.dts??[]):(r=t,n=t)}return{js:r,dts:n}})(e,qe.plugins);if(a.includes("**"))throw new Error('input should not include "**", please read the [documentation](https://nodejs.org/api/packages.html#subpath-patterns).');const v=a.includes("*")?me(process.cwd()).filter((e=>/(?<!\.d)\.[cm]?tsx?$/.test(e))).map((e=>t.relative(process.cwd(),e))).filter((e=>_e.isMatch(e,a.slice(2)))):a,S=a.includes("*")?a.split("*")[0].replace("./",""):"",b=o.includes("*")?o.split("*")[0].replace("./",""):"";if(S.length>0&&0===b.length||0===S.length&&b.length>0)throw new Error('input and path should both include "*" or not include "*"');const x=t.extname(i),$=x.replace(/(\.[cm]?)js$/,".d$1ts");return[{input:v,external:p,output:[...Ye({dir:Qe,name:s,interop:"auto",entryFileNames:e=>Array.isArray(v)?e.facadeModuleId.replace(`${process.cwd()}/`,"").replace(S,b).replace(/(\.[cm]?)ts$/,x):i.replace(`${Qe}/`,""),sourcemap:"object"==typeof r?.output?.sourcemap?r.output.sourcemap.js:r?.output?.sourcemap,format:d?"esm":g?"cjs":h?"umd":c?"esm":"cjs",strict:"object"==typeof r?.output?.strict?r.output.strict.js:r?.output?.strict})],plugins:[u.nodeResolve({exportConditions:y}),import("rollup-plugin-postcss").then((({default:e})=>e({extract:t.resolve(i.replace(/\.[cm]?js$/,".css")),minimize:!0}))).catch((()=>{})),Q.default({tsconfig:A}),D.default(),Me({onEvent:(e,t)=>l.sendMessage({...E,data:{...E.data,event:e,message:t,tags:["js"]}})}),m]},{input:v,external:p,output:[{dir:t.resolve(("object"==typeof _?_.dts:_)??"dist"),sourcemap:"object"==typeof r?.output?.sourcemap?r.output.sourcemap.dts:r?.output?.sourcemap,entryFileNames:e=>Array.isArray(v)?e.facadeModuleId.replace(`${process.cwd()}/`,"").replace(S,b).replace(/(\.[cm]?)ts$/,$):i.replace(`${Qe}/`,"").replace(/(\.[cm]?)js$/,$),strict:"object"==typeof r?.output?.strict?r.output.strict.dts:r?.output?.strict}],plugins:[u.nodeResolve({exportConditions:y}),je({patterns:[We]}),n.dts({respectExternal:!0,compilerOptions:{...R,outDir:"dist",declaration:!0}}),Me({onEvent:(e,t)=>l.sendMessage({...E,data:{...E.data,event:e,message:t,tags:["dts"]}})}),C]}]};exports.template=function(e){const{name:n,type:o,exports:s}=e,a="module"===o;if(!n)throw new Error("package.json name is required");if(!s)throw new Error("package.json exports is required");const u=Ue?.split(",").map((e=>e.trim())).map((e=>({index:"."}[e]??e))),i=Ze(n),p=function(e=process.cwd()){const t="string"==typeof e?P.default.existsSync(`${e}/package.json`)?JSON.parse(P.default.readFileSync(`${e}/package.json`,"utf-8")):{}:e,{name:r,dependencies:n={},peerDependencies:o={},optionalDependencies:s={}}=t;if(!r)throw new Error("package.json must have a name field");return Object.keys(n).concat(Object.keys(o)).concat(Object.keys(s)).map((e=>new RegExp(`^${e}(/.*)?$`))).concat([new RegExp(`^${r}(/.*)?(?<!${Be.map((e=>`\\.${e}`)).join("|")})$`),/^node:/])}(e),[c,f]=function({entrypoints:e,pkgIsModule:n,entries:o,config:s,dir:a,noFilter:u,isPublish:i}){const{build:l={},publish:{withSuffix:p=!1,withSource:c=!0}={}}=s??{},{crossModuleConvertor:f=!0}=l,d=`./${g=((...e)=>t.resolve(a??process.cwd(),...e))(("object"==typeof l?.output?.dir?l.output.dir.js:l?.output?.dir)??"dist"),t.relative(a??process.cwd(),g)}`;var g;const[,h]=r.resolveEntrypoints(e);o&&Object.entries(h).forEach((([e])=>{o.some((t=>_e.isMatch(e,t,{matchBase:!0})))||delete h[e]}));const A=u?h:r.filterLeafs(h,{skipValue:[/(^|\/)\.jk-noentry/,...r.DEFAULT_SKIP_VALUES]}),R=f?{import:e=>!n&&0===Ce(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!n||0!==Ce(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[A,r.entrypoints2Exports(A,{outdir:d,withSuffix:i?p:void 0,withSource:i?c:void 0,withConditional:{...R}})]}({entrypoints:s,pkgIsModule:a,entries:u,config:Ke}),d=new Map;r.getAllLeafs(c,(({keys:e,value:t})=>{if("string"==typeof t){const r=d.get(t)??[];d.set(t,r),r.push(e)}return!1}));const g=[];return d.forEach(((e,t)=>e.forEach((e=>{const[n,...o]=e,s=i+("."===n?"":Ze(n)),u=((e,t)=>t.reduce(((e,t)=>{if("string"==typeof e)throw new Error("key not found in exports");if(!(t in e))throw new Error(`key ${t} not found in exports`);return e[t]}),e))(f,e),l={path:n,name:s,input:t,external:p,pkgIsModule:a};switch(typeof u){case"string":g.push(...Ve({...l,output:u,conditionals:o},qe));break;case"object":r.getAllLeafs(u,(({keys:e,value:t})=>{const r=[...new Set([...o,...e])];return"string"==typeof t&&g.push(...Ve({...l,output:t,conditionals:r},qe)),!1}))}})))),l.sendMessage({type:"init",data:{leafMap:d,targetsLength:g.length}}),g.map((e=>({...Ge,...e,plugins:[...Fe,e.plugins]})))};
@@ -1,4 +1,4 @@
1
- import e from"node:fs";import t,{resolve as n,relative as r,dirname as o}from"node:path";import{resolveEntrypoints as s,filterLeafs as i,DEFAULT_SKIP_VALUES as a,entrypoints2Exports as u,getAllLeafs as p}from"@jiek/pkger/entrypoints";import{dts as l}from"@jiek/rollup-plugin-dts";import{isWorkspaceDir as c,getWorkspaceDir as f}from"@jiek/utils/getWorkspaceDir";import d from"@rollup/plugin-commonjs";import g from"@rollup/plugin-json";import{nodeResolve as h}from"@rollup/plugin-node-resolve";import A from"@rollup/plugin-terser";import{sendMessage as R}from"execa";import y from"rollup-plugin-esbuild";import E from"typescript";import m from"util";import _ from"path";import{createRequire as C}from"node:module";import{program as S}from"commander";import{load as b}from"js-yaml";import"@pnpm/filter-workspace-packages";import{parse as v}from"jsonc-parser";const x=t=>e.readdirSync(t).reduce(((r,o)=>{const s=n(t,o);return e.statSync(s).isDirectory()?s.endsWith("/node_modules")?r:[...r,...x(s)]:[...r,s]}),[]);var $,H,w,T,L,O,k,N,I,M,j,B,P,G,D,K,F,U,Q,W={};function X(){return $||($=1,(e=W).isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,o)=>!1!==o&&!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=o,e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>!("brace"!==e.type||e.commas>>0+e.ranges||(e.invalid=!0,0)),e.isInvalidBrace=e=>!("brace"!==e.type||!0!==e.invalid&&!e.dollar&&(e.commas>>0+e.ranges&&!0===e.open&&!0===e.close||(e.invalid=!0,0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||!0===e.open||!0===e.close,e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let o=e[r];Array.isArray(o)?n(o):void 0!==o&&t.push(o)}return t};return n(e),t}),W;var e}function q(){if(w)return H;w=1;const e=X();return H=(t,n={})=>{let r=(t,o={})=>{let s=n.escapeInvalid&&e.isInvalidBrace(o),i=!0===t.invalid&&!0===n.escapeInvalid,a="";if(t.value)return(s||i)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)a+=r(e);return a};return r(t)}}
1
+ import e from"node:fs";import t,{resolve as n,relative as r,dirname as o,extname as s}from"node:path";import{resolveEntrypoints as i,filterLeafs as a,DEFAULT_SKIP_VALUES as u,entrypoints2Exports as p,getAllLeafs as l}from"@jiek/pkger/entrypoints";import{dts as c}from"@jiek/rollup-plugin-dts";import{isWorkspaceDir as f,getWorkspaceDir as d}from"@jiek/utils/getWorkspaceDir";import g from"@rollup/plugin-commonjs";import h from"@rollup/plugin-json";import{nodeResolve as A}from"@rollup/plugin-node-resolve";import R from"@rollup/plugin-terser";import{sendMessage as y}from"execa";import E from"util";import m from"path";import _ from"rollup-plugin-esbuild";import C from"typescript";import{createRequire as S}from"node:module";import{program as b}from"commander";import{load as v}from"js-yaml";import"@pnpm/filter-workspace-packages";import{parse as x}from"jsonc-parser";var $,H,w,T,L,O,k,N,I,M,j,B,P,G,D,K,F,U,Q,W={};function X(){return $||($=1,(e=W).isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,o)=>!1!==o&&!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=o,e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>!("brace"!==e.type||e.commas>>0+e.ranges||(e.invalid=!0,0)),e.isInvalidBrace=e=>!("brace"!==e.type||!0!==e.invalid&&!e.dollar&&(e.commas>>0+e.ranges&&!0===e.open&&!0===e.close||(e.invalid=!0,0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||!0===e.open||!0===e.close,e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let o=e[r];Array.isArray(o)?n(o):void 0!==o&&t.push(o)}return t};return n(e),t}),W;var e}function q(){if(w)return H;w=1;const e=X();return H=(t,n={})=>{let r=(t,o={})=>{let s=n.escapeInvalid&&e.isInvalidBrace(o),i=!0===t.invalid&&!0===n.escapeInvalid,a="";if(t.value)return(s||i)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)a+=r(e);return a};return r(t)}}
2
2
  /*!
3
3
  * is-number <https://github.com/jonschlinkert/is-number>
4
4
  *
@@ -16,4 +16,4 @@ import e from"node:fs";import t,{resolve as n,relative as r,dirname as o}from"no
16
16
  *
17
17
  * Copyright (c) 2014-present, Jon Schlinkert.
18
18
  * Licensed under the MIT License.
19
- */function z(){if(I)return N;I=1;const e=m,t=Y(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},i=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},a=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},u=(e,n,r,o)=>{if(r)return t(e,n,{wrap:!1,...o});let s=String.fromCharCode(e);return e===n?s:`[${s}-${String.fromCharCode(n)}]`},p=(e,n,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return t(e,n,r)},l=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw l([e,t]);return[]},f=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw l([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,d=String(e),g=String(t),h=String(n);n=Math.max(Math.abs(n),1);let A=s(d)||s(g)||s(h),R=A?Math.max(d.length,g.length,h.length):0,y=!1===A&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),E=r.transform||(e=>t=>!0===e?Number(t):String(t))(y);if(r.toRegex&&1===n)return u(a(e,R),a(t,R),!0,r);let m={negatives:[],positives:[]},_=[],C=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?m[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):_.push(i(E(o,C),R,y)),o=f?o-n:o+n,C++;var S;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",o="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.join("|")})`),n=o&&s?`${o}|${s}`:o||s,t.wrap?`(${r}${n})`:n})(m,r):p(_,null,{wrap:!1,...r}):_},d=(e,t,s,i={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,i);if("function"==typeof s)return d(e,t,1,{transform:s});if(n(s))return d(e,t,0,s);let a={...i};return!0===a.capture&&(a.wrap=!0),s=s||a.step||1,o(s)?o(e)&&o(t)?f(e,t,s,a):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let s=r.transform||(e=>String.fromCharCode(e)),i=`${e}`.charCodeAt(0),a=`${t}`.charCodeAt(0),l=i>a,f=Math.min(i,a),d=Math.max(i,a);if(r.toRegex&&1===n)return u(f,d,!1,r);let g=[],h=0;for(;l?i>=a:i<=a;)g.push(s(i,h)),i=l?i-n:i+n,h++;return!0===r.toRegex?p(g,null,{wrap:!1,options:r}):g})(e,t,Math.max(Math.abs(s),1),a):null==s||n(s)?d(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,a)};return N=d}function V(){if(F)return K;F=1;const e=q(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:i,CHAR_RIGHT_PARENTHESES:a,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:d,CHAR_NO_BREAK_SPACE:g,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=D?G:(D=1,G={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return K=(A,R={})=>{if("string"!=typeof A)throw new TypeError("Expected a string");let y=R||{},E="number"==typeof y.maxLength?Math.min(t,y.maxLength):t;if(A.length>E)throw new SyntaxError(`Input length (${A.length}), exceeds max characters (${E})`);let m,_={type:"root",input:A,nodes:[]},C=[_],S=_,b=_,v=0,x=A.length,$=0,H=0;const w=()=>A[$++],T=e=>{if("text"===e.type&&"dot"===b.type&&(b.type="text"),!b||"text"!==b.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=b,b=e,e;b.value+=e.value};for(T({type:"bos"});$<x;)if(S=C[C.length-1],m=w(),m!==h&&m!==g)if(m!==n)if(m!==c)if(m!==l)if(m!==i)if(m!==a)if(m!==f&&m!==d&&m!==r)if(m!==u)if(m!==p)if(m===o&&H>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}T({type:"comma",value:m}),S.commas++}else if(m===s&&H>0&&0===S.commas){let e=S.nodes;if(0===H||0===e.length){T({type:"text",value:m});continue}if("dot"===b.type){if(S.range=[],b.value+=m,b.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,b.type="text";continue}S.ranges++,S.args=[];continue}if("range"===b.type){e.pop();let t=e[e.length-1];t.value+=b.value+m,b=t,S.ranges--;continue}T({type:"dot",value:m})}else T({type:"text",value:m});else{if("brace"!==S.type){T({type:"text",value:m});continue}let e="close";S=C.pop(),S.close=!0,T({type:e,value:m}),H--,S=C[C.length-1]}else{H++;let e=b.value&&"$"===b.value.slice(-1)||!0===S.dollar;S=T({type:"brace",open:!0,close:!1,dollar:e,depth:H,commas:0,ranges:0,nodes:[]}),C.push(S),T({type:"open",value:m})}else{let e,t=m;for(!0!==R.keepQuotes&&(m="");$<x&&(e=w());)if(e!==n){if(e===t){!0===R.keepQuotes&&(m+=e);break}m+=e}else m+=e+w();T({type:"text",value:m})}else{if("paren"!==S.type){T({type:"text",value:m});continue}S=C.pop(),T({type:"text",value:m}),S=C[C.length-1]}else S=T({type:"paren",nodes:[]}),C.push(S),T({type:"text",value:m});else{let e;for(v++;$<x&&(e=w());)if(m+=e,e!==l)if(e!==n){if(e===c&&(v--,0===v))break}else m+=w();else v++;T({type:"text",value:m})}else T({type:"text",value:"\\"+m});else T({type:"text",value:(R.keepEscaping?m:"")+w()});do{if(S=C.pop(),"root"!==S.type){S.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=C[C.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(C.length>0);return T({type:"eos"}),_},K}function J(){if(Q)return U;Q=1;const e=q(),t=function(){if(j)return M;j=1;const e=z(),t=X();return M=(n,r={})=>{let o=(n,s={})=>{let i=t.isInvalidBrace(s),a=!0===n.invalid&&!0===r.escapeInvalid,u=!0===i||!0===a,p=!0===r.escapeInvalid?"\\":"",l="";if(!0===n.isOpen)return p+n.value;if(!0===n.isClose)return p+n.value;if("open"===n.type)return u?p+n.value:"(";if("close"===n.type)return u?p+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let o=t.reduce(n.nodes),s=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(let e of n.nodes)l+=o(e,n);return l};return o(n)}}(),n=function(){if(P)return B;P=1;const e=z(),t=q(),n=X(),r=(e="",t="",o=!1)=>{let s=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?n.flatten(t).map((e=>`{${e}}`)):t;for(let n of e)if(Array.isArray(n))for(let e of n)s.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(s)};return B=(o,s={})=>{let i=void 0===s.rangeLimit?1e3:s.rangeLimit,a=(o,u={})=>{o.queue=[];let p=u,l=u.queue;for(;"brace"!==p.type&&"root"!==p.type&&p.parent;)p=p.parent,l=p.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){let a=n.reduce(o.nodes);if(n.exceedsLimit(...a,s.step,i))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...a,s);return 0===u.length&&(u=t(o,s)),l.push(r(l.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,d=o;for(;"brace"!==d.type&&"root"!==d.type&&d.parent;)d=d.parent,f=d.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(r(f.pop(),t.value)):t.nodes&&a(t,o):l.push(r(l.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(a(o))}}(),r=V(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};return o.parse=(e,t={})=>r(e,t),o.stringify=(t,n={})=>e("string"==typeof t?o.parse(t,n):t,n),o.compile=(e,n={})=>("string"==typeof e&&(e=o.parse(e,n)),t(e,n)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let r=n(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),U=o}var ee,te,ne,re,oe,se,ie,ae,ue,pe,le,ce,fe,de={};function ge(){if(te)return ee;te=1;const e=_,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",s="[^/]",i=`(?:${o}|$)`,a=`(?:^|${o})`,u=`${r}{1,2}${i}`,p={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:i,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${a}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${i})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:a},l={...p,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return ee={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?l:p}}function he(){return ne||(ne=1,function(e){const t=_,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:i}=ge();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,"\\$1"),e.toPosixSlashes=e=>e.replace(r,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===t.sep,e.escapeLast=(t,n,r)=>{const o=t.lastIndexOf(n,r);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,n,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?"":"^"}(?:${e})${n.contains?"":"$"}`;return!0===t.negated&&(r=`(?:^(?!${r}).*$)`),r}}(de)),de}function Ae(){if(ue)return ae;ue=1;const e=_,t=function(){if(oe)return re;oe=1;const e=he(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:i,CHAR_FORWARD_SLASH:a,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:d,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:h}=ge(),A=e=>e===a||e===r,R=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return re=(y,E)=>{const m=E||{},_=y.length-1,C=!0===m.parts||!0===m.scanToEnd,S=[],b=[],v=[];let x,$,H=y,w=-1,T=0,L=0,O=!1,k=!1,N=!1,I=!1,M=!1,j=!1,B=!1,P=!1,G=!1,D=!1,K=0,F={value:"",depth:0,isGlob:!1};const U=()=>w>=_,Q=()=>(x=$,H.charCodeAt(++w));for(;w<_;){let e;if($=Q(),$!==r){if(!0===j||$===u){for(K++;!0!==U()&&($=Q());)if($!==r)if($!==u){if(!0!==j&&$===s&&($=Q())===s){if(O=F.isBrace=!0,N=F.isGlob=!0,D=!0,!0===C)continue;break}if(!0!==j&&$===o){if(O=F.isBrace=!0,N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===d&&(K--,0===K)){j=!1,O=F.isBrace=!0,D=!0;break}}else K++;else B=F.backslashes=!0,Q();if(!0===C)continue;break}if($!==a){if(!0!==m.noext&&!0==($===c||$===n||$===t||$===f||$===i)&&H.charCodeAt(w+1)===p){if(N=F.isGlob=!0,I=F.isExtglob=!0,D=!0,$===i&&w===T&&(G=!0),!0===C){for(;!0!==U()&&($=Q());)if($!==r){if($===g){N=F.isGlob=!0,D=!0;break}}else B=F.backslashes=!0,$=Q();continue}break}if($===t){if(x===t&&(M=F.isGlobstar=!0),N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===f){if(N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===l){for(;!0!==U()&&(e=Q());)if(e!==r){if(e===h){k=F.isBracket=!0,N=F.isGlob=!0,D=!0;break}}else B=F.backslashes=!0,Q();if(!0===C)continue;break}if(!0===m.nonegate||$!==i||w!==T){if(!0!==m.noparen&&$===p){if(N=F.isGlob=!0,!0===C){for(;!0!==U()&&($=Q());)if($!==p){if($===g){D=!0;break}}else B=F.backslashes=!0,$=Q();continue}break}if(!0===N){if(D=!0,!0===C)continue;break}}else P=F.negated=!0,T++}else{if(S.push(w),b.push(F),F={value:"",depth:0,isGlob:!1},!0===D)continue;if(x===s&&w===T+1){T+=2;continue}L=w+1}}else B=F.backslashes=!0,$=Q(),$===u&&(j=!0)}!0===m.noext&&(I=!1,N=!1);let W=H,X="",q="";T>0&&(X=H.slice(0,T),H=H.slice(T),L-=T),W&&!0===N&&L>0?(W=H.slice(0,L),q=H.slice(L)):!0===N?(W="",q=H):W=H,W&&""!==W&&"/"!==W&&W!==H&&A(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),!0===m.unescape&&(q&&(q=e.removeBackslashes(q)),W&&!0===B&&(W=e.removeBackslashes(W)));const Z={prefix:X,input:y,start:T,base:W,glob:q,isBrace:O,isBracket:k,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:G};if(!0===m.tokens&&(Z.maxDepth=0,A($)||b.push(F),Z.tokens=b),!0===m.parts||!0===m.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:T,r=S[t],o=y.slice(n,r);m.tokens&&(0===t&&0!==T?(b[t].isPrefix=!0,b[t].value=X):b[t].value=o,R(b[t]),Z.maxDepth+=b[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<y.length){const t=y.slice(e+1);v.push(t),m.tokens&&(b[b.length-1].value=t,R(b[b.length-1]),Z.maxDepth+=b[b.length-1].depth)}Z.slashes=S,Z.parts=v}return Z}}(),n=function(){if(ie)return se;ie=1;const e=ge(),t=he(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:i}=e,a=(e,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...e,n);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map((e=>t.escapeRegex(e))).join("..")}return r},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,p=(l,c)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=i[l]||l;const f={...c},d="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let g=l.length;if(g>d)throw new SyntaxError(`Input length: ${g}, exceeds maximum allowed length: ${d}`);const h={type:"bos",value:"",output:f.prepend||""},A=[h],R=f.capture?"":"?:",y=t.isWindows(c),E=e.globChars(y),m=e.extglobChars(E),{DOT_LITERAL:_,PLUS_LITERAL:C,SLASH_LITERAL:S,ONE_CHAR:b,DOTS_SLASH:v,NO_DOT:x,NO_DOT_SLASH:$,NO_DOTS_SLASH:H,QMARK:w,QMARK_NO_DOT:T,STAR:L,START_ANCHOR:O}=E,k=e=>`(${R}(?:(?!${O}${e.dot?v:_}).)*?)`,N=f.dot?"":x,I=f.dot?w:T;let M=!0===f.bash?k(f):L;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const j={input:l,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:A};l=t.removePrefix(l,j),g=l.length;const B=[],P=[],G=[];let D,K=h;const F=()=>j.index===g-1,U=j.peek=(e=1)=>l[j.index+e],Q=j.advance=()=>l[++j.index]||"",W=()=>l.slice(j.index+1),X=(e="",t=0)=>{j.consumed+=e,j.index+=t},q=e=>{j.output+=null!=e.output?e.output:e.value,X(e.value)},Z=()=>{let e=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)Q(),j.start++,e++;return e%2!=0&&(j.negated=!0,j.start++,!0)},Y=e=>{j[e]++,G.push(e)},z=e=>{j[e]--,G.pop()},V=e=>{if("globstar"===K.type){const t=j.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||B.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(j.output=j.output.slice(0,-K.output.length),K.type="star",K.value="*",K.output=M,j.output+=K.output)}if(B.length&&"paren"!==e.type&&(B[B.length-1].inner+=e.value),(e.value||e.output)&&q(e),K&&"text"===K.type&&"text"===e.type)return K.value+=e.value,void(K.output=(K.output||"")+e.value);e.prev=K,A.push(e),K=e},J=(e,t)=>{const n={...m[t],conditions:1,inner:""};n.prev=K,n.parens=j.parens,n.output=j.output;const r=(f.capture?"(":"")+n.open;Y("parens"),V({type:e,value:t,output:j.output?"":b}),V({type:"paren",extglob:!0,value:Q(),output:r}),B.push(n)},ee=e=>{let t,n=e.close+(f.capture?")":"");if("negate"===e.type){let r=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=k(f)),(r!==M||F()||/^\)+$/.test(W()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=W())&&/^\.[^\\/.]+$/.test(t)){const o=p(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(j.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:D,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let e=!1,n=l.replace(s,((t,n,r,o,s,i)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(s?w.repeat(s.length):""):0===i?I+(s?w.repeat(s.length):""):w.repeat(r.length):"."===o?_.repeat(r.length):"*"===o?n?n+o+(s?M:""):M:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===l&&!0===f.contains?(j.output=l,j):(j.output=t.wrapOutput(n,j,c),j)}for(;!F();){if(D=Q(),"\0"===D)continue;if("\\"===D){const e=U();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){D+="\\",V({type:"text",value:D});continue}const t=/^\\+/.exec(W());let n=0;if(t&&t[0].length>2&&(n=t[0].length,j.index+=n,n%2!=0&&(D+="\\")),!0===f.unescape?D=Q():D+=Q(),0===j.brackets){V({type:"text",value:D});continue}}if(j.brackets>0&&("]"!==D||"["===K.value||"[^"===K.value)){if(!1!==f.posix&&":"===D){const e=K.value.slice(1);if(e.includes("[")&&(K.posix=!0,e.includes(":"))){const e=K.value.lastIndexOf("["),t=K.value.slice(0,e),n=K.value.slice(e+2),o=r[n];if(o){K.value=t+o,j.backtrack=!0,Q(),h.output||1!==A.indexOf(K)||(h.output=b);continue}}}("["===D&&":"!==U()||"-"===D&&"]"===U())&&(D=`\\${D}`),"]"!==D||"["!==K.value&&"[^"!==K.value||(D=`\\${D}`),!0===f.posix&&"!"===D&&"["===K.value&&(D="^"),K.value+=D,q({value:D});continue}if(1===j.quotes&&'"'!==D){D=t.escapeRegex(D),K.value+=D,q({value:D});continue}if('"'===D){j.quotes=1===j.quotes?0:1,!0===f.keepQuotes&&V({type:"text",value:D});continue}if("("===D){Y("parens"),V({type:"paren",value:D});continue}if(")"===D){if(0===j.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=B[B.length-1];if(e&&j.parens===e.parens+1){ee(B.pop());continue}V({type:"paren",value:D,output:j.parens?")":"\\)"}),z("parens");continue}if("["===D){if(!0!==f.nobracket&&W().includes("]"))Y("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));D=`\\${D}`}V({type:"bracket",value:D});continue}if("]"===D){if(!0===f.nobracket||K&&"bracket"===K.type&&1===K.value.length){V({type:"text",value:D,output:`\\${D}`});continue}if(0===j.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));V({type:"text",value:D,output:`\\${D}`});continue}z("brackets");const e=K.value.slice(1);if(!0===K.posix||"^"!==e[0]||e.includes("/")||(D=`/${D}`),K.value+=D,q({value:D}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(K.value);if(j.output=j.output.slice(0,-K.value.length),!0===f.literalBrackets){j.output+=n,K.value=n;continue}K.value=`(${R}${n}|${K.value})`,j.output+=K.value;continue}if("{"===D&&!0!==f.nobrace){Y("braces");const e={type:"brace",value:D,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};P.push(e),V(e);continue}if("}"===D){const e=P[P.length-1];if(!0===f.nobrace||!e){V({type:"text",value:D,output:D});continue}let t=")";if(!0===e.dots){const e=A.slice(),n=[];for(let t=e.length-1;t>=0&&(A.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=a(n,f),j.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=j.output.slice(0,e.outputIndex),r=j.tokens.slice(e.tokensIndex);e.value=e.output="\\{",D=t="\\}",j.output=n;for(const e of r)j.output+=e.output||e.value}V({type:"brace",value:D,output:t}),z("braces"),P.pop();continue}if("|"===D){B.length>0&&B[B.length-1].conditions++,V({type:"text",value:D});continue}if(","===D){let e=D;const t=P[P.length-1];t&&"braces"===G[G.length-1]&&(t.comma=!0,e="|"),V({type:"comma",value:D,output:e});continue}if("/"===D){if("dot"===K.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",A.pop(),K=h;continue}V({type:"slash",value:D,output:S});continue}if("."===D){if(j.braces>0&&"dot"===K.type){"."===K.value&&(K.output=_);const e=P[P.length-1];K.type="dots",K.output+=D,K.value+=D,e.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==K.type&&"slash"!==K.type){V({type:"text",value:D,output:_});continue}V({type:"dot",value:D,output:_});continue}if("?"===D){if((!K||"("!==K.value)&&!0!==f.noextglob&&"("===U()&&"?"!==U(2)){J("qmark",D);continue}if(K&&"paren"===K.type){const e=U();let n=D;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===K.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(W()))&&(n=`\\${D}`),V({type:"text",value:D,output:n});continue}if(!0!==f.dot&&("slash"===K.type||"bos"===K.type)){V({type:"qmark",value:D,output:T});continue}V({type:"qmark",value:D,output:w});continue}if("!"===D){if(!0!==f.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){J("negate",D);continue}if(!0!==f.nonegate&&0===j.index){Z();continue}}if("+"===D){if(!0!==f.noextglob&&"("===U()&&"?"!==U(2)){J("plus",D);continue}if(K&&"("===K.value||!1===f.regex){V({type:"plus",value:D,output:C});continue}if(K&&("bracket"===K.type||"paren"===K.type||"brace"===K.type)||j.parens>0){V({type:"plus",value:D});continue}V({type:"plus",value:C});continue}if("@"===D){if(!0!==f.noextglob&&"("===U()&&"?"!==U(2)){V({type:"at",extglob:!0,value:D,output:""});continue}V({type:"text",value:D});continue}if("*"!==D){"$"!==D&&"^"!==D||(D=`\\${D}`);const e=o.exec(W());e&&(D+=e[0],j.index+=e[0].length),V({type:"text",value:D});continue}if(K&&("globstar"===K.type||!0===K.star)){K.type="star",K.star=!0,K.value+=D,K.output=M,j.backtrack=!0,j.globstar=!0,X(D);continue}let e=W();if(!0!==f.noextglob&&/^\([^?]/.test(e)){J("star",D);continue}if("star"===K.type){if(!0===f.noglobstar){X(D);continue}const t=K.prev,n=t.prev,r="slash"===t.type||"bos"===t.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===f.bash&&(!r||e[0]&&"/"!==e[0])){V({type:"star",value:D,output:""});continue}const s=j.braces>0&&("comma"===t.type||"brace"===t.type),i=B.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!s&&!i){V({type:"star",value:D,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[j.index+4];if(t&&"/"!==t)break;e=e.slice(3),X("/**",3)}if("bos"===t.type&&F()){K.type="globstar",K.value+=D,K.output=k(f),j.output=K.output,j.globstar=!0,X(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&F()){j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=k(f)+(f.strictSlashes?")":"|$)"),K.value+=D,j.globstar=!0,j.output+=t.output+K.output,X(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=`${k(f)}${S}|${S}${n})`,K.value+=D,j.output+=t.output+K.output,j.globstar=!0,X(D+Q()),V({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){K.type="globstar",K.value+=D,K.output=`(?:^|${S}|${k(f)}${S})`,j.output=K.output,j.globstar=!0,X(D+Q()),V({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-K.output.length),K.type="globstar",K.output=k(f),K.value+=D,j.output+=K.output,j.globstar=!0,X(D);continue}const n={type:"star",value:D,output:M};!0!==f.bash?!K||"bracket"!==K.type&&"paren"!==K.type||!0!==f.regex?(j.index!==j.start&&"slash"!==K.type&&"dot"!==K.type||("dot"===K.type?(j.output+=$,K.output+=$):!0===f.dot?(j.output+=H,K.output+=H):(j.output+=N,K.output+=N),"*"!==U()&&(j.output+=b,K.output+=b)),V(n)):(n.output=D,V(n)):(n.output=".*?","bos"!==K.type&&"slash"!==K.type||(n.output=N+n.output),V(n))}for(;j.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));j.output=t.escapeLast(j.output,"["),z("brackets")}for(;j.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));j.output=t.escapeLast(j.output,"("),z("parens")}for(;j.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));j.output=t.escapeLast(j.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==K.type&&"bracket"!==K.type||V({type:"maybe_slash",value:"",output:`${S}?`}),!0===j.backtrack){j.output="";for(const e of j.tokens)j.output+=null!=e.output?e.output:e.value,e.suffix&&(j.output+=e.suffix)}return j};return p.fastpaths=(r,o)=>{const s={...o},a="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,u=r.length;if(u>a)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${a}`);r=i[r]||r;const p=t.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:d,NO_DOT:g,NO_DOTS:h,NO_DOTS_SLASH:A,STAR:R,START_ANCHOR:y}=e.globChars(p),E=s.dot?h:g,m=s.dot?A:g,_=s.capture?"":"?:";let C=!0===s.bash?".*?":R;s.capture&&(C=`(${C})`);const S=e=>!0===e.noglobstar?C:`(${_}(?:(?!${y}${e.dot?d:l}).)*?)`,b=e=>{switch(e){case"*":return`${E}${f}${C}`;case".*":return`${l}${f}${C}`;case"*.*":return`${E}${C}${l}${f}${C}`;case"*/*":return`${E}${C}${c}${f}${m}${C}`;case"**":return E+S(s);case"**/*":return`(?:${E}${S(s)}${c})?${m}${f}${C}`;case"**/*.*":return`(?:${E}${S(s)}${c})?${m}${C}${l}${f}${C}`;case"**/.*":return`(?:${E}${S(s)}${c})?${l}${f}${C}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=b(t[1]);if(!n)return;return n+l+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let x=b(v);return x&&!0!==s.strictSlashes&&(x+=`${c}?`),x},se=p}(),r=he(),o=ge(),s=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>s(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(i=e)&&"object"==typeof i&&!Array.isArray(i)&&e.tokens&&e.input;var i;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const a=t||{},u=r.isWindows(t),p=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=p.state;delete p.state;let c=()=>!1;if(a.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(a.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:i,output:f}=s.test(n,p,t,{glob:e,posix:u}),d={glob:e,state:l,regex:p,posix:u,input:n,output:f,match:i,isMatch:o};return"function"==typeof a.onResult&&a.onResult(d),!1===o?(d.isMatch=!1,!!r&&d):c(n)?("function"==typeof a.onIgnore&&a.onIgnore(d),d.isMatch=!1,!!r&&d):("function"==typeof a.onMatch&&a.onMatch(d),!r||d)};return n&&(f.state=l),f};return s.test=(e,t,n,{glob:o,posix:i}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const a=n||{},u=a.format||(i?r.toPosixSlashes:null);let p=e===o,l=p&&u?u(e):e;return!1===p&&(l=u?u(e):e,p=l===o),!1!==p&&!0!==a.capture||(p=!0===a.matchBase||!0===a.basename?s.matchBase(e,t,n,i):t.exec(l)),{isMatch:Boolean(p),match:p,output:l}},s.matchBase=(t,n,o,i=r.isWindows(o))=>(n instanceof RegExp?n:s.makeRe(n,o)).test(e.basename(t)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):n(e,{...t,fastpaths:!1}),s.scan=(e,n)=>t(e,n),s.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},i=o.contains?"":"^",a=o.contains?"":"$";let u=`${i}(?:${e.output})${a}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const p=s.toRegex(u,t);return!0===r&&(p.state=e),p},s.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(i.output=n.fastpaths(e,t)),i.output||(i=n(e,t)),s.compileRe(i,t,r,o)},s.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},s.constants=o,ae=s}function Re(){return le?pe:(le=1,pe=Ae())}var ye=function(){if(fe)return ce;fe=1;const e=m,t=J(),n=Re(),r=he(),o=e=>""===e||"./"===e,s=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,i=new Set,a=0,u=e=>{i.add(e.output),r&&r.onResult&&r.onResult(e)};for(let i=0;i<t.length;i++){let p=n(String(t[i]),{...r,onResult:u},!0),l=p.state.negated||p.state.negatedExtglob;l&&a++;for(let t of e){let e=p(t,!0);(l?!e.isMatch:e.isMatch)&&(l?o.add(e.output):(o.delete(e.output),s.add(e.output)))}}let p=(a===t.length?[...i]:[...s]).filter((e=>!o.has(e)));if(r&&0===p.length){if(!0===r.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}return p};return s.match=s,s.matcher=(e,t)=>n(e,t),s.any=s.isMatch=(e,t,r)=>n(t,r)(e),s.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],i=new Set(s(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)i.has(e)||r.add(e);return[...r]},s.contains=(t,n,r)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(n))return n.some((e=>s.contains(t,e,r)));if("string"==typeof n){if(o(t)||o(n))return!1;if(t.includes(n)||t.startsWith("./")&&t.slice(2).includes(n))return!0}return s.isMatch(t,n,{...r,contains:!0})},s.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,n),i={};for(let t of o)i[t]=e[t];return i},s.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(o.some((e=>t(e))))return!0}return!1},s.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(!o.every((e=>t(e))))return!1}return!0},s.all=(t,r,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(r).every((e=>n(e,o)(t)))},s.capture=(e,t,o)=>{let s=r.isWindows(o),i=n.makeRe(String(e),{...o,capture:!0}).exec(s?r.toPosixSlashes(t):t);if(i)return i.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>n.makeRe(...e),s.scan=(...e)=>n.scan(...e),s.parse=(e,r)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),r))o.push(n.parse(e,r));return o},s.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},ce=s}();const Ee=(e,t)=>new Set([...e].filter((e=>t.has(e))));let me;function _e(){if(me)return me;const e=S.getOptionValue("root");return me=e?t.isAbsolute(e)?e:t.resolve(process.cwd(),e):void 0,me}let Ce,Se="";try{C(import.meta.url).resolve("@pnpm/filter-workspace-packages"),Se="pnpm"}catch{}""!==Se&&S.option("-f, --filter <filter>","filter packages");let be=!1;const ve=C(import.meta.url);function xe(e){try{return ve.resolve(e),!0}catch(e){return!1}}let $e;const He=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of He)if(xe(e)){$e=e;break}const we=C(import.meta.url);let Te="jiek.config";const Le=t=>{t=n(t);const r=o(t),{extends:s,...i}=(a=t,e.existsSync(a)&&e.statSync(a).isFile()?v(e.readFileSync(a,"utf-8"),[],{allowTrailingComma:!0,allowEmptyContent:!0}):{});var a;const u=(p=s?Array.isArray(s)?s:[s]:[],p?.map((e=>n(r,e)))??[]);var p;return 0===u.length?i:u.map(Le).concat(i).reduce(((e,{compilerOptions:t={},references:n,...r})=>({...e,...r,compilerOptions:{...e.compilerOptions,...t}})),{})},Oe=(e,t)=>{e=n(e),t=n(t);const r=o(e),s=Le(e),[i,a,u,p]=[s.references?.map((({path:e})=>e)),s.files,s.include,s.exclude].map((e=>e?.map((e=>n(r,e)))??[]));if(p.length>0&&p.some((e=>ye.isMatch(t,e))))return;if(0===s.files?.length&&0===s.include?.length)return;let l=!1;if(l||(l=a.length>0&&a.includes(t)),l||(l=u.length>0&&u.some((e=>ye.isMatch(t,e)))),l)return s.compilerOptions??{};if(!(s.files&&s.files.length>0||s.include&&s.include.length>0)){i.reverse();for(const e of i){const n=Oe(e,t);if(n)return n}return s.compilerOptions}};var ke=(e={})=>{const{onEvent:t}=e;return{name:"progress",buildStart:()=>t?.("start","Start building..."),buildEnd:()=>t?.("end","Build completed!"),resolveId:{order:"post",handler:e=>t?.("resolve",`Resolving ${e}...`)},load:{order:"post",handler:e=>t?.("load",`Loading ${e}...`)},transform:{order:"post",handler:(e,n)=>t?.("transform",`Transforming ${n}...`)}}},Ne=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const Ie=["te?xt","json","(css|s[ac]ss|less|styl)"];const{JIEK_ROOT:Me,JIEK_ENTRIES:je}=process.env,Be=Me??f(),Pe={},Ge=[g()],De=function(n){const{wd:r}=function(){if(Ce)return{wd:Ce,notWorkspace:be};const e=_e();if(void 0!==e){const t=c(e,Se);return be=!t,Ce=e,{wd:Ce,notWorkspace:be}}try{Ce=f(Se)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;Ce=e,be=!0}return{wd:Ce,notWorkspace:be}}();let o=S.getOptionValue("configPath");if(o){if(!e.existsSync(o))throw new Error(`config file not found: ${o}`);t.isAbsolute(o)||(o=t.resolve(r,o))}else o=function(n,r){const o=!!$e;function s(o){const s=[t.resolve(process.cwd(),`${Te}.${o}`),t.resolve(process.cwd(),`.${Te}.${o}`),t.resolve(n,`${Te}.${o}`),t.resolve(n,`.${Te}.${o}`)];r&&s.unshift(t.resolve(r,`${Te}.${o}`),t.resolve(r,`.${Te}.${o}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return Te=s("js")??Te,Te=s("json")??Te,Te=s("yaml")??Te,o&&(Te=s("ts")??Te),t.resolve(n,Te)}(r,n);const s=t.extname(o);let i;switch(s){case".js":i=we(o);break;case".json":return we(o);case".yaml":return b(e.readFileSync(o,"utf-8"));case".ts":if($e){we($e),i=we(o);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":i={};break;default:throw new Error(`unsupported config file type: ${s}`)}if(!i)throw new Error("config file is empty");return i.default??i}()??{},{build:Ke={}}=De,Fe=`./${r(process.cwd(),n(("object"==typeof Ke?.output?.dir?Ke.output.dir.js:Ke?.output?.dir)??"dist"))}`,Ue=/\.(css|s[ac]ss|less|styl)$/,Qe=e=>n(Be,e),We=e=>e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())).replace(/(?:^|-)(\w)/g,((e,t)=>t.toUpperCase())),Xe=(e,t=Ke?.output?.minify)=>!1===t?[e]:"only-minify"===t?[{...e,entryFileNames:t=>"function"==typeof e.entryFileNames?e.entryFileNames(t).replace(/(\.[cm]?js)$/,".min$1"):(()=>{throw new Error("entryFileNames must be a function")})(),plugins:[...e.plugins??[],A()]}]:[e,{...e,entryFileNames:t=>"function"==typeof e.entryFileNames?e.entryFileNames(t).replace(/(\.[cm]?js)$/,".min$1"):(()=>{throw new Error("entryFileNames must be a function")})(),file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],A()]}],qe=(t,r={})=>{const{path:s,name:i,input:a,output:u,external:p,pkgIsModule:c,conditionals:f}=t,g=f.includes("import"),A=f.includes("require"),m=f.includes("browser");let _;[Qe("tsconfig.json"),Qe("tsconfig.dts.json")].forEach((t=>{e.existsSync(t)&&e.statSync(t).isFile()&&(_=t)}));let C={};if(_){const e=Oe(_,n(a)),{options:t,errors:r}=E.convertCompilerOptionsFromJson(e,o(_));if(r.length>0)throw new Error(r.map((e=>e.messageText)).join("\n"));C=t,delete C.composite}const S=[...f,...C.customConditions??[]],b={type:"progress",data:{name:i,path:s,exportConditions:S,input:a}},v=r?.output?.dir,{js:$,dts:H}=((e,t)=>{if(!1===t||null==t)return{js:[],dts:[]};let n=[],r=[];switch(typeof t){case"function":n=t("js",e),r=t("dts",e);break;case"object":"js"in t||"dts"in t?(n=t.js??[],r=t.dts??[]):(n=t,r=t)}return{js:n,dts:r}})(t,Ke.plugins);if(a.includes("**"))throw new Error('input should not include "**", please read the [documentation](https://nodejs.org/api/packages.html#subpath-patterns).');const w=a.includes("*")?x(process.cwd()).filter((e=>/(?<!\.d)\.[cm]?tsx?$/.test(e))):a,T=a.includes("*")?a.split("*")[0]:"";return[{input:w,external:p,output:[...Xe({dir:Fe,name:i,interop:"auto",entryFileNames:e=>Array.isArray(w)?e.facadeModuleId.replace(`${process.cwd()}/`,"./").replace(T,"").replace(/(\.[cm]?)ts$/,"$1js"):u.replace(`${Fe}/`,""),sourcemap:"object"==typeof r?.output?.sourcemap?r.output.sourcemap.js:r?.output?.sourcemap,format:g?"esm":A?"cjs":m?"umd":c?"esm":"cjs",strict:"object"==typeof r?.output?.strict?r.output.strict.js:r?.output?.strict})],plugins:[h({exportConditions:S}),import("rollup-plugin-postcss").then((({default:e})=>e({extract:n(u.replace(/\.[cm]?js$/,".css")),minimize:!0}))).catch((()=>{})),y({tsconfig:_}),d(),ke({onEvent:(e,t)=>R({...b,data:{...b.data,event:e,message:t,tags:["js"]}})}),$]},{input:w,external:p,output:[{dir:n(("object"==typeof v?v.dts:v)??"dist"),sourcemap:"object"==typeof r?.output?.sourcemap?r.output.sourcemap.dts:r?.output?.sourcemap,entryFileNames:e=>Array.isArray(w)?e.facadeModuleId.replace(`${process.cwd()}/`,"./").replace(T,"").replace(/(\.[cm]?)ts$/,".d$1ts"):u.replace(`${Fe}/`,"").replace(/(\.[cm]?)js$/,".d$1ts"),strict:"object"==typeof r?.output?.strict?r.output.strict.dts:r?.output?.strict}],plugins:[h({exportConditions:S}),Ne({patterns:[Ue]}),l({respectExternal:!0,compilerOptions:C}),ke({onEvent:(e,t)=>R({...b,data:{...b.data,event:e,message:t,tags:["dts"]}})}),H]}]};function Ze(t){const{name:o,type:l,exports:c}=t,f="module"===l;if(!o)throw new Error("package.json name is required");if(!c)throw new Error("package.json exports is required");const d=je?.split(",").map((e=>e.trim())).map((e=>({index:"."}[e]??e))),g=We(o),h=function(t=process.cwd()){const n="string"==typeof t?e.existsSync(`${t}/package.json`)?JSON.parse(e.readFileSync(`${t}/package.json`,"utf-8")):{}:t,{name:r,dependencies:o={},peerDependencies:s={},optionalDependencies:i={}}=n;if(!r)throw new Error("package.json must have a name field");return Object.keys(o).concat(Object.keys(s)).concat(Object.keys(i)).map((e=>new RegExp(`^${e}(/.*)?$`))).concat([new RegExp(`^${r}(/.*)?(?<!${Ie.map((e=>`\\.${e}`)).join("|")})$`),/^node:/])}(t),[A,y]=function({entrypoints:e,pkgIsModule:t,entries:o,config:p,dir:l,noFilter:c,isPublish:f}){const{build:d={},publish:{withSuffix:g=!1,withSource:h=!0}={}}=p??{},{crossModuleConvertor:A=!0}=d,R=`./${(e=>r(l??process.cwd(),e))(((...e)=>n(l??process.cwd(),...e))(("object"==typeof d?.output?.dir?d.output.dir.js:d?.output?.dir)??"dist"))}`,[,y]=s(e);o&&Object.entries(y).forEach((([e])=>{o.some((t=>ye.isMatch(e,t,{matchBase:!0})))||delete y[e]}));const E=c?y:i(y,{skipValue:[/(^|\/)\.jk-noentry/,...a]});return[E,u(E,{outdir:R,withSuffix:f?g:void 0,withSource:f?h:void 0,withConditional:{...A?{import:e=>!t&&0===Ee(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ee(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{}}})]}({entrypoints:c,pkgIsModule:f,entries:d,config:De}),E=new Map;p(A,(({keys:e,value:t})=>{if("string"==typeof t){const n=E.get(t)??[];E.set(t,n),n.push(e)}return!1}));const m=[];return E.forEach(((e,t)=>e.forEach((e=>{const[n,...r]=e,o=g+("."===n?"":We(n)),s=((e,t)=>t.reduce(((e,t)=>{if("string"==typeof e)throw new Error("key not found in exports");if(!(t in e))throw new Error(`key ${t} not found in exports`);return e[t]}),e))(y,e),i={path:n,name:o,input:t,external:h,pkgIsModule:f};switch(typeof s){case"string":m.push(...qe({...i,output:s,conditionals:r},Ke));break;case"object":p(s,(({keys:e,value:t})=>{const n=[...new Set([...r,...e])];return"string"==typeof t&&m.push(...qe({...i,output:t,conditionals:n},Ke)),!1}))}})))),R({type:"init",data:{leafMap:E,targetsLength:m.length}}),m.map((e=>({...Pe,...e,plugins:[...Ge,e.plugins]})))}export{Ze as template};
19
+ */function z(){if(I)return N;I=1;const e=E,t=Y(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},i=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},a=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},u=(e,n,r,o)=>{if(r)return t(e,n,{wrap:!1,...o});let s=String.fromCharCode(e);return e===n?s:`[${s}-${String.fromCharCode(n)}]`},p=(e,n,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return t(e,n,r)},l=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw l([e,t]);return[]},f=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw l([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,d=String(e),g=String(t),h=String(n);n=Math.max(Math.abs(n),1);let A=s(d)||s(g)||s(h),R=A?Math.max(d.length,g.length,h.length):0,y=!1===A&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),E=r.transform||(e=>t=>!0===e?Number(t):String(t))(y);if(r.toRegex&&1===n)return u(a(e,R),a(t,R),!0,r);let m={negatives:[],positives:[]},_=[],C=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?m[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):_.push(i(E(o,C),R,y)),o=f?o-n:o+n,C++;var S;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",o="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.join("|")})`),n=o&&s?`${o}|${s}`:o||s,t.wrap?`(${r}${n})`:n})(m,r):p(_,null,{wrap:!1,...r}):_},d=(e,t,s,i={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,i);if("function"==typeof s)return d(e,t,1,{transform:s});if(n(s))return d(e,t,0,s);let a={...i};return!0===a.capture&&(a.wrap=!0),s=s||a.step||1,o(s)?o(e)&&o(t)?f(e,t,s,a):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let s=r.transform||(e=>String.fromCharCode(e)),i=`${e}`.charCodeAt(0),a=`${t}`.charCodeAt(0),l=i>a,f=Math.min(i,a),d=Math.max(i,a);if(r.toRegex&&1===n)return u(f,d,!1,r);let g=[],h=0;for(;l?i>=a:i<=a;)g.push(s(i,h)),i=l?i-n:i+n,h++;return!0===r.toRegex?p(g,null,{wrap:!1,options:r}):g})(e,t,Math.max(Math.abs(s),1),a):null==s||n(s)?d(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,a)};return N=d}function V(){if(F)return K;F=1;const e=q(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:i,CHAR_RIGHT_PARENTHESES:a,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:d,CHAR_NO_BREAK_SPACE:g,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=D?G:(D=1,G={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return K=(A,R={})=>{if("string"!=typeof A)throw new TypeError("Expected a string");let y=R||{},E="number"==typeof y.maxLength?Math.min(t,y.maxLength):t;if(A.length>E)throw new SyntaxError(`Input length (${A.length}), exceeds max characters (${E})`);let m,_={type:"root",input:A,nodes:[]},C=[_],S=_,b=_,v=0,x=A.length,$=0,H=0;const w=()=>A[$++],T=e=>{if("text"===e.type&&"dot"===b.type&&(b.type="text"),!b||"text"!==b.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=b,b=e,e;b.value+=e.value};for(T({type:"bos"});$<x;)if(S=C[C.length-1],m=w(),m!==h&&m!==g)if(m!==n)if(m!==c)if(m!==l)if(m!==i)if(m!==a)if(m!==f&&m!==d&&m!==r)if(m!==u)if(m!==p)if(m===o&&H>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}T({type:"comma",value:m}),S.commas++}else if(m===s&&H>0&&0===S.commas){let e=S.nodes;if(0===H||0===e.length){T({type:"text",value:m});continue}if("dot"===b.type){if(S.range=[],b.value+=m,b.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,b.type="text";continue}S.ranges++,S.args=[];continue}if("range"===b.type){e.pop();let t=e[e.length-1];t.value+=b.value+m,b=t,S.ranges--;continue}T({type:"dot",value:m})}else T({type:"text",value:m});else{if("brace"!==S.type){T({type:"text",value:m});continue}let e="close";S=C.pop(),S.close=!0,T({type:e,value:m}),H--,S=C[C.length-1]}else{H++;let e=b.value&&"$"===b.value.slice(-1)||!0===S.dollar;S=T({type:"brace",open:!0,close:!1,dollar:e,depth:H,commas:0,ranges:0,nodes:[]}),C.push(S),T({type:"open",value:m})}else{let e,t=m;for(!0!==R.keepQuotes&&(m="");$<x&&(e=w());)if(e!==n){if(e===t){!0===R.keepQuotes&&(m+=e);break}m+=e}else m+=e+w();T({type:"text",value:m})}else{if("paren"!==S.type){T({type:"text",value:m});continue}S=C.pop(),T({type:"text",value:m}),S=C[C.length-1]}else S=T({type:"paren",nodes:[]}),C.push(S),T({type:"text",value:m});else{let e;for(v++;$<x&&(e=w());)if(m+=e,e!==l)if(e!==n){if(e===c&&(v--,0===v))break}else m+=w();else v++;T({type:"text",value:m})}else T({type:"text",value:"\\"+m});else T({type:"text",value:(R.keepEscaping?m:"")+w()});do{if(S=C.pop(),"root"!==S.type){S.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=C[C.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(C.length>0);return T({type:"eos"}),_},K}function J(){if(Q)return U;Q=1;const e=q(),t=function(){if(j)return M;j=1;const e=z(),t=X();return M=(n,r={})=>{let o=(n,s={})=>{let i=t.isInvalidBrace(s),a=!0===n.invalid&&!0===r.escapeInvalid,u=!0===i||!0===a,p=!0===r.escapeInvalid?"\\":"",l="";if(!0===n.isOpen)return p+n.value;if(!0===n.isClose)return p+n.value;if("open"===n.type)return u?p+n.value:"(";if("close"===n.type)return u?p+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let o=t.reduce(n.nodes),s=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(let e of n.nodes)l+=o(e,n);return l};return o(n)}}(),n=function(){if(P)return B;P=1;const e=z(),t=q(),n=X(),r=(e="",t="",o=!1)=>{let s=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?n.flatten(t).map((e=>`{${e}}`)):t;for(let n of e)if(Array.isArray(n))for(let e of n)s.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(s)};return B=(o,s={})=>{let i=void 0===s.rangeLimit?1e3:s.rangeLimit,a=(o,u={})=>{o.queue=[];let p=u,l=u.queue;for(;"brace"!==p.type&&"root"!==p.type&&p.parent;)p=p.parent,l=p.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){let a=n.reduce(o.nodes);if(n.exceedsLimit(...a,s.step,i))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...a,s);return 0===u.length&&(u=t(o,s)),l.push(r(l.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,d=o;for(;"brace"!==d.type&&"root"!==d.type&&d.parent;)d=d.parent,f=d.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(r(f.pop(),t.value)):t.nodes&&a(t,o):l.push(r(l.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(a(o))}}(),r=V(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};return o.parse=(e,t={})=>r(e,t),o.stringify=(t,n={})=>e("string"==typeof t?o.parse(t,n):t,n),o.compile=(e,n={})=>("string"==typeof e&&(e=o.parse(e,n)),t(e,n)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let r=n(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),U=o}var ee,te,ne,re,oe,se,ie,ae,ue,pe,le,ce,fe,de={};function ge(){if(te)return ee;te=1;const e=m,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",s="[^/]",i=`(?:${o}|$)`,a=`(?:^|${o})`,u=`${r}{1,2}${i}`,p={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:i,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${a}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${i})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:a},l={...p,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return ee={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?l:p}}function he(){return ne||(ne=1,function(e){const t=m,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:i}=ge();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,"\\$1"),e.toPosixSlashes=e=>e.replace(r,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===t.sep,e.escapeLast=(t,n,r)=>{const o=t.lastIndexOf(n,r);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,n,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?"":"^"}(?:${e})${n.contains?"":"$"}`;return!0===t.negated&&(r=`(?:^(?!${r}).*$)`),r}}(de)),de}function Ae(){if(ue)return ae;ue=1;const e=m,t=function(){if(oe)return re;oe=1;const e=he(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:i,CHAR_FORWARD_SLASH:a,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:d,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:h}=ge(),A=e=>e===a||e===r,R=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return re=(y,E)=>{const m=E||{},_=y.length-1,C=!0===m.parts||!0===m.scanToEnd,S=[],b=[],v=[];let x,$,H=y,w=-1,T=0,L=0,O=!1,k=!1,N=!1,I=!1,M=!1,j=!1,B=!1,P=!1,G=!1,D=!1,K=0,F={value:"",depth:0,isGlob:!1};const U=()=>w>=_,Q=()=>(x=$,H.charCodeAt(++w));for(;w<_;){let e;if($=Q(),$!==r){if(!0===j||$===u){for(K++;!0!==U()&&($=Q());)if($!==r)if($!==u){if(!0!==j&&$===s&&($=Q())===s){if(O=F.isBrace=!0,N=F.isGlob=!0,D=!0,!0===C)continue;break}if(!0!==j&&$===o){if(O=F.isBrace=!0,N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===d&&(K--,0===K)){j=!1,O=F.isBrace=!0,D=!0;break}}else K++;else B=F.backslashes=!0,Q();if(!0===C)continue;break}if($!==a){if(!0!==m.noext&&!0==($===c||$===n||$===t||$===f||$===i)&&H.charCodeAt(w+1)===p){if(N=F.isGlob=!0,I=F.isExtglob=!0,D=!0,$===i&&w===T&&(G=!0),!0===C){for(;!0!==U()&&($=Q());)if($!==r){if($===g){N=F.isGlob=!0,D=!0;break}}else B=F.backslashes=!0,$=Q();continue}break}if($===t){if(x===t&&(M=F.isGlobstar=!0),N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===f){if(N=F.isGlob=!0,D=!0,!0===C)continue;break}if($===l){for(;!0!==U()&&(e=Q());)if(e!==r){if(e===h){k=F.isBracket=!0,N=F.isGlob=!0,D=!0;break}}else B=F.backslashes=!0,Q();if(!0===C)continue;break}if(!0===m.nonegate||$!==i||w!==T){if(!0!==m.noparen&&$===p){if(N=F.isGlob=!0,!0===C){for(;!0!==U()&&($=Q());)if($!==p){if($===g){D=!0;break}}else B=F.backslashes=!0,$=Q();continue}break}if(!0===N){if(D=!0,!0===C)continue;break}}else P=F.negated=!0,T++}else{if(S.push(w),b.push(F),F={value:"",depth:0,isGlob:!1},!0===D)continue;if(x===s&&w===T+1){T+=2;continue}L=w+1}}else B=F.backslashes=!0,$=Q(),$===u&&(j=!0)}!0===m.noext&&(I=!1,N=!1);let W=H,X="",q="";T>0&&(X=H.slice(0,T),H=H.slice(T),L-=T),W&&!0===N&&L>0?(W=H.slice(0,L),q=H.slice(L)):!0===N?(W="",q=H):W=H,W&&""!==W&&"/"!==W&&W!==H&&A(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),!0===m.unescape&&(q&&(q=e.removeBackslashes(q)),W&&!0===B&&(W=e.removeBackslashes(W)));const Z={prefix:X,input:y,start:T,base:W,glob:q,isBrace:O,isBracket:k,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:G};if(!0===m.tokens&&(Z.maxDepth=0,A($)||b.push(F),Z.tokens=b),!0===m.parts||!0===m.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:T,r=S[t],o=y.slice(n,r);m.tokens&&(0===t&&0!==T?(b[t].isPrefix=!0,b[t].value=X):b[t].value=o,R(b[t]),Z.maxDepth+=b[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<y.length){const t=y.slice(e+1);v.push(t),m.tokens&&(b[b.length-1].value=t,R(b[b.length-1]),Z.maxDepth+=b[b.length-1].depth)}Z.slashes=S,Z.parts=v}return Z}}(),n=function(){if(ie)return se;ie=1;const e=ge(),t=he(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:i}=e,a=(e,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...e,n);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map((e=>t.escapeRegex(e))).join("..")}return r},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,p=(l,c)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=i[l]||l;const f={...c},d="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let g=l.length;if(g>d)throw new SyntaxError(`Input length: ${g}, exceeds maximum allowed length: ${d}`);const h={type:"bos",value:"",output:f.prepend||""},A=[h],R=f.capture?"":"?:",y=t.isWindows(c),E=e.globChars(y),m=e.extglobChars(E),{DOT_LITERAL:_,PLUS_LITERAL:C,SLASH_LITERAL:S,ONE_CHAR:b,DOTS_SLASH:v,NO_DOT:x,NO_DOT_SLASH:$,NO_DOTS_SLASH:H,QMARK:w,QMARK_NO_DOT:T,STAR:L,START_ANCHOR:O}=E,k=e=>`(${R}(?:(?!${O}${e.dot?v:_}).)*?)`,N=f.dot?"":x,I=f.dot?w:T;let M=!0===f.bash?k(f):L;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const j={input:l,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:A};l=t.removePrefix(l,j),g=l.length;const B=[],P=[],G=[];let D,K=h;const F=()=>j.index===g-1,U=j.peek=(e=1)=>l[j.index+e],Q=j.advance=()=>l[++j.index]||"",W=()=>l.slice(j.index+1),X=(e="",t=0)=>{j.consumed+=e,j.index+=t},q=e=>{j.output+=null!=e.output?e.output:e.value,X(e.value)},Z=()=>{let e=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)Q(),j.start++,e++;return e%2!=0&&(j.negated=!0,j.start++,!0)},Y=e=>{j[e]++,G.push(e)},z=e=>{j[e]--,G.pop()},V=e=>{if("globstar"===K.type){const t=j.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||B.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(j.output=j.output.slice(0,-K.output.length),K.type="star",K.value="*",K.output=M,j.output+=K.output)}if(B.length&&"paren"!==e.type&&(B[B.length-1].inner+=e.value),(e.value||e.output)&&q(e),K&&"text"===K.type&&"text"===e.type)return K.value+=e.value,void(K.output=(K.output||"")+e.value);e.prev=K,A.push(e),K=e},J=(e,t)=>{const n={...m[t],conditions:1,inner:""};n.prev=K,n.parens=j.parens,n.output=j.output;const r=(f.capture?"(":"")+n.open;Y("parens"),V({type:e,value:t,output:j.output?"":b}),V({type:"paren",extglob:!0,value:Q(),output:r}),B.push(n)},ee=e=>{let t,n=e.close+(f.capture?")":"");if("negate"===e.type){let r=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=k(f)),(r!==M||F()||/^\)+$/.test(W()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=W())&&/^\.[^\\/.]+$/.test(t)){const o=p(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(j.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:D,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let e=!1,n=l.replace(s,((t,n,r,o,s,i)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(s?w.repeat(s.length):""):0===i?I+(s?w.repeat(s.length):""):w.repeat(r.length):"."===o?_.repeat(r.length):"*"===o?n?n+o+(s?M:""):M:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===l&&!0===f.contains?(j.output=l,j):(j.output=t.wrapOutput(n,j,c),j)}for(;!F();){if(D=Q(),"\0"===D)continue;if("\\"===D){const e=U();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){D+="\\",V({type:"text",value:D});continue}const t=/^\\+/.exec(W());let n=0;if(t&&t[0].length>2&&(n=t[0].length,j.index+=n,n%2!=0&&(D+="\\")),!0===f.unescape?D=Q():D+=Q(),0===j.brackets){V({type:"text",value:D});continue}}if(j.brackets>0&&("]"!==D||"["===K.value||"[^"===K.value)){if(!1!==f.posix&&":"===D){const e=K.value.slice(1);if(e.includes("[")&&(K.posix=!0,e.includes(":"))){const e=K.value.lastIndexOf("["),t=K.value.slice(0,e),n=K.value.slice(e+2),o=r[n];if(o){K.value=t+o,j.backtrack=!0,Q(),h.output||1!==A.indexOf(K)||(h.output=b);continue}}}("["===D&&":"!==U()||"-"===D&&"]"===U())&&(D=`\\${D}`),"]"!==D||"["!==K.value&&"[^"!==K.value||(D=`\\${D}`),!0===f.posix&&"!"===D&&"["===K.value&&(D="^"),K.value+=D,q({value:D});continue}if(1===j.quotes&&'"'!==D){D=t.escapeRegex(D),K.value+=D,q({value:D});continue}if('"'===D){j.quotes=1===j.quotes?0:1,!0===f.keepQuotes&&V({type:"text",value:D});continue}if("("===D){Y("parens"),V({type:"paren",value:D});continue}if(")"===D){if(0===j.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=B[B.length-1];if(e&&j.parens===e.parens+1){ee(B.pop());continue}V({type:"paren",value:D,output:j.parens?")":"\\)"}),z("parens");continue}if("["===D){if(!0!==f.nobracket&&W().includes("]"))Y("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));D=`\\${D}`}V({type:"bracket",value:D});continue}if("]"===D){if(!0===f.nobracket||K&&"bracket"===K.type&&1===K.value.length){V({type:"text",value:D,output:`\\${D}`});continue}if(0===j.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));V({type:"text",value:D,output:`\\${D}`});continue}z("brackets");const e=K.value.slice(1);if(!0===K.posix||"^"!==e[0]||e.includes("/")||(D=`/${D}`),K.value+=D,q({value:D}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(K.value);if(j.output=j.output.slice(0,-K.value.length),!0===f.literalBrackets){j.output+=n,K.value=n;continue}K.value=`(${R}${n}|${K.value})`,j.output+=K.value;continue}if("{"===D&&!0!==f.nobrace){Y("braces");const e={type:"brace",value:D,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};P.push(e),V(e);continue}if("}"===D){const e=P[P.length-1];if(!0===f.nobrace||!e){V({type:"text",value:D,output:D});continue}let t=")";if(!0===e.dots){const e=A.slice(),n=[];for(let t=e.length-1;t>=0&&(A.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=a(n,f),j.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=j.output.slice(0,e.outputIndex),r=j.tokens.slice(e.tokensIndex);e.value=e.output="\\{",D=t="\\}",j.output=n;for(const e of r)j.output+=e.output||e.value}V({type:"brace",value:D,output:t}),z("braces"),P.pop();continue}if("|"===D){B.length>0&&B[B.length-1].conditions++,V({type:"text",value:D});continue}if(","===D){let e=D;const t=P[P.length-1];t&&"braces"===G[G.length-1]&&(t.comma=!0,e="|"),V({type:"comma",value:D,output:e});continue}if("/"===D){if("dot"===K.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",A.pop(),K=h;continue}V({type:"slash",value:D,output:S});continue}if("."===D){if(j.braces>0&&"dot"===K.type){"."===K.value&&(K.output=_);const e=P[P.length-1];K.type="dots",K.output+=D,K.value+=D,e.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==K.type&&"slash"!==K.type){V({type:"text",value:D,output:_});continue}V({type:"dot",value:D,output:_});continue}if("?"===D){if((!K||"("!==K.value)&&!0!==f.noextglob&&"("===U()&&"?"!==U(2)){J("qmark",D);continue}if(K&&"paren"===K.type){const e=U();let n=D;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===K.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(W()))&&(n=`\\${D}`),V({type:"text",value:D,output:n});continue}if(!0!==f.dot&&("slash"===K.type||"bos"===K.type)){V({type:"qmark",value:D,output:T});continue}V({type:"qmark",value:D,output:w});continue}if("!"===D){if(!0!==f.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){J("negate",D);continue}if(!0!==f.nonegate&&0===j.index){Z();continue}}if("+"===D){if(!0!==f.noextglob&&"("===U()&&"?"!==U(2)){J("plus",D);continue}if(K&&"("===K.value||!1===f.regex){V({type:"plus",value:D,output:C});continue}if(K&&("bracket"===K.type||"paren"===K.type||"brace"===K.type)||j.parens>0){V({type:"plus",value:D});continue}V({type:"plus",value:C});continue}if("@"===D){if(!0!==f.noextglob&&"("===U()&&"?"!==U(2)){V({type:"at",extglob:!0,value:D,output:""});continue}V({type:"text",value:D});continue}if("*"!==D){"$"!==D&&"^"!==D||(D=`\\${D}`);const e=o.exec(W());e&&(D+=e[0],j.index+=e[0].length),V({type:"text",value:D});continue}if(K&&("globstar"===K.type||!0===K.star)){K.type="star",K.star=!0,K.value+=D,K.output=M,j.backtrack=!0,j.globstar=!0,X(D);continue}let e=W();if(!0!==f.noextglob&&/^\([^?]/.test(e)){J("star",D);continue}if("star"===K.type){if(!0===f.noglobstar){X(D);continue}const t=K.prev,n=t.prev,r="slash"===t.type||"bos"===t.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===f.bash&&(!r||e[0]&&"/"!==e[0])){V({type:"star",value:D,output:""});continue}const s=j.braces>0&&("comma"===t.type||"brace"===t.type),i=B.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!s&&!i){V({type:"star",value:D,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[j.index+4];if(t&&"/"!==t)break;e=e.slice(3),X("/**",3)}if("bos"===t.type&&F()){K.type="globstar",K.value+=D,K.output=k(f),j.output=K.output,j.globstar=!0,X(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&F()){j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=k(f)+(f.strictSlashes?")":"|$)"),K.value+=D,j.globstar=!0,j.output+=t.output+K.output,X(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=`${k(f)}${S}|${S}${n})`,K.value+=D,j.output+=t.output+K.output,j.globstar=!0,X(D+Q()),V({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){K.type="globstar",K.value+=D,K.output=`(?:^|${S}|${k(f)}${S})`,j.output=K.output,j.globstar=!0,X(D+Q()),V({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-K.output.length),K.type="globstar",K.output=k(f),K.value+=D,j.output+=K.output,j.globstar=!0,X(D);continue}const n={type:"star",value:D,output:M};!0!==f.bash?!K||"bracket"!==K.type&&"paren"!==K.type||!0!==f.regex?(j.index!==j.start&&"slash"!==K.type&&"dot"!==K.type||("dot"===K.type?(j.output+=$,K.output+=$):!0===f.dot?(j.output+=H,K.output+=H):(j.output+=N,K.output+=N),"*"!==U()&&(j.output+=b,K.output+=b)),V(n)):(n.output=D,V(n)):(n.output=".*?","bos"!==K.type&&"slash"!==K.type||(n.output=N+n.output),V(n))}for(;j.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));j.output=t.escapeLast(j.output,"["),z("brackets")}for(;j.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));j.output=t.escapeLast(j.output,"("),z("parens")}for(;j.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));j.output=t.escapeLast(j.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==K.type&&"bracket"!==K.type||V({type:"maybe_slash",value:"",output:`${S}?`}),!0===j.backtrack){j.output="";for(const e of j.tokens)j.output+=null!=e.output?e.output:e.value,e.suffix&&(j.output+=e.suffix)}return j};return p.fastpaths=(r,o)=>{const s={...o},a="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,u=r.length;if(u>a)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${a}`);r=i[r]||r;const p=t.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:d,NO_DOT:g,NO_DOTS:h,NO_DOTS_SLASH:A,STAR:R,START_ANCHOR:y}=e.globChars(p),E=s.dot?h:g,m=s.dot?A:g,_=s.capture?"":"?:";let C=!0===s.bash?".*?":R;s.capture&&(C=`(${C})`);const S=e=>!0===e.noglobstar?C:`(${_}(?:(?!${y}${e.dot?d:l}).)*?)`,b=e=>{switch(e){case"*":return`${E}${f}${C}`;case".*":return`${l}${f}${C}`;case"*.*":return`${E}${C}${l}${f}${C}`;case"*/*":return`${E}${C}${c}${f}${m}${C}`;case"**":return E+S(s);case"**/*":return`(?:${E}${S(s)}${c})?${m}${f}${C}`;case"**/*.*":return`(?:${E}${S(s)}${c})?${m}${C}${l}${f}${C}`;case"**/.*":return`(?:${E}${S(s)}${c})?${l}${f}${C}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=b(t[1]);if(!n)return;return n+l+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let x=b(v);return x&&!0!==s.strictSlashes&&(x+=`${c}?`),x},se=p}(),r=he(),o=ge(),s=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>s(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(i=e)&&"object"==typeof i&&!Array.isArray(i)&&e.tokens&&e.input;var i;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const a=t||{},u=r.isWindows(t),p=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=p.state;delete p.state;let c=()=>!1;if(a.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(a.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:i,output:f}=s.test(n,p,t,{glob:e,posix:u}),d={glob:e,state:l,regex:p,posix:u,input:n,output:f,match:i,isMatch:o};return"function"==typeof a.onResult&&a.onResult(d),!1===o?(d.isMatch=!1,!!r&&d):c(n)?("function"==typeof a.onIgnore&&a.onIgnore(d),d.isMatch=!1,!!r&&d):("function"==typeof a.onMatch&&a.onMatch(d),!r||d)};return n&&(f.state=l),f};return s.test=(e,t,n,{glob:o,posix:i}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const a=n||{},u=a.format||(i?r.toPosixSlashes:null);let p=e===o,l=p&&u?u(e):e;return!1===p&&(l=u?u(e):e,p=l===o),!1!==p&&!0!==a.capture||(p=!0===a.matchBase||!0===a.basename?s.matchBase(e,t,n,i):t.exec(l)),{isMatch:Boolean(p),match:p,output:l}},s.matchBase=(t,n,o,i=r.isWindows(o))=>(n instanceof RegExp?n:s.makeRe(n,o)).test(e.basename(t)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):n(e,{...t,fastpaths:!1}),s.scan=(e,n)=>t(e,n),s.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},i=o.contains?"":"^",a=o.contains?"":"$";let u=`${i}(?:${e.output})${a}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const p=s.toRegex(u,t);return!0===r&&(p.state=e),p},s.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(i.output=n.fastpaths(e,t)),i.output||(i=n(e,t)),s.compileRe(i,t,r,o)},s.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},s.constants=o,ae=s}function Re(){return le?pe:(le=1,pe=Ae())}var ye=function(){if(fe)return ce;fe=1;const e=E,t=J(),n=Re(),r=he(),o=e=>""===e||"./"===e,s=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,i=new Set,a=0,u=e=>{i.add(e.output),r&&r.onResult&&r.onResult(e)};for(let i=0;i<t.length;i++){let p=n(String(t[i]),{...r,onResult:u},!0),l=p.state.negated||p.state.negatedExtglob;l&&a++;for(let t of e){let e=p(t,!0);(l?!e.isMatch:e.isMatch)&&(l?o.add(e.output):(o.delete(e.output),s.add(e.output)))}}let p=(a===t.length?[...i]:[...s]).filter((e=>!o.has(e)));if(r&&0===p.length){if(!0===r.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}return p};return s.match=s,s.matcher=(e,t)=>n(e,t),s.any=s.isMatch=(e,t,r)=>n(t,r)(e),s.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],i=new Set(s(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)i.has(e)||r.add(e);return[...r]},s.contains=(t,n,r)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(n))return n.some((e=>s.contains(t,e,r)));if("string"==typeof n){if(o(t)||o(n))return!1;if(t.includes(n)||t.startsWith("./")&&t.slice(2).includes(n))return!0}return s.isMatch(t,n,{...r,contains:!0})},s.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,n),i={};for(let t of o)i[t]=e[t];return i},s.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(o.some((e=>t(e))))return!0}return!1},s.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(!o.every((e=>t(e))))return!1}return!0},s.all=(t,r,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(r).every((e=>n(e,o)(t)))},s.capture=(e,t,o)=>{let s=r.isWindows(o),i=n.makeRe(String(e),{...o,capture:!0}).exec(s?r.toPosixSlashes(t):t);if(i)return i.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>n.makeRe(...e),s.scan=(...e)=>n.scan(...e),s.parse=(e,r)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),r))o.push(n.parse(e,r));return o},s.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},ce=s}();const Ee=t=>e.readdirSync(t).reduce(((r,o)=>{const s=n(t,o);return e.statSync(s).isDirectory()?s.endsWith("/node_modules")?r:[...r,...Ee(s)]:[...r,s]}),[]),me=(e,t)=>new Set([...e].filter((e=>t.has(e))));let _e;function Ce(){if(_e)return _e;const e=b.getOptionValue("root");return _e=e?t.isAbsolute(e)?e:t.resolve(process.cwd(),e):void 0,_e}let Se,be="";try{S(import.meta.url).resolve("@pnpm/filter-workspace-packages"),be="pnpm"}catch{}""!==be&&b.option("-f, --filter <filter>","filter packages");let ve=!1;const xe=S(import.meta.url);function $e(e){try{return xe.resolve(e),!0}catch(e){return!1}}let He;const we=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of we)if($e(e)){He=e;break}const Te=S(import.meta.url);let Le="jiek.config";const Oe=t=>{t=n(t);const r=o(t),{extends:s,...i}=(a=t,e.existsSync(a)&&e.statSync(a).isFile()?x(e.readFileSync(a,"utf-8"),[],{allowTrailingComma:!0,allowEmptyContent:!0}):{});var a;const u=(p=s?Array.isArray(s)?s:[s]:[],p?.map((e=>n(r,e)))??[]);var p;return 0===u.length?i:u.map(Oe).concat(i).reduce(((e,{compilerOptions:t={},references:n,...r})=>({...e,...r,compilerOptions:{...e.compilerOptions,...t}})),{})},ke=(e,t)=>{e=n(e),t=n(t);const r=o(e),s=Oe(e),[i,a,u,p]=[s.references?.map((({path:e})=>e)),s.files,s.include,s.exclude].map((e=>e?.map((e=>n(r,e)))??[]));if(p.length>0&&p.some((e=>ye.isMatch(t,e))))return;if(0===s.files?.length&&0===s.include?.length)return;let l=!1;if(l||(l=a.length>0&&a.includes(t)),l||(l=u.length>0&&u.some((e=>ye.isMatch(t,e)))),l)return s.compilerOptions??{};if(!(s.files&&s.files.length>0||s.include&&s.include.length>0)){i.reverse();for(const e of i){const n=ke(e,t);if(n)return n}return s.compilerOptions}};var Ne=(e={})=>{const{onEvent:t}=e;return{name:"progress",buildStart:()=>t?.("start","Start building..."),buildEnd:()=>t?.("end","Build completed!"),resolveId:{order:"post",handler:e=>t?.("resolve",`Resolving ${e}...`)},load:{order:"post",handler:e=>t?.("load",`Loading ${e}...`)},transform:{order:"post",handler:(e,n)=>t?.("transform",`Transforming ${n}...`)}}},Ie=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const Me=["te?xt","json","(css|s[ac]ss|less|styl)"];const{JIEK_ROOT:je,JIEK_ENTRIES:Be}=process.env,Pe=je??d(),Ge={},De=[h()],Ke=function(n){const{wd:r}=function(){if(Se)return{wd:Se,notWorkspace:ve};const e=Ce();if(void 0!==e){const t=f(e,be);return ve=!t,Se=e,{wd:Se,notWorkspace:ve}}try{Se=d(be)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;Se=e,ve=!0}return{wd:Se,notWorkspace:ve}}();let o=b.getOptionValue("configPath");if(o){if(!e.existsSync(o))throw new Error(`config file not found: ${o}`);t.isAbsolute(o)||(o=t.resolve(r,o))}else o=function(n,r){const o=!!He;function s(o){const s=[t.resolve(process.cwd(),`${Le}.${o}`),t.resolve(process.cwd(),`.${Le}.${o}`),t.resolve(n,`${Le}.${o}`),t.resolve(n,`.${Le}.${o}`)];r&&s.unshift(t.resolve(r,`${Le}.${o}`),t.resolve(r,`.${Le}.${o}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return Le=s("js")??Le,Le=s("json")??Le,Le=s("yaml")??Le,o&&(Le=s("ts")??Le),t.resolve(n,Le)}(r,n);const s=t.extname(o);let i;switch(s){case".js":i=Te(o);break;case".json":return Te(o);case".yaml":return v(e.readFileSync(o,"utf-8"));case".ts":if(He){Te(He),i=Te(o);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":i={};break;default:throw new Error(`unsupported config file type: ${s}`)}if(!i)throw new Error("config file is empty");return i.default??i}()??{},{build:Fe={}}=Ke,Ue=`./${r(process.cwd(),n(("object"==typeof Fe?.output?.dir?Fe.output.dir.js:Fe?.output?.dir)??"dist"))}`,Qe=/\.(css|s[ac]ss|less|styl)$/,We=e=>n(Pe,e),Xe=e=>e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())).replace(/(?:^|-)(\w)/g,((e,t)=>t.toUpperCase())),qe=(e,t=Fe?.output?.minify)=>!1===t?[e]:"only-minify"===t?[{...e,entryFileNames:t=>"function"==typeof e.entryFileNames?e.entryFileNames(t).replace(/(\.[cm]?js)$/,".min$1"):(()=>{throw new Error("entryFileNames must be a function")})(),plugins:[...e.plugins??[],R()]}]:[e,{...e,entryFileNames:t=>"function"==typeof e.entryFileNames?e.entryFileNames(t).replace(/(\.[cm]?js)$/,".min$1"):(()=>{throw new Error("entryFileNames must be a function")})(),file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],R()]}],Ze=(t,i={})=>{const{path:a,name:u,input:p,output:l,external:f,pkgIsModule:d,conditionals:h}=t,R=h.includes("import"),E=h.includes("require"),m=h.includes("browser");let S;[We("tsconfig.json"),We("tsconfig.dts.json")].forEach((t=>{e.existsSync(t)&&e.statSync(t).isFile()&&(S=t)}));let b={};if(S){const e=ke(S,n(p)),{options:t,errors:r}=C.convertCompilerOptionsFromJson(e,o(S));if(r.length>0)throw new Error(r.map((e=>e.messageText)).join("\n"));b=t,delete b.composite}const v=[...h,...b.customConditions??[]],x={type:"progress",data:{name:u,path:a,exportConditions:v,input:p}},$=i?.output?.dir,{js:H,dts:w}=((e,t)=>{if(!1===t||null==t)return{js:[],dts:[]};let n=[],r=[];switch(typeof t){case"function":n=t("js",e),r=t("dts",e);break;case"object":"js"in t||"dts"in t?(n=t.js??[],r=t.dts??[]):(n=t,r=t)}return{js:n,dts:r}})(t,Fe.plugins);if(p.includes("**"))throw new Error('input should not include "**", please read the [documentation](https://nodejs.org/api/packages.html#subpath-patterns).');const T=p.includes("*")?Ee(process.cwd()).filter((e=>/(?<!\.d)\.[cm]?tsx?$/.test(e))).map((e=>r(process.cwd(),e))).filter((e=>ye.isMatch(e,p.slice(2)))):p,L=p.includes("*")?p.split("*")[0].replace("./",""):"",O=a.includes("*")?a.split("*")[0].replace("./",""):"";if(L.length>0&&0===O.length||0===L.length&&O.length>0)throw new Error('input and path should both include "*" or not include "*"');const k=s(l),N=k.replace(/(\.[cm]?)js$/,".d$1ts");return[{input:T,external:f,output:[...qe({dir:Ue,name:u,interop:"auto",entryFileNames:e=>Array.isArray(T)?e.facadeModuleId.replace(`${process.cwd()}/`,"").replace(L,O).replace(/(\.[cm]?)ts$/,k):l.replace(`${Ue}/`,""),sourcemap:"object"==typeof i?.output?.sourcemap?i.output.sourcemap.js:i?.output?.sourcemap,format:R?"esm":E?"cjs":m?"umd":d?"esm":"cjs",strict:"object"==typeof i?.output?.strict?i.output.strict.js:i?.output?.strict})],plugins:[A({exportConditions:v}),import("rollup-plugin-postcss").then((({default:e})=>e({extract:n(l.replace(/\.[cm]?js$/,".css")),minimize:!0}))).catch((()=>{})),_({tsconfig:S}),g(),Ne({onEvent:(e,t)=>y({...x,data:{...x.data,event:e,message:t,tags:["js"]}})}),H]},{input:T,external:f,output:[{dir:n(("object"==typeof $?$.dts:$)??"dist"),sourcemap:"object"==typeof i?.output?.sourcemap?i.output.sourcemap.dts:i?.output?.sourcemap,entryFileNames:e=>Array.isArray(T)?e.facadeModuleId.replace(`${process.cwd()}/`,"").replace(L,O).replace(/(\.[cm]?)ts$/,N):l.replace(`${Ue}/`,"").replace(/(\.[cm]?)js$/,N),strict:"object"==typeof i?.output?.strict?i.output.strict.dts:i?.output?.strict}],plugins:[A({exportConditions:v}),Ie({patterns:[Qe]}),c({respectExternal:!0,compilerOptions:{...b,outDir:"dist",declaration:!0}}),Ne({onEvent:(e,t)=>y({...x,data:{...x.data,event:e,message:t,tags:["dts"]}})}),w]}]};function Ye(t){const{name:o,type:s,exports:c}=t,f="module"===s;if(!o)throw new Error("package.json name is required");if(!c)throw new Error("package.json exports is required");const d=Be?.split(",").map((e=>e.trim())).map((e=>({index:"."}[e]??e))),g=Xe(o),h=function(t=process.cwd()){const n="string"==typeof t?e.existsSync(`${t}/package.json`)?JSON.parse(e.readFileSync(`${t}/package.json`,"utf-8")):{}:t,{name:r,dependencies:o={},peerDependencies:s={},optionalDependencies:i={}}=n;if(!r)throw new Error("package.json must have a name field");return Object.keys(o).concat(Object.keys(s)).concat(Object.keys(i)).map((e=>new RegExp(`^${e}(/.*)?$`))).concat([new RegExp(`^${r}(/.*)?(?<!${Me.map((e=>`\\.${e}`)).join("|")})$`),/^node:/])}(t),[A,R]=function({entrypoints:e,pkgIsModule:t,entries:o,config:s,dir:l,noFilter:c,isPublish:f}){const{build:d={},publish:{withSuffix:g=!1,withSource:h=!0}={}}=s??{},{crossModuleConvertor:A=!0}=d,R=`./${(e=>r(l??process.cwd(),e))(((...e)=>n(l??process.cwd(),...e))(("object"==typeof d?.output?.dir?d.output.dir.js:d?.output?.dir)??"dist"))}`,[,y]=i(e);o&&Object.entries(y).forEach((([e])=>{o.some((t=>ye.isMatch(e,t,{matchBase:!0})))||delete y[e]}));const E=c?y:a(y,{skipValue:[/(^|\/)\.jk-noentry/,...u]});return[E,p(E,{outdir:R,withSuffix:f?g:void 0,withSource:f?h:void 0,withConditional:{...A?{import:e=>!t&&0===me(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==me(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{}}})]}({entrypoints:c,pkgIsModule:f,entries:d,config:Ke}),E=new Map;l(A,(({keys:e,value:t})=>{if("string"==typeof t){const n=E.get(t)??[];E.set(t,n),n.push(e)}return!1}));const m=[];return E.forEach(((e,t)=>e.forEach((e=>{const[n,...r]=e,o=g+("."===n?"":Xe(n)),s=((e,t)=>t.reduce(((e,t)=>{if("string"==typeof e)throw new Error("key not found in exports");if(!(t in e))throw new Error(`key ${t} not found in exports`);return e[t]}),e))(R,e),i={path:n,name:o,input:t,external:h,pkgIsModule:f};switch(typeof s){case"string":m.push(...Ze({...i,output:s,conditionals:r},Fe));break;case"object":l(s,(({keys:e,value:t})=>{const n=[...new Set([...r,...e])];return"string"==typeof t&&m.push(...Ze({...i,output:t,conditionals:n},Fe)),!1}))}})))),y({type:"init",data:{leafMap:E,targetsLength:m.length}}),m.map((e=>({...Ge,...e,plugins:[...De,e.plugins]})))}export{Ye as template};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jiek",
3
3
  "type": "module",
4
- "version": "1.0.11",
4
+ "version": "1.0.13",
5
5
  "description": "YiJie's personal kits.",
6
6
  "bin": {
7
7
  "jiek": "bin/jiek.js",
@@ -45,7 +45,7 @@
45
45
  "#~/*": "./src/*"
46
46
  },
47
47
  "dependencies": {
48
- "@jiek/rollup-plugin-dts": "^6.1.1",
48
+ "@jiek/rollup-plugin-dts": "^6.1.2",
49
49
  "@rollup/plugin-commonjs": "^28.0.0",
50
50
  "@rollup/plugin-json": "^6.0.1",
51
51
  "@rollup/plugin-node-resolve": "^15.3.0",
@@ -1,7 +1,5 @@
1
- import './base'
2
-
3
1
  import fs from 'node:fs'
4
- import { dirname, relative, resolve } from 'node:path'
2
+ import { dirname, extname, relative, resolve } from 'node:path'
5
3
 
6
4
  import type { RecursiveRecord } from '@jiek/pkger/entrypoints'
7
5
  import { getAllLeafs } from '@jiek/pkger/entrypoints'
@@ -12,6 +10,7 @@ import json from '@rollup/plugin-json'
12
10
  import { nodeResolve } from '@rollup/plugin-node-resolve'
13
11
  import terser from '@rollup/plugin-terser'
14
12
  import { sendMessage } from 'execa'
13
+ import { isMatch } from 'micromatch'
15
14
  import type { InputPluginOption, OutputOptions, OutputPlugin, RollupOptions } from 'rollup'
16
15
  import esbuild from 'rollup-plugin-esbuild'
17
16
  import ts from 'typescript'
@@ -195,9 +194,22 @@ const generateConfigs = (context: ConfigGenerateContext, options: TemplateOption
195
194
  ? input
196
195
  : recusiveListFiles(process.cwd())
197
196
  .filter(p => /(?<!\.d)\.[cm]?tsx?$/.test(p))
197
+ .map(p => relative(process.cwd(), p))
198
+ .filter(p => isMatch(p, input.slice(2)))
198
199
  const globCommonDir = input.includes('*')
199
- ? input.split('*')[0]
200
+ ? input.split('*')[0].replace('./', '')
201
+ : ''
202
+ const pathCommonDir = path.includes('*')
203
+ ? path.split('*')[0].replace('./', '')
200
204
  : ''
205
+ if (
206
+ (globCommonDir.length > 0 && pathCommonDir.length === 0)
207
+ || (globCommonDir.length === 0 && pathCommonDir.length > 0)
208
+ ) {
209
+ throw new Error('input and path should both include "*" or not include "*"')
210
+ }
211
+ const jsOutputSuffix = extname(output)
212
+ const tsOutputSuffix = jsOutputSuffix.replace(/(\.[cm]?)js$/, '.d$1ts')
201
213
  return [
202
214
  {
203
215
  input: inputObj,
@@ -209,9 +221,9 @@ const generateConfigs = (context: ConfigGenerateContext, options: TemplateOption
209
221
  interop: 'auto',
210
222
  entryFileNames: (chunkInfo) => (
211
223
  Array.isArray(inputObj)
212
- ? chunkInfo.facadeModuleId!.replace(`${process.cwd()}/`, './')
213
- .replace(globCommonDir, '')
214
- .replace(/(\.[cm]?)ts$/, '$1js')
224
+ ? chunkInfo.facadeModuleId!.replace(`${process.cwd()}/`, '')
225
+ .replace(globCommonDir, pathCommonDir)
226
+ .replace(/(\.[cm]?)ts$/, jsOutputSuffix)
215
227
  : output.replace(`${jsOutdir}/`, '')
216
228
  ),
217
229
  sourcemap: typeof options?.output?.sourcemap === 'object'
@@ -266,12 +278,12 @@ const generateConfigs = (context: ConfigGenerateContext, options: TemplateOption
266
278
  : options?.output?.sourcemap,
267
279
  entryFileNames: (chunkInfo) => (
268
280
  Array.isArray(inputObj)
269
- ? chunkInfo.facadeModuleId!.replace(`${process.cwd()}/`, './')
270
- .replace(globCommonDir, '')
271
- .replace(/(\.[cm]?)ts$/, '.d$1ts')
281
+ ? chunkInfo.facadeModuleId!.replace(`${process.cwd()}/`, '')
282
+ .replace(globCommonDir, pathCommonDir)
283
+ .replace(/(\.[cm]?)ts$/, tsOutputSuffix)
272
284
  : output
273
285
  .replace(`${jsOutdir}/`, '')
274
- .replace(/(\.[cm]?)js$/, '.d$1ts')
286
+ .replace(/(\.[cm]?)js$/, tsOutputSuffix)
275
287
  ),
276
288
  strict: typeof options?.output?.strict === 'object'
277
289
  ? options.output.strict.dts
@@ -283,7 +295,13 @@ const generateConfigs = (context: ConfigGenerateContext, options: TemplateOption
283
295
  skip({ patterns: [STYLE_REGEXP] }),
284
296
  dts({
285
297
  respectExternal: true,
286
- compilerOptions
298
+ compilerOptions: {
299
+ ...compilerOptions,
300
+ // temp directory, it not affect the output
301
+ // but if the user not set it and `declaration`, inputs can't generate any dts files when the input relative imports of `package.json`
302
+ outDir: 'dist',
303
+ declaration: true
304
+ }
287
305
  }),
288
306
  progress({
289
307
  onEvent: (event, message) =>