@visulima/cerebro 3.0.0-alpha.32 → 3.0.0-alpha.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,36 @@
1
+ ## @visulima/cerebro [3.0.0-alpha.33](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.32...@visulima/cerebro@3.0.0-alpha.33) (2026-06-30)
2
+
3
+ ### Styles
4
+
5
+ * cs fixes ([2a960bb](https://github.com/visulima/visulima/commit/2a960bb1772c9dc70080e2d75d3a0d827034e294))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * add fallow code-intelligence across all packages ([a3b4821](https://github.com/visulima/visulima/commit/a3b48215002e86fed20f2973038b5d4a0aa1ce04))
10
+
11
+ ### Code Refactoring
12
+
13
+ * **cerebro:** lazy-load optional peer deps in built-in commands ([d499fe6](https://github.com/visulima/visulima/commit/d499fe60e903eb4322e8fb449d2592b88b7039cd))
14
+ * resolve fallow dead-code across 13 packages ([8c458d2](https://github.com/visulima/visulima/commit/8c458d2eb17225ed48fc4bee4569e522912e8c3d))
15
+
16
+ ### Tests
17
+
18
+ * fix failing and flaky package tests ([3f2894e](https://github.com/visulima/visulima/commit/3f2894e816e99f465abb0d3b7d5161af69bbb4ec))
19
+
20
+ ### Continuous Integration
21
+
22
+ * **fallow:** make fallow:health advisory (--report-only) ([d57148e](https://github.com/visulima/visulima/commit/d57148ea0e3556b4c24d8d336b9fa14987f5dc7d))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * **@visulima/colorize:** upgraded to 2.0.0-alpha.15
28
+ * **@visulima/boxen:** upgraded to 3.0.0-alpha.15
29
+ * **@visulima/command-line-args:** upgraded to 2.0.0-alpha.14
30
+ * **@visulima/error:** upgraded to 6.0.0-alpha.35
31
+ * **@visulima/pail:** upgraded to 4.0.0-alpha.23
32
+ * **@visulima/string:** upgraded to 3.0.0-alpha.18
33
+
1
34
  ## @visulima/cerebro [3.0.0-alpha.32](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.31...@visulima/cerebro@3.0.0-alpha.32) (2026-06-13)
2
35
 
3
36
  ### Features
@@ -1,5 +1,5 @@
1
- import f from"@bomb.sh/tab";import{t as b}from"../packem_shared/cerebro-error-z8DS5U8c.js";class h extends b{troubleshooting;constructor(o,t,i=[]){super(o,t,{troubleshooting:i}),this.name="CompletionError",this.troubleshooting=i,i.length>0&&(this.hint=i.join(`
2
- `))}}const c=["bash","zsh","fish","powershell"],a=["node","bun","deno"],g=e=>"Deno"in e,S=e=>"Bun"in e,d=()=>g(globalThis)?"deno":S(globalThis)?"bun":"node",p=e=>{const o=e?.starshipShell??e?.shell;if(o){const s=o.toLowerCase();if(s.includes("zsh"))return"zsh";if(s.includes("bash"))return"bash";if(s.includes("fish"))return"fish"}const t=e?.psModulePath,i=e?.prompt;if(t||i?.includes("PS"))return"powershell";if(e?.comSpec?.toLowerCase().includes("cmd.exe"))return"bash"},m=f,w=(e,o)=>{for(const t of o)t.hidden||(t.name&&e.option(t.name,t.description??""),t.alias&&e.option(t.alias,t.description??""))},$=(e,o)=>{for(const[t,i]of o){if(i.name!==t||i.hidden)continue;const s=e.command(i.name,i.description??"");i.options&&w(s,i.options)}},y=e=>{if(!c.includes(e))throw new h(`Invalid shell type: ${e}`,"INVALID_SHELL",[`Valid shells are: ${c.join(", ")}`,"Shell will be auto-detected if not specified"])},L=e=>{if(e&&!a.includes(e))throw new h(`Invalid runtime: ${e}`,"INVALID_RUNTIME",[`Valid runtimes are: ${a.join(", ")}`,"Runtime will be auto-detected if not specified"])},C=(e,o)=>{e.error("Could not detect current shell");const t=[`Usage: ${o} completion --shell=<bash|zsh|fish|powershell> [--runtime=<node|bun|deno>]`,"","Examples:"," # Install completions for zsh:",` ${o} completion --shell=zsh > ~/.${o}-completion.zsh`,` echo 'source ~/.${o}-completion.zsh' >> ~/.zshrc`,""," # Install completions for bash with custom runtime:",` ${o} completion --shell=bash --runtime=bun > ~/.${o}-completion.bash`,` echo 'source ~/.${o}-completion.bash' >> ~/.bashrc`,""," # Install completions for fish:",` ${o} completion --shell=fish > ~/.config/fish/completions/${o}.fish`].join(`
3
- `);e.info(t)},P={description:"Generate shell completion scripts",env:[{description:"Shell path (Unix-like systems). Used for shell detection.",name:"SHELL",type:String},{description:"Starship shell configuration. Takes precedence over SHELL for detection.",name:"STARSHIP_SHELL",type:String},{description:"PowerShell module path (Windows). Used for PowerShell detection.",name:"PSModulePath",type:String},{description:"Command prompt variable (Windows). Used for PowerShell detection.",name:"PROMPT",type:String},{description:"Command processor (Windows). Used for Windows Command Prompt detection.",name:"ComSpec",type:String}],execute:async({env:e,logger:o,options:t,runtime:i})=>{const s=i.getCliName(),l=t.shell??p(e);if(!l){C(o,s);return}try{y(l),L(t.runtime),$(m,i.getCommands());const n=`${t.runtime??d()} ${s}`;m.setup(s,n,l)}catch(n){if(n instanceof h){const r=[`Failed to generate completion script: ${n.message}`,`Error code: ${n.code}`];throw n.troubleshooting.length>0&&r.push("","Troubleshooting:",...n.troubleshooting.map(u=>` • ${u}`)),o.error(r.join(`
4
- `)),n}else{const r=["Failed to generate completion script",`Error: ${n instanceof Error?n.message:String(n)}`,"","Troubleshooting:"," • Ensure @bomb.sh/tab is installed: pnpm add @bomb.sh/tab",` • Verify shell is supported: ${c.join(", ")}`,` • Verify runtime is supported: ${a.join(", ")}`," • Check that your CLI name is correct"];o.error(r.join(`
5
- `))}}},name:"completion",options:[{defaultOption:!0,defaultValue:p(),description:"Shell type (bash, zsh, fish, powershell). Defaults to current shell if detected.",name:"shell",type:String,typeLabel:"{underline shell}"},{defaultValue:d(),description:"JavaScript runtime (node, bun, deno). Defaults to current runtime if detected.",name:"runtime",type:String,typeLabel:"{underline runtime}"}]};export{P as default};
1
+ import{t as u}from"../packem_shared/cerebro-error-z8DS5U8c.js";class h extends u{troubleshooting;constructor(o,t,i=[]){super(o,t,{troubleshooting:i}),this.name="CompletionError",this.troubleshooting=i,i.length>0&&(this.hint=i.join(`
2
+ `))}}const a=["bash","zsh","fish","powershell"],c=["node","bun","deno"],f=e=>"Deno"in e,b=e=>"Bun"in e,d=()=>f(globalThis)?"deno":b(globalThis)?"bun":"node",p=e=>{const o=e?.starshipShell??e?.shell;if(o){const s=o.toLowerCase();if(s.includes("zsh"))return"zsh";if(s.includes("bash"))return"bash";if(s.includes("fish"))return"fish"}const t=e?.psModulePath,i=e?.prompt;if(t||i?.includes("PS"))return"powershell";if(e?.comSpec?.toLowerCase().includes("cmd.exe"))return"bash"},g=async()=>(await import("@bomb.sh/tab")).default,S=(e,o)=>{for(const t of o)t.hidden||(t.name&&e.option(t.name,t.description??""),t.alias&&e.option(t.alias,t.description??""))},w=(e,o)=>{for(const[t,i]of o){if(i.name!==t||i.hidden)continue;const s=e.command(i.name,i.description??"");i.options&&S(s,i.options)}},$=e=>{if(!a.includes(e))throw new h(`Invalid shell type: ${e}`,"INVALID_SHELL",[`Valid shells are: ${a.join(", ")}`,"Shell will be auto-detected if not specified"])},y=e=>{if(e&&!c.includes(e))throw new h(`Invalid runtime: ${e}`,"INVALID_RUNTIME",[`Valid runtimes are: ${c.join(", ")}`,"Runtime will be auto-detected if not specified"])},L=(e,o)=>{e.error("Could not detect current shell");const t=[`Usage: ${o} completion --shell=<bash|zsh|fish|powershell> [--runtime=<node|bun|deno>]`,"","Examples:"," # Install completions for zsh:",` ${o} completion --shell=zsh > ~/.${o}-completion.zsh`,` echo 'source ~/.${o}-completion.zsh' >> ~/.zshrc`,""," # Install completions for bash with custom runtime:",` ${o} completion --shell=bash --runtime=bun > ~/.${o}-completion.bash`,` echo 'source ~/.${o}-completion.bash' >> ~/.bashrc`,""," # Install completions for fish:",` ${o} completion --shell=fish > ~/.config/fish/completions/${o}.fish`].join(`
3
+ `);e.info(t)},I={description:"Generate shell completion scripts",env:[{description:"Shell path (Unix-like systems). Used for shell detection.",name:"SHELL",type:String},{description:"Starship shell configuration. Takes precedence over SHELL for detection.",name:"STARSHIP_SHELL",type:String},{description:"PowerShell module path (Windows). Used for PowerShell detection.",name:"PSModulePath",type:String},{description:"Command prompt variable (Windows). Used for PowerShell detection.",name:"PROMPT",type:String},{description:"Command processor (Windows). Used for Windows Command Prompt detection.",name:"ComSpec",type:String}],execute:async({env:e,logger:o,options:t,runtime:i})=>{const s=i.getCliName(),l=t.shell??p(e);if(!l){L(o,s);return}try{$(l),y(t.runtime);const n=await g();w(n,i.getCommands());const r=`${t.runtime??d()} ${s}`;n.setup(s,r,l)}catch(n){if(n instanceof h){const r=[`Failed to generate completion script: ${n.message}`,`Error code: ${n.code}`];throw n.troubleshooting.length>0&&r.push("","Troubleshooting:",...n.troubleshooting.map(m=>` • ${m}`)),o.error(r.join(`
4
+ `)),n}else{const r=["Failed to generate completion script",`Error: ${n instanceof Error?n.message:String(n)}`,"","Troubleshooting:"," • Ensure @bomb.sh/tab is installed: pnpm add @bomb.sh/tab",` • Verify shell is supported: ${a.join(", ")}`,` • Verify runtime is supported: ${c.join(", ")}`," • Check that your CLI name is correct"];o.error(r.join(`
5
+ `))}}},name:"completion",options:[{defaultOption:!0,defaultValue:p(),description:"Shell type (bash, zsh, fish, powershell). Defaults to current shell if detected.",name:"shell",type:String,typeLabel:"{underline shell}"},{defaultValue:d(),description:"JavaScript runtime (node, bun, deno). Defaults to current runtime if detected.",name:"runtime",type:String,typeLabel:"{underline runtime}"}]};export{I as default};
@@ -1 +1 @@
1
- import{inverse as p,cyan as u,green as h,yellow as g}from"@visulima/colorize";import{a as y,r as f}from"../packem_shared/index-BSKOOIL6.js";const O=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}],b="__Other",v=s=>s.charAt(0).toUpperCase()+s.slice(1),w=(s,r,l,o)=>{s.debug("no command given, printing general help...");let m=[...new Set(l.values())].filter(n=>!n.hidden);o&&(m=m.filter(n=>n.group===o));const e=m.reduce((n,i)=>{const d=i.group??b;return n[d]??=[],n[d].push(i),n},{}),a=n=>n.map(i=>{let d="";typeof i.alias=="string"?d=i.alias:Array.isArray(i.alias)&&(d=i.alias.join(", ")),d!==""&&(d=` [${d}]`);let t=i.name;return i.commandPath&&i.commandPath.length>0&&(t=`${i.commandPath.join(" ")} ${i.name}`),[`${h(t)}${d}`,i.description??""]});(s.raw??s.log)(f([{content:`${u(r.getCliName())} ${h("<command>")} [positional arguments] ${g("[options]")}`,header:p.cyan(" Usage ")},...Object.keys(e).map(n=>{const i=o?` ${v(o)}`:"";return{content:a(e[n]),header:n===b||o?p.green(` Available${i} Commands `):` ${p.green(` ${v(n)} `)}`}}),l.has("help")?{header:p.yellow(" Command Options "),optionList:l.get("help").options?.filter(n=>!n.hidden)}:void 0,{header:p.yellow(" Global Options "),optionList:r.getGlobalOptions()},{content:O.filter(n=>!n.hidden).map(n=>[n.name,n.description??""]),header:p.magenta(" Environment Variables ")},{content:`Run "${u(r.getCliName())} ${h("help <command>")}" or "${u(r.getCliName())} ${h("<command>")} ${g("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},$=(s,r)=>{const l=[];for(const o of s.values()){if(o.hidden)continue;const m=o.commandPath??[];if(m.length!==r.length)continue;let e=!0;for(const[a,n]of r.entries())if(m[a]!==n){e=!1;break}e&&l.push(o)}return l},E=(s,r,l,o)=>{const m=l.join(" "),e=[{content:`${u(r.getCliName())} ${h(m)} ${h("<subcommand>")} [positional arguments] ${g("[options]")}`,header:p.cyan(" Usage ")},{content:o.map(a=>{const n=[...a.commandPath??[],a.name].join(" ");return[h(n),a.description??""]}),header:p.green(" Subcommands ")},{header:p.yellow(" Global Options "),optionList:r.getGlobalOptions()},{content:`Run "${u(r.getCliName())} ${h(`${m} <subcommand>`)} ${g("--help")}" for help with a specific subcommand.`,raw:!0}];(s.raw??s.log)(f(e))},N=(s,r,l,o,m)=>{let e=m??l.get(o);if(!e)for(const t of l.values()){const c=t.commandPath?[...t.commandPath,t.name]:[t.name];if(c.at(-1)===o||c.join(" ")===o){e=t;break}}if(!e){const t=o.split(" ").filter(Boolean),c=t.length>0?$(l,t):[];if(c.length>0){E(s,r,t,c);return}s.error(`Command "${o}" not found`);return}const a=[],n=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(a.push({content:`${u(r.getCliName())} ${h(n)}${e.argument?" [positional arguments]":""}${e.options?" [options]":""}`,header:p.cyan(" Usage ")}),e.description&&a.push({content:e.description,header:p.green(" Description ")}),e.argument&&a.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&a.push({header:p.yellow(" Command Options "),optionList:e.options.filter(t=>!t.hidden)}),a.push({header:p.yellow(" Global Options "),optionList:r.getGlobalOptions()}),Array.isArray(e.env)&&e.env.length>0){const t=e.env.filter(c=>!c.hidden);t.length>0&&a.push({content:t.map(c=>[c.name,c.description??""]),header:p.magenta(" Environment Variables ")})}if(e.alias!==void 0&&e.alias.length>0){let t=e.alias;typeof e.alias=="string"&&(t=[e.alias]),a.splice(1,0,{content:t,header:"Alias(es)"})}Array.isArray(e.examples)&&e.examples.length>0&&a.push({content:e.examples,header:"Examples"});const i=[...e.commandPath??[],e.name],d=$(l,i);d.length>0&&a.push({content:d.map(t=>{const c=[...t.commandPath??[],t.name].join(" ");return[h(c),t.description??""]}),header:p.green(" Subcommands ")}),(s.raw??s.log)(f(a))};class P{argument={description:"Command to show help for (subcommand path supported, e.g. `cli help docker build`)",name:"command",type:String};name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(r){this.commands=r}execute(r){const{argument:l,command:o,commandName:m,logger:e,options:a,runtime:n}=r,{footer:i,header:d}=n.getCommandSection();d&&(e.raw??e.log)(y(d));const t=m==="help"&&Array.isArray(l)&&l.length>0?l.join(" "):void 0;if(m==="help"&&t===void 0)w(e,n,this.commands,typeof a?.group=="string"?a.group:void 0);else{const c=t!==void 0||o===void 0||o.name==="help"?void 0:o;N(e,n,this.commands,t??m,c)}i&&(e.raw??e.log)(y(i))}}export{P as default};
1
+ import{inverse as p,cyan as u,green as h,yellow as g}from"@visulima/colorize";import{a as y,r as f}from"../packem_shared/index-B7-8G-9s.js";const O=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}],b="__Other",v=s=>s.charAt(0).toUpperCase()+s.slice(1),w=(s,r,l,o)=>{s.debug("no command given, printing general help...");let m=[...new Set(l.values())].filter(n=>!n.hidden);o&&(m=m.filter(n=>n.group===o));const e=m.reduce((n,i)=>{const d=i.group??b;return n[d]??=[],n[d].push(i),n},{}),a=n=>n.map(i=>{let d="";typeof i.alias=="string"?d=i.alias:Array.isArray(i.alias)&&(d=i.alias.join(", ")),d!==""&&(d=` [${d}]`);let t=i.name;return i.commandPath&&i.commandPath.length>0&&(t=`${i.commandPath.join(" ")} ${i.name}`),[`${h(t)}${d}`,i.description??""]});(s.raw??s.log)(f([{content:`${u(r.getCliName())} ${h("<command>")} [positional arguments] ${g("[options]")}`,header:p.cyan(" Usage ")},...Object.keys(e).map(n=>{const i=o?` ${v(o)}`:"";return{content:a(e[n]),header:n===b||o?p.green(` Available${i} Commands `):` ${p.green(` ${v(n)} `)}`}}),l.has("help")?{header:p.yellow(" Command Options "),optionList:l.get("help").options?.filter(n=>!n.hidden)}:void 0,{header:p.yellow(" Global Options "),optionList:r.getGlobalOptions()},{content:O.filter(n=>!n.hidden).map(n=>[n.name,n.description??""]),header:p.magenta(" Environment Variables ")},{content:`Run "${u(r.getCliName())} ${h("help <command>")}" or "${u(r.getCliName())} ${h("<command>")} ${g("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},$=(s,r)=>{const l=[];for(const o of s.values()){if(o.hidden)continue;const m=o.commandPath??[];if(m.length!==r.length)continue;let e=!0;for(const[a,n]of r.entries())if(m[a]!==n){e=!1;break}e&&l.push(o)}return l},E=(s,r,l,o)=>{const m=l.join(" "),e=[{content:`${u(r.getCliName())} ${h(m)} ${h("<subcommand>")} [positional arguments] ${g("[options]")}`,header:p.cyan(" Usage ")},{content:o.map(a=>{const n=[...a.commandPath??[],a.name].join(" ");return[h(n),a.description??""]}),header:p.green(" Subcommands ")},{header:p.yellow(" Global Options "),optionList:r.getGlobalOptions()},{content:`Run "${u(r.getCliName())} ${h(`${m} <subcommand>`)} ${g("--help")}" for help with a specific subcommand.`,raw:!0}];(s.raw??s.log)(f(e))},N=(s,r,l,o,m)=>{let e=m??l.get(o);if(!e)for(const t of l.values()){const c=t.commandPath?[...t.commandPath,t.name]:[t.name];if(c.at(-1)===o||c.join(" ")===o){e=t;break}}if(!e){const t=o.split(" ").filter(Boolean),c=t.length>0?$(l,t):[];if(c.length>0){E(s,r,t,c);return}s.error(`Command "${o}" not found`);return}const a=[],n=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(a.push({content:`${u(r.getCliName())} ${h(n)}${e.argument?" [positional arguments]":""}${e.options?" [options]":""}`,header:p.cyan(" Usage ")}),e.description&&a.push({content:e.description,header:p.green(" Description ")}),e.argument&&a.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&a.push({header:p.yellow(" Command Options "),optionList:e.options.filter(t=>!t.hidden)}),a.push({header:p.yellow(" Global Options "),optionList:r.getGlobalOptions()}),Array.isArray(e.env)&&e.env.length>0){const t=e.env.filter(c=>!c.hidden);t.length>0&&a.push({content:t.map(c=>[c.name,c.description??""]),header:p.magenta(" Environment Variables ")})}if(e.alias!==void 0&&e.alias.length>0){let t=e.alias;typeof e.alias=="string"&&(t=[e.alias]),a.splice(1,0,{content:t,header:"Alias(es)"})}Array.isArray(e.examples)&&e.examples.length>0&&a.push({content:e.examples,header:"Examples"});const i=[...e.commandPath??[],e.name],d=$(l,i);d.length>0&&a.push({content:d.map(t=>{const c=[...t.commandPath??[],t.name].join(" ");return[h(c),t.description??""]}),header:p.green(" Subcommands ")}),(s.raw??s.log)(f(a))};class P{argument={description:"Command to show help for (subcommand path supported, e.g. `cli help docker build`)",name:"command",type:String};name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(r){this.commands=r}execute(r){const{argument:l,command:o,commandName:m,logger:e,options:a,runtime:n}=r,{footer:i,header:d}=n.getCommandSection();d&&(e.raw??e.log)(y(d));const t=m==="help"&&Array.isArray(l)&&l.length>0?l.join(" "):void 0;if(m==="help"&&t===void 0)w(e,n,this.commands,typeof a?.group=="string"?a.group:void 0);else{const c=t!==void 0||o===void 0||o.name==="help"?void 0:o;N(e,n,this.commands,t??m,c)}i&&(e.raw??e.log)(y(i))}}export{P as default};
@@ -1,36 +1,36 @@
1
- import{createRequire as x}from"node:module";import L from"github-slugger";import{r as N}from"../packem_shared/index-BSKOOIL6.js";import{g as V,a as q,b as G}from"../packem_shared/runtime-process-Dmz0vCJy.js";const S=x(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=e=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[t,n]=$.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return $.getBuiltinModule(e)}return S(e)},{resolve:E,join:k,dirname:B}=O("node:path"),P=async(e,t)=>{try{return await e.access(t),!0}catch{return!1}},T=new L,v=e=>T.slug(e),U=e=>e.filter(Boolean),I=(e,t)=>{const n=new Set,r=[];for(const o of e){const a=t(o);n.has(a)||(n.add(a),r.push(o))}return r},M=(e,t)=>{const n=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(e.argument){const r=e.argument.name.toUpperCase(),o=e.argument.required?r:`[${r}]`;return`${t} ${n} ${o}`}return`${t} ${n}`},F=(e,t)=>{if(!Array.isArray(e.env)||e.env.length===0)return;const n=e.env.filter(r=>!r.hidden);n.length>0&&t.push({content:n.map(r=>[r.name,r.description??""]),header:" Environment Variables "})},W=(e,t)=>{const n=[],r=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" "),o=!!e.argument,a=!!e.options;if(n.push({content:`${t} ${r}${o?" [positional arguments]":""}${a?" [options]":""}`,header:" Usage "}),e.description&&n.push({content:e.description,header:" Description "}),e.argument&&n.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&n.push({header:" Command Options ",optionList:e.options.filter(i=>!i.hidden)}),F(e,n),e.alias!==void 0&&e.alias.length>0){const i=Array.isArray(e.alias)?e.alias:[e.alias];n.splice(1,0,{content:i,header:"Alias(es)"})}return Array.isArray(e.examples)&&e.examples.length>0&&n.push({content:e.examples,header:"Examples"}),N(n)},z=(e,t)=>{const n=e.description?.trim().split(`
2
- `)[0]??"",r=M(e,t),o=W(e,t);return U([`## \`${r}\``,n,`\`\`\`
3
- ${o.trim()}
1
+ import{createRequire as x}from"node:module";import{r as L}from"../packem_shared/index-B7-8G-9s.js";import{g as N,a as V,b as q}from"../packem_shared/runtime-process-Dmz0vCJy.js";const S=x(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[n,t]=h.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return h.getBuiltinModule(e)}return S(e)},{resolve:P,join:k,dirname:B}=O("node:path"),v=async(e,n)=>{try{return await e.access(n),!0}catch{return!1}},G=async()=>{const{default:e}=await import("github-slugger"),n=new e;return t=>n.slug(t)},T=e=>e.filter(Boolean),U=(e,n)=>{const t=new Set,a=[];for(const r of e){const o=n(r);t.has(o)||(t.add(o),a.push(r))}return a},M=(e,n)=>{const t=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(e.argument){const a=e.argument.name.toUpperCase(),r=e.argument.required?a:`[${a}]`;return`${n} ${t} ${r}`}return`${n} ${t}`},F=(e,n)=>{if(!Array.isArray(e.env)||e.env.length===0)return;const t=e.env.filter(a=>!a.hidden);t.length>0&&n.push({content:t.map(a=>[a.name,a.description??""]),header:" Environment Variables "})},I=(e,n)=>{const t=[],a=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" "),r=!!e.argument,o=!!e.options;if(t.push({content:`${n} ${a}${r?" [positional arguments]":""}${o?" [options]":""}`,header:" Usage "}),e.description&&t.push({content:e.description,header:" Description "}),e.argument&&t.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&t.push({header:" Command Options ",optionList:e.options.filter(i=>!i.hidden)}),F(e,t),e.alias!==void 0&&e.alias.length>0){const i=Array.isArray(e.alias)?e.alias:[e.alias];t.splice(1,0,{content:i,header:"Alias(es)"})}return Array.isArray(e.examples)&&e.examples.length>0&&t.push({content:e.examples,header:"Examples"}),L(t)},W=(e,n)=>{const t=e.description?.trim().split(`
2
+ `)[0]??"",a=M(e,n),r=I(e,n);return T([`## \`${a}\``,t,`\`\`\`
3
+ ${r.trim()}
4
4
  \`\`\``]).join(`
5
5
 
6
- `)},H=(e,t,n,r)=>{const o=`(${["--version","-V"].join("|")})`,a=q(),i=G();return`\`\`\`sh-session
7
- $ npm install -g ${t}
6
+ `)},z=(e,n,t,a)=>{const r=`(${["--version","-V"].join("|")})`,o=V(),i=q();return`\`\`\`sh-session
7
+ $ npm install -g ${n}
8
8
  $ ${e} COMMAND
9
9
  running command...
10
- $ ${e} ${o}
11
- ${t}/${n??"unknown"} ${a}-${i} node-v${r}
10
+ $ ${e} ${r}
11
+ ${n}/${t??"unknown"} ${o}-${i} node-v${a}
12
12
  $ ${e} --help [COMMAND]
13
13
  USAGE
14
14
  $ ${e} COMMAND
15
15
  ...
16
16
  \`\`\`
17
- `},R=(e,t,n)=>{const r=e.map(a=>{const i=M(a,t);return`* [\`${i}\`](#${v(i)})`}),o=e.map(a=>z(a,t)).map(a=>`${a.trim()}
17
+ `},R=(e,n,t,a)=>{const r=e.map(i=>{const p=M(i,n);return`* [\`${p}\`](#${a(p)})`}),o=e.map(i=>W(i,n)).map(i=>`${i.trim()}
18
18
  `);return[...r,"",...o].join(`
19
- `).trim()},j=async(e,t,n)=>{const r=B(t);await P(e,r)||await e.mkdir(r,{recursive:!0}),await e.writeFile(t,n,"utf8")},J=async(e,t,n,r,o,a)=>{const i=new Map;for(const m of n){const s=m.group??"__Other",l=i.get(s)??[];l.push(m),i.set(s,l)}const d=Array.from(i.entries(),([m,s])=>m==="__Other"?["Other",s]:[m,s]);return await Promise.all(d.map(async([m,s])=>{const l=m.replaceAll(":","/"),f=k(".",r,`${l}.md`),u=`\`${o} ${m}\``,p=`${[u,"=".repeat(u.length),"",`Commands in the ${m} group.`,"",R(s,o)].join(`
19
+ `).trim()},j=async(e,n,t)=>{const a=B(n);await v(e,a)||await e.mkdir(a,{recursive:!0}),await e.writeFile(n,t,"utf8")},H=async(e,n,t,a,r,o,i)=>{const p=new Map;for(const m of t){const s=m.group??"__Other",u=p.get(s)??[];u.push(m),p.set(s,u)}const d=Array.from(p.entries(),([m,s])=>m==="__Other"?["Other",s]:[m,s]);return await Promise.all(d.map(async([m,s])=>{const u=m.replaceAll(":","/"),y=k(".",a,`${u}.md`),g=`\`${r} ${m}\``,l=`${[g,"=".repeat(g.length),"",`Commands in the ${m} group.`,"",R(s,r,o,i)].join(`
20
20
  `).trim()}
21
- `;a.dryRun||await j(e,E(t,f),p)})),`${[`# Command Topics
22
- `,...d.map(([m])=>{const s=m.replaceAll(":","/");return`* [\`${o} ${m}\`](${r}/${s}.md)`})].join(`
21
+ `;o.dryRun||await j(e,P(n,y),l)})),`${[`# Command Topics
22
+ `,...d.map(([m])=>{const s=m.replaceAll(":","/");return`* [\`${r} ${m}\`](${a}/${s}.md)`})].join(`
23
23
  `).trim()}
24
24
  `},A=e=>e.replaceAll(`\r
25
25
  `,`
26
26
  `).replaceAll("\r",`
27
- `),K=e=>A(e).split(`
28
- `).filter(t=>t.startsWith("# ")).map(t=>t.trim().slice(2)).map(t=>`* [${t}](#${v(t)})`).join(`
29
- `),w=e=>e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),y=(e,t,n)=>{const r=A(e),o=`<!-- ${t} -->`,a=`<!-- ${t}stop -->`;if(r.includes(o)&&r.includes(a)){const i=w(o),d=w(a),m=new RegExp(String.raw`${i}(.|\n)*${d}`,"m");return r.replace(m,`${o}
30
- ${n}
31
- ${a}`)}return r.replace(o,`${o}
32
- ${n}
33
- ${a}`)},ee={description:"Generate README documentation for CLI commands",execute:async({fs:e,logger:t,options:n,process:r,runtime:o})=>{const a=o.getCliName(),i=o.getPackageName()??a,d=o.getPackageVersion(),m=V().node??"unknown",s={aliases:n.aliases,dryRun:n.dryRun,multi:n.multi,outputDir:n.outputDir??"docs",readmePath:n.readmePath??"README.md",version:n.version??d??void 0},l=o.getCommands(),f=[...l.values()].filter(c=>!c.hidden).filter(c=>s.aliases?!0:c.name===l.get(c.name)?.name).toSorted((c,h)=>{const b=c.commandPath?[...c.commandPath,c.name].join(" "):c.name,C=h.commandPath?[...h.commandPath,h.name].join(" "):h.name;return b.localeCompare(C)}),u=I(f,c=>c.commandPath?[...c.commandPath,c.name].join(" "):c.name);t.debug(`Processing ${String(u.length)} commands for README generation`);let p;const g=E(r.cwd,s.readmePath??"README.md");if(await P(e,g)){const c=await e.readFile(g,"utf8");p=A(c)}else t.warn(`README file not found at ${g}, creating template`),p=`# ${i}
27
+ `),J=(e,n)=>A(e).split(`
28
+ `).filter(t=>t.startsWith("# ")).map(t=>t.trim().slice(2)).map(t=>`* [${t}](#${n(t)})`).join(`
29
+ `),E=e=>e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),w=(e,n,t)=>{const a=A(e),r=`<!-- ${n} -->`,o=`<!-- ${n}stop -->`;if(a.includes(r)&&a.includes(o)){const i=E(r),p=E(o),d=new RegExp(String.raw`${i}(.|\n)*${p}`,"m");return a.replace(d,`${r}
30
+ ${t}
31
+ ${o}`)}return a.replace(r,`${r}
32
+ ${t}
33
+ ${o}`)},Y={description:"Generate README documentation for CLI commands",execute:async({fs:e,logger:n,options:t,process:a,runtime:r})=>{const o=r.getCliName(),i=r.getPackageName()??o,p=r.getPackageVersion(),d=N().node??"unknown",m=await G(),s={aliases:t.aliases,dryRun:t.dryRun,multi:t.multi,outputDir:t.outputDir??"docs",readmePath:t.readmePath??"README.md",version:t.version??p??void 0},u=r.getCommands(),y=[...u.values()].filter(c=>!c.hidden).filter(c=>s.aliases?!0:c.name===u.get(c.name)?.name).toSorted((c,f)=>{const b=c.commandPath?[...c.commandPath,c.name].join(" "):c.name,C=f.commandPath?[...f.commandPath,f.name].join(" "):f.name;return b.localeCompare(C)}),g=U(y,c=>c.commandPath?[...c.commandPath,c.name].join(" "):c.name);n.debug(`Processing ${String(g.length)} commands for README generation`);let l;const $=P(a.cwd,s.readmePath??"README.md");if(await v(e,$)){const c=await e.readFile($,"utf8");l=A(c)}else n.warn(`README file not found at ${$}, creating template`),l=`# ${i}
34
34
 
35
35
  <!-- usage -->
36
36
  <!-- usagestop -->
@@ -40,6 +40,6 @@ ${a}`)},ee={description:"Generate README documentation for CLI commands",execute
40
40
 
41
41
  <!-- toc -->
42
42
  <!-- tocstop -->
43
- `;const D=s.outputDir??"docs",_=s.version??d??"unknown";p=y(p,"usage",H(a,i,_,m)),p=y(p,"commands",s.multi?await J(e,r.cwd,u,D,a,s):R(u,a)),p=y(p,"toc",K(p)),p=`${p.trimEnd()}
44
- `,s.dryRun?(t.info("Dry run mode - README not written"),t.info(`Generated README content:
45
- ${p}`)):(await j(e,g,p),t.info(`README generated successfully at ${g}`))},name:"readme",options:[{description:"Include aliases in command list",name:"aliases",type:Boolean},{description:"Show what would be generated without writing files",name:"dry-run",type:Boolean},{description:"Generate multi-file documentation by command groups",name:"multi",type:Boolean},{description:"Maximum depth for nested topics when using multi-file mode",name:"nested-topics-depth",type:Number},{description:"Output directory for multi-file documentation",name:"output-dir",type:String,typeLabel:"{underline directory}"},{description:"Path to README file to generate",name:"readme-path",type:String,typeLabel:"{underline path}"},{description:"Repository prefix for code links",name:"repository-prefix",type:String,typeLabel:"{underline prefix}"},{description:"Version to use in generated documentation",name:"version",type:String,typeLabel:"{underline version}"}]};export{ee as default};
43
+ `;const D=s.outputDir??"docs",_=s.version??p??"unknown";l=w(l,"usage",z(o,i,_,d)),l=w(l,"commands",s.multi?await H(e,a.cwd,g,D,o,s,m):R(g,o,s,m)),l=w(l,"toc",J(l,m)),l=`${l.trimEnd()}
44
+ `,s.dryRun?(n.info("Dry run mode - README not written"),n.info(`Generated README content:
45
+ ${l}`)):(await j(e,$,l),n.info(`README generated successfully at ${$}`))},name:"readme",options:[{description:"Include aliases in command list",name:"aliases",type:Boolean},{description:"Show what would be generated without writing files",name:"dry-run",type:Boolean},{description:"Generate multi-file documentation by command groups",name:"multi",type:Boolean},{description:"Maximum depth for nested topics when using multi-file mode",name:"nested-topics-depth",type:Number},{description:"Output directory for multi-file documentation",name:"output-dir",type:String,typeLabel:"{underline directory}"},{description:"Path to README file to generate",name:"readme-path",type:String,typeLabel:"{underline path}"},{description:"Repository prefix for code links",name:"repository-prefix",type:String,typeLabel:"{underline prefix}"},{description:"Version to use in generated documentation",name:"version",type:String,typeLabel:"{underline version}"}]};export{Y as default};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{Cli as e}from"./packem_shared/Cerebro-BsroI2VY.js";import{VERBOSITY_DEBUG as B,VERBOSITY_NORMAL as O,VERBOSITY_QUIET as R,VERBOSITY_VERBOSE as V}from"./packem_shared/VERBOSITY_DEBUG-XPultrIA.js";import{lazyNamed as I}from"./packem_shared/lazyNamed-DMUm8mZe.js";import"./packem_shared/renderError-Dqej8k13-BmipVhik.js";import{h as T}from"./packem_shared/VisulimaError-DTMgXonA-CzaryRgZ.js";const t=(r,o)=>new e(r,o);export{e as Cerebro,B as VERBOSITY_DEBUG,O as VERBOSITY_NORMAL,R as VERBOSITY_QUIET,V as VERBOSITY_VERBOSE,T as VisulimaError,t as createCerebro,I as lazyNamed};
1
+ import{Cli as e}from"./packem_shared/Cerebro-DgpeCeXr.js";import{VERBOSITY_DEBUG as B,VERBOSITY_NORMAL as O,VERBOSITY_QUIET as R,VERBOSITY_VERBOSE as V}from"./packem_shared/VERBOSITY_DEBUG-XPultrIA.js";import{lazyNamed as I}from"./packem_shared/lazyNamed-DMUm8mZe.js";import"./packem_shared/renderError-Dqej8k13-BmipVhik.js";import{h as T}from"./packem_shared/VisulimaError-DTMgXonA-CzaryRgZ.js";const t=(r,o)=>new e(r,o);export{e as Cerebro,B as VERBOSITY_DEBUG,O as VERBOSITY_NORMAL,R as VERBOSITY_QUIET,V as VERBOSITY_VERBOSE,T as VisulimaError,t as createCerebro,I as lazyNamed};
@@ -1,4 +1,4 @@
1
- import{createRequire as Te}from"node:module";import{VERBOSITY_DEBUG as T,POSITIONALS_KEY as Q,VERBOSITY_NORMAL as te,VERBOSITY_QUIET as Ge,VERBOSITY_VERBOSE as He}from"./VERBOSITY_DEBUG-XPultrIA.js";import{t as w}from"./cerebro-error-z8DS5U8c.js";import{c as X,d as se,o as ce,e as F,a as Ye,b as Je,f as Ke,h as Ze,i as Qe}from"./runtime-process-Dmz0vCJy.js";import"./renderError-Dqej8k13-BmipVhik.js";import{h as H}from"./VisulimaError-DTMgXonA-CzaryRgZ.js";import{distance as Xe}from"fastest-levenshtein";import{k as et,A as tt}from"./split-by-case-C-dbSFCl.js";const je=Te(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ue=t=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[e,n]=W.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return W.getBuiltinModule(t)}return je(t)},{writeFile:Be,stat:ze,rm:Re,readFile:le,readdir:Fe,mkdir:qe,access:We}=Ue("node:fs/promises"),J=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];let U=class extends w{commandName;constructor(e,n=[]){const o=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(o,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}},xe=class extends w{option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}},nt=class extends w{unknownOptions;constructor(e,n){const o=e.join(", "),s=`Found unknown ${e.length===1?"option":"options"}: ${o}`;super(s,"UNKNOWN_OPTION",{suggestions:n,unknownOptions:e}),this.name="UnknownOptionError",this.unknownOptions=e,n&&n.length>0&&(this.hint=`Did you mean: ${n.join(", ")}?`)}},ot=class extends w{pluginName;constructor(e,n,o){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:o,pluginName:e}),this.name="PluginError",this.pluginName=e,o&&(this.cause=o)}},it=class{logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);X().CEREBRO_OUTPUT_LEVEL===String(T)&&this.logger.debug(`registering plugin: ${e.name}`),this.plugins.set(e.name,e),this.cachedDependencyOrder=void 0}async init(e){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const n=this.getDependencyOrder();this.logger.debug(`initializing ${String(n.length)} plugin(s)...`);for(const o of n)if(typeof o.init=="function"){this.logger.debug(`initializing plugin: ${o.name}`);try{await o.init(e)}catch(s){const i=new ot(o.name,`Failed to initialize: ${s instanceof Error?s.message:String(s)}`,s instanceof Error?s:void 0);throw this.logger.error(i.message),i}}this.initialized=!0}async executeLifecycle(e,n,o){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const s=this.getDependencyOrder();for(const i of s){const l=i[e];if(typeof l=="function"){this.logger.debug(`executing ${e} hook for plugin: ${i.name}`);try{await(e==="afterCommand"?l(n,o):l(n))}catch(a){throw this.logger.error(`Error in ${e} hook for plugin "${i.name}":`,a),a}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const o=this.getDependencyOrder();for(const s of o)if(typeof s.onError=="function"){this.logger.debug(`executing error handler for plugin: ${s.name}`);try{await s.onError(e,n)}catch(i){this.logger.error(`Error in error handler for plugin "${s.name}":`,i)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,o=new Set,s=i=>{if(n.has(i))return;if(o.has(i))throw new Error(`Circular dependency detected involving plugin "${i}"`);const l=this.plugins.get(i);if(!l)throw new Error(`Plugin "${i}" not found`);if(o.add(i),l.dependencies)for(const a of l.dependencies)s(a);o.delete(i),n.add(i),e.push(l)};for(const i of this.plugins.keys())s(i);return this.cachedDependencyOrder=e,e}validateDependencies(){for(const e of this.plugins.values())if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin "${e.name}" depends on "${n}" which is not registered`)}}};const G=t=>t.type?.name==="Boolean",st=t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},de=t=>(G(t)||(t.typeLabel=t.typeLabel??st(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),at=new RegExp(/^-([^\d-])$/),rt=new RegExp(/^--(\S+)/),lt=new RegExp(/^-([^\d-]{2,})$/),ct=t=>at.test(t)||rt.test(t)||lt.test(t),dt=(t,e)=>{const n=e[0]&&ct(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const o=new Error(`Command not recognised: ${String(n)}`);throw o.command=n,o.name="INVALID_COMMAND",o}return{argv:e,command:n}};class re extends H{optionName;value;constructor(e,n,o){super({hint:`Pass a valid ${o} value for '${e}'.`,message:`Invalid ${o} value '${n}' for option '${e}'`,name:"INVALID_VALUE",title:"Invalid Value"}),this.optionName=e,this.value=n,Object.setPrototypeOf(this,re.prototype)}}let ut=class Ie extends H{optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,Ie.prototype)}},ue=class ke extends H{optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,ke.prototype)}},mt=class Ee extends H{value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,Ee.prototype)}};class x extends H{constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,x.prototype)}}const me=(t,e,n)=>{const o=Number(t);if(e&&Number.isNaN(o)&&String(t).trim().toLowerCase()!=="nan")throw new re(n??"",String(t),"Number");return o},he=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",pe=t=>t===Number||typeof t=="function"&&t.name==="Number",fe=t=>t===String||typeof t=="function"&&t.name==="String",ht=(t,e,n={})=>{const{optionName:o,strictTypes:s}=n;return Array.isArray(t)?he(e)?t.map(Boolean):pe(e)?t.map(i=>me(i,s,o)):fe(e)?t.map(String):t.map(i=>e(String(i))):t===null?null:he(e)?!!t:pe(e)?me(t,s,o):fe(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t))},b=(t,e,n,...o)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...o)},pt=/-([a-z])/g,ft=/^\d+$/,K=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",gt=t=>t.codePointAt(0)===95,ge=(t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],we=t=>t==="__proto__"||t==="constructor"||t==="prototype",ye=(t,e,n,o=!1)=>{t[e]===void 0?t[e]=o?[n]:n:o&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},ve=(t,e,n,o,s)=>{let i=e.get(t)??n.get(t);if(!i&&o){const l=t.toLowerCase();i=o.get(l)??s?.get(l)}return i},wt=(t,e,n,o)=>{const s=n.debug??!1;b(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),b(s,"Starting argument resolution","resolver"),b(s,"Tokens:","resolver",t),b(s,"Definitions:","resolver",e),b(s,"Processing tokens...","resolver");const i=new Map,l=new Map,a=n.caseInsensitive?new Map:void 0,d=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,m=n.camelCase?new Map:void 0;for(const c of e)if(i.set(c.name,c),c.alias&&l.set(c.alias,c),n.caseInsensitive&&a&&(a.set(c.name.toLowerCase(),c),c.alias&&d&&d.set(c.alias.toLowerCase(),c)),n.camelCase&&r&&m){const u=c.name.replaceAll(pt,(p,C)=>C.toUpperCase());r.set(c.name,u),m.set(u,c.name)}const h=Object.create(null),f=Object.create(null),y=[],E=[],A=new Set;let I=!1;const O=e.find(c=>c.defaultOption),v=e.some(c=>c.group),$=e.find(c=>c.type===Number);for(let c=0;c<t.length;c++){const u=t[c];if(u.kind==="option-terminator"){h._unknown=o.slice(u.index),I=!0;break}if(u.kind==="option"&&u.name){let p=ve(u.name,i,l,a,d);!p&&u.value===void 0&&$&&ft.test(u.name)&&(p=$,u.value=u.name,u.name=$.name);let C=!1;if(!p&&n.negation&&u.value===void 0&&u.name.startsWith("no-")){const N=u.name.slice(3),P=ve(N,i,l,a,d);P?.type&&K(P.type)&&(p=P,C=!0)}const g=p?p.name:u.name,k=p?.multiple,D=p?.lazyMultiple;if(Object.hasOwn(f,g)&&f[g]!==void 0&&!k&&!D&&!n.partial)throw new ut(g);if(!p&&n.partial){const N=u.rawName??`--${u.name}${u.value!==void 0&&u.inlineValue?`=${u.value}`:""}`;y.push({index:u.index,value:N});continue}if(!p&&n.stopAtFirstUnknown){h._unknown=o.slice(u.index);break}if(!p&&!n.partial)throw new ue(u.name);if(u.value===void 0){const N=t[c+1],P=N?.kind==="option"&&!("name"in N)&&N.value!==void 0,M=N&&p&&!(p.type&&K(p.type))&&(N.kind==="positional"||P),Se=p&&p.defaultOption&&!p.multiple&&!p.lazyMultiple;if(M&&(!p?.defaultOption||Se))if(k){let S=c+1;const ee=[];for(;S<t.length&&(t[S].kind==="positional"||t[S].kind==="option"&&!("name"in t[S])&&t[S].value!==void 0);)ee.push(t[S].value),A.add(t[S].index),S++;f[g]=f[g]===void 0?ee:ge(f[g],ee),c=S-1}else D?(ye(f,g,N.value,!0),A.add(N.index),c++):(f[g]=N.value,A.add(N.index),c++);else p?.type&&K(p.type)?ye(f,g,!C,k):f[g]=k?[]:null}else{let{value:N}=u;if(p?.type&&K(p.type))switch(N){case"":{if(n.partial){f._unknown??=[];const M=`${u.rawName??`--${u.name}`}${u.value?`=${u.value}`:""}`;f._unknown.push(M),E.push({index:u.index,value:M}),N=!0}else throw new ue(u.name);break}case"false":{N=!1;break}case"true":{N=!0;break}default:N=!0}const P=[N];if(k){let M=c+1;for(;M<t.length&&t[M].kind==="positional";)P.push(t[M].value),A.add(t[M].index),M++;c=M-1}f[g]===void 0?f[g]=k||D?P:N:k||D?f[g]=ge(f[g],P):f[g]=N}}else if(u.kind==="positional"&&n.stopAtFirstUnknown&&!A.has(u.index)&&!O){b(s,`Found unconsumed positional token at index ${String(u.index)}, stopping processing`,"resolver"),h._unknown=o.slice(u.index);break}}for(const[c,u]of Object.entries(f)){const p=i.get(c);p&&(p.multiple||p.lazyMultiple)&&!Array.isArray(u)&&(f[c]=[u])}const _=c=>c.kind==="option"&&!i.has(c.name??"")&&!l.has(c.name??"")&&(!n.caseInsensitive||!a?.has(c.name?.toLowerCase()??"")&&!d?.has(c.name?.toLowerCase()??""));let L=-1,V=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!I&&(L=t.findIndex(c=>_(c)),L!==-1&&(V=t[L].index)),O){const c=[],u=[];for(const p of t)p.kind==="positional"&&!A.has(p.index)&&p.index<V&&(c.push(p.value),u.push(p));if(c.length>0){const p=f[O.name],C=O.multiple??O.lazyMultiple;p===void 0?C?(u.forEach(g=>A.add(g.index)),f[O.name]=c):(A.add(u[0].index),f[O.name]=c[0]):C&&(u.forEach(g=>A.add(g.index)),f[O.name]=Array.isArray(p)?[...c,...p]:[...c,p])}}if(!n.partial){for(const c of t)if(c.kind==="positional"&&!A.has(c.index))throw new mt(o[c.index])}if(n.partial&&!n.stopAtFirstUnknown){const c=[...y];if(f._unknown)for(const u of E)c.push({index:u.index,value:u.value});for(const u of t)u.kind==="positional"&&!A.has(u.index)&&c.push({index:u.index,value:o[u.index]});c.length>0&&(c.sort((u,p)=>u.index-p.index),h._unknown=c.map(u=>u.value))}if(n.stopAtFirstUnknown&&!I){const c=t.findIndex(p=>p.kind==="positional"&&!A.has(p.index));let u=-1;if(L!==-1&&c!==-1?u=Math.min(L,c):L!==-1?u=L:c!==-1&&(u=c),u>=0){const p=t[u].index;h._unknown=o.slice(p)}}else y.length>0&&!n.partial&&(h._unknown=y.map(c=>c.value));for(const[c,u]of Object.entries(f)){const p=n.camelCase?r?.get(c)??c:c,C=i.get(c);C?.type?h[p]=ht(u,C.type,{optionName:C.name,strictTypes:n.strictTypes}):h[p]=u===void 0?null:u}for(const c of e){const u=n.camelCase?r?.get(c.name)??c.name:c.name;!(u in h)&&c.defaultValue!==void 0&&(c.multiple??c.lazyMultiple?h[u]=Array.isArray(c.defaultValue)?[...c.defaultValue]:[c.defaultValue]:h[u]=c.defaultValue)}if(v){const c={},u={},p={};for(const g of e)if(g.group){const k=Array.isArray(g.group)?g.group:[g.group];for(const D of k)we(D)||(c[D]??={})}for(const g of Object.keys(h))if(!gt(g)){u[g]=h[g];let k=g;n.camelCase&&(k=m?.get(g)??g);const D=i.get(k);if(D?.group){const N=Array.isArray(D.group)?D.group:[D.group];for(const P of N)we(P)||c[P]&&(c[P][g]=h[g])}else p[g]=h[g]}const C={_all:u};for(const[g,k]of Object.entries(c))C[g]=k;Object.keys(p).length>0&&(C._none=p),h._unknown&&(C._unknown=h._unknown),Object.keys(h).forEach(g=>delete h[g]),Object.assign(h,C)}const Y=Object.defineProperties({},Object.getOwnPropertyDescriptors(h));return b(s,"Final parsed result:","resolver",Y),Y},q="-".codePointAt(0),z="=",yt=z.codePointAt(0),vt="--",Nt="-",$t="--",Pe=t=>t.length>2&&t.startsWith($t),bt=t=>Pe(t)&&!t.includes(z,3),At=t=>Pe(t)&&t.includes(z,3),Ot=t=>{if(t.length!==2||t.codePointAt(0)!==q||t.codePointAt(1)===q)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},_t=t=>!(t.length<=2||t.codePointAt(0)!==q||t.codePointAt(1)===q),Ct=t=>{const e=[];let n=0,o=[],s=0,i=-1,l=0;for(;s<o.length||n<t.length;){let a;if(s<o.length?(a=o[s],s++):(a=t[n],n++),l>0?l--:i++,a===vt){e.push({index:i,kind:"option-terminator"});const d=[...o.slice(s),...t.slice(n)],r=d.map((m,h)=>({index:i+h+1,kind:"positional",value:m}));e.push(...r),i+=d.length;break}if(Ot(a)){const d=a.charAt(1);e.push({index:i,kind:"option",name:d,rawName:a});continue}if(_t(a)&&!a.includes(z)){const d=[];let r="",m=!1;for(let h=1;h<a.length;h++){const f=a.charAt(h);m?r+=f:f.codePointAt(0)===yt?m=!0:d.push(`${Nt}${f}`)}if(m)if(d.length>0){const h=d.pop();d.push(`${h}=${r}`)}else d.push(r);o=s<o.length?[...d,...o.slice(s)]:d,s=0,l=d.length;continue}if(bt(a)){const d=a.slice(2);e.push({index:i,kind:"option",name:d,rawName:a});continue}if(At(a)){const d=a.indexOf(z),r=a.slice(2,d),m=a.slice(d+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:a,value:m});continue}if(a.length>2&&a.codePointAt(0)===q&&a.codePointAt(1)!==q&&a.includes(z)){const d=a.indexOf(z),r=a.charAt(1),m=a.slice(d+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:a,value:m});continue}e.push({index:i,kind:"positional",value:a})}return e},xt=/\d/,It=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",kt=t=>typeof t=="function",Et=(t,e,n)=>{const o=n?.debug??!1;b(o,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,i=new Set,l=new Set,a=new Set;let d=0;for(const r of t){if(b(o,"Checking definition:","validation",r),!r.name)throw b(o,"Validation failed: name is required","validation"),new x("Invalid option definition: name is required");if(typeof r.name!="string")throw new x("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new x("Invalid option definition: name cannot be empty");const m=e?r.name.toLowerCase():"";if(s.has(r.name)||e&&l.has(m))throw new x(`Invalid option definition: duplicate name '${r.name}'`);if(i.has(r.name)||e&&a.has(m))throw new x(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(s.add(r.name),e&&l.add(m),r.alias!==void 0){if(typeof r.alias!="string")throw new x("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new x("Invalid option definition: alias must be a single character");if(xt.test(r.alias))throw new x("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new x('Invalid option definition: alias cannot be "-"');const h=e?r.alias.toLowerCase():"";if(i.has(r.alias)||e&&a.has(h))throw new x(`Invalid option definition: duplicate alias '${r.alias}'`);if(s.has(r.alias)||e&&l.has(h))throw new x(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);i.add(r.alias),e&&a.add(h)}if(r.defaultOption&&(d++,r.type!==void 0&&It(r.type)))throw new x("Invalid option definition: defaultOption cannot be Boolean type");if(r.type!==void 0&&!(r.type===Boolean||r.type===Number||r.type===String||typeof r.type=="function"&&kt(r.type)))throw new x("Invalid option definition: invalid type")}if(d>1)throw b(o,"Validation failed: multiple defaultOptions not allowed","validation"),new x("Invalid option definition: multiple defaultOptions not allowed");b(o,"Validation completed successfully","validation")};function Pt(t,e={}){const n=e.debug??!1;b(n,"Starting command-line-args parsing","index"),b(n,"Options:","index",e);const o={...e};o.stopAtFirstUnknown&&(o.partial=!0);const s=Array.isArray(t)?t:[t];b(n,"Normalized definitions:","index",s),Et(s,o.caseInsensitive,n?o:void 0);let{argv:i}=o;if(!i&&(i=process.argv.slice(2),process.execArgv.length>0)){const r=new Set(process.execArgv);i=i.filter(m=>!r.has(m))}b(n,"Using argv:","index",i);let l=i;o.caseInsensitive&&(l=i.map(r=>{if(r.startsWith("--")){const m=r.indexOf("="),h=(m===-1?r.slice(2):r.slice(2,m)).toLowerCase();return m===-1?`--${h}`:`--${h}${r.slice(m)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const m=r.slice(1).split("=",2),h=m[0],f=m[1];if(!h)return r;const y=h.toLowerCase();return f===void 0?`-${y}`:`-${y}=${f}`}return r}));const a=Ct(l.map(String));b(n,"Tokenized arguments:","index",a);const d=wt(a,s,o,i);return b(n,"Command-line-args parsing completed","index"),d}class Lt{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let ne=class extends w{commandName;constructor(e,n,o){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",o!==void 0&&(this.cause=o)}};const Dt=/^-{1,2}(\w+)(=(.+))?$/,Le=(t,e,n,o)=>{const s=Dt.exec(t);if(s===null)return{};const i=s[1];if(!i)return{};const l=n&&o?n.get(i)??o.get(i):e.find(a=>a.name===i||a.alias===i);return l!==void 0?{argName:l.name,argValue:s[3],option:l}:{}},Ne=(t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},Mt=new Set(["0","1","false","true"]),Vt=(t,e,n,o)=>{if(e.length===0||t.length===0)return{};const s=(i,l)=>{const{argName:a,argValue:d,option:r}=Le(l,e,n,o),{lastOption:m}=i;return r&&G(r)&&d&&a?i.partial[a]=Ne(d,r):i.lastName&&m&&G(m)&&Mt.has(l)&&(i.partial[i.lastName]=Ne(l,m)),{lastName:a,lastOption:r,partial:i.partial}};return t.reduce(s,{partial:{}}).partial},St=new Set(["0","1","false","true"]),Tt=(t,e,n,o)=>{if(e.length===0||t.length===0)return t;const s=(i,l)=>{const{argValue:a,option:d}=Le(l,e,n,o),{lastOption:r}=i;if(r&&G(r)&&St.has(l)){const{args:m}=i;return{args:m.slice(0,-1)}}return d&&G(d)&&a?{args:i.args}:{args:[...i.args,l],lastOption:d}};return t.reduce(s,{args:[]}).args},$e=t=>{const e=new Map;for(const n of t){const o=e.get(n.name);o?e.set(n.name,{...o,...n}):e.set(n.name,n)}return[...e.values()]},jt=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},Ut=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return jt(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},Bt=/_./g,zt=/^[A-Z]/,Rt=t=>t.toLowerCase().replaceAll(Bt,e=>e[1]?.toUpperCase()??e).replace(zt,e=>e.toLowerCase()),Ft=t=>{if(!t||t.length===0)return{};const e={},n=X();for(const o of t){const s=n[o.name],i=Ut(o,s),l=i===void 0?o.defaultValue:i,a=Rt(o.name);e[a]=l}return e},qt=t=>{const e=new Map,n=new Map;for(const o of t)if(e.set(o.name,o),o.alias){const s=Array.isArray(o.alias)?o.alias:[o.alias];for(const i of s)n.set(i,o)}return{optionMapByAlias:n,optionMapByName:e}},De=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new ne(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(o){throw new ne(t.name,o instanceof Error?o.message:String(o),o)}const n=e.default;if(typeof n!="function")throw new ne(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},Wt=(t,e,n,o)=>{const s=new Lt(t.name,t),{_all:i,_unknown:l,positionals:a}=e,d=Object.keys(n).length>0?{...i,...n}:i;Q in d&&delete d[Q],s.argument=a?.[Q]??[],s.rawUnknown=[...l??[]];const r=Object.keys(o).length>0;return s.options=r?{...d,...o}:d,s.env=Ft(t.env),s},Gt=(t,e,n)=>{const o=t.options??[],s=o.length>0;let i=$e(s?[...o,...n]:n);if(i.length>0){for(const r of i)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(i=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:Q,type:t.argument.type,typeLabel:t.argument.typeLabel},...i]);let l,a;if(s){const{optionMapByAlias:r,optionMapByName:m}=qt(o);l=Tt(e,o,m,r),a=Vt(e,o,m,r)}else l=e,a={};const d=Pt(i,{argv:l,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:i,booleanValues:a,parsedArgs:d}},R=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await De(t))(e);let Ht=class extends w{commandName;missingOptions;constructor(e,n){super(`Command "${e}" is missing required options: ${n.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:e,missingOptions:n}),this.name="CommandValidationError",this.commandName=e,this.missingOptions=n,this.hint=`Provide the following required options: ${n.join(", ")}`}},Yt=class extends w{choices;option;value;constructor(e,n,o){super(`Invalid value "${n}" for option "${e}". Allowed values: ${o.join(", ")}`,"INVALID_CHOICE",{choices:o,option:e,value:n}),this.name="InvalidChoiceError",this.option=e,this.value=n,this.choices=o,this.hint=`Use one of: ${o.map(s=>`--${e} ${s}`).join(", ")}`}};const be=(t,e,n=!1)=>{const o=[];for(const s of t)if(!(!n&&!s.required)&&e[s.name]===void 0){if(s.type?.name==="Boolean"){e[s.name]=!1;continue}o.push(s)}return o},Jt=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Xe(t,e)<=t.length/3,j=(t,e)=>{const n=t.toLowerCase();return e.filter(o=>Jt(o.toLowerCase(),n))},Kt=(t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(o=>{const s=o.startsWith("--");let i=`Found unknown ${s?"option":"argument"} "${o}"`;if(s){const l=j(o.replace("--",""),(e.options??[]).map(a=>a.name));if(l.length>0){const[a,...d]=l.map(r=>`--${r}`);i+=d.length>0?`, did you mean ${a??""} or ${d.join(", ")}?`:`, did you mean ${a??""}?`}}n.push(i)}),n.length>0)throw new Error(n.join(`
1
+ import{createRequire as Te}from"node:module";import{VERBOSITY_DEBUG as T,POSITIONALS_KEY as Q,VERBOSITY_NORMAL as te,VERBOSITY_QUIET as Ge,VERBOSITY_VERBOSE as He}from"./VERBOSITY_DEBUG-XPultrIA.js";import{t as w}from"./cerebro-error-z8DS5U8c.js";import{c as X,d as se,o as ce,e as F,a as Ye,b as Je,f as Ke,h as Ze,i as Qe}from"./runtime-process-Dmz0vCJy.js";import"./renderError-Dqej8k13-BmipVhik.js";import{h as H}from"./VisulimaError-DTMgXonA-CzaryRgZ.js";import{distance as Xe}from"fastest-levenshtein";import{k as et,A as tt}from"./split-by-case-Dbpgd7rf.js";const je=Te(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ue=t=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[e,n]=W.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return W.getBuiltinModule(t)}return je(t)},{writeFile:Be,stat:ze,rm:Re,readFile:le,readdir:Fe,mkdir:qe,access:We}=Ue("node:fs/promises"),J=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];let U=class extends w{commandName;constructor(e,n=[]){const o=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(o,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}},xe=class extends w{option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}},nt=class extends w{unknownOptions;constructor(e,n){const o=e.join(", "),s=`Found unknown ${e.length===1?"option":"options"}: ${o}`;super(s,"UNKNOWN_OPTION",{suggestions:n,unknownOptions:e}),this.name="UnknownOptionError",this.unknownOptions=e,n&&n.length>0&&(this.hint=`Did you mean: ${n.join(", ")}?`)}},ot=class extends w{pluginName;constructor(e,n,o){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:o,pluginName:e}),this.name="PluginError",this.pluginName=e,o&&(this.cause=o)}},it=class{logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);X().CEREBRO_OUTPUT_LEVEL===String(T)&&this.logger.debug(`registering plugin: ${e.name}`),this.plugins.set(e.name,e),this.cachedDependencyOrder=void 0}async init(e){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const n=this.getDependencyOrder();this.logger.debug(`initializing ${String(n.length)} plugin(s)...`);for(const o of n)if(typeof o.init=="function"){this.logger.debug(`initializing plugin: ${o.name}`);try{await o.init(e)}catch(s){const i=new ot(o.name,`Failed to initialize: ${s instanceof Error?s.message:String(s)}`,s instanceof Error?s:void 0);throw this.logger.error(i.message),i}}this.initialized=!0}async executeLifecycle(e,n,o){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const s=this.getDependencyOrder();for(const i of s){const l=i[e];if(typeof l=="function"){this.logger.debug(`executing ${e} hook for plugin: ${i.name}`);try{await(e==="afterCommand"?l(n,o):l(n))}catch(a){throw this.logger.error(`Error in ${e} hook for plugin "${i.name}":`,a),a}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const o=this.getDependencyOrder();for(const s of o)if(typeof s.onError=="function"){this.logger.debug(`executing error handler for plugin: ${s.name}`);try{await s.onError(e,n)}catch(i){this.logger.error(`Error in error handler for plugin "${s.name}":`,i)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,o=new Set,s=i=>{if(n.has(i))return;if(o.has(i))throw new Error(`Circular dependency detected involving plugin "${i}"`);const l=this.plugins.get(i);if(!l)throw new Error(`Plugin "${i}" not found`);if(o.add(i),l.dependencies)for(const a of l.dependencies)s(a);o.delete(i),n.add(i),e.push(l)};for(const i of this.plugins.keys())s(i);return this.cachedDependencyOrder=e,e}validateDependencies(){for(const e of this.plugins.values())if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin "${e.name}" depends on "${n}" which is not registered`)}}};const G=t=>t.type?.name==="Boolean",st=t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},de=t=>(G(t)||(t.typeLabel=t.typeLabel??st(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),at=new RegExp(/^-([^\d-])$/),rt=new RegExp(/^--(\S+)/),lt=new RegExp(/^-([^\d-]{2,})$/),ct=t=>at.test(t)||rt.test(t)||lt.test(t),dt=(t,e)=>{const n=e[0]&&ct(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const o=new Error(`Command not recognised: ${String(n)}`);throw o.command=n,o.name="INVALID_COMMAND",o}return{argv:e,command:n}};class re extends H{optionName;value;constructor(e,n,o){super({hint:`Pass a valid ${o} value for '${e}'.`,message:`Invalid ${o} value '${n}' for option '${e}'`,name:"INVALID_VALUE",title:"Invalid Value"}),this.optionName=e,this.value=n,Object.setPrototypeOf(this,re.prototype)}}let ut=class Ie extends H{optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,Ie.prototype)}},ue=class ke extends H{optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,ke.prototype)}},mt=class Ee extends H{value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,Ee.prototype)}};class x extends H{constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,x.prototype)}}const me=(t,e,n)=>{const o=Number(t);if(e&&Number.isNaN(o)&&String(t).trim().toLowerCase()!=="nan")throw new re(n??"",String(t),"Number");return o},he=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",pe=t=>t===Number||typeof t=="function"&&t.name==="Number",fe=t=>t===String||typeof t=="function"&&t.name==="String",ht=(t,e,n={})=>{const{optionName:o,strictTypes:s}=n;return Array.isArray(t)?he(e)?t.map(Boolean):pe(e)?t.map(i=>me(i,s,o)):fe(e)?t.map(String):t.map(i=>e(String(i))):t===null?null:he(e)?!!t:pe(e)?me(t,s,o):fe(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t))},b=(t,e,n,...o)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...o)},pt=/-([a-z])/g,ft=/^\d+$/,K=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",gt=t=>t.codePointAt(0)===95,ge=(t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],we=t=>t==="__proto__"||t==="constructor"||t==="prototype",ye=(t,e,n,o=!1)=>{t[e]===void 0?t[e]=o?[n]:n:o&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},ve=(t,e,n,o,s)=>{let i=e.get(t)??n.get(t);if(!i&&o){const l=t.toLowerCase();i=o.get(l)??s?.get(l)}return i},wt=(t,e,n,o)=>{const s=n.debug??!1;b(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),b(s,"Starting argument resolution","resolver"),b(s,"Tokens:","resolver",t),b(s,"Definitions:","resolver",e),b(s,"Processing tokens...","resolver");const i=new Map,l=new Map,a=n.caseInsensitive?new Map:void 0,d=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,m=n.camelCase?new Map:void 0;for(const c of e)if(i.set(c.name,c),c.alias&&l.set(c.alias,c),n.caseInsensitive&&a&&(a.set(c.name.toLowerCase(),c),c.alias&&d&&d.set(c.alias.toLowerCase(),c)),n.camelCase&&r&&m){const u=c.name.replaceAll(pt,(p,C)=>C.toUpperCase());r.set(c.name,u),m.set(u,c.name)}const h=Object.create(null),f=Object.create(null),y=[],E=[],A=new Set;let I=!1;const O=e.find(c=>c.defaultOption),v=e.some(c=>c.group),$=e.find(c=>c.type===Number);for(let c=0;c<t.length;c++){const u=t[c];if(u.kind==="option-terminator"){h._unknown=o.slice(u.index),I=!0;break}if(u.kind==="option"&&u.name){let p=ve(u.name,i,l,a,d);!p&&u.value===void 0&&$&&ft.test(u.name)&&(p=$,u.value=u.name,u.name=$.name);let C=!1;if(!p&&n.negation&&u.value===void 0&&u.name.startsWith("no-")){const N=u.name.slice(3),P=ve(N,i,l,a,d);P?.type&&K(P.type)&&(p=P,C=!0)}const g=p?p.name:u.name,k=p?.multiple,D=p?.lazyMultiple;if(Object.hasOwn(f,g)&&f[g]!==void 0&&!k&&!D&&!n.partial)throw new ut(g);if(!p&&n.partial){const N=u.rawName??`--${u.name}${u.value!==void 0&&u.inlineValue?`=${u.value}`:""}`;y.push({index:u.index,value:N});continue}if(!p&&n.stopAtFirstUnknown){h._unknown=o.slice(u.index);break}if(!p&&!n.partial)throw new ue(u.name);if(u.value===void 0){const N=t[c+1],P=N?.kind==="option"&&!("name"in N)&&N.value!==void 0,M=N&&p&&!(p.type&&K(p.type))&&(N.kind==="positional"||P),Se=p&&p.defaultOption&&!p.multiple&&!p.lazyMultiple;if(M&&(!p?.defaultOption||Se))if(k){let S=c+1;const ee=[];for(;S<t.length&&(t[S].kind==="positional"||t[S].kind==="option"&&!("name"in t[S])&&t[S].value!==void 0);)ee.push(t[S].value),A.add(t[S].index),S++;f[g]=f[g]===void 0?ee:ge(f[g],ee),c=S-1}else D?(ye(f,g,N.value,!0),A.add(N.index),c++):(f[g]=N.value,A.add(N.index),c++);else p?.type&&K(p.type)?ye(f,g,!C,k):f[g]=k?[]:null}else{let{value:N}=u;if(p?.type&&K(p.type))switch(N){case"":{if(n.partial){f._unknown??=[];const M=`${u.rawName??`--${u.name}`}${u.value?`=${u.value}`:""}`;f._unknown.push(M),E.push({index:u.index,value:M}),N=!0}else throw new ue(u.name);break}case"false":{N=!1;break}case"true":{N=!0;break}default:N=!0}const P=[N];if(k){let M=c+1;for(;M<t.length&&t[M].kind==="positional";)P.push(t[M].value),A.add(t[M].index),M++;c=M-1}f[g]===void 0?f[g]=k||D?P:N:k||D?f[g]=ge(f[g],P):f[g]=N}}else if(u.kind==="positional"&&n.stopAtFirstUnknown&&!A.has(u.index)&&!O){b(s,`Found unconsumed positional token at index ${String(u.index)}, stopping processing`,"resolver"),h._unknown=o.slice(u.index);break}}for(const[c,u]of Object.entries(f)){const p=i.get(c);p&&(p.multiple||p.lazyMultiple)&&!Array.isArray(u)&&(f[c]=[u])}const _=c=>c.kind==="option"&&!i.has(c.name??"")&&!l.has(c.name??"")&&(!n.caseInsensitive||!a?.has(c.name?.toLowerCase()??"")&&!d?.has(c.name?.toLowerCase()??""));let L=-1,V=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!I&&(L=t.findIndex(c=>_(c)),L!==-1&&(V=t[L].index)),O){const c=[],u=[];for(const p of t)p.kind==="positional"&&!A.has(p.index)&&p.index<V&&(c.push(p.value),u.push(p));if(c.length>0){const p=f[O.name],C=O.multiple??O.lazyMultiple;p===void 0?C?(u.forEach(g=>A.add(g.index)),f[O.name]=c):(A.add(u[0].index),f[O.name]=c[0]):C&&(u.forEach(g=>A.add(g.index)),f[O.name]=Array.isArray(p)?[...c,...p]:[...c,p])}}if(!n.partial){for(const c of t)if(c.kind==="positional"&&!A.has(c.index))throw new mt(o[c.index])}if(n.partial&&!n.stopAtFirstUnknown){const c=[...y];if(f._unknown)for(const u of E)c.push({index:u.index,value:u.value});for(const u of t)u.kind==="positional"&&!A.has(u.index)&&c.push({index:u.index,value:o[u.index]});c.length>0&&(c.sort((u,p)=>u.index-p.index),h._unknown=c.map(u=>u.value))}if(n.stopAtFirstUnknown&&!I){const c=t.findIndex(p=>p.kind==="positional"&&!A.has(p.index));let u=-1;if(L!==-1&&c!==-1?u=Math.min(L,c):L!==-1?u=L:c!==-1&&(u=c),u>=0){const p=t[u].index;h._unknown=o.slice(p)}}else y.length>0&&!n.partial&&(h._unknown=y.map(c=>c.value));for(const[c,u]of Object.entries(f)){const p=n.camelCase?r?.get(c)??c:c,C=i.get(c);C?.type?h[p]=ht(u,C.type,{optionName:C.name,strictTypes:n.strictTypes}):h[p]=u===void 0?null:u}for(const c of e){const u=n.camelCase?r?.get(c.name)??c.name:c.name;!(u in h)&&c.defaultValue!==void 0&&(c.multiple??c.lazyMultiple?h[u]=Array.isArray(c.defaultValue)?[...c.defaultValue]:[c.defaultValue]:h[u]=c.defaultValue)}if(v){const c={},u={},p={};for(const g of e)if(g.group){const k=Array.isArray(g.group)?g.group:[g.group];for(const D of k)we(D)||(c[D]??={})}for(const g of Object.keys(h))if(!gt(g)){u[g]=h[g];let k=g;n.camelCase&&(k=m?.get(g)??g);const D=i.get(k);if(D?.group){const N=Array.isArray(D.group)?D.group:[D.group];for(const P of N)we(P)||c[P]&&(c[P][g]=h[g])}else p[g]=h[g]}const C={_all:u};for(const[g,k]of Object.entries(c))C[g]=k;Object.keys(p).length>0&&(C._none=p),h._unknown&&(C._unknown=h._unknown),Object.keys(h).forEach(g=>delete h[g]),Object.assign(h,C)}const Y=Object.defineProperties({},Object.getOwnPropertyDescriptors(h));return b(s,"Final parsed result:","resolver",Y),Y},q="-".codePointAt(0),z="=",yt=z.codePointAt(0),vt="--",Nt="-",$t="--",Pe=t=>t.length>2&&t.startsWith($t),bt=t=>Pe(t)&&!t.includes(z,3),At=t=>Pe(t)&&t.includes(z,3),Ot=t=>{if(t.length!==2||t.codePointAt(0)!==q||t.codePointAt(1)===q)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},_t=t=>!(t.length<=2||t.codePointAt(0)!==q||t.codePointAt(1)===q),Ct=t=>{const e=[];let n=0,o=[],s=0,i=-1,l=0;for(;s<o.length||n<t.length;){let a;if(s<o.length?(a=o[s],s++):(a=t[n],n++),l>0?l--:i++,a===vt){e.push({index:i,kind:"option-terminator"});const d=[...o.slice(s),...t.slice(n)],r=d.map((m,h)=>({index:i+h+1,kind:"positional",value:m}));e.push(...r),i+=d.length;break}if(Ot(a)){const d=a.charAt(1);e.push({index:i,kind:"option",name:d,rawName:a});continue}if(_t(a)&&!a.includes(z)){const d=[];let r="",m=!1;for(let h=1;h<a.length;h++){const f=a.charAt(h);m?r+=f:f.codePointAt(0)===yt?m=!0:d.push(`${Nt}${f}`)}if(m)if(d.length>0){const h=d.pop();d.push(`${h}=${r}`)}else d.push(r);o=s<o.length?[...d,...o.slice(s)]:d,s=0,l=d.length;continue}if(bt(a)){const d=a.slice(2);e.push({index:i,kind:"option",name:d,rawName:a});continue}if(At(a)){const d=a.indexOf(z),r=a.slice(2,d),m=a.slice(d+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:a,value:m});continue}if(a.length>2&&a.codePointAt(0)===q&&a.codePointAt(1)!==q&&a.includes(z)){const d=a.indexOf(z),r=a.charAt(1),m=a.slice(d+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:a,value:m});continue}e.push({index:i,kind:"positional",value:a})}return e},xt=/\d/,It=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",kt=t=>typeof t=="function",Et=(t,e,n)=>{const o=n?.debug??!1;b(o,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,i=new Set,l=new Set,a=new Set;let d=0;for(const r of t){if(b(o,"Checking definition:","validation",r),!r.name)throw b(o,"Validation failed: name is required","validation"),new x("Invalid option definition: name is required");if(typeof r.name!="string")throw new x("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new x("Invalid option definition: name cannot be empty");const m=e?r.name.toLowerCase():"";if(s.has(r.name)||e&&l.has(m))throw new x(`Invalid option definition: duplicate name '${r.name}'`);if(i.has(r.name)||e&&a.has(m))throw new x(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(s.add(r.name),e&&l.add(m),r.alias!==void 0){if(typeof r.alias!="string")throw new x("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new x("Invalid option definition: alias must be a single character");if(xt.test(r.alias))throw new x("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new x('Invalid option definition: alias cannot be "-"');const h=e?r.alias.toLowerCase():"";if(i.has(r.alias)||e&&a.has(h))throw new x(`Invalid option definition: duplicate alias '${r.alias}'`);if(s.has(r.alias)||e&&l.has(h))throw new x(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);i.add(r.alias),e&&a.add(h)}if(r.defaultOption&&(d++,r.type!==void 0&&It(r.type)))throw new x("Invalid option definition: defaultOption cannot be Boolean type");if(r.type!==void 0&&!(r.type===Boolean||r.type===Number||r.type===String||typeof r.type=="function"&&kt(r.type)))throw new x("Invalid option definition: invalid type")}if(d>1)throw b(o,"Validation failed: multiple defaultOptions not allowed","validation"),new x("Invalid option definition: multiple defaultOptions not allowed");b(o,"Validation completed successfully","validation")};function Pt(t,e={}){const n=e.debug??!1;b(n,"Starting command-line-args parsing","index"),b(n,"Options:","index",e);const o={...e};o.stopAtFirstUnknown&&(o.partial=!0);const s=Array.isArray(t)?t:[t];b(n,"Normalized definitions:","index",s),Et(s,o.caseInsensitive,n?o:void 0);let{argv:i}=o;if(!i&&(i=process.argv.slice(2),process.execArgv.length>0)){const r=new Set(process.execArgv);i=i.filter(m=>!r.has(m))}b(n,"Using argv:","index",i);let l=i;o.caseInsensitive&&(l=i.map(r=>{if(r.startsWith("--")){const m=r.indexOf("="),h=(m===-1?r.slice(2):r.slice(2,m)).toLowerCase();return m===-1?`--${h}`:`--${h}${r.slice(m)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const m=r.slice(1).split("=",2),h=m[0],f=m[1];if(!h)return r;const y=h.toLowerCase();return f===void 0?`-${y}`:`-${y}=${f}`}return r}));const a=Ct(l.map(String));b(n,"Tokenized arguments:","index",a);const d=wt(a,s,o,i);return b(n,"Command-line-args parsing completed","index"),d}class Lt{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let ne=class extends w{commandName;constructor(e,n,o){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",o!==void 0&&(this.cause=o)}};const Dt=/^-{1,2}(\w+)(=(.+))?$/,Le=(t,e,n,o)=>{const s=Dt.exec(t);if(s===null)return{};const i=s[1];if(!i)return{};const l=n&&o?n.get(i)??o.get(i):e.find(a=>a.name===i||a.alias===i);return l!==void 0?{argName:l.name,argValue:s[3],option:l}:{}},Ne=(t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},Mt=new Set(["0","1","false","true"]),Vt=(t,e,n,o)=>{if(e.length===0||t.length===0)return{};const s=(i,l)=>{const{argName:a,argValue:d,option:r}=Le(l,e,n,o),{lastOption:m}=i;return r&&G(r)&&d&&a?i.partial[a]=Ne(d,r):i.lastName&&m&&G(m)&&Mt.has(l)&&(i.partial[i.lastName]=Ne(l,m)),{lastName:a,lastOption:r,partial:i.partial}};return t.reduce(s,{partial:{}}).partial},St=new Set(["0","1","false","true"]),Tt=(t,e,n,o)=>{if(e.length===0||t.length===0)return t;const s=(i,l)=>{const{argValue:a,option:d}=Le(l,e,n,o),{lastOption:r}=i;if(r&&G(r)&&St.has(l)){const{args:m}=i;return{args:m.slice(0,-1)}}return d&&G(d)&&a?{args:i.args}:{args:[...i.args,l],lastOption:d}};return t.reduce(s,{args:[]}).args},$e=t=>{const e=new Map;for(const n of t){const o=e.get(n.name);o?e.set(n.name,{...o,...n}):e.set(n.name,n)}return[...e.values()]},jt=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},Ut=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return jt(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},Bt=/_./g,zt=/^[A-Z]/,Rt=t=>t.toLowerCase().replaceAll(Bt,e=>e[1]?.toUpperCase()??e).replace(zt,e=>e.toLowerCase()),Ft=t=>{if(!t||t.length===0)return{};const e={},n=X();for(const o of t){const s=n[o.name],i=Ut(o,s),l=i===void 0?o.defaultValue:i,a=Rt(o.name);e[a]=l}return e},qt=t=>{const e=new Map,n=new Map;for(const o of t)if(e.set(o.name,o),o.alias){const s=Array.isArray(o.alias)?o.alias:[o.alias];for(const i of s)n.set(i,o)}return{optionMapByAlias:n,optionMapByName:e}},De=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new ne(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(o){throw new ne(t.name,o instanceof Error?o.message:String(o),o)}const n=e.default;if(typeof n!="function")throw new ne(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},Wt=(t,e,n,o)=>{const s=new Lt(t.name,t),{_all:i,_unknown:l,positionals:a}=e,d=Object.keys(n).length>0?{...i,...n}:i;Q in d&&delete d[Q],s.argument=a?.[Q]??[],s.rawUnknown=[...l??[]];const r=Object.keys(o).length>0;return s.options=r?{...d,...o}:d,s.env=Ft(t.env),s},Gt=(t,e,n)=>{const o=t.options??[],s=o.length>0;let i=$e(s?[...o,...n]:n);if(i.length>0){for(const r of i)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(i=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:Q,type:t.argument.type,typeLabel:t.argument.typeLabel},...i]);let l,a;if(s){const{optionMapByAlias:r,optionMapByName:m}=qt(o);l=Tt(e,o,m,r),a=Vt(e,o,m,r)}else l=e,a={};const d=Pt(i,{argv:l,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:i,booleanValues:a,parsedArgs:d}},R=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await De(t))(e);let Ht=class extends w{commandName;missingOptions;constructor(e,n){super(`Command "${e}" is missing required options: ${n.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:e,missingOptions:n}),this.name="CommandValidationError",this.commandName=e,this.missingOptions=n,this.hint=`Provide the following required options: ${n.join(", ")}`}},Yt=class extends w{choices;option;value;constructor(e,n,o){super(`Invalid value "${n}" for option "${e}". Allowed values: ${o.join(", ")}`,"INVALID_CHOICE",{choices:o,option:e,value:n}),this.name="InvalidChoiceError",this.option=e,this.value=n,this.choices=o,this.hint=`Use one of: ${o.map(s=>`--${e} ${s}`).join(", ")}`}};const be=(t,e,n=!1)=>{const o=[];for(const s of t)if(!(!n&&!s.required)&&e[s.name]===void 0){if(s.type?.name==="Boolean"){e[s.name]=!1;continue}o.push(s)}return o},Jt=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Xe(t,e)<=t.length/3,j=(t,e)=>{const n=t.toLowerCase();return e.filter(o=>Jt(o.toLowerCase(),n))},Kt=(t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(o=>{const s=o.startsWith("--");let i=`Found unknown ${s?"option":"argument"} "${o}"`;if(s){const l=j(o.replace("--",""),(e.options??[]).map(a=>a.name));if(l.length>0){const[a,...d]=l.map(r=>`--${r}`);i+=d.length>0?`, did you mean ${a??""} or ${d.join(", ")}?`:`, did you mean ${a??""}?`}}n.push(i)}),n.length>0)throw new Error(n.join(`
2
2
  `))},Zt=(t,e,n)=>{const o=n.__requiredOptions__,s=o?be(o,e,!0):be(t,e,!1);if(s.length>0)throw new Ht(n.name,s.map(i=>i.name));e._unknown&&e._unknown.length>0&&!n.argument&&Kt(e,n)},Qt=(t,e,n)=>{const o=n.__conflictingOptions__??t.filter(s=>s.conflicts!==void 0);if(o.length>0){const s=o.find(i=>Array.isArray(i.conflicts)?i.conflicts.some(l=>e[l]!==void 0)&&e[i.name]!==void 0:e[i.conflicts]!==void 0&&e[i.name]!==void 0);if(s)throw new xe(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},Xt=(t,e)=>{const n=e.options;if(n)for(const o of n){if(!o.choices||o.choices.length===0)continue;const s=t[o.name];if(s==null)continue;const i=Array.isArray(s)?s:[s];for(const l of i){const a=String(l);if(!o.choices.includes(a))throw new Yt(o.name,a,o.choices)}}},en=t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const s of t.options){if(s.name){const i=e.get(s.name)??[];i.push(s),e.set(s.name,i)}if(typeof s.alias=="string"&&s.alias.length>0){const i=n.get(s.alias)??[];i.push(s),n.set(s.alias,i)}else if(Array.isArray(s.alias)){for(const i of s.alias)if(i.length>0){const l=n.get(i)??[];l.push(s),n.set(i,l)}}}const o=[];for(const[s,i]of e)i.length>1&&o.push(`Duplicate option name "${s}" in command "${t.name}": ${JSON.stringify(i)}`);for(const[s,i]of n)i.length>1&&o.push(`Duplicate option alias "-${s}" used by options ${i.map(l=>`"${l.name}"`).join(", ")} in command "${t.name}"`);if(o.length>0)throw new Error(o.join(`
3
3
  `))},tn=(t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let o;for(let s=1;s<=e.length;s+=1){const i=e[s-1];if(i===void 0||i.startsWith("-"))break;n.push(i);const l=n.join(" ");t.has(l)&&(o={commandPath:[...n],depth:s})}return o?{argv:e.slice(o.depth),commandPath:o.commandPath}:{argv:e,commandPath:void 0}},B=t=>t.join(" "),Ae=(t,e)=>e&&e.length>0?[...e,t]:[t],nn=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),on=(t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),sn=(t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const o=[];let s="",i="";for(let l=0;l<n;l++){const a=t[l];if(et.test(a)){s?(o.push(s+i+a),s="",i=""):(o.length>0&&o.push(e),s=a);continue}s?(i&&(i+=e),i+=a):(o.length>0&&o.push(e),o.push(a))}return o.join("")},Me=(t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return sn(tt(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>{const i=s,l=i.toLowerCase();return n?(n=!1,nn(l)):on(l)}),"")},an=/^no-/,rn=t=>{t.options?.forEach(e=>{e.__camelCaseName__=Me(e.name)})},ln=t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const o of t.options)e.add(o.name);const n=[];for(const o of t.options)if(o.name.startsWith("no-")){const s=o.name.replace(an,"");if(!e.has(s)){if(o.type!==Boolean)throw new Error(`Cannot add negated option "${o.name}" to command "${t.name}" because it is not a boolean.`);const i={...o,defaultValue:o.defaultValue===void 0?!0:!o.defaultValue,name:s};n.push(i),e.add(s)}}n.length>0&&t.options.push(...n)},cn=(t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,o=new Map;for(const i of e.options)if(i.name.startsWith("no-")){const l=Me(i.name);o.set(l,i)}const s=Object.keys(n).filter(i=>o.has(i));if(s.length!==0)for(const i of s){const l=i.charAt(2);if(!l)continue;const a=l.toLowerCase()+i.slice(3),d=o.get(i);d&&(d.__negated__=!0),n[a]=!n[i],Reflect.deleteProperty(n,i)}},dn=(t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const s of e.options)s.__camelCaseName__&&s.__negated__===void 0&&s.implies!==void 0&&n.set(s.__camelCaseName__,s);if(n.size===0)return;const{options:o}=t;for(const s of Object.keys(o)){const i=n.get(s);if(i?.implies){const{implies:l}=i;for(const[a,d]of Object.entries(l))o[a]===void 0&&(o[a]=d)}}},un=()=>!!process.versions.electron,mn=()=>un()&&!process.defaultApp,hn=()=>mn()?0:1,pn=t=>t.slice(hn()+1),fn=" ",gn=(t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,o)=>n===e[o]),wn=t=>{if(typeof t=="string")return t.split(fn);const e=se();return gn(t,e)?pn(t):t},yn=t=>{const e=i=>{t.error(`Uncaught exception: ${i.message||i}`),i.stack&&t.error(i.stack),F(1)},n=(i,l)=>{if(i instanceof Error)t.error(`Promise rejection: ${i.message||i}`),i.stack&&t.error(i.stack);else{let a;if(typeof i=="string")a=i;else try{a=JSON.stringify(i)}catch{a=String(i)}t.error(`Promise rejection: ${a}`)}F(1)},o=ce("uncaughtException",e),s=ce("unhandledRejection",n);return()=>{o(),s()}},Oe=100,vn=/^[a-z][\w-]*$/i,ae=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new w(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},_e=(t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new w(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},oe=(t,e)=>{if(typeof t!="object"||t===null)throw new w(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},Z=t=>{const e=ae(t,"Command name");if(e.length>Oe)throw new w(`Command name is too long (maximum ${String(Oe)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new w(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!vn.test(e))throw new w(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},Nn=new Set([`
4
4
  `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),$n=(t,e={})=>{if(typeof t!="string")throw new TypeError("Argument must be a string");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,o=n.maxArgumentLength??1e6;if(Number.isFinite(o)&&o>0&&t.length>o)throw new Error(`Argument is too long (maximum ${String(o)} characters)`);if(n.checkDangerousChars){for(const s of t)if(Nn.has(s))throw new Error(`Argument contains dangerous character: ${s}`)}return n.trim?t.trim():t},Ce=(t,e={})=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,o=n.maxArguments??1e5;if(Number.isFinite(o)&&o>0&&t.length>o)throw new Error(`Too many arguments (maximum ${String(o)})`);return t.map(s=>$n(s,n))},bn=/^-([^\d-])$/,An=/^--(\S+)/,On=/^-([^\d-]{2,})$/,ie=t=>bn.test(t)||An.test(t)||On.test(t),_n={access:(t,e)=>We(t,e),mkdir:(t,e)=>qe(t,e),readdir:t=>Fe(t),readFile:(async(t,e)=>e===void 0?le(t):le(t,e)),rm:(t,e)=>Re(t,e),stat:t=>ze(t),writeFile:(t,e,n)=>Be(t,e,n)},Cn=(t,e,n)=>{const o=e.indexOf("--"),s=o===-1?new Set:new Set(e.slice(o+1)),i=n.filter(d=>d.startsWith("--")&&d!=="--"&&!s.has(d));if(i.length===0)return;const l=(t.options??[]).map(d=>d.name),a=i.flatMap(d=>j(d.slice(2),l).map(r=>`--${r}`));throw new nt(i,a)};class Ve{#t;#e;#d;#u;#p;#f;#O;#_;#C;#N;#x;#$;#I;#k=te;#m;#n;#o;#i;#s;#a;#g=!1;#E;#P=!1;#w;#y;#v;#l=[];#S(){return this.#w===void 0&&(this.#w=[...this.#o.keys()]),this.#w}#L(){return this.#y===void 0&&(this.#y=[...this.#n.keys()]),this.#y}#r(){return this.#v===void 0&&(this.#v=[...this.#S(),...this.#L()]),this.#v}#D(){return this.#l.length===0?J:[...J,...this.#l]}#M(){this.#w=void 0,this.#y=void 0,this.#v=void 0}#b(){if(this.#d===void 0){const e=wn(this.#e.argv);this.#d=Ce(e,{maxArguments:this.#$}),this.#T()}return this.#d}#A(){return this.#N??X()}#h(e){this.#k=e,this.#A().CEREBRO_OUTPUT_LEVEL=String(e)}#c(){const e=this.#A().CEREBRO_OUTPUT_LEVEL,n=e===void 0?Number.NaN:Number(e);return Number.isNaN(n)?this.#k:n}#T(){if(!this.#d)return;let e=!1;for(const n of this.#d){if(n==="--quiet"||n==="-q"){this.#h(Ge),e=!0;break}if(n==="--verbose"||n==="-v"){this.#h(He),e=!0;break}if(n==="--debug"){this.#h(T),e=!0;break}}e||this.#h(Object.hasOwn(this.#A(),"DEBUG")?T:te)}#j(){this.#P||(this.#E=yn(this.#t),this.#P=!0)}#U(){return{arch:Je(),argv:this.#b(),cwd:this.#u,env:this.#N??X(),exit:this.#C??(e=>F(e??0)),platform:Ye(),stdin:this.#x}}#V(e,n,o,s){this.#c()===T&&this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:i,booleanValues:l,parsedArgs:a}=Gt(e,n,this.#D()),d=Object.keys(l).length>0;let r=a;d&&(r={...a,_all:{...a._all,...l}}),Zt(i,r,e);const m=Wt(e,a,l,o);m.runtime=this,m.argv=this.#b(),m.fs=this.#_??_n,m.process=this.#U(),m.console=this.#t;const h=e.options&&e.options.length>0;if(h&&e.options){const f=e.options.filter(y=>y.name.startsWith("no-"));for(const y of f){const E=y.name.slice(3),A=`--${y.name}`,I=`--${E}`,O=n.includes(A),v=n.includes(I);if(O&&v)throw new xe(E,y.name)}}return h&&(cn(m,e),dn(m,e)),Qt(i,m.options,e),Xt(m.options,e),this.#I&&Cn(e,n,m.rawUnknown),this.#c()===T&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(m.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(m.argument,null,2))),{arguments_:i,booleanValues:l,commandArgs:r,parsedArgs:a,toolbox:m}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new w("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#p=e.trim();const o=n.argv??se(),s=n.cwd??Ke();if(this.#e={...n,argv:o,cwd:s},this.#e.argv&&!Array.isArray(this.#e.argv))throw new w("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new w("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new w("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new w("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});if(typeof this.#e.logger=="object"){const r=["debug","error","info","log","warn"],m=[],h=this.#e.logger;for(const f of r)typeof h[f]!="function"&&m.push(f);if(m.length>0)throw new w(`Logger object is missing required methods: ${m.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:m});this.#t=this.#e.logger}else this.#t={...console,debug:(...r)=>{this.#c()===T&&console.debug(...r)}};this.#f=this.#e.packageVersion,this.#O=this.#e.packageName,this.#u=this.#e.cwd,this.#s="help",this.#a={};const i=n.fs;if(i!==void 0&&(typeof i!="object"||i===null))throw new w("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const l=n.exit;if(l!==void 0&&typeof l!="function")throw new w("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const a=n.env;if(a!==void 0&&(typeof a!="object"||a===null))throw new w("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const d=n.stdin;if(d!==void 0&&typeof d!="string")throw new w("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#_=n.fs,this.#C=n.exit,this.#N=n.env,this.#x=n.stdin??"",this.#$=n.maxArguments,this.#I=n.strictOptions??!1,this.#h(te),this.#n=new Map,this.#o=new Map,this.#i=new Map}setCommandSection(e){return this.#a=e,this}getCommandSection(){return this.#a.header||(this.#a.header=`${this.#p}${this.#f?` v${this.#f}`:""}`),this.#a}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){oe(e,"Command"),Z(e.name);const n=typeof e.execute=="function",o=typeof e.loader=="function";if(n&&o)throw new w(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!o)throw new w(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?Z(e.alias):_e(e.alias,"Command alias").forEach(r=>Z(r))),e.argument&&oe(e.argument,"Command argument"),e.options&&oe(e.options,"Command options"),e.commandPath&&(_e(e.commandPath,"Command commandPath"),e.commandPath.forEach(r=>{Z(r)}));const s=Ae(e.name,e.commandPath),i=B(s);if(this.#o.has(i))throw new w(`Command with path "${i}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const l=Array.isArray(e.commandPath)&&e.commandPath.length>0,a=this.#n.get(e.name),d=a!==void 0&&(a.commandPath===void 0||a.commandPath.length===0);if(!l&&d)throw new w(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const r of e.options)de(r);if(en(e),ln(e),rn(e),e.options&&(e.__conflictingOptions__=e.options.filter(r=>r.conflicts!==void 0),e.__requiredOptions__=e.options.filter(r=>r.required===!0)),l&&a!==void 0)this.#n.set(i,e);else{if(!l&&a!==void 0&&!d){const r=Ae(a.name,a.commandPath);this.#n.set(B(r),a)}this.#n.set(e.name,e)}if(this.#o.set(i,s),this.#i.set(i,e),this.#M(),e.alias!==void 0){const r=typeof e.alias=="string"?[e.alias]:e.alias;for(const m of r){if(this.#c()===T&&this.#t.debug("adding alias",m),this.#n.has(m))throw new w(`Command alias "${m}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:m,commandName:e.name});this.#n.set(m,e)}}return this}addGlobalOption(e){const n=e,o=new Set(J.map(i=>i.name)),s=new Set(J.map(i=>i.alias).filter(Boolean));if(o.has(n.name))throw new w(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&s.has(n.alias))throw new w(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(i=>i.name)).has(n.name))throw new w(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",de(n),this.#l.push(n),this}getGlobalOptions(){return this.#D()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#m?this.#m:(this.#m=new it(this.#t),this.#m.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#m)}getCliName(){return this.#p}getPackageVersion(){return this.#f}getPackageName(){return this.#O}getCommands(){return this.#n}getCwd(){return this.#u}dispose(){this.#E?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:o=!0,...s}=e;if(!this.#n.has("help")){const{default:v}=await import("../commands/help-command.js");this.addCommand(new v(this.#n))}const i=this.#L(),l=this.#o;this.#j();const a=this.#b();let d,r=[...a];this.#c()===T&&(this.#t.debug(`process.execPath: ${Ze()}`),this.#t.debug(`process.execArgv: ${Qe().join(" ")}`),this.#t.debug(`process.argv: ${se().join(" ")}`));const m=tn(l,[...a]);if(m.commandPath)d=m.commandPath,r=m.argv;else{if(a.length>1&&a[0]&&a[1]&&!ie(a[0])&&!ie(a[1])){const $=[];let _=0;for(;_<a.length;){const V=a[_];if(!V||ie(V))break;$.push(V),_+=1}const L=B($);if($[0]&&!i.includes($[0])){const V=this.#r(),Y=j(L,V);throw new U(L,Y)}}let v;try{v=dt([null,...i],[...a])}catch($){if($ instanceof Error&&$.name==="INVALID_COMMAND"&&"command"in $){const _=$.command,L=this.#r(),V=j(_,L);throw new U(_,V)}throw $}v.command&&(d=[v.command],r=v.argv)}if(!d)if(this.#s)d=[this.#s];else{const v=this.#r();throw new U("",v)}const h=B(d),f=this.#o.get(h);let y;if(f){if(y=this.#i.get(h),!y||B(f)!==h){const v=this.#r(),$=j(h,v);throw new U(h,$)}}else{const v=d.at(-1);if(y=v?this.#n.get(v):void 0,!y){const $=this.#r(),_=j(h,$);throw new U(h,_)}}if(typeof y.execute!="function"&&typeof y.loader!="function")return this.#t.error(`Command "${y.name}" has no function to execute.`),o?F(1):void 0;const E=r;let A,I;try{({commandArgs:A,toolbox:I}=this.#V(y,E,s,h))}catch(v){if(this.#t.error(v),o)return F(1);throw v}const O=this.getPluginManager();try{!this.#g&&O.hasPlugins()&&(await O.init({cli:this,cwd:this.#u,logger:this.#t}),this.#g=!0),await O.executeLifecycle("execute",I),await O.executeLifecycle("beforeCommand",I);let v;const $=A.global;if($?.help){const _=this.#n.get("help");if(!_)throw new w("Help command not found","COMMAND_NOT_FOUND");v=await R(_,I)}else if($?.version??$?.V){const _=this.#n.get("version");if(!_)throw new w("Version command not found","COMMAND_NOT_FOUND");v=await R(_,I)}else v=await R(y,I);return await O.executeLifecycle("afterCommand",I,v),o?F(0):void 0}catch(v){throw await O.executeErrorHandlers(v,I),v}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:o=[],...s}=n;ae(e,"Command name");const i=e.split(" ").filter(Boolean),l=B(i),a=this.#o.get(l)?this.#i.get(l):this.#n.get(e);if(!a){const f=this.#r(),y=j(l||e,f);throw new U(e,y)}if(typeof a.execute!="function"&&typeof a.loader!="function")throw new w(`Command "${a.name}" has no function to execute`,"INVALID_COMMAND",{commandName:a.name});const d=[...Ce(o,{maxArguments:this.#$})];this.#c()===T&&this.#t.debug(`running command '${e}' programmatically with args: ${d.join(", ")}`);const{commandArgs:r,toolbox:m}=this.#V(a,d,s,l||e),h=this.getPluginManager();try{!this.#g&&h.hasPlugins()&&(await h.init({cli:this,cwd:this.#u,logger:this.#t}),this.#g=!0),await h.executeLifecycle("execute",m),await h.executeLifecycle("beforeCommand",m);let f;const y=r.global;if(y?.help){const E=this.#n.get("help");if(!E)throw new w("Help command not found","COMMAND_NOT_FOUND");f=await R(E,m)}else if(y?.version??y?.V){const E=this.#n.get("version");if(!E)throw new w("Version command not found","COMMAND_NOT_FOUND");f=await R(E,m)}else f=await R(a,m);return await h.executeLifecycle("afterCommand",m,f),f}catch(f){throw await h.executeErrorHandlers(f,m),f}}clone(e){const n={...this.#e,...e},o=new Ve(this.#p,n);for(const[s,i]of this.#n)o.#n.set(s,i);for(const[s,i]of this.#o)o.#o.set(s,[...i]);for(const[s,i]of this.#i)o.#i.set(s,i);for(const s of this.#l)o.#l.push(s);return o.#s=this.#s,o.#a={...this.#a},o.#M(),o}async getAction(e){ae(e,"Command name");const n=e.split(" ").filter(Boolean),o=B(n),s=this.#o.get(o)?this.#i.get(o):this.#n.get(e);if(!s){const i=this.#r(),l=j(o||e,i);throw new U(e,l)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return De(s);throw new w(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}}export{Ve as Cli};
@@ -1,4 +1,4 @@
1
- import{createRequire as Bd}from"node:module";import{m as ro,y as To,n as je,x as Gd,R as Nd,F as Wd,B as xd,l as Pd,d as Fd}from"./split-by-case-C-dbSFCl.js";import{createTable as Go}from"@visulima/tabular";import{NO_BORDER as No}from"@visulima/tabular/style";import Ad from"@visulima/colorize/template";import{c as _d}from"./runtime-process-Dmz0vCJy.js";import{bold as Ed}from"@visulima/colorize";const Md=Bd(import.meta.url),Ei=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ko=i=>{if(typeof Ei<"u"&&Ei.versions&&Ei.versions.node){const[o,e]=Ei.versions.node.split(".").map(Number);if(o>22||o===22&&e>=3||o===20&&e>=16)return Ei.getBuiltinModule(i)}return Md(i)},{createRequire:Kd}=ko("node:module"),Pi=Ei,{execFileSync:Rd}=ko("node:child_process"),bo=ko("node:fs"),Od=ko("node:tty"),zd=ko("node:os"),$d=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],qd=12288,Id=65510,Ud=[12288,12288,65281,65376,65504,65510],Vd=8361,it=65518,ot=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],et=32,nt=10630,at=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],ut=4352,gt=262141,au=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],Lo=(i,o)=>{let e=0,n=Math.floor(i.length/2)-1;for(;e<=n;){const a=Math.floor((e+n)/2),u=a*2;if(o<i[u])n=a-1;else if(o>i[u+1])e=a+1;else return!0}return!1},_n=19968,[dt,tt]=ht(au);function ht(i){let o=i[0],e=i[1];for(let n=0;n<i.length;n+=2){const a=i[n],u=i[n+1];if(_n>=a&&_n<=u)return[a,u];u-a>e-o&&(o=a,e=u)}return[o,e]}const st=i=>i<161||i>1114109?!1:Lo($d,i),rt=i=>i<qd||i>Id?!1:Lo(Ud,i),vt=i=>i<Vd||i>it?!1:Lo(ot,i),lt=i=>i<et||i>nt?!1:Lo(at,i),yt=i=>i>=dt&&i<=tt?!0:i<ut||i>gt?!1:Lo(au,i);function ct(i){return st(i)?"ambiguous":rt(i)?"fullwidth":vt(i)?"halfwidth":lt(i)?"narrow":yt(i)?"wide":"neutral"}function bt(i){if(!Number.isSafeInteger(i))throw new TypeError(`Expected a code point, got \`${typeof i}\`.`)}function uu(i){return bt(i),ct(i)}const zn=new Map,pt=i=>[i.ambiguousIsNarrow?1:0,i.control,i.fullWidth,i.regular,i.wide].join("|"),wt=i=>{const o=pt(i.width);let e=zn.get(o);return e||(e=new Map,zn.set(o,e)),e},Qo=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,gu=i=>i>=32&&i<=126?"latin":i===8203||i===8204||i===8205||i===8288?"zero":i<=31||i>=127&&i<=159?"control":i>=160&&i<=255||i>=9472&&i<=9599?"latin":i>=4352&&i<=4607||i>=11904&&i<=40959||i>=44032&&i<=55215||i>=63744&&i<=64255||i>=65280&&i<=65519&&!(i>=65377&&i<=65439)||i>=12352&&i<=12543?"wide":i===8230?"latin":"other",jt=(i,o)=>{const e=wt(o),n=Math.floor(i/65536),a=i%65536;let u=e.get(n);if(u||(u=new Map,e.set(n,u)),u.has(a))return u.get(a);let g;switch(gu(i)){case"control":{g=o.width.control;break}case"latin":{g=o.width.regular;break}case"wide":{g=o.width.wide;break}case"zero":{g=0;break}default:switch(uu(i)){case"ambiguous":{g=o.width.ambiguousIsNarrow?o.width.regular:o.width.wide;break}case"fullwidth":{g=o.width.fullWidth;break}case"wide":{g=o.width.wide;break}default:g=o.width.regular}}return u.set(a,g),g},mt=i=>i>=768&&i<=879||i>=6832&&i<=6911||i>=7616&&i<=7679||i>=8400&&i<=8447||i>=65056&&i<=65071||i>=917760&&i<=917999||i>=65024&&i<=65039||i>=3633&&i<=3642||i>=3655&&i<=3662||i>=3761&&i<=3769||i>=3771&&i<=3772||i>=3784&&i<=3789||i>=2304&&i<=2307||i>=2362&&i<=2383||i>=2385&&i<=2391||i>=2402&&i<=2403||i>=2433&&i<=2435||i>=2492&&i<=2500||i>=2509&&i<=2509||i>=2561&&i<=2563||i>=2620&&i<=2637||i>=1611&&i<=1631||i>=1648&&i<=1648||i>=1750&&i<=1773||i>=2276&&i<=2302||i>=1425&&i<=1469||i>=1471&&i<=1471||i>=1473&&i<=1474||i>=1476&&i<=1477||i>=1479&&i<=1479||i>=3893&&i<=3893||i>=3895&&i<=3895||i>=3897&&i<=3897||i>=3953&&i<=3966||i>=3968&&i<=3972||i>=3974&&i<=3975?!0:i>=768&&i<=777||i>=803&&i<=803,Qe=(i,o={})=>{if(!i||i.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const e={truncation:{countAnsiEscapeCodes:o.countAnsiEscapeCodes??!1,ellipsis:o.ellipsis??"",ellipsisWidth:o.ellipsisWidth??(o.ellipsis?Qe(o.ellipsis,{...o,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:o.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:o.ambiguousIsNarrow??!1,ansi:o.ansiWidth??0,control:o.controlWidth??0,emoji:o.emojiWidth??2,fullWidth:o.fullWidth??2,halfWidth:o.halfWidth??1,regular:o.regularWidth??1,tab:o.tabWidth??8,wide:o.wideWidth??2}},n=Math.max(0,e.truncation.limit-e.truncation.ellipsisWidth),{length:a}=i,u=a>1e4;let g=0,t=0,h=a,s=!1;const v=i.includes("\x1B")||i.includes("›");for(;g<a;){if(v&&(i[g]==="\x1B"||i[g]==="›")){if(i.startsWith("\x1B]8;;",g)){const p="\x1B]8;;\x07",j=p.length,L=i.indexOf("\x07",g+5);if(L!==-1){const K=i.indexOf(p,L+1);if(K!==-1){const R=K+j,z=i.slice(L+1,K).replace(ro,""),B=Qe(z,{ambiguousIsNarrow:e.width.ambiguousIsNarrow,ansiWidth:e.width.ansi,controlWidth:e.width.control,countAnsiEscapeCodes:!1,ellipsis:e.truncation.ellipsis,ellipsisWidth:e.truncation.ellipsisWidth,emojiWidth:e.width.emoji,fullWidth:e.width.fullWidth,halfWidth:e.width.halfWidth,limit:Math.max(0,n-t),regularWidth:e.width.regular,tabWidth:e.width.tab,wideWidth:e.width.wide}),E=B.width;if(B.truncated)s=!0,h=Math.min(h,g);else if(t+E>n&&(h=Math.min(h,g),s=!0,t+E>e.truncation.limit))break;if(t+=E,g=R,s&&t>=e.truncation.limit)break;continue}}}if(ro.lastIndex=g,ro.test(i)){const p=ro.lastIndex-g,j=e.truncation.countAnsiEscapeCodes?p:e.width.ansi;if(t+j>n&&(h=Math.min(h,g),t+j>e.truncation.limit)){s=!0;break}t+=j,g=ro.lastIndex;continue}}const c=i.codePointAt(g);if(c===8203||c===65279||c>=8288&&c<=8292){g+=1;continue}if(c===9){if(t+e.width.tab>n&&(h=Math.min(h,g),t+e.width.tab>e.truncation.limit)){s=!0;break}t+=e.width.tab,g+=1;continue}if(Qo.lastIndex=g,Qo.test(i)){const p=(Qo.lastIndex-g)*e.width.regular;if(t+p>n){const j=Math.floor((n-t)/e.width.regular);if(h=Math.min(h,g+j),t+p>e.truncation.limit){s=!0;break}}t+=p,g=Qo.lastIndex;continue}if((c<=31||c>=127&&c<=159)&&(To.lastIndex=g,To.test(i))){const p=(To.lastIndex-g)*e.width.control;if(t+p>n&&(h=Math.min(h,g+Math.floor((n-t)/e.width.control)),t+p>e.truncation.limit)){s=!0;break}t+=p,g=To.lastIndex;continue}if(je.lastIndex=g,je.test(i)){if(t+e.width.emoji>n&&(h=Math.min(h,g),t+e.width.emoji>e.truncation.limit)){s=!0;break}t+=e.width.emoji,g=je.lastIndex;continue}const y=i.codePointAt(g)??0;if(mt(y)){g+=y>65535?2:1;continue}let b;if(u)b=jt(y,e);else switch(gu(y)){case"control":{b=e.width.control;break}case"latin":{b=e.width.regular;break}case"wide":{b=e.width.wide;break}case"zero":{b=0;break}default:switch(uu(y)){case"ambiguous":{b=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{b=e.width.fullWidth;break}case"wide":{b=e.width.wide;break}default:b=e.width.regular}}if(t+b>n&&(h=Math.min(h,g),t+b>e.truncation.limit)){s=!0;break}t+=b,g+=y>65535?2:1}let r=t,l=!1;return s&&e.truncation.limit>=e.truncation.ellipsisWidth&&(r=e.truncation.limit,l=!0),{ellipsed:l,index:s?h:a,truncated:s,width:r}},ft=(i,o={})=>Qe(i,{...o,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Yt=Kd(import.meta.url),vo=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=i=>{if(typeof vo<"u"&&vo.versions&&vo.versions.node){const[o,e]=vo.versions.node.split(".").map(Number);if(o>22||o===22&&e>=3||o===20&&e>=16)return vo.getBuiltinModule(i)}return Yt(i)};kt("node:util");function Lt(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var me,En;function Zt(){if(En)return me;En=1,me=o;function i(n){return n instanceof Buffer?Buffer.from(n):new n.constructor(n.buffer.slice(),n.byteOffset,n.length)}function o(n){if(n=n||{},n.circles)return e(n);const a=new Map;if(a.set(Date,s=>new Date(s)),a.set(Map,(s,v)=>new Map(g(Array.from(s),v))),a.set(Set,(s,v)=>new Set(g(Array.from(s),v))),n.constructorHandlers)for(const s of n.constructorHandlers)a.set(s[0],s[1]);let u=null;return n.proto?h:t;function g(s,v){const r=Object.keys(s),l=new Array(r.length);for(let c=0;c<r.length;c++){const y=r[c],b=s[y];typeof b!="object"||b===null?l[y]=b:b.constructor!==Object&&(u=a.get(b.constructor))?l[y]=u(b,v):ArrayBuffer.isView(b)?l[y]=i(b):l[y]=v(b)}return l}function t(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return g(s,t);if(s.constructor!==Object&&(u=a.get(s.constructor)))return u(s,t);const v={};for(const r in s){if(Object.hasOwnProperty.call(s,r)===!1)continue;const l=s[r];typeof l!="object"||l===null?v[r]=l:l.constructor!==Object&&(u=a.get(l.constructor))?v[r]=u(l,t):ArrayBuffer.isView(l)?v[r]=i(l):v[r]=t(l)}return v}function h(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return g(s,h);if(s.constructor!==Object&&(u=a.get(s.constructor)))return u(s,h);const v={};for(const r in s){const l=s[r];typeof l!="object"||l===null?v[r]=l:l.constructor!==Object&&(u=a.get(l.constructor))?v[r]=u(l,h):ArrayBuffer.isView(l)?v[r]=i(l):v[r]=h(l)}return v}}function e(n){const a=[],u=[],g=new Map;if(g.set(Date,r=>new Date(r)),g.set(Map,(r,l)=>new Map(h(Array.from(r),l))),g.set(Set,(r,l)=>new Set(h(Array.from(r),l))),n.constructorHandlers)for(const r of n.constructorHandlers)g.set(r[0],r[1]);let t=null;return n.proto?v:s;function h(r,l){const c=Object.keys(r),y=new Array(c.length);for(let b=0;b<c.length;b++){const p=c[b],j=r[p];if(typeof j!="object"||j===null)y[p]=j;else if(j.constructor!==Object&&(t=g.get(j.constructor)))y[p]=t(j,l);else if(ArrayBuffer.isView(j))y[p]=i(j);else{const L=a.indexOf(j);L!==-1?y[p]=u[L]:y[p]=l(j)}}return y}function s(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return h(r,s);if(r.constructor!==Object&&(t=g.get(r.constructor)))return t(r,s);const l={};a.push(r),u.push(l);for(const c in r){if(Object.hasOwnProperty.call(r,c)===!1)continue;const y=r[c];if(typeof y!="object"||y===null)l[c]=y;else if(y.constructor!==Object&&(t=g.get(y.constructor)))l[c]=t(y,s);else if(ArrayBuffer.isView(y))l[c]=i(y);else{const b=a.indexOf(y);b!==-1?l[c]=u[b]:l[c]=s(y)}}return a.pop(),u.pop(),l}function v(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return h(r,v);if(r.constructor!==Object&&(t=g.get(r.constructor)))return t(r,v);const l={};a.push(r),u.push(l);for(const c in r){const y=r[c];if(typeof y!="object"||y===null)l[c]=y;else if(y.constructor!==Object&&(t=g.get(y.constructor)))l[c]=t(y,v);else if(ArrayBuffer.isView(y))l[c]=i(y);else{const b=a.indexOf(y);b!==-1?l[c]=u[b]:l[c]=v(y)}}return a.pop(),u.pop(),l}}return me}var Jt=Zt();const du=Lt(Jt);du();var tu=typeof global=="object"&&global&&global.Object===Object&&global,St=typeof self=="object"&&self&&self.Object===Object&&self,P=tu||St||Function("return this")(),_=P.Symbol,hu=Object.prototype,Ct=hu.hasOwnProperty,Xt=hu.toString,lo=_?_.toStringTag:void 0;function Ht(i){var o=Ct.call(i,lo),e=i[lo];try{i[lo]=void 0;var n=!0}catch{}var a=Xt.call(i);return n&&(o?i[lo]=e:delete i[lo]),a}var Dt=Object.prototype,Tt=Dt.toString;function Qt(i){return Tt.call(i)}var Bt="[object Null]",Mt="[object Undefined]",$n=_?_.toStringTag:void 0;function q(i){return i==null?i===void 0?Mt:Bt:$n&&$n in Object(i)?Ht(i):Qt(i)}function N(i){return i!=null&&typeof i=="object"}var Gt="[object Symbol]";function ei(i){return typeof i=="symbol"||N(i)&&q(i)==Gt}var Nt=NaN;function qn(i){return typeof i=="number"?i:ei(i)?Nt:+i}function M(i,o){for(var e=-1,n=i==null?0:i.length,a=Array(n);++e<n;)a[e]=o(i[e],e,i);return a}var k=Array.isArray,In=_?_.prototype:void 0,Un=In?In.toString:void 0;function ni(i){if(typeof i=="string")return i;if(k(i))return M(i,ni)+"";if(ei(i))return Un?Un.call(i):"";var o=i+"";return o=="0"&&1/i==-1/0?"-0":o}function Eo(i,o){return function(e,n){var a;if(e===void 0&&n===void 0)return o;if(e!==void 0&&(a=e),n!==void 0){if(a===void 0)return n;typeof e=="string"||typeof n=="string"?(e=ni(e),n=ni(n)):(e=qn(e),n=qn(n)),a=i(e,n)}return a}}var Wt=Eo(function(i,o){return i+o},0),xt=/\s/;function su(i){for(var o=i.length;o--&&xt.test(i.charAt(o)););return o}var Pt=/^\s+/;function ru(i){return i&&i.slice(0,su(i)+1).replace(Pt,"")}function G(i){var o=typeof i;return i!=null&&(o=="object"||o=="function")}var Vn=NaN,Ft=/^[-+]0x[0-9a-f]+$/i,Kt=/^0b[01]+$/i,Rt=/^0o[0-7]+$/i,Ot=parseInt;function di(i){if(typeof i=="number")return i;if(ei(i))return Vn;if(G(i)){var o=typeof i.valueOf=="function"?i.valueOf():i;i=G(o)?o+"":o}if(typeof i!="string")return i===0?i:+i;i=ru(i);var e=Kt.test(i);return e||Rt.test(i)?Ot(i.slice(2),e?2:8):Ft.test(i)?Vn:+i}var ia=1/0,At=17976931348623157e292;function Li(i){if(!i)return i===0?i:0;if(i=di(i),i===ia||i===-ia){var o=i<0?-1:1;return o*At}return i===i?i:0}function Z(i){var o=Li(i),e=o%1;return o===o?e?o-e:o:0}var _t="Expected a function";function zt(i,o){if(typeof o!="function")throw new TypeError(_t);return i=Z(i),function(){if(--i<1)return o.apply(this,arguments)}}function V(i){return i}var Et="[object AsyncFunction]",$t="[object Function]",qt="[object GeneratorFunction]",It="[object Proxy]";function Zi(i){if(!G(i))return!1;var o=q(i);return o==$t||o==qt||o==Et||o==It}var Wo=P["__core-js_shared__"],oa=(function(){var i=/[^.]+$/.exec(Wo&&Wo.keys&&Wo.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function Ut(i){return!!oa&&oa in i}var Vt=Function.prototype,ih=Vt.toString;function Oi(i){if(i!=null){try{return ih.call(i)}catch{}try{return i+""}catch{}}return""}var oh=/[\\^$.*+?()[\]{}|]/g,eh=/^\[object .+?Constructor\]$/,nh=Function.prototype,ah=Object.prototype,uh=nh.toString,gh=ah.hasOwnProperty,dh=RegExp("^"+uh.call(gh).replace(oh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vu(i){if(!G(i)||Ut(i))return!1;var o=Zi(i)?dh:eh;return o.test(Oi(i))}function th(i,o){return i?.[o]}function Ai(i,o){var e=th(i,o);return vu(e)?e:void 0}var wo=Ai(P,"WeakMap"),Oo=wo&&new wo,lu=Oo?function(i,o){return Oo.set(i,o),i}:V,ea=Object.create,oo=(function(){function i(){}return function(o){if(!G(o))return{};if(ea)return ea(o);i.prototype=o;var e=new i;return i.prototype=void 0,e}})();function jo(i){return function(){var o=arguments;switch(o.length){case 0:return new i;case 1:return new i(o[0]);case 2:return new i(o[0],o[1]);case 3:return new i(o[0],o[1],o[2]);case 4:return new i(o[0],o[1],o[2],o[3]);case 5:return new i(o[0],o[1],o[2],o[3],o[4]);case 6:return new i(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new i(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var e=oo(i.prototype),n=i.apply(e,o);return G(n)?n:e}}var hh=1;function sh(i,o,e){var n=o&hh,a=jo(i);function u(){var g=this&&this!==P&&this instanceof u?a:i;return g.apply(n?e:this,arguments)}return u}function ai(i,o,e){switch(e.length){case 0:return i.call(o);case 1:return i.call(o,e[0]);case 2:return i.call(o,e[0],e[1]);case 3:return i.call(o,e[0],e[1],e[2])}return i.apply(o,e)}var rh=Math.max;function yu(i,o,e,n){for(var a=-1,u=i.length,g=e.length,t=-1,h=o.length,s=rh(u-g,0),v=Array(h+s),r=!n;++t<h;)v[t]=o[t];for(;++a<g;)(r||a<u)&&(v[e[a]]=i[a]);for(;s--;)v[t++]=i[a++];return v}var vh=Math.max;function cu(i,o,e,n){for(var a=-1,u=i.length,g=-1,t=e.length,h=-1,s=o.length,v=vh(u-t,0),r=Array(v+s),l=!n;++a<v;)r[a]=i[a];for(var c=a;++h<s;)r[c+h]=o[h];for(;++g<t;)(l||a<u)&&(r[c+e[g]]=i[a++]);return r}function lh(i,o){for(var e=i.length,n=0;e--;)i[e]===o&&++n;return n}function $o(){}var yh=4294967295;function S(i){this.__wrapped__=i,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=yh,this.__views__=[]}S.prototype=oo($o.prototype);S.prototype.constructor=S;function $e(){}var qe=Oo?function(i){return Oo.get(i)}:$e,Ii={},ch=Object.prototype,bh=ch.hasOwnProperty;function xo(i){for(var o=i.name+"",e=Ii[o],n=bh.call(Ii,o)?e.length:0;n--;){var a=e[n],u=a.func;if(u==null||u==i)return a.name}return o}function hi(i,o){this.__wrapped__=i,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=void 0}hi.prototype=oo($o.prototype);hi.prototype.constructor=hi;function U(i,o){var e=-1,n=i.length;for(o||(o=Array(n));++e<n;)o[e]=i[e];return o}function bu(i){if(i instanceof S)return i.clone();var o=new hi(i.__wrapped__,i.__chain__);return o.__actions__=U(i.__actions__),o.__index__=i.__index__,o.__values__=i.__values__,o}var ph=Object.prototype,wh=ph.hasOwnProperty;function d(i){if(N(i)&&!k(i)&&!(i instanceof S)){if(i instanceof hi)return i;if(wh.call(i,"__wrapped__"))return bu(i)}return new hi(i)}d.prototype=$o.prototype;d.prototype.constructor=d;function Be(i){var o=xo(i),e=d[o];if(typeof e!="function"||!(o in S.prototype))return!1;if(i===e)return!0;var n=qe(e);return!!n&&i===n[0]}var jh=800,mh=16,fh=Date.now;function pu(i){var o=0,e=0;return function(){var n=fh(),a=mh-(n-e);if(e=n,a>0){if(++o>=jh)return arguments[0]}else o=0;return i.apply(void 0,arguments)}}var wu=pu(lu),Yh=/\{\n\/\* \[wrapped with (.+)\] \*/,kh=/,? & /;function Lh(i){var o=i.match(Yh);return o?o[1].split(kh):[]}var Zh=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function Jh(i,o){var e=o.length;if(!e)return i;var n=e-1;return o[n]=(e>1?"& ":"")+o[n],o=o.join(e>2?", ":" "),i.replace(Zh,`{
1
+ import{createRequire as Bd}from"node:module";import{d as ro,y as To,n as je,x as Gd,R as Nd,l as Wd,B as xd,m as Pd,F as Fd}from"./split-by-case-Dbpgd7rf.js";import{createTable as Go}from"@visulima/tabular";import{NO_BORDER as No}from"@visulima/tabular/style";import Ad from"@visulima/colorize/template";import{c as _d}from"./runtime-process-Dmz0vCJy.js";import{bold as Ed}from"@visulima/colorize";const Md=Bd(import.meta.url),Ei=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ko=i=>{if(typeof Ei<"u"&&Ei.versions&&Ei.versions.node){const[o,e]=Ei.versions.node.split(".").map(Number);if(o>22||o===22&&e>=3||o===20&&e>=16)return Ei.getBuiltinModule(i)}return Md(i)},{createRequire:Kd}=ko("node:module"),Pi=Ei,{execFileSync:Rd}=ko("node:child_process"),bo=ko("node:fs"),Od=ko("node:tty"),zd=ko("node:os"),$d=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],qd=12288,Id=65510,Ud=[12288,12288,65281,65376,65504,65510],Vd=8361,it=65518,ot=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],et=32,nt=10630,at=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],ut=4352,gt=262141,au=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],Lo=(i,o)=>{let e=0,n=Math.floor(i.length/2)-1;for(;e<=n;){const a=Math.floor((e+n)/2),u=a*2;if(o<i[u])n=a-1;else if(o>i[u+1])e=a+1;else return!0}return!1},_n=19968,[dt,tt]=ht(au);function ht(i){let o=i[0],e=i[1];for(let n=0;n<i.length;n+=2){const a=i[n],u=i[n+1];if(_n>=a&&_n<=u)return[a,u];u-a>e-o&&(o=a,e=u)}return[o,e]}const st=i=>i<161||i>1114109?!1:Lo($d,i),rt=i=>i<qd||i>Id?!1:Lo(Ud,i),vt=i=>i<Vd||i>it?!1:Lo(ot,i),lt=i=>i<et||i>nt?!1:Lo(at,i),yt=i=>i>=dt&&i<=tt?!0:i<ut||i>gt?!1:Lo(au,i);function ct(i){return st(i)?"ambiguous":rt(i)?"fullwidth":vt(i)?"halfwidth":lt(i)?"narrow":yt(i)?"wide":"neutral"}function bt(i){if(!Number.isSafeInteger(i))throw new TypeError(`Expected a code point, got \`${typeof i}\`.`)}function uu(i){return bt(i),ct(i)}const zn=new Map,pt=i=>[i.ambiguousIsNarrow?1:0,i.control,i.fullWidth,i.regular,i.wide].join("|"),wt=i=>{const o=pt(i.width);let e=zn.get(o);return e||(e=new Map,zn.set(o,e)),e},Qo=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,gu=i=>i>=32&&i<=126?"latin":i===8203||i===8204||i===8205||i===8288?"zero":i<=31||i>=127&&i<=159?"control":i>=160&&i<=255||i>=9472&&i<=9599?"latin":i>=4352&&i<=4607||i>=11904&&i<=40959||i>=44032&&i<=55215||i>=63744&&i<=64255||i>=65280&&i<=65519&&!(i>=65377&&i<=65439)||i>=12352&&i<=12543?"wide":i===8230?"latin":"other",jt=(i,o)=>{const e=wt(o),n=Math.floor(i/65536),a=i%65536;let u=e.get(n);if(u||(u=new Map,e.set(n,u)),u.has(a))return u.get(a);let g;switch(gu(i)){case"control":{g=o.width.control;break}case"latin":{g=o.width.regular;break}case"wide":{g=o.width.wide;break}case"zero":{g=0;break}default:switch(uu(i)){case"ambiguous":{g=o.width.ambiguousIsNarrow?o.width.regular:o.width.wide;break}case"fullwidth":{g=o.width.fullWidth;break}case"wide":{g=o.width.wide;break}default:g=o.width.regular}}return u.set(a,g),g},mt=i=>i>=768&&i<=879||i>=6832&&i<=6911||i>=7616&&i<=7679||i>=8400&&i<=8447||i>=65056&&i<=65071||i>=917760&&i<=917999||i>=65024&&i<=65039||i>=3633&&i<=3642||i>=3655&&i<=3662||i>=3761&&i<=3769||i>=3771&&i<=3772||i>=3784&&i<=3789||i>=2304&&i<=2307||i>=2362&&i<=2383||i>=2385&&i<=2391||i>=2402&&i<=2403||i>=2433&&i<=2435||i>=2492&&i<=2500||i>=2509&&i<=2509||i>=2561&&i<=2563||i>=2620&&i<=2637||i>=1611&&i<=1631||i>=1648&&i<=1648||i>=1750&&i<=1773||i>=2276&&i<=2302||i>=1425&&i<=1469||i>=1471&&i<=1471||i>=1473&&i<=1474||i>=1476&&i<=1477||i>=1479&&i<=1479||i>=3893&&i<=3893||i>=3895&&i<=3895||i>=3897&&i<=3897||i>=3953&&i<=3966||i>=3968&&i<=3972||i>=3974&&i<=3975?!0:i>=768&&i<=777||i>=803&&i<=803,Qe=(i,o={})=>{if(!i||i.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const e={truncation:{countAnsiEscapeCodes:o.countAnsiEscapeCodes??!1,ellipsis:o.ellipsis??"",ellipsisWidth:o.ellipsisWidth??(o.ellipsis?Qe(o.ellipsis,{...o,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:o.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:o.ambiguousIsNarrow??!1,ansi:o.ansiWidth??0,control:o.controlWidth??0,emoji:o.emojiWidth??2,fullWidth:o.fullWidth??2,halfWidth:o.halfWidth??1,regular:o.regularWidth??1,tab:o.tabWidth??8,wide:o.wideWidth??2}},n=Math.max(0,e.truncation.limit-e.truncation.ellipsisWidth),{length:a}=i,u=a>1e4;let g=0,t=0,h=a,s=!1;const v=i.includes("\x1B")||i.includes("›");for(;g<a;){if(v&&(i[g]==="\x1B"||i[g]==="›")){if(i.startsWith("\x1B]8;;",g)){const p="\x1B]8;;\x07",j=p.length,L=i.indexOf("\x07",g+5);if(L!==-1){const K=i.indexOf(p,L+1);if(K!==-1){const R=K+j,z=i.slice(L+1,K).replace(ro,""),B=Qe(z,{ambiguousIsNarrow:e.width.ambiguousIsNarrow,ansiWidth:e.width.ansi,controlWidth:e.width.control,countAnsiEscapeCodes:!1,ellipsis:e.truncation.ellipsis,ellipsisWidth:e.truncation.ellipsisWidth,emojiWidth:e.width.emoji,fullWidth:e.width.fullWidth,halfWidth:e.width.halfWidth,limit:Math.max(0,n-t),regularWidth:e.width.regular,tabWidth:e.width.tab,wideWidth:e.width.wide}),E=B.width;if(B.truncated)s=!0,h=Math.min(h,g);else if(t+E>n&&(h=Math.min(h,g),s=!0,t+E>e.truncation.limit))break;if(t+=E,g=R,s&&t>=e.truncation.limit)break;continue}}}if(ro.lastIndex=g,ro.test(i)){const p=ro.lastIndex-g,j=e.truncation.countAnsiEscapeCodes?p:e.width.ansi;if(t+j>n&&(h=Math.min(h,g),t+j>e.truncation.limit)){s=!0;break}t+=j,g=ro.lastIndex;continue}}const c=i.codePointAt(g);if(c===8203||c===65279||c>=8288&&c<=8292){g+=1;continue}if(c===9){if(t+e.width.tab>n&&(h=Math.min(h,g),t+e.width.tab>e.truncation.limit)){s=!0;break}t+=e.width.tab,g+=1;continue}if(Qo.lastIndex=g,Qo.test(i)){const p=(Qo.lastIndex-g)*e.width.regular;if(t+p>n){const j=Math.floor((n-t)/e.width.regular);if(h=Math.min(h,g+j),t+p>e.truncation.limit){s=!0;break}}t+=p,g=Qo.lastIndex;continue}if((c<=31||c>=127&&c<=159)&&(To.lastIndex=g,To.test(i))){const p=(To.lastIndex-g)*e.width.control;if(t+p>n&&(h=Math.min(h,g+Math.floor((n-t)/e.width.control)),t+p>e.truncation.limit)){s=!0;break}t+=p,g=To.lastIndex;continue}if(je.lastIndex=g,je.test(i)){if(t+e.width.emoji>n&&(h=Math.min(h,g),t+e.width.emoji>e.truncation.limit)){s=!0;break}t+=e.width.emoji,g=je.lastIndex;continue}const y=i.codePointAt(g)??0;if(mt(y)){g+=y>65535?2:1;continue}let b;if(u)b=jt(y,e);else switch(gu(y)){case"control":{b=e.width.control;break}case"latin":{b=e.width.regular;break}case"wide":{b=e.width.wide;break}case"zero":{b=0;break}default:switch(uu(y)){case"ambiguous":{b=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{b=e.width.fullWidth;break}case"wide":{b=e.width.wide;break}default:b=e.width.regular}}if(t+b>n&&(h=Math.min(h,g),t+b>e.truncation.limit)){s=!0;break}t+=b,g+=y>65535?2:1}let r=t,l=!1;return s&&e.truncation.limit>=e.truncation.ellipsisWidth&&(r=e.truncation.limit,l=!0),{ellipsed:l,index:s?h:a,truncated:s,width:r}},ft=(i,o={})=>Qe(i,{...o,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Yt=Kd(import.meta.url),vo=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=i=>{if(typeof vo<"u"&&vo.versions&&vo.versions.node){const[o,e]=vo.versions.node.split(".").map(Number);if(o>22||o===22&&e>=3||o===20&&e>=16)return vo.getBuiltinModule(i)}return Yt(i)};kt("node:util");function Lt(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var me,En;function Zt(){if(En)return me;En=1,me=o;function i(n){return n instanceof Buffer?Buffer.from(n):new n.constructor(n.buffer.slice(),n.byteOffset,n.length)}function o(n){if(n=n||{},n.circles)return e(n);const a=new Map;if(a.set(Date,s=>new Date(s)),a.set(Map,(s,v)=>new Map(g(Array.from(s),v))),a.set(Set,(s,v)=>new Set(g(Array.from(s),v))),n.constructorHandlers)for(const s of n.constructorHandlers)a.set(s[0],s[1]);let u=null;return n.proto?h:t;function g(s,v){const r=Object.keys(s),l=new Array(r.length);for(let c=0;c<r.length;c++){const y=r[c],b=s[y];typeof b!="object"||b===null?l[y]=b:b.constructor!==Object&&(u=a.get(b.constructor))?l[y]=u(b,v):ArrayBuffer.isView(b)?l[y]=i(b):l[y]=v(b)}return l}function t(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return g(s,t);if(s.constructor!==Object&&(u=a.get(s.constructor)))return u(s,t);const v={};for(const r in s){if(Object.hasOwnProperty.call(s,r)===!1)continue;const l=s[r];typeof l!="object"||l===null?v[r]=l:l.constructor!==Object&&(u=a.get(l.constructor))?v[r]=u(l,t):ArrayBuffer.isView(l)?v[r]=i(l):v[r]=t(l)}return v}function h(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return g(s,h);if(s.constructor!==Object&&(u=a.get(s.constructor)))return u(s,h);const v={};for(const r in s){const l=s[r];typeof l!="object"||l===null?v[r]=l:l.constructor!==Object&&(u=a.get(l.constructor))?v[r]=u(l,h):ArrayBuffer.isView(l)?v[r]=i(l):v[r]=h(l)}return v}}function e(n){const a=[],u=[],g=new Map;if(g.set(Date,r=>new Date(r)),g.set(Map,(r,l)=>new Map(h(Array.from(r),l))),g.set(Set,(r,l)=>new Set(h(Array.from(r),l))),n.constructorHandlers)for(const r of n.constructorHandlers)g.set(r[0],r[1]);let t=null;return n.proto?v:s;function h(r,l){const c=Object.keys(r),y=new Array(c.length);for(let b=0;b<c.length;b++){const p=c[b],j=r[p];if(typeof j!="object"||j===null)y[p]=j;else if(j.constructor!==Object&&(t=g.get(j.constructor)))y[p]=t(j,l);else if(ArrayBuffer.isView(j))y[p]=i(j);else{const L=a.indexOf(j);L!==-1?y[p]=u[L]:y[p]=l(j)}}return y}function s(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return h(r,s);if(r.constructor!==Object&&(t=g.get(r.constructor)))return t(r,s);const l={};a.push(r),u.push(l);for(const c in r){if(Object.hasOwnProperty.call(r,c)===!1)continue;const y=r[c];if(typeof y!="object"||y===null)l[c]=y;else if(y.constructor!==Object&&(t=g.get(y.constructor)))l[c]=t(y,s);else if(ArrayBuffer.isView(y))l[c]=i(y);else{const b=a.indexOf(y);b!==-1?l[c]=u[b]:l[c]=s(y)}}return a.pop(),u.pop(),l}function v(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return h(r,v);if(r.constructor!==Object&&(t=g.get(r.constructor)))return t(r,v);const l={};a.push(r),u.push(l);for(const c in r){const y=r[c];if(typeof y!="object"||y===null)l[c]=y;else if(y.constructor!==Object&&(t=g.get(y.constructor)))l[c]=t(y,v);else if(ArrayBuffer.isView(y))l[c]=i(y);else{const b=a.indexOf(y);b!==-1?l[c]=u[b]:l[c]=v(y)}}return a.pop(),u.pop(),l}}return me}var Jt=Zt();const du=Lt(Jt);du();var tu=typeof global=="object"&&global&&global.Object===Object&&global,St=typeof self=="object"&&self&&self.Object===Object&&self,P=tu||St||Function("return this")(),_=P.Symbol,hu=Object.prototype,Ct=hu.hasOwnProperty,Xt=hu.toString,lo=_?_.toStringTag:void 0;function Ht(i){var o=Ct.call(i,lo),e=i[lo];try{i[lo]=void 0;var n=!0}catch{}var a=Xt.call(i);return n&&(o?i[lo]=e:delete i[lo]),a}var Dt=Object.prototype,Tt=Dt.toString;function Qt(i){return Tt.call(i)}var Bt="[object Null]",Mt="[object Undefined]",$n=_?_.toStringTag:void 0;function q(i){return i==null?i===void 0?Mt:Bt:$n&&$n in Object(i)?Ht(i):Qt(i)}function N(i){return i!=null&&typeof i=="object"}var Gt="[object Symbol]";function ei(i){return typeof i=="symbol"||N(i)&&q(i)==Gt}var Nt=NaN;function qn(i){return typeof i=="number"?i:ei(i)?Nt:+i}function M(i,o){for(var e=-1,n=i==null?0:i.length,a=Array(n);++e<n;)a[e]=o(i[e],e,i);return a}var k=Array.isArray,In=_?_.prototype:void 0,Un=In?In.toString:void 0;function ni(i){if(typeof i=="string")return i;if(k(i))return M(i,ni)+"";if(ei(i))return Un?Un.call(i):"";var o=i+"";return o=="0"&&1/i==-1/0?"-0":o}function Eo(i,o){return function(e,n){var a;if(e===void 0&&n===void 0)return o;if(e!==void 0&&(a=e),n!==void 0){if(a===void 0)return n;typeof e=="string"||typeof n=="string"?(e=ni(e),n=ni(n)):(e=qn(e),n=qn(n)),a=i(e,n)}return a}}var Wt=Eo(function(i,o){return i+o},0),xt=/\s/;function su(i){for(var o=i.length;o--&&xt.test(i.charAt(o)););return o}var Pt=/^\s+/;function ru(i){return i&&i.slice(0,su(i)+1).replace(Pt,"")}function G(i){var o=typeof i;return i!=null&&(o=="object"||o=="function")}var Vn=NaN,Ft=/^[-+]0x[0-9a-f]+$/i,Kt=/^0b[01]+$/i,Rt=/^0o[0-7]+$/i,Ot=parseInt;function di(i){if(typeof i=="number")return i;if(ei(i))return Vn;if(G(i)){var o=typeof i.valueOf=="function"?i.valueOf():i;i=G(o)?o+"":o}if(typeof i!="string")return i===0?i:+i;i=ru(i);var e=Kt.test(i);return e||Rt.test(i)?Ot(i.slice(2),e?2:8):Ft.test(i)?Vn:+i}var ia=1/0,At=17976931348623157e292;function Li(i){if(!i)return i===0?i:0;if(i=di(i),i===ia||i===-ia){var o=i<0?-1:1;return o*At}return i===i?i:0}function Z(i){var o=Li(i),e=o%1;return o===o?e?o-e:o:0}var _t="Expected a function";function zt(i,o){if(typeof o!="function")throw new TypeError(_t);return i=Z(i),function(){if(--i<1)return o.apply(this,arguments)}}function V(i){return i}var Et="[object AsyncFunction]",$t="[object Function]",qt="[object GeneratorFunction]",It="[object Proxy]";function Zi(i){if(!G(i))return!1;var o=q(i);return o==$t||o==qt||o==Et||o==It}var Wo=P["__core-js_shared__"],oa=(function(){var i=/[^.]+$/.exec(Wo&&Wo.keys&&Wo.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function Ut(i){return!!oa&&oa in i}var Vt=Function.prototype,ih=Vt.toString;function Oi(i){if(i!=null){try{return ih.call(i)}catch{}try{return i+""}catch{}}return""}var oh=/[\\^$.*+?()[\]{}|]/g,eh=/^\[object .+?Constructor\]$/,nh=Function.prototype,ah=Object.prototype,uh=nh.toString,gh=ah.hasOwnProperty,dh=RegExp("^"+uh.call(gh).replace(oh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vu(i){if(!G(i)||Ut(i))return!1;var o=Zi(i)?dh:eh;return o.test(Oi(i))}function th(i,o){return i?.[o]}function Ai(i,o){var e=th(i,o);return vu(e)?e:void 0}var wo=Ai(P,"WeakMap"),Oo=wo&&new wo,lu=Oo?function(i,o){return Oo.set(i,o),i}:V,ea=Object.create,oo=(function(){function i(){}return function(o){if(!G(o))return{};if(ea)return ea(o);i.prototype=o;var e=new i;return i.prototype=void 0,e}})();function jo(i){return function(){var o=arguments;switch(o.length){case 0:return new i;case 1:return new i(o[0]);case 2:return new i(o[0],o[1]);case 3:return new i(o[0],o[1],o[2]);case 4:return new i(o[0],o[1],o[2],o[3]);case 5:return new i(o[0],o[1],o[2],o[3],o[4]);case 6:return new i(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new i(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var e=oo(i.prototype),n=i.apply(e,o);return G(n)?n:e}}var hh=1;function sh(i,o,e){var n=o&hh,a=jo(i);function u(){var g=this&&this!==P&&this instanceof u?a:i;return g.apply(n?e:this,arguments)}return u}function ai(i,o,e){switch(e.length){case 0:return i.call(o);case 1:return i.call(o,e[0]);case 2:return i.call(o,e[0],e[1]);case 3:return i.call(o,e[0],e[1],e[2])}return i.apply(o,e)}var rh=Math.max;function yu(i,o,e,n){for(var a=-1,u=i.length,g=e.length,t=-1,h=o.length,s=rh(u-g,0),v=Array(h+s),r=!n;++t<h;)v[t]=o[t];for(;++a<g;)(r||a<u)&&(v[e[a]]=i[a]);for(;s--;)v[t++]=i[a++];return v}var vh=Math.max;function cu(i,o,e,n){for(var a=-1,u=i.length,g=-1,t=e.length,h=-1,s=o.length,v=vh(u-t,0),r=Array(v+s),l=!n;++a<v;)r[a]=i[a];for(var c=a;++h<s;)r[c+h]=o[h];for(;++g<t;)(l||a<u)&&(r[c+e[g]]=i[a++]);return r}function lh(i,o){for(var e=i.length,n=0;e--;)i[e]===o&&++n;return n}function $o(){}var yh=4294967295;function S(i){this.__wrapped__=i,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=yh,this.__views__=[]}S.prototype=oo($o.prototype);S.prototype.constructor=S;function $e(){}var qe=Oo?function(i){return Oo.get(i)}:$e,Ii={},ch=Object.prototype,bh=ch.hasOwnProperty;function xo(i){for(var o=i.name+"",e=Ii[o],n=bh.call(Ii,o)?e.length:0;n--;){var a=e[n],u=a.func;if(u==null||u==i)return a.name}return o}function hi(i,o){this.__wrapped__=i,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=void 0}hi.prototype=oo($o.prototype);hi.prototype.constructor=hi;function U(i,o){var e=-1,n=i.length;for(o||(o=Array(n));++e<n;)o[e]=i[e];return o}function bu(i){if(i instanceof S)return i.clone();var o=new hi(i.__wrapped__,i.__chain__);return o.__actions__=U(i.__actions__),o.__index__=i.__index__,o.__values__=i.__values__,o}var ph=Object.prototype,wh=ph.hasOwnProperty;function d(i){if(N(i)&&!k(i)&&!(i instanceof S)){if(i instanceof hi)return i;if(wh.call(i,"__wrapped__"))return bu(i)}return new hi(i)}d.prototype=$o.prototype;d.prototype.constructor=d;function Be(i){var o=xo(i),e=d[o];if(typeof e!="function"||!(o in S.prototype))return!1;if(i===e)return!0;var n=qe(e);return!!n&&i===n[0]}var jh=800,mh=16,fh=Date.now;function pu(i){var o=0,e=0;return function(){var n=fh(),a=mh-(n-e);if(e=n,a>0){if(++o>=jh)return arguments[0]}else o=0;return i.apply(void 0,arguments)}}var wu=pu(lu),Yh=/\{\n\/\* \[wrapped with (.+)\] \*/,kh=/,? & /;function Lh(i){var o=i.match(Yh);return o?o[1].split(kh):[]}var Zh=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function Jh(i,o){var e=o.length;if(!e)return i;var n=e-1;return o[n]=(e>1?"& ":"")+o[n],o=o.join(e>2?", ":" "),i.replace(Zh,`{
2
2
  /* [wrapped with `+o+`] */
3
3
  `)}function Ie(i){return function(){return i}}var Ao=(function(){try{var i=Ai(Object,"defineProperty");return i({},"",{}),i}catch{}})(),Sh=Ao?function(i,o){return Ao(i,"toString",{configurable:!0,enumerable:!1,value:Ie(o),writable:!0})}:V,Ue=pu(Sh);function gi(i,o){for(var e=-1,n=i==null?0:i.length;++e<n&&o(i[e],e,i)!==!1;);return i}function qo(i,o,e,n){for(var a=i.length,u=e+(n?1:-1);n?u--:++u<a;)if(o(i[u],u,i))return u;return-1}function ju(i){return i!==i}function Ch(i,o,e){for(var n=e-1,a=i.length;++n<a;)if(i[n]===o)return n;return-1}function eo(i,o,e){return o===o?Ch(i,o,e):qo(i,ju,e)}function Io(i,o){var e=i==null?0:i.length;return!!e&&eo(i,o,0)>-1}var Xh=1,Hh=2,Dh=8,Th=16,Qh=32,Bh=64,Mh=128,Gh=256,Nh=512,Wh=[["ary",Mh],["bind",Xh],["bindKey",Hh],["curry",Dh],["curryRight",Th],["flip",Nh],["partial",Qh],["partialRight",Bh],["rearg",Gh]];function xh(i,o){return gi(Wh,function(e){var n="_."+e[0];o&e[1]&&!Io(i,n)&&i.push(n)}),i.sort()}function mu(i,o,e){var n=o+"";return Ue(i,Jh(n,xh(Lh(n),e)))}var Ph=4,Fh=8,na=32,aa=64;function fu(i,o,e,n,a,u,g,t,h,s){var v=o&Fh,r=v?g:void 0,l=v?void 0:g,c=v?u:void 0,y=v?void 0:u;o|=v?na:aa,o&=~(v?aa:na),o&Ph||(o&=-4);var b=[i,o,a,c,r,y,l,t,h,s],p=e.apply(void 0,b);return Be(i)&&wu(p,b),p.placeholder=n,mu(p,i,o)}function no(i){var o=i;return o.placeholder}var Kh=9007199254740991,Rh=/^(?:0|[1-9]\d*)$/;function Ji(i,o){var e=typeof i;return o=o??Kh,!!o&&(e=="number"||e!="symbol"&&Rh.test(i))&&i>-1&&i%1==0&&i<o}var Oh=Math.min;function Ah(i,o){for(var e=i.length,n=Oh(o.length,e),a=U(i);n--;){var u=o[n];i[n]=Ji(u,e)?a[u]:void 0}return i}var ua="__lodash_placeholder__";function Di(i,o){for(var e=-1,n=i.length,a=0,u=[];++e<n;){var g=i[e];(g===o||g===ua)&&(i[e]=ua,u[a++]=e)}return u}var _h=1,zh=2,Eh=8,$h=16,qh=128,Ih=512;function Uo(i,o,e,n,a,u,g,t,h,s){var v=o&qh,r=o&_h,l=o&zh,c=o&(Eh|$h),y=o&Ih,b=l?void 0:jo(i);function p(){for(var j=arguments.length,L=Array(j),K=j;K--;)L[K]=arguments[K];if(c)var R=no(p),z=lh(L,R);if(n&&(L=yu(L,n,a,c)),u&&(L=cu(L,u,g,c)),j-=z,c&&j<s){var B=Di(L,R);return fu(i,o,Uo,p.placeholder,e,L,B,t,h,s-j)}var E=r?e:this,ki=l?E[i]:i;return j=L.length,t?L=Ah(L,t):y&&j>1&&L.reverse(),v&&h<j&&(L.length=h),this&&this!==P&&this instanceof p&&(ki=b||jo(ki)),ki.apply(E,L)}return p}function Uh(i,o,e){var n=jo(i);function a(){for(var u=arguments.length,g=Array(u),t=u,h=no(a);t--;)g[t]=arguments[t];var s=u<3&&g[0]!==h&&g[u-1]!==h?[]:Di(g,h);if(u-=s.length,u<e)return fu(i,o,Uo,a.placeholder,void 0,g,s,void 0,void 0,e-u);var v=this&&this!==P&&this instanceof a?n:i;return ai(v,this,g)}return a}var Vh=1;function is(i,o,e,n){var a=o&Vh,u=jo(i);function g(){for(var t=-1,h=arguments.length,s=-1,v=n.length,r=Array(v+h),l=this&&this!==P&&this instanceof g?u:i;++s<v;)r[s]=n[s];for(;h--;)r[s++]=arguments[++t];return ai(l,a?e:this,r)}return g}var ga="__lodash_placeholder__",fe=1,os=2,es=4,da=8,yo=128,ta=256,ns=Math.min;function as(i,o){var e=i[1],n=o[1],a=e|n,u=a<(fe|os|yo),g=n==yo&&e==da||n==yo&&e==ta&&i[7].length<=o[8]||n==(yo|ta)&&o[7].length<=o[8]&&e==da;if(!(u||g))return i;n&fe&&(i[2]=o[2],a|=e&fe?0:es);var t=o[3];if(t){var h=i[3];i[3]=h?yu(h,t,o[4]):t,i[4]=h?Di(i[3],ga):o[4]}return t=o[5],t&&(h=i[5],i[5]=h?cu(h,t,o[6]):t,i[6]=h?Di(i[5],ga):o[6]),t=o[7],t&&(i[7]=t),n&yo&&(i[8]=i[8]==null?o[8]:ns(i[8],o[8])),i[9]==null&&(i[9]=o[9]),i[0]=o[0],i[1]=a,i}var us="Expected a function",ha=1,gs=2,sa=8,ra=16,va=32,ds=64,la=Math.max;function Si(i,o,e,n,a,u,g,t){var h=o&gs;if(!h&&typeof i!="function")throw new TypeError(us);var s=n?n.length:0;if(s||(o&=-97,n=a=void 0),g=g===void 0?g:la(Z(g),0),t=t===void 0?t:Z(t),s-=a?a.length:0,o&ds){var v=n,r=a;n=a=void 0}var l=h?void 0:qe(i),c=[i,o,e,n,a,v,r,u,g,t];if(l&&as(c,l),i=c[0],o=c[1],e=c[2],n=c[3],a=c[4],t=c[9]=c[9]===void 0?h?0:i.length:la(c[9]-s,0),!t&&o&(sa|ra)&&(o&=-25),!o||o==ha)var y=sh(i,o,e);else o==sa||o==ra?y=Uh(i,o,t):(o==va||o==(ha|va))&&!a.length?y=is(i,o,e,n):y=Uo.apply(void 0,c);var b=l?lu:wu;return mu(b(y,c),i,o)}var ts=128;function Yu(i,o,e){return o=e?void 0:o,o=i&&o==null?i.length:o,Si(i,ts,void 0,void 0,void 0,void 0,o)}function wi(i,o,e){o=="__proto__"&&Ao?Ao(i,o,{configurable:!0,enumerable:!0,value:e,writable:!0}):i[o]=e}function bi(i,o){return i===o||i!==i&&o!==o}var hs=Object.prototype,ss=hs.hasOwnProperty;function Zo(i,o,e){var n=i[o];(!(ss.call(i,o)&&bi(n,e))||e===void 0&&!(o in i))&&wi(i,o,e)}function ji(i,o,e,n){var a=!e;e||(e={});for(var u=-1,g=o.length;++u<g;){var t=o[u],h=n?n(e[t],i[t],t,e,i):void 0;h===void 0&&(h=i[t]),a?wi(e,t,h):Zo(e,t,h)}return e}var ya=Math.max;function ku(i,o,e){return o=ya(o===void 0?i.length-1:o,0),function(){for(var n=arguments,a=-1,u=ya(n.length-o,0),g=Array(u);++a<u;)g[a]=n[o+a];a=-1;for(var t=Array(o+1);++a<o;)t[a]=n[a];return t[o]=e(g),ai(i,this,t)}}function J(i,o){return Ue(ku(i,o,V),i+"")}var rs=9007199254740991;function Vo(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=rs}function ii(i){return i!=null&&Vo(i.length)&&!Zi(i)}function $(i,o,e){if(!G(e))return!1;var n=typeof o;return(n=="number"?ii(e)&&Ji(o,e.length):n=="string"&&o in e)?bi(e[o],i):!1}function ao(i){return J(function(o,e){var n=-1,a=e.length,u=a>1?e[a-1]:void 0,g=a>2?e[2]:void 0;for(u=i.length>3&&typeof u=="function"?(a--,u):void 0,g&&$(e[0],e[1],g)&&(u=a<3?void 0:u,a=1),o=Object(o);++n<a;){var t=e[n];t&&i(o,t,n,u)}return o})}var vs=Object.prototype;function Jo(i){var o=i&&i.constructor,e=typeof o=="function"&&o.prototype||vs;return i===e}function Ve(i,o){for(var e=-1,n=Array(i);++e<i;)n[e]=o(e);return n}var ls="[object Arguments]";function ca(i){return N(i)&&q(i)==ls}var Lu=Object.prototype,ys=Lu.hasOwnProperty,cs=Lu.propertyIsEnumerable,Fi=ca((function(){return arguments})())?ca:function(i){return N(i)&&ys.call(i,"callee")&&!cs.call(i,"callee")};function on(){return!1}var Zu=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ba=Zu&&typeof module=="object"&&module&&!module.nodeType&&module,bs=ba&&ba.exports===Zu,pa=bs?P.Buffer:void 0,ps=pa?pa.isBuffer:void 0,Ti=ps||on,ws="[object Arguments]",js="[object Array]",ms="[object Boolean]",fs="[object Date]",Ys="[object Error]",ks="[object Function]",Ls="[object Map]",Zs="[object Number]",Js="[object Object]",Ss="[object RegExp]",Cs="[object Set]",Xs="[object String]",Hs="[object WeakMap]",Ds="[object ArrayBuffer]",Ts="[object DataView]",Qs="[object Float32Array]",Bs="[object Float64Array]",Ms="[object Int8Array]",Gs="[object Int16Array]",Ns="[object Int32Array]",Ws="[object Uint8Array]",xs="[object Uint8ClampedArray]",Ps="[object Uint16Array]",Fs="[object Uint32Array]",Q={};Q[Qs]=Q[Bs]=Q[Ms]=Q[Gs]=Q[Ns]=Q[Ws]=Q[xs]=Q[Ps]=Q[Fs]=!0;Q[ws]=Q[js]=Q[Ds]=Q[ms]=Q[Ts]=Q[fs]=Q[Ys]=Q[ks]=Q[Ls]=Q[Zs]=Q[Js]=Q[Ss]=Q[Cs]=Q[Xs]=Q[Hs]=!1;function Ks(i){return N(i)&&Vo(i.length)&&!!Q[q(i)]}function ui(i){return function(o){return i(o)}}var Ju=typeof exports=="object"&&exports&&!exports.nodeType&&exports,po=Ju&&typeof module=="object"&&module&&!module.nodeType&&module,Rs=po&&po.exports===Ju,Ye=Rs&&tu.process,si=(function(){try{var i=po&&po.require&&po.require("util").types;return i||Ye&&Ye.binding&&Ye.binding("util")}catch{}})(),wa=si&&si.isTypedArray,uo=wa?ui(wa):Ks,Os=Object.prototype,As=Os.hasOwnProperty;function Su(i,o){var e=k(i),n=!e&&Fi(i),a=!e&&!n&&Ti(i),u=!e&&!n&&!a&&uo(i),g=e||n||a||u,t=g?Ve(i.length,String):[],h=t.length;for(var s in i)(o||As.call(i,s))&&!(g&&(s=="length"||a&&(s=="offset"||s=="parent")||u&&(s=="buffer"||s=="byteLength"||s=="byteOffset")||Ji(s,h)))&&t.push(s);return t}function Cu(i,o){return function(e){return i(o(e))}}var _s=Cu(Object.keys,Object),zs=Object.prototype,Es=zs.hasOwnProperty;function en(i){if(!Jo(i))return _s(i);var o=[];for(var e in Object(i))Es.call(i,e)&&e!="constructor"&&o.push(e);return o}function F(i){return ii(i)?Su(i):en(i)}var $s=Object.prototype,qs=$s.hasOwnProperty,Is=ao(function(i,o){if(Jo(o)||ii(o)){ji(o,F(o),i);return}for(var e in o)qs.call(o,e)&&Zo(i,e,o[e])});function Us(i){var o=[];if(i!=null)for(var e in Object(i))o.push(e);return o}var Vs=Object.prototype,ir=Vs.hasOwnProperty;function or(i){if(!G(i))return Us(i);var o=Jo(i),e=[];for(var n in i)n=="constructor"&&(o||!ir.call(i,n))||e.push(n);return e}function oi(i){return ii(i)?Su(i,!0):or(i)}var er=ao(function(i,o){ji(o,oi(o),i)}),nr=ao(function(i,o,e,n){ji(o,oi(o),i,n)}),Me=ao(function(i,o,e,n){ji(o,F(o),i,n)}),ar=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ur=/^\w*$/;function nn(i,o){if(k(i))return!1;var e=typeof i;return e=="number"||e=="symbol"||e=="boolean"||i==null||ei(i)?!0:ur.test(i)||!ar.test(i)||o!=null&&i in Object(o)}var mo=Ai(Object,"create");function gr(){this.__data__=mo?mo(null):{},this.size=0}function dr(i){var o=this.has(i)&&delete this.__data__[i];return this.size-=o?1:0,o}var tr="__lodash_hash_undefined__",hr=Object.prototype,sr=hr.hasOwnProperty;function rr(i){var o=this.__data__;if(mo){var e=o[i];return e===tr?void 0:e}return sr.call(o,i)?o[i]:void 0}var vr=Object.prototype,lr=vr.hasOwnProperty;function yr(i){var o=this.__data__;return mo?o[i]!==void 0:lr.call(o,i)}var cr="__lodash_hash_undefined__";function br(i,o){var e=this.__data__;return this.size+=this.has(i)?0:1,e[i]=mo&&o===void 0?cr:o,this}function Ki(i){var o=-1,e=i==null?0:i.length;for(this.clear();++o<e;){var n=i[o];this.set(n[0],n[1])}}Ki.prototype.clear=gr;Ki.prototype.delete=dr;Ki.prototype.get=rr;Ki.prototype.has=yr;Ki.prototype.set=br;function pr(){this.__data__=[],this.size=0}function ie(i,o){for(var e=i.length;e--;)if(bi(i[e][0],o))return e;return-1}var wr=Array.prototype,jr=wr.splice;function mr(i){var o=this.__data__,e=ie(o,i);if(e<0)return!1;var n=o.length-1;return e==n?o.pop():jr.call(o,e,1),--this.size,!0}function fr(i){var o=this.__data__,e=ie(o,i);return e<0?void 0:o[e][1]}function Yr(i){return ie(this.__data__,i)>-1}function kr(i,o){var e=this.__data__,n=ie(e,i);return n<0?(++this.size,e.push([i,o])):e[n][1]=o,this}function Ci(i){var o=-1,e=i==null?0:i.length;for(this.clear();++o<e;){var n=i[o];this.set(n[0],n[1])}}Ci.prototype.clear=pr;Ci.prototype.delete=mr;Ci.prototype.get=fr;Ci.prototype.has=Yr;Ci.prototype.set=kr;var fo=Ai(P,"Map");function Lr(){this.size=0,this.__data__={hash:new Ki,map:new(fo||Ci),string:new Ki}}function Zr(i){var o=typeof i;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?i!=="__proto__":i===null}function oe(i,o){var e=i.__data__;return Zr(o)?e[typeof o=="string"?"string":"hash"]:e.map}function Jr(i){var o=oe(this,i).delete(i);return this.size-=o?1:0,o}function Sr(i){return oe(this,i).get(i)}function Cr(i){return oe(this,i).has(i)}function Xr(i,o){var e=oe(this,i),n=e.size;return e.set(i,o),this.size+=e.size==n?0:1,this}function Xi(i){var o=-1,e=i==null?0:i.length;for(this.clear();++o<e;){var n=i[o];this.set(n[0],n[1])}}Xi.prototype.clear=Lr;Xi.prototype.delete=Jr;Xi.prototype.get=Sr;Xi.prototype.has=Cr;Xi.prototype.set=Xr;var Hr="Expected a function";function ee(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new TypeError(Hr);var e=function(){var n=arguments,a=o?o.apply(this,n):n[0],u=e.cache;if(u.has(a))return u.get(a);var g=i.apply(this,n);return e.cache=u.set(a,g)||u,g};return e.cache=new(ee.Cache||Xi),e}ee.Cache=Xi;var Dr=500;function Tr(i){var o=ee(i,function(n){return e.size===Dr&&e.clear(),n}),e=o.cache;return o}var Qr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Br=/\\(\\)?/g,Xu=Tr(function(i){var o=[];return i.charCodeAt(0)===46&&o.push(""),i.replace(Qr,function(e,n,a,u){o.push(a?u.replace(Br,"$1"):n||e)}),o});function X(i){return i==null?"":ni(i)}function Bi(i,o){return k(i)?i:nn(i,o)?[i]:Xu(X(i))}function yi(i){if(typeof i=="string"||ei(i))return i;var o=i+"";return o=="0"&&1/i==-1/0?"-0":o}function _i(i,o){o=Bi(o,i);for(var e=0,n=o.length;i!=null&&e<n;)i=i[yi(o[e++])];return e&&e==n?i:void 0}function an(i,o,e){var n=i==null?void 0:_i(i,o);return n===void 0?e:n}function un(i,o){for(var e=-1,n=o.length,a=Array(n),u=i==null;++e<n;)a[e]=u?void 0:an(i,o[e]);return a}function Mi(i,o){for(var e=-1,n=o.length,a=i.length;++e<n;)i[a+e]=o[e];return i}var ja=_?_.isConcatSpreadable:void 0;function Mr(i){return k(i)||Fi(i)||!!(ja&&i&&i[ja])}function A(i,o,e,n,a){var u=-1,g=i.length;for(e||(e=Mr),a||(a=[]);++u<g;){var t=i[u];o>0&&e(t)?o>1?A(t,o-1,e,n,a):Mi(a,t):n||(a[a.length]=t)}return a}function Hu(i){var o=i==null?0:i.length;return o?A(i,1):[]}function Hi(i){return Ue(ku(i,void 0,Hu),i+"")}var Gr=Hi(un),ne=Cu(Object.getPrototypeOf,Object),Nr="[object Object]",Wr=Function.prototype,xr=Object.prototype,Du=Wr.toString,Pr=xr.hasOwnProperty,Fr=Du.call(Object);function So(i){if(!N(i)||q(i)!=Nr)return!1;var o=ne(i);if(o===null)return!0;var e=Pr.call(o,"constructor")&&o.constructor;return typeof e=="function"&&e instanceof e&&Du.call(e)==Fr}var Kr="[object DOMException]",Rr="[object Error]";function gn(i){if(!N(i))return!1;var o=q(i);return o==Rr||o==Kr||typeof i.message=="string"&&typeof i.name=="string"&&!So(i)}var Tu=J(function(i,o){try{return ai(i,void 0,o)}catch(e){return gn(e)?e:new Error(e)}}),Or="Expected a function";function Qu(i,o){var e;if(typeof o!="function")throw new TypeError(Or);return i=Z(i),function(){return--i>0&&(e=o.apply(this,arguments)),i<=1&&(o=void 0),e}}var Ar=1,_r=32,ae=J(function(i,o,e){var n=Ar;if(e.length){var a=Di(e,no(ae));n|=_r}return Si(i,n,o,e,a)});ae.placeholder={};var zr=Hi(function(i,o){return gi(o,function(e){e=yi(e),wi(i,e,ae(i[e],i))}),i}),Er=1,$r=2,qr=32,dn=J(function(i,o,e){var n=Er|$r;if(e.length){var a=Di(e,no(dn));n|=qr}return Si(o,n,i,e,a)});dn.placeholder={};function ri(i,o,e){var n=-1,a=i.length;o<0&&(o=-o>a?0:a+o),e=e>a?a:e,e<0&&(e+=a),a=o>e?0:e-o>>>0,o>>>=0;for(var u=Array(a);++n<a;)u[n]=i[n+o];return u}function Gi(i,o,e){var n=i.length;return e=e===void 0?n:e,!o&&e>=n?i:ri(i,o,e)}var Ir="\\ud800-\\udfff",Ur="\\u0300-\\u036f",Vr="\\ufe20-\\ufe2f",iv="\\u20d0-\\u20ff",ov=Ur+Vr+iv,ev="\\ufe0e\\ufe0f",nv="\\u200d",av=RegExp("["+nv+Ir+ov+ev+"]");function go(i){return av.test(i)}function uv(i){return i.split("")}var Bu="\\ud800-\\udfff",gv="\\u0300-\\u036f",dv="\\ufe20-\\ufe2f",tv="\\u20d0-\\u20ff",hv=gv+dv+tv,sv="\\ufe0e\\ufe0f",rv="["+Bu+"]",Ge="["+hv+"]",Ne="\\ud83c[\\udffb-\\udfff]",vv="(?:"+Ge+"|"+Ne+")",Mu="[^"+Bu+"]",Gu="(?:\\ud83c[\\udde6-\\uddff]){2}",Nu="[\\ud800-\\udbff][\\udc00-\\udfff]",lv="\\u200d",Wu=vv+"?",xu="["+sv+"]?",yv="(?:"+lv+"(?:"+[Mu,Gu,Nu].join("|")+")"+xu+Wu+")*",cv=xu+Wu+yv,bv="(?:"+[Mu+Ge+"?",Ge,Gu,Nu,rv].join("|")+")",pv=RegExp(Ne+"(?="+Ne+")|"+bv+cv,"g");function wv(i){return i.match(pv)||[]}function ci(i){return go(i)?wv(i):uv(i)}function Pu(i){return function(o){o=X(o);var e=go(o)?ci(o):void 0,n=e?e[0]:o.charAt(0),a=e?Gi(e,1).join(""):o.slice(1);return n[i]()+a}}var tn=Pu("toUpperCase");function Fu(i){return tn(X(i).toLowerCase())}function hn(i,o,e,n){var a=-1,u=i==null?0:i.length;for(n&&u&&(e=i[++a]);++a<u;)e=o(e,i[a],a,i);return e}function sn(i){return function(o){return i?.[o]}}var jv={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},mv=sn(jv),fv=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Yv="\\u0300-\\u036f",kv="\\ufe20-\\ufe2f",Lv="\\u20d0-\\u20ff",Zv=Yv+kv+Lv,Jv="["+Zv+"]",Sv=RegExp(Jv,"g");function Ku(i){return i=X(i),i&&i.replace(fv,mv).replace(Sv,"")}var Cv=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Xv(i){return i.match(Cv)||[]}var Hv=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Dv(i){return Hv.test(i)}var Ru="\\ud800-\\udfff",Tv="\\u0300-\\u036f",Qv="\\ufe20-\\ufe2f",Bv="\\u20d0-\\u20ff",Mv=Tv+Qv+Bv,Ou="\\u2700-\\u27bf",Au="a-z\\xdf-\\xf6\\xf8-\\xff",Gv="\\xac\\xb1\\xd7\\xf7",Nv="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Wv="\\u2000-\\u206f",xv=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",_u="A-Z\\xc0-\\xd6\\xd8-\\xde",Pv="\\ufe0e\\ufe0f",zu=Gv+Nv+Wv+xv,Eu="['’]",ma="["+zu+"]",Fv="["+Mv+"]",$u="\\d+",Kv="["+Ou+"]",qu="["+Au+"]",Iu="[^"+Ru+zu+$u+Ou+Au+_u+"]",Rv="\\ud83c[\\udffb-\\udfff]",Ov="(?:"+Fv+"|"+Rv+")",Av="[^"+Ru+"]",Uu="(?:\\ud83c[\\udde6-\\uddff]){2}",Vu="[\\ud800-\\udbff][\\udc00-\\udfff]",$i="["+_u+"]",_v="\\u200d",fa="(?:"+qu+"|"+Iu+")",zv="(?:"+$i+"|"+Iu+")",Ya="(?:"+Eu+"(?:d|ll|m|re|s|t|ve))?",ka="(?:"+Eu+"(?:D|LL|M|RE|S|T|VE))?",ig=Ov+"?",og="["+Pv+"]?",Ev="(?:"+_v+"(?:"+[Av,Uu,Vu].join("|")+")"+og+ig+")*",$v="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",qv="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Iv=og+ig+Ev,Uv="(?:"+[Kv,Uu,Vu].join("|")+")"+Iv,Vv=RegExp([$i+"?"+qu+"+"+Ya+"(?="+[ma,$i,"$"].join("|")+")",zv+"+"+ka+"(?="+[ma,$i+fa,"$"].join("|")+")",$i+"?"+fa+"+"+Ya,$i+"+"+ka,qv,$v,$u,Uv].join("|"),"g");function il(i){return i.match(Vv)||[]}function eg(i,o,e){return i=X(i),o=e?void 0:o,o===void 0?Dv(i)?il(i):Xv(i):i.match(o)||[]}var ol="['’]",el=RegExp(ol,"g");function to(i){return function(o){return hn(eg(Ku(o).replace(el,"")),i,"")}}var nl=to(function(i,o,e){return o=o.toLowerCase(),i+(e?Fu(o):o)});function al(){if(!arguments.length)return[];var i=arguments[0];return k(i)?i:[i]}var ul=P.isFinite,gl=Math.min;function rn(i){var o=Math[i];return function(e,n){if(e=di(e),n=n==null?0:gl(Z(n),292),n&&ul(e)){var a=(X(e)+"e").split("e"),u=o(a[0]+"e"+(+a[1]+n));return a=(X(u)+"e").split("e"),+(a[0]+"e"+(+a[1]-n))}return o(e)}}var dl=rn("ceil");function ng(i){var o=d(i);return o.__chain__=!0,o}var tl=Math.ceil,hl=Math.max;function sl(i,o,e){(e?$(i,o,e):o===void 0)?o=1:o=hl(Z(o),0);var n=i==null?0:i.length;if(!n||o<1)return[];for(var a=0,u=0,g=Array(tl(n/o));a<n;)g[u++]=ri(i,a,a+=o);return g}function zi(i,o,e){return i===i&&(e!==void 0&&(i=i<=e?i:e),o!==void 0&&(i=i>=o?i:o)),i}function rl(i,o,e){return e===void 0&&(e=o,o=void 0),e!==void 0&&(e=di(e),e=e===e?e:0),o!==void 0&&(o=di(o),o=o===o?o:0),zi(di(i),o,e)}function vl(){this.__data__=new Ci,this.size=0}function ll(i){var o=this.__data__,e=o.delete(i);return this.size=o.size,e}function yl(i){return this.__data__.get(i)}function cl(i){return this.__data__.has(i)}var bl=200;function pl(i,o){var e=this.__data__;if(e instanceof Ci){var n=e.__data__;if(!fo||n.length<bl-1)return n.push([i,o]),this.size=++e.size,this;e=this.__data__=new Xi(n)}return e.set(i,o),this.size=e.size,this}function li(i){var o=this.__data__=new Ci(i);this.size=o.size}li.prototype.clear=vl;li.prototype.delete=ll;li.prototype.get=yl;li.prototype.has=cl;li.prototype.set=pl;function ag(i,o){return i&&ji(o,F(o),i)}function wl(i,o){return i&&ji(o,oi(o),i)}var ug=typeof exports=="object"&&exports&&!exports.nodeType&&exports,La=ug&&typeof module=="object"&&module&&!module.nodeType&&module,jl=La&&La.exports===ug,Za=jl?P.Buffer:void 0,Ja=Za?Za.allocUnsafe:void 0;function gg(i,o){if(o)return i.slice();var e=i.length,n=Ja?Ja(e):new i.constructor(e);return i.copy(n),n}function Ni(i,o){for(var e=-1,n=i==null?0:i.length,a=0,u=[];++e<n;){var g=i[e];o(g,e,i)&&(u[a++]=g)}return u}function vn(){return[]}var ml=Object.prototype,fl=ml.propertyIsEnumerable,Sa=Object.getOwnPropertySymbols,ln=Sa?function(i){return i==null?[]:(i=Object(i),Ni(Sa(i),function(o){return fl.call(i,o)}))}:vn;function Yl(i,o){return ji(i,ln(i),o)}var kl=Object.getOwnPropertySymbols,dg=kl?function(i){for(var o=[];i;)Mi(o,ln(i)),i=ne(i);return o}:vn;function Ll(i,o){return ji(i,dg(i),o)}function tg(i,o,e){var n=o(i);return k(i)?n:Mi(n,e(i))}function We(i){return tg(i,F,ln)}function yn(i){return tg(i,oi,dg)}var xe=Ai(P,"DataView"),Pe=Ai(P,"Promise"),Ui=Ai(P,"Set"),Ca="[object Map]",Zl="[object Object]",Xa="[object Promise]",Ha="[object Set]",Da="[object WeakMap]",Ta="[object DataView]",Jl=Oi(xe),Sl=Oi(fo),Cl=Oi(Pe),Xl=Oi(Ui),Hl=Oi(wo),xi=q;(xe&&xi(new xe(new ArrayBuffer(1)))!=Ta||fo&&xi(new fo)!=Ca||Pe&&xi(Pe.resolve())!=Xa||Ui&&xi(new Ui)!=Ha||wo&&xi(new wo)!=Da)&&(xi=function(i){var o=q(i),e=o==Zl?i.constructor:void 0,n=e?Oi(e):"";if(n)switch(n){case Jl:return Ta;case Sl:return Ca;case Cl:return Xa;case Xl:return Ha;case Hl:return Da}return o});const pi=xi;var Dl=Object.prototype,Tl=Dl.hasOwnProperty;function Ql(i){var o=i.length,e=new i.constructor(o);return o&&typeof i[0]=="string"&&Tl.call(i,"index")&&(e.index=i.index,e.input=i.input),e}var _o=P.Uint8Array;function cn(i){var o=new i.constructor(i.byteLength);return new _o(o).set(new _o(i)),o}function Bl(i,o){var e=o?cn(i.buffer):i.buffer;return new i.constructor(e,i.byteOffset,i.byteLength)}var Ml=/\w*$/;function Gl(i){var o=new i.constructor(i.source,Ml.exec(i));return o.lastIndex=i.lastIndex,o}var Qa=_?_.prototype:void 0,Ba=Qa?Qa.valueOf:void 0;function Nl(i){return Ba?Object(Ba.call(i)):{}}function hg(i,o){var e=o?cn(i.buffer):i.buffer;return new i.constructor(e,i.byteOffset,i.length)}var Wl="[object Boolean]",xl="[object Date]",Pl="[object Map]",Fl="[object Number]",Kl="[object RegExp]",Rl="[object Set]",Ol="[object String]",Al="[object Symbol]",_l="[object ArrayBuffer]",zl="[object DataView]",El="[object Float32Array]",$l="[object Float64Array]",ql="[object Int8Array]",Il="[object Int16Array]",Ul="[object Int32Array]",Vl="[object Uint8Array]",i0="[object Uint8ClampedArray]",o0="[object Uint16Array]",e0="[object Uint32Array]";function n0(i,o,e){var n=i.constructor;switch(o){case _l:return cn(i);case Wl:case xl:return new n(+i);case zl:return Bl(i,e);case El:case $l:case ql:case Il:case Ul:case Vl:case i0:case o0:case e0:return hg(i,e);case Pl:return new n;case Fl:case Ol:return new n(i);case Kl:return Gl(i);case Rl:return new n;case Al:return Nl(i)}}function sg(i){return typeof i.constructor=="function"&&!Jo(i)?oo(ne(i)):{}}var a0="[object Map]";function u0(i){return N(i)&&pi(i)==a0}var Ma=si&&si.isMap,rg=Ma?ui(Ma):u0,g0="[object Set]";function d0(i){return N(i)&&pi(i)==g0}var Ga=si&&si.isSet,vg=Ga?ui(Ga):d0,t0=1,h0=2,s0=4,lg="[object Arguments]",r0="[object Array]",v0="[object Boolean]",l0="[object Date]",y0="[object Error]",yg="[object Function]",c0="[object GeneratorFunction]",b0="[object Map]",p0="[object Number]",cg="[object Object]",w0="[object RegExp]",j0="[object Set]",m0="[object String]",f0="[object Symbol]",Y0="[object WeakMap]",k0="[object ArrayBuffer]",L0="[object DataView]",Z0="[object Float32Array]",J0="[object Float64Array]",S0="[object Int8Array]",C0="[object Int16Array]",X0="[object Int32Array]",H0="[object Uint8Array]",D0="[object Uint8ClampedArray]",T0="[object Uint16Array]",Q0="[object Uint32Array]",T={};T[lg]=T[r0]=T[k0]=T[L0]=T[v0]=T[l0]=T[Z0]=T[J0]=T[S0]=T[C0]=T[X0]=T[b0]=T[p0]=T[cg]=T[w0]=T[j0]=T[m0]=T[f0]=T[H0]=T[D0]=T[T0]=T[Q0]=!0;T[y0]=T[yg]=T[Y0]=!1;function ti(i,o,e,n,a,u){var g,t=o&t0,h=o&h0,s=o&s0;if(e&&(g=a?e(i,n,a,u):e(i)),g!==void 0)return g;if(!G(i))return i;var v=k(i);if(v){if(g=Ql(i),!t)return U(i,g)}else{var r=pi(i),l=r==yg||r==c0;if(Ti(i))return gg(i,t);if(r==cg||r==lg||l&&!a){if(g=h||l?{}:sg(i),!t)return h?Ll(i,wl(g,i)):Yl(i,ag(g,i))}else{if(!T[r])return a?i:{};g=n0(i,r,t)}}u||(u=new li);var c=u.get(i);if(c)return c;u.set(i,g),vg(i)?i.forEach(function(p){g.add(ti(p,o,e,p,i,u))}):rg(i)&&i.forEach(function(p,j){g.set(j,ti(p,o,e,j,i,u))});var y=s?h?yn:We:h?oi:F,b=v?void 0:y(i);return gi(b||i,function(p,j){b&&(j=p,p=i[j]),Zo(g,j,ti(p,o,e,j,i,u))}),g}var B0=4;function M0(i){return ti(i,B0)}var G0=1,N0=4;function W0(i){return ti(i,G0|N0)}var x0=1,P0=4;function F0(i,o){return o=typeof o=="function"?o:void 0,ti(i,x0|P0,o)}var K0=4;function R0(i,o){return o=typeof o=="function"?o:void 0,ti(i,K0,o)}function O0(){return new hi(this.value(),this.__chain__)}function A0(i){for(var o=-1,e=i==null?0:i.length,n=0,a=[];++o<e;){var u=i[o];u&&(a[n++]=u)}return a}function _0(){var i=arguments.length;if(!i)return[];for(var o=Array(i-1),e=arguments[0],n=i;n--;)o[n-1]=arguments[n];return Mi(k(e)?U(e):[e],A(o,1))}var z0="__lodash_hash_undefined__";function E0(i){return this.__data__.set(i,z0),this}function $0(i){return this.__data__.has(i)}function Ri(i){var o=-1,e=i==null?0:i.length;for(this.__data__=new Xi;++o<e;)this.add(i[o])}Ri.prototype.add=Ri.prototype.push=E0;Ri.prototype.has=$0;function bn(i,o){for(var e=-1,n=i==null?0:i.length;++e<n;)if(o(i[e],e,i))return!0;return!1}function Yo(i,o){return i.has(o)}var q0=1,I0=2;function bg(i,o,e,n,a,u){var g=e&q0,t=i.length,h=o.length;if(t!=h&&!(g&&h>t))return!1;var s=u.get(i),v=u.get(o);if(s&&v)return s==o&&v==i;var r=-1,l=!0,c=e&I0?new Ri:void 0;for(u.set(i,o),u.set(o,i);++r<t;){var y=i[r],b=o[r];if(n)var p=g?n(b,y,r,o,i,u):n(y,b,r,i,o,u);if(p!==void 0){if(p)continue;l=!1;break}if(c){if(!bn(o,function(j,L){if(!Yo(c,L)&&(y===j||a(y,j,e,n,u)))return c.push(L)})){l=!1;break}}else if(!(y===b||a(y,b,e,n,u))){l=!1;break}}return u.delete(i),u.delete(o),l}function pn(i){var o=-1,e=Array(i.size);return i.forEach(function(n,a){e[++o]=[a,n]}),e}function ue(i){var o=-1,e=Array(i.size);return i.forEach(function(n){e[++o]=n}),e}var U0=1,V0=2,iy="[object Boolean]",oy="[object Date]",ey="[object Error]",ny="[object Map]",ay="[object Number]",uy="[object RegExp]",gy="[object Set]",dy="[object String]",ty="[object Symbol]",hy="[object ArrayBuffer]",sy="[object DataView]",Na=_?_.prototype:void 0,ke=Na?Na.valueOf:void 0;function ry(i,o,e,n,a,u,g){switch(e){case sy:if(i.byteLength!=o.byteLength||i.byteOffset!=o.byteOffset)return!1;i=i.buffer,o=o.buffer;case hy:return!(i.byteLength!=o.byteLength||!u(new _o(i),new _o(o)));case iy:case oy:case ay:return bi(+i,+o);case ey:return i.name==o.name&&i.message==o.message;case uy:case dy:return i==o+"";case ny:var t=pn;case gy:var h=n&U0;if(t||(t=ue),i.size!=o.size&&!h)return!1;var s=g.get(i);if(s)return s==o;n|=V0,g.set(i,o);var v=bg(t(i),t(o),n,a,u,g);return g.delete(i),v;case ty:if(ke)return ke.call(i)==ke.call(o)}return!1}var vy=1,ly=Object.prototype,yy=ly.hasOwnProperty;function cy(i,o,e,n,a,u){var g=e&vy,t=We(i),h=t.length,s=We(o),v=s.length;if(h!=v&&!g)return!1;for(var r=h;r--;){var l=t[r];if(!(g?l in o:yy.call(o,l)))return!1}var c=u.get(i),y=u.get(o);if(c&&y)return c==o&&y==i;var b=!0;u.set(i,o),u.set(o,i);for(var p=g;++r<h;){l=t[r];var j=i[l],L=o[l];if(n)var K=g?n(L,j,l,o,i,u):n(j,L,l,i,o,u);if(!(K===void 0?j===L||a(j,L,e,n,u):K)){b=!1;break}p||(p=l=="constructor")}if(b&&!p){var R=i.constructor,z=o.constructor;R!=z&&"constructor"in i&&"constructor"in o&&!(typeof R=="function"&&R instanceof R&&typeof z=="function"&&z instanceof z)&&(b=!1)}return u.delete(i),u.delete(o),b}var by=1,Wa="[object Arguments]",xa="[object Array]",Bo="[object Object]",py=Object.prototype,Pa=py.hasOwnProperty;function wy(i,o,e,n,a,u){var g=k(i),t=k(o),h=g?xa:pi(i),s=t?xa:pi(o);h=h==Wa?Bo:h,s=s==Wa?Bo:s;var v=h==Bo,r=s==Bo,l=h==s;if(l&&Ti(i)){if(!Ti(o))return!1;g=!0,v=!1}if(l&&!v)return u||(u=new li),g||uo(i)?bg(i,o,e,n,a,u):ry(i,o,h,e,n,a,u);if(!(e&by)){var c=v&&Pa.call(i,"__wrapped__"),y=r&&Pa.call(o,"__wrapped__");if(c||y){var b=c?i.value():i,p=y?o.value():o;return u||(u=new li),a(b,p,e,n,u)}}return l?(u||(u=new li),cy(i,o,e,n,a,u)):!1}function Co(i,o,e,n,a){return i===o?!0:i==null||o==null||!N(i)&&!N(o)?i!==i&&o!==o:wy(i,o,e,n,Co,a)}var jy=1,my=2;function wn(i,o,e,n){var a=e.length,u=a,g=!n;if(i==null)return!u;for(i=Object(i);a--;){var t=e[a];if(g&&t[2]?t[1]!==i[t[0]]:!(t[0]in i))return!1}for(;++a<u;){t=e[a];var h=t[0],s=i[h],v=t[1];if(g&&t[2]){if(s===void 0&&!(h in i))return!1}else{var r=new li;if(n)var l=n(s,v,h,i,o,r);if(!(l===void 0?Co(v,s,jy|my,n,r):l))return!1}}return!0}function pg(i){return i===i&&!G(i)}function jn(i){for(var o=F(i),e=o.length;e--;){var n=o[e],a=i[n];o[e]=[n,a,pg(a)]}return o}function wg(i,o){return function(e){return e==null?!1:e[i]===o&&(o!==void 0||i in Object(e))}}function jg(i){var o=jn(i);return o.length==1&&o[0][2]?wg(o[0][0],o[0][1]):function(e){return e===i||wn(e,i,o)}}function fy(i,o){return i!=null&&o in Object(i)}function mg(i,o,e){o=Bi(o,i);for(var n=-1,a=o.length,u=!1;++n<a;){var g=yi(o[n]);if(!(u=i!=null&&e(i,g)))break;i=i[g]}return u||++n!=a?u:(a=i==null?0:i.length,!!a&&Vo(a)&&Ji(g,a)&&(k(i)||Fi(i)))}function mn(i,o){return i!=null&&mg(i,o,fy)}var Yy=1,ky=2;function fg(i,o){return nn(i)&&pg(o)?wg(yi(i),o):function(e){var n=an(e,i);return n===void 0&&n===o?mn(e,i):Co(o,n,Yy|ky)}}function fn(i){return function(o){return o?.[i]}}function Ly(i){return function(o){return _i(o,i)}}function Yg(i){return nn(i)?fn(yi(i)):Ly(i)}function Y(i){return typeof i=="function"?i:i==null?V:typeof i=="object"?k(i)?fg(i[0],i[1]):jg(i):Yg(i)}var Zy="Expected a function";function Jy(i){var o=i==null?0:i.length,e=Y;return i=o?M(i,function(n){if(typeof n[1]!="function")throw new TypeError(Zy);return[e(n[0]),n[1]]}):[],J(function(n){for(var a=-1;++a<o;){var u=i[a];if(ai(u[0],this,n))return ai(u[1],this,n)}})}function kg(i,o,e){var n=e.length;if(i==null)return!n;for(i=Object(i);n--;){var a=e[n],u=o[a],g=i[a];if(g===void 0&&!(a in i)||!u(g))return!1}return!0}function Sy(i){var o=F(i);return function(e){return kg(e,i,o)}}var Cy=1;function Xy(i){return Sy(ti(i,Cy))}function Hy(i,o){return o==null||kg(i,o,F(o))}function Dy(i,o,e,n){for(var a=-1,u=i==null?0:i.length;++a<u;){var g=i[a];o(n,g,e(g),i)}return n}function Lg(i){return function(o,e,n){for(var a=-1,u=Object(o),g=n(o),t=g.length;t--;){var h=g[i?t:++a];if(e(u[h],h,u)===!1)break}return o}}var Yn=Lg();function mi(i,o){return i&&Yn(i,o,F)}function Zg(i,o){return function(e,n){if(e==null)return e;if(!ii(e))return i(e,n);for(var a=e.length,u=o?a:-1,g=Object(e);(o?u--:++u<a)&&n(g[u],u,g)!==!1;);return e}}var Wi=Zg(mi);function Ty(i,o,e,n){return Wi(i,function(a,u,g){o(n,a,e(a),g)}),n}function ge(i,o){return function(e,n){var a=k(e)?Dy:Ty,u=o?o():{};return a(e,i,Y(n),u)}}var Qy=Object.prototype,By=Qy.hasOwnProperty,My=ge(function(i,o,e){By.call(i,e)?++i[e]:wi(i,e,1)});function Gy(i,o){var e=oo(i);return o==null?e:ag(e,o)}var Ny=8;function kn(i,o,e){o=e?void 0:o;var n=Si(i,Ny,void 0,void 0,void 0,void 0,void 0,o);return n.placeholder=kn.placeholder,n}kn.placeholder={};var Wy=16;function Ln(i,o,e){o=e?void 0:o;var n=Si(i,Wy,void 0,void 0,void 0,void 0,void 0,o);return n.placeholder=Ln.placeholder,n}Ln.placeholder={};var Po=function(){return P.Date.now()},xy="Expected a function",Py=Math.max,Fy=Math.min;function Jg(i,o,e){var n,a,u,g,t,h,s=0,v=!1,r=!1,l=!0;if(typeof i!="function")throw new TypeError(xy);o=di(o)||0,G(e)&&(v=!!e.leading,r="maxWait"in e,u=r?Py(di(e.maxWait)||0,o):u,l="trailing"in e?!!e.trailing:l);function c(B){var E=n,ki=a;return n=a=void 0,s=B,g=i.apply(ki,E),g}function y(B){return s=B,t=setTimeout(j,o),v?c(B):g}function b(B){var E=B-h,ki=B-s,An=o-E;return r?Fy(An,u-ki):An}function p(B){var E=B-h,ki=B-s;return h===void 0||E>=o||E<0||r&&ki>=u}function j(){var B=Po();if(p(B))return L(B);t=setTimeout(j,b(B))}function L(B){return t=void 0,l&&n?c(B):(n=a=void 0,g)}function K(){t!==void 0&&clearTimeout(t),s=0,n=h=a=t=void 0}function R(){return t===void 0?g:L(Po())}function z(){var B=Po(),E=p(B);if(n=arguments,a=this,h=B,E){if(t===void 0)return y(h);if(r)return clearTimeout(t),t=setTimeout(j,o),c(h)}return t===void 0&&(t=setTimeout(j,o)),g}return z.cancel=K,z.flush=R,z}function Ky(i,o){return i==null||i!==i?o:i}var Sg=Object.prototype,Ry=Sg.hasOwnProperty,Oy=J(function(i,o){i=Object(i);var e=-1,n=o.length,a=n>2?o[2]:void 0;for(a&&$(o[0],o[1],a)&&(n=1);++e<n;)for(var u=o[e],g=oi(u),t=-1,h=g.length;++t<h;){var s=g[t],v=i[s];(v===void 0||bi(v,Sg[s])&&!Ry.call(i,s))&&(i[s]=u[s])}return i});function Fe(i,o,e){(e!==void 0&&!bi(i[o],e)||e===void 0&&!(o in i))&&wi(i,o,e)}function x(i){return N(i)&&ii(i)}function Ke(i,o){if(!(o==="constructor"&&typeof i[o]=="function")&&o!="__proto__")return i[o]}function Cg(i){return ji(i,oi(i))}function Ay(i,o,e,n,a,u,g){var t=Ke(i,e),h=Ke(o,e),s=g.get(h);if(s){Fe(i,e,s);return}var v=u?u(t,h,e+"",i,o,g):void 0,r=v===void 0;if(r){var l=k(h),c=!l&&Ti(h),y=!l&&!c&&uo(h);v=h,l||c||y?k(t)?v=t:x(t)?v=U(t):c?(r=!1,v=gg(h,!0)):y?(r=!1,v=hg(h,!0)):v=[]:So(h)||Fi(h)?(v=t,Fi(t)?v=Cg(t):(!G(t)||Zi(t))&&(v=sg(h))):r=!1}r&&(g.set(h,v),a(v,h,n,u,g),g.delete(h)),Fe(i,e,v)}function de(i,o,e,n,a){i!==o&&Yn(o,function(u,g){if(a||(a=new li),G(u))Ay(i,o,g,e,de,n,a);else{var t=n?n(Ke(i,g),u,g+"",i,o,a):void 0;t===void 0&&(t=u),Fe(i,g,t)}},oi)}function Xg(i,o,e,n,a,u){return G(i)&&G(o)&&(u.set(o,i),de(i,o,void 0,Xg,u),u.delete(o)),i}var Hg=ao(function(i,o,e,n){de(i,o,e,n)}),_y=J(function(i){return i.push(void 0,Xg),ai(Hg,void 0,i)}),zy="Expected a function";function Dg(i,o,e){if(typeof i!="function")throw new TypeError(zy);return setTimeout(function(){i.apply(void 0,e)},o)}var Ey=J(function(i,o){return Dg(i,1,o)}),$y=J(function(i,o,e){return Dg(i,di(o)||0,e)});function Zn(i,o,e){for(var n=-1,a=i==null?0:i.length;++n<a;)if(e(o,i[n]))return!0;return!1}var qy=200;function Xo(i,o,e,n){var a=-1,u=Io,g=!0,t=i.length,h=[],s=o.length;if(!t)return h;e&&(o=M(o,ui(e))),n?(u=Zn,g=!1):o.length>=qy&&(u=Yo,g=!1,o=new Ri(o));i:for(;++a<t;){var v=i[a],r=e==null?v:e(v);if(v=n||v!==0?v:0,g&&r===r){for(var l=s;l--;)if(o[l]===r)continue i;h.push(v)}else u(o,r,n)||h.push(v)}return h}var Iy=J(function(i,o){return x(i)?Xo(i,A(o,1,x,!0)):[]});function vi(i){var o=i==null?0:i.length;return o?i[o-1]:void 0}var Uy=J(function(i,o){var e=vi(o);return x(e)&&(e=void 0),x(i)?Xo(i,A(o,1,x,!0),Y(e)):[]}),Vy=J(function(i,o){var e=vi(o);return x(e)&&(e=void 0),x(i)?Xo(i,A(o,1,x,!0),void 0,e):[]}),ic=Eo(function(i,o){return i/o},1);function oc(i,o,e){var n=i==null?0:i.length;return n?(o=e||o===void 0?1:Z(o),ri(i,o<0?0:o,n)):[]}function ec(i,o,e){var n=i==null?0:i.length;return n?(o=e||o===void 0?1:Z(o),o=n-o,ri(i,0,o<0?0:o)):[]}function te(i,o,e,n){for(var a=i.length,u=n?a:-1;(n?u--:++u<a)&&o(i[u],u,i););return e?ri(i,n?0:u,n?u+1:a):ri(i,n?u+1:0,n?a:u)}function nc(i,o){return i&&i.length?te(i,Y(o),!0,!0):[]}function ac(i,o){return i&&i.length?te(i,Y(o),!0):[]}function fi(i){return typeof i=="function"?i:V}function uc(i,o){var e=k(i)?gi:Wi;return e(i,fi(o))}function gc(i,o){for(var e=i==null?0:i.length;e--&&o(i[e],e,i)!==!1;);return i}var Tg=Lg(!0);function Jn(i,o){return i&&Tg(i,o,F)}var Qg=Zg(Jn,!0);function dc(i,o){var e=k(i)?gc:Qg;return e(i,fi(o))}function tc(i,o,e){i=X(i),o=ni(o);var n=i.length;e=e===void 0?n:zi(Z(e),0,n);var a=e;return e-=o.length,e>=0&&i.slice(e,a)==o}function hc(i,o){return M(o,function(e){return[e,i[e]]})}function sc(i){var o=-1,e=Array(i.size);return i.forEach(function(n){e[++o]=[n,n]}),e}var rc="[object Map]",vc="[object Set]";function Bg(i){return function(o){var e=pi(o);return e==rc?pn(o):e==vc?sc(o):hc(o,i(o))}}var lc=Bg(F),yc=Bg(oi),cc={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},bc=sn(cc),Mg=/[&<>"']/g,pc=RegExp(Mg.source);function Gg(i){return i=X(i),i&&pc.test(i)?i.replace(Mg,bc):i}var Ng=/[\\^$.*+?()[\]{}|]/g,wc=RegExp(Ng.source);function jc(i){return i=X(i),i&&wc.test(i)?i.replace(Ng,"\\$&"):i}function Wg(i,o){for(var e=-1,n=i==null?0:i.length;++e<n;)if(!o(i[e],e,i))return!1;return!0}function mc(i,o){var e=!0;return Wi(i,function(n,a,u){return e=!!o(n,a,u),e}),e}function fc(i,o,e){var n=k(i)?Wg:mc;return e&&$(i,o,e)&&(o=void 0),n(i,Y(o))}var Yc=4294967295;function xg(i){return i?zi(Z(i),0,Yc):0}function kc(i,o,e,n){var a=i.length;for(e=Z(e),e<0&&(e=-e>a?0:a+e),n=n===void 0||n>a?a:Z(n),n<0&&(n+=a),n=e>n?0:xg(n);e<n;)i[e++]=o;return i}function Lc(i,o,e,n){var a=i==null?0:i.length;return a?(e&&typeof e!="number"&&$(i,o,e)&&(e=0,n=a),kc(i,o,e,n)):[]}function Pg(i,o){var e=[];return Wi(i,function(n,a,u){o(n,a,u)&&e.push(n)}),e}function Zc(i,o){var e=k(i)?Ni:Pg;return e(i,Y(o))}function Fg(i){return function(o,e,n){var a=Object(o);if(!ii(o)){var u=Y(e);o=F(o),e=function(t){return u(a[t],t,a)}}var g=i(o,e,n);return g>-1?a[u?o[g]:g]:void 0}}var Jc=Math.max;function Kg(i,o,e){var n=i==null?0:i.length;if(!n)return-1;var a=e==null?0:Z(e);return a<0&&(a=Jc(n+a,0)),qo(i,Y(o),a)}var Sc=Fg(Kg);function Rg(i,o,e){var n;return e(i,function(a,u,g){if(o(a,u,g))return n=u,!1}),n}function Cc(i,o){return Rg(i,Y(o),mi)}var Xc=Math.max,Hc=Math.min;function Og(i,o,e){var n=i==null?0:i.length;if(!n)return-1;var a=n-1;return e!==void 0&&(a=Z(e),a=e<0?Xc(n+a,0):Hc(a,n-1)),qo(i,Y(o),a,!0)}var Dc=Fg(Og);function Tc(i,o){return Rg(i,Y(o),Jn)}function Qc(i){return i&&i.length?i[0]:void 0}function Ag(i,o){var e=-1,n=ii(i)?Array(i.length):[];return Wi(i,function(a,u,g){n[++e]=o(a,u,g)}),n}function he(i,o){var e=k(i)?M:Ag;return e(i,Y(o))}function Bc(i,o){return A(he(i,o),1)}var Mc=1/0;function Gc(i,o){return A(he(i,o),Mc)}function Nc(i,o,e){return e=e===void 0?1:Z(e),A(he(i,o),e)}var Wc=1/0;function xc(i){var o=i==null?0:i.length;return o?A(i,Wc):[]}function Pc(i,o){var e=i==null?0:i.length;return e?(o=o===void 0?1:Z(o),A(i,o)):[]}var Fc=512;function Kc(i){return Si(i,Fc)}var Rc=rn("floor"),Oc="Expected a function",Ac=8,_c=32,zc=128,Ec=256;function _g(i){return Hi(function(o){var e=o.length,n=e,a=hi.prototype.thru;for(i&&o.reverse();n--;){var u=o[n];if(typeof u!="function")throw new TypeError(Oc);if(a&&!g&&xo(u)=="wrapper")var g=new hi([],!0)}for(n=g?n:e;++n<e;){u=o[n];var t=xo(u),h=t=="wrapper"?qe(u):void 0;h&&Be(h[0])&&h[1]==(zc|Ac|_c|Ec)&&!h[4].length&&h[9]==1?g=g[xo(h[0])].apply(g,h[3]):g=u.length==1&&Be(u)?g[t]():g.thru(u)}return function(){var s=arguments,v=s[0];if(g&&s.length==1&&k(v))return g.plant(v).value();for(var r=0,l=e?o[r].apply(this,s):v;++r<e;)l=o[r].call(this,l);return l}})}var $c=_g(),qc=_g(!0);function Ic(i,o){return i==null?i:Yn(i,fi(o),oi)}function Uc(i,o){return i==null?i:Tg(i,fi(o),oi)}function Vc(i,o){return i&&mi(i,fi(o))}function ib(i,o){return i&&Jn(i,fi(o))}function ob(i){for(var o=-1,e=i==null?0:i.length,n={};++o<e;){var a=i[o];wi(n,a[0],a[1])}return n}function se(i,o){return Ni(o,function(e){return Zi(i[e])})}function eb(i){return i==null?[]:se(i,F(i))}function nb(i){return i==null?[]:se(i,oi(i))}var ab=Object.prototype,ub=ab.hasOwnProperty,gb=ge(function(i,o,e){ub.call(i,e)?i[e].push(o):wi(i,e,[o])});function Sn(i,o){return i>o}function re(i){return function(o,e){return typeof o=="string"&&typeof e=="string"||(o=di(o),e=di(e)),i(o,e)}}var db=re(Sn),tb=re(function(i,o){return i>=o}),hb=Object.prototype,sb=hb.hasOwnProperty;function rb(i,o){return i!=null&&sb.call(i,o)}function vb(i,o){return i!=null&&mg(i,o,rb)}var lb=Math.max,yb=Math.min;function cb(i,o,e){return i>=yb(o,e)&&i<lb(o,e)}function bb(i,o,e){return o=Li(o),e===void 0?(e=o,o=0):e=Li(e),i=di(i),cb(i,o,e)}var pb="[object String]";function ve(i){return typeof i=="string"||!k(i)&&N(i)&&q(i)==pb}function Cn(i,o){return M(o,function(e){return i[e]})}function ho(i){return i==null?[]:Cn(i,F(i))}var wb=Math.max;function jb(i,o,e,n){i=ii(i)?i:ho(i),e=e&&!n?Z(e):0;var a=i.length;return e<0&&(e=wb(a+e,0)),ve(i)?e<=a&&i.indexOf(o,e)>-1:!!a&&eo(i,o,e)>-1}var mb=Math.max;function fb(i,o,e){var n=i==null?0:i.length;if(!n)return-1;var a=e==null?0:Z(e);return a<0&&(a=mb(n+a,0)),eo(i,o,a)}function Yb(i){var o=i==null?0:i.length;return o?ri(i,0,-1):[]}var kb=Math.min;function Xn(i,o,e){for(var n=e?Zn:Io,a=i[0].length,u=i.length,g=u,t=Array(u),h=1/0,s=[];g--;){var v=i[g];g&&o&&(v=M(v,ui(o))),h=kb(v.length,h),t[g]=!e&&(o||a>=120&&v.length>=120)?new Ri(g&&v):void 0}v=i[0];var r=-1,l=t[0];i:for(;++r<a&&s.length<h;){var c=v[r],y=o?o(c):c;if(c=e||c!==0?c:0,!(l?Yo(l,y):n(s,y,e))){for(g=u;--g;){var b=t[g];if(!(b?Yo(b,y):n(i[g],y,e)))continue i}l&&l.push(y),s.push(c)}}return s}function Hn(i){return x(i)?i:[]}var Lb=J(function(i){var o=M(i,Hn);return o.length&&o[0]===i[0]?Xn(o):[]}),Zb=J(function(i){var o=vi(i),e=M(i,Hn);return o===vi(e)?o=void 0:e.pop(),e.length&&e[0]===i[0]?Xn(e,Y(o)):[]}),Jb=J(function(i){var o=vi(i),e=M(i,Hn);return o=typeof o=="function"?o:void 0,o&&e.pop(),e.length&&e[0]===i[0]?Xn(e,void 0,o):[]});function Sb(i,o,e,n){return mi(i,function(a,u,g){o(n,e(a),u,g)}),n}function zg(i,o){return function(e,n){return Sb(e,i,o(n),{})}}var Cb=Object.prototype,Xb=Cb.toString,Hb=zg(function(i,o,e){o!=null&&typeof o.toString!="function"&&(o=Xb.call(o)),i[o]=e},Ie(V)),Eg=Object.prototype,Db=Eg.hasOwnProperty,Tb=Eg.toString,Qb=zg(function(i,o,e){o!=null&&typeof o.toString!="function"&&(o=Tb.call(o)),Db.call(i,o)?i[o].push(e):i[o]=[e]},Y);function $g(i,o){return o.length<2?i:_i(i,ri(o,0,-1))}function Ho(i,o,e){o=Bi(o,i),i=$g(i,o);var n=i==null?i:i[yi(vi(o))];return n==null?void 0:ai(n,i,e)}var Bb=J(Ho),Mb=J(function(i,o,e){var n=-1,a=typeof o=="function",u=ii(i)?Array(i.length):[];return Wi(i,function(g){u[++n]=a?ai(o,g,e):Ho(g,o,e)}),u}),Gb="[object ArrayBuffer]";function Nb(i){return N(i)&&q(i)==Gb}var Fa=si&&si.isArrayBuffer,Wb=Fa?ui(Fa):Nb,xb="[object Boolean]";function Pb(i){return i===!0||i===!1||N(i)&&q(i)==xb}var Fb="[object Date]";function Kb(i){return N(i)&&q(i)==Fb}var Ka=si&&si.isDate,Rb=Ka?ui(Ka):Kb;function Ob(i){return N(i)&&i.nodeType===1&&!So(i)}var Ab="[object Map]",_b="[object Set]",zb=Object.prototype,Eb=zb.hasOwnProperty;function $b(i){if(i==null)return!0;if(ii(i)&&(k(i)||typeof i=="string"||typeof i.splice=="function"||Ti(i)||uo(i)||Fi(i)))return!i.length;var o=pi(i);if(o==Ab||o==_b)return!i.size;if(Jo(i))return!en(i).length;for(var e in i)if(Eb.call(i,e))return!1;return!0}function qb(i,o){return Co(i,o)}function Ib(i,o,e){e=typeof e=="function"?e:void 0;var n=e?e(i,o):void 0;return n===void 0?Co(i,o,void 0,e):!!n}var Ub=P.isFinite;function Vb(i){return typeof i=="number"&&Ub(i)}function qg(i){return typeof i=="number"&&i==Z(i)}function ip(i,o){return i===o||wn(i,o,jn(o))}function op(i,o,e){return e=typeof e=="function"?e:void 0,wn(i,o,jn(o),e)}var ep="[object Number]";function Ig(i){return typeof i=="number"||N(i)&&q(i)==ep}function np(i){return Ig(i)&&i!=+i}var ap=Wo?Zi:on,up="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.";function gp(i){if(ap(i))throw new Error(up);return vu(i)}function dp(i){return i==null}function tp(i){return i===null}var hp="[object RegExp]";function sp(i){return N(i)&&q(i)==hp}var Ra=si&&si.isRegExp,Dn=Ra?ui(Ra):sp,Oa=9007199254740991;function rp(i){return qg(i)&&i>=-Oa&&i<=Oa}function vp(i){return i===void 0}var lp="[object WeakMap]";function yp(i){return N(i)&&pi(i)==lp}var cp="[object WeakSet]";function bp(i){return N(i)&&q(i)==cp}var pp=1;function wp(i){return Y(typeof i=="function"?i:ti(i,pp))}var jp=Array.prototype,mp=jp.join;function fp(i,o){return i==null?"":mp.call(i,o)}var Yp=to(function(i,o,e){return i+(e?"-":"")+o.toLowerCase()}),kp=ge(function(i,o,e){wi(i,e,o)});function Lp(i,o,e){for(var n=e+1;n--;)if(i[n]===o)return n;return n}var Zp=Math.max,Jp=Math.min;function Sp(i,o,e){var n=i==null?0:i.length;if(!n)return-1;var a=n;return e!==void 0&&(a=Z(e),a=a<0?Zp(n+a,0):Jp(a,n-1)),o===o?Lp(i,o,a):qo(i,ju,a,!0)}var Cp=to(function(i,o,e){return i+(e?" ":"")+o.toLowerCase()}),Xp=Pu("toLowerCase");function Tn(i,o){return i<o}var Hp=re(Tn),Dp=re(function(i,o){return i<=o});function Tp(i,o){var e={};return o=Y(o),mi(i,function(n,a,u){wi(e,o(n,a,u),n)}),e}function Qp(i,o){var e={};return o=Y(o),mi(i,function(n,a,u){wi(e,a,o(n,a,u))}),e}var Bp=1;function Mp(i){return jg(ti(i,Bp))}var Gp=1;function Np(i,o){return fg(i,ti(o,Gp))}function le(i,o,e){for(var n=-1,a=i.length;++n<a;){var u=i[n],g=o(u);if(g!=null&&(t===void 0?g===g&&!ei(g):e(g,t)))var t=g,h=u}return h}function Wp(i){return i&&i.length?le(i,V,Sn):void 0}function xp(i,o){return i&&i.length?le(i,Y(o),Sn):void 0}function Qn(i,o){for(var e,n=-1,a=i.length;++n<a;){var u=o(i[n]);u!==void 0&&(e=e===void 0?u:e+u)}return e}var Pp=NaN;function Ug(i,o){var e=i==null?0:i.length;return e?Qn(i,o)/e:Pp}function Fp(i){return Ug(i,V)}function Kp(i,o){return Ug(i,Y(o))}var Rp=ao(function(i,o,e){de(i,o,e)}),Op=J(function(i,o){return function(e){return Ho(e,i,o)}}),Ap=J(function(i,o){return function(e){return Ho(i,e,o)}});function _p(i){return i&&i.length?le(i,V,Tn):void 0}function zp(i,o){return i&&i.length?le(i,Y(o),Tn):void 0}function Ep(i,o,e){var n=F(o),a=se(o,n),u=!(G(e)&&"chain"in e)||!!e.chain,g=Zi(i);return gi(a,function(t){var h=o[t];i[t]=h,g&&(i.prototype[t]=function(){var s=this.__chain__;if(u||s){var v=i(this.__wrapped__),r=v.__actions__=U(this.__actions__);return r.push({func:h,args:arguments,thisArg:i}),v.__chain__=s,v}return h.apply(i,Mi([this.value()],arguments))})}),i}var $p=Eo(function(i,o){return i*o},1),qp="Expected a function";function ye(i){if(typeof i!="function")throw new TypeError(qp);return function(){var o=arguments;switch(o.length){case 0:return!i.call(this);case 1:return!i.call(this,o[0]);case 2:return!i.call(this,o[0],o[1]);case 3:return!i.call(this,o[0],o[1],o[2])}return!i.apply(this,o)}}function Ip(i){for(var o,e=[];!(o=i.next()).done;)e.push(o.value);return e}var Up="[object Map]",Vp="[object Set]",Le=_?_.iterator:void 0;function Vg(i){if(!i)return[];if(ii(i))return ve(i)?ci(i):U(i);if(Le&&i[Le])return Ip(i[Le]());var o=pi(i),e=o==Up?pn:o==Vp?ue:ho;return e(i)}function iw(){this.__values__===void 0&&(this.__values__=Vg(this.value()));var i=this.__index__>=this.__values__.length,o=i?void 0:this.__values__[this.__index__++];return{done:i,value:o}}function id(i,o){var e=i.length;if(e)return o+=o<0?e:0,Ji(o,e)?i[o]:void 0}function ow(i,o){return i&&i.length?id(i,Z(o)):void 0}function ew(i){return i=Z(i),J(function(o){return id(o,i)})}var nw=Object.prototype,aw=nw.hasOwnProperty;function Bn(i,o){o=Bi(o,i);var e=-1,n=o.length;if(!n)return!0;for(;++e<n;){var a=yi(o[e]);if(a==="__proto__"&&!aw.call(i,"__proto__")||(a==="constructor"||a==="prototype")&&e<n-1)return!1}var u=$g(i,o);return u==null||delete u[yi(vi(o))]}function uw(i){return So(i)?void 0:i}var gw=1,dw=2,tw=4,hw=Hi(function(i,o){var e={};if(i==null)return e;var n=!1;o=M(o,function(u){return u=Bi(u,i),n||(n=u.length>1),u}),ji(i,yn(i),e),n&&(e=ti(e,gw|dw|tw,uw));for(var a=o.length;a--;)Bn(e,o[a]);return e});function Do(i,o,e,n){if(!G(i))return i;o=Bi(o,i);for(var a=-1,u=o.length,g=u-1,t=i;t!=null&&++a<u;){var h=yi(o[a]),s=e;if(h==="__proto__"||h==="constructor"||h==="prototype")return i;if(a!=g){var v=t[h];s=n?n(v,h,t):void 0,s===void 0&&(s=G(v)?v:Ji(o[a+1])?[]:{})}Zo(t,h,s),t=t[h]}return i}function od(i,o,e){for(var n=-1,a=o.length,u={};++n<a;){var g=o[n],t=_i(i,g);e(t,g)&&Do(u,Bi(g,i),t)}return u}function ed(i,o){if(i==null)return{};var e=M(yn(i),function(n){return[n]});return o=Y(o),od(i,e,function(n,a){return o(n,a[0])})}function sw(i,o){return ed(i,ye(Y(o)))}function rw(i){return Qu(2,i)}function vw(i,o){var e=i.length;for(i.sort(o);e--;)i[e]=i[e].value;return i}function nd(i,o){if(i!==o){var e=i!==void 0,n=i===null,a=i===i,u=ei(i),g=o!==void 0,t=o===null,h=o===o,s=ei(o);if(!t&&!s&&!u&&i>o||u&&g&&h&&!t&&!s||n&&g&&h||!e&&h||!a)return 1;if(!n&&!u&&!s&&i<o||s&&e&&a&&!n&&!u||t&&e&&a||!g&&a||!h)return-1}return 0}function lw(i,o,e){for(var n=-1,a=i.criteria,u=o.criteria,g=a.length,t=e.length;++n<g;){var h=nd(a[n],u[n]);if(h){if(n>=t)return h;var s=e[n];return h*(s=="desc"?-1:1)}}return i.index-o.index}function ad(i,o,e){o.length?o=M(o,function(u){return k(u)?function(g){return _i(g,u.length===1?u[0]:u)}:u}):o=[V];var n=-1;o=M(o,ui(Y));var a=Ag(i,function(u,g,t){var h=M(o,function(s){return s(u)});return{criteria:h,index:++n,value:u}});return vw(a,function(u,g){return lw(u,g,e)})}function yw(i,o,e,n){return i==null?[]:(k(o)||(o=o==null?[]:[o]),e=n?void 0:e,k(e)||(e=e==null?[]:[e]),ad(i,o,e))}function Mn(i){return Hi(function(o){return o=M(o,ui(Y)),J(function(e){var n=this;return i(o,function(a){return ai(a,n,e)})})})}var cw=Mn(M),bw=J,pw=Math.min,ww=bw(function(i,o){o=o.length==1&&k(o[0])?M(o[0],ui(Y)):M(A(o,1),ui(Y));var e=o.length;return J(function(n){for(var a=-1,u=pw(n.length,e);++a<u;)n[a]=o[a].call(this,n[a]);return ai(i,this,n)})}),jw=Mn(Wg),mw=Mn(bn),fw=9007199254740991,Yw=Math.floor;function Re(i,o){var e="";if(!i||o<1||o>fw)return e;do o%2&&(e+=i),o=Yw(o/2),o&&(i+=i);while(o);return e}var kw=fn("length"),ud="\\ud800-\\udfff",Lw="\\u0300-\\u036f",Zw="\\ufe20-\\ufe2f",Jw="\\u20d0-\\u20ff",Sw=Lw+Zw+Jw,Cw="\\ufe0e\\ufe0f",Xw="["+ud+"]",Oe="["+Sw+"]",Ae="\\ud83c[\\udffb-\\udfff]",Hw="(?:"+Oe+"|"+Ae+")",gd="[^"+ud+"]",dd="(?:\\ud83c[\\udde6-\\uddff]){2}",td="[\\ud800-\\udbff][\\udc00-\\udfff]",Dw="\\u200d",hd=Hw+"?",sd="["+Cw+"]?",Tw="(?:"+Dw+"(?:"+[gd,dd,td].join("|")+")"+sd+hd+")*",Qw=sd+hd+Tw,Bw="(?:"+[gd+Oe+"?",Oe,dd,td,Xw].join("|")+")",Aa=RegExp(Ae+"(?="+Ae+")|"+Bw+Qw,"g");function Mw(i){for(var o=Aa.lastIndex=0;Aa.test(i);)++o;return o}function so(i){return go(i)?Mw(i):kw(i)}var Gw=Math.ceil;function zo(i,o){o=o===void 0?" ":ni(o);var e=o.length;if(e<2)return e?Re(o,i):o;var n=Re(o,Gw(i/so(o)));return go(o)?Gi(ci(n),0,i).join(""):n.slice(0,i)}var Nw=Math.ceil,Ww=Math.floor;function xw(i,o,e){i=X(i),o=Z(o);var n=o?so(i):0;if(!o||n>=o)return i;var a=(o-n)/2;return zo(Ww(a),e)+i+zo(Nw(a),e)}function Pw(i,o,e){i=X(i),o=Z(o);var n=o?so(i):0;return o&&n<o?i+zo(o-n,e):i}function Fw(i,o,e){i=X(i),o=Z(o);var n=o?so(i):0;return o&&n<o?zo(o-n,e)+i:i}var Kw=/^\s+/,Rw=P.parseInt;function Ow(i,o,e){return e||o==null?o=0:o&&(o=+o),Rw(X(i).replace(Kw,""),o||0)}var Aw=32,ce=J(function(i,o){var e=Di(o,no(ce));return Si(i,Aw,void 0,o,e)});ce.placeholder={};var _w=64,Gn=J(function(i,o){var e=Di(o,no(Gn));return Si(i,_w,void 0,o,e)});Gn.placeholder={};var zw=ge(function(i,o,e){i[e?0:1].push(o)},function(){return[[],[]]});function Ew(i,o){return od(i,o,function(e,n){return mn(i,n)})}var $w=Hi(function(i,o){return i==null?{}:Ew(i,o)});function qw(i){for(var o,e=this;e instanceof $o;){var n=bu(e);n.__index__=0,n.__values__=void 0,o?a.__wrapped__=n:o=n;var a=n;e=e.__wrapped__}return a.__wrapped__=i,o}function Iw(i){return function(o){return i==null?void 0:_i(i,o)}}function Uw(i,o,e,n){for(var a=e-1,u=i.length;++a<u;)if(n(i[a],o))return a;return-1}var Vw=Array.prototype,_a=Vw.splice;function Nn(i,o,e,n){var a=n?Uw:eo,u=-1,g=o.length,t=i;for(i===o&&(o=U(o)),e&&(t=M(i,ui(e)));++u<g;)for(var h=0,s=o[u],v=e?e(s):s;(h=a(t,v,h,n))>-1;)t!==i&&_a.call(t,h,1),_a.call(i,h,1);return i}function rd(i,o){return i&&i.length&&o&&o.length?Nn(i,o):i}var ij=J(rd);function oj(i,o,e){return i&&i.length&&o&&o.length?Nn(i,o,Y(e)):i}function ej(i,o,e){return i&&i.length&&o&&o.length?Nn(i,o,void 0,e):i}var nj=Array.prototype,aj=nj.splice;function vd(i,o){for(var e=i?o.length:0,n=e-1;e--;){var a=o[e];if(e==n||a!==u){var u=a;Ji(a)?aj.call(i,a,1):Bn(i,a)}}return i}var uj=Hi(function(i,o){var e=i==null?0:i.length,n=un(i,o);return vd(i,M(o,function(a){return Ji(a,e)?+a:a}).sort(nd)),n}),gj=Math.floor,dj=Math.random;function Wn(i,o){return i+gj(dj()*(o-i+1))}var tj=parseFloat,hj=Math.min,sj=Math.random;function rj(i,o,e){if(e&&typeof e!="boolean"&&$(i,o,e)&&(o=e=void 0),e===void 0&&(typeof o=="boolean"?(e=o,o=void 0):typeof i=="boolean"&&(e=i,i=void 0)),i===void 0&&o===void 0?(i=0,o=1):(i=Li(i),o===void 0?(o=i,i=0):o=Li(o)),i>o){var n=i;i=o,o=n}if(e||i%1||o%1){var a=sj();return hj(i+a*(o-i+tj("1e-"+((a+"").length-1))),o)}return Wn(i,o)}var vj=Math.ceil,lj=Math.max;function yj(i,o,e,n){for(var a=-1,u=lj(vj((o-i)/(e||1)),0),g=Array(u);u--;)g[n?u:++a]=i,i+=e;return g}function ld(i){return function(o,e,n){return n&&typeof n!="number"&&$(o,e,n)&&(e=n=void 0),o=Li(o),e===void 0?(e=o,o=0):e=Li(e),n=n===void 0?o<e?1:-1:Li(n),yj(o,e,n,i)}}var cj=ld(),bj=ld(!0),pj=256,wj=Hi(function(i,o){return Si(i,pj,void 0,void 0,void 0,o)});function yd(i,o,e,n,a){return a(i,function(u,g,t){e=n?(n=!1,u):o(e,u,g,t)}),e}function jj(i,o,e){var n=k(i)?hn:yd,a=arguments.length<3;return n(i,Y(o),e,a,Wi)}function mj(i,o,e,n){var a=i==null?0:i.length;for(n&&a&&(e=i[--a]);a--;)e=o(e,i[a],a,i);return e}function fj(i,o,e){var n=k(i)?mj:yd,a=arguments.length<3;return n(i,Y(o),e,a,Qg)}function Yj(i,o){var e=k(i)?Ni:Pg;return e(i,ye(Y(o)))}function kj(i,o){var e=[];if(!(i&&i.length))return e;var n=-1,a=[],u=i.length;for(o=Y(o);++n<u;){var g=i[n];o(g,n,i)&&(e.push(g),a.push(n))}return vd(i,a),e}function Lj(i,o,e){return(e?$(i,o,e):o===void 0)?o=1:o=Z(o),Re(X(i),o)}function Zj(){var i=arguments,o=X(i[0]);return i.length<3?o:o.replace(i[1],i[2])}var Jj="Expected a function";function Sj(i,o){if(typeof i!="function")throw new TypeError(Jj);return o=o===void 0?o:Z(o),J(i,o)}function Cj(i,o,e){o=Bi(o,i);var n=-1,a=o.length;for(a||(a=1,i=void 0);++n<a;){var u=i?.[yi(o[n])];u===void 0&&(n=a,u=e),i=Zi(u)?u.call(i):u}return i}var Xj=Array.prototype,Hj=Xj.reverse;function _e(i){return i==null?i:Hj.call(i)}var Dj=rn("round");function cd(i){var o=i.length;return o?i[Wn(0,o-1)]:void 0}function Tj(i){return cd(ho(i))}function Qj(i){var o=k(i)?cd:Tj;return o(i)}function be(i,o){var e=-1,n=i.length,a=n-1;for(o=o===void 0?n:o;++e<o;){var u=Wn(e,a),g=i[u];i[u]=i[e],i[e]=g}return i.length=o,i}function Bj(i,o){return be(U(i),zi(o,0,i.length))}function Mj(i,o){var e=ho(i);return be(e,zi(o,0,e.length))}function Gj(i,o,e){(e?$(i,o,e):o===void 0)?o=1:o=Z(o);var n=k(i)?Bj:Mj;return n(i,o)}function Nj(i,o,e){return i==null?i:Do(i,o,e)}function Wj(i,o,e,n){return n=typeof n=="function"?n:void 0,i==null?i:Do(i,o,e,n)}function xj(i){return be(U(i))}function Pj(i){return be(ho(i))}function Fj(i){var o=k(i)?xj:Pj;return o(i)}var Kj="[object Map]",Rj="[object Set]";function Oj(i){if(i==null)return 0;if(ii(i))return ve(i)?so(i):i.length;var o=pi(i);return o==Kj||o==Rj?i.size:en(i).length}function Aj(i,o,e){var n=i==null?0:i.length;return n?(e&&typeof e!="number"&&$(i,o,e)?(o=0,e=n):(o=o==null?0:Z(o),e=e===void 0?n:Z(e)),ri(i,o,e)):[]}var _j=to(function(i,o,e){return i+(e?"_":"")+o.toLowerCase()});function zj(i,o){var e;return Wi(i,function(n,a,u){return e=o(n,a,u),!e}),!!e}function Ej(i,o,e){var n=k(i)?bn:zj;return e&&$(i,o,e)&&(o=void 0),n(i,Y(o))}var $j=J(function(i,o){if(i==null)return[];var e=o.length;return e>1&&$(i,o[0],o[1])?o=[]:e>2&&$(o[0],o[1],o[2])&&(o=[o[0]]),ad(i,A(o,1),[])}),qj=4294967295,Ij=qj-1,Uj=Math.floor,Vj=Math.min;function xn(i,o,e,n){var a=0,u=i==null?0:i.length;if(u===0)return 0;o=e(o);for(var g=o!==o,t=o===null,h=ei(o),s=o===void 0;a<u;){var v=Uj((a+u)/2),r=e(i[v]),l=r!==void 0,c=r===null,y=r===r,b=ei(r);if(g)var p=n||y;else s?p=y&&(n||l):t?p=y&&l&&(n||!c):h?p=y&&l&&!c&&(n||!b):c||b?p=!1:p=n?r<=o:r<o;p?a=v+1:u=v}return Vj(u,Ij)}var im=4294967295,om=im>>>1;function pe(i,o,e){var n=0,a=i==null?n:i.length;if(typeof o=="number"&&o===o&&a<=om){for(;n<a;){var u=n+a>>>1,g=i[u];g!==null&&!ei(g)&&(e?g<=o:g<o)?n=u+1:a=u}return a}return xn(i,o,V,e)}function em(i,o){return pe(i,o)}function nm(i,o,e){return xn(i,o,Y(e))}function am(i,o){var e=i==null?0:i.length;if(e){var n=pe(i,o);if(n<e&&bi(i[n],o))return n}return-1}function um(i,o){return pe(i,o,!0)}function gm(i,o,e){return xn(i,o,Y(e),!0)}function dm(i,o){var e=i==null?0:i.length;if(e){var n=pe(i,o,!0)-1;if(bi(i[n],o))return n}return-1}function bd(i,o){for(var e=-1,n=i.length,a=0,u=[];++e<n;){var g=i[e],t=o?o(g):g;if(!e||!bi(t,h)){var h=t;u[a++]=g===0?0:g}}return u}function tm(i){return i&&i.length?bd(i):[]}function hm(i,o){return i&&i.length?bd(i,Y(o)):[]}var sm=4294967295;function rm(i,o,e){return e&&typeof e!="number"&&$(i,o,e)&&(o=e=void 0),e=e===void 0?sm:e>>>0,e?(i=X(i),i&&(typeof o=="string"||o!=null&&!Dn(o))&&(o=ni(o),!o&&go(i))?Gi(ci(i),0,e):i.split(o,e)):[]}var vm="Expected a function",lm=Math.max;function ym(i,o){if(typeof i!="function")throw new TypeError(vm);return o=o==null?0:lm(Z(o),0),J(function(e){var n=e[o],a=Gi(e,0,o);return n&&Mi(a,n),ai(i,this,a)})}var cm=to(function(i,o,e){return i+(e?" ":"")+tn(o)});function bm(i,o,e){return i=X(i),e=e==null?0:zi(Z(e),0,i.length),o=ni(o),i.slice(e,e+o.length)==o}function pm(){return{}}function wm(){return""}function jm(){return!0}var mm=Eo(function(i,o){return i-o},0);function fm(i){return i&&i.length?Qn(i,V):0}function Ym(i,o){return i&&i.length?Qn(i,Y(o)):0}function km(i){var o=i==null?0:i.length;return o?ri(i,1,o):[]}function Lm(i,o,e){return i&&i.length?(o=e||o===void 0?1:Z(o),ri(i,0,o<0?0:o)):[]}function Zm(i,o,e){var n=i==null?0:i.length;return n?(o=e||o===void 0?1:Z(o),o=n-o,ri(i,o<0?0:o,n)):[]}function Jm(i,o){return i&&i.length?te(i,Y(o),!1,!0):[]}function Sm(i,o){return i&&i.length?te(i,Y(o)):[]}function Cm(i,o){return o(i),i}var pd=Object.prototype,Xm=pd.hasOwnProperty;function za(i,o,e,n){return i===void 0||bi(i,pd[e])&&!Xm.call(n,e)?o:i}var Hm={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function Dm(i){return"\\"+Hm[i]}var wd=/<%=([\s\S]+?)%>/g,Tm=/<%-([\s\S]+?)%>/g,Qm=/<%([\s\S]+?)%>/g,ze={escape:Tm,evaluate:Qm,interpolate:wd,variable:"",imports:{_:{escape:Gg}}},Bm="Invalid `variable` option passed into `_.template`",Mm="Invalid `imports` option passed into `_.template`",Gm=/\b__p \+= '';/g,Nm=/\b(__p \+=) '' \+/g,Wm=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ea=/[()=,{}\[\]\/\s]/,xm=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Mo=/($^)/,Pm=/['\n\r\u2028\u2029\\]/g,Fm=Object.prototype,$a=Fm.hasOwnProperty;function Km(i,o,e){var n=ze.imports._.templateSettings||ze;e&&$(i,o,e)&&(o=void 0),i=X(i),o=Me({},o,n,za);var a=Me({},o.imports,n.imports,za),u=F(a),g=Cn(a,u);gi(u,function(p){if(Ea.test(p))throw new Error(Mm)});var t,h,s=0,v=o.interpolate||Mo,r="__p += '",l=RegExp((o.escape||Mo).source+"|"+v.source+"|"+(v===wd?xm:Mo).source+"|"+(o.evaluate||Mo).source+"|$","g"),c=$a.call(o,"sourceURL")?"//# sourceURL="+(o.sourceURL+"").replace(/\s/g," ")+`
4
4
  `:"";i.replace(l,function(p,j,L,K,R,z){return L||(L=K),r+=i.slice(s,z).replace(Pm,Dm),j&&(t=!0,r+=`' +
@@ -1 +1 @@
1
- import{createRequire as J}from"node:module";const Q=J(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,X=e=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[t,a]=W.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return W.getBuiltinModule(e)}return Q(e)},{createRequire:Y}=X("node:module"),H=String.raw,T=H`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,ee=()=>new RegExp(H`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${T}(?:\u200D${T})*`,"gu");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const Be=/^[ \t]*(?:\r\n|\r|\n)/,_e=/(?:\r\n|\r|\n)[ \t]*$/,ve=/^(?:[\r\n]|$)/,Te=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,Fe=/^[ \t]*[\r\n][ \t\r\n]*$/,ze=/\r\n|\n|\r/g,Me=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,Ie=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,m=ee(),te=/[-_./\s]+/g,$=/(\u001B\[[0-9;]*[a-z])/i,F=new RegExp("\\p{Script=Arabic}","u"),se=new RegExp("\\p{Script=Bengali}","u"),b=new RegExp("\\p{Script=Cyrillic}","u"),ne=new RegExp("\\p{Script=Devanagari}","u"),re=new RegExp("\\p{Script=Ethiopic}","u"),j=new RegExp("\\p{Script=Greek}","u"),z=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),ie=new RegExp("\\p{Script=Gujarati}","u"),le=new RegExp("\\p{Script=Gurmukhi}","u"),M=new RegExp("\\p{Script=Hangul}","u"),I=new RegExp("\\p{Script=Hebrew}","u"),oe=new RegExp("\\p{Script=Hiragana}","u"),O=new RegExp("\\p{Script=Han}","u"),ce=new RegExp("\\p{Script=Kannada}","u"),ae=new RegExp("\\p{Script=Katakana}","u"),pe=new RegExp("\\p{Script=Khmer}","u"),ue=new RegExp("\\p{Script=Lao}","u"),S=new RegExp("\\p{Script=Latin}","u"),he=new RegExp("\\p{Script=Malayalam}","u"),fe=new RegExp("\\p{Script=Myanmar}","u"),ge=new RegExp("\\p{Script=Oriya}","u"),de=new RegExp("\\p{Script=Sinhala}","u"),xe=new RegExp("\\p{Script=Tamil}","u"),we=new RegExp("\\p{Script=Telugu}","u"),Ee=new RegExp("\\p{Script=Thai}","u"),ke=new RegExp("\\p{Script=Tibetan}","u"),q=/[\u02BB\u02BC\u0027]/u,Se=e=>e.replace(m,"");class Re{capacity;cache;constructor(t){this.capacity=t,this.cache=new Map}get(t){if(!this.cache.has(t))return;const a=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,a),a}has(t){return this.cache.has(t)}set(t,a){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.capacity){const f=this.cache.keys().next().value;f!==void 0&&this.cache.delete(f)}this.cache.set(t,a)}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}size(){return this.cache.size}}const Ce=Y(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Le=e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[t,a]=y.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return y.getBuiltinModule(e)}return Ce(e)},{stripVTControlCharacters:Ue}=Le("node:util"),A=new Re(1e3),me=/[.*+?^${}()|[\]\\]/g,be=e=>{const t=e.join("");if(A.has(t)){const d=A.get(t);return d.lastIndex=0,d}const a=e.map(d=>d.replaceAll(me,String.raw`\$&`)).join("|"),f=new RegExp(a,"g");return A.set(t,f),f},We=e=>{const t=[];let a=0,f;for(m.lastIndex=0;(f=m.exec(e))!==null;)f.index>a&&t.push(e.slice(a,f.index)),t.push(f[0]),a=m.lastIndex;return a<e.length&&t.push(e.slice(a)),t.filter(Boolean)},ye=/[ČŠŽĐ]/i,P=new Uint8Array(128),D=new Uint8Array(128),K=new Uint8Array(128);for(let e=0;e<128;e++)P[e]=e>=65&&e<=90?1:0,D[e]=e>=97&&e<=122?1:0,K[e]=e>=48&&e<=57?1:0;const B=e=>P[e],G=e=>D[e],_=e=>K[e],U=(e,t,a,f,d)=>{if(e.length===0)return[];let h=!1;const k=Object.values(t);for(const i of k)if(i(e[0])){h=!0;break}if(!h&&!a)return[e];const g=[...e],w=[];let n=g[0],l="other";const p=Object.entries(t);for(const i of p){const[r,c]=i;if(c(g[0])){l=r;break}}let s=a&&f?g[0]===g[0].toLocaleUpperCase(f):!1;for(let i=1;i<g.length;i++){const r=g[i];let c="other";for(const x of p){const[E,R]=x;if(R(r)){c=E;break}}const u=a&&f?r===r.toLocaleUpperCase(f):!1;let o=!1;d?o=d(l,c,s,u,r,i,g):(l!==c&&l!=="other"&&c!=="other"&&(o=!0),a&&c!=="other"&&!s&&u&&(o=!0)),o?(w.push(n),n=r):n+=r,l=c,a&&(s=u)}return n&&n.length>0&&w.push(n),w.length>0?w:[e]},$e=(e,t,a,f)=>{if(a.size===0)return t;for(const d of a)if(e.startsWith(d,t))return f.push(d),t+d.length;return t},N=(e,t=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let a=0;const f=[],d=e.length;for(let h=1;h<d;h++){const k=$e(e,a,t,f);if(k!==a){a=k,h=a-1;continue}const g=e.codePointAt(h-1),w=e.codePointAt(h),n=g&&g<128&&B(g),l=w&&w<128&&B(w),p=g&&g<128&&G(g),s=g&&g<128&&_(g),i=w&&w<128&&_(w);if(p&&l){f.push(e.slice(a,h)),a=h;continue}if(s&&!i||!s&&i){f.push(e.slice(a,h)),a=h;continue}if(i&&!s){let r=!1,c=!1;if(h+1<d){const u=e.codePointAt(h+1);r=u&&u<128&&B(u),c=u&&u<128&&_(u)}if(!c&&r){f.push(e.slice(a,h),e.slice(h,h+1)),a=h+1;continue}}if(h+1<d){const r=e.codePointAt(h+1),c=r&&r<128&&G(r);if(n&&l&&c){const u=e.slice(a,h+1);t.has(u)||(f.push(e.slice(a,h)),a=h)}}}return a<d&&f.push(e.slice(a)),f.filter(h=>h!=="")},V=(e,t,a)=>{if(e.length===0)return[];const f=e===e.toLocaleUpperCase(t);if(t.startsWith("de")){if(!f&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(t))return[e];const n=[...e],l=n.length,p=[];let s=n[0],i=n[0]===n[0].toLocaleUpperCase(t),r=i,c=i?0:-1;for(let u=1;u<l;u++){const o=n[u],x=o===o.toLocaleUpperCase(t);if(x===i)s+=o;else if(x)s&&s.length>0&&(p.push(s),s=o),r=!0,c=u;else{if(r&&u-c>1){const E=n[u-1],R=s.slice(0,-1);R&&R.length>0&&p.push(R),s=E+o}else s+=o;r=!1,c=-1}i=x}return s&&s.length>0&&p.push(s),p}if(t.startsWith("uk")||t.startsWith("ru")||t.startsWith("bg")||t.startsWith("sr")||t.startsWith("mk")||t.startsWith("be")){if(!b.test(e)&&!S.test(e))return[e];const n=[...e],l=n.length,p=[];let s=n[0];const i=n[0];let r;b.test(i)?r=1:S.test(i)?r=2:r=0;let c=i===i.toLocaleUpperCase(t);for(let o=1;o<l;o++){const x=n[o];let E;b.test(x)?E=1:S.test(x)?E=2:E=0;const R=x===x.toLocaleUpperCase(t);r!==E&&(r===1||r===2)&&(E===1||E===2)||E===r&&!c&&R?(p.push(s),s=x):s+=x,r=E,c=R}s&&s.length>0&&p.push(s);const u=[];for(let o=0;o<p.length;o++)o<p.length-1&&p[o].length===1&&S.test(p[o])&&b.test(p[o+1][0])?(u.push(p[o]+p[o+1]),o+=1):u.push(p[o]);return u}if(t.startsWith("el")){if(!j.test(e)&&!S.test(e))return[e];const n=[];z.lastIndex=0;let l;for(;(l=z.exec(e))!==null;)n.push(l[0]);n.length===0&&n.push(e);const p=[];if(n.length===1){const s=n[0];if(!s||!j.test(s[0])||s.length===1)return[s??e]}for(const s of n){if(!s)continue;if(!j.test(s[0])||s.length===1){p.push(s);continue}const i=s.length;let r=s[0],c=s[0]===s[0].toLocaleUpperCase(t);for(let u=1;u<i;u++){const o=s[u],x=o===o.toLocaleUpperCase(t);!c&&x?(p.push(r),r=o):r+=o,c=x}r&&p.push(r)}return p}if(t.startsWith("ja")||t.startsWith("ko")){const n=t.startsWith("ja"),l=n?{hiragana:s=>oe.test(s),kanji:s=>O.test(s),katakana:s=>ae.test(s),latin:s=>S.test(s)}:{hangul:s=>M.test(s),latin:s=>S.test(s)},p=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(n){const s=U(e,l,!1,t,(r,c)=>r==="hiragana"&&c==="katakana"||r==="katakana"&&c==="hiragana"||r==="hiragana"&&c==="latin"||r==="katakana"&&c==="latin"||r==="kanji"&&c==="latin"||r==="latin"&&(c==="hiragana"||c==="katakana"||c==="kanji")),i=[];for(const r of s){const c=r;c.length===1&&p.has(c)&&i.length>0?i[i.length-1]=i.at(-1)+c:i.push(c)}return i.length>0?i:[e]}return U(e,l,!1,t,(s,i)=>s==="hangul"&&i==="latin"||s==="latin"&&i==="hangul")}if(t.startsWith("sl")){const n=[...e],l=n.length,p=[];let s=n[0],i=n[0]===n[0].toLocaleUpperCase(t);for(let r=1;r<l;r++){const c=n[r],u=c===c.toLocaleUpperCase(t),o=ye.test(c),x=r<l-1&&n[r+1]===n[r+1].toLocaleUpperCase(t);!i&&u||o&&x?(p.push(s),s=c,o&&x&&(p.push(s),s="")):s+=c,i=u}return s&&s.length>0&&p.push(s),p}if(t.startsWith("zh"))return U(e,{han:n=>O.test(n),latin:n=>S.test(n)},!1,t);if(["ar","fa","he","ur"].includes(t.split("-")[0])){const n=l=>I.test(l)||F.test(l);return U(e,{latin:l=>S.test(l),rtl:l=>n(l)},!1,t)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(t.split("-")[0])){const n=l=>ne.test(l)||se.test(l)||ie.test(l)||le.test(l)||ce.test(l)||xe.test(l)||we.test(l)||he.test(l)||de.test(l)||Ee.test(l)||ue.test(l)||ke.test(l)||fe.test(l)||re.test(l)||pe.test(l)||ge.test(l);return U(e,{indic:l=>n(l),latin:l=>S.test(l)},!1,t)}if(["be","bg","ru","sr","uk"].includes(t))return U(e,{cyrillic:n=>b.test(n),latin:n=>S.test(n)},!0,t);if(["ar","fa","he"].includes(t))return U(e,{latin:n=>S.test(n),rtl:n=>I.test(n)||F.test(n)},!1,t);if(t.startsWith("ko"))return U(e,{hangul:n=>M.test(n),latin:n=>S.test(n)},!1,t);if(t.startsWith("uz")){if(!b.test(e)&&!S.test(e))return[e];const n=[...e],l=n.length,p=[];let s=n[0],i=n[0]===n[0].toLocaleUpperCase(t);for(let r=1;r<l;r++){const c=n[r],u=c===c.toLocaleUpperCase(t);if(q.test(c)||q.test(n[r-1])){s+=c;continue}!i&&u?(p.push(s),s=c):s+=c,i=u}return s&&s.length>0&&p.push(s),p}const d=[...e],h=d.length,k=[];let g=d[0],w=d[0]===d[0].toLocaleUpperCase(t);for(const n of a)if(e.startsWith(n)){k.push(n),g=d[n.length],w=g===g.toLocaleUpperCase(t);break}for(let n=1;n<h;n++){const l=d[n],p=l===l.toLocaleUpperCase(t);let s=0;for(const i of a)if(e.startsWith(i,n)){k.push(g,i),s=i.length,g="";const r=i.at(-1);r&&(w=r===r.toLocaleUpperCase(t));break}if(s>0){n+=s-1;continue}!w&&p?(k.push(g),g=l):g+=l,w=p}return g&&k.push(g),k},je=(e,t,a)=>{const f=[],d=$.test(e)?e.split($).filter(Boolean):[e];for(const h of d){const k=h;if($.test(k))f.push(k);else{m.lastIndex=0;const g=m.test(k)?We(k).filter(Boolean):[k];for(const w of g)if(m.lastIndex=0,m.test(w))f.push(w);else if(t){const n=t.toLowerCase().split("-")[0];f.push(...V(w,n,a))}else f.push(...N(w,a))}}return f},Oe=(e,t={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:a=!1,handleEmoji:f=!1,knownAcronyms:d=[],locale:h,normalize:k=!1,separators:g,stripAnsi:w=!1,stripEmoji:n=!1}=t,l=new Set([...d].toSorted((o,x)=>x.length-o.length));let p=e;w&&(p=Ue(p)),n&&(p=Se(p));let s;Array.isArray(g)?s=be(g):g instanceof RegExp?s=g:s=te;const i=[];let r=p;const c=s.flags.includes("g")?s:new RegExp(s.source,`${s.flags}g`);for(;r.length>0;){const o=c.exec(r);if(!o){r===".."?i.push(".."):r==="."?i.push("."):r.length>0&&i.push(r);break}const x=o.index,E=o[0],R=E.length,v=r.slice(0,x),Z=r.slice(x+R);if(E.startsWith("../"))i.push(".."),r=r.slice(x+3);else if(E.startsWith("./"))i.push("."),r=r.slice(x+2);else if(x===0&&E==="..")i.push(".."),r=r.slice(2);else if(x===0&&E===".")i.push("."),r=r.slice(1);else{v.length>0&&i.push(v);let C=0;for(;(C=E.indexOf("../",C))!==-1;)i.push(".."),C+=3;for(C=0;(C=E.indexOf("./",C))!==-1;)(C===0||E[C-1]!==".")&&i.push("."),C+=2;let L=Z;for(;L.startsWith("../");)i.push(".."),L=L.slice(3);for(;L.startsWith("./");)i.push("."),L=L.slice(2);if(L===".."){i.push("..");break}else if(L==="."){i.push(".");break}else r=L}c.lastIndex=0}if(i.length===0){const o=p.split(s).filter(Boolean);i.push(...o)}let u=[];for(const o of i)a||f?u.push(...je(o,h,l)):h?u.push(...V(o,h,l)):u.push(...N(o,l));return k&&(u=u.map(o=>l.has(o)?o:h&&o===o.toLocaleUpperCase(h)?o[0]+o.slice(1).toLocaleLowerCase(h):o.toUpperCase()===o&&!l.has(o)?o.slice(0,1)+o.slice(1).toLowerCase():o)),u};export{Oe as A,ve as B,Fe as F,_e as R,Te as d,$ as k,ze as l,Me as m,m as n,Be as x,Ie as y};
1
+ import{createRequire as J}from"node:module";const Q=J(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,X=e=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[t,a]=W.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return W.getBuiltinModule(e)}return Q(e)},{createRequire:Y}=X("node:module"),H=String.raw,T=H`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,ee=()=>new RegExp(H`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${T}(?:\u200D${T})*`,"gu");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const Be=/^[ \t]*(?:\r\n|\r|\n)/,_e=/(?:\r\n|\r|\n)[ \t]*$/,ve=/^(?:[\r\n]|$)/,Te=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,Fe=/^[ \t]*[\r\n][ \t\r\n]*$/,ze=/\r\n|\n|\r/g,Me=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,Ie=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,m=ee(),te=/[-_./\s]+/g,$=/(\u001B\[[0-9;]*[a-z])/i,F=new RegExp("\\p{Script=Arabic}","u"),se=new RegExp("\\p{Script=Bengali}","u"),b=new RegExp("\\p{Script=Cyrillic}","u"),ne=new RegExp("\\p{Script=Devanagari}","u"),re=new RegExp("\\p{Script=Ethiopic}","u"),j=new RegExp("\\p{Script=Greek}","u"),z=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),ie=new RegExp("\\p{Script=Gujarati}","u"),le=new RegExp("\\p{Script=Gurmukhi}","u"),M=new RegExp("\\p{Script=Hangul}","u"),I=new RegExp("\\p{Script=Hebrew}","u"),oe=new RegExp("\\p{Script=Hiragana}","u"),O=new RegExp("\\p{Script=Han}","u"),ce=new RegExp("\\p{Script=Kannada}","u"),ae=new RegExp("\\p{Script=Katakana}","u"),pe=new RegExp("\\p{Script=Khmer}","u"),ue=new RegExp("\\p{Script=Lao}","u"),S=new RegExp("\\p{Script=Latin}","u"),he=new RegExp("\\p{Script=Malayalam}","u"),fe=new RegExp("\\p{Script=Myanmar}","u"),ge=new RegExp("\\p{Script=Oriya}","u"),de=new RegExp("\\p{Script=Sinhala}","u"),xe=new RegExp("\\p{Script=Tamil}","u"),we=new RegExp("\\p{Script=Telugu}","u"),Ee=new RegExp("\\p{Script=Thai}","u"),ke=new RegExp("\\p{Script=Tibetan}","u"),q=/[\u02BB\u02BC\u0027]/u,Se=e=>e.replace(m,"");class Re{capacity;cache;constructor(t){this.capacity=t,this.cache=new Map}get(t){if(!this.cache.has(t))return;const a=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,a),a}has(t){return this.cache.has(t)}set(t,a){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.capacity){const f=this.cache.keys().next().value;f!==void 0&&this.cache.delete(f)}this.cache.set(t,a)}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}size(){return this.cache.size}}const Ce=Y(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Le=e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[t,a]=y.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return y.getBuiltinModule(e)}return Ce(e)},{stripVTControlCharacters:Ue}=Le("node:util"),A=new Re(1e3),me=/[.*+?^${}()|[\]\\]/g,be=e=>{const t=e.join("");if(A.has(t)){const d=A.get(t);return d.lastIndex=0,d}const a=e.map(d=>d.replaceAll(me,String.raw`\$&`)).join("|"),f=new RegExp(a,"g");return A.set(t,f),f},We=e=>{const t=[];let a=0,f;for(m.lastIndex=0;(f=m.exec(e))!==null;)f.index>a&&t.push(e.slice(a,f.index)),t.push(f[0]),a=m.lastIndex;return a<e.length&&t.push(e.slice(a)),t.filter(Boolean)},ye=/[ČŠŽĐ]/i,P=new Uint8Array(128),D=new Uint8Array(128),K=new Uint8Array(128);for(let e=0;e<128;e++)P[e]=e>=65&&e<=90?1:0,D[e]=e>=97&&e<=122?1:0,K[e]=e>=48&&e<=57?1:0;const B=e=>P[e],G=e=>D[e],_=e=>K[e],U=(e,t,a,f,d)=>{if(e.length===0)return[];let h=!1;const k=Object.values(t);for(const i of k)if(i(e[0])){h=!0;break}if(!h&&!a)return[e];const g=[...e],w=[];let n=g[0],l="other";const p=Object.entries(t);for(const i of p){const[r,c]=i;if(c(g[0])){l=r;break}}let s=a&&f?g[0]===g[0].toLocaleUpperCase(f):!1;for(let i=1;i<g.length;i++){const r=g[i];let c="other";for(const x of p){const[E,R]=x;if(R(r)){c=E;break}}const u=a&&f?r===r.toLocaleUpperCase(f):!1;let o=!1;d?o=d(l,c,s,u,r,i,g):(l!==c&&l!=="other"&&c!=="other"&&(o=!0),a&&c!=="other"&&!s&&u&&(o=!0)),o?(w.push(n),n=r):n+=r,l=c,a&&(s=u)}return n&&n.length>0&&w.push(n),w.length>0?w:[e]},$e=(e,t,a,f)=>{if(a.size===0)return t;for(const d of a)if(e.startsWith(d,t))return f.push(d),t+d.length;return t},N=(e,t=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let a=0;const f=[],d=e.length;for(let h=1;h<d;h++){const k=$e(e,a,t,f);if(k!==a){a=k,h=a-1;continue}const g=e.codePointAt(h-1),w=e.codePointAt(h),n=g&&g<128&&B(g),l=w&&w<128&&B(w),p=g&&g<128&&G(g),s=g&&g<128&&_(g),i=w&&w<128&&_(w);if(p&&l){f.push(e.slice(a,h)),a=h;continue}if(s&&!i||!s&&i){f.push(e.slice(a,h)),a=h;continue}if(i&&!s){let r=!1,c=!1;if(h+1<d){const u=e.codePointAt(h+1);r=u&&u<128&&B(u),c=u&&u<128&&_(u)}if(!c&&r){f.push(e.slice(a,h),e.slice(h,h+1)),a=h+1;continue}}if(h+1<d){const r=e.codePointAt(h+1),c=r&&r<128&&G(r);if(n&&l&&c){const u=e.slice(a,h+1);t.has(u)||(f.push(e.slice(a,h)),a=h)}}}return a<d&&f.push(e.slice(a)),f.filter(h=>h!=="")},V=(e,t,a)=>{if(e.length===0)return[];const f=e===e.toLocaleUpperCase(t);if(t.startsWith("de")){if(!f&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(t))return[e];const n=[...e],l=n.length,p=[];let s=n[0],i=n[0]===n[0].toLocaleUpperCase(t),r=i,c=i?0:-1;for(let u=1;u<l;u++){const o=n[u],x=o===o.toLocaleUpperCase(t);if(x===i)s+=o;else if(x)s&&s.length>0&&(p.push(s),s=o),r=!0,c=u;else{if(r&&u-c>1){const E=n[u-1],R=s.slice(0,-1);R&&R.length>0&&p.push(R),s=E+o}else s+=o;r=!1,c=-1}i=x}return s&&s.length>0&&p.push(s),p}if(t.startsWith("uk")||t.startsWith("ru")||t.startsWith("bg")||t.startsWith("sr")||t.startsWith("mk")||t.startsWith("be")){if(!b.test(e)&&!S.test(e))return[e];const n=[...e],l=n.length,p=[];let s=n[0];const i=n[0];let r;b.test(i)?r=1:S.test(i)?r=2:r=0;let c=i===i.toLocaleUpperCase(t);for(let o=1;o<l;o++){const x=n[o];let E;b.test(x)?E=1:S.test(x)?E=2:E=0;const R=x===x.toLocaleUpperCase(t);r!==E&&(r===1||r===2)&&(E===1||E===2)||E===r&&!c&&R?(p.push(s),s=x):s+=x,r=E,c=R}s&&s.length>0&&p.push(s);const u=[];for(let o=0;o<p.length;o++)o<p.length-1&&p[o].length===1&&S.test(p[o])&&b.test(p[o+1][0])?(u.push(p[o]+p[o+1]),o+=1):u.push(p[o]);return u}if(t.startsWith("el")){if(!j.test(e)&&!S.test(e))return[e];const n=[];z.lastIndex=0;let l;for(;(l=z.exec(e))!==null;)n.push(l[0]);n.length===0&&n.push(e);const p=[];if(n.length===1){const s=n[0];if(!s||!j.test(s[0])||s.length===1)return[s??e]}for(const s of n){if(!s)continue;if(!j.test(s[0])||s.length===1){p.push(s);continue}const i=s.length;let r=s[0],c=s[0]===s[0].toLocaleUpperCase(t);for(let u=1;u<i;u++){const o=s[u],x=o===o.toLocaleUpperCase(t);!c&&x?(p.push(r),r=o):r+=o,c=x}r&&p.push(r)}return p}if(t.startsWith("ja")||t.startsWith("ko")){const n=t.startsWith("ja"),l=n?{hiragana:s=>oe.test(s),kanji:s=>O.test(s),katakana:s=>ae.test(s),latin:s=>S.test(s)}:{hangul:s=>M.test(s),latin:s=>S.test(s)},p=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(n){const s=U(e,l,!1,t,(r,c)=>r==="hiragana"&&c==="katakana"||r==="katakana"&&c==="hiragana"||r==="hiragana"&&c==="latin"||r==="katakana"&&c==="latin"||r==="kanji"&&c==="latin"||r==="latin"&&(c==="hiragana"||c==="katakana"||c==="kanji")),i=[];for(const r of s){const c=r;c.length===1&&p.has(c)&&i.length>0?i[i.length-1]=i.at(-1)+c:i.push(c)}return i.length>0?i:[e]}return U(e,l,!1,t,(s,i)=>s==="hangul"&&i==="latin"||s==="latin"&&i==="hangul")}if(t.startsWith("sl")){const n=[...e],l=n.length,p=[];let s=n[0],i=n[0]===n[0].toLocaleUpperCase(t);for(let r=1;r<l;r++){const c=n[r],u=c===c.toLocaleUpperCase(t),o=ye.test(c),x=r<l-1&&n[r+1]===n[r+1].toLocaleUpperCase(t);!i&&u||o&&x?(p.push(s),s=c,o&&x&&(p.push(s),s="")):s+=c,i=u}return s&&s.length>0&&p.push(s),p}if(t.startsWith("zh"))return U(e,{han:n=>O.test(n),latin:n=>S.test(n)},!1,t);if(["ar","fa","he","ur"].includes(t.split("-")[0])){const n=l=>I.test(l)||F.test(l);return U(e,{latin:l=>S.test(l),rtl:l=>n(l)},!1,t)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(t.split("-")[0])){const n=l=>ne.test(l)||se.test(l)||ie.test(l)||le.test(l)||ce.test(l)||xe.test(l)||we.test(l)||he.test(l)||de.test(l)||Ee.test(l)||ue.test(l)||ke.test(l)||fe.test(l)||re.test(l)||pe.test(l)||ge.test(l);return U(e,{indic:l=>n(l),latin:l=>S.test(l)},!1,t)}if(["be","bg","ru","sr","uk"].includes(t))return U(e,{cyrillic:n=>b.test(n),latin:n=>S.test(n)},!0,t);if(["ar","fa","he"].includes(t))return U(e,{latin:n=>S.test(n),rtl:n=>I.test(n)||F.test(n)},!1,t);if(t.startsWith("ko"))return U(e,{hangul:n=>M.test(n),latin:n=>S.test(n)},!1,t);if(t.startsWith("uz")){if(!b.test(e)&&!S.test(e))return[e];const n=[...e],l=n.length,p=[];let s=n[0],i=n[0]===n[0].toLocaleUpperCase(t);for(let r=1;r<l;r++){const c=n[r],u=c===c.toLocaleUpperCase(t);if(q.test(c)||q.test(n[r-1])){s+=c;continue}!i&&u?(p.push(s),s=c):s+=c,i=u}return s&&s.length>0&&p.push(s),p}const d=[...e],h=d.length,k=[];let g=d[0],w=d[0]===d[0].toLocaleUpperCase(t);for(const n of a)if(e.startsWith(n)){k.push(n),g=d[n.length],w=g===g.toLocaleUpperCase(t);break}for(let n=1;n<h;n++){const l=d[n],p=l===l.toLocaleUpperCase(t);let s=0;for(const i of a)if(e.startsWith(i,n)){k.push(g,i),s=i.length,g="";const r=i.at(-1);r&&(w=r===r.toLocaleUpperCase(t));break}if(s>0){n+=s-1;continue}!w&&p?(k.push(g),g=l):g+=l,w=p}return g&&k.push(g),k},je=(e,t,a)=>{const f=[],d=$.test(e)?e.split($).filter(Boolean):[e];for(const h of d){const k=h;if($.test(k))f.push(k);else{m.lastIndex=0;const g=m.test(k)?We(k).filter(Boolean):[k];for(const w of g)if(m.lastIndex=0,m.test(w))f.push(w);else if(t){const n=t.toLowerCase().split("-")[0];f.push(...V(w,n,a))}else f.push(...N(w,a))}}return f},Oe=(e,t={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:a=!1,handleEmoji:f=!1,knownAcronyms:d=[],locale:h,normalize:k=!1,separators:g,stripAnsi:w=!1,stripEmoji:n=!1}=t,l=new Set([...d].toSorted((o,x)=>x.length-o.length));let p=e;w&&(p=Ue(p)),n&&(p=Se(p));let s;Array.isArray(g)?s=be(g):g instanceof RegExp?s=g:s=te;const i=[];let r=p;const c=s.flags.includes("g")?s:new RegExp(s.source,`${s.flags}g`);for(;r.length>0;){const o=c.exec(r);if(!o){r===".."?i.push(".."):r==="."?i.push("."):r.length>0&&i.push(r);break}const x=o.index,E=o[0],R=E.length,v=r.slice(0,x),Z=r.slice(x+R);if(E.startsWith("../"))i.push(".."),r=r.slice(x+3);else if(E.startsWith("./"))i.push("."),r=r.slice(x+2);else if(x===0&&E==="..")i.push(".."),r=r.slice(2);else if(x===0&&E===".")i.push("."),r=r.slice(1);else{v.length>0&&i.push(v);let C=0;for(;(C=E.indexOf("../",C))!==-1;)i.push(".."),C+=3;for(C=0;(C=E.indexOf("./",C))!==-1;)(C===0||E[C-1]!==".")&&i.push("."),C+=2;let L=Z;for(;L.startsWith("../");)i.push(".."),L=L.slice(3);for(;L.startsWith("./");)i.push("."),L=L.slice(2);if(L===".."){i.push("..");break}else if(L==="."){i.push(".");break}else r=L}c.lastIndex=0}if(i.length===0){const o=p.split(s).filter(Boolean);i.push(...o)}let u=[];for(const o of i)a||f?u.push(...je(o,h,l)):h?u.push(...V(o,h,l)):u.push(...N(o,l));return k&&(u=u.map(o=>l.has(o)?o:h&&o===o.toLocaleUpperCase(h)?o[0]+o.slice(1).toLocaleLowerCase(h):o.toUpperCase()===o&&!l.has(o)?o.slice(0,1)+o.slice(1).toLowerCase():o)),u};export{Oe as A,ve as B,Te as F,_e as R,Me as d,$ as k,Fe as l,ze as m,m as n,Be as x,Ie as y};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/cerebro",
3
- "version": "3.0.0-alpha.32",
3
+ "version": "3.0.0-alpha.33",
4
4
  "description": "A delightful toolkit for building cross-runtime CLIs for Node.js, Deno, and Bun.",
5
5
  "keywords": [
6
6
  "ansi",
@@ -109,16 +109,16 @@
109
109
  "LICENSE.md"
110
110
  ],
111
111
  "dependencies": {
112
- "@visulima/colorize": "2.0.0-alpha.14",
112
+ "@visulima/colorize": "2.0.0-alpha.15",
113
113
  "@visulima/tabular": "4.0.0-alpha.14",
114
114
  "fastest-levenshtein": "^1.0.16"
115
115
  },
116
116
  "peerDependencies": {
117
- "@bomb.sh/tab": "0.0.16",
118
- "@visulima/boxen": "3.0.0-alpha.14",
117
+ "@bomb.sh/tab": ">=0.0.16",
118
+ "@visulima/boxen": "3.0.0-alpha.15",
119
119
  "@visulima/find-cache-dir": "3.0.0-alpha.12",
120
- "@visulima/pail": "4.0.0-alpha.22",
121
- "github-slugger": "2.0.0"
120
+ "@visulima/pail": "4.0.0-alpha.23",
121
+ "github-slugger": ">=2.0.0"
122
122
  },
123
123
  "peerDependenciesMeta": {
124
124
  "@bomb.sh/tab": {