jiek 1.1.4 → 1.1.5

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.1.3";
144
+ var version = "1.1.4";
145
145
  var description$1 = "YiJie's personal kits.";
146
146
  var bin = {
147
147
  jiek: "bin/jiek.js",
@@ -350,10 +350,12 @@ const require$1 = node_module.createRequire((typeof document === 'undefined' ? r
350
350
  const description = `
351
351
  Build the package according to the 'exports' field in the package.json.
352
352
  `.trim();
353
- commander.program.command("build").description(description).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 ({
353
+ commander.program.command("build").description(description).option("-s, --silent", "Don't display logs.").option("-e, --entries <ENTRIES>", "Specify the entries of the package.json's 'exports' field.(support glob)").option("--without-js", "Do not output js files.").option("--without-dts", "Do not output dts files.").option("-v, --verbose", "Display debug logs.").action(async ({
354
354
  silent,
355
355
  entries,
356
- verbose
356
+ verbose,
357
+ withoutJs,
358
+ withoutDts
357
359
  }) => {
358
360
  actionRestore();
359
361
  const { build } = loadConfig();
@@ -398,7 +400,9 @@ commander.program.command("build").description(description).option("-s, --silent
398
400
  env: {
399
401
  ...process.env,
400
402
  JIEK_ROOT: wd,
401
- JIEK_ENTRIES: entries
403
+ JIEK_ENTRIES: entries,
404
+ JIEK_WITHOUT_JS: String(withoutJs),
405
+ JIEK_WITHOUT_DTS: String(withoutDts)
402
406
  }
403
407
  });
404
408
  const bars = {};
package/dist/cli.d.cts CHANGED
@@ -13,6 +13,7 @@ interface ConfigGenerateContext {
13
13
  pkgIsModule: boolean;
14
14
  conditionals: string[];
15
15
  }
16
+ type OutputControl = boolean | ((context: ConfigGenerateContext) => boolean);
16
17
  interface TemplateOptions {
17
18
  /**
18
19
  * When the user configures type: module, the generated output from entry points that don't
@@ -37,6 +38,8 @@ interface TemplateOptions {
37
38
  dir?: Mapping2ROO<'dir'>;
38
39
  sourcemap?: Mapping2ROO<'sourcemap'>;
39
40
  strict?: Mapping2ROO<'strict'>;
41
+ js?: OutputControl;
42
+ dts?: OutputControl;
40
43
  };
41
44
  plugins?: InputPluginOption | ((type: 'js' | 'dts', context: ConfigGenerateContext) => InputPluginOption) | {
42
45
  js: InputPluginOption;
package/dist/cli.d.ts CHANGED
@@ -13,6 +13,7 @@ interface ConfigGenerateContext {
13
13
  pkgIsModule: boolean;
14
14
  conditionals: string[];
15
15
  }
16
+ type OutputControl = boolean | ((context: ConfigGenerateContext) => boolean);
16
17
  interface TemplateOptions {
17
18
  /**
18
19
  * When the user configures type: module, the generated output from entry points that don't
@@ -37,6 +38,8 @@ interface TemplateOptions {
37
38
  dir?: Mapping2ROO<'dir'>;
38
39
  sourcemap?: Mapping2ROO<'sourcemap'>;
39
40
  strict?: Mapping2ROO<'strict'>;
41
+ js?: OutputControl;
42
+ dts?: OutputControl;
40
43
  };
41
44
  plugins?: InputPluginOption | ((type: 'js' | 'dts', context: ConfigGenerateContext) => InputPluginOption) | {
42
45
  js: InputPluginOption;
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.1.3";
113
+ var version = "1.1.4";
114
114
  var description$1 = "YiJie's personal kits.";
115
115
  var bin = {
116
116
  jiek: "bin/jiek.js",
@@ -319,10 +319,12 @@ const require = createRequire(import.meta.url);
319
319
  const description = `
320
320
  Build the package according to the 'exports' field in the package.json.
321
321
  `.trim();
322
- program.command("build").description(description).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 ({
322
+ program.command("build").description(description).option("-s, --silent", "Don't display logs.").option("-e, --entries <ENTRIES>", "Specify the entries of the package.json's 'exports' field.(support glob)").option("--without-js", "Do not output js files.").option("--without-dts", "Do not output dts files.").option("-v, --verbose", "Display debug logs.").action(async ({
323
323
  silent,
324
324
  entries,
325
- verbose
325
+ verbose,
326
+ withoutJs,
327
+ withoutDts
326
328
  }) => {
327
329
  actionRestore();
328
330
  const { build } = loadConfig();
@@ -367,7 +369,9 @@ program.command("build").description(description).option("-s, --silent", "Don't
367
369
  env: {
368
370
  ...process.env,
369
371
  JIEK_ROOT: wd,
370
- JIEK_ENTRIES: entries
372
+ JIEK_ENTRIES: entries,
373
+ JIEK_WITHOUT_JS: String(withoutJs),
374
+ JIEK_WITHOUT_DTS: String(withoutDts)
371
375
  }
372
376
  });
373
377
  const bars = {};
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.1.3",I="YiJie's personal kits.";let j;function M(){j()}function B(){new Promise((e=>j=e))}o.program.version(N).description(I).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const P=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 P.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){let t,n;"object"==typeof e?(t=e.dir,n=e.root??O().wd):(t=e,n=O().wd);let r=o.program.getOptionValue("configPath");if(r){if(!E.default.existsSync(r))throw new Error(`config file not found: ${r}`);_.default.isAbsolute(r)||(r=_.default.resolve(n,r))}else r=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)}(n,t);const s=_.default.extname(r);let i;switch(s){case".js":i=F(r);break;case".json":return F(r);case".yaml":return a.load(E.default.readFileSync(r,"utf-8"));case".ts":if(U){F(U),i=F(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":i={};break;default:throw new Error(`unsupported config file type: ${s}`)}if(!i)throw new Error("config file is empty");return i.default??i}const Q=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href),W="\nBuild the package according to the 'exports' field in the package.json.\n".trim();o.program.command("build").description(W).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})=>{B();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()})),M()}));var X,Z,J,z,Y,V,ee,te,ne,re,oe,ae,se,ie,ue,le,pe,ce,fe,de={};function ge(){return X||(X=1,(e=de).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}),de;var e}function he(){if(J)return Z;J=1;const e=ge();return Z=(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 _=R(e),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?E.default.isAbsolute(e)?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=E.default.resolve(n,"pnpm-workspace.yaml"),s=_.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(!_.default.existsSync(E.default.resolve(t,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const n=JSON.parse(_.default.readFileSync(E.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(_.default.readFileSync(E.default.resolve(n,"package.json"),"utf-8"))}}}""!==T&&o.program.option("-f, --filter <filter>","filter packages");var N="1.1.4",I="YiJie's personal kits.";let j;function M(){j()}function B(){new Promise((e=>j=e))}o.program.version(N).description(I).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const P=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 P.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){let t,n;"object"==typeof e?(t=e.dir,n=e.root??O().wd):(t=e,n=O().wd);let r=o.program.getOptionValue("configPath");if(r){if(!_.default.existsSync(r))throw new Error(`config file not found: ${r}`);E.default.isAbsolute(r)||(r=E.default.resolve(n,r))}else r=function(e,t){const n=!!U;function r(n){const r=[E.default.resolve(process.cwd(),`${K}.${n}`),E.default.resolve(process.cwd(),`.${K}.${n}`),E.default.resolve(e,`${K}.${n}`),E.default.resolve(e,`.${K}.${n}`)];t&&r.unshift(E.default.resolve(t,`${K}.${n}`),E.default.resolve(t,`.${K}.${n}`));for(const e of r)if(_.default.existsSync(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),E.default.resolve(e,K)}(n,t);const s=E.default.extname(r);let i;switch(s){case".js":i=F(r);break;case".json":return F(r);case".yaml":return a.load(_.default.readFileSync(r,"utf-8"));case".ts":if(U){F(U),i=F(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":i={};break;default:throw new Error(`unsupported config file type: ${s}`)}if(!i)throw new Error("config file is empty");return i.default??i}const W=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:A&&A.src||new URL("cli.min.cjs",document.baseURI).href),Q="\nBuild the package according to the 'exports' field in the package.json.\n".trim();o.program.command("build").description(Q).option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").option("--without-js","Do not output js files.").option("--without-dts","Do not output dts files.").option("-v, --verbose","Display debug logs.").action((async({silent:e,entries:t,verbose:n,withoutJs:r,withoutDts:o})=>{B();const{build:a}=q();e=e??a?.silent??!1;const{wd:s,value:l={}}=await L()??{};if(0===Object.keys(l).length)throw new Error("no package found");const p=E.default.resolve(s,"node_modules");_.default.existsSync(p)||_.default.mkdirSync(p);const c=(...e)=>E.default.resolve(p,".jiek",...e);_.default.existsSync(c())||_.default.mkdirSync(c());const f=W.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup"),d=new i.MultiBar({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {input} | {message}"},i.Presets.shades_classic);let g=0;await Promise.all(Object.entries(l).map((async([a,i])=>{const l=i.name?.replace(/^@/g,"").replace(/\//g,"+"),p=c(`${l??"anonymous-"+g++}.rollup.config.js`);_.default.writeFileSync(p,(e=>`\nmodule.exports = require('jiek/rollup').template(${JSON.stringify(e,null,2)})\n`.trimStart())(i));let h="";U&&(h=`node -r ${U} `);const y=`${h}${f} --silent -c ${p}`,A=u.execaCommand(y,{ipc:!0,cwd:a,env:{...process.env,JIEK_ROOT:s,JIEK_ENTRIES:t,JIEK_WITHOUT_JS:String(r),JIEK_WITHOUT_DTS:String(o)}}),R={};let m=10;A.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!e&&A.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 '${i.name}' has ${n} targets to build`),r.forEach((({input:e})=>{m=Math.max(m,e.length)})),r.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;R[n]||(R[n]=d.create(50,0,{input:e.padEnd(m),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=R[`${r}:${t}`];if(!s)return;s.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:r.padEnd(m),status:o?.padEnd(10),message:`${n?.join(", ")}: ${a}`})}})),await new Promise(((e,t)=>{let r="";A.stderr?.on("data",(e=>{r+=e})),A.once("exit",(n=>0===n?e():t(new Error(`rollup build failed:\n${r}`)))),n&&A.stdout?.pipe(process.stdout)}))}))).finally((()=>{d.stop()})),M()}));var X,J,Z,z,Y,V,ee,te,ne,re,oe,ae,se,ie,ue,le,pe,ce,fe,de={};function ge(){return X||(X=1,(e=de).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}),de;var e}function he(){if(Z)return J;Z=1;const e=ge();return J=(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
  *
@@ -16,4 +16,4 @@
16
16
  *
17
17
  * Copyright (c) 2014-present, Jon Schlinkert.
18
18
  * Licensed under the MIT License.
19
- */function Re(){if(ne)return te;ne=1;const e=C.default,t=Ae(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),a=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},s=(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},i=(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 a=String.fromCharCode(e);return e===n?a:`[${a}-${String.fromCharCode(n)}]`},l=(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)},p=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw p([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 p([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 y=a(d)||a(g)||a(h),A=y?Math.max(d.length,g.length,h.length):0,R=!1===y&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),m=r.transform||(e=>t=>!0===e?Number(t):String(t))(R);if(r.toRegex&&1===n)return u(i(e,A),i(t,A),!0,r);let E={negatives:[],positives:[]},_=[],b=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?E[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):_.push(s(m(o,b),A,R)),o=f?o-n:o+n,b++;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="",a="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(a=`-(${r}${e.negatives.join("|")})`),n=o&&a?`${o}|${a}`:o||a,t.wrap?`(${r}${n})`:n})(E,r):l(_,null,{wrap:!1,...r}):_},d=(e,t,a,s={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,s);if("function"==typeof a)return d(e,t,1,{transform:a});if(n(a))return d(e,t,0,a);let i={...s};return!0===i.capture&&(i.wrap=!0),a=a||i.step||1,o(a)?o(e)&&o(t)?f(e,t,a,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let a=r.transform||(e=>String.fromCharCode(e)),s=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),p=s>i,f=Math.min(s,i),d=Math.max(s,i);if(r.toRegex&&1===n)return u(f,d,!1,r);let g=[],h=0;for(;p?s>=i:s<=i;)g.push(a(s,h)),s=p?s-n:s+n,h++;return!0===r.toRegex?l(g,null,{wrap:!1,options:r}):g})(e,t,Math.max(Math.abs(a),1),i):null==a||n(a)?d(e,t,1,a):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(a,i)};return te=d}function me(){if(pe)return le;pe=1;const e=he(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_LEFT_PARENTHESES:s,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,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}=ue?ie:(ue=1,ie={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 le=(y,A={})=>{if("string"!=typeof y)throw new TypeError("Expected a string");let R=A||{},m="number"==typeof R.maxLength?Math.min(t,R.maxLength):t;if(y.length>m)throw new SyntaxError(`Input length (${y.length}), exceeds max characters (${m})`);let E,_={type:"root",input:y,nodes:[]},b=[_],S=_,C=_,v=0,$=y.length,x=0,w=0;const H=()=>y[x++],k=e=>{if("text"===e.type&&"dot"===C.type&&(C.type="text"),!C||"text"!==C.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e;C.value+=e.value};for(k({type:"bos"});x<$;)if(S=b[b.length-1],E=H(),E!==h&&E!==g)if(E!==n)if(E!==c)if(E!==p)if(E!==s)if(E!==i)if(E!==f&&E!==d&&E!==r)if(E!==u)if(E!==l)if(E===o&&w>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}k({type:"comma",value:E}),S.commas++}else if(E===a&&w>0&&0===S.commas){let e=S.nodes;if(0===w||0===e.length){k({type:"text",value:E});continue}if("dot"===C.type){if(S.range=[],C.value+=E,C.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,C.type="text";continue}S.ranges++,S.args=[];continue}if("range"===C.type){e.pop();let t=e[e.length-1];t.value+=C.value+E,C=t,S.ranges--;continue}k({type:"dot",value:E})}else k({type:"text",value:E});else{if("brace"!==S.type){k({type:"text",value:E});continue}let e="close";S=b.pop(),S.close=!0,k({type:e,value:E}),w--,S=b[b.length-1]}else{w++;let e=C.value&&"$"===C.value.slice(-1)||!0===S.dollar;S=k({type:"brace",open:!0,close:!1,dollar:e,depth:w,commas:0,ranges:0,nodes:[]}),b.push(S),k({type:"open",value:E})}else{let e,t=E;for(!0!==A.keepQuotes&&(E="");x<$&&(e=H());)if(e!==n){if(e===t){!0===A.keepQuotes&&(E+=e);break}E+=e}else E+=e+H();k({type:"text",value:E})}else{if("paren"!==S.type){k({type:"text",value:E});continue}S=b.pop(),k({type:"text",value:E}),S=b[b.length-1]}else S=k({type:"paren",nodes:[]}),b.push(S),k({type:"text",value:E});else{let e;for(v++;x<$&&(e=H());)if(E+=e,e!==p)if(e!==n){if(e===c&&(v--,0===v))break}else E+=H();else v++;k({type:"text",value:E})}else k({type:"text",value:"\\"+E});else k({type:"text",value:(A.keepEscaping?E:"")+H()});do{if(S=b.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=b[b.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(b.length>0);return k({type:"eos"}),_},le}function Ee(){if(fe)return ce;fe=1;const e=he(),t=function(){if(oe)return re;oe=1;const e=Re(),t=ge();return re=(n,r={})=>{let o=(n,a={})=>{let s=t.isInvalidBrace(a),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===s||!0===i,l=!0===r.escapeInvalid?"\\":"",p="";if(!0===n.isOpen)return l+n.value;if(!0===n.isClose)return l+n.value;if("open"===n.type)return u?l+n.value:"(";if("close"===n.type)return u?l+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),a=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==a.length)return o.length>1&&a.length>1?`(${a})`:a}if(n.nodes)for(let e of n.nodes)p+=o(e,n);return p};return o(n)}}(),n=function(){if(se)return ae;se=1;const e=Re(),t=he(),n=ge(),r=(e="",t="",o=!1)=>{let a=[];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)a.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),a.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(a)};return ae=(o,a={})=>{let s=void 0===a.rangeLimit?1e3:a.rangeLimit,i=(o,u={})=>{o.queue=[];let l=u,p=u.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(r(p.pop(),t(o,a)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void p.push(r(p.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,a.step,s))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,a);return 0===u.length&&(u=t(o,a)),p.push(r(p.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&&i(t,o):p.push(r(p.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=me(),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),ce=o}var _e,be,Se,Ce,ve,$e,xe,we,He,ke,Oe,Te,Le,Ne={};function Ie(){if(be)return _e;be=1;const e=v.default,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",a="[^/]",s=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${s}`,l={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:a,END_ANCHOR:s,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${s})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${a}*?`,START_ANCHOR:i},p={...l,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 _e={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 je(){return Se||(Se=1,function(e){const t=v.default,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:s}=Ie();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>a.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(s,"\\$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}}(Ne)),Ne}function Me(){if(He)return we;He=1;const e=v.default,t=function(){if(ve)return Ce;ve=1;const e=je(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,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}=Ie(),y=e=>e===i||e===r,A=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return Ce=(R,m)=>{const E=m||{},_=R.length-1,b=!0===E.parts||!0===E.scanToEnd,S=[],C=[],v=[];let $,x,w=R,H=-1,k=0,O=0,T=!1,L=!1,N=!1,I=!1,j=!1,M=!1,B=!1,P=!1,D=!1,U=!1,G=0,F={value:"",depth:0,isGlob:!1};const K=()=>H>=_,q=()=>($=x,w.charCodeAt(++H));for(;H<_;){let e;if(x=q(),x!==r){if(!0===M||x===u){for(G++;!0!==K()&&(x=q());)if(x!==r)if(x!==u){if(!0!==M&&x===a&&(x=q())===a){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(!0!==M&&x===o){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===d&&(G--,0===G)){M=!1,T=F.isBrace=!0,U=!0;break}}else G++;else B=F.backslashes=!0,q();if(!0===b)continue;break}if(x!==i){if(!0!==E.noext&&!0==(x===c||x===n||x===t||x===f||x===s)&&w.charCodeAt(H+1)===l){if(N=F.isGlob=!0,I=F.isExtglob=!0,U=!0,x===s&&H===k&&(D=!0),!0===b){for(;!0!==K()&&(x=q());)if(x!==r){if(x===g){N=F.isGlob=!0,U=!0;break}}else B=F.backslashes=!0,x=q();continue}break}if(x===t){if($===t&&(j=F.isGlobstar=!0),N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===f){if(N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===p){for(;!0!==K()&&(e=q());)if(e!==r){if(e===h){L=F.isBracket=!0,N=F.isGlob=!0,U=!0;break}}else B=F.backslashes=!0,q();if(!0===b)continue;break}if(!0===E.nonegate||x!==s||H!==k){if(!0!==E.noparen&&x===l){if(N=F.isGlob=!0,!0===b){for(;!0!==K()&&(x=q());)if(x!==l){if(x===g){U=!0;break}}else B=F.backslashes=!0,x=q();continue}break}if(!0===N){if(U=!0,!0===b)continue;break}}else P=F.negated=!0,k++}else{if(S.push(H),C.push(F),F={value:"",depth:0,isGlob:!1},!0===U)continue;if($===a&&H===k+1){k+=2;continue}O=H+1}}else B=F.backslashes=!0,x=q(),x===u&&(M=!0)}!0===E.noext&&(I=!1,N=!1);let Q=w,W="",X="";k>0&&(W=w.slice(0,k),w=w.slice(k),O-=k),Q&&!0===N&&O>0?(Q=w.slice(0,O),X=w.slice(O)):!0===N?(Q="",X=w):Q=w,Q&&""!==Q&&"/"!==Q&&Q!==w&&y(Q.charCodeAt(Q.length-1))&&(Q=Q.slice(0,-1)),!0===E.unescape&&(X&&(X=e.removeBackslashes(X)),Q&&!0===B&&(Q=e.removeBackslashes(Q)));const Z={prefix:W,input:R,start:k,base:Q,glob:X,isBrace:T,isBracket:L,isGlob:N,isExtglob:I,isGlobstar:j,negated:P,negatedExtglob:D};if(!0===E.tokens&&(Z.maxDepth=0,y(x)||C.push(F),Z.tokens=C),!0===E.parts||!0===E.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:k,r=S[t],o=R.slice(n,r);E.tokens&&(0===t&&0!==k?(C[t].isPrefix=!0,C[t].value=W):C[t].value=o,A(C[t]),Z.maxDepth+=C[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<R.length){const t=R.slice(e+1);v.push(t),E.tokens&&(C[C.length-1].value=t,A(C[C.length-1]),Z.maxDepth+=C[C.length-1].depth)}Z.slashes=S,Z.parts=v}return Z}}(),n=function(){if(xe)return $e;xe=1;const e=Ie(),t=je(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:a,REPLACEMENTS:s}=e,i=(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`,l=(p,c)=>{if("string"!=typeof p)throw new TypeError("Expected a string");p=s[p]||p;const f={...c},d="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;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||""},y=[h],A=f.capture?"":"?:",R=t.isWindows(c),m=e.globChars(R),E=e.extglobChars(m),{DOT_LITERAL:_,PLUS_LITERAL:b,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:v,NO_DOT:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:w,QMARK:H,QMARK_NO_DOT:k,STAR:O,START_ANCHOR:T}=m,L=e=>`(${A}(?:(?!${T}${e.dot?v:_}).)*?)`,N=f.dot?"":$,I=f.dot?H:k;let j=!0===f.bash?L(f):O;f.capture&&(j=`(${j})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const M={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:y};p=t.removePrefix(p,M),g=p.length;const B=[],P=[],D=[];let U,G=h;const F=()=>M.index===g-1,K=M.peek=(e=1)=>p[M.index+e],q=M.advance=()=>p[++M.index]||"",Q=()=>p.slice(M.index+1),W=(e="",t=0)=>{M.consumed+=e,M.index+=t},X=e=>{M.output+=null!=e.output?e.output:e.value,W(e.value)},Z=()=>{let e=1;for(;"!"===K()&&("("!==K(2)||"?"===K(3));)q(),M.start++,e++;return e%2!=0&&(M.negated=!0,M.start++,!0)},J=e=>{M[e]++,D.push(e)},z=e=>{M[e]--,D.pop()},Y=e=>{if("globstar"===G.type){const t=M.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||(M.output=M.output.slice(0,-G.output.length),G.type="star",G.value="*",G.output=j,M.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,y.push(e),G=e},V=(e,t)=>{const n={...E[t],conditions:1,inner:""};n.prev=G,n.parens=M.parens,n.output=M.output;const r=(f.capture?"(":"")+n.open;J("parens"),Y({type:e,value:t,output:M.output?"":C}),Y({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=j;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=L(f)),(r!==j||F()||/^\)+$/.test(Q()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=Q())&&/^\.[^\\/.]+$/.test(t)){const o=l(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(M.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:U,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(p)){let e=!1,n=p.replace(a,((t,n,r,o,a,s)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(a?H.repeat(a.length):""):0===s?I+(a?H.repeat(a.length):""):H.repeat(r.length):"."===o?_.repeat(r.length):"*"===o?n?n+o+(a?j:""):j:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===p&&!0===f.contains?(M.output=p,M):(M.output=t.wrapOutput(n,M,c),M)}for(;!F();){if(U=q(),"\0"===U)continue;if("\\"===U){const e=K();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){U+="\\",Y({type:"text",value:U});continue}const t=/^\\+/.exec(Q());let n=0;if(t&&t[0].length>2&&(n=t[0].length,M.index+=n,n%2!=0&&(U+="\\")),!0===f.unescape?U=q():U+=q(),0===M.brackets){Y({type:"text",value:U});continue}}if(M.brackets>0&&("]"!==U||"["===G.value||"[^"===G.value)){if(!1!==f.posix&&":"===U){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),n=G.value.slice(e+2),o=r[n];if(o){G.value=t+o,M.backtrack=!0,q(),h.output||1!==y.indexOf(G)||(h.output=C);continue}}}("["===U&&":"!==K()||"-"===U&&"]"===K())&&(U=`\\${U}`),"]"!==U||"["!==G.value&&"[^"!==G.value||(U=`\\${U}`),!0===f.posix&&"!"===U&&"["===G.value&&(U="^"),G.value+=U,X({value:U});continue}if(1===M.quotes&&'"'!==U){U=t.escapeRegex(U),G.value+=U,X({value:U});continue}if('"'===U){M.quotes=1===M.quotes?0:1,!0===f.keepQuotes&&Y({type:"text",value:U});continue}if("("===U){J("parens"),Y({type:"paren",value:U});continue}if(")"===U){if(0===M.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=B[B.length-1];if(e&&M.parens===e.parens+1){ee(B.pop());continue}Y({type:"paren",value:U,output:M.parens?")":"\\)"}),z("parens");continue}if("["===U){if(!0!==f.nobracket&&Q().includes("]"))J("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));U=`\\${U}`}Y({type:"bracket",value:U});continue}if("]"===U){if(!0===f.nobracket||G&&"bracket"===G.type&&1===G.value.length){Y({type:"text",value:U,output:`\\${U}`});continue}if(0===M.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));Y({type:"text",value:U,output:`\\${U}`});continue}z("brackets");const e=G.value.slice(1);if(!0===G.posix||"^"!==e[0]||e.includes("/")||(U=`/${U}`),G.value+=U,X({value:U}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(G.value);if(M.output=M.output.slice(0,-G.value.length),!0===f.literalBrackets){M.output+=n,G.value=n;continue}G.value=`(${A}${n}|${G.value})`,M.output+=G.value;continue}if("{"===U&&!0!==f.nobrace){J("braces");const e={type:"brace",value:U,output:"(",outputIndex:M.output.length,tokensIndex:M.tokens.length};P.push(e),Y(e);continue}if("}"===U){const e=P[P.length-1];if(!0===f.nobrace||!e){Y({type:"text",value:U,output:U});continue}let t=")";if(!0===e.dots){const e=y.slice(),n=[];for(let t=e.length-1;t>=0&&(y.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=i(n,f),M.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=M.output.slice(0,e.outputIndex),r=M.tokens.slice(e.tokensIndex);e.value=e.output="\\{",U=t="\\}",M.output=n;for(const e of r)M.output+=e.output||e.value}Y({type:"brace",value:U,output:t}),z("braces"),P.pop();continue}if("|"===U){B.length>0&&B[B.length-1].conditions++,Y({type:"text",value:U});continue}if(","===U){let e=U;const t=P[P.length-1];t&&"braces"===D[D.length-1]&&(t.comma=!0,e="|"),Y({type:"comma",value:U,output:e});continue}if("/"===U){if("dot"===G.type&&M.index===M.start+1){M.start=M.index+1,M.consumed="",M.output="",y.pop(),G=h;continue}Y({type:"slash",value:U,output:S});continue}if("."===U){if(M.braces>0&&"dot"===G.type){"."===G.value&&(G.output=_);const e=P[P.length-1];G.type="dots",G.output+=U,G.value+=U,e.dots=!0;continue}if(M.braces+M.parens===0&&"bos"!==G.type&&"slash"!==G.type){Y({type:"text",value:U,output:_});continue}Y({type:"dot",value:U,output:_});continue}if("?"===U){if((!G||"("!==G.value)&&!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V("qmark",U);continue}if(G&&"paren"===G.type){const e=K();let n=U;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()))&&(n=`\\${U}`),Y({type:"text",value:U,output:n});continue}if(!0!==f.dot&&("slash"===G.type||"bos"===G.type)){Y({type:"qmark",value:U,output:k});continue}Y({type:"qmark",value:U,output:H});continue}if("!"===U){if(!0!==f.noextglob&&"("===K()&&("?"!==K(2)||!/[!=<:]/.test(K(3)))){V("negate",U);continue}if(!0!==f.nonegate&&0===M.index){Z();continue}}if("+"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V("plus",U);continue}if(G&&"("===G.value||!1===f.regex){Y({type:"plus",value:U,output:b});continue}if(G&&("bracket"===G.type||"paren"===G.type||"brace"===G.type)||M.parens>0){Y({type:"plus",value:U});continue}Y({type:"plus",value:b});continue}if("@"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){Y({type:"at",extglob:!0,value:U,output:""});continue}Y({type:"text",value:U});continue}if("*"!==U){"$"!==U&&"^"!==U||(U=`\\${U}`);const e=o.exec(Q());e&&(U+=e[0],M.index+=e[0].length),Y({type:"text",value:U});continue}if(G&&("globstar"===G.type||!0===G.star)){G.type="star",G.star=!0,G.value+=U,G.output=j,M.backtrack=!0,M.globstar=!0,W(U);continue}let e=Q();if(!0!==f.noextglob&&/^\([^?]/.test(e)){V("star",U);continue}if("star"===G.type){if(!0===f.noglobstar){W(U);continue}const t=G.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])){Y({type:"star",value:U,output:""});continue}const a=M.braces>0&&("comma"===t.type||"brace"===t.type),s=B.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!a&&!s){Y({type:"star",value:U,output:""});continue}for(;"/**"===e.slice(0,3);){const t=p[M.index+4];if(t&&"/"!==t)break;e=e.slice(3),W("/**",3)}if("bos"===t.type&&F()){G.type="globstar",G.value+=U,G.output=L(f),M.output=G.output,M.globstar=!0,W(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&F()){M.output=M.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=L(f)+(f.strictSlashes?")":"|$)"),G.value+=U,M.globstar=!0,M.output+=t.output+G.output,W(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";M.output=M.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=`${L(f)}${S}|${S}${n})`,G.value+=U,M.output+=t.output+G.output,M.globstar=!0,W(U+q()),Y({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){G.type="globstar",G.value+=U,G.output=`(?:^|${S}|${L(f)}${S})`,M.output=G.output,M.globstar=!0,W(U+q()),Y({type:"slash",value:"/",output:""});continue}M.output=M.output.slice(0,-G.output.length),G.type="globstar",G.output=L(f),G.value+=U,M.output+=G.output,M.globstar=!0,W(U);continue}const n={type:"star",value:U,output:j};!0!==f.bash?!G||"bracket"!==G.type&&"paren"!==G.type||!0!==f.regex?(M.index!==M.start&&"slash"!==G.type&&"dot"!==G.type||("dot"===G.type?(M.output+=x,G.output+=x):!0===f.dot?(M.output+=w,G.output+=w):(M.output+=N,G.output+=N),"*"!==K()&&(M.output+=C,G.output+=C)),Y(n)):(n.output=U,Y(n)):(n.output=".*?","bos"!==G.type&&"slash"!==G.type||(n.output=N+n.output),Y(n))}for(;M.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));M.output=t.escapeLast(M.output,"["),z("brackets")}for(;M.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));M.output=t.escapeLast(M.output,"("),z("parens")}for(;M.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));M.output=t.escapeLast(M.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==G.type&&"bracket"!==G.type||Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===M.backtrack){M.output="";for(const e of M.tokens)M.output+=null!=e.output?e.output:e.value,e.suffix&&(M.output+=e.suffix)}return M};return l.fastpaths=(r,o)=>{const a={...o},i="number"==typeof a.maxLength?Math.min(n,a.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=s[r]||r;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:y,STAR:A,START_ANCHOR:R}=e.globChars(l),m=a.dot?h:g,E=a.dot?y:g,_=a.capture?"":"?:";let b=!0===a.bash?".*?":A;a.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${_}(?:(?!${R}${e.dot?d:p}).)*?)`,C=e=>{switch(e){case"*":return`${m}${f}${b}`;case".*":return`${p}${f}${b}`;case"*.*":return`${m}${b}${p}${f}${b}`;case"*/*":return`${m}${b}${c}${f}${E}${b}`;case"**":return m+S(a);case"**/*":return`(?:${m}${S(a)}${c})?${E}${f}${b}`;case"**/*.*":return`(?:${m}${S(a)}${c})?${E}${b}${p}${f}${b}`;case"**/.*":return`(?:${m}${S(a)}${c})?${p}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+p+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==a.strictSlashes&&($+=`${c}?`),$},$e=l}(),r=je(),o=Ie(),a=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>a(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(s=e)&&"object"==typeof s&&!Array.isArray(s)&&e.tokens&&e.input;var s;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),l=o?a.compileRe(e,t):a.makeRe(e,t,!1,!0),p=l.state;delete l.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=a(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:s,output:f}=a.test(n,l,t,{glob:e,posix:u}),d={glob:e,state:p,regex:l,posix:u,input:n,output:f,match:s,isMatch:o};return"function"==typeof i.onResult&&i.onResult(d),!1===o?(d.isMatch=!1,!!r&&d):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(d),d.isMatch=!1,!!r&&d):("function"==typeof i.onMatch&&i.onMatch(d),!r||d)};return n&&(f.state=p),f};return a.test=(e,t,n,{glob:o,posix:s}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const i=n||{},u=i.format||(s?r.toPosixSlashes:null);let l=e===o,p=l&&u?u(e):e;return!1===l&&(p=u?u(e):e,l=p===o),!1!==l&&!0!==i.capture||(l=!0===i.matchBase||!0===i.basename?a.matchBase(e,t,n,s):t.exec(p)),{isMatch:Boolean(l),match:l,output:p}},a.matchBase=(t,n,o,s=r.isWindows(o))=>(n instanceof RegExp?n:a.makeRe(n,o)).test(e.basename(t)),a.isMatch=(e,t,n)=>a(t,n)(e),a.parse=(e,t)=>Array.isArray(e)?e.map((e=>a.parse(e,t))):n(e,{...t,fastpaths:!1}),a.scan=(e,n)=>t(e,n),a.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},s=o.contains?"":"^",i=o.contains?"":"$";let u=`${s}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const l=a.toRegex(u,t);return!0===r&&(l.state=e),l},a.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(s.output=n.fastpaths(e,t)),s.output||(s=n(e,t)),a.compileRe(s,t,r,o)},a.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/$^/}},a.constants=o,we=a}function Be(){return Oe?ke:(Oe=1,ke=Me())}var Pe=function(){if(Le)return Te;Le=1;const e=C.default,t=Ee(),n=Be(),r=je(),o=e=>""===e||"./"===e,a=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,a=new Set,s=new Set,i=0,u=e=>{s.add(e.output),r&&r.onResult&&r.onResult(e)};for(let s=0;s<t.length;s++){let l=n(String(t[s]),{...r,onResult:u},!0),p=l.state.negated||l.state.negatedExtglob;p&&i++;for(let t of e){let e=l(t,!0);(p?!e.isMatch:e.isMatch)&&(p?o.add(e.output):(o.delete(e.output),a.add(e.output)))}}let l=(i===t.length?[...s]:[...a]).filter((e=>!o.has(e)));if(r&&0===l.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 l};return a.match=a,a.matcher=(e,t)=>n(e,t),a.any=a.isMatch=(e,t,r)=>n(t,r)(e),a.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],s=new Set(a(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)s.has(e)||r.add(e);return[...r]},a.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=>a.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 a.isMatch(t,n,{...r,contains:!0})},a.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=a(Object.keys(e),t,n),s={};for(let t of o)s[t]=e[t];return s},a.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},a.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},a.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)))},a.capture=(e,t,o)=>{let a=r.isWindows(o),s=n.makeRe(String(e),{...o,capture:!0}).exec(a?r.toPosixSlashes(t):t);if(s)return s.slice(1).map((e=>void 0===e?"":e))},a.makeRe=(...e)=>n.makeRe(...e),a.scan=(...e)=>n.scan(...e),a.parse=(e,r)=>{let o=[];for(let a of[].concat(e||[]))for(let e of t(String(a),r))o.push(n.parse(e,r));return o},a.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},a.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return a.braces(e,{...t,expand:!0})},Te=a}();const De='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),Ue="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const Ge=new Map;function Fe(e,t){if(Ge.has(e))return Ge.get(e)[t];const n=_.default.resolve(e,"package.json"),r=JSON.parse(E.default.readFileSync(n,"utf-8"));return Ge.set(e,r),r[t]}o.program.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,e]=o.program.args,t=process.cwd(),{init:n={}}=q()??{},{wd:r}=O(),a=_.default.basename(r),{named:s,template:i,bug:u={},readme:l=Ue,readmeTemplate:p}=n,f={template:"bug_report.yml",labels:["bug"],...u};let d=l;if(p){const e=_.default.resolve(r,p);d=E.default.readFileSync(e,"utf-8")}const g=function(e,t){let n=t??De,r=!1;try{t&&JSON.parse(t)}catch(e){r=!0}if(r){const r=_.default.resolve(e,t);n=E.default.readFileSync(r,"utf-8")}return n}(r,i),{indent:h=" "}=b.default(g),y={tabSize:h.length,insertSpaces:!0},A=["license","author"];let R=g;for(const e of A)R=c.applyEdits(R,c.modify(R,[e],Fe(r,e),{formattingOptions:y}));let[m,C]=await async function(e,t,{wd:n,cwd:r,workspaceName:o}){const a=r.replace(`${n}/`,"");let s=_.default.basename(r);if("function"==typeof e)return e(t,{full:n,relative:r});let i,u,l=!1;if("object"==typeof e)if(r===n){const{rule:t}=await S.default.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(i=t,u=e[t])}else for(const[t,n]of Object.entries(e)){if(Pe.isMatch(a,t)){i=t,u=n;break}if(Pe.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){l=!0,i=t,u=n;break}}if(u||(i="packages/*",u=`@${o}/$basename`),!u)throw new Error("no matched rule");if(!t&&l&&(s=await S.default.prompt({type:"input",name:"name",message:`the matched rule is \`${String(u)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof u)return u(t,{full:n,relative:r,basename:s});if("string"==typeof u){const e=t??s;return[u.replace(/\$basename/g,e),i?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(s,e,{wd:r,cwd:t,workspaceName:a});if(!C){const{dir:t}=await S.default.prompt({type:"input",name:"dir",message:"package directory",default:e});C=t}if(!m){const{name:t}=await S.default.prompt({type:"input",name:"name",message:"package name",default:e});m=t}R=c.applyEdits(R,c.modify(R,["name"],m,{formattingOptions:y}));let v=Fe(r,"repository");"string"==typeof v&&(v={type:"git",url:v,directory:C}),R=c.applyEdits(R,c.modify(R,["repository"],v,{formattingOptions:y}));const $=`${v?.url}/blob/master/${C}/README.md`;R=c.applyEdits(R,c.modify(R,["homepage"],$,{formattingOptions:y}));let x=f.labels;"function"==typeof x&&(x=x({name:m,dir:C})),x.push(`scope:${m}`);const w=`${v?.url}/issues/new?template=${f.template}&labels=${x.join(",")}`;function H(e){if(!C)throw new Error("pkgDir is not defined");return _.default.resolve(C,e)}R=c.applyEdits(R,c.modify(R,["bugs"],w,{formattingOptions:y})),E.default.existsSync(C)||E.default.mkdirSync(C);const k=H("package.json");if(E.default.existsSync(k))throw new Error("package.json already exists");E.default.writeFileSync(k,R),console.log(R,"written to",k);const T=Fe(r,"license"),L=H("README.md");"function"==typeof d&&(d=d({dir:C,packageJson:JSON.parse(R)}));const N=d.replace(/\$name/g,m).replace(/\$license/g,T);E.default.writeFileSync(L,N)}));const Ke=(e,t)=>new Set([...e].filter((e=>t.has(e))));function qe({entrypoints:e,pkgIsModule:t,entries:r,config:o,dir:a,noFilter:s,isPublish:i}){const{build:u={},publish:{withSuffix:l=!1,withSource:p=!0}={}}=o??{},{crossModuleConvertor:c=!0}=u,f=`./${d=((...e)=>n.resolve(a??process.cwd(),...e))(("object"==typeof u?.output?.dir?u.output.dir.js:u?.output?.dir)??"dist"),n.relative(a??process.cwd(),d)}`;var d;const[,g]=y.resolveEntrypoints(e);r&&Object.entries(g).forEach((([e])=>{r.some((t=>Pe.isMatch(e,t,{matchBase:!0})))||delete g[e]}));const h=s?g:y.filterLeafs(g,{skipValue:[/(^|\/)\.jk-noentry/,...y.DEFAULT_SKIP_VALUES]}),A=c?{import:e=>!t&&0===Ke(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ke(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[h,y.entrypoints2Exports(h,{outdir:f,withSuffix:i?l:void 0,withSource:i?p:void 0,withConditional:{...A}})]}o.program.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-no-b, --no-bumper","no bump version").option("-p, --preview","preview publish").action((async({preview:e,bumper:t,...n})=>{B();const{value:r={}}=await L()??{},o=Object.entries(r);if(0===o.length)throw new Error("no packages selected");const a=o.map((([e,t])=>{const{type:n,exports:r={}}=t,o="module"===n,a={...t},[s,i]=qe({entrypoints:r,pkgIsModule:o,config:q(e),dir:e,noFilter:!0,isPublish:!0});return a.exports={...s,...i},[e,a]})),s=Object.entries(n).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[n,r]of a){const o=E.default.readFileSync(_.default.join(n,"package.json"),"utf-8"),a=JSON.parse(o)??"0.0.0",i=t?h.bump(a.version,t):a.version,{indent:u=" "}=b.default(o),l={tabSize:u.length,insertSpaces:!0};let p=o;p=c.applyEdits(p,c.modify(p,["version"],i,{formattingOptions:l}));for(const[e,t]of Object.entries(r))if(JSON.stringify(t)!==JSON.stringify(a[e]))if("exports"!==e)p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l}));else{const e=t;for(const[t,n]of Object.entries(e))p=c.applyEdits(p,c.modify(p,["publishConfig","exports",t],n,{formattingOptions:l}));const n=e?.["."],o={};if(n){switch(typeof n){case"string":o["module"===r?.type?"module":"main"]=n;break;case"object":{const e=n;o.main=e.require??e.default,o.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(o))void 0!==t&&(p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l})))}}try{if(E.default.renameSync(_.default.join(n,"package.json"),_.default.join(n,"package.json.bak")),E.default.writeFileSync(_.default.join(n,"package.json"),p),console.log(p),e){console.warn("preview mode");continue}$.execSync(["pnpm","publish","--access","public","--no-git-checks",...s].join(" "),{cwd:n,stdio:"inherit"});const t=c.applyEdits(o,c.modify(o,["version"],i,{}));E.default.writeFileSync(_.default.join(n,"package.json.bak"),t)}finally{E.default.unlinkSync(_.default.join(n,"package.json")),E.default.renameSync(_.default.join(n,"package.json.bak"),_.default.join(n,"package.json"))}}M()})),o.program.parse(process.argv);
19
+ */function Re(){if(ne)return te;ne=1;const e=C.default,t=Ae(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),a=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},s=(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},i=(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 a=String.fromCharCode(e);return e===n?a:`[${a}-${String.fromCharCode(n)}]`},l=(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)},p=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw p([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 p([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 y=a(d)||a(g)||a(h),A=y?Math.max(d.length,g.length,h.length):0,R=!1===y&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),m=r.transform||(e=>t=>!0===e?Number(t):String(t))(R);if(r.toRegex&&1===n)return u(i(e,A),i(t,A),!0,r);let _={negatives:[],positives:[]},E=[],b=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?_[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):E.push(s(m(o,b),A,R)),o=f?o-n:o+n,b++;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="",a="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(a=`-(${r}${e.negatives.join("|")})`),n=o&&a?`${o}|${a}`:o||a,t.wrap?`(${r}${n})`:n})(_,r):l(E,null,{wrap:!1,...r}):E},d=(e,t,a,s={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,s);if("function"==typeof a)return d(e,t,1,{transform:a});if(n(a))return d(e,t,0,a);let i={...s};return!0===i.capture&&(i.wrap=!0),a=a||i.step||1,o(a)?o(e)&&o(t)?f(e,t,a,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let a=r.transform||(e=>String.fromCharCode(e)),s=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),p=s>i,f=Math.min(s,i),d=Math.max(s,i);if(r.toRegex&&1===n)return u(f,d,!1,r);let g=[],h=0;for(;p?s>=i:s<=i;)g.push(a(s,h)),s=p?s-n:s+n,h++;return!0===r.toRegex?l(g,null,{wrap:!1,options:r}):g})(e,t,Math.max(Math.abs(a),1),i):null==a||n(a)?d(e,t,1,a):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(a,i)};return te=d}function me(){if(pe)return le;pe=1;const e=he(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_LEFT_PARENTHESES:s,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,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}=ue?ie:(ue=1,ie={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 le=(y,A={})=>{if("string"!=typeof y)throw new TypeError("Expected a string");let R=A||{},m="number"==typeof R.maxLength?Math.min(t,R.maxLength):t;if(y.length>m)throw new SyntaxError(`Input length (${y.length}), exceeds max characters (${m})`);let _,E={type:"root",input:y,nodes:[]},b=[E],S=E,C=E,v=0,$=y.length,x=0,w=0;const H=()=>y[x++],k=e=>{if("text"===e.type&&"dot"===C.type&&(C.type="text"),!C||"text"!==C.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e;C.value+=e.value};for(k({type:"bos"});x<$;)if(S=b[b.length-1],_=H(),_!==h&&_!==g)if(_!==n)if(_!==c)if(_!==p)if(_!==s)if(_!==i)if(_!==f&&_!==d&&_!==r)if(_!==u)if(_!==l)if(_===o&&w>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}k({type:"comma",value:_}),S.commas++}else if(_===a&&w>0&&0===S.commas){let e=S.nodes;if(0===w||0===e.length){k({type:"text",value:_});continue}if("dot"===C.type){if(S.range=[],C.value+=_,C.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,C.type="text";continue}S.ranges++,S.args=[];continue}if("range"===C.type){e.pop();let t=e[e.length-1];t.value+=C.value+_,C=t,S.ranges--;continue}k({type:"dot",value:_})}else k({type:"text",value:_});else{if("brace"!==S.type){k({type:"text",value:_});continue}let e="close";S=b.pop(),S.close=!0,k({type:e,value:_}),w--,S=b[b.length-1]}else{w++;let e=C.value&&"$"===C.value.slice(-1)||!0===S.dollar;S=k({type:"brace",open:!0,close:!1,dollar:e,depth:w,commas:0,ranges:0,nodes:[]}),b.push(S),k({type:"open",value:_})}else{let e,t=_;for(!0!==A.keepQuotes&&(_="");x<$&&(e=H());)if(e!==n){if(e===t){!0===A.keepQuotes&&(_+=e);break}_+=e}else _+=e+H();k({type:"text",value:_})}else{if("paren"!==S.type){k({type:"text",value:_});continue}S=b.pop(),k({type:"text",value:_}),S=b[b.length-1]}else S=k({type:"paren",nodes:[]}),b.push(S),k({type:"text",value:_});else{let e;for(v++;x<$&&(e=H());)if(_+=e,e!==p)if(e!==n){if(e===c&&(v--,0===v))break}else _+=H();else v++;k({type:"text",value:_})}else k({type:"text",value:"\\"+_});else k({type:"text",value:(A.keepEscaping?_:"")+H()});do{if(S=b.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=b[b.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(b.length>0);return k({type:"eos"}),E},le}function _e(){if(fe)return ce;fe=1;const e=he(),t=function(){if(oe)return re;oe=1;const e=Re(),t=ge();return re=(n,r={})=>{let o=(n,a={})=>{let s=t.isInvalidBrace(a),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===s||!0===i,l=!0===r.escapeInvalid?"\\":"",p="";if(!0===n.isOpen)return l+n.value;if(!0===n.isClose)return l+n.value;if("open"===n.type)return u?l+n.value:"(";if("close"===n.type)return u?l+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),a=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==a.length)return o.length>1&&a.length>1?`(${a})`:a}if(n.nodes)for(let e of n.nodes)p+=o(e,n);return p};return o(n)}}(),n=function(){if(se)return ae;se=1;const e=Re(),t=he(),n=ge(),r=(e="",t="",o=!1)=>{let a=[];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)a.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),a.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(a)};return ae=(o,a={})=>{let s=void 0===a.rangeLimit?1e3:a.rangeLimit,i=(o,u={})=>{o.queue=[];let l=u,p=u.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(r(p.pop(),t(o,a)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void p.push(r(p.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,a.step,s))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,a);return 0===u.length&&(u=t(o,a)),p.push(r(p.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&&i(t,o):p.push(r(p.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=me(),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),ce=o}var Ee,be,Se,Ce,ve,$e,xe,we,He,ke,Oe,Te,Le,Ne={};function Ie(){if(be)return Ee;be=1;const e=v.default,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",a="[^/]",s=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${s}`,l={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:a,END_ANCHOR:s,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${s})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${a}*?`,START_ANCHOR:i},p={...l,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?p:l}}function je(){return Se||(Se=1,function(e){const t=v.default,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:s}=Ie();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>a.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(s,"\\$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}}(Ne)),Ne}function Me(){if(He)return we;He=1;const e=v.default,t=function(){if(ve)return Ce;ve=1;const e=je(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:a,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,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}=Ie(),y=e=>e===i||e===r,A=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return Ce=(R,m)=>{const _=m||{},E=R.length-1,b=!0===_.parts||!0===_.scanToEnd,S=[],C=[],v=[];let $,x,w=R,H=-1,k=0,O=0,T=!1,L=!1,N=!1,I=!1,j=!1,M=!1,B=!1,P=!1,D=!1,U=!1,G=0,F={value:"",depth:0,isGlob:!1};const K=()=>H>=E,q=()=>($=x,w.charCodeAt(++H));for(;H<E;){let e;if(x=q(),x!==r){if(!0===M||x===u){for(G++;!0!==K()&&(x=q());)if(x!==r)if(x!==u){if(!0!==M&&x===a&&(x=q())===a){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(!0!==M&&x===o){if(T=F.isBrace=!0,N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===d&&(G--,0===G)){M=!1,T=F.isBrace=!0,U=!0;break}}else G++;else B=F.backslashes=!0,q();if(!0===b)continue;break}if(x!==i){if(!0!==_.noext&&!0==(x===c||x===n||x===t||x===f||x===s)&&w.charCodeAt(H+1)===l){if(N=F.isGlob=!0,I=F.isExtglob=!0,U=!0,x===s&&H===k&&(D=!0),!0===b){for(;!0!==K()&&(x=q());)if(x!==r){if(x===g){N=F.isGlob=!0,U=!0;break}}else B=F.backslashes=!0,x=q();continue}break}if(x===t){if($===t&&(j=F.isGlobstar=!0),N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===f){if(N=F.isGlob=!0,U=!0,!0===b)continue;break}if(x===p){for(;!0!==K()&&(e=q());)if(e!==r){if(e===h){L=F.isBracket=!0,N=F.isGlob=!0,U=!0;break}}else B=F.backslashes=!0,q();if(!0===b)continue;break}if(!0===_.nonegate||x!==s||H!==k){if(!0!==_.noparen&&x===l){if(N=F.isGlob=!0,!0===b){for(;!0!==K()&&(x=q());)if(x!==l){if(x===g){U=!0;break}}else B=F.backslashes=!0,x=q();continue}break}if(!0===N){if(U=!0,!0===b)continue;break}}else P=F.negated=!0,k++}else{if(S.push(H),C.push(F),F={value:"",depth:0,isGlob:!1},!0===U)continue;if($===a&&H===k+1){k+=2;continue}O=H+1}}else B=F.backslashes=!0,x=q(),x===u&&(M=!0)}!0===_.noext&&(I=!1,N=!1);let W=w,Q="",X="";k>0&&(Q=w.slice(0,k),w=w.slice(k),O-=k),W&&!0===N&&O>0?(W=w.slice(0,O),X=w.slice(O)):!0===N?(W="",X=w):W=w,W&&""!==W&&"/"!==W&&W!==w&&y(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),!0===_.unescape&&(X&&(X=e.removeBackslashes(X)),W&&!0===B&&(W=e.removeBackslashes(W)));const J={prefix:Q,input:R,start:k,base:W,glob:X,isBrace:T,isBracket:L,isGlob:N,isExtglob:I,isGlobstar:j,negated:P,negatedExtglob:D};if(!0===_.tokens&&(J.maxDepth=0,y(x)||C.push(F),J.tokens=C),!0===_.parts||!0===_.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:k,r=S[t],o=R.slice(n,r);_.tokens&&(0===t&&0!==k?(C[t].isPrefix=!0,C[t].value=Q):C[t].value=o,A(C[t]),J.maxDepth+=C[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<R.length){const t=R.slice(e+1);v.push(t),_.tokens&&(C[C.length-1].value=t,A(C[C.length-1]),J.maxDepth+=C[C.length-1].depth)}J.slashes=S,J.parts=v}return J}}(),n=function(){if(xe)return $e;xe=1;const e=Ie(),t=je(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:a,REPLACEMENTS:s}=e,i=(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`,l=(p,c)=>{if("string"!=typeof p)throw new TypeError("Expected a string");p=s[p]||p;const f={...c},d="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;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||""},y=[h],A=f.capture?"":"?:",R=t.isWindows(c),m=e.globChars(R),_=e.extglobChars(m),{DOT_LITERAL:E,PLUS_LITERAL:b,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:v,NO_DOT:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:w,QMARK:H,QMARK_NO_DOT:k,STAR:O,START_ANCHOR:T}=m,L=e=>`(${A}(?:(?!${T}${e.dot?v:E}).)*?)`,N=f.dot?"":$,I=f.dot?H:k;let j=!0===f.bash?L(f):O;f.capture&&(j=`(${j})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const M={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:y};p=t.removePrefix(p,M),g=p.length;const B=[],P=[],D=[];let U,G=h;const F=()=>M.index===g-1,K=M.peek=(e=1)=>p[M.index+e],q=M.advance=()=>p[++M.index]||"",W=()=>p.slice(M.index+1),Q=(e="",t=0)=>{M.consumed+=e,M.index+=t},X=e=>{M.output+=null!=e.output?e.output:e.value,Q(e.value)},J=()=>{let e=1;for(;"!"===K()&&("("!==K(2)||"?"===K(3));)q(),M.start++,e++;return e%2!=0&&(M.negated=!0,M.start++,!0)},Z=e=>{M[e]++,D.push(e)},z=e=>{M[e]--,D.pop()},Y=e=>{if("globstar"===G.type){const t=M.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||(M.output=M.output.slice(0,-G.output.length),G.type="star",G.value="*",G.output=j,M.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,y.push(e),G=e},V=(e,t)=>{const n={..._[t],conditions:1,inner:""};n.prev=G,n.parens=M.parens,n.output=M.output;const r=(f.capture?"(":"")+n.open;Z("parens"),Y({type:e,value:t,output:M.output?"":C}),Y({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=j;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=L(f)),(r!==j||F()||/^\)+$/.test(W()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=W())&&/^\.[^\\/.]+$/.test(t)){const o=l(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(M.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:U,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(p)){let e=!1,n=p.replace(a,((t,n,r,o,a,s)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(a?H.repeat(a.length):""):0===s?I+(a?H.repeat(a.length):""):H.repeat(r.length):"."===o?E.repeat(r.length):"*"===o?n?n+o+(a?j:""):j:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===p&&!0===f.contains?(M.output=p,M):(M.output=t.wrapOutput(n,M,c),M)}for(;!F();){if(U=q(),"\0"===U)continue;if("\\"===U){const e=K();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){U+="\\",Y({type:"text",value:U});continue}const t=/^\\+/.exec(W());let n=0;if(t&&t[0].length>2&&(n=t[0].length,M.index+=n,n%2!=0&&(U+="\\")),!0===f.unescape?U=q():U+=q(),0===M.brackets){Y({type:"text",value:U});continue}}if(M.brackets>0&&("]"!==U||"["===G.value||"[^"===G.value)){if(!1!==f.posix&&":"===U){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),n=G.value.slice(e+2),o=r[n];if(o){G.value=t+o,M.backtrack=!0,q(),h.output||1!==y.indexOf(G)||(h.output=C);continue}}}("["===U&&":"!==K()||"-"===U&&"]"===K())&&(U=`\\${U}`),"]"!==U||"["!==G.value&&"[^"!==G.value||(U=`\\${U}`),!0===f.posix&&"!"===U&&"["===G.value&&(U="^"),G.value+=U,X({value:U});continue}if(1===M.quotes&&'"'!==U){U=t.escapeRegex(U),G.value+=U,X({value:U});continue}if('"'===U){M.quotes=1===M.quotes?0:1,!0===f.keepQuotes&&Y({type:"text",value:U});continue}if("("===U){Z("parens"),Y({type:"paren",value:U});continue}if(")"===U){if(0===M.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=B[B.length-1];if(e&&M.parens===e.parens+1){ee(B.pop());continue}Y({type:"paren",value:U,output:M.parens?")":"\\)"}),z("parens");continue}if("["===U){if(!0!==f.nobracket&&W().includes("]"))Z("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));U=`\\${U}`}Y({type:"bracket",value:U});continue}if("]"===U){if(!0===f.nobracket||G&&"bracket"===G.type&&1===G.value.length){Y({type:"text",value:U,output:`\\${U}`});continue}if(0===M.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));Y({type:"text",value:U,output:`\\${U}`});continue}z("brackets");const e=G.value.slice(1);if(!0===G.posix||"^"!==e[0]||e.includes("/")||(U=`/${U}`),G.value+=U,X({value:U}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(G.value);if(M.output=M.output.slice(0,-G.value.length),!0===f.literalBrackets){M.output+=n,G.value=n;continue}G.value=`(${A}${n}|${G.value})`,M.output+=G.value;continue}if("{"===U&&!0!==f.nobrace){Z("braces");const e={type:"brace",value:U,output:"(",outputIndex:M.output.length,tokensIndex:M.tokens.length};P.push(e),Y(e);continue}if("}"===U){const e=P[P.length-1];if(!0===f.nobrace||!e){Y({type:"text",value:U,output:U});continue}let t=")";if(!0===e.dots){const e=y.slice(),n=[];for(let t=e.length-1;t>=0&&(y.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=i(n,f),M.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=M.output.slice(0,e.outputIndex),r=M.tokens.slice(e.tokensIndex);e.value=e.output="\\{",U=t="\\}",M.output=n;for(const e of r)M.output+=e.output||e.value}Y({type:"brace",value:U,output:t}),z("braces"),P.pop();continue}if("|"===U){B.length>0&&B[B.length-1].conditions++,Y({type:"text",value:U});continue}if(","===U){let e=U;const t=P[P.length-1];t&&"braces"===D[D.length-1]&&(t.comma=!0,e="|"),Y({type:"comma",value:U,output:e});continue}if("/"===U){if("dot"===G.type&&M.index===M.start+1){M.start=M.index+1,M.consumed="",M.output="",y.pop(),G=h;continue}Y({type:"slash",value:U,output:S});continue}if("."===U){if(M.braces>0&&"dot"===G.type){"."===G.value&&(G.output=E);const e=P[P.length-1];G.type="dots",G.output+=U,G.value+=U,e.dots=!0;continue}if(M.braces+M.parens===0&&"bos"!==G.type&&"slash"!==G.type){Y({type:"text",value:U,output:E});continue}Y({type:"dot",value:U,output:E});continue}if("?"===U){if((!G||"("!==G.value)&&!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V("qmark",U);continue}if(G&&"paren"===G.type){const e=K();let n=U;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===G.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(W()))&&(n=`\\${U}`),Y({type:"text",value:U,output:n});continue}if(!0!==f.dot&&("slash"===G.type||"bos"===G.type)){Y({type:"qmark",value:U,output:k});continue}Y({type:"qmark",value:U,output:H});continue}if("!"===U){if(!0!==f.noextglob&&"("===K()&&("?"!==K(2)||!/[!=<:]/.test(K(3)))){V("negate",U);continue}if(!0!==f.nonegate&&0===M.index){J();continue}}if("+"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){V("plus",U);continue}if(G&&"("===G.value||!1===f.regex){Y({type:"plus",value:U,output:b});continue}if(G&&("bracket"===G.type||"paren"===G.type||"brace"===G.type)||M.parens>0){Y({type:"plus",value:U});continue}Y({type:"plus",value:b});continue}if("@"===U){if(!0!==f.noextglob&&"("===K()&&"?"!==K(2)){Y({type:"at",extglob:!0,value:U,output:""});continue}Y({type:"text",value:U});continue}if("*"!==U){"$"!==U&&"^"!==U||(U=`\\${U}`);const e=o.exec(W());e&&(U+=e[0],M.index+=e[0].length),Y({type:"text",value:U});continue}if(G&&("globstar"===G.type||!0===G.star)){G.type="star",G.star=!0,G.value+=U,G.output=j,M.backtrack=!0,M.globstar=!0,Q(U);continue}let e=W();if(!0!==f.noextglob&&/^\([^?]/.test(e)){V("star",U);continue}if("star"===G.type){if(!0===f.noglobstar){Q(U);continue}const t=G.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])){Y({type:"star",value:U,output:""});continue}const a=M.braces>0&&("comma"===t.type||"brace"===t.type),s=B.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!a&&!s){Y({type:"star",value:U,output:""});continue}for(;"/**"===e.slice(0,3);){const t=p[M.index+4];if(t&&"/"!==t)break;e=e.slice(3),Q("/**",3)}if("bos"===t.type&&F()){G.type="globstar",G.value+=U,G.output=L(f),M.output=G.output,M.globstar=!0,Q(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&F()){M.output=M.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=L(f)+(f.strictSlashes?")":"|$)"),G.value+=U,M.globstar=!0,M.output+=t.output+G.output,Q(U);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";M.output=M.output.slice(0,-(t.output+G.output).length),t.output=`(?:${t.output}`,G.type="globstar",G.output=`${L(f)}${S}|${S}${n})`,G.value+=U,M.output+=t.output+G.output,M.globstar=!0,Q(U+q()),Y({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){G.type="globstar",G.value+=U,G.output=`(?:^|${S}|${L(f)}${S})`,M.output=G.output,M.globstar=!0,Q(U+q()),Y({type:"slash",value:"/",output:""});continue}M.output=M.output.slice(0,-G.output.length),G.type="globstar",G.output=L(f),G.value+=U,M.output+=G.output,M.globstar=!0,Q(U);continue}const n={type:"star",value:U,output:j};!0!==f.bash?!G||"bracket"!==G.type&&"paren"!==G.type||!0!==f.regex?(M.index!==M.start&&"slash"!==G.type&&"dot"!==G.type||("dot"===G.type?(M.output+=x,G.output+=x):!0===f.dot?(M.output+=w,G.output+=w):(M.output+=N,G.output+=N),"*"!==K()&&(M.output+=C,G.output+=C)),Y(n)):(n.output=U,Y(n)):(n.output=".*?","bos"!==G.type&&"slash"!==G.type||(n.output=N+n.output),Y(n))}for(;M.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));M.output=t.escapeLast(M.output,"["),z("brackets")}for(;M.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));M.output=t.escapeLast(M.output,"("),z("parens")}for(;M.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));M.output=t.escapeLast(M.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==G.type&&"bracket"!==G.type||Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===M.backtrack){M.output="";for(const e of M.tokens)M.output+=null!=e.output?e.output:e.value,e.suffix&&(M.output+=e.suffix)}return M};return l.fastpaths=(r,o)=>{const a={...o},i="number"==typeof a.maxLength?Math.min(n,a.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=s[r]||r;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:y,STAR:A,START_ANCHOR:R}=e.globChars(l),m=a.dot?h:g,_=a.dot?y:g,E=a.capture?"":"?:";let b=!0===a.bash?".*?":A;a.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${E}(?:(?!${R}${e.dot?d:p}).)*?)`,C=e=>{switch(e){case"*":return`${m}${f}${b}`;case".*":return`${p}${f}${b}`;case"*.*":return`${m}${b}${p}${f}${b}`;case"*/*":return`${m}${b}${c}${f}${_}${b}`;case"**":return m+S(a);case"**/*":return`(?:${m}${S(a)}${c})?${_}${f}${b}`;case"**/*.*":return`(?:${m}${S(a)}${c})?${_}${b}${p}${f}${b}`;case"**/.*":return`(?:${m}${S(a)}${c})?${p}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+p+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==a.strictSlashes&&($+=`${c}?`),$},$e=l}(),r=je(),o=Ie(),a=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>a(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(s=e)&&"object"==typeof s&&!Array.isArray(s)&&e.tokens&&e.input;var s;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),l=o?a.compileRe(e,t):a.makeRe(e,t,!1,!0),p=l.state;delete l.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=a(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:s,output:f}=a.test(n,l,t,{glob:e,posix:u}),d={glob:e,state:p,regex:l,posix:u,input:n,output:f,match:s,isMatch:o};return"function"==typeof i.onResult&&i.onResult(d),!1===o?(d.isMatch=!1,!!r&&d):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(d),d.isMatch=!1,!!r&&d):("function"==typeof i.onMatch&&i.onMatch(d),!r||d)};return n&&(f.state=p),f};return a.test=(e,t,n,{glob:o,posix:s}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const i=n||{},u=i.format||(s?r.toPosixSlashes:null);let l=e===o,p=l&&u?u(e):e;return!1===l&&(p=u?u(e):e,l=p===o),!1!==l&&!0!==i.capture||(l=!0===i.matchBase||!0===i.basename?a.matchBase(e,t,n,s):t.exec(p)),{isMatch:Boolean(l),match:l,output:p}},a.matchBase=(t,n,o,s=r.isWindows(o))=>(n instanceof RegExp?n:a.makeRe(n,o)).test(e.basename(t)),a.isMatch=(e,t,n)=>a(t,n)(e),a.parse=(e,t)=>Array.isArray(e)?e.map((e=>a.parse(e,t))):n(e,{...t,fastpaths:!1}),a.scan=(e,n)=>t(e,n),a.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},s=o.contains?"":"^",i=o.contains?"":"$";let u=`${s}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const l=a.toRegex(u,t);return!0===r&&(l.state=e),l},a.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(s.output=n.fastpaths(e,t)),s.output||(s=n(e,t)),a.compileRe(s,t,r,o)},a.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/$^/}},a.constants=o,we=a}function Be(){return Oe?ke:(Oe=1,ke=Me())}var Pe=function(){if(Le)return Te;Le=1;const e=C.default,t=_e(),n=Be(),r=je(),o=e=>""===e||"./"===e,a=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,a=new Set,s=new Set,i=0,u=e=>{s.add(e.output),r&&r.onResult&&r.onResult(e)};for(let s=0;s<t.length;s++){let l=n(String(t[s]),{...r,onResult:u},!0),p=l.state.negated||l.state.negatedExtglob;p&&i++;for(let t of e){let e=l(t,!0);(p?!e.isMatch:e.isMatch)&&(p?o.add(e.output):(o.delete(e.output),a.add(e.output)))}}let l=(i===t.length?[...s]:[...a]).filter((e=>!o.has(e)));if(r&&0===l.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 l};return a.match=a,a.matcher=(e,t)=>n(e,t),a.any=a.isMatch=(e,t,r)=>n(t,r)(e),a.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],s=new Set(a(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)s.has(e)||r.add(e);return[...r]},a.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=>a.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 a.isMatch(t,n,{...r,contains:!0})},a.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=a(Object.keys(e),t,n),s={};for(let t of o)s[t]=e[t];return s},a.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},a.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},a.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)))},a.capture=(e,t,o)=>{let a=r.isWindows(o),s=n.makeRe(String(e),{...o,capture:!0}).exec(a?r.toPosixSlashes(t):t);if(s)return s.slice(1).map((e=>void 0===e?"":e))},a.makeRe=(...e)=>n.makeRe(...e),a.scan=(...e)=>n.scan(...e),a.parse=(e,r)=>{let o=[];for(let a of[].concat(e||[]))for(let e of t(String(a),r))o.push(n.parse(e,r));return o},a.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},a.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return a.braces(e,{...t,expand:!0})},Te=a}();const De='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),Ue="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const Ge=new Map;function Fe(e,t){if(Ge.has(e))return Ge.get(e)[t];const n=E.default.resolve(e,"package.json"),r=JSON.parse(_.default.readFileSync(n,"utf-8"));return Ge.set(e,r),r[t]}o.program.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,e]=o.program.args,t=process.cwd(),{init:n={}}=q()??{},{wd:r}=O(),a=E.default.basename(r),{named:s,template:i,bug:u={},readme:l=Ue,readmeTemplate:p}=n,f={template:"bug_report.yml",labels:["bug"],...u};let d=l;if(p){const e=E.default.resolve(r,p);d=_.default.readFileSync(e,"utf-8")}const g=function(e,t){let n=t??De,r=!1;try{t&&JSON.parse(t)}catch(e){r=!0}if(r){const r=E.default.resolve(e,t);n=_.default.readFileSync(r,"utf-8")}return n}(r,i),{indent:h=" "}=b.default(g),y={tabSize:h.length,insertSpaces:!0},A=["license","author"];let R=g;for(const e of A)R=c.applyEdits(R,c.modify(R,[e],Fe(r,e),{formattingOptions:y}));let[m,C]=await async function(e,t,{wd:n,cwd:r,workspaceName:o}){const a=r.replace(`${n}/`,"");let s=E.default.basename(r);if("function"==typeof e)return e(t,{full:n,relative:r});let i,u,l=!1;if("object"==typeof e)if(r===n){const{rule:t}=await S.default.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(i=t,u=e[t])}else for(const[t,n]of Object.entries(e)){if(Pe.isMatch(a,t)){i=t,u=n;break}if(Pe.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){l=!0,i=t,u=n;break}}if(u||(i="packages/*",u=`@${o}/$basename`),!u)throw new Error("no matched rule");if(!t&&l&&(s=await S.default.prompt({type:"input",name:"name",message:`the matched rule is \`${String(u)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof u)return u(t,{full:n,relative:r,basename:s});if("string"==typeof u){const e=t??s;return[u.replace(/\$basename/g,e),i?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(s,e,{wd:r,cwd:t,workspaceName:a});if(!C){const{dir:t}=await S.default.prompt({type:"input",name:"dir",message:"package directory",default:e});C=t}if(!m){const{name:t}=await S.default.prompt({type:"input",name:"name",message:"package name",default:e});m=t}R=c.applyEdits(R,c.modify(R,["name"],m,{formattingOptions:y}));let v=Fe(r,"repository");"string"==typeof v&&(v={type:"git",url:v,directory:C}),R=c.applyEdits(R,c.modify(R,["repository"],v,{formattingOptions:y}));const $=`${v?.url}/blob/master/${C}/README.md`;R=c.applyEdits(R,c.modify(R,["homepage"],$,{formattingOptions:y}));let x=f.labels;"function"==typeof x&&(x=x({name:m,dir:C})),x.push(`scope:${m}`);const w=`${v?.url}/issues/new?template=${f.template}&labels=${x.join(",")}`;function H(e){if(!C)throw new Error("pkgDir is not defined");return E.default.resolve(C,e)}R=c.applyEdits(R,c.modify(R,["bugs"],w,{formattingOptions:y})),_.default.existsSync(C)||_.default.mkdirSync(C);const k=H("package.json");if(_.default.existsSync(k))throw new Error("package.json already exists");_.default.writeFileSync(k,R),console.log(R,"written to",k);const T=Fe(r,"license"),L=H("README.md");"function"==typeof d&&(d=d({dir:C,packageJson:JSON.parse(R)}));const N=d.replace(/\$name/g,m).replace(/\$license/g,T);_.default.writeFileSync(L,N)}));const Ke=(e,t)=>new Set([...e].filter((e=>t.has(e))));function qe({entrypoints:e,pkgIsModule:t,entries:r,config:o,dir:a,noFilter:s,isPublish:i}){const{build:u={},publish:{withSuffix:l=!1,withSource:p=!0}={}}=o??{},{crossModuleConvertor:c=!0}=u,f=`./${d=((...e)=>n.resolve(a??process.cwd(),...e))(("object"==typeof u?.output?.dir?u.output.dir.js:u?.output?.dir)??"dist"),n.relative(a??process.cwd(),d)}`;var d;const[,g]=y.resolveEntrypoints(e);r&&Object.entries(g).forEach((([e])=>{r.some((t=>Pe.isMatch(e,t,{matchBase:!0})))||delete g[e]}));const h=s?g:y.filterLeafs(g,{skipValue:[/(^|\/)\.jk-noentry/,...y.DEFAULT_SKIP_VALUES]}),A=c?{import:e=>!t&&0===Ke(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ke(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[h,y.entrypoints2Exports(h,{outdir:f,withSuffix:i?l:void 0,withSource:i?p:void 0,withConditional:{...A}})]}o.program.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-no-b, --no-bumper","no bump version").option("-p, --preview","preview publish").action((async({preview:e,bumper:t,...n})=>{B();const{value:r={}}=await L()??{},o=Object.entries(r);if(0===o.length)throw new Error("no packages selected");const a=o.map((([e,t])=>{const{type:n,exports:r={}}=t,o="module"===n,a={...t},[s,i]=qe({entrypoints:r,pkgIsModule:o,config:q(e),dir:e,noFilter:!0,isPublish:!0});return a.exports={...s,...i},[e,a]})),s=Object.entries(n).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[n,r]of a){const o=_.default.readFileSync(E.default.join(n,"package.json"),"utf-8"),a=JSON.parse(o)??"0.0.0",i=t?h.bump(a.version,t):a.version,{indent:u=" "}=b.default(o),l={tabSize:u.length,insertSpaces:!0};let p=o;p=c.applyEdits(p,c.modify(p,["version"],i,{formattingOptions:l}));for(const[e,t]of Object.entries(r))if(JSON.stringify(t)!==JSON.stringify(a[e]))if("exports"!==e)p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l}));else{const e=t;for(const[t,n]of Object.entries(e))p=c.applyEdits(p,c.modify(p,["publishConfig","exports",t],n,{formattingOptions:l}));const n=e?.["."],o={};if(n){switch(typeof n){case"string":o["module"===r?.type?"module":"main"]=n;break;case"object":{const e=n;o.main=e.require??e.default,o.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(o))void 0!==t&&(p=c.applyEdits(p,c.modify(p,["publishConfig",e],t,{formattingOptions:l})))}}try{if(_.default.renameSync(E.default.join(n,"package.json"),E.default.join(n,"package.json.bak")),_.default.writeFileSync(E.default.join(n,"package.json"),p),console.log(p),e){console.warn("preview mode");continue}$.execSync(["pnpm","publish","--access","public","--no-git-checks",...s].join(" "),{cwd:n,stdio:"inherit"});const t=c.applyEdits(o,c.modify(o,["version"],i,{}));_.default.writeFileSync(E.default.join(n,"package.json.bak"),t)}finally{_.default.unlinkSync(E.default.join(n,"package.json")),_.default.renameSync(E.default.join(n,"package.json.bak"),E.default.join(n,"package.json"))}}M()})),o.program.parse(process.argv);