@jup-ag/cli 0.1.0 → 0.2.1

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/dist/index.js CHANGED
@@ -1,45 +1,45 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as MG}from"node:module";var LG=Object.create;var{getPrototypeOf:BG,defineProperty:x6,getOwnPropertyNames:RG}=Object;var IG=Object.prototype.hasOwnProperty;function wG(D){return this[D]}var OG,TG,b6=(D,$,J)=>{var Q=D!=null&&typeof D==="object";if(Q){var G=$?OG??=new WeakMap:TG??=new WeakMap,q=G.get(D);if(q)return q}J=D!=null?LG(BG(D)):{};let X=$||!D||!D.__esModule?x6(J,"default",{value:D,enumerable:!0}):J;for(let Y of RG(D))if(!IG.call(X,Y))x6(X,Y,{get:wG.bind(D,Y),enumerable:!0});if(Q)G.set(D,X);return X};var c=(D,$)=>()=>($||D(($={exports:{}}).exports,$),$.exports);var z0=MG(import.meta.url);var $8=c((PG)=>{class I9 extends Error{constructor(D,$,J){super(J);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=$,this.exitCode=D,this.nestedError=void 0}}class h6 extends I9{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}PG.CommanderError=I9;PG.InvalidArgumentError=h6});var x8=c((xG)=>{var{InvalidArgumentError:kG}=$8();class v6{constructor(D,$){switch(this.description=$||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(D,$){if($===this.defaultValue||!Array.isArray($))return[D];return $.push(D),$}default(D,$){return this.defaultValue=D,this.defaultValueDescription=$,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=($,J)=>{if(!this.argChoices.includes($))throw new kG(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue($,J);return $},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function AG(D){let $=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+$+">":"["+$+"]"}xG.Argument=v6;xG.humanReadableArgName=AG});var w9=c((yG)=>{var{humanReadableArgName:vG}=x8();class y6{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(D){this.helpWidth=this.helpWidth??D.helpWidth??80}visibleCommands(D){let $=D.commands.filter((Q)=>!Q._hidden),J=D._getHelpCommand();if(J&&!J._hidden)$.push(J);if(this.sortSubcommands)$.sort((Q,G)=>{return Q.name().localeCompare(G.name())});return $}compareOptions(D,$){let J=(Q)=>{return Q.short?Q.short.replace(/^-/,""):Q.long.replace(/^--/,"")};return J(D).localeCompare(J($))}visibleOptions(D){let $=D.options.filter((Q)=>!Q.hidden),J=D._getHelpOption();if(J&&!J.hidden){let Q=J.short&&D._findOption(J.short),G=J.long&&D._findOption(J.long);if(!Q&&!G)$.push(J);else if(J.long&&!G)$.push(D.createOption(J.long,J.description));else if(J.short&&!Q)$.push(D.createOption(J.short,J.description))}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let $=[];for(let J=D.parent;J;J=J.parent){let Q=J.options.filter((G)=>!G.hidden);$.push(...Q)}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach(($)=>{$.description=$.description||D._argsDescription[$.name()]||""});if(D.registeredArguments.find(($)=>$.description))return D.registeredArguments;return[]}subcommandTerm(D){let $=D.registeredArguments.map((J)=>vG(J)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+($?" "+$:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,$){return $.visibleCommands(D).reduce((J,Q)=>{return Math.max(J,this.displayWidth($.styleSubcommandTerm($.subcommandTerm(Q))))},0)}longestOptionTermLength(D,$){return $.visibleOptions(D).reduce((J,Q)=>{return Math.max(J,this.displayWidth($.styleOptionTerm($.optionTerm(Q))))},0)}longestGlobalOptionTermLength(D,$){return $.visibleGlobalOptions(D).reduce((J,Q)=>{return Math.max(J,this.displayWidth($.styleOptionTerm($.optionTerm(Q))))},0)}longestArgumentTermLength(D,$){return $.visibleArguments(D).reduce((J,Q)=>{return Math.max(J,this.displayWidth($.styleArgumentTerm($.argumentTerm(Q))))},0)}commandUsage(D){let $=D._name;if(D._aliases[0])$=$+"|"+D._aliases[0];let J="";for(let Q=D.parent;Q;Q=Q.parent)J=Q.name()+" "+J;return J+$+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let $=[];if(D.argChoices)$.push(`choices: ${D.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")$.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)$.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)$.push(`env: ${D.envVar}`);if($.length>0){let J=`(${$.join(", ")})`;if(D.description)return`${D.description} ${J}`;return J}return D.description}argumentDescription(D){let $=[];if(D.argChoices)$.push(`choices: ${D.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if(D.defaultValue!==void 0)$.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if($.length>0){let J=`(${$.join(", ")})`;if(D.description)return`${D.description} ${J}`;return J}return D.description}formatItemList(D,$,J){if($.length===0)return[];return[J.styleTitle(D),...$,""]}groupItems(D,$,J){let Q=new Map;return D.forEach((G)=>{let q=J(G);if(!Q.has(q))Q.set(q,[])}),$.forEach((G)=>{let q=J(G);if(!Q.has(q))Q.set(q,[]);Q.get(q).push(G)}),Q}formatHelp(D,$){let J=$.padWidth(D,$),Q=$.helpWidth??80;function G(j,U){return $.formatItem(j,J,U,$)}let q=[`${$.styleTitle("Usage:")} ${$.styleUsage($.commandUsage(D))}`,""],X=$.commandDescription(D);if(X.length>0)q=q.concat([$.boxWrap($.styleCommandDescription(X),Q),""]);let Y=$.visibleArguments(D).map((j)=>{return G($.styleArgumentTerm($.argumentTerm(j)),$.styleArgumentDescription($.argumentDescription(j)))});if(q=q.concat(this.formatItemList("Arguments:",Y,$)),this.groupItems(D.options,$.visibleOptions(D),(j)=>j.helpGroupHeading??"Options:").forEach((j,U)=>{let C=j.map((z)=>{return G($.styleOptionTerm($.optionTerm(z)),$.styleOptionDescription($.optionDescription(z)))});q=q.concat(this.formatItemList(U,C,$))}),$.showGlobalOptions){let j=$.visibleGlobalOptions(D).map((U)=>{return G($.styleOptionTerm($.optionTerm(U)),$.styleOptionDescription($.optionDescription(U)))});q=q.concat(this.formatItemList("Global Options:",j,$))}return this.groupItems(D.commands,$.visibleCommands(D),(j)=>j.helpGroup()||"Commands:").forEach((j,U)=>{let C=j.map((z)=>{return G($.styleSubcommandTerm($.subcommandTerm(z)),$.styleSubcommandDescription($.subcommandDescription(z)))});q=q.concat(this.formatItemList(U,C,$))}),q.join(`
3
- `)}displayWidth(D){return f6(D).length}styleTitle(D){return D}styleUsage(D){return D.split(" ").map(($)=>{if($==="[options]")return this.styleOptionText($);if($==="[command]")return this.styleSubcommandText($);if($[0]==="["||$[0]==="<")return this.styleArgumentText($);return this.styleCommandText($)}).join(" ")}styleCommandDescription(D){return this.styleDescriptionText(D)}styleOptionDescription(D){return this.styleDescriptionText(D)}styleSubcommandDescription(D){return this.styleDescriptionText(D)}styleArgumentDescription(D){return this.styleDescriptionText(D)}styleDescriptionText(D){return D}styleOptionTerm(D){return this.styleOptionText(D)}styleSubcommandTerm(D){return D.split(" ").map(($)=>{if($==="[options]")return this.styleOptionText($);if($[0]==="["||$[0]==="<")return this.styleArgumentText($);return this.styleSubcommandText($)}).join(" ")}styleArgumentTerm(D){return this.styleArgumentText(D)}styleOptionText(D){return D}styleArgumentText(D){return D}styleSubcommandText(D){return D}styleCommandText(D){return D}padWidth(D,$){return Math.max($.longestOptionTermLength(D,$),$.longestGlobalOptionTermLength(D,$),$.longestSubcommandTermLength(D,$),$.longestArgumentTermLength(D,$))}preformatted(D){return/\n[^\S\r\n]/.test(D)}formatItem(D,$,J,Q){let q=" ".repeat(2);if(!J)return q+D;let X=D.padEnd($+D.length-Q.displayWidth(D)),Y=2,K=(this.helpWidth??80)-$-Y-2,j;if(K<this.minWidthToWrap||Q.preformatted(J))j=J;else j=Q.boxWrap(J,K).replace(/\n/g,`
4
- `+" ".repeat($+Y));return q+X+" ".repeat(Y)+j.replace(/\n/g,`
5
- ${q}`)}boxWrap(D,$){if($<this.minWidthToWrap)return D;let J=D.split(/\r\n|\n/),Q=/[\s]*[^\s]+/g,G=[];return J.forEach((q)=>{let X=q.match(Q);if(X===null){G.push("");return}let Y=[X.shift()],Z=this.displayWidth(Y[0]);X.forEach((K)=>{let j=this.displayWidth(K);if(Z+j<=$){Y.push(K),Z+=j;return}G.push(Y.join(""));let U=K.trimStart();Y=[U],Z=this.displayWidth(U)}),G.push(Y.join(""))}),G.join(`
6
- `)}}function f6(D){let $=/\x1b\[\d*(;\d*)*m/g;return D.replace($,"")}yG.Help=y6;yG.stripColor=f6});var O9=c((lG)=>{var{InvalidArgumentError:uG}=$8();class u6{constructor(D,$){this.flags=D,this.description=$||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let J=gG(D);if(this.short=J.shortFlag,this.long=J.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(D,$){return this.defaultValue=D,this.defaultValueDescription=$,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let $=D;if(typeof D==="string")$={[D]:!0};return this.implied=Object.assign(this.implied||{},$),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_collectValue(D,$){if($===this.defaultValue||!Array.isArray($))return[D];return $.push(D),$}choices(D){return this.argChoices=D.slice(),this.parseArg=($,J)=>{if(!this.argChoices.includes($))throw new uG(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue($,J);return $},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return m6(this.name().replace(/^no-/,""));return m6(this.name())}helpGroup(D){return this.helpGroupHeading=D,this}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class g6{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach(($)=>{if($.negate)this.negativeOptions.set($.attributeName(),$);else this.positiveOptions.set($.attributeName(),$)}),this.negativeOptions.forEach(($,J)=>{if(this.positiveOptions.has(J))this.dualOptions.add(J)})}valueFromOption(D,$){let J=$.attributeName();if(!this.dualOptions.has(J))return!0;let Q=this.negativeOptions.get(J).presetArg,G=Q!==void 0?Q:!1;return $.negate===(G===D)}}function m6(D){return D.split("-").reduce(($,J)=>{return $+J[0].toUpperCase()+J.slice(1)})}function gG(D){let $,J,Q=/^-[^-]$/,G=/^--[^-]/,q=D.split(/[ |,]+/).concat("guard");if(Q.test(q[0]))$=q.shift();if(G.test(q[0]))J=q.shift();if(!$&&Q.test(q[0]))$=q.shift();if(!$&&G.test(q[0]))$=J,J=q.shift();if(q[0].startsWith("-")){let X=q[0],Y=`option creation failed due to '${X}' in option flags '${D}'`;if(/^-[^-][^-]/.test(X))throw Error(`${Y}
2
+ import{createRequire as Aq}from"node:module";var Tq=Object.create;var{getPrototypeOf:Oq,defineProperty:y7,getOwnPropertyNames:Mq}=Object;var Pq=Object.prototype.hasOwnProperty;function _q(D){return this[D]}var Sq,kq,f7=(D,$,J)=>{var Q=D!=null&&typeof D==="object";if(Q){var q=$?Sq??=new WeakMap:kq??=new WeakMap,G=q.get(D);if(G)return G}J=D!=null?Tq(Oq(D)):{};let X=$||!D||!D.__esModule?y7(J,"default",{value:D,enumerable:!0}):J;for(let Y of Mq(D))if(!Pq.call(X,Y))y7(X,Y,{get:_q.bind(D,Y),enumerable:!0});if(Q)q.set(D,X);return X};var a=(D,$)=>()=>($||D(($={exports:{}}).exports,$),$.exports);var V0=Aq(import.meta.url);var G8=a((xq)=>{class M9 extends Error{constructor(D,$,J){super(J);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=$,this.exitCode=D,this.nestedError=void 0}}class m7 extends M9{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}xq.CommanderError=M9;xq.InvalidArgumentError=m7});var y8=a((fq)=>{var{InvalidArgumentError:vq}=G8();class u7{constructor(D,$){switch(this.description=$||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(D,$){if($===this.defaultValue||!Array.isArray($))return[D];return $.push(D),$}default(D,$){return this.defaultValue=D,this.defaultValueDescription=$,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=($,J)=>{if(!this.argChoices.includes($))throw new vq(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue($,J);return $},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function yq(D){let $=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+$+">":"["+$+"]"}fq.Argument=u7;fq.humanReadableArgName=yq});var P9=a((lq)=>{var{humanReadableArgName:gq}=y8();class g7{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(D){this.helpWidth=this.helpWidth??D.helpWidth??80}visibleCommands(D){let $=D.commands.filter((Q)=>!Q._hidden),J=D._getHelpCommand();if(J&&!J._hidden)$.push(J);if(this.sortSubcommands)$.sort((Q,q)=>{return Q.name().localeCompare(q.name())});return $}compareOptions(D,$){let J=(Q)=>{return Q.short?Q.short.replace(/^-/,""):Q.long.replace(/^--/,"")};return J(D).localeCompare(J($))}visibleOptions(D){let $=D.options.filter((Q)=>!Q.hidden),J=D._getHelpOption();if(J&&!J.hidden){let Q=J.short&&D._findOption(J.short),q=J.long&&D._findOption(J.long);if(!Q&&!q)$.push(J);else if(J.long&&!q)$.push(D.createOption(J.long,J.description));else if(J.short&&!Q)$.push(D.createOption(J.short,J.description))}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let $=[];for(let J=D.parent;J;J=J.parent){let Q=J.options.filter((q)=>!q.hidden);$.push(...Q)}if(this.sortOptions)$.sort(this.compareOptions);return $}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach(($)=>{$.description=$.description||D._argsDescription[$.name()]||""});if(D.registeredArguments.find(($)=>$.description))return D.registeredArguments;return[]}subcommandTerm(D){let $=D.registeredArguments.map((J)=>gq(J)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+($?" "+$:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,$){return $.visibleCommands(D).reduce((J,Q)=>{return Math.max(J,this.displayWidth($.styleSubcommandTerm($.subcommandTerm(Q))))},0)}longestOptionTermLength(D,$){return $.visibleOptions(D).reduce((J,Q)=>{return Math.max(J,this.displayWidth($.styleOptionTerm($.optionTerm(Q))))},0)}longestGlobalOptionTermLength(D,$){return $.visibleGlobalOptions(D).reduce((J,Q)=>{return Math.max(J,this.displayWidth($.styleOptionTerm($.optionTerm(Q))))},0)}longestArgumentTermLength(D,$){return $.visibleArguments(D).reduce((J,Q)=>{return Math.max(J,this.displayWidth($.styleArgumentTerm($.argumentTerm(Q))))},0)}commandUsage(D){let $=D._name;if(D._aliases[0])$=$+"|"+D._aliases[0];let J="";for(let Q=D.parent;Q;Q=Q.parent)J=Q.name()+" "+J;return J+$+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let $=[];if(D.argChoices)$.push(`choices: ${D.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")$.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)$.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)$.push(`env: ${D.envVar}`);if($.length>0){let J=`(${$.join(", ")})`;if(D.description)return`${D.description} ${J}`;return J}return D.description}argumentDescription(D){let $=[];if(D.argChoices)$.push(`choices: ${D.argChoices.map((J)=>JSON.stringify(J)).join(", ")}`);if(D.defaultValue!==void 0)$.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if($.length>0){let J=`(${$.join(", ")})`;if(D.description)return`${D.description} ${J}`;return J}return D.description}formatItemList(D,$,J){if($.length===0)return[];return[J.styleTitle(D),...$,""]}groupItems(D,$,J){let Q=new Map;return D.forEach((q)=>{let G=J(q);if(!Q.has(G))Q.set(G,[])}),$.forEach((q)=>{let G=J(q);if(!Q.has(G))Q.set(G,[]);Q.get(G).push(q)}),Q}formatHelp(D,$){let J=$.padWidth(D,$),Q=$.helpWidth??80;function q(j,K){return $.formatItem(j,J,K,$)}let G=[`${$.styleTitle("Usage:")} ${$.styleUsage($.commandUsage(D))}`,""],X=$.commandDescription(D);if(X.length>0)G=G.concat([$.boxWrap($.styleCommandDescription(X),Q),""]);let Y=$.visibleArguments(D).map((j)=>{return q($.styleArgumentTerm($.argumentTerm(j)),$.styleArgumentDescription($.argumentDescription(j)))});if(G=G.concat(this.formatItemList("Arguments:",Y,$)),this.groupItems(D.options,$.visibleOptions(D),(j)=>j.helpGroupHeading??"Options:").forEach((j,K)=>{let H=j.map((E)=>{return q($.styleOptionTerm($.optionTerm(E)),$.styleOptionDescription($.optionDescription(E)))});G=G.concat(this.formatItemList(K,H,$))}),$.showGlobalOptions){let j=$.visibleGlobalOptions(D).map((K)=>{return q($.styleOptionTerm($.optionTerm(K)),$.styleOptionDescription($.optionDescription(K)))});G=G.concat(this.formatItemList("Global Options:",j,$))}return this.groupItems(D.commands,$.visibleCommands(D),(j)=>j.helpGroup()||"Commands:").forEach((j,K)=>{let H=j.map((E)=>{return q($.styleSubcommandTerm($.subcommandTerm(E)),$.styleSubcommandDescription($.subcommandDescription(E)))});G=G.concat(this.formatItemList(K,H,$))}),G.join(`
3
+ `)}displayWidth(D){return l7(D).length}styleTitle(D){return D}styleUsage(D){return D.split(" ").map(($)=>{if($==="[options]")return this.styleOptionText($);if($==="[command]")return this.styleSubcommandText($);if($[0]==="["||$[0]==="<")return this.styleArgumentText($);return this.styleCommandText($)}).join(" ")}styleCommandDescription(D){return this.styleDescriptionText(D)}styleOptionDescription(D){return this.styleDescriptionText(D)}styleSubcommandDescription(D){return this.styleDescriptionText(D)}styleArgumentDescription(D){return this.styleDescriptionText(D)}styleDescriptionText(D){return D}styleOptionTerm(D){return this.styleOptionText(D)}styleSubcommandTerm(D){return D.split(" ").map(($)=>{if($==="[options]")return this.styleOptionText($);if($[0]==="["||$[0]==="<")return this.styleArgumentText($);return this.styleSubcommandText($)}).join(" ")}styleArgumentTerm(D){return this.styleArgumentText(D)}styleOptionText(D){return D}styleArgumentText(D){return D}styleSubcommandText(D){return D}styleCommandText(D){return D}padWidth(D,$){return Math.max($.longestOptionTermLength(D,$),$.longestGlobalOptionTermLength(D,$),$.longestSubcommandTermLength(D,$),$.longestArgumentTermLength(D,$))}preformatted(D){return/\n[^\S\r\n]/.test(D)}formatItem(D,$,J,Q){let G=" ".repeat(2);if(!J)return G+D;let X=D.padEnd($+D.length-Q.displayWidth(D)),Y=2,U=(this.helpWidth??80)-$-Y-2,j;if(U<this.minWidthToWrap||Q.preformatted(J))j=J;else j=Q.boxWrap(J,U).replace(/\n/g,`
4
+ `+" ".repeat($+Y));return G+X+" ".repeat(Y)+j.replace(/\n/g,`
5
+ ${G}`)}boxWrap(D,$){if($<this.minWidthToWrap)return D;let J=D.split(/\r\n|\n/),Q=/[\s]*[^\s]+/g,q=[];return J.forEach((G)=>{let X=G.match(Q);if(X===null){q.push("");return}let Y=[X.shift()],Z=this.displayWidth(Y[0]);X.forEach((U)=>{let j=this.displayWidth(U);if(Z+j<=$){Y.push(U),Z+=j;return}q.push(Y.join(""));let K=U.trimStart();Y=[K],Z=this.displayWidth(K)}),q.push(Y.join(""))}),q.join(`
6
+ `)}}function l7(D){let $=/\x1b\[\d*(;\d*)*m/g;return D.replace($,"")}lq.Help=g7;lq.stripColor=l7});var _9=a((iq)=>{var{InvalidArgumentError:cq}=G8();class p7{constructor(D,$){this.flags=D,this.description=$||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let J=aq(D);if(this.short=J.shortFlag,this.long=J.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(D,$){return this.defaultValue=D,this.defaultValueDescription=$,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let $=D;if(typeof D==="string")$={[D]:!0};return this.implied=Object.assign(this.implied||{},$),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_collectValue(D,$){if($===this.defaultValue||!Array.isArray($))return[D];return $.push(D),$}choices(D){return this.argChoices=D.slice(),this.parseArg=($,J)=>{if(!this.argChoices.includes($))throw new cq(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue($,J);return $},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return d7(this.name().replace(/^no-/,""));return d7(this.name())}helpGroup(D){return this.helpGroupHeading=D,this}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class c7{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach(($)=>{if($.negate)this.negativeOptions.set($.attributeName(),$);else this.positiveOptions.set($.attributeName(),$)}),this.negativeOptions.forEach(($,J)=>{if(this.positiveOptions.has(J))this.dualOptions.add(J)})}valueFromOption(D,$){let J=$.attributeName();if(!this.dualOptions.has(J))return!0;let Q=this.negativeOptions.get(J).presetArg,q=Q!==void 0?Q:!1;return $.negate===(q===D)}}function d7(D){return D.split("-").reduce(($,J)=>{return $+J[0].toUpperCase()+J.slice(1)})}function aq(D){let $,J,Q=/^-[^-]$/,q=/^--[^-]/,G=D.split(/[ |,]+/).concat("guard");if(Q.test(G[0]))$=G.shift();if(q.test(G[0]))J=G.shift();if(!$&&Q.test(G[0]))$=G.shift();if(!$&&q.test(G[0]))$=J,J=G.shift();if(G[0].startsWith("-")){let X=G[0],Y=`option creation failed due to '${X}' in option flags '${D}'`;if(/^-[^-][^-]/.test(X))throw Error(`${Y}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
9
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(Q.test(X))throw Error(`${Y}
10
- - too many short flags`);if(G.test(X))throw Error(`${Y}
10
+ - too many short flags`);if(q.test(X))throw Error(`${Y}
11
11
  - too many long flags`);throw Error(`${Y}
12
- - unrecognised flag format`)}if($===void 0&&J===void 0)throw Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:$,longFlag:J}}lG.Option=u6;lG.DualOptions=g6});var l6=c((iG)=>{function cG(D,$){if(Math.abs(D.length-$.length)>3)return Math.max(D.length,$.length);let J=[];for(let Q=0;Q<=D.length;Q++)J[Q]=[Q];for(let Q=0;Q<=$.length;Q++)J[0][Q]=Q;for(let Q=1;Q<=$.length;Q++)for(let G=1;G<=D.length;G++){let q=1;if(D[G-1]===$[Q-1])q=0;else q=1;if(J[G][Q]=Math.min(J[G-1][Q]+1,J[G][Q-1]+1,J[G-1][Q-1]+q),G>1&&Q>1&&D[G-1]===$[Q-2]&&D[G-2]===$[Q-1])J[G][Q]=Math.min(J[G][Q],J[G-2][Q-2]+1)}return J[D.length][$.length]}function aG(D,$){if(!$||$.length===0)return"";$=Array.from(new Set($));let J=D.startsWith("--");if(J)D=D.slice(2),$=$.map((X)=>X.slice(2));let Q=[],G=3,q=0.4;if($.forEach((X)=>{if(X.length<=1)return;let Y=cG(D,X),Z=Math.max(D.length,X.length);if((Z-Y)/Z>q){if(Y<G)G=Y,Q=[X];else if(Y===G)Q.push(X)}}),Q.sort((X,Y)=>X.localeCompare(Y)),J)Q=Q.map((X)=>`--${X}`);if(Q.length>1)return`
12
+ - unrecognised flag format`)}if($===void 0&&J===void 0)throw Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:$,longFlag:J}}iq.Option=p7;iq.DualOptions=c7});var a7=a((tq)=>{function nq(D,$){if(Math.abs(D.length-$.length)>3)return Math.max(D.length,$.length);let J=[];for(let Q=0;Q<=D.length;Q++)J[Q]=[Q];for(let Q=0;Q<=$.length;Q++)J[0][Q]=Q;for(let Q=1;Q<=$.length;Q++)for(let q=1;q<=D.length;q++){let G=1;if(D[q-1]===$[Q-1])G=0;else G=1;if(J[q][Q]=Math.min(J[q-1][Q]+1,J[q][Q-1]+1,J[q-1][Q-1]+G),q>1&&Q>1&&D[q-1]===$[Q-2]&&D[q-2]===$[Q-1])J[q][Q]=Math.min(J[q][Q],J[q-2][Q-2]+1)}return J[D.length][$.length]}function sq(D,$){if(!$||$.length===0)return"";$=Array.from(new Set($));let J=D.startsWith("--");if(J)D=D.slice(2),$=$.map((X)=>X.slice(2));let Q=[],q=3,G=0.4;if($.forEach((X)=>{if(X.length<=1)return;let Y=nq(D,X),Z=Math.max(D.length,X.length);if((Z-Y)/Z>G){if(Y<q)q=Y,Q=[X];else if(Y===q)Q.push(X)}}),Q.sort((X,Y)=>X.localeCompare(Y)),J)Q=Q.map((X)=>`--${X}`);if(Q.length>1)return`
13
13
  (Did you mean one of ${Q.join(", ")}?)`;if(Q.length===1)return`
14
- (Did you mean ${Q[0]}?)`;return""}iG.suggestSimilar=aG});var a6=c(($4)=>{var oG=z0("node:events").EventEmitter,T9=z0("node:child_process"),yD=z0("node:path"),b8=z0("node:fs"),l=z0("node:process"),{Argument:sG,humanReadableArgName:nG}=x8(),{CommanderError:M9}=$8(),{Help:tG,stripColor:eG}=w9(),{Option:p6,DualOptions:D4}=O9(),{suggestSimilar:d6}=l6();class S9 extends oG{constructor(D){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=D||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:($)=>l.stdout.write($),writeErr:($)=>l.stderr.write($),outputError:($,J)=>J($),getOutHelpWidth:()=>l.stdout.isTTY?l.stdout.columns:void 0,getErrHelpWidth:()=>l.stderr.isTTY?l.stderr.columns:void 0,getOutHasColors:()=>P9()??(l.stdout.isTTY&&l.stdout.hasColors?.()),getErrHasColors:()=>P9()??(l.stderr.isTTY&&l.stderr.hasColors?.()),stripColor:($)=>eG($)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let $=this;$;$=$.parent)D.push($);return D}command(D,$,J){let Q=$,G=J;if(typeof Q==="object"&&Q!==null)G=Q,Q=null;G=G||{};let[,q,X]=D.match(/([^ ]+) *(.*)/),Y=this.createCommand(q);if(Q)Y.description(Q),Y._executableHandler=!0;if(G.isDefault)this._defaultCommandName=Y._name;if(Y._hidden=!!(G.noHelp||G.hidden),Y._executableFile=G.executableFile||null,X)Y.arguments(X);if(this._registerCommand(Y),Y.parent=this,Y.copyInheritedSettings(this),Q)return this;return Y}createCommand(D){return new S9(D)}createHelp(){return Object.assign(new tG,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...D},this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,$){if(!D._name)throw Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);if($=$||{},$.isDefault)this._defaultCommandName=D._name;if($.noHelp||$.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,$){return new sG(D,$)}argument(D,$,J,Q){let G=this.createArgument(D,$);if(typeof J==="function")G.default(Q).argParser(J);else G.default(J);return this.addArgument(G),this}arguments(D){return D.trim().split(/ +/).forEach(($)=>{this.argument($)}),this}addArgument(D){let $=this.registeredArguments.slice(-1)[0];if($?.variadic)throw Error(`only the last argument can be variadic '${$.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,$){if(typeof D==="boolean"){if(this._addImplicitHelpCommand=D,D&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let J=D??"help [command]",[,Q,G]=J.match(/([^ ]+) *(.*)/),q=$??"display help for command",X=this.createCommand(Q);if(X.helpOption(!1),G)X.arguments(G);if(q)X.description(q);if(this._addImplicitHelpCommand=!0,this._helpCommand=X,D||$)this._initCommandGroup(X);return this}addHelpCommand(D,$){if(typeof D!=="object")return this.helpCommand(D,$),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this._initCommandGroup(D),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,$){let J=["preSubcommand","preAction","postAction"];if(!J.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'.
16
- Expecting one of '${J.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push($);else this._lifeCycleHooks[D]=[$];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=($)=>{if($.code!=="commander.executeSubCommandAsync")throw $};return this}_exit(D,$,J){if(this._exitCallback)this._exitCallback(new M9(D,$,J));l.exit(D)}action(D){let $=(J)=>{let Q=this.registeredArguments.length,G=J.slice(0,Q);if(this._storeOptionsAsProperties)G[Q]=this;else G[Q]=this.opts();return G.push(this),D.apply(this,G)};return this._actionHandler=$,this}createOption(D,$){return new p6(D,$)}_callParseArg(D,$,J,Q){try{return D.parseArg($,J)}catch(G){if(G.code==="commander.invalidArgument"){let q=`${Q} ${G.message}`;this.error(q,{exitCode:G.exitCode,code:G.code})}throw G}}_registerOption(D){let $=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if($){let J=D.long&&this._findOption(D.long)?D.long:D.short;throw Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${J}'
17
- - already used by option '${$.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let $=(Q)=>{return[Q.name()].concat(Q.aliases())},J=$(D).find((Q)=>this._findCommand(Q));if(J){let Q=$(this._findCommand(J)).join("|"),G=$(D).join("|");throw Error(`cannot add command '${G}' as already have command '${Q}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let $=D.name(),J=D.attributeName();if(D.negate){let G=D.long.replace(/^--no-/,"--");if(!this._findOption(G))this.setOptionValueWithSource(J,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(J,D.defaultValue,"default");let Q=(G,q,X)=>{if(G==null&&D.presetArg!==void 0)G=D.presetArg;let Y=this.getOptionValue(J);if(G!==null&&D.parseArg)G=this._callParseArg(D,G,Y,q);else if(G!==null&&D.variadic)G=D._collectValue(G,Y);if(G==null)if(D.negate)G=!1;else if(D.isBoolean()||D.optional)G=!0;else G="";this.setOptionValueWithSource(J,G,X)};if(this.on("option:"+$,(G)=>{let q=`error: option '${D.flags}' argument '${G}' is invalid.`;Q(G,q,"cli")}),D.envVar)this.on("optionEnv:"+$,(G)=>{let q=`error: option '${D.flags}' value '${G}' from env '${D.envVar}' is invalid.`;Q(G,q,"env")});return this}_optionEx(D,$,J,Q,G){if(typeof $==="object"&&$ instanceof p6)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let q=this.createOption($,J);if(q.makeOptionMandatory(!!D.mandatory),typeof Q==="function")q.default(G).argParser(Q);else if(Q instanceof RegExp){let X=Q;Q=(Y,Z)=>{let K=X.exec(Y);return K?K[0]:Z},q.default(G).argParser(Q)}else q.default(Q);return this.addOption(q)}option(D,$,J,Q){return this._optionEx({},D,$,J,Q)}requiredOption(D,$,J,Q){return this._optionEx({mandatory:!0},D,$,J,Q)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,$){return this.setOptionValueWithSource(D,$,void 0)}setOptionValueWithSource(D,$,J){if(this._storeOptionsAsProperties)this[D]=$;else this._optionValues[D]=$;return this._optionValueSources[D]=J,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let $;return this._getCommandAndAncestors().forEach((J)=>{if(J.getOptionValueSource(D)!==void 0)$=J.getOptionValueSource(D)}),$}_prepareUserArgs(D,$){if(D!==void 0&&!Array.isArray(D))throw Error("first parameter to parse must be array or undefined");if($=$||{},D===void 0&&$.from===void 0){if(l.versions?.electron)$.from="electron";let Q=l.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))$.from="eval"}if(D===void 0)D=l.argv;this.rawArgs=D.slice();let J;switch($.from){case void 0:case"node":this._scriptPath=D[1],J=D.slice(2);break;case"electron":if(l.defaultApp)this._scriptPath=D[1],J=D.slice(2);else J=D.slice(1);break;case"user":J=D.slice(0);break;case"eval":J=D.slice(1);break;default:throw Error(`unexpected parse option { from: '${$.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",J}parse(D,$){this._prepareForParse();let J=this._prepareUserArgs(D,$);return this._parseCommand([],J),this}async parseAsync(D,$){this._prepareForParse();let J=this._prepareUserArgs(D,$);return await this._parseCommand([],J),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(D,$,J){if(b8.existsSync(D))return;let Q=$?`searched for local subcommand relative to directory '${$}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",G=`'${D}' does not exist
14
+ (Did you mean ${Q[0]}?)`;return""}tq.suggestSimilar=sq});var n7=a((X4)=>{var D4=V0("node:events").EventEmitter,S9=V0("node:child_process"),uD=V0("node:path"),f8=V0("node:fs"),p=V0("node:process"),{Argument:$4,humanReadableArgName:J4}=y8(),{CommanderError:k9}=G8(),{Help:Q4,stripColor:q4}=P9(),{Option:i7,DualOptions:G4}=_9(),{suggestSimilar:r7}=a7();class x9 extends D4{constructor(D){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=D||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:($)=>p.stdout.write($),writeErr:($)=>p.stderr.write($),outputError:($,J)=>J($),getOutHelpWidth:()=>p.stdout.isTTY?p.stdout.columns:void 0,getErrHelpWidth:()=>p.stderr.isTTY?p.stderr.columns:void 0,getOutHasColors:()=>A9()??(p.stdout.isTTY&&p.stdout.hasColors?.()),getErrHasColors:()=>A9()??(p.stderr.isTTY&&p.stderr.hasColors?.()),stripColor:($)=>q4($)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let $=this;$;$=$.parent)D.push($);return D}command(D,$,J){let Q=$,q=J;if(typeof Q==="object"&&Q!==null)q=Q,Q=null;q=q||{};let[,G,X]=D.match(/([^ ]+) *(.*)/),Y=this.createCommand(G);if(Q)Y.description(Q),Y._executableHandler=!0;if(q.isDefault)this._defaultCommandName=Y._name;if(Y._hidden=!!(q.noHelp||q.hidden),Y._executableFile=q.executableFile||null,X)Y.arguments(X);if(this._registerCommand(Y),Y.parent=this,Y.copyInheritedSettings(this),Q)return this;return Y}createCommand(D){return new x9(D)}createHelp(){return Object.assign(new Q4,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...D},this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,$){if(!D._name)throw Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);if($=$||{},$.isDefault)this._defaultCommandName=D._name;if($.noHelp||$.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,$){return new $4(D,$)}argument(D,$,J,Q){let q=this.createArgument(D,$);if(typeof J==="function")q.default(Q).argParser(J);else q.default(J);return this.addArgument(q),this}arguments(D){return D.trim().split(/ +/).forEach(($)=>{this.argument($)}),this}addArgument(D){let $=this.registeredArguments.slice(-1)[0];if($?.variadic)throw Error(`only the last argument can be variadic '${$.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,$){if(typeof D==="boolean"){if(this._addImplicitHelpCommand=D,D&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let J=D??"help [command]",[,Q,q]=J.match(/([^ ]+) *(.*)/),G=$??"display help for command",X=this.createCommand(Q);if(X.helpOption(!1),q)X.arguments(q);if(G)X.description(G);if(this._addImplicitHelpCommand=!0,this._helpCommand=X,D||$)this._initCommandGroup(X);return this}addHelpCommand(D,$){if(typeof D!=="object")return this.helpCommand(D,$),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this._initCommandGroup(D),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,$){let J=["preSubcommand","preAction","postAction"];if(!J.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'.
16
+ Expecting one of '${J.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push($);else this._lifeCycleHooks[D]=[$];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=($)=>{if($.code!=="commander.executeSubCommandAsync")throw $};return this}_exit(D,$,J){if(this._exitCallback)this._exitCallback(new k9(D,$,J));p.exit(D)}action(D){let $=(J)=>{let Q=this.registeredArguments.length,q=J.slice(0,Q);if(this._storeOptionsAsProperties)q[Q]=this;else q[Q]=this.opts();return q.push(this),D.apply(this,q)};return this._actionHandler=$,this}createOption(D,$){return new i7(D,$)}_callParseArg(D,$,J,Q){try{return D.parseArg($,J)}catch(q){if(q.code==="commander.invalidArgument"){let G=`${Q} ${q.message}`;this.error(G,{exitCode:q.exitCode,code:q.code})}throw q}}_registerOption(D){let $=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if($){let J=D.long&&this._findOption(D.long)?D.long:D.short;throw Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${J}'
17
+ - already used by option '${$.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let $=(Q)=>{return[Q.name()].concat(Q.aliases())},J=$(D).find((Q)=>this._findCommand(Q));if(J){let Q=$(this._findCommand(J)).join("|"),q=$(D).join("|");throw Error(`cannot add command '${q}' as already have command '${Q}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let $=D.name(),J=D.attributeName();if(D.negate){let q=D.long.replace(/^--no-/,"--");if(!this._findOption(q))this.setOptionValueWithSource(J,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(J,D.defaultValue,"default");let Q=(q,G,X)=>{if(q==null&&D.presetArg!==void 0)q=D.presetArg;let Y=this.getOptionValue(J);if(q!==null&&D.parseArg)q=this._callParseArg(D,q,Y,G);else if(q!==null&&D.variadic)q=D._collectValue(q,Y);if(q==null)if(D.negate)q=!1;else if(D.isBoolean()||D.optional)q=!0;else q="";this.setOptionValueWithSource(J,q,X)};if(this.on("option:"+$,(q)=>{let G=`error: option '${D.flags}' argument '${q}' is invalid.`;Q(q,G,"cli")}),D.envVar)this.on("optionEnv:"+$,(q)=>{let G=`error: option '${D.flags}' value '${q}' from env '${D.envVar}' is invalid.`;Q(q,G,"env")});return this}_optionEx(D,$,J,Q,q){if(typeof $==="object"&&$ instanceof i7)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let G=this.createOption($,J);if(G.makeOptionMandatory(!!D.mandatory),typeof Q==="function")G.default(q).argParser(Q);else if(Q instanceof RegExp){let X=Q;Q=(Y,Z)=>{let U=X.exec(Y);return U?U[0]:Z},G.default(q).argParser(Q)}else G.default(Q);return this.addOption(G)}option(D,$,J,Q){return this._optionEx({},D,$,J,Q)}requiredOption(D,$,J,Q){return this._optionEx({mandatory:!0},D,$,J,Q)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,$){return this.setOptionValueWithSource(D,$,void 0)}setOptionValueWithSource(D,$,J){if(this._storeOptionsAsProperties)this[D]=$;else this._optionValues[D]=$;return this._optionValueSources[D]=J,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let $;return this._getCommandAndAncestors().forEach((J)=>{if(J.getOptionValueSource(D)!==void 0)$=J.getOptionValueSource(D)}),$}_prepareUserArgs(D,$){if(D!==void 0&&!Array.isArray(D))throw Error("first parameter to parse must be array or undefined");if($=$||{},D===void 0&&$.from===void 0){if(p.versions?.electron)$.from="electron";let Q=p.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))$.from="eval"}if(D===void 0)D=p.argv;this.rawArgs=D.slice();let J;switch($.from){case void 0:case"node":this._scriptPath=D[1],J=D.slice(2);break;case"electron":if(p.defaultApp)this._scriptPath=D[1],J=D.slice(2);else J=D.slice(1);break;case"user":J=D.slice(0);break;case"eval":J=D.slice(1);break;default:throw Error(`unexpected parse option { from: '${$.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",J}parse(D,$){this._prepareForParse();let J=this._prepareUserArgs(D,$);return this._parseCommand([],J),this}async parseAsync(D,$){this._prepareForParse();let J=this._prepareUserArgs(D,$);return await this._parseCommand([],J),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(D,$,J){if(f8.existsSync(D))return;let Q=$?`searched for local subcommand relative to directory '${$}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",q=`'${D}' does not exist
19
19
  - if '${J}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${Q}`;throw Error(G)}_executeSubCommand(D,$){$=$.slice();let J=!1,Q=[".js",".ts",".tsx",".mjs",".cjs"];function G(K,j){let U=yD.resolve(K,j);if(b8.existsSync(U))return U;if(Q.includes(yD.extname(j)))return;let C=Q.find((z)=>b8.existsSync(`${U}${z}`));if(C)return`${U}${C}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let q=D._executableFile||`${this._name}-${D._name}`,X=this._executableDir||"";if(this._scriptPath){let K;try{K=b8.realpathSync(this._scriptPath)}catch{K=this._scriptPath}X=yD.resolve(yD.dirname(K),X)}if(X){let K=G(X,q);if(!K&&!D._executableFile&&this._scriptPath){let j=yD.basename(this._scriptPath,yD.extname(this._scriptPath));if(j!==this._name)K=G(X,`${j}-${D._name}`)}q=K||q}J=Q.includes(yD.extname(q));let Y;if(l.platform!=="win32")if(J)$.unshift(q),$=c6(l.execArgv).concat($),Y=T9.spawn(l.argv[0],$,{stdio:"inherit"});else Y=T9.spawn(q,$,{stdio:"inherit"});else this._checkForMissingExecutable(q,X,D._name),$.unshift(q),$=c6(l.execArgv).concat($),Y=T9.spawn(l.execPath,$,{stdio:"inherit"});if(!Y.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((j)=>{l.on(j,()=>{if(Y.killed===!1&&Y.exitCode===null)Y.kill(j)})});let Z=this._exitCallback;Y.on("close",(K)=>{if(K=K??1,!Z)l.exit(K);else Z(new M9(K,"commander.executeSubCommandAsync","(close)"))}),Y.on("error",(K)=>{if(K.code==="ENOENT")this._checkForMissingExecutable(q,X,D._name);else if(K.code==="EACCES")throw Error(`'${q}' not executable`);if(!Z)l.exit(1);else{let j=new M9(1,"commander.executeSubCommandAsync","(error)");j.nestedError=K,Z(j)}}),this.runningCommand=Y}_dispatchSubcommand(D,$,J){let Q=this._findCommand(D);if(!Q)this.help({error:!0});Q._prepareForParse();let G;return G=this._chainOrCallSubCommandHook(G,Q,"preSubcommand"),G=this._chainOrCall(G,()=>{if(Q._executableHandler)this._executeSubCommand(Q,$.concat(J));else return Q._parseCommand($,J)}),G}_dispatchHelpCommand(D){if(!D)this.help();let $=this._findCommand(D);if($&&!$._executableHandler)$.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,$)=>{if(D.required&&this.args[$]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(J,Q,G)=>{let q=Q;if(Q!==null&&J.parseArg){let X=`error: command-argument value '${Q}' is invalid for argument '${J.name()}'.`;q=this._callParseArg(J,Q,G,X)}return q};this._checkNumberOfArguments();let $=[];this.registeredArguments.forEach((J,Q)=>{let G=J.defaultValue;if(J.variadic){if(Q<this.args.length){if(G=this.args.slice(Q),J.parseArg)G=G.reduce((q,X)=>{return D(J,X,q)},J.defaultValue)}else if(G===void 0)G=[]}else if(Q<this.args.length){if(G=this.args[Q],J.parseArg)G=D(J,G,J.defaultValue)}$[Q]=G}),this.processedArgs=$}_chainOrCall(D,$){if(D?.then&&typeof D.then==="function")return D.then(()=>$());return $()}_chainOrCallHooks(D,$){let J=D,Q=[];if(this._getCommandAndAncestors().reverse().filter((G)=>G._lifeCycleHooks[$]!==void 0).forEach((G)=>{G._lifeCycleHooks[$].forEach((q)=>{Q.push({hookedCommand:G,callback:q})})}),$==="postAction")Q.reverse();return Q.forEach((G)=>{J=this._chainOrCall(J,()=>{return G.callback(G.hookedCommand,this)})}),J}_chainOrCallSubCommandHook(D,$,J){let Q=D;if(this._lifeCycleHooks[J]!==void 0)this._lifeCycleHooks[J].forEach((G)=>{Q=this._chainOrCall(Q,()=>{return G(this,$)})});return Q}_parseCommand(D,$){let J=this.parseOptions($);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(J.operands),$=J.unknown,this.args=D.concat($),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),$);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested($),this._dispatchSubcommand(this._defaultCommandName,D,$);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(J.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=()=>{if(J.unknown.length>0)this.unknownOption(J.unknown[0])},G=`command:${this.name()}`;if(this._actionHandler){Q(),this._processArguments();let q;if(q=this._chainOrCallHooks(q,"preAction"),q=this._chainOrCall(q,()=>this._actionHandler(this.processedArgs)),this.parent)q=this._chainOrCall(q,()=>{this.parent.emit(G,D,$)});return q=this._chainOrCallHooks(q,"postAction"),q}if(this.parent?.listenerCount(G))Q(),this._processArguments(),this.parent.emit(G,D,$);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,$);if(this.listenerCount("command:*"))this.emit("command:*",D,$);else if(this.commands.length)this.unknownCommand();else Q(),this._processArguments()}else if(this.commands.length)Q(),this.help({error:!0});else Q(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find(($)=>$._name===D||$._aliases.includes(D))}_findOption(D){return this.options.find(($)=>$.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach(($)=>{if($.mandatory&&D.getOptionValue($.attributeName())===void 0)D.missingMandatoryOptionValue($)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((J)=>{let Q=J.attributeName();if(this.getOptionValue(Q)===void 0)return!1;return this.getOptionValueSource(Q)!=="default"});D.filter((J)=>J.conflictsWith.length>0).forEach((J)=>{let Q=D.find((G)=>J.conflictsWith.includes(G.attributeName()));if(Q)this._conflictingOption(J,Q)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let $=[],J=[],Q=$;function G(K){return K.length>1&&K[0]==="-"}let q=(K)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(K))return!1;return!this._getCommandAndAncestors().some((j)=>j.options.map((U)=>U.short).some((U)=>/^-\d$/.test(U)))},X=null,Y=null,Z=0;while(Z<D.length||Y){let K=Y??D[Z++];if(Y=null,K==="--"){if(Q===J)Q.push(K);Q.push(...D.slice(Z));break}if(X&&(!G(K)||q(K))){this.emit(`option:${X.name()}`,K);continue}if(X=null,G(K)){let j=this._findOption(K);if(j){if(j.required){let U=D[Z++];if(U===void 0)this.optionMissingArgument(j);this.emit(`option:${j.name()}`,U)}else if(j.optional){let U=null;if(Z<D.length&&(!G(D[Z])||q(D[Z])))U=D[Z++];this.emit(`option:${j.name()}`,U)}else this.emit(`option:${j.name()}`);X=j.variadic?j:null;continue}}if(K.length>2&&K[0]==="-"&&K[1]!=="-"){let j=this._findOption(`-${K[1]}`);if(j){if(j.required||j.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${j.name()}`,K.slice(2));else this.emit(`option:${j.name()}`),Y=`-${K.slice(2)}`;continue}}if(/^--[^=]+=/.test(K)){let j=K.indexOf("="),U=this._findOption(K.slice(0,j));if(U&&(U.required||U.optional)){this.emit(`option:${U.name()}`,K.slice(j+1));continue}}if(Q===$&&G(K)&&!(this.commands.length===0&&q(K)))Q=J;if((this._enablePositionalOptions||this._passThroughOptions)&&$.length===0&&J.length===0){if(this._findCommand(K)){$.push(K),J.push(...D.slice(Z));break}else if(this._getHelpCommand()&&K===this._getHelpCommand().name()){$.push(K,...D.slice(Z));break}else if(this._defaultCommandName){J.push(K,...D.slice(Z));break}}if(this._passThroughOptions){Q.push(K,...D.slice(Z));break}Q.push(K)}return{operands:$,unknown:J}}opts(){if(this._storeOptionsAsProperties){let D={},$=this.options.length;for(let J=0;J<$;J++){let Q=this.options[J].attributeName();D[Q]=Q===this._versionOptionName?this._version:this[Q]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,$)=>Object.assign(D,$.opts()),{})}error(D,$){if(this._outputConfiguration.outputError(`${D}
21
+ - ${Q}`;throw Error(q)}_executeSubCommand(D,$){$=$.slice();let J=!1,Q=[".js",".ts",".tsx",".mjs",".cjs"];function q(U,j){let K=uD.resolve(U,j);if(f8.existsSync(K))return K;if(Q.includes(uD.extname(j)))return;let H=Q.find((E)=>f8.existsSync(`${K}${E}`));if(H)return`${K}${H}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let G=D._executableFile||`${this._name}-${D._name}`,X=this._executableDir||"";if(this._scriptPath){let U;try{U=f8.realpathSync(this._scriptPath)}catch{U=this._scriptPath}X=uD.resolve(uD.dirname(U),X)}if(X){let U=q(X,G);if(!U&&!D._executableFile&&this._scriptPath){let j=uD.basename(this._scriptPath,uD.extname(this._scriptPath));if(j!==this._name)U=q(X,`${j}-${D._name}`)}G=U||G}J=Q.includes(uD.extname(G));let Y;if(p.platform!=="win32")if(J)$.unshift(G),$=o7(p.execArgv).concat($),Y=S9.spawn(p.argv[0],$,{stdio:"inherit"});else Y=S9.spawn(G,$,{stdio:"inherit"});else this._checkForMissingExecutable(G,X,D._name),$.unshift(G),$=o7(p.execArgv).concat($),Y=S9.spawn(p.execPath,$,{stdio:"inherit"});if(!Y.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((j)=>{p.on(j,()=>{if(Y.killed===!1&&Y.exitCode===null)Y.kill(j)})});let Z=this._exitCallback;Y.on("close",(U)=>{if(U=U??1,!Z)p.exit(U);else Z(new k9(U,"commander.executeSubCommandAsync","(close)"))}),Y.on("error",(U)=>{if(U.code==="ENOENT")this._checkForMissingExecutable(G,X,D._name);else if(U.code==="EACCES")throw Error(`'${G}' not executable`);if(!Z)p.exit(1);else{let j=new k9(1,"commander.executeSubCommandAsync","(error)");j.nestedError=U,Z(j)}}),this.runningCommand=Y}_dispatchSubcommand(D,$,J){let Q=this._findCommand(D);if(!Q)this.help({error:!0});Q._prepareForParse();let q;return q=this._chainOrCallSubCommandHook(q,Q,"preSubcommand"),q=this._chainOrCall(q,()=>{if(Q._executableHandler)this._executeSubCommand(Q,$.concat(J));else return Q._parseCommand($,J)}),q}_dispatchHelpCommand(D){if(!D)this.help();let $=this._findCommand(D);if($&&!$._executableHandler)$.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,$)=>{if(D.required&&this.args[$]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(J,Q,q)=>{let G=Q;if(Q!==null&&J.parseArg){let X=`error: command-argument value '${Q}' is invalid for argument '${J.name()}'.`;G=this._callParseArg(J,Q,q,X)}return G};this._checkNumberOfArguments();let $=[];this.registeredArguments.forEach((J,Q)=>{let q=J.defaultValue;if(J.variadic){if(Q<this.args.length){if(q=this.args.slice(Q),J.parseArg)q=q.reduce((G,X)=>{return D(J,X,G)},J.defaultValue)}else if(q===void 0)q=[]}else if(Q<this.args.length){if(q=this.args[Q],J.parseArg)q=D(J,q,J.defaultValue)}$[Q]=q}),this.processedArgs=$}_chainOrCall(D,$){if(D?.then&&typeof D.then==="function")return D.then(()=>$());return $()}_chainOrCallHooks(D,$){let J=D,Q=[];if(this._getCommandAndAncestors().reverse().filter((q)=>q._lifeCycleHooks[$]!==void 0).forEach((q)=>{q._lifeCycleHooks[$].forEach((G)=>{Q.push({hookedCommand:q,callback:G})})}),$==="postAction")Q.reverse();return Q.forEach((q)=>{J=this._chainOrCall(J,()=>{return q.callback(q.hookedCommand,this)})}),J}_chainOrCallSubCommandHook(D,$,J){let Q=D;if(this._lifeCycleHooks[J]!==void 0)this._lifeCycleHooks[J].forEach((q)=>{Q=this._chainOrCall(Q,()=>{return q(this,$)})});return Q}_parseCommand(D,$){let J=this.parseOptions($);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(J.operands),$=J.unknown,this.args=D.concat($),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),$);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested($),this._dispatchSubcommand(this._defaultCommandName,D,$);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(J.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=()=>{if(J.unknown.length>0)this.unknownOption(J.unknown[0])},q=`command:${this.name()}`;if(this._actionHandler){Q(),this._processArguments();let G;if(G=this._chainOrCallHooks(G,"preAction"),G=this._chainOrCall(G,()=>this._actionHandler(this.processedArgs)),this.parent)G=this._chainOrCall(G,()=>{this.parent.emit(q,D,$)});return G=this._chainOrCallHooks(G,"postAction"),G}if(this.parent?.listenerCount(q))Q(),this._processArguments(),this.parent.emit(q,D,$);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,$);if(this.listenerCount("command:*"))this.emit("command:*",D,$);else if(this.commands.length)this.unknownCommand();else Q(),this._processArguments()}else if(this.commands.length)Q(),this.help({error:!0});else Q(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find(($)=>$._name===D||$._aliases.includes(D))}_findOption(D){return this.options.find(($)=>$.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach(($)=>{if($.mandatory&&D.getOptionValue($.attributeName())===void 0)D.missingMandatoryOptionValue($)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((J)=>{let Q=J.attributeName();if(this.getOptionValue(Q)===void 0)return!1;return this.getOptionValueSource(Q)!=="default"});D.filter((J)=>J.conflictsWith.length>0).forEach((J)=>{let Q=D.find((q)=>J.conflictsWith.includes(q.attributeName()));if(Q)this._conflictingOption(J,Q)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let $=[],J=[],Q=$;function q(U){return U.length>1&&U[0]==="-"}let G=(U)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(U))return!1;return!this._getCommandAndAncestors().some((j)=>j.options.map((K)=>K.short).some((K)=>/^-\d$/.test(K)))},X=null,Y=null,Z=0;while(Z<D.length||Y){let U=Y??D[Z++];if(Y=null,U==="--"){if(Q===J)Q.push(U);Q.push(...D.slice(Z));break}if(X&&(!q(U)||G(U))){this.emit(`option:${X.name()}`,U);continue}if(X=null,q(U)){let j=this._findOption(U);if(j){if(j.required){let K=D[Z++];if(K===void 0)this.optionMissingArgument(j);this.emit(`option:${j.name()}`,K)}else if(j.optional){let K=null;if(Z<D.length&&(!q(D[Z])||G(D[Z])))K=D[Z++];this.emit(`option:${j.name()}`,K)}else this.emit(`option:${j.name()}`);X=j.variadic?j:null;continue}}if(U.length>2&&U[0]==="-"&&U[1]!=="-"){let j=this._findOption(`-${U[1]}`);if(j){if(j.required||j.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${j.name()}`,U.slice(2));else this.emit(`option:${j.name()}`),Y=`-${U.slice(2)}`;continue}}if(/^--[^=]+=/.test(U)){let j=U.indexOf("="),K=this._findOption(U.slice(0,j));if(K&&(K.required||K.optional)){this.emit(`option:${K.name()}`,U.slice(j+1));continue}}if(Q===$&&q(U)&&!(this.commands.length===0&&G(U)))Q=J;if((this._enablePositionalOptions||this._passThroughOptions)&&$.length===0&&J.length===0){if(this._findCommand(U)){$.push(U),J.push(...D.slice(Z));break}else if(this._getHelpCommand()&&U===this._getHelpCommand().name()){$.push(U,...D.slice(Z));break}else if(this._defaultCommandName){J.push(U,...D.slice(Z));break}}if(this._passThroughOptions){Q.push(U,...D.slice(Z));break}Q.push(U)}return{operands:$,unknown:J}}opts(){if(this._storeOptionsAsProperties){let D={},$=this.options.length;for(let J=0;J<$;J++){let Q=this.options[J].attributeName();D[Q]=Q===this._versionOptionName?this._version:this[Q]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,$)=>Object.assign(D,$.opts()),{})}error(D,$){if(this._outputConfiguration.outputError(`${D}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0});let J=$||{},Q=J.exitCode||1,G=J.code||"commander.error";this._exit(Q,G,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in l.env){let $=D.attributeName();if(this.getOptionValue($)===void 0||["default","config","env"].includes(this.getOptionValueSource($)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,l.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new D4(this.options),$=(J)=>{return this.getOptionValue(J)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(J))};this.options.filter((J)=>J.implied!==void 0&&$(J.attributeName())&&D.valueFromOption(this.getOptionValue(J.attributeName()),J)).forEach((J)=>{Object.keys(J.implied).filter((Q)=>!$(Q)).forEach((Q)=>{this.setOptionValueWithSource(Q,J.implied[Q],"implied")})})}missingArgument(D){let $=`error: missing required argument '${D}'`;this.error($,{code:"commander.missingArgument"})}optionMissingArgument(D){let $=`error: option '${D.flags}' argument missing`;this.error($,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let $=`error: required option '${D.flags}' not specified`;this.error($,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,$){let J=(q)=>{let X=q.attributeName(),Y=this.getOptionValue(X),Z=this.options.find((j)=>j.negate&&X===j.attributeName()),K=this.options.find((j)=>!j.negate&&X===j.attributeName());if(Z&&(Z.presetArg===void 0&&Y===!1||Z.presetArg!==void 0&&Y===Z.presetArg))return Z;return K||q},Q=(q)=>{let X=J(q),Y=X.attributeName();if(this.getOptionValueSource(Y)==="env")return`environment variable '${X.envVar}'`;return`option '${X.flags}'`},G=`error: ${Q(D)} cannot be used with ${Q($)}`;this.error(G,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let $="";if(D.startsWith("--")&&this._showSuggestionAfterError){let Q=[],G=this;do{let q=G.createHelp().visibleOptions(G).filter((X)=>X.long).map((X)=>X.long);Q=Q.concat(q),G=G.parent}while(G&&!G._enablePositionalOptions);$=d6(D,Q)}let J=`error: unknown option '${D}'${$}`;this.error(J,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let $=this.registeredArguments.length,J=$===1?"":"s",G=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${$} argument${J} but got ${D.length}.`;this.error(G,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],$="";if(this._showSuggestionAfterError){let Q=[];this.createHelp().visibleCommands(this).forEach((G)=>{if(Q.push(G.name()),G.alias())Q.push(G.alias())}),$=d6(D,Q)}let J=`error: unknown command '${D}'${$}`;this.error(J,{code:"commander.unknownCommand"})}version(D,$,J){if(D===void 0)return this._version;this._version=D,$=$||"-V, --version",J=J||"output the version number";let Q=this.createOption($,J);return this._versionOptionName=Q.attributeName(),this._registerOption(Q),this.on("option:"+Q.name(),()=>{this._outputConfiguration.writeOut(`${D}
25
- `),this._exit(0,"commander.version",D)}),this}description(D,$){if(D===void 0&&$===void 0)return this._description;if(this._description=D,$)this._argsDescription=$;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let $=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)$=this.commands[this.commands.length-1];if(D===$._name)throw Error("Command alias can't be the same as its name");let J=this.parent?._findCommand(D);if(J){let Q=[J.name()].concat(J.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${Q}'`)}return $._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach(($)=>this.alias($)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let $=this.registeredArguments.map((J)=>{return nG(J)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?$:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}helpGroup(D){if(D===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=D,this}commandsGroup(D){if(D===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=D,this}optionsGroup(D){if(D===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=D,this}_initOptionGroup(D){if(this._defaultOptionGroup&&!D.helpGroupHeading)D.helpGroup(this._defaultOptionGroup)}_initCommandGroup(D){if(this._defaultCommandGroup&&!D.helpGroup())D.helpGroup(this._defaultCommandGroup)}nameFromFilename(D){return this._name=yD.basename(D,yD.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let $=this.createHelp(),J=this._getOutputContext(D);$.prepareContext({error:J.error,helpWidth:J.helpWidth,outputHasColors:J.hasColors});let Q=$.formatHelp(this,$);if(J.hasColors)return Q;return this._outputConfiguration.stripColor(Q)}_getOutputContext(D){D=D||{};let $=!!D.error,J,Q,G;if($)J=(X)=>this._outputConfiguration.writeErr(X),Q=this._outputConfiguration.getErrHasColors(),G=this._outputConfiguration.getErrHelpWidth();else J=(X)=>this._outputConfiguration.writeOut(X),Q=this._outputConfiguration.getOutHasColors(),G=this._outputConfiguration.getOutHelpWidth();return{error:$,write:(X)=>{if(!Q)X=this._outputConfiguration.stripColor(X);return J(X)},hasColors:Q,helpWidth:G}}outputHelp(D){let $;if(typeof D==="function")$=D,D=void 0;let J=this._getOutputContext(D),Q={error:J.error,write:J.write,command:this};this._getCommandAndAncestors().reverse().forEach((q)=>q.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let G=this.helpInformation({error:J.error});if($){if(G=$(G),typeof G!=="string"&&!Buffer.isBuffer(G))throw Error("outputHelp callback must return a string or a Buffer")}if(J.write(G),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((q)=>q.emit("afterAllHelp",Q))}helpOption(D,$){if(typeof D==="boolean"){if(D){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(D??"-h, --help",$??"display help for command"),D||$)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this._initOptionGroup(D),this}help(D){this.outputHelp(D);let $=Number(l.exitCode??0);if($===0&&D&&typeof D!=="function"&&D.error)$=1;this._exit($,"commander.help","(outputHelp)")}addHelpText(D,$){let J=["beforeAll","before","after","afterAll"];if(!J.includes(D))throw Error(`Unexpected value for position to addHelpText.
26
- Expecting one of '${J.join("', '")}'`);let Q=`${D}Help`;return this.on(Q,(G)=>{let q;if(typeof $==="function")q=$({error:G.error,command:G.command});else q=$;if(q)G.write(`${q}
27
- `)}),this}_outputHelpIfRequested(D){let $=this._getHelpOption();if($&&D.find((Q)=>$.is(Q)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function c6(D){return D.map(($)=>{if(!$.startsWith("--inspect"))return $;let J,Q="127.0.0.1",G="9229",q;if((q=$.match(/^(--inspect(-brk)?)$/))!==null)J=q[1];else if((q=$.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(J=q[1],/^\d+$/.test(q[3]))G=q[3];else Q=q[3];else if((q=$.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)J=q[1],Q=q[3],G=q[4];if(J&&G!=="0")return`${J}=${Q}:${parseInt(G)+1}`;return $})}function P9(){if(l.env.NO_COLOR||l.env.FORCE_COLOR==="0"||l.env.FORCE_COLOR==="false")return!1;if(l.env.FORCE_COLOR||l.env.CLICOLOR_FORCE!==void 0)return!0;return}$4.Command=S9;$4.useColor=P9});var s6=c((X4)=>{var{Argument:i6}=x8(),{Command:_9}=a6(),{CommanderError:G4,InvalidArgumentError:r6}=$8(),{Help:q4}=w9(),{Option:o6}=O9();X4.program=new _9;X4.createCommand=(D)=>new _9(D);X4.createOption=(D,$)=>new o6(D,$);X4.createArgument=(D,$)=>new i6(D,$);X4.Command=_9;X4.Option=o6;X4.Argument=i6;X4.Help=q4;X4.CommanderError=G4;X4.InvalidArgumentError=r6;X4.InvalidOptionArgumentError=r6});var f8=c((vj,E1)=>{var v9=[],W1=0,jD=(D,$)=>{if(W1>=$)v9.push(D)};jD.WARN=1;jD.INFO=2;jD.DEBUG=3;jD.reset=()=>{v9=[]};jD.setDebugLevel=(D)=>{W1=D};jD.warn=(D)=>jD(D,jD.WARN);jD.info=(D)=>jD(D,jD.INFO);jD.debug=(D)=>jD(D,jD.DEBUG);jD.debugMessages=()=>v9;E1.exports=jD});var C1=c((yj,z1)=>{z1.exports=({onlyFirst:D=!1}={})=>{let $=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp($,D?void 0:"g")}});var N1=c((fj,H1)=>{var v4=C1();H1.exports=(D)=>typeof D==="string"?D.replace(v4(),""):D});var F1=c((mj,y9)=>{var V1=(D)=>{if(Number.isNaN(D))return!1;if(D>=4352&&(D<=4447||D===9001||D===9002||11904<=D&&D<=12871&&D!==12351||12880<=D&&D<=19903||19968<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65131||65281<=D&&D<=65376||65504<=D&&D<=65510||110592<=D&&D<=110593||127488<=D&&D<=127569||131072<=D&&D<=262141))return!0;return!1};y9.exports=V1;y9.exports.default=V1});var B1=c((uj,L1)=>{L1.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var I1=c((gj,f9)=>{var y4=N1(),f4=F1(),m4=B1(),R1=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=y4(D),D.length===0)return 0;D=D.replace(m4()," ");let $=0;for(let J=0;J<D.length;J++){let Q=D.codePointAt(J);if(Q<=31||Q>=127&&Q<=159)continue;if(Q>=768&&Q<=879)continue;if(Q>65535)J++;$+=f4(Q)?2:1}return $};f9.exports=R1;f9.exports.default=R1});var m9=c((lj,M1)=>{var w1=I1();function m8(D){return D?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function kD(D){let $=m8();return(""+D).replace($,"").split(`
28
- `).reduce(function(G,q){return w1(q)>G?w1(q):G},0)}function G8(D,$){return Array($+1).join(D)}function u4(D,$,J,Q){let G=kD(D);if($+1>=G){let q=$-G;switch(Q){case"right":{D=G8(J,q)+D;break}case"center":{let X=Math.ceil(q/2),Y=q-X;D=G8(J,Y)+D+G8(J,X);break}default:{D=D+G8(J,q);break}}}return D}var k0={};function q8(D,$,J){$="\x1B["+$+"m",J="\x1B["+J+"m",k0[$]={set:D,to:!0},k0[J]={set:D,to:!1},k0[D]={on:$,off:J}}q8("bold",1,22);q8("italics",3,23);q8("underline",4,24);q8("inverse",7,27);q8("strikethrough",9,29);function O1(D,$){let J=$[1]?parseInt($[1].split(";")[0]):0;if(J>=30&&J<=39||J>=90&&J<=97){D.lastForegroundAdded=$[0];return}if(J>=40&&J<=49||J>=100&&J<=107){D.lastBackgroundAdded=$[0];return}if(J===0){for(let G in D)if(Object.prototype.hasOwnProperty.call(D,G))delete D[G];return}let Q=k0[$[0]];if(Q)D[Q.set]=Q.to}function g4(D){let $=m8(!0),J=$.exec(D),Q={};while(J!==null)O1(Q,J),J=$.exec(D);return Q}function T1(D,$){let{lastBackgroundAdded:J,lastForegroundAdded:Q}=D;if(delete D.lastBackgroundAdded,delete D.lastForegroundAdded,Object.keys(D).forEach(function(G){if(D[G])$+=k0[G].off}),J&&J!="\x1B[49m")$+="\x1B[49m";if(Q&&Q!="\x1B[39m")$+="\x1B[39m";return $}function l4(D,$){let{lastBackgroundAdded:J,lastForegroundAdded:Q}=D;if(delete D.lastBackgroundAdded,delete D.lastForegroundAdded,Object.keys(D).forEach(function(G){if(D[G])$=k0[G].on+$}),J&&J!="\x1B[49m")$=J+$;if(Q&&Q!="\x1B[39m")$=Q+$;return $}function p4(D,$){if(D.length===kD(D))return D.substr(0,$);while(kD(D)>$)D=D.slice(0,-1);return D}function d4(D,$){let J=m8(!0),Q=D.split(m8()),G=0,q=0,X="",Y,Z={};while(q<$){Y=J.exec(D);let K=Q[G];if(G++,q+kD(K)>$)K=p4(K,$-q);if(X+=K,q+=kD(K),q<$){if(!Y)break;X+=Y[0],O1(Z,Y)}}return T1(Z,X)}function c4(D,$,J){if(J=J||"…",kD(D)<=$)return D;$-=kD(J);let G=d4(D,$);G+=J;let q="\x1B]8;;\x07";if(D.includes(q)&&!G.includes(q))G+=q;return G}function a4(){return{chars:{top:"─","top-mid":"┬","top-left":"┌","top-right":"┐",bottom:"─","bottom-mid":"┴","bottom-left":"└","bottom-right":"┘",left:"│","left-mid":"├",mid:"─","mid-mid":"┼",right:"│","right-mid":"┤",middle:"│"},truncate:"…",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function i4(D,$){D=D||{},$=$||a4();let J=Object.assign({},$,D);return J.chars=Object.assign({},$.chars,D.chars),J.style=Object.assign({},$.style,D.style),J}function r4(D,$){let J=[],Q=$.split(/(\s+)/g),G=[],q=0,X;for(let Y=0;Y<Q.length;Y+=2){let Z=Q[Y],K=q+kD(Z);if(q>0&&X)K+=X.length;if(K>D){if(q!==0)J.push(G.join(""));G=[Z],q=kD(Z)}else G.push(X||"",Z),q=K;X=Q[Y+1]}if(q)J.push(G.join(""));return J}function o4(D,$){let J=[],Q="";function G(X,Y){if(Q.length&&Y)Q+=Y;Q+=X;while(Q.length>D)J.push(Q.slice(0,D)),Q=Q.slice(D)}let q=$.split(/(\s+)/g);for(let X=0;X<q.length;X+=2)G(q[X],X&&q[X-1]);if(Q.length)J.push(Q);return J}function s4(D,$,J=!0){let Q=[];$=$.split(`
29
- `);let G=J?r4:o4;for(let q=0;q<$.length;q++)Q.push.apply(Q,G(D,$[q]));return Q}function n4(D){let $={},J=[];for(let Q=0;Q<D.length;Q++){let G=l4($,D[Q]);$=g4(G);let q=Object.assign({},$);J.push(T1(q,G))}return J}function t4(D,$){return["\x1B]","8",";",";",D||$,"\x07",$,"\x1B]","8",";",";","\x07"].join("")}M1.exports={strlen:kD,repeat:G8,pad:u4,truncate:c4,mergeOptions:i4,wordWrap:s4,colorizeLines:n4,hyperlink:t4}});var k1=c((pj,_1)=>{var S1={};_1.exports=S1;var P1={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(P1).forEach(function(D){var $=P1[D],J=S1[D]=[];J.open="\x1B["+$[0]+"m",J.close="\x1B["+$[1]+"m"})});var x1=c((dj,A1)=>{A1.exports=function(D,$){$=$||process.argv;var J=$.indexOf("--"),Q=/^-{1,2}/.test(D)?"":"--",G=$.indexOf(Q+D);return G!==-1&&(J===-1?!0:G<J)}});var h1=c((cj,b1)=>{var e4=z0("os"),SD=x1(),zD=process.env,A0=void 0;if(SD("no-color")||SD("no-colors")||SD("color=false"))A0=!1;else if(SD("color")||SD("colors")||SD("color=true")||SD("color=always"))A0=!0;if("FORCE_COLOR"in zD)A0=zD.FORCE_COLOR.length===0||parseInt(zD.FORCE_COLOR,10)!==0;function Dq(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function $q(D){if(A0===!1)return 0;if(SD("color=16m")||SD("color=full")||SD("color=truecolor"))return 3;if(SD("color=256"))return 2;if(D&&!D.isTTY&&A0!==!0)return 0;var $=A0?1:0;if(process.platform==="win32"){var J=e4.release().split(".");if(Number(process.versions.node.split(".")[0])>=8&&Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in zD){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(G){return G in zD})||zD.CI_NAME==="codeship")return 1;return $}if("TEAMCITY_VERSION"in zD)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(zD.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in zD){var Q=parseInt((zD.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(zD.TERM_PROGRAM){case"iTerm.app":return Q>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(zD.TERM))return 2;if(/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(zD.TERM))return 1;if("COLORTERM"in zD)return 1;if(zD.TERM==="dumb")return $;return $}function u9(D){var $=$q(D);return Dq($)}b1.exports={supportsColor:u9,stdout:u9(process.stdout),stderr:u9(process.stderr)}});var y1=c((aj,v1)=>{v1.exports=function($,J){var Q="";$=$||"Run the trap, drop the bass",$=$.split("");var G={a:["@","Ą","Ⱥ","Ʌ","Δ","Λ","Д"],b:["ß","Ɓ","Ƀ","ɮ","β","฿"],c:["©","Ȼ","Ͼ"],d:["Ð","Ɗ","Ԁ","ԁ","Ԃ","ԃ"],e:["Ë","ĕ","Ǝ","ɘ","Σ","ξ","Ҽ","੬"],f:["Ӻ"],g:["ɢ"],h:["Ħ","ƕ","Ң","Һ","Ӈ","Ԋ"],i:["༏"],j:["Ĵ"],k:["ĸ","Ҡ","Ӄ","Ԟ"],l:["Ĺ"],m:["ʍ","Ӎ","ӎ","Ԡ","ԡ","൩"],n:["Ñ","ŋ","Ɲ","Ͷ","Π","Ҋ"],o:["Ø","õ","ø","Ǿ","ʘ","Ѻ","ם","۝","๏"],p:["Ƿ","Ҏ"],q:["্"],r:["®","Ʀ","Ȑ","Ɍ","ʀ","Я"],s:["§","Ϟ","ϟ","Ϩ"],t:["Ł","Ŧ","ͳ"],u:["Ʊ","Ս"],v:["ט"],w:["Ш","Ѡ","Ѽ","൰"],x:["Ҳ","Ӿ","Ӽ","ӽ"],y:["¥","Ұ","Ӌ"],z:["Ƶ","ɀ"]};return $.forEach(function(q){q=q.toLowerCase();var X=G[q]||[" "],Y=Math.floor(Math.random()*X.length);if(typeof G[q]<"u")Q+=G[q][Y];else Q+=q}),Q}});var m1=c((ij,f1)=>{f1.exports=function($,J){$=$||" he is here ";var Q={up:["̍","̎","̄","̅","̿","̑","̆","̐","͒","͗","͑","̇","̈","̊","͂","̓","̈","͊","͋","͌","̃","̂","̌","͐","̀","́","̋","̏","̒","̓","̔","̽","̉","ͣ","ͤ","ͥ","ͦ","ͧ","ͨ","ͩ","ͪ","ͫ","ͬ","ͭ","ͮ","ͯ","̾","͛","͆","̚"],down:["̖","̗","̘","̙","̜","̝","̞","̟","̠","̤","̥","̦","̩","̪","̫","̬","̭","̮","̯","̰","̱","̲","̳","̹","̺","̻","̼","ͅ","͇","͈","͉","͍","͎","͓","͔","͕","͖","͙","͚","̣"],mid:["̕","̛","̀","́","͘","̡","̢","̧","̨","̴","̵","̶","͜","͝","͞","͟","͠","͢","̸","̷","͡"," ҉"]},G=[].concat(Q.up,Q.down,Q.mid);function q(Z){var K=Math.floor(Math.random()*Z);return K}function X(Z){var K=!1;return G.filter(function(j){K=j===Z}),K}function Y(Z,K){var j="",U,C;K=K||{},K.up=typeof K.up<"u"?K.up:!0,K.mid=typeof K.mid<"u"?K.mid:!0,K.down=typeof K.down<"u"?K.down:!0,K.size=typeof K.size<"u"?K.size:"maxi",Z=Z.split("");for(C in Z){if(X(C))continue;switch(j=j+Z[C],U={up:0,down:0,mid:0},K.size){case"mini":U.up=q(8),U.mid=q(2),U.down=q(8);break;case"maxi":U.up=q(16)+3,U.mid=q(4)+1,U.down=q(64)+3;break;default:U.up=q(8)+1,U.mid=q(6)/2,U.down=q(8)+1;break}var z=["up","mid","down"];for(var E in z){var F=z[E];for(var W=0;W<=U[F];W++)if(K[F])j=j+Q[F][q(Q[F].length)]}}return j}return Y($,J)}});var g1=c((rj,u1)=>{u1.exports=function(D){return function($,J,Q){if($===" ")return $;switch(J%3){case 0:return D.red($);case 1:return D.white($);case 2:return D.blue($)}}}});var p1=c((oj,l1)=>{l1.exports=function(D){return function($,J,Q){return J%2===0?$:D.inverse($)}}});var c1=c((sj,d1)=>{d1.exports=function(D){var $=["red","yellow","green","blue","magenta"];return function(J,Q,G){if(J===" ")return J;else return D[$[Q++%$.length]](J)}}});var i1=c((nj,a1)=>{a1.exports=function(D){var $=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(J,Q,G){return J===" "?J:D[$[Math.round(Math.random()*($.length-2))]](J)}}});var t1=c((ej,n1)=>{var f={};n1.exports=f;f.themes={};var Jq=z0("util"),C0=f.styles=k1(),r1=Object.defineProperties,Qq=new RegExp(/[\r\n]+/g);f.supportsColor=h1().supportsColor;if(typeof f.enabled>"u")f.enabled=f.supportsColor()!==!1;f.enable=function(){f.enabled=!0};f.disable=function(){f.enabled=!1};f.stripColors=f.strip=function(D){return(""+D).replace(/\x1B\[\d+m/g,"")};var tj=f.stylize=function($,J){if(!f.enabled)return $+"";var Q=C0[J];if(!Q&&J in f)return f[J]($);return Q.open+$+Q.close},Gq=/[|\\{}()[\]^$+*?.]/g,qq=function(D){if(typeof D!=="string")throw TypeError("Expected a string");return D.replace(Gq,"\\$&")};function o1(D){var $=function J(){return Yq.apply(J,arguments)};return $._styles=D,$.__proto__=Xq,$}var s1=function(){var D={};return C0.grey=C0.gray,Object.keys(C0).forEach(function($){C0[$].closeRe=new RegExp(qq(C0[$].close),"g"),D[$]={get:function(){return o1(this._styles.concat($))}}}),D}(),Xq=r1(function(){},s1);function Yq(){var D=Array.prototype.slice.call(arguments),$=D.map(function(X){if(X!=null&&X.constructor===String)return X;else return Jq.inspect(X)}).join(" ");if(!f.enabled||!$)return $;var J=$.indexOf(`
30
- `)!=-1,Q=this._styles,G=Q.length;while(G--){var q=C0[Q[G]];if($=q.open+$.replace(q.closeRe,q.open)+q.close,J)$=$.replace(Qq,function(X){return q.close+X+q.open})}return $}f.setTheme=function(D){if(typeof D==="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var $ in D)(function(J){f[J]=function(Q){if(typeof D[J]==="object"){var G=Q;for(var q in D[J])G=f[D[J][q]](G);return G}return f[D[J]](Q)}})($)};function Zq(){var D={};return Object.keys(s1).forEach(function($){D[$]={get:function(){return o1([$])}}}),D}var Kq=function($,J){var Q=J.split("");return Q=Q.map($),Q.join("")};f.trap=y1();f.zalgo=m1();f.maps={};f.maps.america=g1()(f);f.maps.zebra=p1()(f);f.maps.rainbow=c1()(f);f.maps.random=i1()(f);for(g9 in f.maps)(function(D){f[D]=function($){return Kq(f.maps[D],$)}})(g9);var g9;r1(f,Zq())});var D$=c((DU,e1)=>{var jq=t1();e1.exports=jq});var G$=c(($U,l8)=>{var{info:Uq,debug:Q$}=f8(),RD=m9();class X8{constructor(D){this.setOptions(D),this.x=null,this.y=null}setOptions(D){if(["boolean","number","bigint","string"].indexOf(typeof D)!==-1)D={content:""+D};D=D||{},this.options=D;let $=D.content;if(["boolean","number","bigint","string"].indexOf(typeof $)!==-1)this.content=String($);else if(!$)this.content=this.options.href||"";else throw Error("Content needs to be a primitive, got: "+typeof $);if(this.colSpan=D.colSpan||1,this.rowSpan=D.rowSpan||1,this.options.href)Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(D,$){this.cells=$;let J=this.options.chars||{},Q=D.chars,G=this.chars={};Eq.forEach(function(Y){l9(J,Q,Y,G)}),this.truncate=this.options.truncate||D.truncate;let q=this.options.style=this.options.style||{},X=D.style;l9(q,X,"padding-left",this),l9(q,X,"padding-right",this),this.head=q.head||X.head,this.border=q.border||X.border,this.fixedWidth=D.colWidths[this.x],this.lines=this.computeLines(D),this.desiredWidth=RD.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(D){let $=D.wordWrap||D.textWrap,{wordWrap:J=$}=this.options;if(this.fixedWidth&&J){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let q=1;while(q<this.colSpan)this.fixedWidth+=D.colWidths[this.x+q],q++}let{wrapOnWordBoundary:Q=!0}=D,{wrapOnWordBoundary:G=Q}=this.options;return this.wrapLines(RD.wordWrap(this.fixedWidth,this.content,G))}return this.wrapLines(this.content.split(`
31
- `))}wrapLines(D){let $=RD.colorizeLines(D);if(this.href)return $.map((J)=>RD.hyperlink(this.href,J));return $}init(D){let $=this.x,J=this.y;this.widths=D.colWidths.slice($,$+this.colSpan),this.heights=D.rowHeights.slice(J,J+this.rowSpan),this.width=this.widths.reduce(J$,-1),this.height=this.heights.reduce(J$,-1),this.hAlign=this.options.hAlign||D.colAligns[$],this.vAlign=this.options.vAlign||D.rowAligns[J],this.drawRight=$+this.colSpan==D.colWidths.length}draw(D,$){if(D=="top")return this.drawTop(this.drawRight);if(D=="bottom")return this.drawBottom(this.drawRight);let J=RD.truncate(this.content,10,this.truncate);if(!D)Uq(`${this.y}-${this.x}: ${this.rowSpan-D}x${this.colSpan} Cell ${J}`);let Q=Math.max(this.height-this.lines.length,0),G;switch(this.vAlign){case"center":G=Math.ceil(Q/2);break;case"bottom":G=Q;break;default:G=0}if(D<G||D>=G+this.lines.length)return this.drawEmpty(this.drawRight,$);let q=this.lines.length>this.height&&D+1>=this.height;return this.drawLine(D-G,this.drawRight,q,$)}drawTop(D){let $=[];if(this.cells)this.widths.forEach(function(J,Q){$.push(this._topLeftChar(Q)),$.push(RD.repeat(this.chars[this.y==0?"top":"mid"],J))},this);else $.push(this._topLeftChar(0)),$.push(RD.repeat(this.chars[this.y==0?"top":"mid"],this.width));if(D)$.push(this.chars[this.y==0?"topRight":"rightMid"]);return this.wrapWithStyleColors("border",$.join(""))}_topLeftChar(D){let $=this.x+D,J;if(this.y==0)J=$==0?"topLeft":D==0?"topMid":"top";else if($==0)J="leftMid";else if(J=D==0?"midMid":"bottomMid",this.cells){if(this.cells[this.y-1][$]instanceof X8.ColSpanCell)J=D==0?"topMid":"mid";if(D==0){let G=1;while(this.cells[this.y][$-G]instanceof X8.ColSpanCell)G++;if(this.cells[this.y][$-G]instanceof X8.RowSpanCell)J="leftMid"}}return this.chars[J]}wrapWithStyleColors(D,$){if(this[D]&&this[D].length)try{let J=D$();for(let Q=this[D].length-1;Q>=0;Q--)J=J[this[D][Q]];return J($)}catch(J){return $}else return $}drawLine(D,$,J,Q){let G=this.chars[this.x==0?"left":"middle"];if(this.x&&Q&&this.cells){let U=this.cells[this.y+Q][this.x-1];while(U instanceof u8)U=this.cells[U.y][U.x-1];if(!(U instanceof g8))G=this.chars.rightMid}let q=RD.repeat(" ",this.paddingLeft),X=$?this.chars.right:"",Y=RD.repeat(" ",this.paddingRight),Z=this.lines[D],K=this.width-(this.paddingLeft+this.paddingRight);if(J)Z+=this.truncate||"…";let j=RD.truncate(Z,K,this.truncate);return j=RD.pad(j,K," ",this.hAlign),j=q+j+Y,this.stylizeLine(G,j,X)}stylizeLine(D,$,J){if(D=this.wrapWithStyleColors("border",D),J=this.wrapWithStyleColors("border",J),this.y===0)$=this.wrapWithStyleColors("head",$);return D+$+J}drawBottom(D){let $=this.chars[this.x==0?"bottomLeft":"bottomMid"],J=RD.repeat(this.chars.bottom,this.width),Q=D?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",$+J+Q)}drawEmpty(D,$){let J=this.chars[this.x==0?"left":"middle"];if(this.x&&$&&this.cells){let q=this.cells[this.y+$][this.x-1];while(q instanceof u8)q=this.cells[q.y][q.x-1];if(!(q instanceof g8))J=this.chars.rightMid}let Q=D?this.chars.right:"",G=RD.repeat(" ",this.width);return this.stylizeLine(J,G,Q)}}class u8{constructor(){}draw(D){if(typeof D==="number")Q$(`${this.y}-${this.x}: 1x1 ColSpanCell`);return""}init(){}mergeTableOptions(){}}class g8{constructor(D){this.originalCell=D}init(D){let $=this.y,J=this.originalCell.y;this.cellOffset=$-J,this.offset=Wq(D.rowHeights,J,this.cellOffset)}draw(D){if(D=="top")return this.originalCell.draw(this.offset,this.cellOffset);if(D=="bottom")return this.originalCell.draw("bottom");return Q$(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+D)}mergeTableOptions(){}}function $$(...D){return D.filter(($)=>$!==void 0&&$!==null).shift()}function l9(D,$,J,Q){let G=J.split("-");if(G.length>1)G[1]=G[1].charAt(0).toUpperCase()+G[1].substr(1),G=G.join(""),Q[G]=$$(D[G],D[J],$[G],$[J]);else Q[J]=$$(D[J],$[J])}function Wq(D,$,J){let Q=D[$];for(let G=1;G<J;G++)Q+=1+D[$+G];return Q}function J$(D,$){return D+$+1}var Eq=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];l8.exports=X8;l8.exports.ColSpanCell=u8;l8.exports.RowSpanCell=g8});var Y$=c((JU,X$)=>{var{warn:zq,debug:Cq}=f8(),p9=G$(),{ColSpanCell:Hq,RowSpanCell:Nq}=p9;(function(){function D(z,E){if(z[E]>0)return D(z,E+1);return E}function $(z){let E={};z.forEach(function(F,W){let H=0;F.forEach(function(N){N.y=W,N.x=W?D(E,H):H;let I=N.rowSpan||1,O=N.colSpan||1;if(I>1)for(let y=0;y<O;y++)E[N.x+y]=I;H=N.x+O}),Object.keys(E).forEach((N)=>{if(E[N]--,E[N]<1)delete E[N]})})}function J(z){let E=0;return z.forEach(function(F){F.forEach(function(W){E=Math.max(E,W.x+(W.colSpan||1))})}),E}function Q(z){return z.length}function G(z,E){let F=z.y,W=z.y-1+(z.rowSpan||1),H=E.y,N=E.y-1+(E.rowSpan||1),I=!(F>N||H>W),O=z.x,y=z.x-1+(z.colSpan||1),p=E.x,m=E.x-1+(E.colSpan||1),T=!(O>m||p>y);return I&&T}function q(z,E,F){let W=Math.min(z.length-1,F),H={x:E,y:F};for(let N=0;N<=W;N++){let I=z[N];for(let O=0;O<I.length;O++)if(G(H,I[O]))return!0}return!1}function X(z,E,F,W){for(let H=F;H<W;H++)if(q(z,H,E))return!1;return!0}function Y(z){z.forEach(function(E,F){E.forEach(function(W){for(let H=1;H<W.rowSpan;H++){let N=new Nq(W);N.x=W.x,N.y=W.y+H,N.colSpan=W.colSpan,K(N,z[F+H])}})})}function Z(z){for(let E=z.length-1;E>=0;E--){let F=z[E];for(let W=0;W<F.length;W++){let H=F[W];for(let N=1;N<H.colSpan;N++){let I=new Hq;I.x=H.x+N,I.y=H.y,F.splice(W+1,0,I)}}}}function K(z,E){let F=0;while(F<E.length&&E[F].x<z.x)F++;E.splice(F,0,z)}function j(z){let E=Q(z),F=J(z);Cq(`Max rows: ${E}; Max cols: ${F}`);for(let W=0;W<E;W++)for(let H=0;H<F;H++)if(!q(z,H,W)){let N={x:H,y:W,colSpan:1,rowSpan:1};H++;while(H<F&&!q(z,H,W))N.colSpan++,H++;let I=W+1;while(I<E&&X(z,I,N.x,N.x+N.colSpan))N.rowSpan++,I++;let O=new p9(N);O.x=N.x,O.y=N.y,zq(`Missing cell at ${O.y}-${O.x}.`),K(O,z[W])}}function U(z){return z.map(function(E){if(!Array.isArray(E)){let F=Object.keys(E)[0];if(E=E[F],Array.isArray(E))E=E.slice(),E.unshift(F);else E=[F,E]}return E.map(function(F){return new p9(F)})})}function C(z){let E=U(z);return $(E),j(E),Y(E),Z(E),E}X$.exports={makeTableLayout:C,layoutTable:$,addRowSpanCells:Y,maxWidth:J,fillInTable:j,computeWidths:q$("colSpan","desiredWidth","x",1),computeHeights:q$("rowSpan","desiredHeight","y",1)}})();function q$(D,$,J,Q){return function(G,q){let X=[],Y=[],Z={};q.forEach(function(K){K.forEach(function(j){if((j[D]||1)>1)Y.push(j);else X[j[J]]=Math.max(X[j[J]]||0,j[$]||0,Q)})}),G.forEach(function(K,j){if(typeof K==="number")X[j]=K});for(let K=Y.length-1;K>=0;K--){let j=Y[K],U=j[D],C=j[J],z=X[C],E=typeof G[C]==="number"?0:1;if(typeof z==="number"){for(let F=1;F<U;F++)if(z+=1+X[C+F],typeof G[C+F]!=="number")E++}else if(z=$==="desiredWidth"?j.desiredWidth-1:1,!Z[C]||Z[C]<z)Z[C]=z;if(j[$]>z){let F=0;while(E>0&&j[$]>z){if(typeof G[C+F]!=="number"){let W=Math.round((j[$]-z)/E);z+=W,X[C+F]+=W,E--}F++}}}Object.assign(G,X,Z);for(let K=0;K<G.length;K++)G[K]=Math.max(Q,G[K]||0)}}});var K$=c((QU,Z$)=>{var fD=f8(),Vq=m9(),d9=Y$();class a9 extends Array{constructor(D){super();let $=Vq.mergeOptions(D);if(Object.defineProperty(this,"options",{value:$,enumerable:$.debug}),$.debug){switch(typeof $.debug){case"boolean":fD.setDebugLevel(fD.WARN);break;case"number":fD.setDebugLevel($.debug);break;case"string":fD.setDebugLevel(parseInt($.debug,10));break;default:fD.setDebugLevel(fD.WARN),fD.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof $.debug}`)}Object.defineProperty(this,"messages",{get(){return fD.debugMessages()}})}}toString(){let D=this,$=this.options.head&&this.options.head.length;if($){if(D=[this.options.head],this.length)D.push.apply(D,this)}else this.options.style.head=[];let J=d9.makeTableLayout(D);J.forEach(function(G){G.forEach(function(q){q.mergeTableOptions(this.options,J)},this)},this),d9.computeWidths(this.options.colWidths,J),d9.computeHeights(this.options.rowHeights,J),J.forEach(function(G){G.forEach(function(q){q.init(this.options)},this)},this);let Q=[];for(let G=0;G<J.length;G++){let q=J[G],X=this.options.rowHeights[G];if(G===0||!this.options.style.compact||G==1&&$)c9(q,"top",Q);for(let Y=0;Y<X;Y++)c9(q,Y,Q);if(G+1==J.length)c9(q,"bottom",Q)}return Q.join(`
24
+ `),this.outputHelp({error:!0});let J=$||{},Q=J.exitCode||1,q=J.code||"commander.error";this._exit(Q,q,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in p.env){let $=D.attributeName();if(this.getOptionValue($)===void 0||["default","config","env"].includes(this.getOptionValueSource($)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,p.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new G4(this.options),$=(J)=>{return this.getOptionValue(J)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(J))};this.options.filter((J)=>J.implied!==void 0&&$(J.attributeName())&&D.valueFromOption(this.getOptionValue(J.attributeName()),J)).forEach((J)=>{Object.keys(J.implied).filter((Q)=>!$(Q)).forEach((Q)=>{this.setOptionValueWithSource(Q,J.implied[Q],"implied")})})}missingArgument(D){let $=`error: missing required argument '${D}'`;this.error($,{code:"commander.missingArgument"})}optionMissingArgument(D){let $=`error: option '${D.flags}' argument missing`;this.error($,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let $=`error: required option '${D.flags}' not specified`;this.error($,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,$){let J=(G)=>{let X=G.attributeName(),Y=this.getOptionValue(X),Z=this.options.find((j)=>j.negate&&X===j.attributeName()),U=this.options.find((j)=>!j.negate&&X===j.attributeName());if(Z&&(Z.presetArg===void 0&&Y===!1||Z.presetArg!==void 0&&Y===Z.presetArg))return Z;return U||G},Q=(G)=>{let X=J(G),Y=X.attributeName();if(this.getOptionValueSource(Y)==="env")return`environment variable '${X.envVar}'`;return`option '${X.flags}'`},q=`error: ${Q(D)} cannot be used with ${Q($)}`;this.error(q,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let $="";if(D.startsWith("--")&&this._showSuggestionAfterError){let Q=[],q=this;do{let G=q.createHelp().visibleOptions(q).filter((X)=>X.long).map((X)=>X.long);Q=Q.concat(G),q=q.parent}while(q&&!q._enablePositionalOptions);$=r7(D,Q)}let J=`error: unknown option '${D}'${$}`;this.error(J,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let $=this.registeredArguments.length,J=$===1?"":"s",q=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${$} argument${J} but got ${D.length}.`;this.error(q,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],$="";if(this._showSuggestionAfterError){let Q=[];this.createHelp().visibleCommands(this).forEach((q)=>{if(Q.push(q.name()),q.alias())Q.push(q.alias())}),$=r7(D,Q)}let J=`error: unknown command '${D}'${$}`;this.error(J,{code:"commander.unknownCommand"})}version(D,$,J){if(D===void 0)return this._version;this._version=D,$=$||"-V, --version",J=J||"output the version number";let Q=this.createOption($,J);return this._versionOptionName=Q.attributeName(),this._registerOption(Q),this.on("option:"+Q.name(),()=>{this._outputConfiguration.writeOut(`${D}
25
+ `),this._exit(0,"commander.version",D)}),this}description(D,$){if(D===void 0&&$===void 0)return this._description;if(this._description=D,$)this._argsDescription=$;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let $=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)$=this.commands[this.commands.length-1];if(D===$._name)throw Error("Command alias can't be the same as its name");let J=this.parent?._findCommand(D);if(J){let Q=[J.name()].concat(J.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${Q}'`)}return $._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach(($)=>this.alias($)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let $=this.registeredArguments.map((J)=>{return J4(J)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?$:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}helpGroup(D){if(D===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=D,this}commandsGroup(D){if(D===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=D,this}optionsGroup(D){if(D===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=D,this}_initOptionGroup(D){if(this._defaultOptionGroup&&!D.helpGroupHeading)D.helpGroup(this._defaultOptionGroup)}_initCommandGroup(D){if(this._defaultCommandGroup&&!D.helpGroup())D.helpGroup(this._defaultCommandGroup)}nameFromFilename(D){return this._name=uD.basename(D,uD.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let $=this.createHelp(),J=this._getOutputContext(D);$.prepareContext({error:J.error,helpWidth:J.helpWidth,outputHasColors:J.hasColors});let Q=$.formatHelp(this,$);if(J.hasColors)return Q;return this._outputConfiguration.stripColor(Q)}_getOutputContext(D){D=D||{};let $=!!D.error,J,Q,q;if($)J=(X)=>this._outputConfiguration.writeErr(X),Q=this._outputConfiguration.getErrHasColors(),q=this._outputConfiguration.getErrHelpWidth();else J=(X)=>this._outputConfiguration.writeOut(X),Q=this._outputConfiguration.getOutHasColors(),q=this._outputConfiguration.getOutHelpWidth();return{error:$,write:(X)=>{if(!Q)X=this._outputConfiguration.stripColor(X);return J(X)},hasColors:Q,helpWidth:q}}outputHelp(D){let $;if(typeof D==="function")$=D,D=void 0;let J=this._getOutputContext(D),Q={error:J.error,write:J.write,command:this};this._getCommandAndAncestors().reverse().forEach((G)=>G.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let q=this.helpInformation({error:J.error});if($){if(q=$(q),typeof q!=="string"&&!Buffer.isBuffer(q))throw Error("outputHelp callback must return a string or a Buffer")}if(J.write(q),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((G)=>G.emit("afterAllHelp",Q))}helpOption(D,$){if(typeof D==="boolean"){if(D){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(D??"-h, --help",$??"display help for command"),D||$)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this._initOptionGroup(D),this}help(D){this.outputHelp(D);let $=Number(p.exitCode??0);if($===0&&D&&typeof D!=="function"&&D.error)$=1;this._exit($,"commander.help","(outputHelp)")}addHelpText(D,$){let J=["beforeAll","before","after","afterAll"];if(!J.includes(D))throw Error(`Unexpected value for position to addHelpText.
26
+ Expecting one of '${J.join("', '")}'`);let Q=`${D}Help`;return this.on(Q,(q)=>{let G;if(typeof $==="function")G=$({error:q.error,command:q.command});else G=$;if(G)q.write(`${G}
27
+ `)}),this}_outputHelpIfRequested(D){let $=this._getHelpOption();if($&&D.find((Q)=>$.is(Q)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function o7(D){return D.map(($)=>{if(!$.startsWith("--inspect"))return $;let J,Q="127.0.0.1",q="9229",G;if((G=$.match(/^(--inspect(-brk)?)$/))!==null)J=G[1];else if((G=$.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(J=G[1],/^\d+$/.test(G[3]))q=G[3];else Q=G[3];else if((G=$.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)J=G[1],Q=G[3],q=G[4];if(J&&q!=="0")return`${J}=${Q}:${parseInt(q)+1}`;return $})}function A9(){if(p.env.NO_COLOR||p.env.FORCE_COLOR==="0"||p.env.FORCE_COLOR==="false")return!1;if(p.env.FORCE_COLOR||p.env.CLICOLOR_FORCE!==void 0)return!0;return}X4.Command=x9;X4.useColor=A9});var D1=a((K4)=>{var{Argument:s7}=y8(),{Command:b9}=n7(),{CommanderError:U4,InvalidArgumentError:t7}=G8(),{Help:j4}=P9(),{Option:e7}=_9();K4.program=new b9;K4.createCommand=(D)=>new b9(D);K4.createOption=(D,$)=>new e7(D,$);K4.createArgument=(D,$)=>new s7(D,$);K4.Command=b9;K4.Option=e7;K4.Argument=s7;K4.Help=j4;K4.CommanderError=U4;K4.InvalidArgumentError=t7;K4.InvalidOptionArgumentError=t7});var l8=a((lj,N1)=>{var u9=[],V1=0,ED=(D,$)=>{if(V1>=$)u9.push(D)};ED.WARN=1;ED.INFO=2;ED.DEBUG=3;ED.reset=()=>{u9=[]};ED.setDebugLevel=(D)=>{V1=D};ED.warn=(D)=>ED(D,ED.WARN);ED.info=(D)=>ED(D,ED.INFO);ED.debug=(D)=>ED(D,ED.DEBUG);ED.debugMessages=()=>u9;N1.exports=ED});var C1=a((dj,F1)=>{F1.exports=({onlyFirst:D=!1}={})=>{let $=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp($,D?void 0:"g")}});var L1=a((pj,R1)=>{var g4=C1();R1.exports=(D)=>typeof D==="string"?D.replace(g4(),""):D});var I1=a((cj,g9)=>{var B1=(D)=>{if(Number.isNaN(D))return!1;if(D>=4352&&(D<=4447||D===9001||D===9002||11904<=D&&D<=12871&&D!==12351||12880<=D&&D<=19903||19968<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65131||65281<=D&&D<=65376||65504<=D&&D<=65510||110592<=D&&D<=110593||127488<=D&&D<=127569||131072<=D&&D<=262141))return!0;return!1};g9.exports=B1;g9.exports.default=B1});var T1=a((aj,w1)=>{w1.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var M1=a((ij,l9)=>{var l4=L1(),d4=I1(),p4=T1(),O1=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=l4(D),D.length===0)return 0;D=D.replace(p4()," ");let $=0;for(let J=0;J<D.length;J++){let Q=D.codePointAt(J);if(Q<=31||Q>=127&&Q<=159)continue;if(Q>=768&&Q<=879)continue;if(Q>65535)J++;$+=d4(Q)?2:1}return $};l9.exports=O1;l9.exports.default=O1});var d9=a((rj,k1)=>{var P1=M1();function d8(D){return D?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function bD(D){let $=d8();return(""+D).replace($,"").split(`
28
+ `).reduce(function(q,G){return P1(G)>q?P1(G):q},0)}function Z8(D,$){return Array($+1).join(D)}function c4(D,$,J,Q){let q=bD(D);if($+1>=q){let G=$-q;switch(Q){case"right":{D=Z8(J,G)+D;break}case"center":{let X=Math.ceil(G/2),Y=G-X;D=Z8(J,Y)+D+Z8(J,X);break}default:{D=D+Z8(J,G);break}}}return D}var x0={};function U8(D,$,J){$="\x1B["+$+"m",J="\x1B["+J+"m",x0[$]={set:D,to:!0},x0[J]={set:D,to:!1},x0[D]={on:$,off:J}}U8("bold",1,22);U8("italics",3,23);U8("underline",4,24);U8("inverse",7,27);U8("strikethrough",9,29);function _1(D,$){let J=$[1]?parseInt($[1].split(";")[0]):0;if(J>=30&&J<=39||J>=90&&J<=97){D.lastForegroundAdded=$[0];return}if(J>=40&&J<=49||J>=100&&J<=107){D.lastBackgroundAdded=$[0];return}if(J===0){for(let q in D)if(Object.prototype.hasOwnProperty.call(D,q))delete D[q];return}let Q=x0[$[0]];if(Q)D[Q.set]=Q.to}function a4(D){let $=d8(!0),J=$.exec(D),Q={};while(J!==null)_1(Q,J),J=$.exec(D);return Q}function S1(D,$){let{lastBackgroundAdded:J,lastForegroundAdded:Q}=D;if(delete D.lastBackgroundAdded,delete D.lastForegroundAdded,Object.keys(D).forEach(function(q){if(D[q])$+=x0[q].off}),J&&J!="\x1B[49m")$+="\x1B[49m";if(Q&&Q!="\x1B[39m")$+="\x1B[39m";return $}function i4(D,$){let{lastBackgroundAdded:J,lastForegroundAdded:Q}=D;if(delete D.lastBackgroundAdded,delete D.lastForegroundAdded,Object.keys(D).forEach(function(q){if(D[q])$=x0[q].on+$}),J&&J!="\x1B[49m")$=J+$;if(Q&&Q!="\x1B[39m")$=Q+$;return $}function r4(D,$){if(D.length===bD(D))return D.substr(0,$);while(bD(D)>$)D=D.slice(0,-1);return D}function o4(D,$){let J=d8(!0),Q=D.split(d8()),q=0,G=0,X="",Y,Z={};while(G<$){Y=J.exec(D);let U=Q[q];if(q++,G+bD(U)>$)U=r4(U,$-G);if(X+=U,G+=bD(U),G<$){if(!Y)break;X+=Y[0],_1(Z,Y)}}return S1(Z,X)}function n4(D,$,J){if(J=J||"…",bD(D)<=$)return D;$-=bD(J);let q=o4(D,$);q+=J;let G="\x1B]8;;\x07";if(D.includes(G)&&!q.includes(G))q+=G;return q}function s4(){return{chars:{top:"─","top-mid":"┬","top-left":"┌","top-right":"┐",bottom:"─","bottom-mid":"┴","bottom-left":"└","bottom-right":"┘",left:"│","left-mid":"├",mid:"─","mid-mid":"┼",right:"│","right-mid":"┤",middle:"│"},truncate:"…",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function t4(D,$){D=D||{},$=$||s4();let J=Object.assign({},$,D);return J.chars=Object.assign({},$.chars,D.chars),J.style=Object.assign({},$.style,D.style),J}function e4(D,$){let J=[],Q=$.split(/(\s+)/g),q=[],G=0,X;for(let Y=0;Y<Q.length;Y+=2){let Z=Q[Y],U=G+bD(Z);if(G>0&&X)U+=X.length;if(U>D){if(G!==0)J.push(q.join(""));q=[Z],G=bD(Z)}else q.push(X||"",Z),G=U;X=Q[Y+1]}if(G)J.push(q.join(""));return J}function DG(D,$){let J=[],Q="";function q(X,Y){if(Q.length&&Y)Q+=Y;Q+=X;while(Q.length>D)J.push(Q.slice(0,D)),Q=Q.slice(D)}let G=$.split(/(\s+)/g);for(let X=0;X<G.length;X+=2)q(G[X],X&&G[X-1]);if(Q.length)J.push(Q);return J}function $G(D,$,J=!0){let Q=[];$=$.split(`
29
+ `);let q=J?e4:DG;for(let G=0;G<$.length;G++)Q.push.apply(Q,q(D,$[G]));return Q}function JG(D){let $={},J=[];for(let Q=0;Q<D.length;Q++){let q=i4($,D[Q]);$=a4(q);let G=Object.assign({},$);J.push(S1(G,q))}return J}function QG(D,$){return["\x1B]","8",";",";",D||$,"\x07",$,"\x1B]","8",";",";","\x07"].join("")}k1.exports={strlen:bD,repeat:Z8,pad:c4,truncate:n4,mergeOptions:t4,wordWrap:$G,colorizeLines:JG,hyperlink:QG}});var h1=a((oj,b1)=>{var x1={};b1.exports=x1;var A1={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(A1).forEach(function(D){var $=A1[D],J=x1[D]=[];J.open="\x1B["+$[0]+"m",J.close="\x1B["+$[1]+"m"})});var y1=a((nj,v1)=>{v1.exports=function(D,$){$=$||process.argv;var J=$.indexOf("--"),Q=/^-{1,2}/.test(D)?"":"--",q=$.indexOf(Q+D);return q!==-1&&(J===-1?!0:q<J)}});var m1=a((sj,f1)=>{var qG=V0("os"),AD=y1(),FD=process.env,b0=void 0;if(AD("no-color")||AD("no-colors")||AD("color=false"))b0=!1;else if(AD("color")||AD("colors")||AD("color=true")||AD("color=always"))b0=!0;if("FORCE_COLOR"in FD)b0=FD.FORCE_COLOR.length===0||parseInt(FD.FORCE_COLOR,10)!==0;function GG(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function XG(D){if(b0===!1)return 0;if(AD("color=16m")||AD("color=full")||AD("color=truecolor"))return 3;if(AD("color=256"))return 2;if(D&&!D.isTTY&&b0!==!0)return 0;var $=b0?1:0;if(process.platform==="win32"){var J=qG.release().split(".");if(Number(process.versions.node.split(".")[0])>=8&&Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in FD){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(q){return q in FD})||FD.CI_NAME==="codeship")return 1;return $}if("TEAMCITY_VERSION"in FD)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(FD.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in FD){var Q=parseInt((FD.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(FD.TERM_PROGRAM){case"iTerm.app":return Q>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(FD.TERM))return 2;if(/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(FD.TERM))return 1;if("COLORTERM"in FD)return 1;if(FD.TERM==="dumb")return $;return $}function p9(D){var $=XG(D);return GG($)}f1.exports={supportsColor:p9,stdout:p9(process.stdout),stderr:p9(process.stderr)}});var g1=a((tj,u1)=>{u1.exports=function($,J){var Q="";$=$||"Run the trap, drop the bass",$=$.split("");var q={a:["@","Ą","Ⱥ","Ʌ","Δ","Λ","Д"],b:["ß","Ɓ","Ƀ","ɮ","β","฿"],c:["©","Ȼ","Ͼ"],d:["Ð","Ɗ","Ԁ","ԁ","Ԃ","ԃ"],e:["Ë","ĕ","Ǝ","ɘ","Σ","ξ","Ҽ","੬"],f:["Ӻ"],g:["ɢ"],h:["Ħ","ƕ","Ң","Һ","Ӈ","Ԋ"],i:["༏"],j:["Ĵ"],k:["ĸ","Ҡ","Ӄ","Ԟ"],l:["Ĺ"],m:["ʍ","Ӎ","ӎ","Ԡ","ԡ","൩"],n:["Ñ","ŋ","Ɲ","Ͷ","Π","Ҋ"],o:["Ø","õ","ø","Ǿ","ʘ","Ѻ","ם","۝","๏"],p:["Ƿ","Ҏ"],q:["্"],r:["®","Ʀ","Ȑ","Ɍ","ʀ","Я"],s:["§","Ϟ","ϟ","Ϩ"],t:["Ł","Ŧ","ͳ"],u:["Ʊ","Ս"],v:["ט"],w:["Ш","Ѡ","Ѽ","൰"],x:["Ҳ","Ӿ","Ӽ","ӽ"],y:["¥","Ұ","Ӌ"],z:["Ƶ","ɀ"]};return $.forEach(function(G){G=G.toLowerCase();var X=q[G]||[" "],Y=Math.floor(Math.random()*X.length);if(typeof q[G]<"u")Q+=q[G][Y];else Q+=G}),Q}});var d1=a((ej,l1)=>{l1.exports=function($,J){$=$||" he is here ";var Q={up:["̍","̎","̄","̅","̿","̑","̆","̐","͒","͗","͑","̇","̈","̊","͂","̓","̈","͊","͋","͌","̃","̂","̌","͐","̀","́","̋","̏","̒","̓","̔","̽","̉","ͣ","ͤ","ͥ","ͦ","ͧ","ͨ","ͩ","ͪ","ͫ","ͬ","ͭ","ͮ","ͯ","̾","͛","͆","̚"],down:["̖","̗","̘","̙","̜","̝","̞","̟","̠","̤","̥","̦","̩","̪","̫","̬","̭","̮","̯","̰","̱","̲","̳","̹","̺","̻","̼","ͅ","͇","͈","͉","͍","͎","͓","͔","͕","͖","͙","͚","̣"],mid:["̕","̛","̀","́","͘","̡","̢","̧","̨","̴","̵","̶","͜","͝","͞","͟","͠","͢","̸","̷","͡"," ҉"]},q=[].concat(Q.up,Q.down,Q.mid);function G(Z){var U=Math.floor(Math.random()*Z);return U}function X(Z){var U=!1;return q.filter(function(j){U=j===Z}),U}function Y(Z,U){var j="",K,H;U=U||{},U.up=typeof U.up<"u"?U.up:!0,U.mid=typeof U.mid<"u"?U.mid:!0,U.down=typeof U.down<"u"?U.down:!0,U.size=typeof U.size<"u"?U.size:"maxi",Z=Z.split("");for(H in Z){if(X(H))continue;switch(j=j+Z[H],K={up:0,down:0,mid:0},U.size){case"mini":K.up=G(8),K.mid=G(2),K.down=G(8);break;case"maxi":K.up=G(16)+3,K.mid=G(4)+1,K.down=G(64)+3;break;default:K.up=G(8)+1,K.mid=G(6)/2,K.down=G(8)+1;break}var E=["up","mid","down"];for(var z in E){var C=E[z];for(var W=0;W<=K[C];W++)if(U[C])j=j+Q[C][G(Q[C].length)]}}return j}return Y($,J)}});var c1=a((DK,p1)=>{p1.exports=function(D){return function($,J,Q){if($===" ")return $;switch(J%3){case 0:return D.red($);case 1:return D.white($);case 2:return D.blue($)}}}});var i1=a(($K,a1)=>{a1.exports=function(D){return function($,J,Q){return J%2===0?$:D.inverse($)}}});var o1=a((JK,r1)=>{r1.exports=function(D){var $=["red","yellow","green","blue","magenta"];return function(J,Q,q){if(J===" ")return J;else return D[$[Q++%$.length]](J)}}});var s1=a((QK,n1)=>{n1.exports=function(D){var $=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(J,Q,q){return J===" "?J:D[$[Math.round(Math.random()*($.length-2))]](J)}}});var J$=a((GK,$$)=>{var m={};$$.exports=m;m.themes={};var YG=V0("util"),N0=m.styles=h1(),t1=Object.defineProperties,ZG=new RegExp(/[\r\n]+/g);m.supportsColor=m1().supportsColor;if(typeof m.enabled>"u")m.enabled=m.supportsColor()!==!1;m.enable=function(){m.enabled=!0};m.disable=function(){m.enabled=!1};m.stripColors=m.strip=function(D){return(""+D).replace(/\x1B\[\d+m/g,"")};var qK=m.stylize=function($,J){if(!m.enabled)return $+"";var Q=N0[J];if(!Q&&J in m)return m[J]($);return Q.open+$+Q.close},UG=/[|\\{}()[\]^$+*?.]/g,jG=function(D){if(typeof D!=="string")throw TypeError("Expected a string");return D.replace(UG,"\\$&")};function e1(D){var $=function J(){return WG.apply(J,arguments)};return $._styles=D,$.__proto__=KG,$}var D$=function(){var D={};return N0.grey=N0.gray,Object.keys(N0).forEach(function($){N0[$].closeRe=new RegExp(jG(N0[$].close),"g"),D[$]={get:function(){return e1(this._styles.concat($))}}}),D}(),KG=t1(function(){},D$);function WG(){var D=Array.prototype.slice.call(arguments),$=D.map(function(X){if(X!=null&&X.constructor===String)return X;else return YG.inspect(X)}).join(" ");if(!m.enabled||!$)return $;var J=$.indexOf(`
30
+ `)!=-1,Q=this._styles,q=Q.length;while(q--){var G=N0[Q[q]];if($=G.open+$.replace(G.closeRe,G.open)+G.close,J)$=$.replace(ZG,function(X){return G.close+X+G.open})}return $}m.setTheme=function(D){if(typeof D==="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var $ in D)(function(J){m[J]=function(Q){if(typeof D[J]==="object"){var q=Q;for(var G in D[J])q=m[D[J][G]](q);return q}return m[D[J]](Q)}})($)};function zG(){var D={};return Object.keys(D$).forEach(function($){D[$]={get:function(){return e1([$])}}}),D}var EG=function($,J){var Q=J.split("");return Q=Q.map($),Q.join("")};m.trap=g1();m.zalgo=d1();m.maps={};m.maps.america=c1()(m);m.maps.zebra=i1()(m);m.maps.rainbow=o1()(m);m.maps.random=s1()(m);for(c9 in m.maps)(function(D){m[D]=function($){return EG(m.maps[D],$)}})(c9);var c9;t1(m,zG())});var q$=a((XK,Q$)=>{var HG=J$();Q$.exports=HG});var Z$=a((YK,a8)=>{var{info:VG,debug:Y$}=l8(),OD=d9();class j8{constructor(D){this.setOptions(D),this.x=null,this.y=null}setOptions(D){if(["boolean","number","bigint","string"].indexOf(typeof D)!==-1)D={content:""+D};D=D||{},this.options=D;let $=D.content;if(["boolean","number","bigint","string"].indexOf(typeof $)!==-1)this.content=String($);else if(!$)this.content=this.options.href||"";else throw Error("Content needs to be a primitive, got: "+typeof $);if(this.colSpan=D.colSpan||1,this.rowSpan=D.rowSpan||1,this.options.href)Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(D,$){this.cells=$;let J=this.options.chars||{},Q=D.chars,q=this.chars={};FG.forEach(function(Y){a9(J,Q,Y,q)}),this.truncate=this.options.truncate||D.truncate;let G=this.options.style=this.options.style||{},X=D.style;a9(G,X,"padding-left",this),a9(G,X,"padding-right",this),this.head=G.head||X.head,this.border=G.border||X.border,this.fixedWidth=D.colWidths[this.x],this.lines=this.computeLines(D),this.desiredWidth=OD.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(D){let $=D.wordWrap||D.textWrap,{wordWrap:J=$}=this.options;if(this.fixedWidth&&J){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let G=1;while(G<this.colSpan)this.fixedWidth+=D.colWidths[this.x+G],G++}let{wrapOnWordBoundary:Q=!0}=D,{wrapOnWordBoundary:q=Q}=this.options;return this.wrapLines(OD.wordWrap(this.fixedWidth,this.content,q))}return this.wrapLines(this.content.split(`
31
+ `))}wrapLines(D){let $=OD.colorizeLines(D);if(this.href)return $.map((J)=>OD.hyperlink(this.href,J));return $}init(D){let $=this.x,J=this.y;this.widths=D.colWidths.slice($,$+this.colSpan),this.heights=D.rowHeights.slice(J,J+this.rowSpan),this.width=this.widths.reduce(X$,-1),this.height=this.heights.reduce(X$,-1),this.hAlign=this.options.hAlign||D.colAligns[$],this.vAlign=this.options.vAlign||D.rowAligns[J],this.drawRight=$+this.colSpan==D.colWidths.length}draw(D,$){if(D=="top")return this.drawTop(this.drawRight);if(D=="bottom")return this.drawBottom(this.drawRight);let J=OD.truncate(this.content,10,this.truncate);if(!D)VG(`${this.y}-${this.x}: ${this.rowSpan-D}x${this.colSpan} Cell ${J}`);let Q=Math.max(this.height-this.lines.length,0),q;switch(this.vAlign){case"center":q=Math.ceil(Q/2);break;case"bottom":q=Q;break;default:q=0}if(D<q||D>=q+this.lines.length)return this.drawEmpty(this.drawRight,$);let G=this.lines.length>this.height&&D+1>=this.height;return this.drawLine(D-q,this.drawRight,G,$)}drawTop(D){let $=[];if(this.cells)this.widths.forEach(function(J,Q){$.push(this._topLeftChar(Q)),$.push(OD.repeat(this.chars[this.y==0?"top":"mid"],J))},this);else $.push(this._topLeftChar(0)),$.push(OD.repeat(this.chars[this.y==0?"top":"mid"],this.width));if(D)$.push(this.chars[this.y==0?"topRight":"rightMid"]);return this.wrapWithStyleColors("border",$.join(""))}_topLeftChar(D){let $=this.x+D,J;if(this.y==0)J=$==0?"topLeft":D==0?"topMid":"top";else if($==0)J="leftMid";else if(J=D==0?"midMid":"bottomMid",this.cells){if(this.cells[this.y-1][$]instanceof j8.ColSpanCell)J=D==0?"topMid":"mid";if(D==0){let q=1;while(this.cells[this.y][$-q]instanceof j8.ColSpanCell)q++;if(this.cells[this.y][$-q]instanceof j8.RowSpanCell)J="leftMid"}}return this.chars[J]}wrapWithStyleColors(D,$){if(this[D]&&this[D].length)try{let J=q$();for(let Q=this[D].length-1;Q>=0;Q--)J=J[this[D][Q]];return J($)}catch(J){return $}else return $}drawLine(D,$,J,Q){let q=this.chars[this.x==0?"left":"middle"];if(this.x&&Q&&this.cells){let K=this.cells[this.y+Q][this.x-1];while(K instanceof p8)K=this.cells[K.y][K.x-1];if(!(K instanceof c8))q=this.chars.rightMid}let G=OD.repeat(" ",this.paddingLeft),X=$?this.chars.right:"",Y=OD.repeat(" ",this.paddingRight),Z=this.lines[D],U=this.width-(this.paddingLeft+this.paddingRight);if(J)Z+=this.truncate||"…";let j=OD.truncate(Z,U,this.truncate);return j=OD.pad(j,U," ",this.hAlign),j=G+j+Y,this.stylizeLine(q,j,X)}stylizeLine(D,$,J){if(D=this.wrapWithStyleColors("border",D),J=this.wrapWithStyleColors("border",J),this.y===0)$=this.wrapWithStyleColors("head",$);return D+$+J}drawBottom(D){let $=this.chars[this.x==0?"bottomLeft":"bottomMid"],J=OD.repeat(this.chars.bottom,this.width),Q=D?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",$+J+Q)}drawEmpty(D,$){let J=this.chars[this.x==0?"left":"middle"];if(this.x&&$&&this.cells){let G=this.cells[this.y+$][this.x-1];while(G instanceof p8)G=this.cells[G.y][G.x-1];if(!(G instanceof c8))J=this.chars.rightMid}let Q=D?this.chars.right:"",q=OD.repeat(" ",this.width);return this.stylizeLine(J,q,Q)}}class p8{constructor(){}draw(D){if(typeof D==="number")Y$(`${this.y}-${this.x}: 1x1 ColSpanCell`);return""}init(){}mergeTableOptions(){}}class c8{constructor(D){this.originalCell=D}init(D){let $=this.y,J=this.originalCell.y;this.cellOffset=$-J,this.offset=NG(D.rowHeights,J,this.cellOffset)}draw(D){if(D=="top")return this.originalCell.draw(this.offset,this.cellOffset);if(D=="bottom")return this.originalCell.draw("bottom");return Y$(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+D)}mergeTableOptions(){}}function G$(...D){return D.filter(($)=>$!==void 0&&$!==null).shift()}function a9(D,$,J,Q){let q=J.split("-");if(q.length>1)q[1]=q[1].charAt(0).toUpperCase()+q[1].substr(1),q=q.join(""),Q[q]=G$(D[q],D[J],$[q],$[J]);else Q[J]=G$(D[J],$[J])}function NG(D,$,J){let Q=D[$];for(let q=1;q<J;q++)Q+=1+D[$+q];return Q}function X$(D,$){return D+$+1}var FG=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];a8.exports=j8;a8.exports.ColSpanCell=p8;a8.exports.RowSpanCell=c8});var K$=a((ZK,j$)=>{var{warn:CG,debug:RG}=l8(),i9=Z$(),{ColSpanCell:LG,RowSpanCell:BG}=i9;(function(){function D(E,z){if(E[z]>0)return D(E,z+1);return z}function $(E){let z={};E.forEach(function(C,W){let V=0;C.forEach(function(N){N.y=W,N.x=W?D(z,V):V;let w=N.rowSpan||1,O=N.colSpan||1;if(w>1)for(let f=0;f<O;f++)z[N.x+f]=w;V=N.x+O}),Object.keys(z).forEach((N)=>{if(z[N]--,z[N]<1)delete z[N]})})}function J(E){let z=0;return E.forEach(function(C){C.forEach(function(W){z=Math.max(z,W.x+(W.colSpan||1))})}),z}function Q(E){return E.length}function q(E,z){let C=E.y,W=E.y-1+(E.rowSpan||1),V=z.y,N=z.y-1+(z.rowSpan||1),w=!(C>N||V>W),O=E.x,f=E.x-1+(E.colSpan||1),c=z.x,g=z.x-1+(z.colSpan||1),M=!(O>g||c>f);return w&&M}function G(E,z,C){let W=Math.min(E.length-1,C),V={x:z,y:C};for(let N=0;N<=W;N++){let w=E[N];for(let O=0;O<w.length;O++)if(q(V,w[O]))return!0}return!1}function X(E,z,C,W){for(let V=C;V<W;V++)if(G(E,V,z))return!1;return!0}function Y(E){E.forEach(function(z,C){z.forEach(function(W){for(let V=1;V<W.rowSpan;V++){let N=new BG(W);N.x=W.x,N.y=W.y+V,N.colSpan=W.colSpan,U(N,E[C+V])}})})}function Z(E){for(let z=E.length-1;z>=0;z--){let C=E[z];for(let W=0;W<C.length;W++){let V=C[W];for(let N=1;N<V.colSpan;N++){let w=new LG;w.x=V.x+N,w.y=V.y,C.splice(W+1,0,w)}}}}function U(E,z){let C=0;while(C<z.length&&z[C].x<E.x)C++;z.splice(C,0,E)}function j(E){let z=Q(E),C=J(E);RG(`Max rows: ${z}; Max cols: ${C}`);for(let W=0;W<z;W++)for(let V=0;V<C;V++)if(!G(E,V,W)){let N={x:V,y:W,colSpan:1,rowSpan:1};V++;while(V<C&&!G(E,V,W))N.colSpan++,V++;let w=W+1;while(w<z&&X(E,w,N.x,N.x+N.colSpan))N.rowSpan++,w++;let O=new i9(N);O.x=N.x,O.y=N.y,CG(`Missing cell at ${O.y}-${O.x}.`),U(O,E[W])}}function K(E){return E.map(function(z){if(!Array.isArray(z)){let C=Object.keys(z)[0];if(z=z[C],Array.isArray(z))z=z.slice(),z.unshift(C);else z=[C,z]}return z.map(function(C){return new i9(C)})})}function H(E){let z=K(E);return $(z),j(z),Y(z),Z(z),z}j$.exports={makeTableLayout:H,layoutTable:$,addRowSpanCells:Y,maxWidth:J,fillInTable:j,computeWidths:U$("colSpan","desiredWidth","x",1),computeHeights:U$("rowSpan","desiredHeight","y",1)}})();function U$(D,$,J,Q){return function(q,G){let X=[],Y=[],Z={};G.forEach(function(U){U.forEach(function(j){if((j[D]||1)>1)Y.push(j);else X[j[J]]=Math.max(X[j[J]]||0,j[$]||0,Q)})}),q.forEach(function(U,j){if(typeof U==="number")X[j]=U});for(let U=Y.length-1;U>=0;U--){let j=Y[U],K=j[D],H=j[J],E=X[H],z=typeof q[H]==="number"?0:1;if(typeof E==="number"){for(let C=1;C<K;C++)if(E+=1+X[H+C],typeof q[H+C]!=="number")z++}else if(E=$==="desiredWidth"?j.desiredWidth-1:1,!Z[H]||Z[H]<E)Z[H]=E;if(j[$]>E){let C=0;while(z>0&&j[$]>E){if(typeof q[H+C]!=="number"){let W=Math.round((j[$]-E)/z);E+=W,X[H+C]+=W,z--}C++}}}Object.assign(q,X,Z);for(let U=0;U<q.length;U++)q[U]=Math.max(Q,q[U]||0)}}});var z$=a((UK,W$)=>{var gD=l8(),IG=d9(),r9=K$();class n9 extends Array{constructor(D){super();let $=IG.mergeOptions(D);if(Object.defineProperty(this,"options",{value:$,enumerable:$.debug}),$.debug){switch(typeof $.debug){case"boolean":gD.setDebugLevel(gD.WARN);break;case"number":gD.setDebugLevel($.debug);break;case"string":gD.setDebugLevel(parseInt($.debug,10));break;default:gD.setDebugLevel(gD.WARN),gD.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof $.debug}`)}Object.defineProperty(this,"messages",{get(){return gD.debugMessages()}})}}toString(){let D=this,$=this.options.head&&this.options.head.length;if($){if(D=[this.options.head],this.length)D.push.apply(D,this)}else this.options.style.head=[];let J=r9.makeTableLayout(D);J.forEach(function(q){q.forEach(function(G){G.mergeTableOptions(this.options,J)},this)},this),r9.computeWidths(this.options.colWidths,J),r9.computeHeights(this.options.rowHeights,J),J.forEach(function(q){q.forEach(function(G){G.init(this.options)},this)},this);let Q=[];for(let q=0;q<J.length;q++){let G=J[q],X=this.options.rowHeights[q];if(q===0||!this.options.style.compact||q==1&&$)o9(G,"top",Q);for(let Y=0;Y<X;Y++)o9(G,Y,Q);if(q+1==J.length)o9(G,"bottom",Q)}return Q.join(`
32
32
  `)}get width(){return this.toString().split(`
33
- `)[0].length}}a9.reset=()=>fD.reset();function c9(D,$,J){let Q=[];D.forEach(function(q){Q.push(q.draw($))});let G=Q.join("");if(G.length)J.push(G)}Z$.exports=a9});var n6=b6(s6(),1),{program:Zj,createCommand:Kj,createArgument:jj,createOption:Uj,CommanderError:Wj,InvalidArgumentError:Ej,InvalidOptionArgumentError:zj,Command:t6,Argument:Cj,Option:Hj,Help:Nj}=n6.default;import{mkdirSync as e6,readFileSync as V4,writeFileSync as F4,existsSync as D1}from"node:fs";import{join as k9}from"node:path";import{homedir as L4}from"node:os";var h8={activeKey:"default",output:"table"};class d{static CONFIG_DIR=k9(L4(),".config","jup");static SETTINGS_FILE=k9(this.CONFIG_DIR,"settings.json");static KEYS_DIR=k9(this.CONFIG_DIR,"keys");static init(){if(e6(this.CONFIG_DIR,{recursive:!0}),e6(this.KEYS_DIR,{recursive:!0}),!D1(this.SETTINGS_FILE))this.save(h8)}static load(){if(!D1(this.SETTINGS_FILE))return{...h8};let D=JSON.parse(V4(this.SETTINGS_FILE,"utf-8"));return{activeKey:typeof D.activeKey==="string"?D.activeKey:h8.activeKey,output:D.output==="table"||D.output==="json"?D.output:h8.output}}static set(D){if(Object.keys(D).length===0)throw Error("No settings provided to update.");let $=this.load();this.save({...$,...D})}static save(D){F4(this.SETTINGS_FILE,JSON.stringify(D,null,2)+`
34
- `)}}var $1=(D=0)=>($)=>`\x1B[${$+D}m`,J1=(D=0)=>($)=>`\x1B[${38+D};5;${$}m`,Q1=(D=0)=>($,J,Q)=>`\x1B[${38+D};2;${$};${J};${Q}m`,i={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Ij=Object.keys(i.modifier),B4=Object.keys(i.color),R4=Object.keys(i.bgColor),wj=[...B4,...R4];function I4(){let D=new Map;for(let[$,J]of Object.entries(i)){for(let[Q,G]of Object.entries(J))i[Q]={open:`\x1B[${G[0]}m`,close:`\x1B[${G[1]}m`},J[Q]=i[Q],D.set(G[0],G[1]);Object.defineProperty(i,$,{value:J,enumerable:!1})}return Object.defineProperty(i,"codes",{value:D,enumerable:!1}),i.color.close="\x1B[39m",i.bgColor.close="\x1B[49m",i.color.ansi=$1(),i.color.ansi256=J1(),i.color.ansi16m=Q1(),i.bgColor.ansi=$1(10),i.bgColor.ansi256=J1(10),i.bgColor.ansi16m=Q1(10),Object.defineProperties(i,{rgbToAnsi256:{value($,J,Q){if($===J&&J===Q){if($<8)return 16;if($>248)return 231;return Math.round(($-8)/247*24)+232}return 16+36*Math.round($/255*5)+6*Math.round(J/255*5)+Math.round(Q/255*5)},enumerable:!1},hexToRgb:{value($){let J=/[a-f\d]{6}|[a-f\d]{3}/i.exec($.toString(16));if(!J)return[0,0,0];let[Q]=J;if(Q.length===3)Q=[...Q].map((q)=>q+q).join("");let G=Number.parseInt(Q,16);return[G>>16&255,G>>8&255,G&255]},enumerable:!1},hexToAnsi256:{value:($)=>i.rgbToAnsi256(...i.hexToRgb($)),enumerable:!1},ansi256ToAnsi:{value($){if($<8)return 30+$;if($<16)return 90+($-8);let J,Q,G;if($>=232)J=(($-232)*10+8)/255,Q=J,G=J;else{$-=16;let Y=$%36;J=Math.floor($/36)/5,Q=Math.floor(Y/6)/5,G=Y%6/5}let q=Math.max(J,Q,G)*2;if(q===0)return 30;let X=30+(Math.round(G)<<2|Math.round(Q)<<1|Math.round(J));if(q===2)X+=60;return X},enumerable:!1},rgbToAnsi:{value:($,J,Q)=>i.ansi256ToAnsi(i.rgbToAnsi256($,J,Q)),enumerable:!1},hexToAnsi:{value:($)=>i.ansi256ToAnsi(i.hexToAnsi256($)),enumerable:!1}}),i}var w4=I4(),PD=w4;import A9 from"node:process";import O4 from"node:os";import G1 from"node:tty";function TD(D,$=globalThis.Deno?globalThis.Deno.args:A9.argv){let J=D.startsWith("-")?"":D.length===1?"-":"--",Q=$.indexOf(J+D),G=$.indexOf("--");return Q!==-1&&(G===-1||Q<G)}var{env:r}=A9,v8;if(TD("no-color")||TD("no-colors")||TD("color=false")||TD("color=never"))v8=0;else if(TD("color")||TD("colors")||TD("color=true")||TD("color=always"))v8=1;function T4(){if("FORCE_COLOR"in r){if(r.FORCE_COLOR==="true")return 1;if(r.FORCE_COLOR==="false")return 0;return r.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(r.FORCE_COLOR,10),3)}}function M4(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function P4(D,{streamIsTTY:$,sniffFlags:J=!0}={}){let Q=T4();if(Q!==void 0)v8=Q;let G=J?v8:Q;if(G===0)return 0;if(J){if(TD("color=16m")||TD("color=full")||TD("color=truecolor"))return 3;if(TD("color=256"))return 2}if("TF_BUILD"in r&&"AGENT_NAME"in r)return 1;if(D&&!$&&G===void 0)return 0;let q=G||0;if(r.TERM==="dumb")return q;if(A9.platform==="win32"){let X=O4.release().split(".");if(Number(X[0])>=10&&Number(X[2])>=10586)return Number(X[2])>=14931?3:2;return 1}if("CI"in r){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((X)=>(X in r)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((X)=>(X in r))||r.CI_NAME==="codeship")return 1;return q}if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if(r.COLORTERM==="truecolor")return 3;if(r.TERM==="xterm-kitty")return 3;if(r.TERM==="xterm-ghostty")return 3;if(r.TERM==="wezterm")return 3;if("TERM_PROGRAM"in r){let X=Number.parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return X>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(r.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM))return 1;if("COLORTERM"in r)return 1;return q}function q1(D,$={}){let J=P4(D,{streamIsTTY:D&&D.isTTY,...$});return M4(J)}var S4={stdout:q1({isTTY:G1.isatty(1)}),stderr:q1({isTTY:G1.isatty(2)})},X1=S4;function Y1(D,$,J){let Q=D.indexOf($);if(Q===-1)return D;let G=$.length,q=0,X="";do X+=D.slice(q,Q)+$+J,q=Q+G,Q=D.indexOf($,q);while(Q!==-1);return X+=D.slice(q),X}function Z1(D,$,J,Q){let G=0,q="";do{let X=D[Q-1]==="\r";q+=D.slice(G,X?Q-1:Q)+$+(X?`\r
33
+ `)[0].length}}n9.reset=()=>gD.reset();function o9(D,$,J){let Q=[];D.forEach(function(G){Q.push(G.draw($))});let q=Q.join("");if(q.length)J.push(q)}W$.exports=n9});var $1=f7(D1(),1),{program:Ej,createCommand:Hj,createArgument:Vj,createOption:Nj,CommanderError:Fj,InvalidArgumentError:Cj,InvalidOptionArgumentError:Rj,Command:J1,Argument:Lj,Option:Bj,Help:Ij}=$1.default;import{existsSync as Q1,mkdirSync as q1,readFileSync as I4,writeFileSync as w4}from"node:fs";import{homedir as T4}from"node:os";import{join as h9}from"node:path";var m8={activeKey:"default",output:"table"};class u{static CONFIG_DIR=h9(T4(),".config","jup");static SETTINGS_FILE=h9(this.CONFIG_DIR,"settings.json");static KEYS_DIR=h9(this.CONFIG_DIR,"keys");static init(){if(q1(this.CONFIG_DIR,{recursive:!0}),q1(this.KEYS_DIR,{recursive:!0}),!Q1(this.SETTINGS_FILE))this.save(m8)}static load(){if(!Q1(this.SETTINGS_FILE))return{...m8};let D=JSON.parse(I4(this.SETTINGS_FILE,"utf-8"));return{activeKey:typeof D.activeKey==="string"?D.activeKey:m8.activeKey,output:D.output==="table"||D.output==="json"?D.output:m8.output,apiKey:typeof D.apiKey==="string"?D.apiKey:void 0}}static set(D){if(Object.keys(D).length===0)throw Error("No settings provided to update.");let $=this.load();this.save({...$,...D})}static save(D){let{apiKey:$,...J}=D,Q=$?{...J,apiKey:$}:J;w4(this.SETTINGS_FILE,JSON.stringify(Q,null,2)+`
34
+ `)}}var G1=(D=0)=>($)=>`\x1B[${$+D}m`,X1=(D=0)=>($)=>`\x1B[${38+D};5;${$}m`,Y1=(D=0)=>($,J,Q)=>`\x1B[${38+D};2;${$};${J};${Q}m`,r={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},_j=Object.keys(r.modifier),O4=Object.keys(r.color),M4=Object.keys(r.bgColor),Sj=[...O4,...M4];function P4(){let D=new Map;for(let[$,J]of Object.entries(r)){for(let[Q,q]of Object.entries(J))r[Q]={open:`\x1B[${q[0]}m`,close:`\x1B[${q[1]}m`},J[Q]=r[Q],D.set(q[0],q[1]);Object.defineProperty(r,$,{value:J,enumerable:!1})}return Object.defineProperty(r,"codes",{value:D,enumerable:!1}),r.color.close="\x1B[39m",r.bgColor.close="\x1B[49m",r.color.ansi=G1(),r.color.ansi256=X1(),r.color.ansi16m=Y1(),r.bgColor.ansi=G1(10),r.bgColor.ansi256=X1(10),r.bgColor.ansi16m=Y1(10),Object.defineProperties(r,{rgbToAnsi256:{value($,J,Q){if($===J&&J===Q){if($<8)return 16;if($>248)return 231;return Math.round(($-8)/247*24)+232}return 16+36*Math.round($/255*5)+6*Math.round(J/255*5)+Math.round(Q/255*5)},enumerable:!1},hexToRgb:{value($){let J=/[a-f\d]{6}|[a-f\d]{3}/i.exec($.toString(16));if(!J)return[0,0,0];let[Q]=J;if(Q.length===3)Q=[...Q].map((G)=>G+G).join("");let q=Number.parseInt(Q,16);return[q>>16&255,q>>8&255,q&255]},enumerable:!1},hexToAnsi256:{value:($)=>r.rgbToAnsi256(...r.hexToRgb($)),enumerable:!1},ansi256ToAnsi:{value($){if($<8)return 30+$;if($<16)return 90+($-8);let J,Q,q;if($>=232)J=(($-232)*10+8)/255,Q=J,q=J;else{$-=16;let Y=$%36;J=Math.floor($/36)/5,Q=Math.floor(Y/6)/5,q=Y%6/5}let G=Math.max(J,Q,q)*2;if(G===0)return 30;let X=30+(Math.round(q)<<2|Math.round(Q)<<1|Math.round(J));if(G===2)X+=60;return X},enumerable:!1},rgbToAnsi:{value:($,J,Q)=>r.ansi256ToAnsi(r.rgbToAnsi256($,J,Q)),enumerable:!1},hexToAnsi:{value:($)=>r.ansi256ToAnsi(r.hexToAnsi256($)),enumerable:!1}}),r}var _4=P4(),kD=_4;import v9 from"node:process";import S4 from"node:os";import Z1 from"node:tty";function _D(D,$=globalThis.Deno?globalThis.Deno.args:v9.argv){let J=D.startsWith("-")?"":D.length===1?"-":"--",Q=$.indexOf(J+D),q=$.indexOf("--");return Q!==-1&&(q===-1||Q<q)}var{env:o}=v9,u8;if(_D("no-color")||_D("no-colors")||_D("color=false")||_D("color=never"))u8=0;else if(_D("color")||_D("colors")||_D("color=true")||_D("color=always"))u8=1;function k4(){if("FORCE_COLOR"in o){if(o.FORCE_COLOR==="true")return 1;if(o.FORCE_COLOR==="false")return 0;return o.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(o.FORCE_COLOR,10),3)}}function A4(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function x4(D,{streamIsTTY:$,sniffFlags:J=!0}={}){let Q=k4();if(Q!==void 0)u8=Q;let q=J?u8:Q;if(q===0)return 0;if(J){if(_D("color=16m")||_D("color=full")||_D("color=truecolor"))return 3;if(_D("color=256"))return 2}if("TF_BUILD"in o&&"AGENT_NAME"in o)return 1;if(D&&!$&&q===void 0)return 0;let G=q||0;if(o.TERM==="dumb")return G;if(v9.platform==="win32"){let X=S4.release().split(".");if(Number(X[0])>=10&&Number(X[2])>=10586)return Number(X[2])>=14931?3:2;return 1}if("CI"in o){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((X)=>(X in o)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((X)=>(X in o))||o.CI_NAME==="codeship")return 1;return G}if("TEAMCITY_VERSION"in o)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION)?1:0;if(o.COLORTERM==="truecolor")return 3;if(o.TERM==="xterm-kitty")return 3;if(o.TERM==="xterm-ghostty")return 3;if(o.TERM==="wezterm")return 3;if("TERM_PROGRAM"in o){let X=Number.parseInt((o.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(o.TERM_PROGRAM){case"iTerm.app":return X>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(o.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM))return 1;if("COLORTERM"in o)return 1;return G}function U1(D,$={}){let J=x4(D,{streamIsTTY:D&&D.isTTY,...$});return A4(J)}var b4={stdout:U1({isTTY:Z1.isatty(1)}),stderr:U1({isTTY:Z1.isatty(2)})},j1=b4;function K1(D,$,J){let Q=D.indexOf($);if(Q===-1)return D;let q=$.length,G=0,X="";do X+=D.slice(G,Q)+$+J,G=Q+q,Q=D.indexOf($,G);while(Q!==-1);return X+=D.slice(G),X}function W1(D,$,J,Q){let q=0,G="";do{let X=D[Q-1]==="\r";G+=D.slice(q,X?Q-1:Q)+$+(X?`\r
35
35
  `:`
36
- `)+J,G=Q+1,Q=D.indexOf(`
37
- `,G)}while(Q!==-1);return q+=D.slice(G),q}var{stdout:K1,stderr:j1}=X1,x9=Symbol("GENERATOR"),S0=Symbol("STYLER"),J8=Symbol("IS_EMPTY"),U1=["ansi","ansi","ansi256","ansi16m"],_0=Object.create(null),_4=(D,$={})=>{if($.level&&!(Number.isInteger($.level)&&$.level>=0&&$.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let J=K1?K1.level:0;D.level=$.level===void 0?J:$.level};var k4=(D)=>{let $=(...J)=>J.join(" ");return _4($,D),Object.setPrototypeOf($,Q8.prototype),$};function Q8(D){return k4(D)}Object.setPrototypeOf(Q8.prototype,Function.prototype);for(let[D,$]of Object.entries(PD))_0[D]={get(){let J=y8(this,h9($.open,$.close,this[S0]),this[J8]);return Object.defineProperty(this,D,{value:J}),J}};_0.visible={get(){let D=y8(this,this[S0],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var b9=(D,$,J,...Q)=>{if(D==="rgb"){if($==="ansi16m")return PD[J].ansi16m(...Q);if($==="ansi256")return PD[J].ansi256(PD.rgbToAnsi256(...Q));return PD[J].ansi(PD.rgbToAnsi(...Q))}if(D==="hex")return b9("rgb",$,J,...PD.hexToRgb(...Q));return PD[J][D](...Q)},A4=["rgb","hex","ansi256"];for(let D of A4){_0[D]={get(){let{level:J}=this;return function(...Q){let G=h9(b9(D,U1[J],"color",...Q),PD.color.close,this[S0]);return y8(this,G,this[J8])}}};let $="bg"+D[0].toUpperCase()+D.slice(1);_0[$]={get(){let{level:J}=this;return function(...Q){let G=h9(b9(D,U1[J],"bgColor",...Q),PD.bgColor.close,this[S0]);return y8(this,G,this[J8])}}}}var x4=Object.defineProperties(()=>{},{..._0,level:{enumerable:!0,get(){return this[x9].level},set(D){this[x9].level=D}}}),h9=(D,$,J)=>{let Q,G;if(J===void 0)Q=D,G=$;else Q=J.openAll+D,G=$+J.closeAll;return{open:D,close:$,openAll:Q,closeAll:G,parent:J}},y8=(D,$,J)=>{let Q=(...G)=>b4(Q,G.length===1?""+G[0]:G.join(" "));return Object.setPrototypeOf(Q,x4),Q[x9]=D,Q[S0]=$,Q[J8]=J,Q},b4=(D,$)=>{if(D.level<=0||!$)return D[J8]?"":$;let J=D[S0];if(J===void 0)return $;let{openAll:Q,closeAll:G}=J;if($.includes("\x1B"))while(J!==void 0)$=Y1($,J.close,J.open),J=J.parent;let q=$.indexOf(`
38
- `);if(q!==-1)$=Z1($,G,Q,q);return Q+$+G};Object.defineProperties(Q8.prototype,_0);var h4=Q8(),bj=Q8({level:j1?j1.level:0});var sD=h4;var i9=b6(K$(),1);class v{static outputOverride;static isJson(){return(this.outputOverride??d.load().output)==="json"}static json(D){console.log(JSON.stringify(D,null,2))}static error(D){let $=D instanceof Error?D.message:String(D);if(this.isJson())this.json({error:$});else console.log(`${sD.red.bold("Error:")} ${$}`)}static table(D){if(D.type==="horizontal"){if(D.rows.length===0){console.log("No results.");return}let $=Object.keys(D.headers),J=$.map((G)=>sD.bold(D.headers[G])),Q=new i9.default({head:J,style:{head:[]}});for(let G of D.rows)Q.push($.map((q)=>String(G[q]??"")));console.log(Q.toString())}else{let $=new i9.default;for(let{label:J,value:Q}of D.rows)$.push({[sD.bold(J)]:Q});console.log($.toString())}}static formatBoolean(D){return D?"✅":"❌"}static formatPercentageChange(D){if(D===void 0||D===null)return"—";let $=`${D>=0?"+":""}${D.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}%`;if(D>0.5)return sD.green($);if(D<-0.5)return sD.red($);return sD.gray($)}static formatDollar(D){if(!D)return sD.gray("—");if(D<1000)return D.toLocaleString("en-US",{currency:"USD",style:"currency",minimumSignificantDigits:5,maximumSignificantDigits:5});return D.toLocaleString("en-US",{currency:"USD",style:"currency"})}}class r9{static register(D){let $=D.command("config").description("CLI settings and configurations");$.command("list").description("List all settings").action(()=>this.list()),$.command("set").description("Update settings").option("--active-key <name>","Set the active key").option("--output <type>","Set the output format ('table' or 'json')").action((J)=>this.set(J))}static list(){let D=d.load();if(v.isJson()){v.json(D);return}let $=Object.entries(D).map(([J,Q])=>({setting:J,value:String(Q)}));v.table({type:"horizontal",headers:{setting:"Setting",value:"Value"},rows:$})}static set(D){if(D.output&&D.output!=="table"&&D.output!=="json")throw Error("Invalid --output format. Must be 'table' or 'json'.");d.set(D),this.list()}}import{copyFileSync as VK,existsSync as U0,readdirSync as FK,renameSync as LK,rmSync as BK}from"node:fs";import{homedir as RK}from"node:os";import{join as P0}from"node:path";var Fq=1,Lq=2,Bq=3,Rq=4,Iq=5,wq=6,Oq=7,Tq=8,Mq=9,Pq=10,Sq=11,_q=12,kq=-32700,Aq=-32603,xq=-32602,bq=-32601,hq=-32600,vq=-32019,yq=-32018,fq=-32017,mq=-32016,uq=-32015,gq=-32014,lq=-32013,pq=-32012,dq=-32011,cq=-32010,aq=-32009,iq=-32008,rq=-32007,oq=-32006,sq=-32005,nq=-32004,tq=-32003,eq=-32002,DX=-32001,s9=2800000,n9=2800001,$X=2800002,t9=2800003,j$=2800004,U$=2800005,e9=2800006,D7=2800007,p8=2800008,$7=2800009,W$=2800010,E$=2800011,JX=3230000,QX=32300001,GX=3230002,qX=3230003,XX=3230004,YX=3610000,J7=3610001,z$=3610002,Q7=3610003,C$=3610004,G7=3610005,H$=3610006,q7=3610007,N$=3611000,V$=3704000,X7=3704001,F$=3704002,L$=3704003,B$=3704004,ZX=4128000,KX=4128001,jX=4128002,o9=4615000,UX=4615001,WX=4615002,EX=4615003,zX=4615004,CX=4615005,HX=4615006,NX=4615007,VX=4615008,FX=4615009,LX=4615010,BX=4615011,RX=4615012,IX=4615013,wX=4615014,OX=4615015,TX=4615016,MX=4615017,PX=4615018,SX=4615019,_X=4615020,kX=4615021,AX=4615022,xX=4615023,bX=4615024,hX=4615025,vX=4615026,yX=4615027,fX=4615028,mX=4615029,uX=4615030,gX=4615031,lX=4615032,pX=4615033,dX=4615034,cX=4615035,aX=4615036,iX=4615037,rX=4615038,oX=4615039,sX=4615040,nX=4615041,tX=4615042,eX=4615043,DY=4615044,$Y=4615045,JY=4615046,QY=4615047,GY=4615048,qY=4615049,XY=4615050,YY=4615051,ZY=4615052,KY=4615053,jY=4615054,UY=5508000,WY=5508001,EY=5508002,zY=5508003,CY=5508004,HY=5508005,NY=5508006,VY=5508007,FY=5508008,LY=5508009,BY=5508010,RY=5508011,IY=5607000,wY=5607001,OY=5607002,TY=5607003,MY=5607004,PY=5607005,SY=5607006,_Y=5607007,kY=5607008,AY=5607009,xY=5607010,bY=5607011,hY=5607012,vY=5607013,yY=5607014,fY=5607015,mY=5607016,uY=5607017,R$=5663000,I$=5663001,Y7=5663002,Z7=5663003,w$=5663004,O$=5663005,T$=5663006,M$=5663007,P$=5663008,S$=5663009,gY=5663010,lY=5663011,_$=5663012,pY=5663013,dY=5663014,K7=5663015,j7=5663016,d8=5663017,cY=5663018,aY=5663019,k$=5663020,Y8=5663021,A$=5663022,U7=5663023,W7=5663024,E7=5663025,z7=5663026,C7=5663027,iY=5663028,rY=7050000,oY=7050001,sY=7050002,nY=7050003,tY=7050004,eY=7050005,D2=7050006,$2=7050007,J2=7050008,Q2=7050009,G2=7050010,q2=7050011,X2=7050012,Y2=7050013,Z2=7050014,K2=7050015,j2=7050016,U2=7050017,W2=7050018,E2=7050019,z2=7050020,C2=7050021,H2=7050022,N2=7050023,V2=7050024,F2=7050025,L2=7050026,B2=7050027,R2=7050028,I2=7050029,w2=7050030,O2=7050031,T2=7050032,M2=7050033,P2=7050034,S2=7050035,_2=7050036,k2=7618000,A2=7618001,x2=7618002,b2=7618003,h2=7618004,v2=7618005,y2=7618006,f2=7618007,m2=7618008,u2=7618009,H7=8078000,N7=8078001,x$=8078002,b$=8078003,V7=8078004,F7=8078005,L7=8078006,B7=8078007,h$=8078008,v$=8078009,y$=8078010,R7=8078011,x0=8078012,I7=8078013,w7=8078014,f$=8078015,m$=8078016,O7=8078017,u$=8078018,g2=8078019,g$=8078020,l$=8078021,p$=8078022,d$=8078023,c$=8078024,a$=8078025,l2=8100000,p2=8100001,d2=8100002,c2=8100003,a2=8190000,i2=8190001,r2=8190002,o2=8190003,s2=8190004,i$=8500000,r$=8500001,o$=8500002,n2=8500003,t2=8500004,e2=8500005,s$=8500006,D5=9900000,$5=9900001,J5=9900002,Q5=9900003,G5=9900004,q5=9900005,X5=9900006;var Y5={[JX]:"Account not found at address: $address",[XX]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[qX]:"Expected decoded account at address: $address",[GX]:"Failed to decode account data at address: $address",[QX]:"Accounts not found at addresses: $addresses",[$7]:"Unable to find a viable program address bump seed.",[$X]:"$putativeAddress is not a base58-encoded address.",[s9]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[t9]:"The `CryptoKey` must be an `Ed25519` public key.",[E$]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[p8]:"Invalid seeds; point must fall off the Ed25519 curve.",[j$]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[e9]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[D7]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[U$]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[W$]:"Program address cannot end with PDA marker.",[n9]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[Rq]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[Fq]:"The network has progressed past the last block for which this transaction could have been committed.",[H7]:"Codec [$codecDescription] cannot decode empty byte arrays.",[p$]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[g$]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[F7]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[L7]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[V7]:"Encoder and decoder must either both be fixed-size or variable-size.",[h$]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[x$]:"Expected a fixed-size codec, got a variable-size one.",[I7]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[b$]:"Expected a variable-size codec, got a fixed-size one.",[g2]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[N7]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[u$]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[v$]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[y$]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[f$]:"Invalid literal union variant. Expected one of [$variants], got $value.",[B7]:"Expected [$codecDescription] to have $expected items, got $actual.",[x0]:"Invalid value $value for base $base with alphabet $alphabet.",[m$]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[R7]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[w7]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[l$]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[O7]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[d$]:"This decoder expected a byte array of exactly $expectedLength bytes, but $numExcessBytes unexpected excess bytes remained after decoding. Are you sure that you have chosen the correct decoder for this data?",[c$]:"Invalid pattern match value. The provided value does not match any of the specified patterns.",[a$]:"Invalid pattern match bytes. The provided byte array does not match any of the specified patterns.",[N$]:"No random values implementation could be found.",[Sq]:"Failed to send transaction$causeMessage",[_q]:"Failed to send transactions$causeMessages",[FX]:"Instruction requires an uninitialized account",[xX]:"Instruction tries to borrow reference for an account which is already borrowed",[bX]:"Instruction left account with an outstanding borrowed reference",[kX]:"Program other than the account's owner changed the size of the account data",[CX]:"Account data too small for instruction",[AX]:"Instruction expected an executable account",[JY]:"An account does not have enough lamports to be rent-exempt",[GY]:"Program arithmetic overflowed",[$Y]:"Failed to serialize or deserialize account data",[jY]:"Builtin programs must consume compute units",[lX]:"Cross-program invocation call depth too deep",[rX]:"Computational budget exceeded",[vX]:"Custom program error: #$code",[MX]:"Instruction contains duplicate accounts",[hX]:"Instruction modifications of multiply-passed account differ",[uX]:"Executable accounts must be rent exempt",[fX]:"Instruction changed executable accounts data",[mX]:"Instruction changed the balance of an executable account",[PX]:"Instruction changed executable bit of an account",[wX]:"Instruction modified data of an account it does not own",[IX]:"Instruction spent from the balance of an account it does not own",[UX]:"Generic instruction error",[XY]:"Provided owner is not allowed",[eX]:"Account is immutable",[DY]:"Incorrect authority provided",[NX]:"Incorrect program id for instruction",[HX]:"Insufficient funds for instruction",[zX]:"Invalid account data for instruction",[QY]:"Invalid account owner",[WX]:"Invalid program argument",[yX]:"Program returned invalid error code",[EX]:"Invalid instruction data",[iX]:"Failed to reallocate account data",[aX]:"Provided seeds do not result in a valid address",[YY]:"Accounts data allocations exceeded the maximum allowed per transaction",[ZY]:"Max accounts exceeded",[KY]:"Max instruction trace length exceeded",[cX]:"Length of the seed is too long for address generation",[pX]:"An account required by the instruction is missing",[VX]:"Missing required signature for instruction",[RX]:"Instruction illegally modified the program id of an account",[_X]:"Insufficient account keys for instruction",[oX]:"Cross-program invocation with unauthorized signer or writable account",[sX]:"Failed to create program execution environment",[tX]:"Program failed to compile",[nX]:"Program failed to complete",[TX]:"Instruction modified data of a read-only account",[OX]:"Instruction changed the balance of a read-only account",[dX]:"Cross-program invocation reentrancy not allowed for this instruction",[SX]:"Instruction modified rent epoch of an account",[BX]:"Sum of account balances before and after instruction do not match",[LX]:"Instruction requires an initialized account",[o9]:"The instruction failed with the error: $errorName",[gX]:"Unsupported program id",[qY]:"Unsupported sysvar",[q5]:"Invalid instruction plan kind: $kind.",[x2]:"The provided instruction plan is empty.",[v2]:"No failed transaction plan result was found in the provided transaction plan result.",[h2]:"This transaction plan executor does not support non-divisible sequential plans. To support them, you may create your own executor such that multi-transaction atomicity is preserved — e.g. by targetting RPCs that support transaction bundles.",[b2]:"The provided transaction plan failed to execute. See the `transactionPlanResult` attribute for more details. Note that the `cause` property is deprecated, and a future version will not set it.",[k2]:"The provided message has insufficient capacity to accommodate the next instruction(s) in this plan. Expected at least $numBytesRequired free byte(s), got $numFreeBytes byte(s).",[X5]:"Invalid transaction plan kind: $kind.",[A2]:"No more instructions to pack; the message packer has completed the instruction plan.",[y2]:"Unexpected instruction plan. Expected $expectedKind plan, got $actualKind plan.",[f2]:"Unexpected transaction plan. Expected $expectedKind plan, got $actualKind plan.",[m2]:"Unexpected transaction plan result. Expected $expectedKind plan, got $actualKind plan.",[u2]:"Expected a successful transaction plan result. I.e. there is at least one failed or cancelled transaction in the plan.",[ZX]:"The instruction does not have any accounts.",[KX]:"The instruction does not have any data.",[jX]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[Iq]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[Lq]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[J5]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[G5]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[$5]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[D5]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[Q5]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[Aq]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[xq]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[hq]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[bq]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[kq]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[pq]:"$__serverMessage",[DX]:"$__serverMessage",[nq]:"$__serverMessage",[gq]:"$__serverMessage",[fq]:"Epoch rewards period still active at slot $slot",[cq]:"$__serverMessage",[aq]:"$__serverMessage",[vq]:"Failed to query long-term storage; please try again",[mq]:"Minimum context slot has not been reached",[sq]:"Node is unhealthy; behind by $numSlotsBehind slots",[iq]:"No snapshot",[eq]:"Transaction simulation failed",[yq]:"Rewards cannot be found because slot $slot is not the epoch boundary. This may be due to gap in the queried node's local ledger or long-term storage",[rq]:"$__serverMessage",[dq]:"Transaction history is not available from this node",[oq]:"$__serverMessage",[lq]:"Transaction signature length mismatch",[tq]:"Transaction signature verification failure",[uq]:"$__serverMessage",[V$]:"Key pair bytes must be of length 64, got $byteLength.",[X7]:"Expected private key bytes with length 32. Actual length: $actualLength.",[F$]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[B$]:"The provided private key does not match the provided public key.",[L$]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[wq]:"Lamports value must be in the range [0, 2e64-1]",[Oq]:"`$value` cannot be parsed as a `BigInt`",[Pq]:"$message",[Tq]:"`$value` cannot be parsed as a `Number`",[Bq]:"No nonce account could be found at address `$nonceAccountAddress`",[TY]:"Expected base58 encoded application domain to decode to a byte array of length 32. Actual length: $actualLength.",[vY]:"Attempted to sign an offchain message with an address that is not a signer for it",[OY]:"Expected base58-encoded application domain string of length in the range [32, 44]. Actual length: $actualLength.",[hY]:"The signer addresses in this offchain message envelope do not match the list of required signers in the message preamble. These unexpected signers were present in the envelope: `[$unexpectedSigners]`. These required signers were missing from the envelope `[$missingSigners]`.",[IY]:"The message body provided has a byte-length of $actualBytes. The maximum allowable byte-length is $maxBytes",[_Y]:"Expected message format $expectedMessageFormat, got $actualMessageFormat",[kY]:"The message length specified in the message preamble is $specifiedLength bytes. The actual length of the message is $actualLength bytes.",[AY]:"Offchain message content must be non-empty",[PY]:"Offchain message must specify the address of at least one required signer",[xY]:"Offchain message envelope must reserve space for at least one signature",[MY]:"The offchain message preamble specifies $numRequiredSignatures required signature(s), got $signaturesLength.",[fY]:"The signatories of this offchain message must be listed in lexicographical order",[mY]:"An address must be listed no more than once among the signatories of an offchain message",[bY]:"Offchain message is missing signatures for addresses: $addresses.",[uY]:"Offchain message signature verification failed. Signature mismatch for required signatories [$signatoriesWithInvalidSignatures]. Missing signatures for signatories [$signatoriesWithMissingSignatures]",[wY]:"The message body provided contains characters whose codes fall outside the allowed range. In order to ensure clear-signing compatiblity with hardware wallets, the message may only contain line feeds and characters in the range [\\x20-\\x7e].",[yY]:"Expected offchain message version $expectedVersion. Got $actualVersion.",[SY]:"This version of Kit does not support decoding offchain messages with version $unsupportedVersion. The current max supported version is 0.",[s$]:"The provided account could not be identified as an account from the $programName program.",[o$]:"The provided instruction could not be identified as an instruction from the $programName program.",[i$]:"The provided instruction is missing some accounts. Expected at least $expectedAccountMetas account(s), got $actualAccountMetas.",[t2]:"Expected resolved instruction input '$inputName' to be non-null.",[n2]:"Expected resolved instruction input '$inputName' to be of type `$expectedType`.",[e2]:"Unrecognized account type '$accountType' for the $programName program.",[r$]:"Unrecognized instruction type '$instructionType' for the $programName program.",[a2]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[r2]:"WebSocket was closed before payload could be added to the send buffer",[o2]:"WebSocket connection closed",[s2]:"WebSocket failed to connect",[i2]:"Failed to obtain a subscription id from the server",[c2]:"Could not find an API plan for RPC method: `$method`",[l2]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[d2]:"HTTP error ($statusCode): $message",[p2]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[UY]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[WY]:"The provided value does not implement the `KeyPairSigner` interface",[zY]:"The provided value does not implement the `MessageModifyingSigner` interface",[CY]:"The provided value does not implement the `MessagePartialSigner` interface",[EY]:"The provided value does not implement any of the `MessageSigner` interfaces",[NY]:"The provided value does not implement the `TransactionModifyingSigner` interface",[VY]:"The provided value does not implement the `TransactionPartialSigner` interface",[FY]:"The provided value does not implement the `TransactionSendingSigner` interface",[HY]:"The provided value does not implement any of the `TransactionSigner` interfaces",[LY]:"More than one `TransactionSendingSigner` was identified.",[BY]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[RY]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[q7]:"Cannot export a non-extractable key.",[J7]:"No digest implementation could be found.",[YX]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[z$]:`This runtime does not support the generation of Ed25519 key pairs.
36
+ `)+J,q=Q+1,Q=D.indexOf(`
37
+ `,q)}while(Q!==-1);return G+=D.slice(q),G}var{stdout:z1,stderr:E1}=j1,y9=Symbol("GENERATOR"),k0=Symbol("STYLER"),X8=Symbol("IS_EMPTY"),H1=["ansi","ansi","ansi256","ansi16m"],A0=Object.create(null),h4=(D,$={})=>{if($.level&&!(Number.isInteger($.level)&&$.level>=0&&$.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let J=z1?z1.level:0;D.level=$.level===void 0?J:$.level};var v4=(D)=>{let $=(...J)=>J.join(" ");return h4($,D),Object.setPrototypeOf($,Y8.prototype),$};function Y8(D){return v4(D)}Object.setPrototypeOf(Y8.prototype,Function.prototype);for(let[D,$]of Object.entries(kD))A0[D]={get(){let J=g8(this,m9($.open,$.close,this[k0]),this[X8]);return Object.defineProperty(this,D,{value:J}),J}};A0.visible={get(){let D=g8(this,this[k0],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var f9=(D,$,J,...Q)=>{if(D==="rgb"){if($==="ansi16m")return kD[J].ansi16m(...Q);if($==="ansi256")return kD[J].ansi256(kD.rgbToAnsi256(...Q));return kD[J].ansi(kD.rgbToAnsi(...Q))}if(D==="hex")return f9("rgb",$,J,...kD.hexToRgb(...Q));return kD[J][D](...Q)},y4=["rgb","hex","ansi256"];for(let D of y4){A0[D]={get(){let{level:J}=this;return function(...Q){let q=m9(f9(D,H1[J],"color",...Q),kD.color.close,this[k0]);return g8(this,q,this[X8])}}};let $="bg"+D[0].toUpperCase()+D.slice(1);A0[$]={get(){let{level:J}=this;return function(...Q){let q=m9(f9(D,H1[J],"bgColor",...Q),kD.bgColor.close,this[k0]);return g8(this,q,this[X8])}}}}var f4=Object.defineProperties(()=>{},{...A0,level:{enumerable:!0,get(){return this[y9].level},set(D){this[y9].level=D}}}),m9=(D,$,J)=>{let Q,q;if(J===void 0)Q=D,q=$;else Q=J.openAll+D,q=$+J.closeAll;return{open:D,close:$,openAll:Q,closeAll:q,parent:J}},g8=(D,$,J)=>{let Q=(...q)=>m4(Q,q.length===1?""+q[0]:q.join(" "));return Object.setPrototypeOf(Q,f4),Q[y9]=D,Q[k0]=$,Q[X8]=J,Q},m4=(D,$)=>{if(D.level<=0||!$)return D[X8]?"":$;let J=D[k0];if(J===void 0)return $;let{openAll:Q,closeAll:q}=J;if($.includes("\x1B"))while(J!==void 0)$=K1($,J.close,J.open),J=J.parent;let G=$.indexOf(`
38
+ `);if(G!==-1)$=W1($,q,Q,G);return Q+$+q};Object.defineProperties(Y8.prototype,A0);var u4=Y8(),uj=Y8({level:E1?E1.level:0});var BD=u4;var q6=f7(z$(),1);class lD extends Error{response;request;options;constructor(D,$,J){let Q=D.status||D.status===0?D.status:"",q=D.statusText??"",G=`${Q} ${q}`.trim(),X=G?`status code ${G}`:"an unknown error";super(`Request failed with ${X}: ${$.method} ${$.url}`);this.name="HTTPError",this.response=D,this.request=$,this.options=J}}class K8 extends Error{name="NonError";value;constructor(D){let $="Non-error value was thrown";try{if(typeof D==="string")$=D;else if(D&&typeof D==="object"&&"message"in D&&typeof D.message==="string")$=D.message}catch{}super($);this.value=D}}class W8 extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(D){let $=D?.cause?D.cause instanceof Error?D.cause:new K8(D.cause):void 0;super(D?.code?`Forced retry: ${D.code}`:"Forced retry",$?{cause:$}:void 0);this.customDelay=D?.delay,this.code=D?.code,this.customRequest=D?.request}}var s9=(()=>{let D=!1,$=!1,J=typeof globalThis.ReadableStream==="function",Q=typeof globalThis.Request==="function";if(J&&Q)try{$=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return D=!0,"half"}}).headers.has("Content-Type")}catch(q){if(q instanceof Error&&q.message==="unsupported BodyInit type")return!1;throw q}return D&&!$})(),E$=typeof globalThis.AbortController==="function",i8=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",H$=typeof globalThis.ReadableStream==="function",V$=typeof globalThis.FormData==="function",r8=["get","post","put","patch","head","delete"],wG=()=>{return};wG();var N$={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},o8=2147483647,F$=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,n8=Symbol("stop");class s8{options;constructor(D){this.options=D}}var C$=(D)=>new s8(D),R$={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},L$={next:!0},B$={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var TG=(D)=>{if(!D)return 0;if(D instanceof FormData){let $=0;for(let[J,Q]of D)$+=F$,$+=new TextEncoder().encode(`Content-Disposition: form-data; name="${J}"`).length,$+=typeof Q==="string"?new TextEncoder().encode(Q).length:Q.size;return $}if(D instanceof Blob)return D.size;if(D instanceof ArrayBuffer)return D.byteLength;if(typeof D==="string")return new TextEncoder().encode(D).length;if(D instanceof URLSearchParams)return new TextEncoder().encode(D.toString()).length;if("byteLength"in D)return D.byteLength;if(typeof D==="object"&&D!==null)try{let $=JSON.stringify(D);return new TextEncoder().encode($).length}catch{return 0}return 0},I$=(D,$,J)=>{let Q,q=0;return D.pipeThrough(new TransformStream({transform(G,X){if(X.enqueue(G),Q){q+=Q.byteLength;let Y=$===0?0:q/$;if(Y>=1)Y=1-Number.EPSILON;J?.({percent:Y,totalBytes:Math.max($,q),transferredBytes:q},Q)}Q=G},flush(){if(Q)q+=Q.byteLength,J?.({percent:1,totalBytes:Math.max($,q),transferredBytes:q},Q)}}))},w$=(D,$)=>{if(!D.body)return D;if(D.status===204)return new Response(null,{status:D.status,statusText:D.statusText,headers:D.headers});let J=Math.max(0,Number(D.headers.get("content-length"))||0);return new Response(I$(D.body,J,$),{status:D.status,statusText:D.statusText,headers:D.headers})},T$=(D,$,J)=>{if(!D.body)return D;let Q=TG(J??D.body);return new Request(D,{duplex:"half",body:I$(D.body,Q,$)})};var D0=(D)=>D!==null&&typeof D==="object";var z8=(...D)=>{for(let $ of D)if((!D0($)||Array.isArray($))&&$!==void 0)throw TypeError("The `options` argument must be an object");return D6({},...D)},t9=(D={},$={})=>{let J=new globalThis.Headers(D),Q=$ instanceof globalThis.Headers,q=new globalThis.Headers($);for(let[G,X]of q.entries())if(Q&&X==="undefined"||X===void 0)J.delete(G);else J.set(G,X);return J};function t8(D,$,J){return Object.hasOwn($,J)&&$[J]===void 0?[]:D6(D[J]??[],$[J]??[])}var e9=(D={},$={})=>({beforeRequest:t8(D,$,"beforeRequest"),beforeRetry:t8(D,$,"beforeRetry"),afterResponse:t8(D,$,"afterResponse"),beforeError:t8(D,$,"beforeError")}),OG=(D,$)=>{let J=new URLSearchParams;for(let Q of[D,$]){if(Q===void 0)continue;if(Q instanceof URLSearchParams)for(let[q,G]of Q.entries())J.append(q,G);else if(Array.isArray(Q))for(let q of Q){if(!Array.isArray(q)||q.length!==2)throw TypeError("Array search parameters must be provided in [[key, value], ...] format");J.append(String(q[0]),String(q[1]))}else if(D0(Q)){for(let[q,G]of Object.entries(Q))if(G!==void 0)J.append(q,String(G))}else{let q=new URLSearchParams(Q);for(let[G,X]of q.entries())J.append(G,X)}}return J},D6=(...D)=>{let $={},J={},Q={},q,G=[];for(let X of D)if(Array.isArray(X)){if(!Array.isArray($))$=[];$=[...$,...X]}else if(D0(X)){for(let[Y,Z]of Object.entries(X)){if(Y==="signal"&&Z instanceof globalThis.AbortSignal){G.push(Z);continue}if(Y==="context"){if(Z!==void 0&&Z!==null&&(!D0(Z)||Array.isArray(Z)))throw TypeError("The `context` option must be an object");$={...$,context:Z===void 0||Z===null?{}:{...$.context,...Z}};continue}if(Y==="searchParams"){if(Z===void 0||Z===null)q=void 0;else q=q===void 0?Z:OG(q,Z);continue}if(D0(Z)&&Y in $)Z=D6($[Y],Z);$={...$,[Y]:Z}}if(D0(X.hooks))Q=e9(Q,X.hooks),$.hooks=Q;if(D0(X.headers))J=t9(J,X.headers),$.headers=J}if(q!==void 0)$.searchParams=q;if(G.length>0)if(G.length===1)$.signal=G[0];else if(i8)$.signal=AbortSignal.any(G);else $.signal=G.at(-1);return $};var M$=(D)=>r8.includes(D)?D.toUpperCase():D,MG=["get","put","head","delete","options","trace"],PG=[408,413,429,500,502,503,504],_G=[413,429,503],O$={limit:2,methods:MG,statusCodes:PG,afterStatusCodes:_G,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:(D)=>0.3*2**(D-1)*1000,jitter:void 0,retryOnTimeout:!1},P$=(D={})=>{if(typeof D==="number")return{...O$,limit:D};if(D.methods&&!Array.isArray(D.methods))throw Error("retry.methods must be an array");if(D.methods&&=D.methods.map((J)=>J.toLowerCase()),D.statusCodes&&!Array.isArray(D.statusCodes))throw Error("retry.statusCodes must be an array");let $=Object.fromEntries(Object.entries(D).filter(([,J])=>J!==void 0));return{...O$,...$}};class h0 extends Error{request;constructor(D){super(`Request timed out: ${D.method} ${D.url}`);this.name="TimeoutError",this.request=D}}async function $6(D,$,J,Q){return new Promise((q,G)=>{let X=setTimeout(()=>{if(J)J.abort();G(new h0(D))},Q.timeout);Q.fetch(D,$).then(q).catch(G).then(()=>{clearTimeout(X)})})}async function J6(D,{signal:$}){return new Promise((J,Q)=>{if($)$.throwIfAborted(),$.addEventListener("abort",q,{once:!0});function q(){clearTimeout(G),Q($.reason)}let G=setTimeout(()=>{$?.removeEventListener("abort",q),J()},D)})}var _$=(D,$)=>{let J={};for(let Q in $){if(!Object.hasOwn($,Q))continue;if(!(Q in B$)&&!(Q in R$)&&(!(Q in D)||(Q in L$)))J[Q]=$[Q]}return J},S$=(D)=>{if(D===void 0)return!1;if(Array.isArray(D))return D.length>0;if(D instanceof URLSearchParams)return D.size>0;if(typeof D==="object")return Object.keys(D).length>0;if(typeof D==="string")return D.trim().length>0;return Boolean(D)};function k$(D){return D instanceof lD||D?.name===lD.name}function A$(D){return D instanceof h0||D?.name===h0.name}class v0{static create(D,$){let J=new v0(D,$),Q=async()=>{if(typeof J.#D.timeout==="number"&&J.#D.timeout>o8)throw RangeError(`The \`timeout\` option cannot be greater than ${o8}`);await Promise.resolve();let G=await J.#N();for(let X of J.#D.hooks.afterResponse){let Y=J.#z(G.clone()),Z;try{Z=await X(J.request,J.#U(),Y,{retryCount:J.#q})}catch(j){throw J.#X(Y),J.#X(G),j}if(Z instanceof s8)throw J.#X(Y),J.#X(G),new W8(Z.options);let U=Z instanceof globalThis.Response?Z:G;if(Y!==U)J.#X(Y);if(G!==U)J.#X(G);G=U}if(J.#z(G),!G.ok&&(typeof J.#D.throwHttpErrors==="function"?J.#D.throwHttpErrors(G.status):J.#D.throwHttpErrors)){let X=new lD(G,J.request,J.#U());for(let Y of J.#D.hooks.beforeError)X=await Y(X,{retryCount:J.#q});throw X}if(J.#D.onDownloadProgress){if(typeof J.#D.onDownloadProgress!=="function")throw TypeError("The `onDownloadProgress` option must be a function");if(!H$)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let X=G.clone();return J.#X(G),w$(X,J.#D.onDownloadProgress)}return G},q=J.#E(Q).finally(()=>{let G=J.#Y;J.#K(G?.body??void 0),J.#K(J.request.body??void 0)});for(let[G,X]of Object.entries(N$)){if(G==="bytes"&&typeof globalThis.Response?.prototype?.bytes!=="function")continue;q[G]=async()=>{J.request.headers.set("accept",J.request.headers.get("accept")||X);let Y=await q;if(G==="json"){if(Y.status===204)return"";let Z=await Y.text();if(Z==="")return"";if($.parseJson)return $.parseJson(Z);return JSON.parse(Z)}return Y[G]()}}return q}static#$(D){if(D&&typeof D==="object"&&!Array.isArray(D)&&!(D instanceof URLSearchParams))return Object.fromEntries(Object.entries(D).filter(([,$])=>$!==void 0));return D}request;#Q;#q=0;#J;#D;#Y;#G;#Z;constructor(D,$={}){if(this.#J=D,this.#D={...$,headers:t9(this.#J.headers,$.headers),hooks:e9({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},$.hooks),method:M$($.method??this.#J.method??"GET"),prefixUrl:String($.prefixUrl||""),retry:P$($.retry),throwHttpErrors:$.throwHttpErrors??!0,timeout:$.timeout??1e4,fetch:$.fetch??globalThis.fetch.bind(globalThis),context:$.context??{}},typeof this.#J!=="string"&&!(this.#J instanceof URL||this.#J instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(this.#D.prefixUrl&&typeof this.#J==="string"){if(this.#J.startsWith("/"))throw Error("`input` must not begin with a slash when using `prefixUrl`");if(!this.#D.prefixUrl.endsWith("/"))this.#D.prefixUrl+="/";this.#J=this.#D.prefixUrl+this.#J}if(E$&&i8)this.#G=this.#D.signal??this.#J.signal,this.#Q=new globalThis.AbortController,this.#D.signal=this.#G?AbortSignal.any([this.#G,this.#Q.signal]):this.#Q.signal;if(s9)this.#D.duplex="half";if(this.#D.json!==void 0)this.#D.body=this.#D.stringifyJson?.(this.#D.json)??JSON.stringify(this.#D.json),this.#D.headers.set("content-type",this.#D.headers.get("content-type")??"application/json");let J=$.headers&&new globalThis.Headers($.headers).has("content-type");if(this.#J instanceof globalThis.Request&&(V$&&this.#D.body instanceof globalThis.FormData||this.#D.body instanceof URLSearchParams)&&!J)this.#D.headers.delete("content-type");if(this.request=new globalThis.Request(this.#J,this.#D),S$(this.#D.searchParams)){let q="?"+(typeof this.#D.searchParams==="string"?this.#D.searchParams.replace(/^\?/,""):new URLSearchParams(v0.#$(this.#D.searchParams)).toString()),G=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,q);this.request=new globalThis.Request(G,this.#D)}if(this.#D.onUploadProgress){if(typeof this.#D.onUploadProgress!=="function")throw TypeError("The `onUploadProgress` option must be a function");if(!s9)throw Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#H(this.request,this.#D.body??void 0)}}#j(){let D=this.#D.retry.delay(this.#q),$=D;if(this.#D.retry.jitter===!0)$=Math.random()*D;else if(typeof this.#D.retry.jitter==="function"){if($=this.#D.retry.jitter(D),!Number.isFinite($)||$<0)$=D}let J=this.#D.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(J,$)}async#V(D){if(this.#q++,this.#q>this.#D.retry.limit)throw D;let $=D instanceof Error?D:new K8(D);if($ instanceof W8)return $.customDelay??this.#j();if(!this.#D.retry.methods.includes(this.request.method.toLowerCase()))throw D;if(this.#D.retry.shouldRetry!==void 0){let J=await this.#D.retry.shouldRetry({error:$,retryCount:this.#q});if(J===!1)throw D;if(J===!0)return this.#j()}if(A$(D)&&!this.#D.retry.retryOnTimeout)throw D;if(k$(D)){if(!this.#D.retry.statusCodes.includes(D.response.status))throw D;let J=D.response.headers.get("Retry-After")??D.response.headers.get("RateLimit-Reset")??D.response.headers.get("X-RateLimit-Retry-After")??D.response.headers.get("X-RateLimit-Reset")??D.response.headers.get("X-Rate-Limit-Reset");if(J&&this.#D.retry.afterStatusCodes.includes(D.response.status)){let Q=Number(J)*1000;if(Number.isNaN(Q))Q=Date.parse(J)-Date.now();else if(Q>=Date.parse("2024-01-01"))Q-=Date.now();let q=this.#D.retry.maxRetryAfter??Q;return Q<q?Q:q}if(D.response.status===413)throw D}return this.#j()}#z(D){if(this.#D.parseJson)D.json=async()=>this.#D.parseJson(await D.text());return D}#K(D){if(!D)return;D.cancel().catch(()=>{return})}#X(D){this.#K(D.body??void 0)}async#E(D){try{return await D()}catch($){let J=Math.min(await this.#V($),o8);if(this.#q<1)throw $;if(await J6(J,this.#G?{signal:this.#G}:{}),$ instanceof W8&&$.customRequest){let Q=this.#D.signal?new globalThis.Request($.customRequest,{signal:this.#D.signal}):new globalThis.Request($.customRequest);this.#W(Q)}for(let Q of this.#D.hooks.beforeRetry){let q=await Q({request:this.request,options:this.#U(),error:$,retryCount:this.#q});if(q instanceof globalThis.Request){this.#W(q);break}if(q instanceof globalThis.Response)return q;if(q===n8)return}return this.#E(D)}}async#N(){if(this.#Q?.signal.aborted)this.#Q=new globalThis.AbortController,this.#D.signal=this.#G?AbortSignal.any([this.#G,this.#Q.signal]):this.#Q.signal,this.request=new globalThis.Request(this.request,{signal:this.#D.signal});for(let $ of this.#D.hooks.beforeRequest){let J=await $(this.request,this.#U(),{retryCount:this.#q});if(J instanceof Response)return J;if(J instanceof globalThis.Request){this.#W(J);break}}let D=_$(this.request,this.#D);if(this.#Y=this.request,this.request=this.#Y.clone(),this.#D.timeout===!1)return this.#D.fetch(this.#Y,D);return $6(this.#Y,D,this.#Q,this.#D)}#U(){if(!this.#Z){let{hooks:D,...$}=this.#D;this.#Z=Object.freeze($)}return this.#Z}#W(D){this.#Z=void 0,this.request=this.#H(D)}#H(D,$){if(!this.#D.onUploadProgress||!D.body)return D;return T$(D,this.#D.onUploadProgress,$??this.#D.body??void 0)}}/*! MIT License © Sindre Sorhus */var Q6=(D)=>{let $=(J,Q)=>v0.create(J,z8(D,Q));for(let J of r8)$[J]=(Q,q)=>v0.create(Q,z8(D,q,{method:J}));return $.create=(J)=>Q6(z8(J)),$.extend=(J)=>{if(typeof J==="function")J=J(D??{});return Q6(z8(D,J))},$.stop=n8,$.retry=C$,$},SG=Q6(),y0=SG;class L{static outputOverride;static isJson(){return(this.outputOverride??u.load().output)==="json"}static json(D){console.log(JSON.stringify(D,null,2))}static async error(D){let $;if(D instanceof lD){let J=await D.response.text().catch(()=>"");try{let Q=JSON.parse(J);$=Q.message??Q.error??JSON.stringify(Q)}catch{$=J||D.message}}else $=D instanceof Error?D.message:String(D);if(this.isJson())this.json({error:$});else console.log(`${BD.red.bold("Error:")} ${$}`)}static table(D){if(D.type==="horizontal"){if(D.rows.length===0){console.log("No results.");return}let $=Object.keys(D.headers),J=$.map((q)=>BD.bold(D.headers[q])),Q=new q6.default({head:J,style:{head:[]}});for(let q of D.rows)Q.push($.map((G)=>String(q[G]??"")));console.log(Q.toString())}else{let $=new q6.default;for(let{label:J,value:Q}of D.rows)$.push({[BD.bold(J)]:Q});console.log($.toString())}}static formatBoolean(D){return D?"✅":"❌"}static formatPercentageChange(D){if(D===void 0||D===null)return"—";let $=`${D>=0?"+":""}${D.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}%`;if(D>0.5)return BD.green($);if(D<-0.5)return BD.red($);return BD.gray($)}static formatDollar(D){if(!D)return BD.gray("—");if(D<1000)return D.toLocaleString("en-US",{currency:"USD",style:"currency",minimumSignificantDigits:5,maximumSignificantDigits:5});return D.toLocaleString("en-US",{currency:"USD",style:"currency"})}}class G6{static register(D){let $=D.command("config").description("CLI settings and configurations");$.command("list").description("List all settings").action(()=>this.list()),$.command("set").description("Update settings").option("--active-key <name>","Set the active key").option("--output <type>","Set the output format ('table' or 'json')").option("--api-key [key]","Use an API key from https://portal.jup.ag/ for higher rate limits").action((J)=>this.set(J))}static list(){let D=u.load();if(L.isJson()){L.json(D);return}let $=Object.entries(D).map(([J,Q])=>({setting:J,value:Q?String(Q):""}));L.table({type:"horizontal",headers:{setting:"Setting",value:"Value"},rows:$})}static set(D){if(D.output&&D.output!=="table"&&D.output!=="json")throw Error("Invalid --output format. Must be 'table' or 'json'.");let{apiKey:$,...J}=D;u.set({...J,apiKey:typeof $==="string"?$:void 0}),this.list()}}import{copyFileSync as SU,existsSync as H0,readdirSync as kU,renameSync as AU,rmSync as xU}from"node:fs";import{homedir as bU}from"node:os";import{join as S0}from"node:path";var kG=1,AG=2,xG=3,bG=4,hG=5,vG=6,yG=7,fG=8,mG=9,uG=10,gG=11,lG=12,dG=-32700,pG=-32603,cG=-32602,aG=-32601,iG=-32600,rG=-32019,oG=-32018,nG=-32017,sG=-32016,tG=-32015,eG=-32014,DX=-32013,$X=-32012,JX=-32011,QX=-32010,qX=-32009,GX=-32008,XX=-32007,YX=-32006,ZX=-32005,UX=-32004,jX=-32003,KX=-32002,WX=-32001,Y6=2800000,Z6=2800001,zX=2800002,U6=2800003,x$=2800004,b$=2800005,j6=2800006,K6=2800007,e8=2800008,W6=2800009,h$=2800010,v$=2800011,EX=3230000,HX=32300001,VX=3230002,NX=3230003,FX=3230004,CX=3610000,z6=3610001,y$=3610002,E6=3610003,f$=3610004,H6=3610005,m$=3610006,V6=3610007,u$=3611000,g$=3704000,N6=3704001,l$=3704002,d$=3704003,p$=3704004,RX=4128000,LX=4128001,BX=4128002,X6=4615000,IX=4615001,wX=4615002,TX=4615003,OX=4615004,MX=4615005,PX=4615006,_X=4615007,SX=4615008,kX=4615009,AX=4615010,xX=4615011,bX=4615012,hX=4615013,vX=4615014,yX=4615015,fX=4615016,mX=4615017,uX=4615018,gX=4615019,lX=4615020,dX=4615021,pX=4615022,cX=4615023,aX=4615024,iX=4615025,rX=4615026,oX=4615027,nX=4615028,sX=4615029,tX=4615030,eX=4615031,D2=4615032,$2=4615033,J2=4615034,Q2=4615035,q2=4615036,G2=4615037,X2=4615038,Y2=4615039,Z2=4615040,U2=4615041,j2=4615042,K2=4615043,W2=4615044,z2=4615045,E2=4615046,H2=4615047,V2=4615048,N2=4615049,F2=4615050,C2=4615051,R2=4615052,L2=4615053,B2=4615054,I2=5508000,w2=5508001,T2=5508002,O2=5508003,M2=5508004,P2=5508005,_2=5508006,S2=5508007,k2=5508008,A2=5508009,x2=5508010,b2=5508011,h2=5607000,v2=5607001,y2=5607002,f2=5607003,m2=5607004,u2=5607005,g2=5607006,l2=5607007,d2=5607008,p2=5607009,c2=5607010,a2=5607011,i2=5607012,r2=5607013,o2=5607014,n2=5607015,s2=5607016,t2=5607017,c$=5663000,a$=5663001,F6=5663002,C6=5663003,i$=5663004,r$=5663005,o$=5663006,n$=5663007,s$=5663008,t$=5663009,e2=5663010,DY=5663011,e$=5663012,$Y=5663013,JY=5663014,R6=5663015,L6=5663016,D9=5663017,QY=5663018,qY=5663019,DJ=5663020,E8=5663021,$J=5663022,B6=5663023,I6=5663024,w6=5663025,T6=5663026,O6=5663027,GY=5663028,XY=7050000,YY=7050001,ZY=7050002,UY=7050003,jY=7050004,KY=7050005,WY=7050006,zY=7050007,EY=7050008,HY=7050009,VY=7050010,NY=7050011,FY=7050012,CY=7050013,RY=7050014,LY=7050015,BY=7050016,IY=7050017,wY=7050018,TY=7050019,OY=7050020,MY=7050021,PY=7050022,_Y=7050023,SY=7050024,kY=7050025,AY=7050026,xY=7050027,bY=7050028,hY=7050029,vY=7050030,yY=7050031,fY=7050032,mY=7050033,uY=7050034,gY=7050035,lY=7050036,dY=7618000,pY=7618001,cY=7618002,aY=7618003,iY=7618004,rY=7618005,oY=7618006,nY=7618007,sY=7618008,tY=7618009,M6=8078000,P6=8078001,JJ=8078002,QJ=8078003,_6=8078004,S6=8078005,k6=8078006,A6=8078007,qJ=8078008,GJ=8078009,XJ=8078010,x6=8078011,f0=8078012,b6=8078013,h6=8078014,YJ=8078015,ZJ=8078016,v6=8078017,UJ=8078018,eY=8078019,jJ=8078020,KJ=8078021,WJ=8078022,zJ=8078023,EJ=8078024,HJ=8078025,D5=8100000,$5=8100001,J5=8100002,Q5=8100003,q5=8190000,G5=8190001,X5=8190002,Y5=8190003,Z5=8190004,VJ=8500000,NJ=8500001,FJ=8500002,U5=8500003,j5=8500004,K5=8500005,CJ=8500006,W5=9900000,z5=9900001,E5=9900002,H5=9900003,V5=9900004,N5=9900005,F5=9900006;var C5={[EX]:"Account not found at address: $address",[FX]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[NX]:"Expected decoded account at address: $address",[VX]:"Failed to decode account data at address: $address",[HX]:"Accounts not found at addresses: $addresses",[W6]:"Unable to find a viable program address bump seed.",[zX]:"$putativeAddress is not a base58-encoded address.",[Y6]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[U6]:"The `CryptoKey` must be an `Ed25519` public key.",[v$]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[e8]:"Invalid seeds; point must fall off the Ed25519 curve.",[x$]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[j6]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[K6]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[b$]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[h$]:"Program address cannot end with PDA marker.",[Z6]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[bG]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[kG]:"The network has progressed past the last block for which this transaction could have been committed.",[M6]:"Codec [$codecDescription] cannot decode empty byte arrays.",[WJ]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[jJ]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[S6]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[k6]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[_6]:"Encoder and decoder must either both be fixed-size or variable-size.",[qJ]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[JJ]:"Expected a fixed-size codec, got a variable-size one.",[b6]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[QJ]:"Expected a variable-size codec, got a fixed-size one.",[eY]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[P6]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[UJ]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[GJ]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[XJ]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[YJ]:"Invalid literal union variant. Expected one of [$variants], got $value.",[A6]:"Expected [$codecDescription] to have $expected items, got $actual.",[f0]:"Invalid value $value for base $base with alphabet $alphabet.",[ZJ]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[x6]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[h6]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[KJ]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[v6]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[zJ]:"This decoder expected a byte array of exactly $expectedLength bytes, but $numExcessBytes unexpected excess bytes remained after decoding. Are you sure that you have chosen the correct decoder for this data?",[EJ]:"Invalid pattern match value. The provided value does not match any of the specified patterns.",[HJ]:"Invalid pattern match bytes. The provided byte array does not match any of the specified patterns.",[u$]:"No random values implementation could be found.",[gG]:"Failed to send transaction$causeMessage",[lG]:"Failed to send transactions$causeMessages",[kX]:"Instruction requires an uninitialized account",[cX]:"Instruction tries to borrow reference for an account which is already borrowed",[aX]:"Instruction left account with an outstanding borrowed reference",[dX]:"Program other than the account's owner changed the size of the account data",[MX]:"Account data too small for instruction",[pX]:"Instruction expected an executable account",[E2]:"An account does not have enough lamports to be rent-exempt",[V2]:"Program arithmetic overflowed",[z2]:"Failed to serialize or deserialize account data",[B2]:"Builtin programs must consume compute units",[D2]:"Cross-program invocation call depth too deep",[X2]:"Computational budget exceeded",[rX]:"Custom program error: #$code",[mX]:"Instruction contains duplicate accounts",[iX]:"Instruction modifications of multiply-passed account differ",[tX]:"Executable accounts must be rent exempt",[nX]:"Instruction changed executable accounts data",[sX]:"Instruction changed the balance of an executable account",[uX]:"Instruction changed executable bit of an account",[vX]:"Instruction modified data of an account it does not own",[hX]:"Instruction spent from the balance of an account it does not own",[IX]:"Generic instruction error",[F2]:"Provided owner is not allowed",[K2]:"Account is immutable",[W2]:"Incorrect authority provided",[_X]:"Incorrect program id for instruction",[PX]:"Insufficient funds for instruction",[OX]:"Invalid account data for instruction",[H2]:"Invalid account owner",[wX]:"Invalid program argument",[oX]:"Program returned invalid error code",[TX]:"Invalid instruction data",[G2]:"Failed to reallocate account data",[q2]:"Provided seeds do not result in a valid address",[C2]:"Accounts data allocations exceeded the maximum allowed per transaction",[R2]:"Max accounts exceeded",[L2]:"Max instruction trace length exceeded",[Q2]:"Length of the seed is too long for address generation",[$2]:"An account required by the instruction is missing",[SX]:"Missing required signature for instruction",[bX]:"Instruction illegally modified the program id of an account",[lX]:"Insufficient account keys for instruction",[Y2]:"Cross-program invocation with unauthorized signer or writable account",[Z2]:"Failed to create program execution environment",[j2]:"Program failed to compile",[U2]:"Program failed to complete",[fX]:"Instruction modified data of a read-only account",[yX]:"Instruction changed the balance of a read-only account",[J2]:"Cross-program invocation reentrancy not allowed for this instruction",[gX]:"Instruction modified rent epoch of an account",[xX]:"Sum of account balances before and after instruction do not match",[AX]:"Instruction requires an initialized account",[X6]:"The instruction failed with the error: $errorName",[eX]:"Unsupported program id",[N2]:"Unsupported sysvar",[N5]:"Invalid instruction plan kind: $kind.",[cY]:"The provided instruction plan is empty.",[rY]:"No failed transaction plan result was found in the provided transaction plan result.",[iY]:"This transaction plan executor does not support non-divisible sequential plans. To support them, you may create your own executor such that multi-transaction atomicity is preserved — e.g. by targetting RPCs that support transaction bundles.",[aY]:"The provided transaction plan failed to execute. See the `transactionPlanResult` attribute for more details. Note that the `cause` property is deprecated, and a future version will not set it.",[dY]:"The provided message has insufficient capacity to accommodate the next instruction(s) in this plan. Expected at least $numBytesRequired free byte(s), got $numFreeBytes byte(s).",[F5]:"Invalid transaction plan kind: $kind.",[pY]:"No more instructions to pack; the message packer has completed the instruction plan.",[oY]:"Unexpected instruction plan. Expected $expectedKind plan, got $actualKind plan.",[nY]:"Unexpected transaction plan. Expected $expectedKind plan, got $actualKind plan.",[sY]:"Unexpected transaction plan result. Expected $expectedKind plan, got $actualKind plan.",[tY]:"Expected a successful transaction plan result. I.e. there is at least one failed or cancelled transaction in the plan.",[RX]:"The instruction does not have any accounts.",[LX]:"The instruction does not have any data.",[BX]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[hG]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[AG]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[E5]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[V5]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[z5]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[W5]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[H5]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[pG]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[cG]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[iG]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[aG]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[dG]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[$X]:"$__serverMessage",[WX]:"$__serverMessage",[UX]:"$__serverMessage",[eG]:"$__serverMessage",[nG]:"Epoch rewards period still active at slot $slot",[QX]:"$__serverMessage",[qX]:"$__serverMessage",[rG]:"Failed to query long-term storage; please try again",[sG]:"Minimum context slot has not been reached",[ZX]:"Node is unhealthy; behind by $numSlotsBehind slots",[GX]:"No snapshot",[KX]:"Transaction simulation failed",[oG]:"Rewards cannot be found because slot $slot is not the epoch boundary. This may be due to gap in the queried node's local ledger or long-term storage",[XX]:"$__serverMessage",[JX]:"Transaction history is not available from this node",[YX]:"$__serverMessage",[DX]:"Transaction signature length mismatch",[jX]:"Transaction signature verification failure",[tG]:"$__serverMessage",[g$]:"Key pair bytes must be of length 64, got $byteLength.",[N6]:"Expected private key bytes with length 32. Actual length: $actualLength.",[l$]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[p$]:"The provided private key does not match the provided public key.",[d$]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[vG]:"Lamports value must be in the range [0, 2e64-1]",[yG]:"`$value` cannot be parsed as a `BigInt`",[uG]:"$message",[fG]:"`$value` cannot be parsed as a `Number`",[xG]:"No nonce account could be found at address `$nonceAccountAddress`",[f2]:"Expected base58 encoded application domain to decode to a byte array of length 32. Actual length: $actualLength.",[r2]:"Attempted to sign an offchain message with an address that is not a signer for it",[y2]:"Expected base58-encoded application domain string of length in the range [32, 44]. Actual length: $actualLength.",[i2]:"The signer addresses in this offchain message envelope do not match the list of required signers in the message preamble. These unexpected signers were present in the envelope: `[$unexpectedSigners]`. These required signers were missing from the envelope `[$missingSigners]`.",[h2]:"The message body provided has a byte-length of $actualBytes. The maximum allowable byte-length is $maxBytes",[l2]:"Expected message format $expectedMessageFormat, got $actualMessageFormat",[d2]:"The message length specified in the message preamble is $specifiedLength bytes. The actual length of the message is $actualLength bytes.",[p2]:"Offchain message content must be non-empty",[u2]:"Offchain message must specify the address of at least one required signer",[c2]:"Offchain message envelope must reserve space for at least one signature",[m2]:"The offchain message preamble specifies $numRequiredSignatures required signature(s), got $signaturesLength.",[n2]:"The signatories of this offchain message must be listed in lexicographical order",[s2]:"An address must be listed no more than once among the signatories of an offchain message",[a2]:"Offchain message is missing signatures for addresses: $addresses.",[t2]:"Offchain message signature verification failed. Signature mismatch for required signatories [$signatoriesWithInvalidSignatures]. Missing signatures for signatories [$signatoriesWithMissingSignatures]",[v2]:"The message body provided contains characters whose codes fall outside the allowed range. In order to ensure clear-signing compatiblity with hardware wallets, the message may only contain line feeds and characters in the range [\\x20-\\x7e].",[o2]:"Expected offchain message version $expectedVersion. Got $actualVersion.",[g2]:"This version of Kit does not support decoding offchain messages with version $unsupportedVersion. The current max supported version is 0.",[CJ]:"The provided account could not be identified as an account from the $programName program.",[FJ]:"The provided instruction could not be identified as an instruction from the $programName program.",[VJ]:"The provided instruction is missing some accounts. Expected at least $expectedAccountMetas account(s), got $actualAccountMetas.",[j5]:"Expected resolved instruction input '$inputName' to be non-null.",[U5]:"Expected resolved instruction input '$inputName' to be of type `$expectedType`.",[K5]:"Unrecognized account type '$accountType' for the $programName program.",[NJ]:"Unrecognized instruction type '$instructionType' for the $programName program.",[q5]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[X5]:"WebSocket was closed before payload could be added to the send buffer",[Y5]:"WebSocket connection closed",[Z5]:"WebSocket failed to connect",[G5]:"Failed to obtain a subscription id from the server",[Q5]:"Could not find an API plan for RPC method: `$method`",[D5]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[J5]:"HTTP error ($statusCode): $message",[$5]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[I2]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[w2]:"The provided value does not implement the `KeyPairSigner` interface",[O2]:"The provided value does not implement the `MessageModifyingSigner` interface",[M2]:"The provided value does not implement the `MessagePartialSigner` interface",[T2]:"The provided value does not implement any of the `MessageSigner` interfaces",[_2]:"The provided value does not implement the `TransactionModifyingSigner` interface",[S2]:"The provided value does not implement the `TransactionPartialSigner` interface",[k2]:"The provided value does not implement the `TransactionSendingSigner` interface",[P2]:"The provided value does not implement any of the `TransactionSigner` interfaces",[A2]:"More than one `TransactionSendingSigner` was identified.",[x2]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[b2]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[V6]:"Cannot export a non-extractable key.",[z6]:"No digest implementation could be found.",[CX]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[y$]:`This runtime does not support the generation of Ed25519 key pairs.
39
39
 
40
40
  Install @solana/webcrypto-ed25519-polyfill and call its \`install\` function before generating keys in environments that do not support Ed25519.
41
41
 
42
- For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[Q7]:"No signature verification implementation could be found.",[C$]:"No key generation implementation could be found.",[G7]:"No signing implementation could be found.",[H$]:"No key export implementation could be found.",[Mq]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[j2]:"Transaction processing left an account with an outstanding borrowed reference",[oY]:"Account in use",[sY]:"Account loaded twice",[nY]:"Attempt to debit an account but found no record of a prior credit.",[N2]:"Transaction loads an address table account that doesn't exist",[$2]:"This transaction has already been processed",[J2]:"Blockhash not found",[Q2]:"Loader call chain is too deep",[K2]:"Transactions are currently disabled due to cluster maintenance",[w2]:"Transaction contains a duplicate instruction ($index) that is not allowed",[eY]:"Insufficient funds for fee",[O2]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[D2]:"This account may not be used to pay transaction fees",[q2]:"Transaction contains an invalid account reference",[F2]:"Transaction loads an address table account with invalid data",[L2]:"Transaction address table lookup uses an invalid index",[V2]:"Transaction loads an address table account with an invalid owner",[M2]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[Y2]:"This program may not be used for executing instructions",[B2]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[E2]:"Transaction loads a writable account that cannot be written",[T2]:"Transaction exceeded max loaded accounts data size cap",[G2]:"Transaction requires a fee but has no signature present",[tY]:"Attempt to load a program that does not exist",[S2]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[P2]:"ResanitizationNeeded",[Z2]:"Transaction failed to sanitize accounts offsets correctly",[X2]:"Transaction did not pass signature verification",[H2]:"Transaction locked too many accounts",[_2]:"Sum of account balances before and after transaction do not match",[rY]:"The transaction failed with the error `$errorName`",[W2]:"Transaction version is unsupported",[C2]:"Transaction would exceed account data limit within the block",[I2]:"Transaction would exceed total account data limit",[z2]:"Transaction would exceed max account limit within the block",[U2]:"Transaction would exceed max Block Cost Limit",[R2]:"Transaction would exceed max Vote Cost Limit",[K7]:"Attempted to sign a transaction with an address that is not a signer for it",[gY]:"Transaction is missing an address at index: $index.",[j7]:"Transaction has no expected signers therefore it cannot be encoded",[k$]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[Y7]:"Transaction does not have a blockhash lifetime",[Z7]:"Transaction is not a durable nonce transaction",[O$]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[T$]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[P$]:"No fee payer set in CompiledTransaction",[M$]:"Could not find program address at index $index",[cY]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[aY]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[lY]:"Transaction is missing a fee payer.",[_$]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[dY]:"Transaction first instruction is not advance nonce account instruction.",[pY]:"Transaction with no instructions cannot be durable nonce transaction.",[R$]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[I$]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[d8]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[S$]:"Transaction is missing signatures for addresses: $addresses.",[w$]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[Y8]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[A$]:"The transaction has a durable nonce lifetime (with nonce `$nonce`), but the nonce account address is in a lookup table. The lifetime constraint cannot be constructed without fetching the lookup tables for the transaction.",[iY]:"Invalid transaction config mask: $mask. Bits 0 and 1 must match (both set or both unset)",[U7]:"Transaction message bytes are malformed: $messageBytes",[W7]:"Transaction message bytes are empty, so the transaction cannot be encoded",[E7]:"Transaction bytes are empty, so no transaction can be decoded",[z7]:"Transaction version 0 must be encoded with signatures first. This transaction was encoded with first byte $firstByte, which is expected to be a signature count for v0 transactions.",[C7]:"The provided transaction bytes expect that there should be $numExpectedSignatures signatures, but the bytes are not long enough to contain a transaction message with this many signatures. The provided bytes are $transactionBytesLength bytes long."},Z5=1000,mD="i",AD="t";function K5(D,$={}){let J=Y5[D];if(J.length===0)return"";let Q;function G(Y){if(Q[AD]===2){let Z=J.slice(Q[mD]+1,Y);q.push(Z in $?`${$[Z]}`:`$${Z}`)}else if(Q[AD]===1)q.push(J.slice(Q[mD],Y))}let q=[];J.split("").forEach((Y,Z)=>{if(Z===0){Q={[mD]:0,[AD]:J[0]==="\\"?0:J[0]==="$"?2:1};return}let K;switch(Q[AD]){case 0:K={[mD]:Z,[AD]:1};break;case 1:if(Y==="\\")K={[mD]:Z,[AD]:0};else if(Y==="$")K={[mD]:Z,[AD]:2};break;case 2:if(Y==="\\")K={[mD]:Z,[AD]:0};else if(Y==="$")K={[mD]:Z,[AD]:2};else if(!Y.match(/\w/))K={[mD]:Z,[AD]:1};break}if(K){if(Q!==K)G(Z);Q=K}}),G();let X=q.join("");if(D>=o9&&D<o9+Z5&&"index"in $)X+=` (instruction #${$.index+1})`;return X}function j5(D,$={}){return K5(D,$)}function n$(D,$){if(D instanceof Error&&D.name==="SolanaError"){if($!==void 0)return D.context.__code===$;return!0}return!1}var b=class extends Error{cause=this.cause;context;constructor(...[D,$]){let J,Q;if($)Object.entries(Object.getOwnPropertyDescriptors($)).forEach(([q,X])=>{if(q==="cause")Q={cause:X.value};else{if(J===void 0)J={__code:D};Object.defineProperty(J,q,X)}});let G=j5(D,J);super(G,Q);this.context=Object.freeze(J===void 0?{__code:D}:J),this.name="SolanaError"}};function U5(D,$){if(D.length>=$)return D;let J=new Uint8Array($).fill(0);return J.set(D),J}var W5=(D,$)=>U5(D.length<=$?D:D.slice(0,$),$);function T7(D,$){return D.length===$.length&&D.every((J,Q)=>J===$[Q])}function b0(D,$){return"fixedSize"in $?$.fixedSize:$.getSizeFromValue(D)}function QD(D){return Object.freeze({...D,encode:($)=>{let J=new Uint8Array(b0($,D));return D.write($,J,0),J}})}function s(D){return Object.freeze({...D,decode:($,J=0)=>D.read($,J)[0]})}function VD(D){return"fixedSize"in D&&typeof D.fixedSize==="number"}function E5(D){return!VD(D)}function xD(D,$){if(VD(D)!==VD($))throw new b(V7);if(VD(D)&&VD($)&&D.fixedSize!==$.fixedSize)throw new b(F7,{decoderFixedSize:$.fixedSize,encoderFixedSize:D.fixedSize});if(!VD(D)&&!VD($)&&D.maxSize!==$.maxSize)throw new b(L7,{decoderMaxSize:$.maxSize,encoderMaxSize:D.maxSize});return{...$,...D,decode:$.decode,encode:D.encode,read:$.read,write:D.write}}function e$(D,$,J=0){if($.length-J<=0)throw new b(H7,{codecDescription:D})}function c8(D,$,J,Q=0){let G=J.length-Q;if(G<$)throw new b(N7,{bytesLength:G,codecDescription:D,expected:$})}function t$(D,$,J){if($<0||$>J)throw new b(w7,{bytesLength:J,codecDescription:D,offset:$})}function h0(D,$,J){let Q=D.byteOffset+($??0),G=J??D.byteLength,q;if(typeof SharedArrayBuffer>"u")q=D.buffer;else if(D.buffer instanceof SharedArrayBuffer)q=new ArrayBuffer(D.length),new Uint8Array(q).set(new Uint8Array(D));else q=D.buffer;return(Q===0||Q===-D.byteLength)&&G===D.byteLength?q:q.slice(Q,Q+G)}function H0(D,$){return QD({fixedSize:$,write:(J,Q,G)=>{let q=D.encode(J),X=q.length>$?q.slice(0,$):q;return Q.set(X,G),G+$}})}function N0(D,$){return s({fixedSize:$,read:(J,Q)=>{if(c8("fixCodecSize",$,J,Q),Q>0||J.length>$)J=J.slice(Q,Q+$);if(VD(D))J=W5(J,D.fixedSize);let[G]=D.read(J,0);return[G,Q+$]}})}function z5(D,$){return s({...D,read:(J,Q)=>{let G=(K)=>C5(K,J.length),q=$.preOffset?$.preOffset({bytes:J,preOffset:Q,wrapBytes:G}):Q;t$("offsetDecoder",q,J.length);let[X,Y]=D.read(J,q),Z=$.postOffset?$.postOffset({bytes:J,newPreOffset:q,postOffset:Y,preOffset:Q,wrapBytes:G}):Y;return t$("offsetDecoder",Z,J.length),[X,Z]}})}function C5(D,$){if($===0)return 0;return(D%$+$)%$}function H5(D,$){if(VD(D)){let J=$(D.fixedSize);if(J<0)throw new b(I7,{bytesLength:J,codecDescription:"resizeDecoder"});return s({...D,fixedSize:J})}return D}function DJ(D,$){return z5(H5(D,(J)=>J+$),{postOffset:({postOffset:J})=>J+$})}function nD(D,$){return QD({...E5(D)?{...D,getSizeFromValue:(J)=>D.getSizeFromValue($(J))}:D,write:(J,Q,G)=>D.write($(J),Q,G)})}function Z8(D,$){return s({...D,read:(J,Q)=>{let[G,q]=D.read(J,Q);return[$(G,J,Q),q]}})}function GJ(D,$,J=$){if(!$.match(new RegExp(`^[${D}]*$`)))throw new b(x0,{alphabet:D,base:D.length,value:J})}var N5=(D)=>{return QD({getSizeFromValue:($)=>{let[J,Q]=$J($,D[0]);if(!Q)return $.length;let G=JJ(Q,D);return J.length+Math.ceil(G.toString(16).length/2)},write($,J,Q){if(GJ(D,$),$==="")return Q;let[G,q]=$J($,D[0]);if(!q)return J.set(new Uint8Array(G.length).fill(0),Q),Q+G.length;let X=JJ(q,D),Y=[];while(X>0n)Y.unshift(Number(X%256n)),X/=256n;let Z=[...Array(G.length).fill(0),...Y];return J.set(Z,Q),Q+Z.length}})},V5=(D)=>{return s({read($,J){let Q=J===0?$:$.slice(J);if(Q.length===0)return["",0];let G=Q.findIndex((Z)=>Z!==0);G=G===-1?Q.length:G;let q=D[0].repeat(G);if(G===Q.length)return[q,$.length];let X=Q.slice(G).reduce((Z,K)=>Z*256n+BigInt(K),0n),Y=F5(X,D);return[q+Y,$.length]}})};function $J(D,$){let[J,Q]=D.split(new RegExp(`((?!${$}).*)`));return[J,Q]}function JJ(D,$){let J=BigInt($.length),Q=0n;for(let G of D)Q*=J,Q+=BigInt($.indexOf(G));return Q}function F5(D,$){let J=BigInt($.length),Q=[];while(D>0n)Q.unshift($[Number(D%J)]),D/=J;return Q.join("")}var QJ={alphabet:"0123456789abcdef",base:16};function M7(D){if(D>=48&&D<=57)return D-48;if(D>=65&&D<=70)return D-55;if(D>=97&&D<=102)return D-87}var qJ=()=>QD({getSizeFromValue:(D)=>Math.ceil(D.length/2),write(D,$,J){let Q=D.length,G=Q/2;if(Q===1){let X=D.charCodeAt(0),Y=M7(X);if(Y===void 0)throw new b(x0,{...QJ,value:D});return $.set([Y],J),1+J}let q=new Uint8Array(G);for(let X=0,Y=0;X<G;X++){let Z=D.charCodeAt(Y++),K=D.charCodeAt(Y++),j=M7(Z),U=M7(K);if(j===void 0||U===void 0&&!Number.isNaN(K))throw new b(x0,{...QJ,value:D});q[X]=!Number.isNaN(K)?j<<4|(U??0):j}return $.set(q,J),q.length+J}});var XJ="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",a8=()=>N5(XJ),P7=()=>V5(XJ);var L5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",S7=()=>{return QD({getSizeFromValue:(D)=>Buffer.from(D,"base64").length,write(D,$,J){GJ(L5,D.replace(/=/g,""));let Q=Buffer.from(D,"base64");return $.set(Q,J),Q.length+J}})},_7=()=>{return s({read:(D,$=0)=>[Buffer.from(h0(D),$).toString("base64"),D.length]})},YJ=()=>xD(S7(),_7());var{TextDecoder:HU,TextEncoder:NU}=globalThis;function ZJ(){if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.digest!=="function")throw new b(J7)}function i8(){if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!=="function")throw new b(Q7)}function KJ(){if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!=="function")throw new b(G7)}var k7,A7;function EJ(){if(!k7)k7=a8();return k7}function B5(){if(!A7)A7=P7();return A7}function R5(D){if(D.length<32||D.length>44)throw new b(n9,{actualLength:D.length});let Q=EJ().encode(D).byteLength;if(Q!==32)throw new b(s9,{actualLength:Q})}function x7(D){return R5(D),D}function K8(){return nD(H0(EJ(),32),(D)=>x7(D))}function v0(){return N0(B5(),32)}function I5(){return xD(K8(),v0())}var w5=37095705934669439343138083508754565189542113879843219016388785533085940283555n,CD=57896044618658097711785492504343953926634992332820282019728792003956564819949n,jJ=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function MD(D){let $=D%CD;return $>=0n?$:CD+$}function bD(D,$){let J=D;while($-- >0n)J*=J,J%=CD;return J}function O5(D){let J=D*D%CD*D%CD,Q=bD(J,2n)*J%CD,G=bD(Q,1n)*D%CD,q=bD(G,5n)*G%CD,X=bD(q,10n)*q%CD,Y=bD(X,20n)*X%CD,Z=bD(Y,40n)*Y%CD,K=bD(Z,80n)*Z%CD,j=bD(K,80n)*Z%CD,U=bD(j,10n)*q%CD;return bD(U,2n)*D%CD}function T5(D,$){let J=MD($*$*$),Q=MD(J*J*$),G=O5(D*Q),q=MD(D*J*G),X=MD($*q*q),Y=q,Z=MD(q*jJ),K=X===D,j=X===MD(-D),U=X===MD(-D*jJ);if(K)q=Y;if(j||U)q=Z;if((MD(q)&1n)===1n)q=MD(-q);if(!K&&!j)return null;return q}function M5(D,$){let J=MD(D*D),Q=MD(J-1n),G=MD(w5*J+1n),q=T5(Q,G);if(q===null)return!1;let X=($&128)!==0;if(q===0n&&X)return!1;return!0}function P5(D){let $=D.toString(16);if($.length===1)return`0${$}`;else return $}function S5(D){let J=`0x${D.reduce((Q,G,q)=>`${P5(q===31?G&-129:G)}${Q}`,"")}`;return BigInt(J)}function _5(D){if(D.byteLength!==32)return!1;let $=S5(D);return M5($,D[31])}var UJ=32,WJ=16,k5=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function A5({programAddress:D,seeds:$}){if(ZJ(),$.length>WJ)throw new b(e9,{actual:$.length,maxSeeds:WJ});let J,Q=$.reduce((Z,K,j)=>{let U=typeof K==="string"?(J||=new TextEncoder).encode(K):K;if(U.byteLength>UJ)throw new b(D7,{actual:U.byteLength,index:j,maxSeedLength:UJ});return Z.push(...U),Z},[]),G=I5(),q=G.encode(D),X=await crypto.subtle.digest("SHA-256",new Uint8Array([...Q,...q,...k5])),Y=new Uint8Array(X);if(_5(Y))throw new b(p8);return G.decode(Y)}async function zJ({programAddress:D,seeds:$}){let J=255;while(J>0)try{return[await A5({programAddress:D,seeds:[...$,new Uint8Array([J])]}),J]}catch(Q){if(n$(Q,p8))J--;else throw Q}throw new b($7)}async function r8(D){if(i8(),D.type!=="public"||D.algorithm.name!=="Ed25519")throw new b(t9);let $=await crypto.subtle.exportKey("raw",D);return v0().decode(new Uint8Array($))}function CJ(D,$,J,Q){if(Q<$||Q>J)throw new b(R7,{codecDescription:D,max:J,min:$,value:Q})}function HJ(D){return D?.endian===1?!1:!0}function x5(D){return QD({fixedSize:D.size,write($,J,Q){if(D.range)CJ(D.name,D.range[0],D.range[1],$);let G=new ArrayBuffer(D.size);return D.set(new DataView(G),$,HJ(D.config)),J.set(new Uint8Array(G),Q),Q+D.size}})}function NJ(D){return s({fixedSize:D.size,read($,J=0){e$(D.name,$,J),c8(D.name,D.size,$,J);let Q=new DataView(h0($,J,D.size));return[D.get(Q,HJ(D.config)),J+D.size]}})}var VJ=()=>QD({getSizeFromValue:(D)=>{if(D<=127)return 1;if(D<=16383)return 2;return 3},maxSize:3,write:(D,$,J)=>{CJ("shortU16",0,65535,D);let Q=[0];for(let G=0;;G+=1){let q=Number(D)>>G*7;if(q===0)break;let X=127&q;if(Q[G]=X,G>0)Q[G-1]|=128}return $.set(Q,J),J+Q.length}}),b7=()=>s({maxSize:3,read:(D,$)=>{let J=0,Q=0;while(++Q){let G=Q-1,q=D[$+G],X=127&q;if(J|=X<<G*7,(q&128)===0)break}return[J,$+Q]}});var h7=(D={})=>x5({config:D,name:"u32",range:[0,Number("0xffffffff")],set:($,J,Q)=>$.setUint32(0,Number(J),Q),size:4}),v7=(D={})=>NJ({config:D,get:($,J)=>$.getUint32(0,J),name:"u32",size:4});var o8=()=>NJ({get:(D)=>D.getUint8(0),name:"u8",size:1});function v5(D,$,J){if($!==J)throw new b(B7,{actual:J,codecDescription:D,expected:$})}function y5(D){return D.reduce(($,J)=>$===null||J===null?null:Math.max($,J),0)}function y0(D){return D.reduce(($,J)=>$===null||J===null?null:$+J,0)}function j8(D){return VD(D)?D.fixedSize:null}function f0(D){return VD(D)?D.fixedSize:D.maxSize??null}function n8(D,$={}){let J=$.size??h7(),Q=s8(J,j8(D)),G=s8(J,f0(D))??void 0;return QD({...Q!==null?{fixedSize:Q}:{getSizeFromValue:(q)=>{return(typeof J==="object"?b0(q.length,J):0)+[...q].reduce((Y,Z)=>Y+b0(Z,D),0)},maxSize:G},write:(q,X,Y)=>{if(typeof J==="number")v5($.description??"array",J,q.length);if(typeof J==="object")Y=J.write(q.length,X,Y);return q.forEach((Z)=>{Y=D.write(Z,X,Y)}),Y}})}function m0(D,$={}){let J=$.size??v7(),Q=j8(D),G=s8(J,Q),q=s8(J,f0(D))??void 0;return s({...G!==null?{fixedSize:G}:{maxSize:q},read:(X,Y)=>{let Z=[];if(typeof J==="object"&&X.slice(Y).length===0)return[Z,Y];if(J==="remainder"){while(Y<X.length){let[U,C]=D.read(X,Y);Y=C,Z.push(U)}return[Z,Y]}let[K,j]=typeof J==="number"?[J,Y]:J.read(X,Y);Y=j;for(let U=0;U<K;U+=1){let[C,z]=D.read(X,Y);Y=z,Z.push(C)}return[Z,Y]}})}function s8(D,$){if(typeof D!=="number")return null;if(D===0)return 0;return $===null?null:$*D}function U8(){return QD({getSizeFromValue:(D)=>D.length,write:(D,$,J)=>{return $.set(D,J),J+D.length}})}function t8(){return s({read:(D,$)=>{let J=D.slice($);return[J,$+J.length]}})}function FJ(D){let $=y0(D.map(j8)),J=y0(D.map(f0))??void 0;return s({...$===null?{maxSize:J}:{fixedSize:$},read:(Q,G)=>{let q=[];return D.forEach((X)=>{let[Y,Z]=X.read(Q,G);q.push(Y),G=Z}),[q,G]}})}function f5(D,$){let J=LJ(D),Q=(q,X,Y)=>{let Z=$(q);return y7(D,Z),D[Z].write(q,X,Y)};if(J!==null)return QD({fixedSize:J,write:Q});let G=BJ(D);return QD({...G!==null?{maxSize:G}:{},getSizeFromValue:(q)=>{let X=$(q);return y7(D,X),b0(q,D[X])},write:Q})}function m5(D,$){let J=LJ(D),Q=(q,X)=>{let Y=$(q,X);return y7(D,Y),D[Y].read(q,X)};if(J!==null)return s({fixedSize:J,read:Q});let G=BJ(D);return s({...G!==null?{maxSize:G}:{},read:Q})}function y7(D,$){if(typeof D[$]>"u")throw new b(O7,{maxRange:D.length-1,minRange:0,variant:$})}function LJ(D){if(D.length===0)return 0;if(!VD(D[0]))return null;let $=D[0].fixedSize;return D.every((Q)=>VD(Q)&&Q.fixedSize===$)?$:null}function BJ(D){return y5(D.map(($)=>f0($)))}function RJ(D,$,J){return f5([$,J],(Q)=>D(Q)?0:1)}function IJ(D,$,J){return m5([$,J],(Q)=>D(Q)?0:1)}function f7(D){let $=D.map(([,G])=>G),J=y0($.map(j8)),Q=y0($.map(f0))??void 0;return QD({...J===null?{getSizeFromValue:(G)=>D.map(([q,X])=>b0(G[q],X)).reduce((q,X)=>q+X,0),maxSize:Q}:{fixedSize:J},write:(G,q,X)=>{return D.forEach(([Y,Z])=>{X=Z.write(G[Y],q,X)}),X}})}function m7(D){let $=D.map(([,G])=>G),J=y0($.map(j8)),Q=y0($.map(f0))??void 0;return s({...J===null?{maxSize:Q}:{fixedSize:J},read:(G,q)=>{let X={};return D.forEach(([Y,Z])=>{let[K,j]=Z.read(G,q);q=j,X[Y]=K}),[X,q]}})}var u5=1,wJ=128;function u7(){return s({maxSize:1,read:(D,$)=>{let J=D[$];if((J&wJ)===0)return["legacy",$];else{let Q=J^wJ;if(Q>u5)throw new b(Y8,{unsupportedVersion:Q});return[Q,$+1]}}})}var fU=Symbol("AddressMapTypeProperty");var mU=Symbol("AddressMapTypeProperty");var TJ=Object.freeze({name:"Ed25519"});function g5(D){return new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32,...D])}async function OJ(D,$=!1){let J=D.byteLength;if(J!==32)throw new b(X7,{actualLength:J});let Q=g5(D);return await crypto.subtle.importKey("pkcs8",Q,TJ,$,["sign"])}async function l5(D,$=!1){if(i8(),D.extractable===!1)throw new b(q7,{key:D});let J=await crypto.subtle.exportKey("jwk",D);return await crypto.subtle.importKey("jwk",{crv:"Ed25519",ext:$,key_ops:["verify"],kty:"OKP",x:J.x},"Ed25519",$,["verify"])}async function e8(D,$){KJ();let J=await crypto.subtle.sign(TJ,D,h0($));return new Uint8Array(J)}async function MJ(D,$=!1){let J=OJ(D,$),[Q,G]=await Promise.all([($?J:OJ(D,!0)).then(async(q)=>await l5(q,!0)),J]);return{privateKey:G,publicKey:Q}}function PJ(D){let $=Object.values(D);if($.length===0)throw new b(j7);return $.map((J)=>{if(!J)return new Uint8Array(64).fill(0);return J})}function d5(){return nD(n8(H0(U8(),64),{size:VJ()}),PJ)}function c5(D){return nD(n8(H0(U8(),64),{description:"signatures",size:D}),PJ)}var a5=128,i5=127;function r5(D){if(D.length===0)throw new b(W7);return u7().decode(D)===1?"messageFirst":"signaturesFirst"}function o5(D){if(D.length===0)throw new b(E7);let $=D[0];if(($&a5)===0)return"signaturesFirst";let J=$&i5;if(J===0)throw new b(z7,{firstByte:$,transactionBytes:D});if(J===1)return"messageFirst";throw new b(Y8,{unsupportedVersion:J})}function SJ(){return RJ((D)=>r5(D.messageBytes)==="signaturesFirst",s5(),n5())}function s5(){return f7([["signatures",d5()],["messageBytes",U8()]])}function g7(D,$){if(D.length<$+2)throw new b(U7,{messageBytes:D});return D[$+1]}function n5(){let D=U8();return QD({getSizeFromValue:($)=>{let J=g7($.messageBytes,0);return $.messageBytes.length+J*64},write:($,J,Q)=>{Q=D.write($.messageBytes,J,Q);let G=g7($.messageBytes,0);return Q=c5(G).write($.signatures,J,Q),Q}})}function t5(){return IJ((D)=>o5(D)==="signaturesFirst",e5(),DZ())}function e5(){return Z8(m7([["signatures",m0(N0(t8(),64),{size:b7()})],["messageBytes",t8()]]),JZ)}function DZ(){return Z8($Z(),QZ)}function $Z(){return s({read(D,$){let J=g7(D,$),Q=J*64,G=D.length-$-Q;if(G<0)throw new b(C7,{numExpectedSignatures:J,transactionBytes:D.subarray($),transactionBytesLength:D.length-$});let q=D.subarray($,$+G),[X,Y]=m0(N0(t8(),64),{size:J}).read(D,$+G);return[{messageBytes:q,signatures:X},Y]}})}function _J(){return xD(SJ(),t5())}function JZ(D){let{messageBytes:$,signatures:J}=D,Q=FJ([u7(),DJ(o8(),2),m0(v0(),{size:b7()})]),[G,q,X]=Q.decode($),Y=X.slice(0,q);if(Y.length!==J.length)throw new b(d8,{numRequiredSignatures:q,signaturesLength:J.length,signerAddresses:Y});let Z=kJ(Y,J);return{messageBytes:$,signatures:Object.freeze(Z)}}function QZ(D){let{messageBytes:$,signatures:J}=D,Q=$[1],G=14,q=m0(v0(),{size:Q}).decode($,14);if(q.length!==J.length)throw new b(d8,{numRequiredSignatures:Q,signaturesLength:J.length,signerAddresses:q});let X=kJ(q,J);return{messageBytes:$,signatures:X}}function kJ(D,$){let J={};return D.forEach((Q,G)=>{let q=$[G];if(q.every((X)=>X===0))J[Q]=null;else J[Q]=q}),Object.freeze(J)}async function D9(D,$){let J,Q;if(await Promise.all(D.map(async(G)=>{let q=await r8(G.publicKey),X=$.signatures[q];if(X===void 0){Q||=new Set,Q.add(q);return}if(Q)return;let Y=await e8(G.privateKey,$.messageBytes);if(X!==null&&T7(Y,X))return;J||={},J[q]=Y})),Q&&Q.size>0){let G=Object.keys($.signatures);throw new b(K7,{expectedAddresses:G,unexpectedAddresses:[...Q]})}if(!J)return $;return Object.freeze({...$,signatures:Object.freeze({...$.signatures,...J})})}function AJ(D){let $=SJ().encode(D);return _7().decode($)}var GZ=1280,qZ=48,XW=GZ-qZ;async function XZ(D){let $=await r8(D.publicKey);return Object.freeze({address:$,keyPair:D,signMessages:(Q)=>Promise.all(Q.map(async(G)=>Object.freeze({[$]:await e8(D.privateKey,G.content)}))),signTransactions:(Q)=>Promise.all(Q.map(async(G)=>{let q=await D9([D],G);return Object.freeze({[$]:q.signatures[$]})}))})}async function xJ(D,$){return await XZ(await MJ(D,$))}var CW=globalThis.TextEncoder;import{existsSync as CK,readFileSync as HK,writeFileSync as NK}from"node:fs";import{join as eQ}from"node:path";/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function V0(D){return D instanceof Uint8Array||ArrayBuffer.isView(D)&&D.constructor.name==="Uint8Array"}function UD(D,$=""){if(!Number.isSafeInteger(D)||D<0){let J=$&&`"${$}" `;throw Error(`${J}expected integer >= 0, got ${D}`)}}function x(D,$,J=""){let Q=V0(D),G=D?.length,q=$!==void 0;if(!Q||q&&G!==$){let X=J&&`"${J}" `,Y=q?` of length ${$}`:"",Z=Q?`length=${G}`:`type=${typeof D}`;throw Error(X+"expected Uint8Array"+Y+", got "+Z)}return D}function u0(D){if(typeof D!=="function"||typeof D.create!=="function")throw Error("Hash must wrapped by utils.createHasher");UD(D.outputLen),UD(D.blockLen)}function g0(D,$=!0){if(D.destroyed)throw Error("Hash instance has been destroyed");if($&&D.finished)throw Error("Hash#digest() has already been called")}function hJ(D,$){x(D,void 0,"digestInto() output");let J=$.outputLen;if(D.length<J)throw Error('"digestInto() output" expected to be of length >='+J)}function GD(...D){for(let $=0;$<D.length;$++)D[$].fill(0)}function hD(D){return new DataView(D.buffer,D.byteOffset,D.byteLength)}function _D(D,$){return D<<32-$|D>>>$}function gD(D,$){return D<<$|D>>>32-$>>>0}var vJ=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),YZ=Array.from({length:256},(D,$)=>$.toString(16).padStart(2,"0"));function lD(D){if(x(D),vJ)return D.toHex();let $="";for(let J=0;J<D.length;J++)$+=YZ[D[J]];return $}var uD={_0:48,_9:57,A:65,F:70,a:97,f:102};function bJ(D){if(D>=uD._0&&D<=uD._9)return D-uD._0;if(D>=uD.A&&D<=uD.F)return D-(uD.A-10);if(D>=uD.a&&D<=uD.f)return D-(uD.a-10);return}function pD(D){if(typeof D!=="string")throw Error("hex string expected, got "+typeof D);if(vJ)return Uint8Array.fromHex(D);let $=D.length,J=$/2;if($%2)throw Error("hex string expected, got unpadded hex of length "+$);let Q=new Uint8Array(J);for(let G=0,q=0;G<J;G++,q+=2){let X=bJ(D.charCodeAt(q)),Y=bJ(D.charCodeAt(q+1));if(X===void 0||Y===void 0){let Z=D[q]+D[q+1];throw Error('hex string expected, got non-hex character "'+Z+'" at index '+q)}Q[G]=X*16+Y}return Q}function ZZ(D){if(typeof D!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(D))}function l7(D,$=""){if(typeof D==="string")return ZZ(D);return x(D,void 0,$)}function $D(...D){let $=0;for(let Q=0;Q<D.length;Q++){let G=D[Q];x(G),$+=G.length}let J=new Uint8Array($);for(let Q=0,G=0;Q<D.length;Q++){let q=D[Q];J.set(q,G),G+=q.length}return J}function yJ(D,$){if($!==void 0&&{}.toString.call($)!=="[object Object]")throw Error("options must be object or undefined");return Object.assign(D,$)}function W8(D,$={}){let J=(G,q)=>D(q).update(G).digest(),Q=D(void 0);return J.outputLen=Q.outputLen,J.blockLen=Q.blockLen,J.create=(G)=>D(G),Object.assign(J,$),Object.freeze(J)}function tD(D=32){let $=typeof globalThis==="object"?globalThis.crypto:null;if(typeof $?.getRandomValues!=="function")throw Error("crypto.getRandomValues must be defined");return $.getRandomValues(new Uint8Array(D))}var p7=(D)=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,D])});function l0(D,$,J){return D&$^~D&J}function $9(D,$,J){return D&$^D&J^$&J}class eD{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(D,$,J,Q){this.blockLen=D,this.outputLen=$,this.padOffset=J,this.isLE=Q,this.buffer=new Uint8Array(D),this.view=hD(this.buffer)}update(D){g0(this),x(D);let{view:$,buffer:J,blockLen:Q}=this,G=D.length;for(let q=0;q<G;){let X=Math.min(Q-this.pos,G-q);if(X===Q){let Y=hD(D);for(;Q<=G-q;q+=Q)this.process(Y,q);continue}if(J.set(D.subarray(q,q+X),this.pos),this.pos+=X,q+=X,this.pos===Q)this.process($,0),this.pos=0}return this.length+=D.length,this.roundClean(),this}digestInto(D){g0(this),hJ(D,this),this.finished=!0;let{buffer:$,view:J,blockLen:Q,isLE:G}=this,{pos:q}=this;if($[q++]=128,GD(this.buffer.subarray(q)),this.padOffset>Q-q)this.process(J,0),q=0;for(let j=q;j<Q;j++)$[j]=0;J.setBigUint64(Q-8,BigInt(this.length*8),G),this.process(J,0);let X=hD(D),Y=this.outputLen;if(Y%4)throw Error("_sha2: outputLen must be aligned to 32bit");let Z=Y/4,K=this.get();if(Z>K.length)throw Error("_sha2: outputLen bigger than state");for(let j=0;j<Z;j++)X.setUint32(4*j,K[j],G)}digest(){let{buffer:D,outputLen:$}=this;this.digestInto(D);let J=D.slice(0,$);return this.destroy(),J}_cloneInto(D){D||=new this.constructor,D.set(...this.get());let{blockLen:$,buffer:J,length:Q,finished:G,destroyed:q,pos:X}=this;if(D.destroyed=q,D.finished=G,D.length=Q,D.pos=X,Q%$)D.buffer.set(J);return D}clone(){return this._cloneInto()}}var dD=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),cD=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),ZD=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),KD=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var J9=BigInt(4294967295),fJ=BigInt(32);function KZ(D,$=!1){if($)return{h:Number(D&J9),l:Number(D>>fJ&J9)};return{h:Number(D>>fJ&J9)|0,l:Number(D&J9)|0}}function mJ(D,$=!1){let J=D.length,Q=new Uint32Array(J),G=new Uint32Array(J);for(let q=0;q<J;q++){let{h:X,l:Y}=KZ(D[q],$);[Q[q],G[q]]=[X,Y]}return[Q,G]}var d7=(D,$,J)=>D>>>J,c7=(D,$,J)=>D<<32-J|$>>>J,F0=(D,$,J)=>D>>>J|$<<32-J,L0=(D,$,J)=>D<<32-J|$>>>J,E8=(D,$,J)=>D<<64-J|$>>>J-32,z8=(D,$,J)=>D>>>J-32|$<<64-J;function vD(D,$,J,Q){let G=($>>>0)+(Q>>>0);return{h:D+J+(G/4294967296|0)|0,l:G|0}}var uJ=(D,$,J)=>(D>>>0)+($>>>0)+(J>>>0),gJ=(D,$,J,Q)=>$+J+Q+(D/4294967296|0)|0,lJ=(D,$,J,Q)=>(D>>>0)+($>>>0)+(J>>>0)+(Q>>>0),pJ=(D,$,J,Q,G)=>$+J+Q+G+(D/4294967296|0)|0,dJ=(D,$,J,Q,G)=>(D>>>0)+($>>>0)+(J>>>0)+(Q>>>0)+(G>>>0),cJ=(D,$,J,Q,G,q)=>$+J+Q+G+q+(D/4294967296|0)|0;var UZ=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),D0=new Uint32Array(64);class a7 extends eD{constructor(D){super(64,D,8,!1)}get(){let{A:D,B:$,C:J,D:Q,E:G,F:q,G:X,H:Y}=this;return[D,$,J,Q,G,q,X,Y]}set(D,$,J,Q,G,q,X,Y){this.A=D|0,this.B=$|0,this.C=J|0,this.D=Q|0,this.E=G|0,this.F=q|0,this.G=X|0,this.H=Y|0}process(D,$){for(let j=0;j<16;j++,$+=4)D0[j]=D.getUint32($,!1);for(let j=16;j<64;j++){let U=D0[j-15],C=D0[j-2],z=_D(U,7)^_D(U,18)^U>>>3,E=_D(C,17)^_D(C,19)^C>>>10;D0[j]=E+D0[j-7]+z+D0[j-16]|0}let{A:J,B:Q,C:G,D:q,E:X,F:Y,G:Z,H:K}=this;for(let j=0;j<64;j++){let U=_D(X,6)^_D(X,11)^_D(X,25),C=K+U+l0(X,Y,Z)+UZ[j]+D0[j]|0,E=(_D(J,2)^_D(J,13)^_D(J,22))+$9(J,Q,G)|0;K=Z,Z=Y,Y=X,X=q+C|0,q=G,G=Q,Q=J,J=C+E|0}J=J+this.A|0,Q=Q+this.B|0,G=G+this.C|0,q=q+this.D|0,X=X+this.E|0,Y=Y+this.F|0,Z=Z+this.G|0,K=K+this.H|0,this.set(J,Q,G,q,X,Y,Z,K)}roundClean(){GD(D0)}destroy(){this.set(0,0,0,0,0,0,0,0),GD(this.buffer)}}class aJ extends a7{A=dD[0]|0;B=dD[1]|0;C=dD[2]|0;D=dD[3]|0;E=dD[4]|0;F=dD[5]|0;G=dD[6]|0;H=dD[7]|0;constructor(){super(32)}}class WZ extends a7{A=cD[0]|0;B=cD[1]|0;C=cD[2]|0;D=cD[3]|0;E=cD[4]|0;F=cD[5]|0;G=cD[6]|0;H=cD[7]|0;constructor(){super(28)}}var iJ=(()=>mJ(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((D)=>BigInt(D))))(),EZ=(()=>iJ[0])(),zZ=(()=>iJ[1])(),$0=new Uint32Array(80),J0=new Uint32Array(80);class C8 extends eD{constructor(D){super(128,D,16,!1)}get(){let{Ah:D,Al:$,Bh:J,Bl:Q,Ch:G,Cl:q,Dh:X,Dl:Y,Eh:Z,El:K,Fh:j,Fl:U,Gh:C,Gl:z,Hh:E,Hl:F}=this;return[D,$,J,Q,G,q,X,Y,Z,K,j,U,C,z,E,F]}set(D,$,J,Q,G,q,X,Y,Z,K,j,U,C,z,E,F){this.Ah=D|0,this.Al=$|0,this.Bh=J|0,this.Bl=Q|0,this.Ch=G|0,this.Cl=q|0,this.Dh=X|0,this.Dl=Y|0,this.Eh=Z|0,this.El=K|0,this.Fh=j|0,this.Fl=U|0,this.Gh=C|0,this.Gl=z|0,this.Hh=E|0,this.Hl=F|0}process(D,$){for(let N=0;N<16;N++,$+=4)$0[N]=D.getUint32($),J0[N]=D.getUint32($+=4);for(let N=16;N<80;N++){let I=$0[N-15]|0,O=J0[N-15]|0,y=F0(I,O,1)^F0(I,O,8)^d7(I,O,7),p=L0(I,O,1)^L0(I,O,8)^c7(I,O,7),m=$0[N-2]|0,T=J0[N-2]|0,w=F0(m,T,19)^E8(m,T,61)^d7(m,T,6),h=L0(m,T,19)^z8(m,T,61)^c7(m,T,6),u=lJ(p,h,J0[N-7],J0[N-16]),L=pJ(u,y,w,$0[N-7],$0[N-16]);$0[N]=L|0,J0[N]=u|0}let{Ah:J,Al:Q,Bh:G,Bl:q,Ch:X,Cl:Y,Dh:Z,Dl:K,Eh:j,El:U,Fh:C,Fl:z,Gh:E,Gl:F,Hh:W,Hl:H}=this;for(let N=0;N<80;N++){let I=F0(j,U,14)^F0(j,U,18)^E8(j,U,41),O=L0(j,U,14)^L0(j,U,18)^z8(j,U,41),y=j&C^~j&E,p=U&z^~U&F,m=dJ(H,O,p,zZ[N],J0[N]),T=cJ(m,W,I,y,EZ[N],$0[N]),w=m|0,h=F0(J,Q,28)^E8(J,Q,34)^E8(J,Q,39),u=L0(J,Q,28)^z8(J,Q,34)^z8(J,Q,39),L=J&G^J&X^G&X,R=Q&q^Q&Y^q&Y;W=E|0,H=F|0,E=C|0,F=z|0,C=j|0,z=U|0,{h:j,l:U}=vD(Z|0,K|0,T|0,w|0),Z=X|0,K=Y|0,X=G|0,Y=q|0,G=J|0,q=Q|0;let V=uJ(w,u,R);J=gJ(V,T,h,L),Q=V|0}({h:J,l:Q}=vD(this.Ah|0,this.Al|0,J|0,Q|0)),{h:G,l:q}=vD(this.Bh|0,this.Bl|0,G|0,q|0),{h:X,l:Y}=vD(this.Ch|0,this.Cl|0,X|0,Y|0),{h:Z,l:K}=vD(this.Dh|0,this.Dl|0,Z|0,K|0),{h:j,l:U}=vD(this.Eh|0,this.El|0,j|0,U|0),{h:C,l:z}=vD(this.Fh|0,this.Fl|0,C|0,z|0),{h:E,l:F}=vD(this.Gh|0,this.Gl|0,E|0,F|0),{h:W,l:H}=vD(this.Hh|0,this.Hl|0,W|0,H|0),this.set(J,Q,G,q,X,Y,Z,K,j,U,C,z,E,F,W,H)}roundClean(){GD($0,J0)}destroy(){GD(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class rJ extends C8{Ah=KD[0]|0;Al=KD[1]|0;Bh=KD[2]|0;Bl=KD[3]|0;Ch=KD[4]|0;Cl=KD[5]|0;Dh=KD[6]|0;Dl=KD[7]|0;Eh=KD[8]|0;El=KD[9]|0;Fh=KD[10]|0;Fl=KD[11]|0;Gh=KD[12]|0;Gl=KD[13]|0;Hh=KD[14]|0;Hl=KD[15]|0;constructor(){super(64)}}class CZ extends C8{Ah=ZD[0]|0;Al=ZD[1]|0;Bh=ZD[2]|0;Bl=ZD[3]|0;Ch=ZD[4]|0;Cl=ZD[5]|0;Dh=ZD[6]|0;Dl=ZD[7]|0;Eh=ZD[8]|0;El=ZD[9]|0;Fh=ZD[10]|0;Fl=ZD[11]|0;Gh=ZD[12]|0;Gl=ZD[13]|0;Hh=ZD[14]|0;Hl=ZD[15]|0;constructor(){super(48)}}var WD=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),ED=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class HZ extends C8{Ah=WD[0]|0;Al=WD[1]|0;Bh=WD[2]|0;Bl=WD[3]|0;Ch=WD[4]|0;Cl=WD[5]|0;Dh=WD[6]|0;Dl=WD[7]|0;Eh=WD[8]|0;El=WD[9]|0;Fh=WD[10]|0;Fl=WD[11]|0;Gh=WD[12]|0;Gl=WD[13]|0;Hh=WD[14]|0;Hl=WD[15]|0;constructor(){super(28)}}class NZ extends C8{Ah=ED[0]|0;Al=ED[1]|0;Bh=ED[2]|0;Bl=ED[3]|0;Ch=ED[4]|0;Cl=ED[5]|0;Dh=ED[6]|0;Dl=ED[7]|0;Eh=ED[8]|0;El=ED[9]|0;Fh=ED[10]|0;Fl=ED[11]|0;Gh=ED[12]|0;Gl=ED[13]|0;Hh=ED[14]|0;Hl=ED[15]|0;constructor(){super(32)}}var B0=W8(()=>new aJ,p7(1));var R0=W8(()=>new rJ,p7(3));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var r7=BigInt(0),i7=BigInt(1);function aD(D,$=""){if(typeof D!=="boolean"){let J=$&&`"${$}" `;throw Error(J+"expected boolean, got type="+typeof D)}return D}function oJ(D){if(typeof D==="bigint"){if(!Q9(D))throw Error("positive bigint expected, got "+D)}else UD(D);return D}function H8(D){let $=oJ(D).toString(16);return $.length&1?"0"+$:$}function sJ(D){if(typeof D!=="string")throw Error("hex string expected, got "+typeof D);return D===""?r7:BigInt("0x"+D)}function p0(D){return sJ(lD(D))}function I0(D){return sJ(lD(q9(x(D)).reverse()))}function G9(D,$){UD($),D=oJ(D);let J=pD(D.toString(16).padStart($*2,"0"));if(J.length!==$)throw Error("number too large");return J}function o7(D,$){return G9(D,$).reverse()}function q9(D){return Uint8Array.from(D)}var Q9=(D)=>typeof D==="bigint"&&r7<=D;function VZ(D,$,J){return Q9(D)&&Q9($)&&Q9(J)&&$<=D&&D<J}function N8(D,$,J,Q){if(!VZ($,J,Q))throw Error("expected valid "+D+": "+J+" <= n < "+Q+", got "+$)}function s7(D){let $;for($=0;D>r7;D>>=i7,$+=1);return $}var V8=(D)=>(i7<<BigInt(D))-i7;function nJ(D,$,J){if(UD(D,"hashLen"),UD($,"qByteLen"),typeof J!=="function")throw Error("hmacFn must be a function");let Q=(W)=>new Uint8Array(W),G=Uint8Array.of(),q=Uint8Array.of(0),X=Uint8Array.of(1),Y=1000,Z=Q(D),K=Q(D),j=0,U=()=>{Z.fill(1),K.fill(0),j=0},C=(...W)=>J(K,$D(Z,...W)),z=(W=G)=>{if(K=C(q,W),Z=C(),W.length===0)return;K=C(X,W),Z=C()},E=()=>{if(j++>=Y)throw Error("drbg: tried max amount of iterations");let W=0,H=[];while(W<$){Z=C();let N=Z.slice();H.push(N),W+=Z.length}return $D(...H)};return(W,H)=>{U(),z(W);let N=void 0;while(!(N=H(E())))z();return U(),N}}function Q0(D,$={},J={}){if(!D||typeof D!=="object")throw Error("expected valid options object");function Q(q,X,Y){let Z=D[q];if(Y&&Z===void 0)return;let K=typeof Z;if(K!==X||Z===null)throw Error(`param "${q}" is invalid: expected ${X}, got ${K}`)}let G=(q,X)=>Object.entries(q).forEach(([Y,Z])=>Q(Y,Z,X));G($,!1),G(J,!0)}function d0(D){let $=new WeakMap;return(J,...Q)=>{let G=$.get(J);if(G!==void 0)return G;let q=D(J,...Q);return $.set(J,q),q}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var HD=BigInt(0),qD=BigInt(1),w0=BigInt(2),DQ=BigInt(3),$Q=BigInt(4),JQ=BigInt(5),FZ=BigInt(7),QQ=BigInt(8),LZ=BigInt(9),GQ=BigInt(16);function n(D,$){let J=D%$;return J>=HD?J:$+J}function o(D,$,J){let Q=D;while($-- >HD)Q*=Q,Q%=J;return Q}function tJ(D,$){if(D===HD)throw Error("invert: expected non-zero number");if($<=HD)throw Error("invert: expected positive modulus, got "+$);let J=n(D,$),Q=$,G=HD,q=qD,X=qD,Y=HD;while(J!==HD){let K=Q/J,j=Q%J,U=G-X*K,C=q-Y*K;Q=J,J=j,G=X,q=Y,X=U,Y=C}if(Q!==qD)throw Error("invert: does not exist");return n(G,$)}function n7(D,$,J){if(!D.eql(D.sqr($),J))throw Error("Cannot find square root")}function qQ(D,$){let J=(D.ORDER+qD)/$Q,Q=D.pow($,J);return n7(D,Q,$),Q}function BZ(D,$){let J=(D.ORDER-JQ)/QQ,Q=D.mul($,w0),G=D.pow(Q,J),q=D.mul($,G),X=D.mul(D.mul(q,w0),G),Y=D.mul(q,D.sub(X,D.ONE));return n7(D,Y,$),Y}function RZ(D){let $=c0(D),J=XQ(D),Q=J($,$.neg($.ONE)),G=J($,Q),q=J($,$.neg(Q)),X=(D+FZ)/GQ;return(Y,Z)=>{let K=Y.pow(Z,X),j=Y.mul(K,Q),U=Y.mul(K,G),C=Y.mul(K,q),z=Y.eql(Y.sqr(j),Z),E=Y.eql(Y.sqr(U),Z);K=Y.cmov(K,j,z),j=Y.cmov(C,U,E);let F=Y.eql(Y.sqr(j),Z),W=Y.cmov(K,j,F);return n7(Y,W,Z),W}}function XQ(D){if(D<DQ)throw Error("sqrt is not defined for small field");let $=D-qD,J=0;while($%w0===HD)$/=w0,J++;let Q=w0,G=c0(D);while(eJ(G,Q)===1)if(Q++>1000)throw Error("Cannot find square root: probably non-prime P");if(J===1)return qQ;let q=G.pow(Q,$),X=($+qD)/w0;return function(Z,K){if(Z.is0(K))return K;if(eJ(Z,K)!==1)throw Error("Cannot find square root");let j=J,U=Z.mul(Z.ONE,q),C=Z.pow(K,$),z=Z.pow(K,X);while(!Z.eql(C,Z.ONE)){if(Z.is0(C))return Z.ZERO;let E=1,F=Z.sqr(C);while(!Z.eql(F,Z.ONE))if(E++,F=Z.sqr(F),E===j)throw Error("Cannot find square root");let W=qD<<BigInt(j-E-1),H=Z.pow(U,W);j=E,U=Z.sqr(H),C=Z.mul(C,U),z=Z.mul(z,H)}return z}}function IZ(D){if(D%$Q===DQ)return qQ;if(D%QQ===JQ)return BZ;if(D%GQ===LZ)return RZ(D);return XQ(D)}var YQ=(D,$)=>(n(D,$)&qD)===qD,wZ=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function t7(D){let $={ORDER:"bigint",BYTES:"number",BITS:"number"},J=wZ.reduce((Q,G)=>{return Q[G]="function",Q},$);return Q0(D,J),D}function OZ(D,$,J){if(J<HD)throw Error("invalid exponent, negatives unsupported");if(J===HD)return D.ONE;if(J===qD)return $;let Q=D.ONE,G=$;while(J>HD){if(J&qD)Q=D.mul(Q,G);G=D.sqr(G),J>>=qD}return Q}function F8(D,$,J=!1){let Q=Array($.length).fill(J?D.ZERO:void 0),G=$.reduce((X,Y,Z)=>{if(D.is0(Y))return X;return Q[Z]=X,D.mul(X,Y)},D.ONE),q=D.inv(G);return $.reduceRight((X,Y,Z)=>{if(D.is0(Y))return X;return Q[Z]=D.mul(X,Q[Z]),D.mul(X,Y)},q),Q}function eJ(D,$){let J=(D.ORDER-qD)/w0,Q=D.pow($,J),G=D.eql(Q,D.ONE),q=D.eql(Q,D.ZERO),X=D.eql(Q,D.neg(D.ONE));if(!G&&!q&&!X)throw Error("invalid Legendre symbol result");return G?1:q?0:-1}function TZ(D,$){if($!==void 0)UD($);let J=$!==void 0?$:D.toString(2).length,Q=Math.ceil(J/8);return{nBitLength:J,nByteLength:Q}}class ZQ{ORDER;BITS;BYTES;isLE;ZERO=HD;ONE=qD;_lengths;_sqrt;_mod;constructor(D,$={}){if(D<=HD)throw Error("invalid field: expected ORDER > 0, got "+D);let J=void 0;if(this.isLE=!1,$!=null&&typeof $==="object"){if(typeof $.BITS==="number")J=$.BITS;if(typeof $.sqrt==="function")this.sqrt=$.sqrt;if(typeof $.isLE==="boolean")this.isLE=$.isLE;if($.allowedLengths)this._lengths=$.allowedLengths?.slice();if(typeof $.modFromBytes==="boolean")this._mod=$.modFromBytes}let{nBitLength:Q,nByteLength:G}=TZ(D,J);if(G>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=D,this.BITS=Q,this.BYTES=G,this._sqrt=void 0,Object.preventExtensions(this)}create(D){return n(D,this.ORDER)}isValid(D){if(typeof D!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof D);return HD<=D&&D<this.ORDER}is0(D){return D===HD}isValidNot0(D){return!this.is0(D)&&this.isValid(D)}isOdd(D){return(D&qD)===qD}neg(D){return n(-D,this.ORDER)}eql(D,$){return D===$}sqr(D){return n(D*D,this.ORDER)}add(D,$){return n(D+$,this.ORDER)}sub(D,$){return n(D-$,this.ORDER)}mul(D,$){return n(D*$,this.ORDER)}pow(D,$){return OZ(this,D,$)}div(D,$){return n(D*tJ($,this.ORDER),this.ORDER)}sqrN(D){return D*D}addN(D,$){return D+$}subN(D,$){return D-$}mulN(D,$){return D*$}inv(D){return tJ(D,this.ORDER)}sqrt(D){if(!this._sqrt)this._sqrt=IZ(this.ORDER);return this._sqrt(this,D)}toBytes(D){return this.isLE?o7(D,this.BYTES):G9(D,this.BYTES)}fromBytes(D,$=!1){x(D);let{_lengths:J,BYTES:Q,isLE:G,ORDER:q,_mod:X}=this;if(J){if(!J.includes(D.length)||D.length>Q)throw Error("Field.fromBytes: expected "+J+" bytes, got "+D.length);let Z=new Uint8Array(Q);Z.set(D,G?0:Z.length-D.length),D=Z}if(D.length!==Q)throw Error("Field.fromBytes: expected "+Q+" bytes, got "+D.length);let Y=G?I0(D):p0(D);if(X)Y=n(Y,q);if(!$){if(!this.isValid(Y))throw Error("invalid field element: outside of range 0..ORDER")}return Y}invertBatch(D){return F8(this,D)}cmov(D,$,J){return J?$:D}}function c0(D,$={}){return new ZQ(D,$)}function KQ(D){if(typeof D!=="bigint")throw Error("field order must be bigint");let $=D.toString(2).length;return Math.ceil($/8)}function e7(D){let $=KQ(D);return $+Math.ceil($/2)}function D6(D,$,J=!1){x(D);let Q=D.length,G=KQ($),q=e7($);if(Q<16||Q<q||Q>1024)throw Error("expected "+q+"-1024 bytes of input, got "+Q);let X=J?I0(D):p0(D),Y=n(X,$-qD)+qD;return J?o7(Y,G):G9(Y,G)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var a0=BigInt(0),O0=BigInt(1);function L8(D,$){let J=$.negate();return D?J:$}function T0(D,$){let J=F8(D.Fp,$.map((Q)=>Q.Z));return $.map((Q,G)=>D.fromAffine(Q.toAffine(J[G])))}function EQ(D,$){if(!Number.isSafeInteger(D)||D<=0||D>$)throw Error("invalid window size, expected [1.."+$+"], got W="+D)}function $6(D,$){EQ(D,$);let J=Math.ceil($/D)+1,Q=2**(D-1),G=2**D,q=V8(D),X=BigInt(D);return{windows:J,windowSize:Q,mask:q,maxNumber:G,shiftBy:X}}function jQ(D,$,J){let{windowSize:Q,mask:G,maxNumber:q,shiftBy:X}=J,Y=Number(D&G),Z=D>>X;if(Y>Q)Y-=q,Z+=O0;let K=$*Q,j=K+Math.abs(Y)-1,U=Y===0,C=Y<0,z=$%2!==0;return{nextN:Z,offset:j,isZero:U,isNeg:C,isNegF:z,offsetF:K}}var J6=new WeakMap,zQ=new WeakMap;function Q6(D){return zQ.get(D)||1}function UQ(D){if(D!==a0)throw Error("invalid wNAF")}class B8{BASE;ZERO;Fn;bits;constructor(D,$){this.BASE=D.BASE,this.ZERO=D.ZERO,this.Fn=D.Fn,this.bits=$}_unsafeLadder(D,$,J=this.ZERO){let Q=D;while($>a0){if($&O0)J=J.add(Q);Q=Q.double(),$>>=O0}return J}precomputeWindow(D,$){let{windows:J,windowSize:Q}=$6($,this.bits),G=[],q=D,X=q;for(let Y=0;Y<J;Y++){X=q,G.push(X);for(let Z=1;Z<Q;Z++)X=X.add(q),G.push(X);q=X.double()}return G}wNAF(D,$,J){if(!this.Fn.isValid(J))throw Error("invalid scalar");let Q=this.ZERO,G=this.BASE,q=$6(D,this.bits);for(let X=0;X<q.windows;X++){let{nextN:Y,offset:Z,isZero:K,isNeg:j,isNegF:U,offsetF:C}=jQ(J,X,q);if(J=Y,K)G=G.add(L8(U,$[C]));else Q=Q.add(L8(j,$[Z]))}return UQ(J),{p:Q,f:G}}wNAFUnsafe(D,$,J,Q=this.ZERO){let G=$6(D,this.bits);for(let q=0;q<G.windows;q++){if(J===a0)break;let{nextN:X,offset:Y,isZero:Z,isNeg:K}=jQ(J,q,G);if(J=X,Z)continue;else{let j=$[Y];Q=Q.add(K?j.negate():j)}}return UQ(J),Q}getPrecomputes(D,$,J){let Q=J6.get($);if(!Q){if(Q=this.precomputeWindow($,D),D!==1){if(typeof J==="function")Q=J(Q);J6.set($,Q)}}return Q}cached(D,$,J){let Q=Q6(D);return this.wNAF(Q,this.getPrecomputes(Q,D,J),$)}unsafe(D,$,J,Q){let G=Q6(D);if(G===1)return this._unsafeLadder(D,$,Q);return this.wNAFUnsafe(G,this.getPrecomputes(G,D,J),$,Q)}createCache(D,$){EQ($,this.bits),zQ.set(D,$),J6.delete(D)}hasCache(D){return Q6(D)!==1}}function CQ(D,$,J,Q){let G=$,q=D.ZERO,X=D.ZERO;while(J>a0||Q>a0){if(J&O0)q=q.add(G);if(Q&O0)X=X.add(G);G=G.double(),J>>=O0,Q>>=O0}return{p1:q,p2:X}}function WQ(D,$,J){if($){if($.ORDER!==D)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return t7($),$}else return c0(D,{isLE:J})}function X9(D,$,J={},Q){if(Q===void 0)Q=D==="edwards";if(!$||typeof $!=="object")throw Error(`expected valid ${D} CURVE object`);for(let Z of["p","n","h"]){let K=$[Z];if(!(typeof K==="bigint"&&K>a0))throw Error(`CURVE.${Z} must be positive bigint`)}let G=WQ($.p,J.Fp,Q),q=WQ($.n,J.Fn,Q),Y=["Gx","Gy","a",D==="weierstrass"?"b":"d"];for(let Z of Y)if(!G.isValid($[Z]))throw Error(`CURVE.${Z} must be valid field element of CURVE.Fp`);return $=Object.freeze(Object.assign({},$)),{CURVE:$,Fp:G,Fn:q}}function Y9(D,$){return function(Q){let G=D(Q);return{secretKey:G,publicKey:$(G)}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var G0=BigInt(0),XD=BigInt(1),G6=BigInt(2),MZ=BigInt(8);function PZ(D,$,J,Q){let G=D.sqr(J),q=D.sqr(Q),X=D.add(D.mul($.a,G),q),Y=D.add(D.ONE,D.mul($.d,D.mul(G,q)));return D.eql(X,Y)}function HQ(D,$={}){let J=X9("edwards",D,$,$.FpFnLE),{Fp:Q,Fn:G}=J,q=J.CURVE,{h:X}=q;Q0($,{},{uvRatio:"function"});let Y=G6<<BigInt(G.BYTES*8)-XD,Z=(W)=>Q.create(W),K=$.uvRatio||((W,H)=>{try{return{isValid:!0,value:Q.sqrt(Q.div(W,H))}}catch(N){return{isValid:!1,value:G0}}});if(!PZ(Q,q,q.Gx,q.Gy))throw Error("bad curve params: generator point");function j(W,H,N=!1){let I=N?XD:G0;return N8("coordinate "+W,H,I,Y),H}function U(W){if(!(W instanceof E))throw Error("EdwardsPoint expected")}let C=d0((W,H)=>{let{X:N,Y:I,Z:O}=W,y=W.is0();if(H==null)H=y?MZ:Q.inv(O);let p=Z(N*H),m=Z(I*H),T=Q.mul(O,H);if(y)return{x:G0,y:XD};if(T!==XD)throw Error("invZ was invalid");return{x:p,y:m}}),z=d0((W)=>{let{a:H,d:N}=q;if(W.is0())throw Error("bad point: ZERO");let{X:I,Y:O,Z:y,T:p}=W,m=Z(I*I),T=Z(O*O),w=Z(y*y),h=Z(w*w),u=Z(m*H),L=Z(w*Z(u+T)),R=Z(h+Z(N*Z(m*T)));if(L!==R)throw Error("bad point: equation left != right (1)");let V=Z(I*O),B=Z(y*p);if(V!==B)throw Error("bad point: equation left != right (2)");return!0});class E{static BASE=new E(q.Gx,q.Gy,XD,Z(q.Gx*q.Gy));static ZERO=new E(G0,XD,XD,G0);static Fp=Q;static Fn=G;X;Y;Z;T;constructor(W,H,N,I){this.X=j("x",W),this.Y=j("y",H),this.Z=j("z",N,!0),this.T=j("t",I),Object.freeze(this)}static CURVE(){return q}static fromAffine(W){if(W instanceof E)throw Error("extended point not allowed");let{x:H,y:N}=W||{};return j("x",H),j("y",N),new E(H,N,XD,Z(H*N))}static fromBytes(W,H=!1){let N=Q.BYTES,{a:I,d:O}=q;W=q9(x(W,N,"point")),aD(H,"zip215");let y=q9(W),p=W[N-1];y[N-1]=p&-129;let m=I0(y),T=H?Y:Q.ORDER;N8("point.y",m,G0,T);let w=Z(m*m),h=Z(w-XD),u=Z(O*w-I),{isValid:L,value:R}=K(h,u);if(!L)throw Error("bad point: invalid y coordinate");let V=(R&XD)===XD,B=(p&128)!==0;if(!H&&R===G0&&B)throw Error("bad point: x=0 and x_0=1");if(B!==V)R=Z(-R);return E.fromAffine({x:R,y:m})}static fromHex(W,H=!1){return E.fromBytes(pD(W),H)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(W=8,H=!0){if(F.createCache(this,W),!H)this.multiply(G6);return this}assertValidity(){z(this)}equals(W){U(W);let{X:H,Y:N,Z:I}=this,{X:O,Y:y,Z:p}=W,m=Z(H*p),T=Z(O*I),w=Z(N*p),h=Z(y*I);return m===T&&w===h}is0(){return this.equals(E.ZERO)}negate(){return new E(Z(-this.X),this.Y,this.Z,Z(-this.T))}double(){let{a:W}=q,{X:H,Y:N,Z:I}=this,O=Z(H*H),y=Z(N*N),p=Z(G6*Z(I*I)),m=Z(W*O),T=H+N,w=Z(Z(T*T)-O-y),h=m+y,u=h-p,L=m-y,R=Z(w*u),V=Z(h*L),B=Z(w*L),M=Z(u*h);return new E(R,V,M,B)}add(W){U(W);let{a:H,d:N}=q,{X:I,Y:O,Z:y,T:p}=this,{X:m,Y:T,Z:w,T:h}=W,u=Z(I*m),L=Z(O*T),R=Z(p*N*h),V=Z(y*w),B=Z((I+O)*(m+T)-u-L),M=V-R,S=V+R,P=Z(L-H*u),_=Z(B*M),k=Z(S*P),A=Z(B*P),t=Z(M*S);return new E(_,k,t,A)}subtract(W){return this.add(W.negate())}multiply(W){if(!G.isValidNot0(W))throw Error("invalid scalar: expected 1 <= sc < curve.n");let{p:H,f:N}=F.cached(this,W,(I)=>T0(E,I));return T0(E,[H,N])[0]}multiplyUnsafe(W,H=E.ZERO){if(!G.isValid(W))throw Error("invalid scalar: expected 0 <= sc < curve.n");if(W===G0)return E.ZERO;if(this.is0()||W===XD)return this;return F.unsafe(this,W,(N)=>T0(E,N),H)}isSmallOrder(){return this.multiplyUnsafe(X).is0()}isTorsionFree(){return F.unsafe(this,q.n).is0()}toAffine(W){return C(this,W)}clearCofactor(){if(X===XD)return this;return this.multiplyUnsafe(X)}toBytes(){let{x:W,y:H}=this.toAffine(),N=Q.toBytes(H);return N[N.length-1]|=W&XD?128:0,N}toHex(){return lD(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let F=new B8(E,G.BITS);return E.BASE.precompute(8),E}function NQ(D,$,J={}){if(typeof $!=="function")throw Error('"hash" function param is required');Q0(J,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:Q}=J,{BASE:G,Fp:q,Fn:X}=D,Y=J.randomBytes||tD,Z=J.adjustScalarBytes||((T)=>T),K=J.domain||((T,w,h)=>{if(aD(h,"phflag"),w.length||h)throw Error("Contexts/pre-hash are not supported");return T});function j(T){return X.create(I0(T))}function U(T){let w=I.secretKey;x(T,I.secretKey,"secretKey");let h=x($(T),2*w,"hashedSecretKey"),u=Z(h.slice(0,w)),L=h.slice(w,2*w),R=j(u);return{head:u,prefix:L,scalar:R}}function C(T){let{head:w,prefix:h,scalar:u}=U(T),L=G.multiply(u),R=L.toBytes();return{head:w,prefix:h,scalar:u,point:L,pointBytes:R}}function z(T){return C(T).pointBytes}function E(T=Uint8Array.of(),...w){let h=$D(...w);return j($(K(h,x(T,void 0,"context"),!!Q)))}function F(T,w,h={}){if(T=x(T,void 0,"message"),Q)T=Q(T);let{prefix:u,scalar:L,pointBytes:R}=C(w),V=E(h.context,u,T),B=G.multiply(V).toBytes(),M=E(h.context,B,R,T),S=X.create(V+M*L);if(!X.isValid(S))throw Error("sign failed: invalid s");let P=$D(B,X.toBytes(S));return x(P,I.signature,"result")}let W={zip215:!0};function H(T,w,h,u=W){let{context:L,zip215:R}=u,V=I.signature;if(T=x(T,V,"signature"),w=x(w,void 0,"message"),h=x(h,I.publicKey,"publicKey"),R!==void 0)aD(R,"zip215");if(Q)w=Q(w);let B=V/2,M=T.subarray(0,B),S=I0(T.subarray(B,V)),P,_,k;try{P=D.fromBytes(h,R),_=D.fromBytes(M,R),k=G.multiplyUnsafe(S)}catch(a){return!1}if(!R&&P.isSmallOrder())return!1;let A=E(L,_.toBytes(),P.toBytes(),w);return _.add(P.multiplyUnsafe(A)).subtract(k).clearCofactor().is0()}let N=q.BYTES,I={secretKey:N,publicKey:N,signature:2*N,seed:N};function O(T=Y(I.seed)){return x(T,I.seed,"seed")}function y(T){return V0(T)&&T.length===X.BYTES}function p(T,w){try{return!!D.fromBytes(T,w)}catch(h){return!1}}let m={getExtendedPublicKey:C,randomSecretKey:O,isValidSecretKey:y,isValidPublicKey:p,toMontgomery(T){let{y:w}=D.fromBytes(T),h=I.publicKey,u=h===32;if(!u&&h!==57)throw Error("only defined for 25519 and 448");let L=u?q.div(XD+w,XD-w):q.div(w-XD,w+XD);return q.toBytes(L)},toMontgomerySecret(T){let w=I.secretKey;x(T,w);let h=$(T.subarray(0,w));return Z(h).subarray(0,w)}};return Object.freeze({keygen:Y9(O,z),getPublicKey:z,sign:F,verify:H,utils:m,Point:D,lengths:I})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var SZ=BigInt(1),VQ=BigInt(2);var _Z=BigInt(5),kZ=BigInt(8),q6=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),AZ=(()=>({p:q6,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:kZ,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();function xZ(D){let $=BigInt(10),J=BigInt(20),Q=BigInt(40),G=BigInt(80),q=q6,Y=D*D%q*D%q,Z=o(Y,VQ,q)*Y%q,K=o(Z,SZ,q)*D%q,j=o(K,_Z,q)*K%q,U=o(j,$,q)*j%q,C=o(U,J,q)*U%q,z=o(C,Q,q)*C%q,E=o(z,G,q)*z%q,F=o(E,G,q)*z%q,W=o(F,$,q)*j%q;return{pow_p_5_8:o(W,VQ,q)*D%q,b2:Y}}function bZ(D){return D[0]&=248,D[31]&=127,D[31]|=64,D}var FQ=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function hZ(D,$){let J=q6,Q=n($*$*$,J),G=n(Q*Q*$,J),q=xZ(D*G).pow_p_5_8,X=n(D*Q*q,J),Y=n($*X*X,J),Z=X,K=n(X*FQ,J),j=Y===D,U=Y===n(-D,J),C=Y===n(-D*FQ,J);if(j)X=Z;if(U||C)X=K;if(YQ(X,J))X=n(-X,J);return{isValid:j||U,value:X}}var vZ=HQ(AZ,{uvRatio:hZ});function yZ(D){return NQ(vZ,R0,Object.assign({adjustScalarBytes:bZ},D))}var X6=yZ({});class Y6{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(D,$){if(u0(D),x($,void 0,"key"),this.iHash=D.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let J=this.blockLen,Q=new Uint8Array(J);Q.set($.length>J?D.create().update($).digest():$);for(let G=0;G<Q.length;G++)Q[G]^=54;this.iHash.update(Q),this.oHash=D.create();for(let G=0;G<Q.length;G++)Q[G]^=106;this.oHash.update(Q),GD(Q)}update(D){return g0(this),this.iHash.update(D),this}digestInto(D){g0(this),x(D,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(D),this.oHash.update(D),this.oHash.digestInto(D),this.destroy()}digest(){let D=new Uint8Array(this.oHash.outputLen);return this.digestInto(D),D}_cloneInto(D){D||=Object.create(Object.getPrototypeOf(this),{});let{oHash:$,iHash:J,finished:Q,destroyed:G,blockLen:q,outputLen:X}=this;return D=D,D.finished=Q,D.destroyed=G,D.blockLen=q,D.outputLen=X,D.oHash=$._cloneInto(D.oHash),D.iHash=J._cloneInto(D.iHash),D}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var q0=(D,$,J)=>new Y6(D,$).update(J).digest();q0.create=(D,$)=>new Y6(D,$);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var LQ=(D,$)=>(D+(D>=0?$:-$)/RQ)/$;function fZ(D,$,J){let[[Q,G],[q,X]]=$,Y=LQ(X*D,J),Z=LQ(-G*D,J),K=D-Y*Q-Z*q,j=-Y*G-Z*X,U=K<iD,C=j<iD;if(U)K=-K;if(C)j=-j;let z=V8(Math.ceil(s7(J)/2))+i0;if(K<iD||K>=z||j<iD||j>=z)throw Error("splitScalar (endomorphism): failed, k="+D);return{k1neg:U,k1:K,k2neg:C,k2:j}}function K6(D){if(!["compact","recovered","der"].includes(D))throw Error('Signature format must be "compact", "recovered", or "der"');return D}function Z6(D,$){let J={};for(let Q of Object.keys($))J[Q]=D[Q]===void 0?$[Q]:D[Q];if(aD(J.lowS,"lowS"),aD(J.prehash,"prehash"),J.format!==void 0)K6(J.format);return J}class BQ extends Error{constructor(D=""){super(D)}}var X0={Err:BQ,_tlv:{encode:(D,$)=>{let{Err:J}=X0;if(D<0||D>256)throw new J("tlv.encode: wrong tag");if($.length&1)throw new J("tlv.encode: unpadded data");let Q=$.length/2,G=H8(Q);if(G.length/2&128)throw new J("tlv.encode: long form length too big");let q=Q>127?H8(G.length/2|128):"";return H8(D)+q+G+$},decode(D,$){let{Err:J}=X0,Q=0;if(D<0||D>256)throw new J("tlv.encode: wrong tag");if($.length<2||$[Q++]!==D)throw new J("tlv.decode: wrong tlv");let G=$[Q++],q=!!(G&128),X=0;if(!q)X=G;else{let Z=G&127;if(!Z)throw new J("tlv.decode(long): indefinite length not supported");if(Z>4)throw new J("tlv.decode(long): byte length is too big");let K=$.subarray(Q,Q+Z);if(K.length!==Z)throw new J("tlv.decode: length bytes not complete");if(K[0]===0)throw new J("tlv.decode(long): zero leftmost byte");for(let j of K)X=X<<8|j;if(Q+=Z,X<128)throw new J("tlv.decode(long): not minimal encoding")}let Y=$.subarray(Q,Q+X);if(Y.length!==X)throw new J("tlv.decode: wrong value length");return{v:Y,l:$.subarray(Q+X)}}},_int:{encode(D){let{Err:$}=X0;if(D<iD)throw new $("integer: negative integers are not allowed");let J=H8(D);if(Number.parseInt(J[0],16)&8)J="00"+J;if(J.length&1)throw new $("unexpected DER parsing assertion: unpadded hex");return J},decode(D){let{Err:$}=X0;if(D[0]&128)throw new $("invalid signature integer: negative");if(D[0]===0&&!(D[1]&128))throw new $("invalid signature integer: unnecessary leading zero");return p0(D)}},toSig(D){let{Err:$,_int:J,_tlv:Q}=X0,G=x(D,void 0,"signature"),{v:q,l:X}=Q.decode(48,G);if(X.length)throw new $("invalid signature: left bytes after parsing");let{v:Y,l:Z}=Q.decode(2,q),{v:K,l:j}=Q.decode(2,Z);if(j.length)throw new $("invalid signature: left bytes after parsing");return{r:J.decode(Y),s:J.decode(K)}},hexFromSig(D){let{_tlv:$,_int:J}=X0,Q=$.encode(2,J.encode(D.r)),G=$.encode(2,J.encode(D.s)),q=Q+G;return $.encode(48,q)}},iD=BigInt(0),i0=BigInt(1),RQ=BigInt(2),Z9=BigInt(3),mZ=BigInt(4);function IQ(D,$={}){let J=X9("weierstrass",D,$),{Fp:Q,Fn:G}=J,q=J.CURVE,{h:X,n:Y}=q;Q0($,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:Z}=$;if(Z){if(!Q.is0(q.a)||typeof Z.beta!=="bigint"||!Array.isArray(Z.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let K=OQ(Q,G);function j(){if(!Q.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function U(L,R,V){let{x:B,y:M}=R.toAffine(),S=Q.toBytes(B);if(aD(V,"isCompressed"),V){j();let P=!Q.isOdd(M);return $D(wQ(P),S)}else return $D(Uint8Array.of(4),S,Q.toBytes(M))}function C(L){x(L,void 0,"Point");let{publicKey:R,publicKeyUncompressed:V}=K,B=L.length,M=L[0],S=L.subarray(1);if(B===R&&(M===2||M===3)){let P=Q.fromBytes(S);if(!Q.isValid(P))throw Error("bad point: is not on curve, wrong x");let _=F(P),k;try{k=Q.sqrt(_)}catch(a){let g=a instanceof Error?": "+a.message:"";throw Error("bad point: is not on curve, sqrt error"+g)}j();let A=Q.isOdd(k);if((M&1)===1!==A)k=Q.neg(k);return{x:P,y:k}}else if(B===V&&M===4){let P=Q.BYTES,_=Q.fromBytes(S.subarray(0,P)),k=Q.fromBytes(S.subarray(P,P*2));if(!W(_,k))throw Error("bad point: is not on curve");return{x:_,y:k}}else throw Error(`bad point: got length ${B}, expected compressed=${R} or uncompressed=${V}`)}let z=$.toBytes||U,E=$.fromBytes||C;function F(L){let R=Q.sqr(L),V=Q.mul(R,L);return Q.add(Q.add(V,Q.mul(L,q.a)),q.b)}function W(L,R){let V=Q.sqr(R),B=F(L);return Q.eql(V,B)}if(!W(q.Gx,q.Gy))throw Error("bad curve params: generator point");let H=Q.mul(Q.pow(q.a,Z9),mZ),N=Q.mul(Q.sqr(q.b),BigInt(27));if(Q.is0(Q.add(H,N)))throw Error("bad curve params: a or b");function I(L,R,V=!1){if(!Q.isValid(R)||V&&Q.is0(R))throw Error(`bad point coordinate ${L}`);return R}function O(L){if(!(L instanceof w))throw Error("Weierstrass Point expected")}function y(L){if(!Z||!Z.basises)throw Error("no endo");return fZ(L,Z.basises,G.ORDER)}let p=d0((L,R)=>{let{X:V,Y:B,Z:M}=L;if(Q.eql(M,Q.ONE))return{x:V,y:B};let S=L.is0();if(R==null)R=S?Q.ONE:Q.inv(M);let P=Q.mul(V,R),_=Q.mul(B,R),k=Q.mul(M,R);if(S)return{x:Q.ZERO,y:Q.ZERO};if(!Q.eql(k,Q.ONE))throw Error("invZ was invalid");return{x:P,y:_}}),m=d0((L)=>{if(L.is0()){if($.allowInfinityPoint&&!Q.is0(L.Y))return;throw Error("bad point: ZERO")}let{x:R,y:V}=L.toAffine();if(!Q.isValid(R)||!Q.isValid(V))throw Error("bad point: x or y not field elements");if(!W(R,V))throw Error("bad point: equation left != right");if(!L.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function T(L,R,V,B,M){return V=new w(Q.mul(V.X,L),V.Y,V.Z),R=L8(B,R),V=L8(M,V),R.add(V)}class w{static BASE=new w(q.Gx,q.Gy,Q.ONE);static ZERO=new w(Q.ZERO,Q.ONE,Q.ZERO);static Fp=Q;static Fn=G;X;Y;Z;constructor(L,R,V){this.X=I("x",L),this.Y=I("y",R,!0),this.Z=I("z",V),Object.freeze(this)}static CURVE(){return q}static fromAffine(L){let{x:R,y:V}=L||{};if(!L||!Q.isValid(R)||!Q.isValid(V))throw Error("invalid affine point");if(L instanceof w)throw Error("projective point not allowed");if(Q.is0(R)&&Q.is0(V))return w.ZERO;return new w(R,V,Q.ONE)}static fromBytes(L){let R=w.fromAffine(E(x(L,void 0,"point")));return R.assertValidity(),R}static fromHex(L){return w.fromBytes(pD(L))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(L=8,R=!0){if(u.createCache(this,L),!R)this.multiply(Z9);return this}assertValidity(){m(this)}hasEvenY(){let{y:L}=this.toAffine();if(!Q.isOdd)throw Error("Field doesn't support isOdd");return!Q.isOdd(L)}equals(L){O(L);let{X:R,Y:V,Z:B}=this,{X:M,Y:S,Z:P}=L,_=Q.eql(Q.mul(R,P),Q.mul(M,B)),k=Q.eql(Q.mul(V,P),Q.mul(S,B));return _&&k}negate(){return new w(this.X,Q.neg(this.Y),this.Z)}double(){let{a:L,b:R}=q,V=Q.mul(R,Z9),{X:B,Y:M,Z:S}=this,P=Q.ZERO,_=Q.ZERO,k=Q.ZERO,A=Q.mul(B,B),t=Q.mul(M,M),a=Q.mul(S,S),g=Q.mul(B,M);return g=Q.add(g,g),k=Q.mul(B,S),k=Q.add(k,k),P=Q.mul(L,k),_=Q.mul(V,a),_=Q.add(P,_),P=Q.sub(t,_),_=Q.add(t,_),_=Q.mul(P,_),P=Q.mul(g,P),k=Q.mul(V,k),a=Q.mul(L,a),g=Q.sub(A,a),g=Q.mul(L,g),g=Q.add(g,k),k=Q.add(A,A),A=Q.add(k,A),A=Q.add(A,a),A=Q.mul(A,g),_=Q.add(_,A),a=Q.mul(M,S),a=Q.add(a,a),A=Q.mul(a,g),P=Q.sub(P,A),k=Q.mul(a,t),k=Q.add(k,k),k=Q.add(k,k),new w(P,_,k)}add(L){O(L);let{X:R,Y:V,Z:B}=this,{X:M,Y:S,Z:P}=L,_=Q.ZERO,k=Q.ZERO,A=Q.ZERO,t=q.a,a=Q.mul(q.b,Z9),g=Q.mul(R,M),e=Q.mul(V,S),JD=Q.mul(B,P),OD=Q.add(R,V),DD=Q.add(M,S);OD=Q.mul(OD,DD),DD=Q.add(g,e),OD=Q.sub(OD,DD),DD=Q.add(R,B);let YD=Q.add(M,P);return DD=Q.mul(DD,YD),YD=Q.add(g,JD),DD=Q.sub(DD,YD),YD=Q.add(V,B),_=Q.add(S,P),YD=Q.mul(YD,_),_=Q.add(e,JD),YD=Q.sub(YD,_),A=Q.mul(t,DD),_=Q.mul(a,JD),A=Q.add(_,A),_=Q.sub(e,A),A=Q.add(e,A),k=Q.mul(_,A),e=Q.add(g,g),e=Q.add(e,g),JD=Q.mul(t,JD),DD=Q.mul(a,DD),e=Q.add(e,JD),JD=Q.sub(g,JD),JD=Q.mul(t,JD),DD=Q.add(DD,JD),g=Q.mul(e,DD),k=Q.add(k,g),g=Q.mul(YD,DD),_=Q.mul(OD,_),_=Q.sub(_,g),g=Q.mul(OD,e),A=Q.mul(YD,A),A=Q.add(A,g),new w(_,k,A)}subtract(L){return this.add(L.negate())}is0(){return this.equals(w.ZERO)}multiply(L){let{endo:R}=$;if(!G.isValidNot0(L))throw Error("invalid scalar: out of range");let V,B,M=(S)=>u.cached(this,S,(P)=>T0(w,P));if(R){let{k1neg:S,k1:P,k2neg:_,k2:k}=y(L),{p:A,f:t}=M(P),{p:a,f:g}=M(k);B=t.add(g),V=T(R.beta,A,a,S,_)}else{let{p:S,f:P}=M(L);V=S,B=P}return T0(w,[V,B])[0]}multiplyUnsafe(L){let{endo:R}=$,V=this;if(!G.isValid(L))throw Error("invalid scalar: out of range");if(L===iD||V.is0())return w.ZERO;if(L===i0)return V;if(u.hasCache(this))return this.multiply(L);if(R){let{k1neg:B,k1:M,k2neg:S,k2:P}=y(L),{p1:_,p2:k}=CQ(w,V,M,P);return T(R.beta,_,k,B,S)}else return u.unsafe(V,L)}toAffine(L){return p(this,L)}isTorsionFree(){let{isTorsionFree:L}=$;if(X===i0)return!0;if(L)return L(w,this);return u.unsafe(this,Y).is0()}clearCofactor(){let{clearCofactor:L}=$;if(X===i0)return this;if(L)return L(w,this);return this.multiplyUnsafe(X)}isSmallOrder(){return this.multiplyUnsafe(X).is0()}toBytes(L=!0){return aD(L,"isCompressed"),this.assertValidity(),z(w,this,L)}toHex(L=!0){return lD(this.toBytes(L))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let h=G.BITS,u=new B8(w,$.endo?Math.ceil(h/2):h);return w.BASE.precompute(8),w}function wQ(D){return Uint8Array.of(D?2:3)}function OQ(D,$){return{secretKey:$.BYTES,publicKey:1+D.BYTES,publicKeyUncompressed:1+2*D.BYTES,publicKeyHasPrefix:!0,signature:2*$.BYTES}}function uZ(D,$={}){let{Fn:J}=D,Q=$.randomBytes||tD,G=Object.assign(OQ(D.Fp,J),{seed:e7(J.ORDER)});function q(z){try{let E=J.fromBytes(z);return J.isValidNot0(E)}catch(E){return!1}}function X(z,E){let{publicKey:F,publicKeyUncompressed:W}=G;try{let H=z.length;if(E===!0&&H!==F)return!1;if(E===!1&&H!==W)return!1;return!!D.fromBytes(z)}catch(H){return!1}}function Y(z=Q(G.seed)){return D6(x(z,G.seed,"seed"),J.ORDER)}function Z(z,E=!0){return D.BASE.multiply(J.fromBytes(z)).toBytes(E)}function K(z){let{secretKey:E,publicKey:F,publicKeyUncompressed:W}=G;if(!V0(z))return;if("_lengths"in J&&J._lengths||E===F)return;let H=x(z,void 0,"key").length;return H===F||H===W}function j(z,E,F=!0){if(K(z)===!0)throw Error("first arg must be private key");if(K(E)===!1)throw Error("second arg must be public key");let W=J.fromBytes(z);return D.fromBytes(E).multiply(W).toBytes(F)}let U={isValidSecretKey:q,isValidPublicKey:X,randomSecretKey:Y},C=Y9(Y,Z);return Object.freeze({getPublicKey:Z,getSharedSecret:j,keygen:C,Point:D,utils:U,lengths:G})}function TQ(D,$,J={}){u0($),Q0(J,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),J=Object.assign({},J);let Q=J.randomBytes||tD,G=J.hmac||((V,B)=>q0($,V,B)),{Fp:q,Fn:X}=D,{ORDER:Y,BITS:Z}=X,{keygen:K,getPublicKey:j,getSharedSecret:U,utils:C,lengths:z}=uZ(D,J),E={prehash:!0,lowS:typeof J.lowS==="boolean"?J.lowS:!0,format:"compact",extraEntropy:!1},F=Y*RQ<q.ORDER;function W(V){let B=Y>>i0;return V>B}function H(V,B){if(!X.isValidNot0(B))throw Error(`invalid signature ${V}: out of range 1..Point.Fn.ORDER`);return B}function N(){if(F)throw Error('"recovered" sig type is not supported for cofactor >2 curves')}function I(V,B){K6(B);let M=z.signature,S=B==="compact"?M:B==="recovered"?M+1:void 0;return x(V,S)}class O{r;s;recovery;constructor(V,B,M){if(this.r=H("r",V),this.s=H("s",B),M!=null){if(N(),![0,1,2,3].includes(M))throw Error("invalid recovery id");this.recovery=M}Object.freeze(this)}static fromBytes(V,B=E.format){I(V,B);let M;if(B==="der"){let{r:k,s:A}=X0.toSig(x(V));return new O(k,A)}if(B==="recovered")M=V[0],B="compact",V=V.subarray(1);let S=z.signature/2,P=V.subarray(0,S),_=V.subarray(S,S*2);return new O(X.fromBytes(P),X.fromBytes(_),M)}static fromHex(V,B){return this.fromBytes(pD(V),B)}assertRecovery(){let{recovery:V}=this;if(V==null)throw Error("invalid recovery id: must be present");return V}addRecoveryBit(V){return new O(this.r,this.s,V)}recoverPublicKey(V){let{r:B,s:M}=this,S=this.assertRecovery(),P=S===2||S===3?B+Y:B;if(!q.isValid(P))throw Error("invalid recovery id: sig.r+curve.n != R.x");let _=q.toBytes(P),k=D.fromBytes($D(wQ((S&1)===0),_)),A=X.inv(P),t=p(x(V,void 0,"msgHash")),a=X.create(-t*A),g=X.create(M*A),e=D.BASE.multiplyUnsafe(a).add(k.multiplyUnsafe(g));if(e.is0())throw Error("invalid recovery: point at infinify");return e.assertValidity(),e}hasHighS(){return W(this.s)}toBytes(V=E.format){if(K6(V),V==="der")return pD(X0.hexFromSig(this));let{r:B,s:M}=this,S=X.toBytes(B),P=X.toBytes(M);if(V==="recovered")return N(),$D(Uint8Array.of(this.assertRecovery()),S,P);return $D(S,P)}toHex(V){return lD(this.toBytes(V))}}let y=J.bits2int||function(B){if(B.length>8192)throw Error("input is too large");let M=p0(B),S=B.length*8-Z;return S>0?M>>BigInt(S):M},p=J.bits2int_modN||function(B){return X.create(y(B))},m=V8(Z);function T(V){return N8("num < 2^"+Z,V,iD,m),X.toBytes(V)}function w(V,B){return x(V,void 0,"message"),B?x($(V),void 0,"prehashed message"):V}function h(V,B,M){let{lowS:S,prehash:P,extraEntropy:_}=Z6(M,E);V=w(V,P);let k=p(V),A=X.fromBytes(B);if(!X.isValidNot0(A))throw Error("invalid private key");let t=[T(A),T(k)];if(_!=null&&_!==!1){let JD=_===!0?Q(z.secretKey):_;t.push(x(JD,void 0,"extraEntropy"))}let a=$D(...t),g=k;function e(JD){let OD=y(JD);if(!X.isValidNot0(OD))return;let DD=X.inv(OD),YD=D.BASE.multiply(OD).toAffine(),D8=X.create(YD.x);if(D8===iD)return;let A8=X.create(DD*X.create(g+D8*A));if(A8===iD)return;let k6=(YD.x===D8?0:2)|Number(YD.y&i0),A6=A8;if(S&&W(A8))A6=X.neg(A8),k6^=1;return new O(D8,A6,F?void 0:k6)}return{seed:a,k2sig:e}}function u(V,B,M={}){let{seed:S,k2sig:P}=h(V,B,M);return nJ($.outputLen,X.BYTES,G)(S,P).toBytes(M.format)}function L(V,B,M,S={}){let{lowS:P,prehash:_,format:k}=Z6(S,E);if(M=x(M,void 0,"publicKey"),B=w(B,_),!V0(V)){let A=V instanceof O?", use sig.toBytes()":"";throw Error("verify expects Uint8Array signature"+A)}I(V,k);try{let A=O.fromBytes(V,k),t=D.fromBytes(M);if(P&&A.hasHighS())return!1;let{r:a,s:g}=A,e=p(B),JD=X.inv(g),OD=X.create(e*JD),DD=X.create(a*JD),YD=D.BASE.multiplyUnsafe(OD).add(t.multiplyUnsafe(DD));if(YD.is0())return!1;return X.create(YD.x)===a}catch(A){return!1}}function R(V,B,M={}){let{prehash:S}=Z6(M,E);return B=w(B,S),O.fromBytes(V,"recovered").recoverPublicKey(B).toBytes()}return Object.freeze({keygen:K,getPublicKey:j,getSharedSecret:U,utils:C,lengths:z,Point:D,sign:u,verify:L,recoverPublicKey:R,Signature:O,hash:$})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var U6={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},gZ={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var MQ=BigInt(2);function lZ(D){let $=U6.p,J=BigInt(3),Q=BigInt(6),G=BigInt(11),q=BigInt(22),X=BigInt(23),Y=BigInt(44),Z=BigInt(88),K=D*D*D%$,j=K*K*D%$,U=o(j,J,$)*j%$,C=o(U,J,$)*j%$,z=o(C,MQ,$)*K%$,E=o(z,G,$)*z%$,F=o(E,q,$)*E%$,W=o(F,Y,$)*F%$,H=o(W,Z,$)*W%$,N=o(H,Y,$)*F%$,I=o(N,J,$)*j%$,O=o(I,X,$)*E%$,y=o(O,Q,$)*K%$,p=o(y,MQ,$);if(!j6.eql(j6.sqr(p),D))throw Error("Cannot find square root");return p}var j6=c0(U6.p,{sqrt:lZ}),pZ=IQ(U6,{Fp:j6,endo:gZ}),M0=TQ(pZ,B0);var r0=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),Y0=new Uint32Array(80);class dZ extends eD{A=r0[0]|0;B=r0[1]|0;C=r0[2]|0;D=r0[3]|0;E=r0[4]|0;constructor(){super(64,20,8,!1)}get(){let{A:D,B:$,C:J,D:Q,E:G}=this;return[D,$,J,Q,G]}set(D,$,J,Q,G){this.A=D|0,this.B=$|0,this.C=J|0,this.D=Q|0,this.E=G|0}process(D,$){for(let Y=0;Y<16;Y++,$+=4)Y0[Y]=D.getUint32($,!1);for(let Y=16;Y<80;Y++)Y0[Y]=gD(Y0[Y-3]^Y0[Y-8]^Y0[Y-14]^Y0[Y-16],1);let{A:J,B:Q,C:G,D:q,E:X}=this;for(let Y=0;Y<80;Y++){let Z,K;if(Y<20)Z=l0(Q,G,q),K=1518500249;else if(Y<40)Z=Q^G^q,K=1859775393;else if(Y<60)Z=$9(Q,G,q),K=2400959708;else Z=Q^G^q,K=3395469782;let j=gD(J,5)+Z+X+K+Y0[Y]|0;X=q,q=G,G=gD(Q,30),Q=J,J=j}J=J+this.A|0,Q=Q+this.B|0,G=G+this.C|0,q=q+this.D|0,X=X+this.E|0,this.set(J,Q,G,q,X)}roundClean(){GD(Y0)}destroy(){this.set(0,0,0,0,0),GD(this.buffer)}}var cZ=Math.pow(2,32),aZ=Array.from({length:64},(D,$)=>Math.floor(cZ*Math.abs(Math.sin($+1)))),K9=r0.slice(0,4),W6=new Uint32Array(16);class iZ extends eD{A=K9[0]|0;B=K9[1]|0;C=K9[2]|0;D=K9[3]|0;constructor(){super(64,16,8,!0)}get(){let{A:D,B:$,C:J,D:Q}=this;return[D,$,J,Q]}set(D,$,J,Q){this.A=D|0,this.B=$|0,this.C=J|0,this.D=Q|0}process(D,$){for(let X=0;X<16;X++,$+=4)W6[X]=D.getUint32($,!0);let{A:J,B:Q,C:G,D:q}=this;for(let X=0;X<64;X++){let Y,Z,K;if(X<16)Y=l0(Q,G,q),Z=X,K=[7,12,17,22];else if(X<32)Y=l0(q,Q,G),Z=(5*X+1)%16,K=[5,9,14,20];else if(X<48)Y=Q^G^q,Z=(3*X+5)%16,K=[4,11,16,23];else Y=G^(Q|~q),Z=7*X%16,K=[6,10,15,21];Y=Y+J+aZ[X]+W6[Z],J=q,q=G,G=Q,Q=Q+gD(Y,K[X%4])}J=J+this.A|0,Q=Q+this.B|0,G=G+this.C|0,q=q+this.D|0,this.set(J,Q,G,q)}roundClean(){GD(W6)}destroy(){this.set(0,0,0,0),GD(this.buffer)}}var rZ=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),SQ=(()=>Uint8Array.from(Array(16).fill(0).map((D,$)=>$)))(),oZ=(()=>SQ.map((D)=>(9*D+5)%16))(),_Q=(()=>{let J=[[SQ],[oZ]];for(let Q=0;Q<4;Q++)for(let G of J)G.push(G[Q].map((q)=>rZ[q]));return J})(),kQ=(()=>_Q[0])(),AQ=(()=>_Q[1])(),xQ=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((D)=>Uint8Array.from(D)),sZ=kQ.map((D,$)=>D.map((J)=>xQ[$][J])),nZ=AQ.map((D,$)=>D.map((J)=>xQ[$][J])),tZ=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),eZ=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function PQ(D,$,J,Q){if(D===0)return $^J^Q;if(D===1)return $&J|~$&Q;if(D===2)return($|~J)^Q;if(D===3)return $&Q|J&~Q;return $^(J|~Q)}var j9=new Uint32Array(16);class bQ extends eD{h0=1732584193;h1=-271733879;h2=-1732584194;h3=271733878;h4=-1009589776;constructor(){super(64,20,8,!0)}get(){let{h0:D,h1:$,h2:J,h3:Q,h4:G}=this;return[D,$,J,Q,G]}set(D,$,J,Q,G){this.h0=D|0,this.h1=$|0,this.h2=J|0,this.h3=Q|0,this.h4=G|0}process(D,$){for(let C=0;C<16;C++,$+=4)j9[C]=D.getUint32($,!0);let J=this.h0|0,Q=J,G=this.h1|0,q=G,X=this.h2|0,Y=X,Z=this.h3|0,K=Z,j=this.h4|0,U=j;for(let C=0;C<5;C++){let z=4-C,E=tZ[C],F=eZ[C],W=kQ[C],H=AQ[C],N=sZ[C],I=nZ[C];for(let O=0;O<16;O++){let y=gD(J+PQ(C,G,X,Z)+j9[W[O]]+E,N[O])+j|0;J=j,j=Z,Z=gD(X,10)|0,X=G,G=y}for(let O=0;O<16;O++){let y=gD(Q+PQ(z,q,Y,K)+j9[H[O]]+F,I[O])+U|0;Q=U,U=K,K=gD(Y,10)|0,Y=q,q=y}}this.set(this.h1+X+K|0,this.h2+Z+U|0,this.h3+j+Q|0,this.h4+J+q|0,this.h0+G+Y|0)}roundClean(){GD(j9)}destroy(){this.destroyed=!0,GD(this.buffer),this.set(0,0,0,0,0)}}var hQ=W8(()=>new bQ);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function o0(D){return D instanceof Uint8Array||ArrayBuffer.isView(D)&&D.constructor.name==="Uint8Array"}function C6(D){if(!o0(D))throw Error("Uint8Array expected")}function mQ(D,$){if(!Array.isArray($))return!1;if($.length===0)return!0;if(D)return $.every((J)=>typeof J==="string");else return $.every((J)=>Number.isSafeInteger(J))}function H6(D){if(typeof D!=="function")throw Error("function expected");return!0}function Z0(D,$){if(typeof $!=="string")throw Error(`${D}: string expected`);return!0}function s0(D){if(!Number.isSafeInteger(D))throw Error(`invalid integer: ${D}`)}function W9(D){if(!Array.isArray(D))throw Error("array expected")}function E9(D,$){if(!mQ(!0,$))throw Error(`${D}: array of strings expected`)}function N6(D,$){if(!mQ(!1,$))throw Error(`${D}: array of numbers expected`)}function ND(...D){let $=(q)=>q,J=(q,X)=>(Y)=>q(X(Y)),Q=D.map((q)=>q.encode).reduceRight(J,$),G=D.map((q)=>q.decode).reduce(J,$);return{encode:Q,decode:G}}function FD(D){let $=typeof D==="string"?D.split(""):D,J=$.length;E9("alphabet",$);let Q=new Map($.map((G,q)=>[G,q]));return{encode:(G)=>{return W9(G),G.map((q)=>{if(!Number.isSafeInteger(q)||q<0||q>=J)throw Error(`alphabet.encode: digit index outside alphabet "${q}". Allowed: ${D}`);return $[q]})},decode:(G)=>{return W9(G),G.map((q)=>{Z0("alphabet.decode",q);let X=Q.get(q);if(X===void 0)throw Error(`Unknown letter: "${q}". Allowed: ${D}`);return X})}}}function LD(D=""){return Z0("join",D),{encode:($)=>{return E9("join.decode",$),$.join(D)},decode:($)=>{return Z0("join.decode",$),$.split(D)}}}function I8(D,$="="){return s0(D),Z0("padding",$),{encode(J){E9("padding.encode",J);while(J.length*D%8)J.push($);return J},decode(J){E9("padding.decode",J);let Q=J.length;if(Q*D%8)throw Error("padding: invalid, string should have whole number of bytes");for(;Q>0&&J[Q-1]===$;Q--)if((Q-1)*D%8===0)throw Error("padding: invalid, string has too much padding");return J.slice(0,Q)}}}function uQ(D){return H6(D),{encode:($)=>$,decode:($)=>D($)}}function E6(D,$,J){if($<2)throw Error(`convertRadix: invalid from=${$}, base cannot be less than 2`);if(J<2)throw Error(`convertRadix: invalid to=${J}, base cannot be less than 2`);if(W9(D),!D.length)return[];let Q=0,G=[],q=Array.from(D,(Y)=>{if(s0(Y),Y<0||Y>=$)throw Error(`invalid integer: ${Y}`);return Y}),X=q.length;while(!0){let Y=0,Z=!0;for(let K=Q;K<X;K++){let j=q[K],U=$*Y,C=U+j;if(!Number.isSafeInteger(C)||U/$!==Y||C-j!==U)throw Error("convertRadix: carry overflow");let z=C/J;Y=C%J;let E=Math.floor(z);if(q[K]=E,!Number.isSafeInteger(E)||E*J+Y!==C)throw Error("convertRadix: carry overflow");if(!Z)continue;else if(!E)Q=K;else Z=!1}if(G.push(Y),Z)break}for(let Y=0;Y<D.length-1&&D[Y]===0;Y++)G.push(0);return G.reverse()}var gQ=(D,$)=>$===0?D:gQ($,D%$),z9=(D,$)=>D+($-gQ(D,$)),U9=(()=>{let D=[];for(let $=0;$<40;$++)D.push(2**$);return D})();function C9(D,$,J,Q){if(W9(D),$<=0||$>32)throw Error(`convertRadix2: wrong from=${$}`);if(J<=0||J>32)throw Error(`convertRadix2: wrong to=${J}`);if(z9($,J)>32)throw Error(`convertRadix2: carry overflow from=${$} to=${J} carryBits=${z9($,J)}`);let G=0,q=0,X=U9[$],Y=U9[J]-1,Z=[];for(let K of D){if(s0(K),K>=X)throw Error(`convertRadix2: invalid data word=${K} from=${$}`);if(G=G<<$|K,q+$>32)throw Error(`convertRadix2: carry overflow pos=${q} from=${$}`);q+=$;for(;q>=J;q-=J)Z.push((G>>q-J&Y)>>>0);let j=U9[q];if(j===void 0)throw Error("invalid carry");G&=j-1}if(G=G<<J-q&Y,!Q&&q>=$)throw Error("Excess padding");if(!Q&&G>0)throw Error(`Non-zero padding: ${G}`);if(Q&&q>0)Z.push(G>>>0);return Z}function lQ(D){s0(D);let $=256;return{encode:(J)=>{if(!o0(J))throw Error("radix.encode input should be Uint8Array");return E6(Array.from(J),$,D)},decode:(J)=>{return N6("radix.decode",J),Uint8Array.from(E6(J,D,$))}}}function ID(D,$=!1){if(s0(D),D<=0||D>32)throw Error("radix2: bits should be in (0..32]");if(z9(8,D)>32||z9(D,8)>32)throw Error("radix2: carry overflow");return{encode:(J)=>{if(!o0(J))throw Error("radix2.encode input should be Uint8Array");return C9(Array.from(J),8,D,!$)},decode:(J)=>{return N6("radix2.decode",J),Uint8Array.from(C9(J,D,8,$))}}}function vQ(D){return H6(D),function(...$){try{return D.apply(null,$)}catch(J){}}}function pQ(D,$){return s0(D),H6($),{encode(J){if(!o0(J))throw Error("checksum.encode: input should be Uint8Array");let Q=$(J).slice(0,D),G=new Uint8Array(J.length+D);return G.set(J),G.set(Q,J.length),G},decode(J){if(!o0(J))throw Error("checksum.decode: input should be Uint8Array");let Q=J.slice(0,-D),G=J.slice(-D),q=$(Q).slice(0,D);for(let X=0;X<D;X++)if(q[X]!==G[X])throw Error("Invalid checksum");return Q}}}var w8={alphabet:FD,chain:ND,checksum:pQ,convertRadix:E6,convertRadix2:C9,radix:lQ,radix2:ID,join:LD,padding:I8},QE=ND(ID(4),FD("0123456789ABCDEF"),LD("")),GE=ND(ID(5),FD("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),I8(5),LD("")),qE=ND(ID(5),FD("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),LD("")),XE=ND(ID(5),FD("0123456789ABCDEFGHIJKLMNOPQRSTUV"),I8(5),LD("")),YE=ND(ID(5),FD("0123456789ABCDEFGHIJKLMNOPQRSTUV"),LD("")),ZE=ND(ID(5),FD("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),LD(""),uQ((D)=>D.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),dQ=(()=>typeof Uint8Array.from([]).toBase64==="function"&&typeof Uint8Array.fromBase64==="function")(),cQ=(D,$)=>{Z0("base64",D);let J=$?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/,Q=$?"base64url":"base64";if(D.length>0&&!J.test(D))throw Error("invalid base64");return Uint8Array.fromBase64(D,{alphabet:Q,lastChunkHandling:"strict"})},KE=dQ?{encode(D){return C6(D),D.toBase64()},decode(D){return cQ(D,!1)}}:ND(ID(6),FD("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),I8(6),LD("")),jE=ND(ID(6),FD("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),LD("")),UE=dQ?{encode(D){return C6(D),D.toBase64({alphabet:"base64url"})},decode(D){return cQ(D,!0)}}:ND(ID(6),FD("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),I8(6),LD("")),WE=ND(ID(6),FD("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),LD("")),V6=(D)=>ND(lQ(58),FD(D),LD("")),DK=V6("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),EE=V6("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),zE=V6("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");var aQ=(D)=>ND(pQ(4,($)=>D(D($))),DK);var z6=ND(FD("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),LD("")),yQ=[996825010,642813549,513874426,1027748829,705979059];function R8(D){let $=D>>25,J=(D&33554431)<<5;for(let Q=0;Q<yQ.length;Q++)if(($>>Q&1)===1)J^=yQ[Q];return J}function fQ(D,$,J=1){let Q=D.length,G=1;for(let q=0;q<Q;q++){let X=D.charCodeAt(q);if(X<33||X>126)throw Error(`Invalid prefix (${D})`);G=R8(G)^X>>5}G=R8(G);for(let q=0;q<Q;q++)G=R8(G)^D.charCodeAt(q)&31;for(let q of $)G=R8(G)^q;for(let q=0;q<6;q++)G=R8(G);return G^=J,z6.encode(C9([G%U9[30]],30,5,!1))}function iQ(D){let $=D==="bech32"?1:734539939,J=ID(5),Q=J.decode,G=J.encode,q=vQ(Q);function X(U,C,z=90){if(Z0("bech32.encode prefix",U),o0(C))C=Array.from(C);N6("bech32.encode",C);let E=U.length;if(E===0)throw TypeError(`Invalid prefix length ${E}`);let F=E+7+C.length;if(z!==!1&&F>z)throw TypeError(`Length ${F} exceeds limit ${z}`);let W=U.toLowerCase(),H=fQ(W,C,$);return`${W}1${z6.encode(C)}${H}`}function Y(U,C=90){Z0("bech32.decode input",U);let z=U.length;if(z<8||C!==!1&&z>C)throw TypeError(`invalid string length: ${z} (${U}). Expected (8..${C})`);let E=U.toLowerCase();if(U!==E&&U!==U.toUpperCase())throw Error("String must be lowercase or uppercase");let F=E.lastIndexOf("1");if(F===0||F===-1)throw Error('Letter "1" must be present between prefix and data only');let W=E.slice(0,F),H=E.slice(F+1);if(H.length<6)throw Error("Data must be at least 6 characters long");let N=z6.decode(H).slice(0,-6),I=fQ(W,N,$);if(!H.endsWith(I))throw Error(`Invalid checksum in ${U}: expected "${I}"`);return{prefix:W,words:N}}let Z=vQ(Y);function K(U){let{prefix:C,words:z}=Y(U,!1);return{prefix:C,words:z,bytes:Q(z)}}function j(U,C){return X(U,G(C))}return{encode:X,decode:Y,encodeFromBytes:j,decodeToBytes:K,decodeUnsafe:Z,fromWords:Q,fromWordsUnsafe:q,toWords:G}}var CE=iQ("bech32"),HE=iQ("bech32m");var $K=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),JK={encode(D){return C6(D),D.toHex()},decode(D){return Z0("hex",D),Uint8Array.fromHex(D)}},NE=$K?JK:ND(ID(4),FD("0123456789abcdef"),LD(""),uQ((D)=>{if(typeof D!=="string"||D.length%2!==0)throw TypeError(`hex.decode: expected string, got ${typeof D} with length ${D.length}`);return D.toLowerCase()}));/*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */var T8=M0.Point,{Fn:O8}=T8,F6=aQ(B0),QK=Uint8Array.from("Bitcoin seed".split(""),(D)=>D.charCodeAt(0)),L6={private:76066276,public:76067358},B6=2147483648,GK=(D)=>hQ(B0(D)),qK=(D)=>hD(D).getUint32(0,!1),H9=(D)=>{if(!Number.isSafeInteger(D)||D<0||D>4294967295)throw Error("invalid number, should be from 0 to 2**32-1, got "+D);let $=new Uint8Array(4);return hD($).setUint32(0,D,!1),$};class K0{get fingerprint(){if(!this.pubHash)throw Error("No publicKey set!");return qK(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this._privateKey||null}get publicKey(){return this._publicKey||null}get privateExtendedKey(){let D=this._privateKey;if(!D)throw Error("No private key");return F6.encode(this.serialize(this.versions.private,$D(Uint8Array.of(0),D)))}get publicExtendedKey(){if(!this._publicKey)throw Error("No public key");return F6.encode(this.serialize(this.versions.public,this._publicKey))}static fromMasterSeed(D,$=L6){if(x(D),8*D.length<128||8*D.length>512)throw Error("HDKey: seed length must be between 128 and 512 bits; 256 bits is advised, got "+D.length);let J=q0(R0,QK,D),Q=J.slice(0,32),G=J.slice(32);return new K0({versions:$,chainCode:G,privateKey:Q})}static fromExtendedKey(D,$=L6){let J=F6.decode(D),Q=hD(J),G=Q.getUint32(0,!1),q={versions:$,depth:J[4],parentFingerprint:Q.getUint32(5,!1),index:Q.getUint32(9,!1),chainCode:J.slice(13,45)},X=J.slice(45),Y=X[0]===0;if(G!==$[Y?"private":"public"])throw Error("Version mismatch");if(Y)return new K0({...q,privateKey:X.slice(1)});else return new K0({...q,publicKey:X})}static fromJSON(D){return K0.fromExtendedKey(D.xpriv)}versions;depth=0;index=0;chainCode=null;parentFingerprint=0;_privateKey;_publicKey;pubHash;constructor(D){if(!D||typeof D!=="object")throw Error("HDKey.constructor must not be called directly");if(this.versions=D.versions||L6,this.depth=D.depth||0,this.chainCode=D.chainCode||null,this.index=D.index||0,this.parentFingerprint=D.parentFingerprint||0,!this.depth){if(this.parentFingerprint||this.index)throw Error("HDKey: zero depth with non-zero index/parent fingerprint")}if(this.depth>255)throw Error("HDKey: depth exceeds the serializable value 255");if(D.publicKey&&D.privateKey)throw Error("HDKey: publicKey and privateKey at same time.");if(D.privateKey){if(!M0.utils.isValidSecretKey(D.privateKey))throw Error("Invalid private key");this._privateKey=D.privateKey,this._publicKey=M0.getPublicKey(D.privateKey,!0)}else if(D.publicKey)this._publicKey=T8.fromBytes(D.publicKey).toBytes(!0);else throw Error("HDKey: no public or private key provided");this.pubHash=GK(this._publicKey)}derive(D){if(!/^[mM]'?/.test(D))throw Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(D))return this;let $=D.replace(/^[mM]'?\//,"").split("/"),J=this;for(let Q of $){let G=/^(\d+)('?)$/.exec(Q),q=G&&G[1];if(!G||G.length!==3||typeof q!=="string")throw Error("invalid child index: "+Q);let X=+q;if(!Number.isSafeInteger(X)||X>=B6)throw Error("Invalid index");if(G[2]==="'")X+=B6;J=J.deriveChild(X)}return J}deriveChild(D){if(!this._publicKey||!this.chainCode)throw Error("No publicKey or chainCode set");let $=H9(D);if(D>=B6){let Y=this._privateKey;if(!Y)throw Error("Could not derive hardened child key");$=$D(Uint8Array.of(0),Y,$)}else $=$D(this._publicKey,$);let J=q0(R0,this.chainCode,$),Q=J.slice(0,32),G=J.slice(32);if(!M0.utils.isValidSecretKey(Q))throw Error("Tweak bigger than curve order");let q={versions:this.versions,chainCode:G,depth:this.depth+1,parentFingerprint:this.fingerprint,index:D},X=O8.fromBytes(Q);try{if(this._privateKey){let Y=O8.create(O8.fromBytes(this._privateKey)+X);if(!O8.isValidNot0(Y))throw Error("The tweak was out of range or the resulted private key is invalid");q.privateKey=O8.toBytes(Y)}else{let Y=T8.fromBytes(this._publicKey).add(T8.BASE.multiply(X));if(Y.equals(T8.ZERO))throw Error("The tweak was equal to negative P, which made the result key invalid");q.publicKey=Y.toBytes(!0)}return new K0(q)}catch(Y){return this.deriveChild(D+1)}}sign(D){if(!this._privateKey)throw Error("No privateKey set!");return x(D,32),M0.sign(D,this._privateKey,{prehash:!1})}verify(D,$){if(x(D,32),x($,64),!this._publicKey)throw Error("No publicKey set!");return M0.verify($,D,this._publicKey,{prehash:!1})}wipePrivateData(){if(this._privateKey)this._privateKey.fill(0),this._privateKey=void 0;return this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(D,$){if(!this.chainCode)throw Error("No chainCode set");return x($,33),$D(H9(D),new Uint8Array([this.depth]),H9(this.parentFingerprint),H9(this.index),this.chainCode,$)}}function XK(D,$,J,Q){u0(D);let G=yJ({dkLen:32,asyncTick:10},Q),{c:q,dkLen:X,asyncTick:Y}=G;if(UD(q,"c"),UD(X,"dkLen"),UD(Y,"asyncTick"),q<1)throw Error("iterations (c) must be >= 1");let Z=l7($,"password"),K=l7(J,"salt"),j=new Uint8Array(X),U=q0.create(D,Z),C=U._cloneInto().update(K);return{c:q,dkLen:X,asyncTick:Y,DK:j,PRF:U,PRFSalt:C}}function YK(D,$,J,Q,G){if(D.destroy(),$.destroy(),Q)Q.destroy();return GD(G),J}function rQ(D,$,J,Q){let{c:G,dkLen:q,DK:X,PRF:Y,PRFSalt:Z}=XK(D,$,J,Q),K,j=new Uint8Array(4),U=hD(j),C=new Uint8Array(Y.outputLen);for(let z=1,E=0;E<q;z++,E+=Y.outputLen){let F=X.subarray(E,E+Y.outputLen);U.setInt32(0,z,!1),(K=Z._cloneInto(K)).update(j).digestInto(C),F.set(C.subarray(0,F.length));for(let W=1;W<G;W++){Y._cloneInto(K).update(C).digestInto(C);for(let H=0;H<F.length;H++)F[H]^=C[H]}}return YK(Y,Z,X,K,C)}/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */var ZK=(D)=>D[0]==="あいこくしん";function oQ(D){if(typeof D!=="string")throw TypeError("invalid mnemonic type: "+typeof D);return D.normalize("NFKD")}function KK(D){let $=oQ(D),J=$.split(" ");if(![12,15,18,21,24].includes(J.length))throw Error("Invalid mnemonic");return{nfkd:$,words:J}}function jK(D){if(x(D),![16,20,24,28,32].includes(D.length))throw Error("invalid entropy length")}function sQ(D,$=128){if(UD($),$%32!==0||$>256)throw TypeError("Invalid entropy");return EK(tD($/8),D)}var UK=(D)=>{let $=8-D.length/4;return new Uint8Array([B0(D)[0]>>$<<$])};function WK(D){if(!Array.isArray(D)||D.length!==2048||typeof D[0]!=="string")throw Error("Wordlist: expected array of 2048 strings");return D.forEach(($)=>{if(typeof $!=="string")throw Error("wordlist: non-string element: "+$)}),w8.chain(w8.checksum(1,UK),w8.radix2(11,!0),w8.alphabet(D))}function EK(D,$){return jK(D),WK($).encode(D).join(ZK($)?" ":" ")}var zK=(D)=>oQ("mnemonic"+D);function nQ(D,$=""){return rQ(R0,KK(D).nfkd,zK($),{c:2048,dkLen:64})}var tQ=`abandon
42
+ For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[E6]:"No signature verification implementation could be found.",[f$]:"No key generation implementation could be found.",[H6]:"No signing implementation could be found.",[m$]:"No key export implementation could be found.",[mG]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[BY]:"Transaction processing left an account with an outstanding borrowed reference",[YY]:"Account in use",[ZY]:"Account loaded twice",[UY]:"Attempt to debit an account but found no record of a prior credit.",[_Y]:"Transaction loads an address table account that doesn't exist",[zY]:"This transaction has already been processed",[EY]:"Blockhash not found",[HY]:"Loader call chain is too deep",[LY]:"Transactions are currently disabled due to cluster maintenance",[vY]:"Transaction contains a duplicate instruction ($index) that is not allowed",[KY]:"Insufficient funds for fee",[yY]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[WY]:"This account may not be used to pay transaction fees",[NY]:"Transaction contains an invalid account reference",[kY]:"Transaction loads an address table account with invalid data",[AY]:"Transaction address table lookup uses an invalid index",[SY]:"Transaction loads an address table account with an invalid owner",[mY]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[CY]:"This program may not be used for executing instructions",[xY]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[TY]:"Transaction loads a writable account that cannot be written",[fY]:"Transaction exceeded max loaded accounts data size cap",[VY]:"Transaction requires a fee but has no signature present",[jY]:"Attempt to load a program that does not exist",[gY]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[uY]:"ResanitizationNeeded",[RY]:"Transaction failed to sanitize accounts offsets correctly",[FY]:"Transaction did not pass signature verification",[PY]:"Transaction locked too many accounts",[lY]:"Sum of account balances before and after transaction do not match",[XY]:"The transaction failed with the error `$errorName`",[wY]:"Transaction version is unsupported",[MY]:"Transaction would exceed account data limit within the block",[hY]:"Transaction would exceed total account data limit",[OY]:"Transaction would exceed max account limit within the block",[IY]:"Transaction would exceed max Block Cost Limit",[bY]:"Transaction would exceed max Vote Cost Limit",[R6]:"Attempted to sign a transaction with an address that is not a signer for it",[e2]:"Transaction is missing an address at index: $index.",[L6]:"Transaction has no expected signers therefore it cannot be encoded",[DJ]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[F6]:"Transaction does not have a blockhash lifetime",[C6]:"Transaction is not a durable nonce transaction",[r$]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[o$]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[s$]:"No fee payer set in CompiledTransaction",[n$]:"Could not find program address at index $index",[QY]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[qY]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[DY]:"Transaction is missing a fee payer.",[e$]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[JY]:"Transaction first instruction is not advance nonce account instruction.",[$Y]:"Transaction with no instructions cannot be durable nonce transaction.",[c$]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[a$]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[D9]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[t$]:"Transaction is missing signatures for addresses: $addresses.",[i$]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[E8]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[$J]:"The transaction has a durable nonce lifetime (with nonce `$nonce`), but the nonce account address is in a lookup table. The lifetime constraint cannot be constructed without fetching the lookup tables for the transaction.",[GY]:"Invalid transaction config mask: $mask. Bits 0 and 1 must match (both set or both unset)",[B6]:"Transaction message bytes are malformed: $messageBytes",[I6]:"Transaction message bytes are empty, so the transaction cannot be encoded",[w6]:"Transaction bytes are empty, so no transaction can be decoded",[T6]:"Transaction version 0 must be encoded with signatures first. This transaction was encoded with first byte $firstByte, which is expected to be a signature count for v0 transactions.",[O6]:"The provided transaction bytes expect that there should be $numExpectedSignatures signatures, but the bytes are not long enough to contain a transaction message with this many signatures. The provided bytes are $transactionBytesLength bytes long."},R5=1000,dD="i",hD="t";function L5(D,$={}){let J=C5[D];if(J.length===0)return"";let Q;function q(Y){if(Q[hD]===2){let Z=J.slice(Q[dD]+1,Y);G.push(Z in $?`${$[Z]}`:`$${Z}`)}else if(Q[hD]===1)G.push(J.slice(Q[dD],Y))}let G=[];J.split("").forEach((Y,Z)=>{if(Z===0){Q={[dD]:0,[hD]:J[0]==="\\"?0:J[0]==="$"?2:1};return}let U;switch(Q[hD]){case 0:U={[dD]:Z,[hD]:1};break;case 1:if(Y==="\\")U={[dD]:Z,[hD]:0};else if(Y==="$")U={[dD]:Z,[hD]:2};break;case 2:if(Y==="\\")U={[dD]:Z,[hD]:0};else if(Y==="$")U={[dD]:Z,[hD]:2};else if(!Y.match(/\w/))U={[dD]:Z,[hD]:1};break}if(U){if(Q!==U)q(Z);Q=U}}),q();let X=G.join("");if(D>=X6&&D<X6+R5&&"index"in $)X+=` (instruction #${$.index+1})`;return X}function B5(D,$={}){return L5(D,$)}function RJ(D,$){if(D instanceof Error&&D.name==="SolanaError"){if($!==void 0)return D.context.__code===$;return!0}return!1}var v=class extends Error{cause=this.cause;context;constructor(...[D,$]){let J,Q;if($)Object.entries(Object.getOwnPropertyDescriptors($)).forEach(([G,X])=>{if(G==="cause")Q={cause:X.value};else{if(J===void 0)J={__code:D};Object.defineProperty(J,G,X)}});let q=B5(D,J);super(q,Q);this.context=Object.freeze(J===void 0?{__code:D}:J),this.name="SolanaError"}};function I5(D,$){if(D.length>=$)return D;let J=new Uint8Array($).fill(0);return J.set(D),J}var w5=(D,$)=>I5(D.length<=$?D:D.slice(0,$),$);function y6(D,$){return D.length===$.length&&D.every((J,Q)=>J===$[Q])}function m0(D,$){return"fixedSize"in $?$.fixedSize:$.getSizeFromValue(D)}function GD(D){return Object.freeze({...D,encode:($)=>{let J=new Uint8Array(m0($,D));return D.write($,J,0),J}})}function s(D){return Object.freeze({...D,decode:($,J=0)=>D.read($,J)[0]})}function ID(D){return"fixedSize"in D&&typeof D.fixedSize==="number"}function T5(D){return!ID(D)}function vD(D,$){if(ID(D)!==ID($))throw new v(_6);if(ID(D)&&ID($)&&D.fixedSize!==$.fixedSize)throw new v(S6,{decoderFixedSize:$.fixedSize,encoderFixedSize:D.fixedSize});if(!ID(D)&&!ID($)&&D.maxSize!==$.maxSize)throw new v(k6,{decoderMaxSize:$.maxSize,encoderMaxSize:D.maxSize});return{...$,...D,decode:$.decode,encode:D.encode,read:$.read,write:D.write}}function BJ(D,$,J=0){if($.length-J<=0)throw new v(M6,{codecDescription:D})}function $9(D,$,J,Q=0){let q=J.length-Q;if(q<$)throw new v(P6,{bytesLength:q,codecDescription:D,expected:$})}function LJ(D,$,J){if($<0||$>J)throw new v(h6,{bytesLength:J,codecDescription:D,offset:$})}function u0(D,$,J){let Q=D.byteOffset+($??0),q=J??D.byteLength,G;if(typeof SharedArrayBuffer>"u")G=D.buffer;else if(D.buffer instanceof SharedArrayBuffer)G=new ArrayBuffer(D.length),new Uint8Array(G).set(new Uint8Array(D));else G=D.buffer;return(Q===0||Q===-D.byteLength)&&q===D.byteLength?G:G.slice(Q,Q+q)}function F0(D,$){return GD({fixedSize:$,write:(J,Q,q)=>{let G=D.encode(J),X=G.length>$?G.slice(0,$):G;return Q.set(X,q),q+$}})}function C0(D,$){return s({fixedSize:$,read:(J,Q)=>{if($9("fixCodecSize",$,J,Q),Q>0||J.length>$)J=J.slice(Q,Q+$);if(ID(D))J=w5(J,D.fixedSize);let[q]=D.read(J,0);return[q,Q+$]}})}function O5(D,$){return s({...D,read:(J,Q)=>{let q=(U)=>M5(U,J.length),G=$.preOffset?$.preOffset({bytes:J,preOffset:Q,wrapBytes:q}):Q;LJ("offsetDecoder",G,J.length);let[X,Y]=D.read(J,G),Z=$.postOffset?$.postOffset({bytes:J,newPreOffset:G,postOffset:Y,preOffset:Q,wrapBytes:q}):Y;return LJ("offsetDecoder",Z,J.length),[X,Z]}})}function M5(D,$){if($===0)return 0;return(D%$+$)%$}function P5(D,$){if(ID(D)){let J=$(D.fixedSize);if(J<0)throw new v(b6,{bytesLength:J,codecDescription:"resizeDecoder"});return s({...D,fixedSize:J})}return D}function IJ(D,$){return O5(P5(D,(J)=>J+$),{postOffset:({postOffset:J})=>J+$})}function $0(D,$){return GD({...T5(D)?{...D,getSizeFromValue:(J)=>D.getSizeFromValue($(J))}:D,write:(J,Q,q)=>D.write($(J),Q,q)})}function H8(D,$){return s({...D,read:(J,Q)=>{let[q,G]=D.read(J,Q);return[$(q,J,Q),G]}})}function MJ(D,$,J=$){if(!$.match(new RegExp(`^[${D}]*$`)))throw new v(f0,{alphabet:D,base:D.length,value:J})}var _5=(D)=>{return GD({getSizeFromValue:($)=>{let[J,Q]=wJ($,D[0]);if(!Q)return $.length;let q=TJ(Q,D);return J.length+Math.ceil(q.toString(16).length/2)},write($,J,Q){if(MJ(D,$),$==="")return Q;let[q,G]=wJ($,D[0]);if(!G)return J.set(new Uint8Array(q.length).fill(0),Q),Q+q.length;let X=TJ(G,D),Y=[];while(X>0n)Y.unshift(Number(X%256n)),X/=256n;let Z=[...Array(q.length).fill(0),...Y];return J.set(Z,Q),Q+Z.length}})},S5=(D)=>{return s({read($,J){let Q=J===0?$:$.slice(J);if(Q.length===0)return["",0];let q=Q.findIndex((Z)=>Z!==0);q=q===-1?Q.length:q;let G=D[0].repeat(q);if(q===Q.length)return[G,$.length];let X=Q.slice(q).reduce((Z,U)=>Z*256n+BigInt(U),0n),Y=k5(X,D);return[G+Y,$.length]}})};function wJ(D,$){let[J,Q]=D.split(new RegExp(`((?!${$}).*)`));return[J,Q]}function TJ(D,$){let J=BigInt($.length),Q=0n;for(let q of D)Q*=J,Q+=BigInt($.indexOf(q));return Q}function k5(D,$){let J=BigInt($.length),Q=[];while(D>0n)Q.unshift($[Number(D%J)]),D/=J;return Q.join("")}var OJ={alphabet:"0123456789abcdef",base:16};function f6(D){if(D>=48&&D<=57)return D-48;if(D>=65&&D<=70)return D-55;if(D>=97&&D<=102)return D-87}var PJ=()=>GD({getSizeFromValue:(D)=>Math.ceil(D.length/2),write(D,$,J){let Q=D.length,q=Q/2;if(Q===1){let X=D.charCodeAt(0),Y=f6(X);if(Y===void 0)throw new v(f0,{...OJ,value:D});return $.set([Y],J),1+J}let G=new Uint8Array(q);for(let X=0,Y=0;X<q;X++){let Z=D.charCodeAt(Y++),U=D.charCodeAt(Y++),j=f6(Z),K=f6(U);if(j===void 0||K===void 0&&!Number.isNaN(U))throw new v(f0,{...OJ,value:D});G[X]=!Number.isNaN(U)?j<<4|(K??0):j}return $.set(G,J),G.length+J}});var _J="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",J9=()=>_5(_J),m6=()=>S5(_J);var A5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u6=()=>{return GD({getSizeFromValue:(D)=>Buffer.from(D,"base64").length,write(D,$,J){MJ(A5,D.replace(/=/g,""));let Q=Buffer.from(D,"base64");return $.set(Q,J),Q.length+J}})},g6=()=>{return s({read:(D,$=0)=>[Buffer.from(u0(D),$).toString("base64"),D.length]})},SJ=()=>vD(u6(),g6());var{TextDecoder:ZW,TextEncoder:UW}=globalThis;function kJ(){if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.digest!=="function")throw new v(z6)}function Q9(){if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!=="function")throw new v(E6)}function AJ(){if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!=="function")throw new v(H6)}var l6,d6;function vJ(){if(!l6)l6=J9();return l6}function x5(){if(!d6)d6=m6();return d6}function b5(D){if(D.length<32||D.length>44)throw new v(Z6,{actualLength:D.length});let Q=vJ().encode(D).byteLength;if(Q!==32)throw new v(Y6,{actualLength:Q})}function g0(D){return b5(D),D}function V8(){return $0(F0(vJ(),32),(D)=>g0(D))}function l0(){return C0(x5(),32)}function h5(){return vD(V8(),l0())}var v5=37095705934669439343138083508754565189542113879843219016388785533085940283555n,CD=57896044618658097711785492504343953926634992332820282019728792003956564819949n,xJ=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function SD(D){let $=D%CD;return $>=0n?$:CD+$}function yD(D,$){let J=D;while($-- >0n)J*=J,J%=CD;return J}function y5(D){let J=D*D%CD*D%CD,Q=yD(J,2n)*J%CD,q=yD(Q,1n)*D%CD,G=yD(q,5n)*q%CD,X=yD(G,10n)*G%CD,Y=yD(X,20n)*X%CD,Z=yD(Y,40n)*Y%CD,U=yD(Z,80n)*Z%CD,j=yD(U,80n)*Z%CD,K=yD(j,10n)*G%CD;return yD(K,2n)*D%CD}function f5(D,$){let J=SD($*$*$),Q=SD(J*J*$),q=y5(D*Q),G=SD(D*J*q),X=SD($*G*G),Y=G,Z=SD(G*xJ),U=X===D,j=X===SD(-D),K=X===SD(-D*xJ);if(U)G=Y;if(j||K)G=Z;if((SD(G)&1n)===1n)G=SD(-G);if(!U&&!j)return null;return G}function m5(D,$){let J=SD(D*D),Q=SD(J-1n),q=SD(v5*J+1n),G=f5(Q,q);if(G===null)return!1;let X=($&128)!==0;if(G===0n&&X)return!1;return!0}function u5(D){let $=D.toString(16);if($.length===1)return`0${$}`;else return $}function g5(D){let J=`0x${D.reduce((Q,q,G)=>`${u5(G===31?q&-129:q)}${Q}`,"")}`;return BigInt(J)}function l5(D){if(D.byteLength!==32)return!1;let $=g5(D);return m5($,D[31])}var bJ=32,hJ=16,d5=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,100,114,101,115,115];async function p5({programAddress:D,seeds:$}){if(kJ(),$.length>hJ)throw new v(j6,{actual:$.length,maxSeeds:hJ});let J,Q=$.reduce((Z,U,j)=>{let K=typeof U==="string"?(J||=new TextEncoder).encode(U):U;if(K.byteLength>bJ)throw new v(K6,{actual:K.byteLength,index:j,maxSeedLength:bJ});return Z.push(...K),Z},[]),q=h5(),G=q.encode(D),X=await crypto.subtle.digest("SHA-256",new Uint8Array([...Q,...G,...d5])),Y=new Uint8Array(X);if(l5(Y))throw new v(e8);return q.decode(Y)}async function yJ({programAddress:D,seeds:$}){let J=255;while(J>0)try{return[await p5({programAddress:D,seeds:[...$,new Uint8Array([J])]}),J]}catch(Q){if(RJ(Q,e8))J--;else throw Q}throw new v(W6)}async function q9(D){if(Q9(),D.type!=="public"||D.algorithm.name!=="Ed25519")throw new v(U6);let $=await crypto.subtle.exportKey("raw",D);return l0().decode(new Uint8Array($))}function fJ(D,$,J,Q){if(Q<$||Q>J)throw new v(x6,{codecDescription:D,max:J,min:$,value:Q})}function mJ(D){return D?.endian===1?!1:!0}function c5(D){return GD({fixedSize:D.size,write($,J,Q){if(D.range)fJ(D.name,D.range[0],D.range[1],$);let q=new ArrayBuffer(D.size);return D.set(new DataView(q),$,mJ(D.config)),J.set(new Uint8Array(q),Q),Q+D.size}})}function uJ(D){return s({fixedSize:D.size,read($,J=0){BJ(D.name,$,J),$9(D.name,D.size,$,J);let Q=new DataView(u0($,J,D.size));return[D.get(Q,mJ(D.config)),J+D.size]}})}var gJ=()=>GD({getSizeFromValue:(D)=>{if(D<=127)return 1;if(D<=16383)return 2;return 3},maxSize:3,write:(D,$,J)=>{fJ("shortU16",0,65535,D);let Q=[0];for(let q=0;;q+=1){let G=Number(D)>>q*7;if(G===0)break;let X=127&G;if(Q[q]=X,q>0)Q[q-1]|=128}return $.set(Q,J),J+Q.length}}),p6=()=>s({maxSize:3,read:(D,$)=>{let J=0,Q=0;while(++Q){let q=Q-1,G=D[$+q],X=127&G;if(J|=X<<q*7,(G&128)===0)break}return[J,$+Q]}});var c6=(D={})=>c5({config:D,name:"u32",range:[0,Number("0xffffffff")],set:($,J,Q)=>$.setUint32(0,Number(J),Q),size:4}),a6=(D={})=>uJ({config:D,get:($,J)=>$.getUint32(0,J),name:"u32",size:4});var G9=()=>uJ({get:(D)=>D.getUint8(0),name:"u8",size:1});function r5(D,$,J){if($!==J)throw new v(A6,{actual:J,codecDescription:D,expected:$})}function o5(D){return D.reduce(($,J)=>$===null||J===null?null:Math.max($,J),0)}function d0(D){return D.reduce(($,J)=>$===null||J===null?null:$+J,0)}function N8(D){return ID(D)?D.fixedSize:null}function p0(D){return ID(D)?D.fixedSize:D.maxSize??null}function Y9(D,$={}){let J=$.size??c6(),Q=X9(J,N8(D)),q=X9(J,p0(D))??void 0;return GD({...Q!==null?{fixedSize:Q}:{getSizeFromValue:(G)=>{return(typeof J==="object"?m0(G.length,J):0)+[...G].reduce((Y,Z)=>Y+m0(Z,D),0)},maxSize:q},write:(G,X,Y)=>{if(typeof J==="number")r5($.description??"array",J,G.length);if(typeof J==="object")Y=J.write(G.length,X,Y);return G.forEach((Z)=>{Y=D.write(Z,X,Y)}),Y}})}function c0(D,$={}){let J=$.size??a6(),Q=N8(D),q=X9(J,Q),G=X9(J,p0(D))??void 0;return s({...q!==null?{fixedSize:q}:{maxSize:G},read:(X,Y)=>{let Z=[];if(typeof J==="object"&&X.slice(Y).length===0)return[Z,Y];if(J==="remainder"){while(Y<X.length){let[K,H]=D.read(X,Y);Y=H,Z.push(K)}return[Z,Y]}let[U,j]=typeof J==="number"?[J,Y]:J.read(X,Y);Y=j;for(let K=0;K<U;K+=1){let[H,E]=D.read(X,Y);Y=E,Z.push(H)}return[Z,Y]}})}function X9(D,$){if(typeof D!=="number")return null;if(D===0)return 0;return $===null?null:$*D}function F8(){return GD({getSizeFromValue:(D)=>D.length,write:(D,$,J)=>{return $.set(D,J),J+D.length}})}function Z9(){return s({read:(D,$)=>{let J=D.slice($);return[J,$+J.length]}})}function lJ(D){let $=d0(D.map(N8)),J=d0(D.map(p0))??void 0;return s({...$===null?{maxSize:J}:{fixedSize:$},read:(Q,q)=>{let G=[];return D.forEach((X)=>{let[Y,Z]=X.read(Q,q);G.push(Y),q=Z}),[G,q]}})}function n5(D,$){let J=dJ(D),Q=(G,X,Y)=>{let Z=$(G);return i6(D,Z),D[Z].write(G,X,Y)};if(J!==null)return GD({fixedSize:J,write:Q});let q=pJ(D);return GD({...q!==null?{maxSize:q}:{},getSizeFromValue:(G)=>{let X=$(G);return i6(D,X),m0(G,D[X])},write:Q})}function s5(D,$){let J=dJ(D),Q=(G,X)=>{let Y=$(G,X);return i6(D,Y),D[Y].read(G,X)};if(J!==null)return s({fixedSize:J,read:Q});let q=pJ(D);return s({...q!==null?{maxSize:q}:{},read:Q})}function i6(D,$){if(typeof D[$]>"u")throw new v(v6,{maxRange:D.length-1,minRange:0,variant:$})}function dJ(D){if(D.length===0)return 0;if(!ID(D[0]))return null;let $=D[0].fixedSize;return D.every((Q)=>ID(Q)&&Q.fixedSize===$)?$:null}function pJ(D){return o5(D.map(($)=>p0($)))}function cJ(D,$,J){return n5([$,J],(Q)=>D(Q)?0:1)}function aJ(D,$,J){return s5([$,J],(Q)=>D(Q)?0:1)}function r6(D){let $=D.map(([,q])=>q),J=d0($.map(N8)),Q=d0($.map(p0))??void 0;return GD({...J===null?{getSizeFromValue:(q)=>D.map(([G,X])=>m0(q[G],X)).reduce((G,X)=>G+X,0),maxSize:Q}:{fixedSize:J},write:(q,G,X)=>{return D.forEach(([Y,Z])=>{X=Z.write(q[Y],G,X)}),X}})}function o6(D){let $=D.map(([,q])=>q),J=d0($.map(N8)),Q=d0($.map(p0))??void 0;return s({...J===null?{maxSize:Q}:{fixedSize:J},read:(q,G)=>{let X={};return D.forEach(([Y,Z])=>{let[U,j]=Z.read(q,G);G=j,X[Y]=U}),[X,G]}})}var t5=1,iJ=128;function n6(){return s({maxSize:1,read:(D,$)=>{let J=D[$];if((J&iJ)===0)return["legacy",$];else{let Q=J^iJ;if(Q>t5)throw new v(E8,{unsupportedVersion:Q});return[Q,$+1]}}})}var SW=Symbol("AddressMapTypeProperty");var kW=Symbol("AddressMapTypeProperty");var oJ=Object.freeze({name:"Ed25519"});function e5(D){return new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32,...D])}async function rJ(D,$=!1){let J=D.byteLength;if(J!==32)throw new v(N6,{actualLength:J});let Q=e5(D);return await crypto.subtle.importKey("pkcs8",Q,oJ,$,["sign"])}async function DZ(D,$=!1){if(Q9(),D.extractable===!1)throw new v(V6,{key:D});let J=await crypto.subtle.exportKey("jwk",D);return await crypto.subtle.importKey("jwk",{crv:"Ed25519",ext:$,key_ops:["verify"],kty:"OKP",x:J.x},"Ed25519",$,["verify"])}async function U9(D,$){AJ();let J=await crypto.subtle.sign(oJ,D,u0($));return new Uint8Array(J)}async function nJ(D,$=!1){let J=rJ(D,$),[Q,q]=await Promise.all([($?J:rJ(D,!0)).then(async(G)=>await DZ(G,!0)),J]);return{privateKey:q,publicKey:Q}}function sJ(D){let $=Object.values(D);if($.length===0)throw new v(L6);return $.map((J)=>{if(!J)return new Uint8Array(64).fill(0);return J})}function JZ(){return $0(Y9(F0(F8(),64),{size:gJ()}),sJ)}function QZ(D){return $0(Y9(F0(F8(),64),{description:"signatures",size:D}),sJ)}var qZ=128,GZ=127;function XZ(D){if(D.length===0)throw new v(I6);return n6().decode(D)===1?"messageFirst":"signaturesFirst"}function YZ(D){if(D.length===0)throw new v(w6);let $=D[0];if(($&qZ)===0)return"signaturesFirst";let J=$&GZ;if(J===0)throw new v(T6,{firstByte:$,transactionBytes:D});if(J===1)return"messageFirst";throw new v(E8,{unsupportedVersion:J})}function tJ(){return cJ((D)=>XZ(D.messageBytes)==="signaturesFirst",ZZ(),UZ())}function ZZ(){return r6([["signatures",JZ()],["messageBytes",F8()]])}function s6(D,$){if(D.length<$+2)throw new v(B6,{messageBytes:D});return D[$+1]}function UZ(){let D=F8();return GD({getSizeFromValue:($)=>{let J=s6($.messageBytes,0);return $.messageBytes.length+J*64},write:($,J,Q)=>{Q=D.write($.messageBytes,J,Q);let q=s6($.messageBytes,0);return Q=QZ(q).write($.signatures,J,Q),Q}})}function jZ(){return aJ((D)=>YZ(D)==="signaturesFirst",KZ(),WZ())}function KZ(){return H8(o6([["signatures",c0(C0(Z9(),64),{size:p6()})],["messageBytes",Z9()]]),EZ)}function WZ(){return H8(zZ(),HZ)}function zZ(){return s({read(D,$){let J=s6(D,$),Q=J*64,q=D.length-$-Q;if(q<0)throw new v(O6,{numExpectedSignatures:J,transactionBytes:D.subarray($),transactionBytesLength:D.length-$});let G=D.subarray($,$+q),[X,Y]=c0(C0(Z9(),64),{size:J}).read(D,$+q);return[{messageBytes:G,signatures:X},Y]}})}function eJ(){return vD(tJ(),jZ())}function EZ(D){let{messageBytes:$,signatures:J}=D,Q=lJ([n6(),IJ(G9(),2),c0(l0(),{size:p6()})]),[q,G,X]=Q.decode($),Y=X.slice(0,G);if(Y.length!==J.length)throw new v(D9,{numRequiredSignatures:G,signaturesLength:J.length,signerAddresses:Y});let Z=DQ(Y,J);return{messageBytes:$,signatures:Object.freeze(Z)}}function HZ(D){let{messageBytes:$,signatures:J}=D,Q=$[1],q=14,G=c0(l0(),{size:Q}).decode($,14);if(G.length!==J.length)throw new v(D9,{numRequiredSignatures:Q,signaturesLength:J.length,signerAddresses:G});let X=DQ(G,J);return{messageBytes:$,signatures:X}}function DQ(D,$){let J={};return D.forEach((Q,q)=>{let G=$[q];if(G.every((X)=>X===0))J[Q]=null;else J[Q]=G}),Object.freeze(J)}async function j9(D,$){let J,Q;if(await Promise.all(D.map(async(q)=>{let G=await q9(q.publicKey),X=$.signatures[G];if(X===void 0){Q||=new Set,Q.add(G);return}if(Q)return;let Y=await U9(q.privateKey,$.messageBytes);if(X!==null&&y6(Y,X))return;J||={},J[G]=Y})),Q&&Q.size>0){let q=Object.keys($.signatures);throw new v(R6,{expectedAddresses:q,unexpectedAddresses:[...Q]})}if(!J)return $;return Object.freeze({...$,signatures:Object.freeze({...$.signatures,...J})})}function $Q(D){let $=tJ().encode(D);return g6().decode($)}var VZ=1280,NZ=48,tW=VZ-NZ;async function FZ(D){let $=await q9(D.publicKey);return Object.freeze({address:$,keyPair:D,signMessages:(Q)=>Promise.all(Q.map(async(q)=>Object.freeze({[$]:await U9(D.privateKey,q.content)}))),signTransactions:(Q)=>Promise.all(Q.map(async(q)=>{let G=await j9([D],q);return Object.freeze({[$]:G.signatures[$]})}))})}async function JQ(D,$){return await FZ(await nJ(D,$))}var Yz=globalThis.TextEncoder;import{existsSync as MU,readFileSync as PU,writeFileSync as _U}from"node:fs";import{join as Bq}from"node:path";/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function R0(D){return D instanceof Uint8Array||ArrayBuffer.isView(D)&&D.constructor.name==="Uint8Array"}function HD(D,$=""){if(!Number.isSafeInteger(D)||D<0){let J=$&&`"${$}" `;throw Error(`${J}expected integer >= 0, got ${D}`)}}function h(D,$,J=""){let Q=R0(D),q=D?.length,G=$!==void 0;if(!Q||G&&q!==$){let X=J&&`"${J}" `,Y=G?` of length ${$}`:"",Z=Q?`length=${q}`:`type=${typeof D}`;throw Error(X+"expected Uint8Array"+Y+", got "+Z)}return D}function a0(D){if(typeof D!=="function"||typeof D.create!=="function")throw Error("Hash must wrapped by utils.createHasher");HD(D.outputLen),HD(D.blockLen)}function i0(D,$=!0){if(D.destroyed)throw Error("Hash instance has been destroyed");if($&&D.finished)throw Error("Hash#digest() has already been called")}function qQ(D,$){h(D,void 0,"digestInto() output");let J=$.outputLen;if(D.length<J)throw Error('"digestInto() output" expected to be of length >='+J)}function XD(...D){for(let $=0;$<D.length;$++)D[$].fill(0)}function fD(D){return new DataView(D.buffer,D.byteOffset,D.byteLength)}function xD(D,$){return D<<32-$|D>>>$}function cD(D,$){return D<<$|D>>>32-$>>>0}var GQ=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),CZ=Array.from({length:256},(D,$)=>$.toString(16).padStart(2,"0"));function aD(D){if(h(D),GQ)return D.toHex();let $="";for(let J=0;J<D.length;J++)$+=CZ[D[J]];return $}var pD={_0:48,_9:57,A:65,F:70,a:97,f:102};function QQ(D){if(D>=pD._0&&D<=pD._9)return D-pD._0;if(D>=pD.A&&D<=pD.F)return D-(pD.A-10);if(D>=pD.a&&D<=pD.f)return D-(pD.a-10);return}function iD(D){if(typeof D!=="string")throw Error("hex string expected, got "+typeof D);if(GQ)return Uint8Array.fromHex(D);let $=D.length,J=$/2;if($%2)throw Error("hex string expected, got unpadded hex of length "+$);let Q=new Uint8Array(J);for(let q=0,G=0;q<J;q++,G+=2){let X=QQ(D.charCodeAt(G)),Y=QQ(D.charCodeAt(G+1));if(X===void 0||Y===void 0){let Z=D[G]+D[G+1];throw Error('hex string expected, got non-hex character "'+Z+'" at index '+G)}Q[q]=X*16+Y}return Q}function RZ(D){if(typeof D!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(D))}function t6(D,$=""){if(typeof D==="string")return RZ(D);return h(D,void 0,$)}function QD(...D){let $=0;for(let Q=0;Q<D.length;Q++){let q=D[Q];h(q),$+=q.length}let J=new Uint8Array($);for(let Q=0,q=0;Q<D.length;Q++){let G=D[Q];J.set(G,q),q+=G.length}return J}function XQ(D,$){if($!==void 0&&{}.toString.call($)!=="[object Object]")throw Error("options must be object or undefined");return Object.assign(D,$)}function C8(D,$={}){let J=(q,G)=>D(G).update(q).digest(),Q=D(void 0);return J.outputLen=Q.outputLen,J.blockLen=Q.blockLen,J.create=(q)=>D(q),Object.assign(J,$),Object.freeze(J)}function J0(D=32){let $=typeof globalThis==="object"?globalThis.crypto:null;if(typeof $?.getRandomValues!=="function")throw Error("crypto.getRandomValues must be defined");return $.getRandomValues(new Uint8Array(D))}var e6=(D)=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,D])});function r0(D,$,J){return D&$^~D&J}function K9(D,$,J){return D&$^D&J^$&J}class Q0{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(D,$,J,Q){this.blockLen=D,this.outputLen=$,this.padOffset=J,this.isLE=Q,this.buffer=new Uint8Array(D),this.view=fD(this.buffer)}update(D){i0(this),h(D);let{view:$,buffer:J,blockLen:Q}=this,q=D.length;for(let G=0;G<q;){let X=Math.min(Q-this.pos,q-G);if(X===Q){let Y=fD(D);for(;Q<=q-G;G+=Q)this.process(Y,G);continue}if(J.set(D.subarray(G,G+X),this.pos),this.pos+=X,G+=X,this.pos===Q)this.process($,0),this.pos=0}return this.length+=D.length,this.roundClean(),this}digestInto(D){i0(this),qQ(D,this),this.finished=!0;let{buffer:$,view:J,blockLen:Q,isLE:q}=this,{pos:G}=this;if($[G++]=128,XD(this.buffer.subarray(G)),this.padOffset>Q-G)this.process(J,0),G=0;for(let j=G;j<Q;j++)$[j]=0;J.setBigUint64(Q-8,BigInt(this.length*8),q),this.process(J,0);let X=fD(D),Y=this.outputLen;if(Y%4)throw Error("_sha2: outputLen must be aligned to 32bit");let Z=Y/4,U=this.get();if(Z>U.length)throw Error("_sha2: outputLen bigger than state");for(let j=0;j<Z;j++)X.setUint32(4*j,U[j],q)}digest(){let{buffer:D,outputLen:$}=this;this.digestInto(D);let J=D.slice(0,$);return this.destroy(),J}_cloneInto(D){D||=new this.constructor,D.set(...this.get());let{blockLen:$,buffer:J,length:Q,finished:q,destroyed:G,pos:X}=this;if(D.destroyed=G,D.finished=q,D.length=Q,D.pos=X,Q%$)D.buffer.set(J);return D}clone(){return this._cloneInto()}}var rD=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),oD=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),KD=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),WD=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var W9=BigInt(4294967295),YQ=BigInt(32);function LZ(D,$=!1){if($)return{h:Number(D&W9),l:Number(D>>YQ&W9)};return{h:Number(D>>YQ&W9)|0,l:Number(D&W9)|0}}function ZQ(D,$=!1){let J=D.length,Q=new Uint32Array(J),q=new Uint32Array(J);for(let G=0;G<J;G++){let{h:X,l:Y}=LZ(D[G],$);[Q[G],q[G]]=[X,Y]}return[Q,q]}var D7=(D,$,J)=>D>>>J,$7=(D,$,J)=>D<<32-J|$>>>J,L0=(D,$,J)=>D>>>J|$<<32-J,B0=(D,$,J)=>D<<32-J|$>>>J,R8=(D,$,J)=>D<<64-J|$>>>J-32,L8=(D,$,J)=>D>>>J-32|$<<64-J;function mD(D,$,J,Q){let q=($>>>0)+(Q>>>0);return{h:D+J+(q/4294967296|0)|0,l:q|0}}var UQ=(D,$,J)=>(D>>>0)+($>>>0)+(J>>>0),jQ=(D,$,J,Q)=>$+J+Q+(D/4294967296|0)|0,KQ=(D,$,J,Q)=>(D>>>0)+($>>>0)+(J>>>0)+(Q>>>0),WQ=(D,$,J,Q,q)=>$+J+Q+q+(D/4294967296|0)|0,zQ=(D,$,J,Q,q)=>(D>>>0)+($>>>0)+(J>>>0)+(Q>>>0)+(q>>>0),EQ=(D,$,J,Q,q,G)=>$+J+Q+q+G+(D/4294967296|0)|0;var IZ=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),q0=new Uint32Array(64);class J7 extends Q0{constructor(D){super(64,D,8,!1)}get(){let{A:D,B:$,C:J,D:Q,E:q,F:G,G:X,H:Y}=this;return[D,$,J,Q,q,G,X,Y]}set(D,$,J,Q,q,G,X,Y){this.A=D|0,this.B=$|0,this.C=J|0,this.D=Q|0,this.E=q|0,this.F=G|0,this.G=X|0,this.H=Y|0}process(D,$){for(let j=0;j<16;j++,$+=4)q0[j]=D.getUint32($,!1);for(let j=16;j<64;j++){let K=q0[j-15],H=q0[j-2],E=xD(K,7)^xD(K,18)^K>>>3,z=xD(H,17)^xD(H,19)^H>>>10;q0[j]=z+q0[j-7]+E+q0[j-16]|0}let{A:J,B:Q,C:q,D:G,E:X,F:Y,G:Z,H:U}=this;for(let j=0;j<64;j++){let K=xD(X,6)^xD(X,11)^xD(X,25),H=U+K+r0(X,Y,Z)+IZ[j]+q0[j]|0,z=(xD(J,2)^xD(J,13)^xD(J,22))+K9(J,Q,q)|0;U=Z,Z=Y,Y=X,X=G+H|0,G=q,q=Q,Q=J,J=H+z|0}J=J+this.A|0,Q=Q+this.B|0,q=q+this.C|0,G=G+this.D|0,X=X+this.E|0,Y=Y+this.F|0,Z=Z+this.G|0,U=U+this.H|0,this.set(J,Q,q,G,X,Y,Z,U)}roundClean(){XD(q0)}destroy(){this.set(0,0,0,0,0,0,0,0),XD(this.buffer)}}class HQ extends J7{A=rD[0]|0;B=rD[1]|0;C=rD[2]|0;D=rD[3]|0;E=rD[4]|0;F=rD[5]|0;G=rD[6]|0;H=rD[7]|0;constructor(){super(32)}}class wZ extends J7{A=oD[0]|0;B=oD[1]|0;C=oD[2]|0;D=oD[3]|0;E=oD[4]|0;F=oD[5]|0;G=oD[6]|0;H=oD[7]|0;constructor(){super(28)}}var VQ=(()=>ZQ(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((D)=>BigInt(D))))(),TZ=(()=>VQ[0])(),OZ=(()=>VQ[1])(),G0=new Uint32Array(80),X0=new Uint32Array(80);class B8 extends Q0{constructor(D){super(128,D,16,!1)}get(){let{Ah:D,Al:$,Bh:J,Bl:Q,Ch:q,Cl:G,Dh:X,Dl:Y,Eh:Z,El:U,Fh:j,Fl:K,Gh:H,Gl:E,Hh:z,Hl:C}=this;return[D,$,J,Q,q,G,X,Y,Z,U,j,K,H,E,z,C]}set(D,$,J,Q,q,G,X,Y,Z,U,j,K,H,E,z,C){this.Ah=D|0,this.Al=$|0,this.Bh=J|0,this.Bl=Q|0,this.Ch=q|0,this.Cl=G|0,this.Dh=X|0,this.Dl=Y|0,this.Eh=Z|0,this.El=U|0,this.Fh=j|0,this.Fl=K|0,this.Gh=H|0,this.Gl=E|0,this.Hh=z|0,this.Hl=C|0}process(D,$){for(let N=0;N<16;N++,$+=4)G0[N]=D.getUint32($),X0[N]=D.getUint32($+=4);for(let N=16;N<80;N++){let w=G0[N-15]|0,O=X0[N-15]|0,f=L0(w,O,1)^L0(w,O,8)^D7(w,O,7),c=B0(w,O,1)^B0(w,O,8)^$7(w,O,7),g=G0[N-2]|0,M=X0[N-2]|0,T=L0(g,M,19)^R8(g,M,61)^D7(g,M,6),y=B0(g,M,19)^L8(g,M,61)^$7(g,M,6),l=KQ(c,y,X0[N-7],X0[N-16]),R=WQ(l,f,T,G0[N-7],G0[N-16]);G0[N]=R|0,X0[N]=l|0}let{Ah:J,Al:Q,Bh:q,Bl:G,Ch:X,Cl:Y,Dh:Z,Dl:U,Eh:j,El:K,Fh:H,Fl:E,Gh:z,Gl:C,Hh:W,Hl:V}=this;for(let N=0;N<80;N++){let w=L0(j,K,14)^L0(j,K,18)^R8(j,K,41),O=B0(j,K,14)^B0(j,K,18)^L8(j,K,41),f=j&H^~j&z,c=K&E^~K&C,g=zQ(V,O,c,OZ[N],X0[N]),M=EQ(g,W,w,f,TZ[N],G0[N]),T=g|0,y=L0(J,Q,28)^R8(J,Q,34)^R8(J,Q,39),l=B0(J,Q,28)^L8(J,Q,34)^L8(J,Q,39),R=J&q^J&X^q&X,I=Q&G^Q&Y^G&Y;W=z|0,V=C|0,z=H|0,C=E|0,H=j|0,E=K|0,{h:j,l:K}=mD(Z|0,U|0,M|0,T|0),Z=X|0,U=Y|0,X=q|0,Y=G|0,q=J|0,G=Q|0;let F=UQ(T,l,I);J=jQ(F,M,y,R),Q=F|0}({h:J,l:Q}=mD(this.Ah|0,this.Al|0,J|0,Q|0)),{h:q,l:G}=mD(this.Bh|0,this.Bl|0,q|0,G|0),{h:X,l:Y}=mD(this.Ch|0,this.Cl|0,X|0,Y|0),{h:Z,l:U}=mD(this.Dh|0,this.Dl|0,Z|0,U|0),{h:j,l:K}=mD(this.Eh|0,this.El|0,j|0,K|0),{h:H,l:E}=mD(this.Fh|0,this.Fl|0,H|0,E|0),{h:z,l:C}=mD(this.Gh|0,this.Gl|0,z|0,C|0),{h:W,l:V}=mD(this.Hh|0,this.Hl|0,W|0,V|0),this.set(J,Q,q,G,X,Y,Z,U,j,K,H,E,z,C,W,V)}roundClean(){XD(G0,X0)}destroy(){XD(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class NQ extends B8{Ah=WD[0]|0;Al=WD[1]|0;Bh=WD[2]|0;Bl=WD[3]|0;Ch=WD[4]|0;Cl=WD[5]|0;Dh=WD[6]|0;Dl=WD[7]|0;Eh=WD[8]|0;El=WD[9]|0;Fh=WD[10]|0;Fl=WD[11]|0;Gh=WD[12]|0;Gl=WD[13]|0;Hh=WD[14]|0;Hl=WD[15]|0;constructor(){super(64)}}class MZ extends B8{Ah=KD[0]|0;Al=KD[1]|0;Bh=KD[2]|0;Bl=KD[3]|0;Ch=KD[4]|0;Cl=KD[5]|0;Dh=KD[6]|0;Dl=KD[7]|0;Eh=KD[8]|0;El=KD[9]|0;Fh=KD[10]|0;Fl=KD[11]|0;Gh=KD[12]|0;Gl=KD[13]|0;Hh=KD[14]|0;Hl=KD[15]|0;constructor(){super(48)}}var VD=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),ND=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class PZ extends B8{Ah=VD[0]|0;Al=VD[1]|0;Bh=VD[2]|0;Bl=VD[3]|0;Ch=VD[4]|0;Cl=VD[5]|0;Dh=VD[6]|0;Dl=VD[7]|0;Eh=VD[8]|0;El=VD[9]|0;Fh=VD[10]|0;Fl=VD[11]|0;Gh=VD[12]|0;Gl=VD[13]|0;Hh=VD[14]|0;Hl=VD[15]|0;constructor(){super(28)}}class _Z extends B8{Ah=ND[0]|0;Al=ND[1]|0;Bh=ND[2]|0;Bl=ND[3]|0;Ch=ND[4]|0;Cl=ND[5]|0;Dh=ND[6]|0;Dl=ND[7]|0;Eh=ND[8]|0;El=ND[9]|0;Fh=ND[10]|0;Fl=ND[11]|0;Gh=ND[12]|0;Gl=ND[13]|0;Hh=ND[14]|0;Hl=ND[15]|0;constructor(){super(32)}}var I0=C8(()=>new HQ,e6(1));var w0=C8(()=>new NQ,e6(3));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var q7=BigInt(0),Q7=BigInt(1);function nD(D,$=""){if(typeof D!=="boolean"){let J=$&&`"${$}" `;throw Error(J+"expected boolean, got type="+typeof D)}return D}function FQ(D){if(typeof D==="bigint"){if(!z9(D))throw Error("positive bigint expected, got "+D)}else HD(D);return D}function I8(D){let $=FQ(D).toString(16);return $.length&1?"0"+$:$}function CQ(D){if(typeof D!=="string")throw Error("hex string expected, got "+typeof D);return D===""?q7:BigInt("0x"+D)}function o0(D){return CQ(aD(D))}function T0(D){return CQ(aD(H9(h(D)).reverse()))}function E9(D,$){HD($),D=FQ(D);let J=iD(D.toString(16).padStart($*2,"0"));if(J.length!==$)throw Error("number too large");return J}function G7(D,$){return E9(D,$).reverse()}function H9(D){return Uint8Array.from(D)}var z9=(D)=>typeof D==="bigint"&&q7<=D;function SZ(D,$,J){return z9(D)&&z9($)&&z9(J)&&$<=D&&D<J}function w8(D,$,J,Q){if(!SZ($,J,Q))throw Error("expected valid "+D+": "+J+" <= n < "+Q+", got "+$)}function X7(D){let $;for($=0;D>q7;D>>=Q7,$+=1);return $}var T8=(D)=>(Q7<<BigInt(D))-Q7;function RQ(D,$,J){if(HD(D,"hashLen"),HD($,"qByteLen"),typeof J!=="function")throw Error("hmacFn must be a function");let Q=(W)=>new Uint8Array(W),q=Uint8Array.of(),G=Uint8Array.of(0),X=Uint8Array.of(1),Y=1000,Z=Q(D),U=Q(D),j=0,K=()=>{Z.fill(1),U.fill(0),j=0},H=(...W)=>J(U,QD(Z,...W)),E=(W=q)=>{if(U=H(G,W),Z=H(),W.length===0)return;U=H(X,W),Z=H()},z=()=>{if(j++>=Y)throw Error("drbg: tried max amount of iterations");let W=0,V=[];while(W<$){Z=H();let N=Z.slice();V.push(N),W+=Z.length}return QD(...V)};return(W,V)=>{K(),E(W);let N=void 0;while(!(N=V(z())))E();return K(),N}}function Y0(D,$={},J={}){if(!D||typeof D!=="object")throw Error("expected valid options object");function Q(G,X,Y){let Z=D[G];if(Y&&Z===void 0)return;let U=typeof Z;if(U!==X||Z===null)throw Error(`param "${G}" is invalid: expected ${X}, got ${U}`)}let q=(G,X)=>Object.entries(G).forEach(([Y,Z])=>Q(Y,Z,X));q($,!1),q(J,!0)}function n0(D){let $=new WeakMap;return(J,...Q)=>{let q=$.get(J);if(q!==void 0)return q;let G=D(J,...Q);return $.set(J,G),G}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var RD=BigInt(0),YD=BigInt(1),O0=BigInt(2),IQ=BigInt(3),wQ=BigInt(4),TQ=BigInt(5),kZ=BigInt(7),OQ=BigInt(8),AZ=BigInt(9),MQ=BigInt(16);function t(D,$){let J=D%$;return J>=RD?J:$+J}function n(D,$,J){let Q=D;while($-- >RD)Q*=Q,Q%=J;return Q}function LQ(D,$){if(D===RD)throw Error("invert: expected non-zero number");if($<=RD)throw Error("invert: expected positive modulus, got "+$);let J=t(D,$),Q=$,q=RD,G=YD,X=YD,Y=RD;while(J!==RD){let U=Q/J,j=Q%J,K=q-X*U,H=G-Y*U;Q=J,J=j,q=X,G=Y,X=K,Y=H}if(Q!==YD)throw Error("invert: does not exist");return t(q,$)}function Y7(D,$,J){if(!D.eql(D.sqr($),J))throw Error("Cannot find square root")}function PQ(D,$){let J=(D.ORDER+YD)/wQ,Q=D.pow($,J);return Y7(D,Q,$),Q}function xZ(D,$){let J=(D.ORDER-TQ)/OQ,Q=D.mul($,O0),q=D.pow(Q,J),G=D.mul($,q),X=D.mul(D.mul(G,O0),q),Y=D.mul(G,D.sub(X,D.ONE));return Y7(D,Y,$),Y}function bZ(D){let $=s0(D),J=_Q(D),Q=J($,$.neg($.ONE)),q=J($,Q),G=J($,$.neg(Q)),X=(D+kZ)/MQ;return(Y,Z)=>{let U=Y.pow(Z,X),j=Y.mul(U,Q),K=Y.mul(U,q),H=Y.mul(U,G),E=Y.eql(Y.sqr(j),Z),z=Y.eql(Y.sqr(K),Z);U=Y.cmov(U,j,E),j=Y.cmov(H,K,z);let C=Y.eql(Y.sqr(j),Z),W=Y.cmov(U,j,C);return Y7(Y,W,Z),W}}function _Q(D){if(D<IQ)throw Error("sqrt is not defined for small field");let $=D-YD,J=0;while($%O0===RD)$/=O0,J++;let Q=O0,q=s0(D);while(BQ(q,Q)===1)if(Q++>1000)throw Error("Cannot find square root: probably non-prime P");if(J===1)return PQ;let G=q.pow(Q,$),X=($+YD)/O0;return function(Z,U){if(Z.is0(U))return U;if(BQ(Z,U)!==1)throw Error("Cannot find square root");let j=J,K=Z.mul(Z.ONE,G),H=Z.pow(U,$),E=Z.pow(U,X);while(!Z.eql(H,Z.ONE)){if(Z.is0(H))return Z.ZERO;let z=1,C=Z.sqr(H);while(!Z.eql(C,Z.ONE))if(z++,C=Z.sqr(C),z===j)throw Error("Cannot find square root");let W=YD<<BigInt(j-z-1),V=Z.pow(K,W);j=z,K=Z.sqr(V),H=Z.mul(H,K),E=Z.mul(E,V)}return E}}function hZ(D){if(D%wQ===IQ)return PQ;if(D%OQ===TQ)return xZ;if(D%MQ===AZ)return bZ(D);return _Q(D)}var SQ=(D,$)=>(t(D,$)&YD)===YD,vZ=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Z7(D){let $={ORDER:"bigint",BYTES:"number",BITS:"number"},J=vZ.reduce((Q,q)=>{return Q[q]="function",Q},$);return Y0(D,J),D}function yZ(D,$,J){if(J<RD)throw Error("invalid exponent, negatives unsupported");if(J===RD)return D.ONE;if(J===YD)return $;let Q=D.ONE,q=$;while(J>RD){if(J&YD)Q=D.mul(Q,q);q=D.sqr(q),J>>=YD}return Q}function O8(D,$,J=!1){let Q=Array($.length).fill(J?D.ZERO:void 0),q=$.reduce((X,Y,Z)=>{if(D.is0(Y))return X;return Q[Z]=X,D.mul(X,Y)},D.ONE),G=D.inv(q);return $.reduceRight((X,Y,Z)=>{if(D.is0(Y))return X;return Q[Z]=D.mul(X,Q[Z]),D.mul(X,Y)},G),Q}function BQ(D,$){let J=(D.ORDER-YD)/O0,Q=D.pow($,J),q=D.eql(Q,D.ONE),G=D.eql(Q,D.ZERO),X=D.eql(Q,D.neg(D.ONE));if(!q&&!G&&!X)throw Error("invalid Legendre symbol result");return q?1:G?0:-1}function fZ(D,$){if($!==void 0)HD($);let J=$!==void 0?$:D.toString(2).length,Q=Math.ceil(J/8);return{nBitLength:J,nByteLength:Q}}class kQ{ORDER;BITS;BYTES;isLE;ZERO=RD;ONE=YD;_lengths;_sqrt;_mod;constructor(D,$={}){if(D<=RD)throw Error("invalid field: expected ORDER > 0, got "+D);let J=void 0;if(this.isLE=!1,$!=null&&typeof $==="object"){if(typeof $.BITS==="number")J=$.BITS;if(typeof $.sqrt==="function")this.sqrt=$.sqrt;if(typeof $.isLE==="boolean")this.isLE=$.isLE;if($.allowedLengths)this._lengths=$.allowedLengths?.slice();if(typeof $.modFromBytes==="boolean")this._mod=$.modFromBytes}let{nBitLength:Q,nByteLength:q}=fZ(D,J);if(q>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=D,this.BITS=Q,this.BYTES=q,this._sqrt=void 0,Object.preventExtensions(this)}create(D){return t(D,this.ORDER)}isValid(D){if(typeof D!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof D);return RD<=D&&D<this.ORDER}is0(D){return D===RD}isValidNot0(D){return!this.is0(D)&&this.isValid(D)}isOdd(D){return(D&YD)===YD}neg(D){return t(-D,this.ORDER)}eql(D,$){return D===$}sqr(D){return t(D*D,this.ORDER)}add(D,$){return t(D+$,this.ORDER)}sub(D,$){return t(D-$,this.ORDER)}mul(D,$){return t(D*$,this.ORDER)}pow(D,$){return yZ(this,D,$)}div(D,$){return t(D*LQ($,this.ORDER),this.ORDER)}sqrN(D){return D*D}addN(D,$){return D+$}subN(D,$){return D-$}mulN(D,$){return D*$}inv(D){return LQ(D,this.ORDER)}sqrt(D){if(!this._sqrt)this._sqrt=hZ(this.ORDER);return this._sqrt(this,D)}toBytes(D){return this.isLE?G7(D,this.BYTES):E9(D,this.BYTES)}fromBytes(D,$=!1){h(D);let{_lengths:J,BYTES:Q,isLE:q,ORDER:G,_mod:X}=this;if(J){if(!J.includes(D.length)||D.length>Q)throw Error("Field.fromBytes: expected "+J+" bytes, got "+D.length);let Z=new Uint8Array(Q);Z.set(D,q?0:Z.length-D.length),D=Z}if(D.length!==Q)throw Error("Field.fromBytes: expected "+Q+" bytes, got "+D.length);let Y=q?T0(D):o0(D);if(X)Y=t(Y,G);if(!$){if(!this.isValid(Y))throw Error("invalid field element: outside of range 0..ORDER")}return Y}invertBatch(D){return O8(this,D)}cmov(D,$,J){return J?$:D}}function s0(D,$={}){return new kQ(D,$)}function AQ(D){if(typeof D!=="bigint")throw Error("field order must be bigint");let $=D.toString(2).length;return Math.ceil($/8)}function U7(D){let $=AQ(D);return $+Math.ceil($/2)}function j7(D,$,J=!1){h(D);let Q=D.length,q=AQ($),G=U7($);if(Q<16||Q<G||Q>1024)throw Error("expected "+G+"-1024 bytes of input, got "+Q);let X=J?T0(D):o0(D),Y=t(X,$-YD)+YD;return J?G7(Y,q):E9(Y,q)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var t0=BigInt(0),M0=BigInt(1);function M8(D,$){let J=$.negate();return D?J:$}function P0(D,$){let J=O8(D.Fp,$.map((Q)=>Q.Z));return $.map((Q,q)=>D.fromAffine(Q.toAffine(J[q])))}function vQ(D,$){if(!Number.isSafeInteger(D)||D<=0||D>$)throw Error("invalid window size, expected [1.."+$+"], got W="+D)}function K7(D,$){vQ(D,$);let J=Math.ceil($/D)+1,Q=2**(D-1),q=2**D,G=T8(D),X=BigInt(D);return{windows:J,windowSize:Q,mask:G,maxNumber:q,shiftBy:X}}function xQ(D,$,J){let{windowSize:Q,mask:q,maxNumber:G,shiftBy:X}=J,Y=Number(D&q),Z=D>>X;if(Y>Q)Y-=G,Z+=M0;let U=$*Q,j=U+Math.abs(Y)-1,K=Y===0,H=Y<0,E=$%2!==0;return{nextN:Z,offset:j,isZero:K,isNeg:H,isNegF:E,offsetF:U}}var W7=new WeakMap,yQ=new WeakMap;function z7(D){return yQ.get(D)||1}function bQ(D){if(D!==t0)throw Error("invalid wNAF")}class P8{BASE;ZERO;Fn;bits;constructor(D,$){this.BASE=D.BASE,this.ZERO=D.ZERO,this.Fn=D.Fn,this.bits=$}_unsafeLadder(D,$,J=this.ZERO){let Q=D;while($>t0){if($&M0)J=J.add(Q);Q=Q.double(),$>>=M0}return J}precomputeWindow(D,$){let{windows:J,windowSize:Q}=K7($,this.bits),q=[],G=D,X=G;for(let Y=0;Y<J;Y++){X=G,q.push(X);for(let Z=1;Z<Q;Z++)X=X.add(G),q.push(X);G=X.double()}return q}wNAF(D,$,J){if(!this.Fn.isValid(J))throw Error("invalid scalar");let Q=this.ZERO,q=this.BASE,G=K7(D,this.bits);for(let X=0;X<G.windows;X++){let{nextN:Y,offset:Z,isZero:U,isNeg:j,isNegF:K,offsetF:H}=xQ(J,X,G);if(J=Y,U)q=q.add(M8(K,$[H]));else Q=Q.add(M8(j,$[Z]))}return bQ(J),{p:Q,f:q}}wNAFUnsafe(D,$,J,Q=this.ZERO){let q=K7(D,this.bits);for(let G=0;G<q.windows;G++){if(J===t0)break;let{nextN:X,offset:Y,isZero:Z,isNeg:U}=xQ(J,G,q);if(J=X,Z)continue;else{let j=$[Y];Q=Q.add(U?j.negate():j)}}return bQ(J),Q}getPrecomputes(D,$,J){let Q=W7.get($);if(!Q){if(Q=this.precomputeWindow($,D),D!==1){if(typeof J==="function")Q=J(Q);W7.set($,Q)}}return Q}cached(D,$,J){let Q=z7(D);return this.wNAF(Q,this.getPrecomputes(Q,D,J),$)}unsafe(D,$,J,Q){let q=z7(D);if(q===1)return this._unsafeLadder(D,$,Q);return this.wNAFUnsafe(q,this.getPrecomputes(q,D,J),$,Q)}createCache(D,$){vQ($,this.bits),yQ.set(D,$),W7.delete(D)}hasCache(D){return z7(D)!==1}}function fQ(D,$,J,Q){let q=$,G=D.ZERO,X=D.ZERO;while(J>t0||Q>t0){if(J&M0)G=G.add(q);if(Q&M0)X=X.add(q);q=q.double(),J>>=M0,Q>>=M0}return{p1:G,p2:X}}function hQ(D,$,J){if($){if($.ORDER!==D)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return Z7($),$}else return s0(D,{isLE:J})}function V9(D,$,J={},Q){if(Q===void 0)Q=D==="edwards";if(!$||typeof $!=="object")throw Error(`expected valid ${D} CURVE object`);for(let Z of["p","n","h"]){let U=$[Z];if(!(typeof U==="bigint"&&U>t0))throw Error(`CURVE.${Z} must be positive bigint`)}let q=hQ($.p,J.Fp,Q),G=hQ($.n,J.Fn,Q),Y=["Gx","Gy","a",D==="weierstrass"?"b":"d"];for(let Z of Y)if(!q.isValid($[Z]))throw Error(`CURVE.${Z} must be valid field element of CURVE.Fp`);return $=Object.freeze(Object.assign({},$)),{CURVE:$,Fp:q,Fn:G}}function N9(D,$){return function(Q){let q=D(Q);return{secretKey:q,publicKey:$(q)}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var Z0=BigInt(0),ZD=BigInt(1),E7=BigInt(2),mZ=BigInt(8);function uZ(D,$,J,Q){let q=D.sqr(J),G=D.sqr(Q),X=D.add(D.mul($.a,q),G),Y=D.add(D.ONE,D.mul($.d,D.mul(q,G)));return D.eql(X,Y)}function mQ(D,$={}){let J=V9("edwards",D,$,$.FpFnLE),{Fp:Q,Fn:q}=J,G=J.CURVE,{h:X}=G;Y0($,{},{uvRatio:"function"});let Y=E7<<BigInt(q.BYTES*8)-ZD,Z=(W)=>Q.create(W),U=$.uvRatio||((W,V)=>{try{return{isValid:!0,value:Q.sqrt(Q.div(W,V))}}catch(N){return{isValid:!1,value:Z0}}});if(!uZ(Q,G,G.Gx,G.Gy))throw Error("bad curve params: generator point");function j(W,V,N=!1){let w=N?ZD:Z0;return w8("coordinate "+W,V,w,Y),V}function K(W){if(!(W instanceof z))throw Error("EdwardsPoint expected")}let H=n0((W,V)=>{let{X:N,Y:w,Z:O}=W,f=W.is0();if(V==null)V=f?mZ:Q.inv(O);let c=Z(N*V),g=Z(w*V),M=Q.mul(O,V);if(f)return{x:Z0,y:ZD};if(M!==ZD)throw Error("invZ was invalid");return{x:c,y:g}}),E=n0((W)=>{let{a:V,d:N}=G;if(W.is0())throw Error("bad point: ZERO");let{X:w,Y:O,Z:f,T:c}=W,g=Z(w*w),M=Z(O*O),T=Z(f*f),y=Z(T*T),l=Z(g*V),R=Z(T*Z(l+M)),I=Z(y+Z(N*Z(g*M)));if(R!==I)throw Error("bad point: equation left != right (1)");let F=Z(w*O),B=Z(f*c);if(F!==B)throw Error("bad point: equation left != right (2)");return!0});class z{static BASE=new z(G.Gx,G.Gy,ZD,Z(G.Gx*G.Gy));static ZERO=new z(Z0,ZD,ZD,Z0);static Fp=Q;static Fn=q;X;Y;Z;T;constructor(W,V,N,w){this.X=j("x",W),this.Y=j("y",V),this.Z=j("z",N,!0),this.T=j("t",w),Object.freeze(this)}static CURVE(){return G}static fromAffine(W){if(W instanceof z)throw Error("extended point not allowed");let{x:V,y:N}=W||{};return j("x",V),j("y",N),new z(V,N,ZD,Z(V*N))}static fromBytes(W,V=!1){let N=Q.BYTES,{a:w,d:O}=G;W=H9(h(W,N,"point")),nD(V,"zip215");let f=H9(W),c=W[N-1];f[N-1]=c&-129;let g=T0(f),M=V?Y:Q.ORDER;w8("point.y",g,Z0,M);let T=Z(g*g),y=Z(T-ZD),l=Z(O*T-w),{isValid:R,value:I}=U(y,l);if(!R)throw Error("bad point: invalid y coordinate");let F=(I&ZD)===ZD,B=(c&128)!==0;if(!V&&I===Z0&&B)throw Error("bad point: x=0 and x_0=1");if(B!==F)I=Z(-I);return z.fromAffine({x:I,y:g})}static fromHex(W,V=!1){return z.fromBytes(iD(W),V)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(W=8,V=!0){if(C.createCache(this,W),!V)this.multiply(E7);return this}assertValidity(){E(this)}equals(W){K(W);let{X:V,Y:N,Z:w}=this,{X:O,Y:f,Z:c}=W,g=Z(V*c),M=Z(O*w),T=Z(N*c),y=Z(f*w);return g===M&&T===y}is0(){return this.equals(z.ZERO)}negate(){return new z(Z(-this.X),this.Y,this.Z,Z(-this.T))}double(){let{a:W}=G,{X:V,Y:N,Z:w}=this,O=Z(V*V),f=Z(N*N),c=Z(E7*Z(w*w)),g=Z(W*O),M=V+N,T=Z(Z(M*M)-O-f),y=g+f,l=y-c,R=g-f,I=Z(T*l),F=Z(y*R),B=Z(T*R),P=Z(l*y);return new z(I,F,P,B)}add(W){K(W);let{a:V,d:N}=G,{X:w,Y:O,Z:f,T:c}=this,{X:g,Y:M,Z:T,T:y}=W,l=Z(w*g),R=Z(O*M),I=Z(c*N*y),F=Z(f*T),B=Z((w+O)*(g+M)-l-R),P=F-I,S=F+I,_=Z(R-V*l),A=Z(B*P),x=Z(S*_),b=Z(B*_),e=Z(P*S);return new z(A,x,e,b)}subtract(W){return this.add(W.negate())}multiply(W){if(!q.isValidNot0(W))throw Error("invalid scalar: expected 1 <= sc < curve.n");let{p:V,f:N}=C.cached(this,W,(w)=>P0(z,w));return P0(z,[V,N])[0]}multiplyUnsafe(W,V=z.ZERO){if(!q.isValid(W))throw Error("invalid scalar: expected 0 <= sc < curve.n");if(W===Z0)return z.ZERO;if(this.is0()||W===ZD)return this;return C.unsafe(this,W,(N)=>P0(z,N),V)}isSmallOrder(){return this.multiplyUnsafe(X).is0()}isTorsionFree(){return C.unsafe(this,G.n).is0()}toAffine(W){return H(this,W)}clearCofactor(){if(X===ZD)return this;return this.multiplyUnsafe(X)}toBytes(){let{x:W,y:V}=this.toAffine(),N=Q.toBytes(V);return N[N.length-1]|=W&ZD?128:0,N}toHex(){return aD(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let C=new P8(z,q.BITS);return z.BASE.precompute(8),z}function uQ(D,$,J={}){if(typeof $!=="function")throw Error('"hash" function param is required');Y0(J,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:Q}=J,{BASE:q,Fp:G,Fn:X}=D,Y=J.randomBytes||J0,Z=J.adjustScalarBytes||((M)=>M),U=J.domain||((M,T,y)=>{if(nD(y,"phflag"),T.length||y)throw Error("Contexts/pre-hash are not supported");return M});function j(M){return X.create(T0(M))}function K(M){let T=w.secretKey;h(M,w.secretKey,"secretKey");let y=h($(M),2*T,"hashedSecretKey"),l=Z(y.slice(0,T)),R=y.slice(T,2*T),I=j(l);return{head:l,prefix:R,scalar:I}}function H(M){let{head:T,prefix:y,scalar:l}=K(M),R=q.multiply(l),I=R.toBytes();return{head:T,prefix:y,scalar:l,point:R,pointBytes:I}}function E(M){return H(M).pointBytes}function z(M=Uint8Array.of(),...T){let y=QD(...T);return j($(U(y,h(M,void 0,"context"),!!Q)))}function C(M,T,y={}){if(M=h(M,void 0,"message"),Q)M=Q(M);let{prefix:l,scalar:R,pointBytes:I}=H(T),F=z(y.context,l,M),B=q.multiply(F).toBytes(),P=z(y.context,B,I,M),S=X.create(F+P*R);if(!X.isValid(S))throw Error("sign failed: invalid s");let _=QD(B,X.toBytes(S));return h(_,w.signature,"result")}let W={zip215:!0};function V(M,T,y,l=W){let{context:R,zip215:I}=l,F=w.signature;if(M=h(M,F,"signature"),T=h(T,void 0,"message"),y=h(y,w.publicKey,"publicKey"),I!==void 0)nD(I,"zip215");if(Q)T=Q(T);let B=F/2,P=M.subarray(0,B),S=T0(M.subarray(B,F)),_,A,x;try{_=D.fromBytes(y,I),A=D.fromBytes(P,I),x=q.multiplyUnsafe(S)}catch(i){return!1}if(!I&&_.isSmallOrder())return!1;let b=z(R,A.toBytes(),_.toBytes(),T);return A.add(_.multiplyUnsafe(b)).subtract(x).clearCofactor().is0()}let N=G.BYTES,w={secretKey:N,publicKey:N,signature:2*N,seed:N};function O(M=Y(w.seed)){return h(M,w.seed,"seed")}function f(M){return R0(M)&&M.length===X.BYTES}function c(M,T){try{return!!D.fromBytes(M,T)}catch(y){return!1}}let g={getExtendedPublicKey:H,randomSecretKey:O,isValidSecretKey:f,isValidPublicKey:c,toMontgomery(M){let{y:T}=D.fromBytes(M),y=w.publicKey,l=y===32;if(!l&&y!==57)throw Error("only defined for 25519 and 448");let R=l?G.div(ZD+T,ZD-T):G.div(T-ZD,T+ZD);return G.toBytes(R)},toMontgomerySecret(M){let T=w.secretKey;h(M,T);let y=$(M.subarray(0,T));return Z(y).subarray(0,T)}};return Object.freeze({keygen:N9(O,E),getPublicKey:E,sign:C,verify:V,utils:g,Point:D,lengths:w})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var gZ=BigInt(1),gQ=BigInt(2);var lZ=BigInt(5),dZ=BigInt(8),H7=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),pZ=(()=>({p:H7,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:dZ,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();function cZ(D){let $=BigInt(10),J=BigInt(20),Q=BigInt(40),q=BigInt(80),G=H7,Y=D*D%G*D%G,Z=n(Y,gQ,G)*Y%G,U=n(Z,gZ,G)*D%G,j=n(U,lZ,G)*U%G,K=n(j,$,G)*j%G,H=n(K,J,G)*K%G,E=n(H,Q,G)*H%G,z=n(E,q,G)*E%G,C=n(z,q,G)*E%G,W=n(C,$,G)*j%G;return{pow_p_5_8:n(W,gQ,G)*D%G,b2:Y}}function aZ(D){return D[0]&=248,D[31]&=127,D[31]|=64,D}var lQ=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function iZ(D,$){let J=H7,Q=t($*$*$,J),q=t(Q*Q*$,J),G=cZ(D*q).pow_p_5_8,X=t(D*Q*G,J),Y=t($*X*X,J),Z=X,U=t(X*lQ,J),j=Y===D,K=Y===t(-D,J),H=Y===t(-D*lQ,J);if(j)X=Z;if(K||H)X=U;if(SQ(X,J))X=t(-X,J);return{isValid:j||K,value:X}}var rZ=mQ(pZ,{uvRatio:iZ});function oZ(D){return uQ(rZ,w0,Object.assign({adjustScalarBytes:aZ},D))}var V7=oZ({});class N7{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(D,$){if(a0(D),h($,void 0,"key"),this.iHash=D.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let J=this.blockLen,Q=new Uint8Array(J);Q.set($.length>J?D.create().update($).digest():$);for(let q=0;q<Q.length;q++)Q[q]^=54;this.iHash.update(Q),this.oHash=D.create();for(let q=0;q<Q.length;q++)Q[q]^=106;this.oHash.update(Q),XD(Q)}update(D){return i0(this),this.iHash.update(D),this}digestInto(D){i0(this),h(D,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(D),this.oHash.update(D),this.oHash.digestInto(D),this.destroy()}digest(){let D=new Uint8Array(this.oHash.outputLen);return this.digestInto(D),D}_cloneInto(D){D||=Object.create(Object.getPrototypeOf(this),{});let{oHash:$,iHash:J,finished:Q,destroyed:q,blockLen:G,outputLen:X}=this;return D=D,D.finished=Q,D.destroyed=q,D.blockLen=G,D.outputLen=X,D.oHash=$._cloneInto(D.oHash),D.iHash=J._cloneInto(D.iHash),D}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var U0=(D,$,J)=>new N7(D,$).update(J).digest();U0.create=(D,$)=>new N7(D,$);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var dQ=(D,$)=>(D+(D>=0?$:-$)/cQ)/$;function nZ(D,$,J){let[[Q,q],[G,X]]=$,Y=dQ(X*D,J),Z=dQ(-q*D,J),U=D-Y*Q-Z*G,j=-Y*q-Z*X,K=U<sD,H=j<sD;if(K)U=-U;if(H)j=-j;let E=T8(Math.ceil(X7(J)/2))+e0;if(U<sD||U>=E||j<sD||j>=E)throw Error("splitScalar (endomorphism): failed, k="+D);return{k1neg:K,k1:U,k2neg:H,k2:j}}function C7(D){if(!["compact","recovered","der"].includes(D))throw Error('Signature format must be "compact", "recovered", or "der"');return D}function F7(D,$){let J={};for(let Q of Object.keys($))J[Q]=D[Q]===void 0?$[Q]:D[Q];if(nD(J.lowS,"lowS"),nD(J.prehash,"prehash"),J.format!==void 0)C7(J.format);return J}class pQ extends Error{constructor(D=""){super(D)}}var j0={Err:pQ,_tlv:{encode:(D,$)=>{let{Err:J}=j0;if(D<0||D>256)throw new J("tlv.encode: wrong tag");if($.length&1)throw new J("tlv.encode: unpadded data");let Q=$.length/2,q=I8(Q);if(q.length/2&128)throw new J("tlv.encode: long form length too big");let G=Q>127?I8(q.length/2|128):"";return I8(D)+G+q+$},decode(D,$){let{Err:J}=j0,Q=0;if(D<0||D>256)throw new J("tlv.encode: wrong tag");if($.length<2||$[Q++]!==D)throw new J("tlv.decode: wrong tlv");let q=$[Q++],G=!!(q&128),X=0;if(!G)X=q;else{let Z=q&127;if(!Z)throw new J("tlv.decode(long): indefinite length not supported");if(Z>4)throw new J("tlv.decode(long): byte length is too big");let U=$.subarray(Q,Q+Z);if(U.length!==Z)throw new J("tlv.decode: length bytes not complete");if(U[0]===0)throw new J("tlv.decode(long): zero leftmost byte");for(let j of U)X=X<<8|j;if(Q+=Z,X<128)throw new J("tlv.decode(long): not minimal encoding")}let Y=$.subarray(Q,Q+X);if(Y.length!==X)throw new J("tlv.decode: wrong value length");return{v:Y,l:$.subarray(Q+X)}}},_int:{encode(D){let{Err:$}=j0;if(D<sD)throw new $("integer: negative integers are not allowed");let J=I8(D);if(Number.parseInt(J[0],16)&8)J="00"+J;if(J.length&1)throw new $("unexpected DER parsing assertion: unpadded hex");return J},decode(D){let{Err:$}=j0;if(D[0]&128)throw new $("invalid signature integer: negative");if(D[0]===0&&!(D[1]&128))throw new $("invalid signature integer: unnecessary leading zero");return o0(D)}},toSig(D){let{Err:$,_int:J,_tlv:Q}=j0,q=h(D,void 0,"signature"),{v:G,l:X}=Q.decode(48,q);if(X.length)throw new $("invalid signature: left bytes after parsing");let{v:Y,l:Z}=Q.decode(2,G),{v:U,l:j}=Q.decode(2,Z);if(j.length)throw new $("invalid signature: left bytes after parsing");return{r:J.decode(Y),s:J.decode(U)}},hexFromSig(D){let{_tlv:$,_int:J}=j0,Q=$.encode(2,J.encode(D.r)),q=$.encode(2,J.encode(D.s)),G=Q+q;return $.encode(48,G)}},sD=BigInt(0),e0=BigInt(1),cQ=BigInt(2),F9=BigInt(3),sZ=BigInt(4);function aQ(D,$={}){let J=V9("weierstrass",D,$),{Fp:Q,Fn:q}=J,G=J.CURVE,{h:X,n:Y}=G;Y0($,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:Z}=$;if(Z){if(!Q.is0(G.a)||typeof Z.beta!=="bigint"||!Array.isArray(Z.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let U=rQ(Q,q);function j(){if(!Q.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function K(R,I,F){let{x:B,y:P}=I.toAffine(),S=Q.toBytes(B);if(nD(F,"isCompressed"),F){j();let _=!Q.isOdd(P);return QD(iQ(_),S)}else return QD(Uint8Array.of(4),S,Q.toBytes(P))}function H(R){h(R,void 0,"Point");let{publicKey:I,publicKeyUncompressed:F}=U,B=R.length,P=R[0],S=R.subarray(1);if(B===I&&(P===2||P===3)){let _=Q.fromBytes(S);if(!Q.isValid(_))throw Error("bad point: is not on curve, wrong x");let A=C(_),x;try{x=Q.sqrt(A)}catch(i){let d=i instanceof Error?": "+i.message:"";throw Error("bad point: is not on curve, sqrt error"+d)}j();let b=Q.isOdd(x);if((P&1)===1!==b)x=Q.neg(x);return{x:_,y:x}}else if(B===F&&P===4){let _=Q.BYTES,A=Q.fromBytes(S.subarray(0,_)),x=Q.fromBytes(S.subarray(_,_*2));if(!W(A,x))throw Error("bad point: is not on curve");return{x:A,y:x}}else throw Error(`bad point: got length ${B}, expected compressed=${I} or uncompressed=${F}`)}let E=$.toBytes||K,z=$.fromBytes||H;function C(R){let I=Q.sqr(R),F=Q.mul(I,R);return Q.add(Q.add(F,Q.mul(R,G.a)),G.b)}function W(R,I){let F=Q.sqr(I),B=C(R);return Q.eql(F,B)}if(!W(G.Gx,G.Gy))throw Error("bad curve params: generator point");let V=Q.mul(Q.pow(G.a,F9),sZ),N=Q.mul(Q.sqr(G.b),BigInt(27));if(Q.is0(Q.add(V,N)))throw Error("bad curve params: a or b");function w(R,I,F=!1){if(!Q.isValid(I)||F&&Q.is0(I))throw Error(`bad point coordinate ${R}`);return I}function O(R){if(!(R instanceof T))throw Error("Weierstrass Point expected")}function f(R){if(!Z||!Z.basises)throw Error("no endo");return nZ(R,Z.basises,q.ORDER)}let c=n0((R,I)=>{let{X:F,Y:B,Z:P}=R;if(Q.eql(P,Q.ONE))return{x:F,y:B};let S=R.is0();if(I==null)I=S?Q.ONE:Q.inv(P);let _=Q.mul(F,I),A=Q.mul(B,I),x=Q.mul(P,I);if(S)return{x:Q.ZERO,y:Q.ZERO};if(!Q.eql(x,Q.ONE))throw Error("invZ was invalid");return{x:_,y:A}}),g=n0((R)=>{if(R.is0()){if($.allowInfinityPoint&&!Q.is0(R.Y))return;throw Error("bad point: ZERO")}let{x:I,y:F}=R.toAffine();if(!Q.isValid(I)||!Q.isValid(F))throw Error("bad point: x or y not field elements");if(!W(I,F))throw Error("bad point: equation left != right");if(!R.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function M(R,I,F,B,P){return F=new T(Q.mul(F.X,R),F.Y,F.Z),I=M8(B,I),F=M8(P,F),I.add(F)}class T{static BASE=new T(G.Gx,G.Gy,Q.ONE);static ZERO=new T(Q.ZERO,Q.ONE,Q.ZERO);static Fp=Q;static Fn=q;X;Y;Z;constructor(R,I,F){this.X=w("x",R),this.Y=w("y",I,!0),this.Z=w("z",F),Object.freeze(this)}static CURVE(){return G}static fromAffine(R){let{x:I,y:F}=R||{};if(!R||!Q.isValid(I)||!Q.isValid(F))throw Error("invalid affine point");if(R instanceof T)throw Error("projective point not allowed");if(Q.is0(I)&&Q.is0(F))return T.ZERO;return new T(I,F,Q.ONE)}static fromBytes(R){let I=T.fromAffine(z(h(R,void 0,"point")));return I.assertValidity(),I}static fromHex(R){return T.fromBytes(iD(R))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(R=8,I=!0){if(l.createCache(this,R),!I)this.multiply(F9);return this}assertValidity(){g(this)}hasEvenY(){let{y:R}=this.toAffine();if(!Q.isOdd)throw Error("Field doesn't support isOdd");return!Q.isOdd(R)}equals(R){O(R);let{X:I,Y:F,Z:B}=this,{X:P,Y:S,Z:_}=R,A=Q.eql(Q.mul(I,_),Q.mul(P,B)),x=Q.eql(Q.mul(F,_),Q.mul(S,B));return A&&x}negate(){return new T(this.X,Q.neg(this.Y),this.Z)}double(){let{a:R,b:I}=G,F=Q.mul(I,F9),{X:B,Y:P,Z:S}=this,_=Q.ZERO,A=Q.ZERO,x=Q.ZERO,b=Q.mul(B,B),e=Q.mul(P,P),i=Q.mul(S,S),d=Q.mul(B,P);return d=Q.add(d,d),x=Q.mul(B,S),x=Q.add(x,x),_=Q.mul(R,x),A=Q.mul(F,i),A=Q.add(_,A),_=Q.sub(e,A),A=Q.add(e,A),A=Q.mul(_,A),_=Q.mul(d,_),x=Q.mul(F,x),i=Q.mul(R,i),d=Q.sub(b,i),d=Q.mul(R,d),d=Q.add(d,x),x=Q.add(b,b),b=Q.add(x,b),b=Q.add(b,i),b=Q.mul(b,d),A=Q.add(A,b),i=Q.mul(P,S),i=Q.add(i,i),b=Q.mul(i,d),_=Q.sub(_,b),x=Q.mul(i,e),x=Q.add(x,x),x=Q.add(x,x),new T(_,A,x)}add(R){O(R);let{X:I,Y:F,Z:B}=this,{X:P,Y:S,Z:_}=R,A=Q.ZERO,x=Q.ZERO,b=Q.ZERO,e=G.a,i=Q.mul(G.b,F9),d=Q.mul(I,P),$D=Q.mul(F,S),qD=Q.mul(B,_),PD=Q.add(I,F),JD=Q.add(P,S);PD=Q.mul(PD,JD),JD=Q.add(d,$D),PD=Q.sub(PD,JD),JD=Q.add(I,B);let jD=Q.add(P,_);return JD=Q.mul(JD,jD),jD=Q.add(d,qD),JD=Q.sub(JD,jD),jD=Q.add(F,B),A=Q.add(S,_),jD=Q.mul(jD,A),A=Q.add($D,qD),jD=Q.sub(jD,A),b=Q.mul(e,JD),A=Q.mul(i,qD),b=Q.add(A,b),A=Q.sub($D,b),b=Q.add($D,b),x=Q.mul(A,b),$D=Q.add(d,d),$D=Q.add($D,d),qD=Q.mul(e,qD),JD=Q.mul(i,JD),$D=Q.add($D,qD),qD=Q.sub(d,qD),qD=Q.mul(e,qD),JD=Q.add(JD,qD),d=Q.mul($D,JD),x=Q.add(x,d),d=Q.mul(jD,JD),A=Q.mul(PD,A),A=Q.sub(A,d),d=Q.mul(PD,$D),b=Q.mul(jD,b),b=Q.add(b,d),new T(A,x,b)}subtract(R){return this.add(R.negate())}is0(){return this.equals(T.ZERO)}multiply(R){let{endo:I}=$;if(!q.isValidNot0(R))throw Error("invalid scalar: out of range");let F,B,P=(S)=>l.cached(this,S,(_)=>P0(T,_));if(I){let{k1neg:S,k1:_,k2neg:A,k2:x}=f(R),{p:b,f:e}=P(_),{p:i,f:d}=P(x);B=e.add(d),F=M(I.beta,b,i,S,A)}else{let{p:S,f:_}=P(R);F=S,B=_}return P0(T,[F,B])[0]}multiplyUnsafe(R){let{endo:I}=$,F=this;if(!q.isValid(R))throw Error("invalid scalar: out of range");if(R===sD||F.is0())return T.ZERO;if(R===e0)return F;if(l.hasCache(this))return this.multiply(R);if(I){let{k1neg:B,k1:P,k2neg:S,k2:_}=f(R),{p1:A,p2:x}=fQ(T,F,P,_);return M(I.beta,A,x,B,S)}else return l.unsafe(F,R)}toAffine(R){return c(this,R)}isTorsionFree(){let{isTorsionFree:R}=$;if(X===e0)return!0;if(R)return R(T,this);return l.unsafe(this,Y).is0()}clearCofactor(){let{clearCofactor:R}=$;if(X===e0)return this;if(R)return R(T,this);return this.multiplyUnsafe(X)}isSmallOrder(){return this.multiplyUnsafe(X).is0()}toBytes(R=!0){return nD(R,"isCompressed"),this.assertValidity(),E(T,this,R)}toHex(R=!0){return aD(this.toBytes(R))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let y=q.BITS,l=new P8(T,$.endo?Math.ceil(y/2):y);return T.BASE.precompute(8),T}function iQ(D){return Uint8Array.of(D?2:3)}function rQ(D,$){return{secretKey:$.BYTES,publicKey:1+D.BYTES,publicKeyUncompressed:1+2*D.BYTES,publicKeyHasPrefix:!0,signature:2*$.BYTES}}function tZ(D,$={}){let{Fn:J}=D,Q=$.randomBytes||J0,q=Object.assign(rQ(D.Fp,J),{seed:U7(J.ORDER)});function G(E){try{let z=J.fromBytes(E);return J.isValidNot0(z)}catch(z){return!1}}function X(E,z){let{publicKey:C,publicKeyUncompressed:W}=q;try{let V=E.length;if(z===!0&&V!==C)return!1;if(z===!1&&V!==W)return!1;return!!D.fromBytes(E)}catch(V){return!1}}function Y(E=Q(q.seed)){return j7(h(E,q.seed,"seed"),J.ORDER)}function Z(E,z=!0){return D.BASE.multiply(J.fromBytes(E)).toBytes(z)}function U(E){let{secretKey:z,publicKey:C,publicKeyUncompressed:W}=q;if(!R0(E))return;if("_lengths"in J&&J._lengths||z===C)return;let V=h(E,void 0,"key").length;return V===C||V===W}function j(E,z,C=!0){if(U(E)===!0)throw Error("first arg must be private key");if(U(z)===!1)throw Error("second arg must be public key");let W=J.fromBytes(E);return D.fromBytes(z).multiply(W).toBytes(C)}let K={isValidSecretKey:G,isValidPublicKey:X,randomSecretKey:Y},H=N9(Y,Z);return Object.freeze({getPublicKey:Z,getSharedSecret:j,keygen:H,Point:D,utils:K,lengths:q})}function oQ(D,$,J={}){a0($),Y0(J,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),J=Object.assign({},J);let Q=J.randomBytes||J0,q=J.hmac||((F,B)=>U0($,F,B)),{Fp:G,Fn:X}=D,{ORDER:Y,BITS:Z}=X,{keygen:U,getPublicKey:j,getSharedSecret:K,utils:H,lengths:E}=tZ(D,J),z={prehash:!0,lowS:typeof J.lowS==="boolean"?J.lowS:!0,format:"compact",extraEntropy:!1},C=Y*cQ<G.ORDER;function W(F){let B=Y>>e0;return F>B}function V(F,B){if(!X.isValidNot0(B))throw Error(`invalid signature ${F}: out of range 1..Point.Fn.ORDER`);return B}function N(){if(C)throw Error('"recovered" sig type is not supported for cofactor >2 curves')}function w(F,B){C7(B);let P=E.signature,S=B==="compact"?P:B==="recovered"?P+1:void 0;return h(F,S)}class O{r;s;recovery;constructor(F,B,P){if(this.r=V("r",F),this.s=V("s",B),P!=null){if(N(),![0,1,2,3].includes(P))throw Error("invalid recovery id");this.recovery=P}Object.freeze(this)}static fromBytes(F,B=z.format){w(F,B);let P;if(B==="der"){let{r:x,s:b}=j0.toSig(h(F));return new O(x,b)}if(B==="recovered")P=F[0],B="compact",F=F.subarray(1);let S=E.signature/2,_=F.subarray(0,S),A=F.subarray(S,S*2);return new O(X.fromBytes(_),X.fromBytes(A),P)}static fromHex(F,B){return this.fromBytes(iD(F),B)}assertRecovery(){let{recovery:F}=this;if(F==null)throw Error("invalid recovery id: must be present");return F}addRecoveryBit(F){return new O(this.r,this.s,F)}recoverPublicKey(F){let{r:B,s:P}=this,S=this.assertRecovery(),_=S===2||S===3?B+Y:B;if(!G.isValid(_))throw Error("invalid recovery id: sig.r+curve.n != R.x");let A=G.toBytes(_),x=D.fromBytes(QD(iQ((S&1)===0),A)),b=X.inv(_),e=c(h(F,void 0,"msgHash")),i=X.create(-e*b),d=X.create(P*b),$D=D.BASE.multiplyUnsafe(i).add(x.multiplyUnsafe(d));if($D.is0())throw Error("invalid recovery: point at infinify");return $D.assertValidity(),$D}hasHighS(){return W(this.s)}toBytes(F=z.format){if(C7(F),F==="der")return iD(j0.hexFromSig(this));let{r:B,s:P}=this,S=X.toBytes(B),_=X.toBytes(P);if(F==="recovered")return N(),QD(Uint8Array.of(this.assertRecovery()),S,_);return QD(S,_)}toHex(F){return aD(this.toBytes(F))}}let f=J.bits2int||function(B){if(B.length>8192)throw Error("input is too large");let P=o0(B),S=B.length*8-Z;return S>0?P>>BigInt(S):P},c=J.bits2int_modN||function(B){return X.create(f(B))},g=T8(Z);function M(F){return w8("num < 2^"+Z,F,sD,g),X.toBytes(F)}function T(F,B){return h(F,void 0,"message"),B?h($(F),void 0,"prehashed message"):F}function y(F,B,P){let{lowS:S,prehash:_,extraEntropy:A}=F7(P,z);F=T(F,_);let x=c(F),b=X.fromBytes(B);if(!X.isValidNot0(b))throw Error("invalid private key");let e=[M(b),M(x)];if(A!=null&&A!==!1){let qD=A===!0?Q(E.secretKey):A;e.push(h(qD,void 0,"extraEntropy"))}let i=QD(...e),d=x;function $D(qD){let PD=f(qD);if(!X.isValidNot0(PD))return;let JD=X.inv(PD),jD=D.BASE.multiply(PD).toAffine(),q8=X.create(jD.x);if(q8===sD)return;let v8=X.create(JD*X.create(d+q8*b));if(v8===sD)return;let h7=(jD.x===q8?0:2)|Number(jD.y&e0),v7=v8;if(S&&W(v8))v7=X.neg(v8),h7^=1;return new O(q8,v7,C?void 0:h7)}return{seed:i,k2sig:$D}}function l(F,B,P={}){let{seed:S,k2sig:_}=y(F,B,P);return RQ($.outputLen,X.BYTES,q)(S,_).toBytes(P.format)}function R(F,B,P,S={}){let{lowS:_,prehash:A,format:x}=F7(S,z);if(P=h(P,void 0,"publicKey"),B=T(B,A),!R0(F)){let b=F instanceof O?", use sig.toBytes()":"";throw Error("verify expects Uint8Array signature"+b)}w(F,x);try{let b=O.fromBytes(F,x),e=D.fromBytes(P);if(_&&b.hasHighS())return!1;let{r:i,s:d}=b,$D=c(B),qD=X.inv(d),PD=X.create($D*qD),JD=X.create(i*qD),jD=D.BASE.multiplyUnsafe(PD).add(e.multiplyUnsafe(JD));if(jD.is0())return!1;return X.create(jD.x)===i}catch(b){return!1}}function I(F,B,P={}){let{prehash:S}=F7(P,z);return B=T(B,S),O.fromBytes(F,"recovered").recoverPublicKey(B).toBytes()}return Object.freeze({keygen:U,getPublicKey:j,getSharedSecret:K,utils:H,lengths:E,Point:D,sign:l,verify:R,recoverPublicKey:I,Signature:O,hash:$})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var L7={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},eZ={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var nQ=BigInt(2);function DU(D){let $=L7.p,J=BigInt(3),Q=BigInt(6),q=BigInt(11),G=BigInt(22),X=BigInt(23),Y=BigInt(44),Z=BigInt(88),U=D*D*D%$,j=U*U*D%$,K=n(j,J,$)*j%$,H=n(K,J,$)*j%$,E=n(H,nQ,$)*U%$,z=n(E,q,$)*E%$,C=n(z,G,$)*z%$,W=n(C,Y,$)*C%$,V=n(W,Z,$)*W%$,N=n(V,Y,$)*C%$,w=n(N,J,$)*j%$,O=n(w,X,$)*z%$,f=n(O,Q,$)*U%$,c=n(f,nQ,$);if(!R7.eql(R7.sqr(c),D))throw Error("Cannot find square root");return c}var R7=s0(L7.p,{sqrt:DU}),$U=aQ(L7,{Fp:R7,endo:eZ}),_0=oQ($U,I0);var D8=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),K0=new Uint32Array(80);class JU extends Q0{A=D8[0]|0;B=D8[1]|0;C=D8[2]|0;D=D8[3]|0;E=D8[4]|0;constructor(){super(64,20,8,!1)}get(){let{A:D,B:$,C:J,D:Q,E:q}=this;return[D,$,J,Q,q]}set(D,$,J,Q,q){this.A=D|0,this.B=$|0,this.C=J|0,this.D=Q|0,this.E=q|0}process(D,$){for(let Y=0;Y<16;Y++,$+=4)K0[Y]=D.getUint32($,!1);for(let Y=16;Y<80;Y++)K0[Y]=cD(K0[Y-3]^K0[Y-8]^K0[Y-14]^K0[Y-16],1);let{A:J,B:Q,C:q,D:G,E:X}=this;for(let Y=0;Y<80;Y++){let Z,U;if(Y<20)Z=r0(Q,q,G),U=1518500249;else if(Y<40)Z=Q^q^G,U=1859775393;else if(Y<60)Z=K9(Q,q,G),U=2400959708;else Z=Q^q^G,U=3395469782;let j=cD(J,5)+Z+X+U+K0[Y]|0;X=G,G=q,q=cD(Q,30),Q=J,J=j}J=J+this.A|0,Q=Q+this.B|0,q=q+this.C|0,G=G+this.D|0,X=X+this.E|0,this.set(J,Q,q,G,X)}roundClean(){XD(K0)}destroy(){this.set(0,0,0,0,0),XD(this.buffer)}}var QU=Math.pow(2,32),qU=Array.from({length:64},(D,$)=>Math.floor(QU*Math.abs(Math.sin($+1)))),C9=D8.slice(0,4),B7=new Uint32Array(16);class GU extends Q0{A=C9[0]|0;B=C9[1]|0;C=C9[2]|0;D=C9[3]|0;constructor(){super(64,16,8,!0)}get(){let{A:D,B:$,C:J,D:Q}=this;return[D,$,J,Q]}set(D,$,J,Q){this.A=D|0,this.B=$|0,this.C=J|0,this.D=Q|0}process(D,$){for(let X=0;X<16;X++,$+=4)B7[X]=D.getUint32($,!0);let{A:J,B:Q,C:q,D:G}=this;for(let X=0;X<64;X++){let Y,Z,U;if(X<16)Y=r0(Q,q,G),Z=X,U=[7,12,17,22];else if(X<32)Y=r0(G,Q,q),Z=(5*X+1)%16,U=[5,9,14,20];else if(X<48)Y=Q^q^G,Z=(3*X+5)%16,U=[4,11,16,23];else Y=q^(Q|~G),Z=7*X%16,U=[6,10,15,21];Y=Y+J+qU[X]+B7[Z],J=G,G=q,q=Q,Q=Q+cD(Y,U[X%4])}J=J+this.A|0,Q=Q+this.B|0,q=q+this.C|0,G=G+this.D|0,this.set(J,Q,q,G)}roundClean(){XD(B7)}destroy(){this.set(0,0,0,0),XD(this.buffer)}}var XU=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),tQ=(()=>Uint8Array.from(Array(16).fill(0).map((D,$)=>$)))(),YU=(()=>tQ.map((D)=>(9*D+5)%16))(),eQ=(()=>{let J=[[tQ],[YU]];for(let Q=0;Q<4;Q++)for(let q of J)q.push(q[Q].map((G)=>XU[G]));return J})(),Dq=(()=>eQ[0])(),$q=(()=>eQ[1])(),Jq=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((D)=>Uint8Array.from(D)),ZU=Dq.map((D,$)=>D.map((J)=>Jq[$][J])),UU=$q.map((D,$)=>D.map((J)=>Jq[$][J])),jU=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),KU=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function sQ(D,$,J,Q){if(D===0)return $^J^Q;if(D===1)return $&J|~$&Q;if(D===2)return($|~J)^Q;if(D===3)return $&Q|J&~Q;return $^(J|~Q)}var R9=new Uint32Array(16);class Qq extends Q0{h0=1732584193;h1=-271733879;h2=-1732584194;h3=271733878;h4=-1009589776;constructor(){super(64,20,8,!0)}get(){let{h0:D,h1:$,h2:J,h3:Q,h4:q}=this;return[D,$,J,Q,q]}set(D,$,J,Q,q){this.h0=D|0,this.h1=$|0,this.h2=J|0,this.h3=Q|0,this.h4=q|0}process(D,$){for(let H=0;H<16;H++,$+=4)R9[H]=D.getUint32($,!0);let J=this.h0|0,Q=J,q=this.h1|0,G=q,X=this.h2|0,Y=X,Z=this.h3|0,U=Z,j=this.h4|0,K=j;for(let H=0;H<5;H++){let E=4-H,z=jU[H],C=KU[H],W=Dq[H],V=$q[H],N=ZU[H],w=UU[H];for(let O=0;O<16;O++){let f=cD(J+sQ(H,q,X,Z)+R9[W[O]]+z,N[O])+j|0;J=j,j=Z,Z=cD(X,10)|0,X=q,q=f}for(let O=0;O<16;O++){let f=cD(Q+sQ(E,G,Y,U)+R9[V[O]]+C,w[O])+K|0;Q=K,K=U,U=cD(Y,10)|0,Y=G,G=f}}this.set(this.h1+X+U|0,this.h2+Z+K|0,this.h3+j+Q|0,this.h4+J+G|0,this.h0+q+Y|0)}roundClean(){XD(R9)}destroy(){this.destroyed=!0,XD(this.buffer),this.set(0,0,0,0,0)}}var qq=C8(()=>new Qq);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $8(D){return D instanceof Uint8Array||ArrayBuffer.isView(D)&&D.constructor.name==="Uint8Array"}function T7(D){if(!$8(D))throw Error("Uint8Array expected")}function Zq(D,$){if(!Array.isArray($))return!1;if($.length===0)return!0;if(D)return $.every((J)=>typeof J==="string");else return $.every((J)=>Number.isSafeInteger(J))}function O7(D){if(typeof D!=="function")throw Error("function expected");return!0}function W0(D,$){if(typeof $!=="string")throw Error(`${D}: string expected`);return!0}function J8(D){if(!Number.isSafeInteger(D))throw Error(`invalid integer: ${D}`)}function B9(D){if(!Array.isArray(D))throw Error("array expected")}function I9(D,$){if(!Zq(!0,$))throw Error(`${D}: array of strings expected`)}function M7(D,$){if(!Zq(!1,$))throw Error(`${D}: array of numbers expected`)}function LD(...D){let $=(G)=>G,J=(G,X)=>(Y)=>G(X(Y)),Q=D.map((G)=>G.encode).reduceRight(J,$),q=D.map((G)=>G.decode).reduce(J,$);return{encode:Q,decode:q}}function wD(D){let $=typeof D==="string"?D.split(""):D,J=$.length;I9("alphabet",$);let Q=new Map($.map((q,G)=>[q,G]));return{encode:(q)=>{return B9(q),q.map((G)=>{if(!Number.isSafeInteger(G)||G<0||G>=J)throw Error(`alphabet.encode: digit index outside alphabet "${G}". Allowed: ${D}`);return $[G]})},decode:(q)=>{return B9(q),q.map((G)=>{W0("alphabet.decode",G);let X=Q.get(G);if(X===void 0)throw Error(`Unknown letter: "${G}". Allowed: ${D}`);return X})}}}function TD(D=""){return W0("join",D),{encode:($)=>{return I9("join.decode",$),$.join(D)},decode:($)=>{return W0("join.decode",$),$.split(D)}}}function S8(D,$="="){return J8(D),W0("padding",$),{encode(J){I9("padding.encode",J);while(J.length*D%8)J.push($);return J},decode(J){I9("padding.decode",J);let Q=J.length;if(Q*D%8)throw Error("padding: invalid, string should have whole number of bytes");for(;Q>0&&J[Q-1]===$;Q--)if((Q-1)*D%8===0)throw Error("padding: invalid, string has too much padding");return J.slice(0,Q)}}}function Uq(D){return O7(D),{encode:($)=>$,decode:($)=>D($)}}function I7(D,$,J){if($<2)throw Error(`convertRadix: invalid from=${$}, base cannot be less than 2`);if(J<2)throw Error(`convertRadix: invalid to=${J}, base cannot be less than 2`);if(B9(D),!D.length)return[];let Q=0,q=[],G=Array.from(D,(Y)=>{if(J8(Y),Y<0||Y>=$)throw Error(`invalid integer: ${Y}`);return Y}),X=G.length;while(!0){let Y=0,Z=!0;for(let U=Q;U<X;U++){let j=G[U],K=$*Y,H=K+j;if(!Number.isSafeInteger(H)||K/$!==Y||H-j!==K)throw Error("convertRadix: carry overflow");let E=H/J;Y=H%J;let z=Math.floor(E);if(G[U]=z,!Number.isSafeInteger(z)||z*J+Y!==H)throw Error("convertRadix: carry overflow");if(!Z)continue;else if(!z)Q=U;else Z=!1}if(q.push(Y),Z)break}for(let Y=0;Y<D.length-1&&D[Y]===0;Y++)q.push(0);return q.reverse()}var jq=(D,$)=>$===0?D:jq($,D%$),w9=(D,$)=>D+($-jq(D,$)),L9=(()=>{let D=[];for(let $=0;$<40;$++)D.push(2**$);return D})();function T9(D,$,J,Q){if(B9(D),$<=0||$>32)throw Error(`convertRadix2: wrong from=${$}`);if(J<=0||J>32)throw Error(`convertRadix2: wrong to=${J}`);if(w9($,J)>32)throw Error(`convertRadix2: carry overflow from=${$} to=${J} carryBits=${w9($,J)}`);let q=0,G=0,X=L9[$],Y=L9[J]-1,Z=[];for(let U of D){if(J8(U),U>=X)throw Error(`convertRadix2: invalid data word=${U} from=${$}`);if(q=q<<$|U,G+$>32)throw Error(`convertRadix2: carry overflow pos=${G} from=${$}`);G+=$;for(;G>=J;G-=J)Z.push((q>>G-J&Y)>>>0);let j=L9[G];if(j===void 0)throw Error("invalid carry");q&=j-1}if(q=q<<J-G&Y,!Q&&G>=$)throw Error("Excess padding");if(!Q&&q>0)throw Error(`Non-zero padding: ${q}`);if(Q&&G>0)Z.push(q>>>0);return Z}function Kq(D){J8(D);let $=256;return{encode:(J)=>{if(!$8(J))throw Error("radix.encode input should be Uint8Array");return I7(Array.from(J),$,D)},decode:(J)=>{return M7("radix.decode",J),Uint8Array.from(I7(J,D,$))}}}function MD(D,$=!1){if(J8(D),D<=0||D>32)throw Error("radix2: bits should be in (0..32]");if(w9(8,D)>32||w9(D,8)>32)throw Error("radix2: carry overflow");return{encode:(J)=>{if(!$8(J))throw Error("radix2.encode input should be Uint8Array");return T9(Array.from(J),8,D,!$)},decode:(J)=>{return M7("radix2.decode",J),Uint8Array.from(T9(J,D,8,$))}}}function Gq(D){return O7(D),function(...$){try{return D.apply(null,$)}catch(J){}}}function Wq(D,$){return J8(D),O7($),{encode(J){if(!$8(J))throw Error("checksum.encode: input should be Uint8Array");let Q=$(J).slice(0,D),q=new Uint8Array(J.length+D);return q.set(J),q.set(Q,J.length),q},decode(J){if(!$8(J))throw Error("checksum.decode: input should be Uint8Array");let Q=J.slice(0,-D),q=J.slice(-D),G=$(Q).slice(0,D);for(let X=0;X<D;X++)if(G[X]!==q[X])throw Error("Invalid checksum");return Q}}}var k8={alphabet:wD,chain:LD,checksum:Wq,convertRadix:I7,convertRadix2:T9,radix:Kq,radix2:MD,join:TD,padding:S8},oz=LD(MD(4),wD("0123456789ABCDEF"),TD("")),nz=LD(MD(5),wD("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),S8(5),TD("")),sz=LD(MD(5),wD("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),TD("")),tz=LD(MD(5),wD("0123456789ABCDEFGHIJKLMNOPQRSTUV"),S8(5),TD("")),ez=LD(MD(5),wD("0123456789ABCDEFGHIJKLMNOPQRSTUV"),TD("")),DE=LD(MD(5),wD("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),TD(""),Uq((D)=>D.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),zq=(()=>typeof Uint8Array.from([]).toBase64==="function"&&typeof Uint8Array.fromBase64==="function")(),Eq=(D,$)=>{W0("base64",D);let J=$?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/,Q=$?"base64url":"base64";if(D.length>0&&!J.test(D))throw Error("invalid base64");return Uint8Array.fromBase64(D,{alphabet:Q,lastChunkHandling:"strict"})},$E=zq?{encode(D){return T7(D),D.toBase64()},decode(D){return Eq(D,!1)}}:LD(MD(6),wD("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),S8(6),TD("")),JE=LD(MD(6),wD("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),TD("")),QE=zq?{encode(D){return T7(D),D.toBase64({alphabet:"base64url"})},decode(D){return Eq(D,!0)}}:LD(MD(6),wD("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),S8(6),TD("")),qE=LD(MD(6),wD("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),TD("")),P7=(D)=>LD(Kq(58),wD(D),TD("")),WU=P7("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),GE=P7("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),XE=P7("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");var Hq=(D)=>LD(Wq(4,($)=>D(D($))),WU);var w7=LD(wD("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),TD("")),Xq=[996825010,642813549,513874426,1027748829,705979059];function _8(D){let $=D>>25,J=(D&33554431)<<5;for(let Q=0;Q<Xq.length;Q++)if(($>>Q&1)===1)J^=Xq[Q];return J}function Yq(D,$,J=1){let Q=D.length,q=1;for(let G=0;G<Q;G++){let X=D.charCodeAt(G);if(X<33||X>126)throw Error(`Invalid prefix (${D})`);q=_8(q)^X>>5}q=_8(q);for(let G=0;G<Q;G++)q=_8(q)^D.charCodeAt(G)&31;for(let G of $)q=_8(q)^G;for(let G=0;G<6;G++)q=_8(q);return q^=J,w7.encode(T9([q%L9[30]],30,5,!1))}function Vq(D){let $=D==="bech32"?1:734539939,J=MD(5),Q=J.decode,q=J.encode,G=Gq(Q);function X(K,H,E=90){if(W0("bech32.encode prefix",K),$8(H))H=Array.from(H);M7("bech32.encode",H);let z=K.length;if(z===0)throw TypeError(`Invalid prefix length ${z}`);let C=z+7+H.length;if(E!==!1&&C>E)throw TypeError(`Length ${C} exceeds limit ${E}`);let W=K.toLowerCase(),V=Yq(W,H,$);return`${W}1${w7.encode(H)}${V}`}function Y(K,H=90){W0("bech32.decode input",K);let E=K.length;if(E<8||H!==!1&&E>H)throw TypeError(`invalid string length: ${E} (${K}). Expected (8..${H})`);let z=K.toLowerCase();if(K!==z&&K!==K.toUpperCase())throw Error("String must be lowercase or uppercase");let C=z.lastIndexOf("1");if(C===0||C===-1)throw Error('Letter "1" must be present between prefix and data only');let W=z.slice(0,C),V=z.slice(C+1);if(V.length<6)throw Error("Data must be at least 6 characters long");let N=w7.decode(V).slice(0,-6),w=Yq(W,N,$);if(!V.endsWith(w))throw Error(`Invalid checksum in ${K}: expected "${w}"`);return{prefix:W,words:N}}let Z=Gq(Y);function U(K){let{prefix:H,words:E}=Y(K,!1);return{prefix:H,words:E,bytes:Q(E)}}function j(K,H){return X(K,q(H))}return{encode:X,decode:Y,encodeFromBytes:j,decodeToBytes:U,decodeUnsafe:Z,fromWords:Q,fromWordsUnsafe:G,toWords:q}}var YE=Vq("bech32"),ZE=Vq("bech32m");var zU=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),EU={encode(D){return T7(D),D.toHex()},decode(D){return W0("hex",D),Uint8Array.fromHex(D)}},UE=zU?EU:LD(MD(4),wD("0123456789abcdef"),TD(""),Uq((D)=>{if(typeof D!=="string"||D.length%2!==0)throw TypeError(`hex.decode: expected string, got ${typeof D} with length ${D.length}`);return D.toLowerCase()}));/*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */var x8=_0.Point,{Fn:A8}=x8,_7=Hq(I0),HU=Uint8Array.from("Bitcoin seed".split(""),(D)=>D.charCodeAt(0)),S7={private:76066276,public:76067358},k7=2147483648,VU=(D)=>qq(I0(D)),NU=(D)=>fD(D).getUint32(0,!1),O9=(D)=>{if(!Number.isSafeInteger(D)||D<0||D>4294967295)throw Error("invalid number, should be from 0 to 2**32-1, got "+D);let $=new Uint8Array(4);return fD($).setUint32(0,D,!1),$};class z0{get fingerprint(){if(!this.pubHash)throw Error("No publicKey set!");return NU(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this._privateKey||null}get publicKey(){return this._publicKey||null}get privateExtendedKey(){let D=this._privateKey;if(!D)throw Error("No private key");return _7.encode(this.serialize(this.versions.private,QD(Uint8Array.of(0),D)))}get publicExtendedKey(){if(!this._publicKey)throw Error("No public key");return _7.encode(this.serialize(this.versions.public,this._publicKey))}static fromMasterSeed(D,$=S7){if(h(D),8*D.length<128||8*D.length>512)throw Error("HDKey: seed length must be between 128 and 512 bits; 256 bits is advised, got "+D.length);let J=U0(w0,HU,D),Q=J.slice(0,32),q=J.slice(32);return new z0({versions:$,chainCode:q,privateKey:Q})}static fromExtendedKey(D,$=S7){let J=_7.decode(D),Q=fD(J),q=Q.getUint32(0,!1),G={versions:$,depth:J[4],parentFingerprint:Q.getUint32(5,!1),index:Q.getUint32(9,!1),chainCode:J.slice(13,45)},X=J.slice(45),Y=X[0]===0;if(q!==$[Y?"private":"public"])throw Error("Version mismatch");if(Y)return new z0({...G,privateKey:X.slice(1)});else return new z0({...G,publicKey:X})}static fromJSON(D){return z0.fromExtendedKey(D.xpriv)}versions;depth=0;index=0;chainCode=null;parentFingerprint=0;_privateKey;_publicKey;pubHash;constructor(D){if(!D||typeof D!=="object")throw Error("HDKey.constructor must not be called directly");if(this.versions=D.versions||S7,this.depth=D.depth||0,this.chainCode=D.chainCode||null,this.index=D.index||0,this.parentFingerprint=D.parentFingerprint||0,!this.depth){if(this.parentFingerprint||this.index)throw Error("HDKey: zero depth with non-zero index/parent fingerprint")}if(this.depth>255)throw Error("HDKey: depth exceeds the serializable value 255");if(D.publicKey&&D.privateKey)throw Error("HDKey: publicKey and privateKey at same time.");if(D.privateKey){if(!_0.utils.isValidSecretKey(D.privateKey))throw Error("Invalid private key");this._privateKey=D.privateKey,this._publicKey=_0.getPublicKey(D.privateKey,!0)}else if(D.publicKey)this._publicKey=x8.fromBytes(D.publicKey).toBytes(!0);else throw Error("HDKey: no public or private key provided");this.pubHash=VU(this._publicKey)}derive(D){if(!/^[mM]'?/.test(D))throw Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(D))return this;let $=D.replace(/^[mM]'?\//,"").split("/"),J=this;for(let Q of $){let q=/^(\d+)('?)$/.exec(Q),G=q&&q[1];if(!q||q.length!==3||typeof G!=="string")throw Error("invalid child index: "+Q);let X=+G;if(!Number.isSafeInteger(X)||X>=k7)throw Error("Invalid index");if(q[2]==="'")X+=k7;J=J.deriveChild(X)}return J}deriveChild(D){if(!this._publicKey||!this.chainCode)throw Error("No publicKey or chainCode set");let $=O9(D);if(D>=k7){let Y=this._privateKey;if(!Y)throw Error("Could not derive hardened child key");$=QD(Uint8Array.of(0),Y,$)}else $=QD(this._publicKey,$);let J=U0(w0,this.chainCode,$),Q=J.slice(0,32),q=J.slice(32);if(!_0.utils.isValidSecretKey(Q))throw Error("Tweak bigger than curve order");let G={versions:this.versions,chainCode:q,depth:this.depth+1,parentFingerprint:this.fingerprint,index:D},X=A8.fromBytes(Q);try{if(this._privateKey){let Y=A8.create(A8.fromBytes(this._privateKey)+X);if(!A8.isValidNot0(Y))throw Error("The tweak was out of range or the resulted private key is invalid");G.privateKey=A8.toBytes(Y)}else{let Y=x8.fromBytes(this._publicKey).add(x8.BASE.multiply(X));if(Y.equals(x8.ZERO))throw Error("The tweak was equal to negative P, which made the result key invalid");G.publicKey=Y.toBytes(!0)}return new z0(G)}catch(Y){return this.deriveChild(D+1)}}sign(D){if(!this._privateKey)throw Error("No privateKey set!");return h(D,32),_0.sign(D,this._privateKey,{prehash:!1})}verify(D,$){if(h(D,32),h($,64),!this._publicKey)throw Error("No publicKey set!");return _0.verify($,D,this._publicKey,{prehash:!1})}wipePrivateData(){if(this._privateKey)this._privateKey.fill(0),this._privateKey=void 0;return this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(D,$){if(!this.chainCode)throw Error("No chainCode set");return h($,33),QD(O9(D),new Uint8Array([this.depth]),O9(this.parentFingerprint),O9(this.index),this.chainCode,$)}}function FU(D,$,J,Q){a0(D);let q=XQ({dkLen:32,asyncTick:10},Q),{c:G,dkLen:X,asyncTick:Y}=q;if(HD(G,"c"),HD(X,"dkLen"),HD(Y,"asyncTick"),G<1)throw Error("iterations (c) must be >= 1");let Z=t6($,"password"),U=t6(J,"salt"),j=new Uint8Array(X),K=U0.create(D,Z),H=K._cloneInto().update(U);return{c:G,dkLen:X,asyncTick:Y,DK:j,PRF:K,PRFSalt:H}}function CU(D,$,J,Q,q){if(D.destroy(),$.destroy(),Q)Q.destroy();return XD(q),J}function Nq(D,$,J,Q){let{c:q,dkLen:G,DK:X,PRF:Y,PRFSalt:Z}=FU(D,$,J,Q),U,j=new Uint8Array(4),K=fD(j),H=new Uint8Array(Y.outputLen);for(let E=1,z=0;z<G;E++,z+=Y.outputLen){let C=X.subarray(z,z+Y.outputLen);K.setInt32(0,E,!1),(U=Z._cloneInto(U)).update(j).digestInto(H),C.set(H.subarray(0,C.length));for(let W=1;W<q;W++){Y._cloneInto(U).update(H).digestInto(H);for(let V=0;V<C.length;V++)C[V]^=H[V]}}return CU(Y,Z,X,U,H)}/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */var RU=(D)=>D[0]==="あいこくしん";function Fq(D){if(typeof D!=="string")throw TypeError("invalid mnemonic type: "+typeof D);return D.normalize("NFKD")}function LU(D){let $=Fq(D),J=$.split(" ");if(![12,15,18,21,24].includes(J.length))throw Error("Invalid mnemonic");return{nfkd:$,words:J}}function BU(D){if(h(D),![16,20,24,28,32].includes(D.length))throw Error("invalid entropy length")}function Cq(D,$=128){if(HD($),$%32!==0||$>256)throw TypeError("Invalid entropy");return TU(J0($/8),D)}var IU=(D)=>{let $=8-D.length/4;return new Uint8Array([I0(D)[0]>>$<<$])};function wU(D){if(!Array.isArray(D)||D.length!==2048||typeof D[0]!=="string")throw Error("Wordlist: expected array of 2048 strings");return D.forEach(($)=>{if(typeof $!=="string")throw Error("wordlist: non-string element: "+$)}),k8.chain(k8.checksum(1,IU),k8.radix2(11,!0),k8.alphabet(D))}function TU(D,$){return BU(D),wU($).encode(D).join(RU($)?" ":" ")}var OU=(D)=>Fq("mnemonic"+D);function Rq(D,$=""){return Nq(w0,LU(D).nfkd,OU($),{c:2048,dkLen:64})}var Lq=`abandon
43
43
  ability
44
44
  able
45
45
  about
@@ -2087,5 +2087,10 @@ zebra
2087
2087
  zero
2088
2088
  zone
2089
2089
  zoo`.split(`
2090
- `);class j0{privateKey;publicKey;constructor(D,$){this.privateKey=D,this.publicKey=$}static async generate(D=24){let $=sQ(tQ,D===12?128:256);return{keyPair:await this.fromSeedPhrase($),mnemonic:$}}static async fromSeedPhrase(D){let $=nQ(D),J=K0.fromMasterSeed($).derive("m/44'/501'/0'/0'");if(!J.privateKey)throw Error("Failed to derive private key");return new j0(J.privateKey,X6.getPublicKey(J.privateKey))}static async fromPrivateKey(D){let $=void 0;try{let Q=JSON.parse(D.startsWith("[")&&D.endsWith("]")?D:`[${D}]`);if(Array.isArray(Q)&&Q.every((G)=>typeof G==="number"&&G>=0&&G<=255)){let G=new Uint8Array(Q);if(G.length===32||G.length===64)$=G}}catch(Q){}try{$??=qJ().encode(D)}catch(Q){}try{$??=a8().encode(D)}catch(Q){}try{$??=S7().encode(D)}catch(Q){}if($==null||$.length!==32&&$.length!==64)throw Error("Invalid private key format");let J=$.slice(0,32);return new j0(J,X6.getPublicKey(J))}toJson(){return JSON.stringify([...this.privateKey,...this.publicKey])}}class wD{#J;#$;constructor(D,$){this.#J=D,this.#$=$}static async fromKeyPair(D){let $=await xJ(D.privateKey);return new wD($,D)}static async fromSeedPhrase(D){return this.fromKeyPair(await j0.fromSeedPhrase(D))}static async fromPrivateKey(D){return this.fromKeyPair(await j0.fromPrivateKey(D))}static async generate(){let{keyPair:D}=await j0.generate();return this.fromKeyPair(D)}static async load(D){let $=eQ(d.KEYS_DIR,`${D}.json`);if(!CK($))throw Error(`Key "${D}" does not exist.`);let J=HK($,"utf-8");return this.fromKeyPair(await j0.fromPrivateKey(J))}save(D){let $=eQ(d.KEYS_DIR,`${D}.json`);NK($,this.#$.toJson())}get address(){return this.#J.address}async signTransaction(D){let $=YJ().encode(D),J=_J().decode($),Q=await D9([this.#J.keyPair],J);return AJ(Q)}}class R6{static register(D){let $=D.command("keys").description("Private key management");$.command("list").description("List all keys").action(()=>this.list()),$.command("add [name]").description("Generate or recover a keypair").option("--overwrite","Overwrite existing key").option("--recover","Recover from seed phrase or private key").option("--seed-phrase <phrase>","Seed phrase for recovery").option("--private-key <key>","Private key (base58) for recovery").action((J,Q)=>this.add(J,Q)),$.command("delete <name>").description("Delete a key").action((J)=>this.delete(J)),$.command("edit <name>").description("Edit a key's name or credentials").option("--name <new-name>","Rename the key").option("--seed-phrase <phrase>","Replace key with new seed phrase").option("--private-key <key>","Replace key with new private key").action((J,Q)=>this.edit(J,Q)),$.command("use <name>").description("Set the active key").action((J)=>this.use(J)),$.command("solana-import").description("Import a Solana CLI keypair").option("--name <name>","Name for the imported key").option("--path <path>","Path to Solana keypair file").option("--overwrite","Overwrite existing key").action((J)=>this.solanaImport(J))}static async list(){if(!U0(d.KEYS_DIR))throw Error("No keys found.");let D=FK(d.KEYS_DIR).filter((Q)=>Q.endsWith(".json")),$=d.load(),J=await Promise.all(D.map(async(Q)=>{let G=Q.replace(".json",""),q=await wD.load(G);return{name:G,address:q.address,active:$.activeKey===G}}));if(v.isJson()){v.json(J);return}v.table({type:"horizontal",headers:{name:"Name",address:"Address",active:"Active"},rows:J.map((Q)=>({...Q,active:v.formatBoolean(Q.active)}))})}static async add(D="default",$={}){let J=P0(d.KEYS_DIR,`${D}.json`);if(U0(J)&&!$.overwrite)throw Error(`Key "${D}" already exists. Use --overwrite to replace.`);let Q;if($.recover)if($.seedPhrase)Q=await wD.fromSeedPhrase($.seedPhrase);else if($.privateKey)Q=await wD.fromPrivateKey($.privateKey);else throw Error("--recover requires --seed-phrase or --private-key");else Q=await wD.generate();Q.save(D),this.list()}static delete(D){let $=P0(d.KEYS_DIR,`${D}.json`);if(!U0($))throw Error(`Key "${D}" not found.`);BK($),this.list()}static async edit(D,$={}){if(!$.name&&!$.seedPhrase&&!$.privateKey)throw Error("At least one option is required (--name, --seed-phrase, or --private-key).");if($.seedPhrase&&$.privateKey)throw Error("--seed-phrase and --private-key are mutually exclusive.");let J=P0(d.KEYS_DIR,`${D}.json`);if(!U0(J))throw Error(`Key "${D}" not found.`);if($.seedPhrase||$.privateKey)($.seedPhrase?await wD.fromSeedPhrase($.seedPhrase):await wD.fromPrivateKey($.privateKey)).save(D);if($.name){let Q=P0(d.KEYS_DIR,`${$.name}.json`);if(U0(Q))throw Error(`Key "${$.name}" already exists.`);if(LK(J,Q),d.load().activeKey===D)d.set({activeKey:$.name})}this.list()}static use(D){let $=P0(d.KEYS_DIR,`${D}.json`);if(!U0($))throw Error(`Key "${D}" not found.`);d.set({activeKey:D}),this.list()}static solanaImport(D={}){let $=D.name??"default",J=D.path??P0(RK(),".config","solana","id.json");if(!U0(J))throw Error(`Solana keypair not found at: ${J}`);let Q=P0(d.KEYS_DIR,`${$}.json`);if(U0(Q)&&!D.overwrite)throw Error(`Key "${$}" already exists. Use --overwrite to replace.`);VK(J,Q),this.list()}}async function DG(D,$={}){let{programAddress:J="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"}=$;return await zJ({programAddress:J,seeds:[K8().encode(D.owner),K8().encode(D.tokenProgram),K8().encode(D.mint)]})}var IK=0,wK;wK={[IK]:"Associated token account owner does not match address derivation"};var OK=0,TK=1,MK=2,PK=3,SK=4,_K=5,kK=6,AK=7,xK=8,bK=9,hK=10,vK=11,yK=12,fK=13,mK=14,uK=15,gK=16,lK=17,pK=18,dK=19,cK;cK={[lK]:"Account is frozen",[kK]:"Already in use",[uK]:"Account does not support specified authority type",[_K]:"Fixed supply",[TK]:"Insufficient funds",[yK]:"Invalid instruction",[MK]:"Invalid Mint",[AK]:"Invalid number of provided signers",[xK]:"Invalid number of required signers",[fK]:"State is invalid for requested operation",[gK]:"This token mint cannot freeze accounts",[pK]:"The provided decimals value different from the Mint decimals",[PK]:"Account not associated with this Mint",[hK]:"Instruction does not support native tokens",[vK]:"Non-native account can only be closed if its balance is zero",[dK]:"Instruction does not support non-native tokens",[OK]:"Lamport balance below rent-exempt threshold",[mK]:"Operation overflowed",[SK]:"Owner does not match",[bK]:"State is unititialized"};class n0 extends Error{response;request;options;constructor(D,$,J){let Q=D.status||D.status===0?D.status:"",G=D.statusText??"",q=`${Q} ${G}`.trim(),X=q?`status code ${q}`:"an unknown error";super(`Request failed with ${X}: ${$.method} ${$.url}`);this.name="HTTPError",this.response=D,this.request=$,this.options=J}}class M8 extends Error{name="NonError";value;constructor(D){let $="Non-error value was thrown";try{if(typeof D==="string")$=D;else if(D&&typeof D==="object"&&"message"in D&&typeof D.message==="string")$=D.message}catch{}super($);this.value=D}}class P8 extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(D){let $=D?.cause?D.cause instanceof Error?D.cause:new M8(D.cause):void 0;super(D?.code?`Forced retry: ${D.code}`:"Forced retry",$?{cause:$}:void 0);this.customDelay=D?.delay,this.code=D?.code,this.customRequest=D?.request}}var I6=(()=>{let D=!1,$=!1,J=typeof globalThis.ReadableStream==="function",Q=typeof globalThis.Request==="function";if(J&&Q)try{$=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return D=!0,"half"}}).headers.has("Content-Type")}catch(G){if(G instanceof Error&&G.message==="unsupported BodyInit type")return!1;throw G}return D&&!$})(),$G=typeof globalThis.AbortController==="function",N9=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",JG=typeof globalThis.ReadableStream==="function",QG=typeof globalThis.FormData==="function",V9=["get","post","put","patch","head","delete"],aK=()=>{return};aK();var GG={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},F9=2147483647,qG=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,L9=Symbol("stop");class B9{options;constructor(D){this.options=D}}var XG=(D)=>new B9(D),YG={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},ZG={next:!0},KG={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var iK=(D)=>{if(!D)return 0;if(D instanceof FormData){let $=0;for(let[J,Q]of D)$+=qG,$+=new TextEncoder().encode(`Content-Disposition: form-data; name="${J}"`).length,$+=typeof Q==="string"?new TextEncoder().encode(Q).length:Q.size;return $}if(D instanceof Blob)return D.size;if(D instanceof ArrayBuffer)return D.byteLength;if(typeof D==="string")return new TextEncoder().encode(D).length;if(D instanceof URLSearchParams)return new TextEncoder().encode(D.toString()).length;if("byteLength"in D)return D.byteLength;if(typeof D==="object"&&D!==null)try{let $=JSON.stringify(D);return new TextEncoder().encode($).length}catch{return 0}return 0},jG=(D,$,J)=>{let Q,G=0;return D.pipeThrough(new TransformStream({transform(q,X){if(X.enqueue(q),Q){G+=Q.byteLength;let Y=$===0?0:G/$;if(Y>=1)Y=1-Number.EPSILON;J?.({percent:Y,totalBytes:Math.max($,G),transferredBytes:G},Q)}Q=q},flush(){if(Q)G+=Q.byteLength,J?.({percent:1,totalBytes:Math.max($,G),transferredBytes:G},Q)}}))},UG=(D,$)=>{if(!D.body)return D;if(D.status===204)return new Response(null,{status:D.status,statusText:D.statusText,headers:D.headers});let J=Math.max(0,Number(D.headers.get("content-length"))||0);return new Response(jG(D.body,J,$),{status:D.status,statusText:D.statusText,headers:D.headers})},WG=(D,$,J)=>{if(!D.body)return D;let Q=iK(J??D.body);return new Request(D,{duplex:"half",body:jG(D.body,Q,$)})};var W0=(D)=>D!==null&&typeof D==="object";var S8=(...D)=>{for(let $ of D)if((!W0($)||Array.isArray($))&&$!==void 0)throw TypeError("The `options` argument must be an object");return T6({},...D)},w6=(D={},$={})=>{let J=new globalThis.Headers(D),Q=$ instanceof globalThis.Headers,G=new globalThis.Headers($);for(let[q,X]of G.entries())if(Q&&X==="undefined"||X===void 0)J.delete(q);else J.set(q,X);return J};function R9(D,$,J){return Object.hasOwn($,J)&&$[J]===void 0?[]:T6(D[J]??[],$[J]??[])}var O6=(D={},$={})=>({beforeRequest:R9(D,$,"beforeRequest"),beforeRetry:R9(D,$,"beforeRetry"),afterResponse:R9(D,$,"afterResponse"),beforeError:R9(D,$,"beforeError")}),rK=(D,$)=>{let J=new URLSearchParams;for(let Q of[D,$]){if(Q===void 0)continue;if(Q instanceof URLSearchParams)for(let[G,q]of Q.entries())J.append(G,q);else if(Array.isArray(Q))for(let G of Q){if(!Array.isArray(G)||G.length!==2)throw TypeError("Array search parameters must be provided in [[key, value], ...] format");J.append(String(G[0]),String(G[1]))}else if(W0(Q)){for(let[G,q]of Object.entries(Q))if(q!==void 0)J.append(G,String(q))}else{let G=new URLSearchParams(Q);for(let[q,X]of G.entries())J.append(q,X)}}return J},T6=(...D)=>{let $={},J={},Q={},G,q=[];for(let X of D)if(Array.isArray(X)){if(!Array.isArray($))$=[];$=[...$,...X]}else if(W0(X)){for(let[Y,Z]of Object.entries(X)){if(Y==="signal"&&Z instanceof globalThis.AbortSignal){q.push(Z);continue}if(Y==="context"){if(Z!==void 0&&Z!==null&&(!W0(Z)||Array.isArray(Z)))throw TypeError("The `context` option must be an object");$={...$,context:Z===void 0||Z===null?{}:{...$.context,...Z}};continue}if(Y==="searchParams"){if(Z===void 0||Z===null)G=void 0;else G=G===void 0?Z:rK(G,Z);continue}if(W0(Z)&&Y in $)Z=T6($[Y],Z);$={...$,[Y]:Z}}if(W0(X.hooks))Q=O6(Q,X.hooks),$.hooks=Q;if(W0(X.headers))J=w6(J,X.headers),$.headers=J}if(G!==void 0)$.searchParams=G;if(q.length>0)if(q.length===1)$.signal=q[0];else if(N9)$.signal=AbortSignal.any(q);else $.signal=q.at(-1);return $};var zG=(D)=>V9.includes(D)?D.toUpperCase():D,oK=["get","put","head","delete","options","trace"],sK=[408,413,429,500,502,503,504],nK=[413,429,503],EG={limit:2,methods:oK,statusCodes:sK,afterStatusCodes:nK,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:(D)=>0.3*2**(D-1)*1000,jitter:void 0,retryOnTimeout:!1},CG=(D={})=>{if(typeof D==="number")return{...EG,limit:D};if(D.methods&&!Array.isArray(D.methods))throw Error("retry.methods must be an array");if(D.methods&&=D.methods.map((J)=>J.toLowerCase()),D.statusCodes&&!Array.isArray(D.statusCodes))throw Error("retry.statusCodes must be an array");let $=Object.fromEntries(Object.entries(D).filter(([,J])=>J!==void 0));return{...EG,...$}};class t0 extends Error{request;constructor(D){super(`Request timed out: ${D.method} ${D.url}`);this.name="TimeoutError",this.request=D}}async function M6(D,$,J,Q){return new Promise((G,q)=>{let X=setTimeout(()=>{if(J)J.abort();q(new t0(D))},Q.timeout);Q.fetch(D,$).then(G).catch(q).then(()=>{clearTimeout(X)})})}async function P6(D,{signal:$}){return new Promise((J,Q)=>{if($)$.throwIfAborted(),$.addEventListener("abort",G,{once:!0});function G(){clearTimeout(q),Q($.reason)}let q=setTimeout(()=>{$?.removeEventListener("abort",G),J()},D)})}var HG=(D,$)=>{let J={};for(let Q in $){if(!Object.hasOwn($,Q))continue;if(!(Q in KG)&&!(Q in YG)&&(!(Q in D)||(Q in ZG)))J[Q]=$[Q]}return J},NG=(D)=>{if(D===void 0)return!1;if(Array.isArray(D))return D.length>0;if(D instanceof URLSearchParams)return D.size>0;if(typeof D==="object")return Object.keys(D).length>0;if(typeof D==="string")return D.trim().length>0;return Boolean(D)};function VG(D){return D instanceof n0||D?.name===n0.name}function FG(D){return D instanceof t0||D?.name===t0.name}class e0{static create(D,$){let J=new e0(D,$),Q=async()=>{if(typeof J.#D.timeout==="number"&&J.#D.timeout>F9)throw RangeError(`The \`timeout\` option cannot be greater than ${F9}`);await Promise.resolve();let q=await J.#N();for(let X of J.#D.hooks.afterResponse){let Y=J.#E(q.clone()),Z;try{Z=await X(J.request,J.#K(),Y,{retryCount:J.#G})}catch(j){throw J.#X(Y),J.#X(q),j}if(Z instanceof B9)throw J.#X(Y),J.#X(q),new P8(Z.options);let K=Z instanceof globalThis.Response?Z:q;if(Y!==K)J.#X(Y);if(q!==K)J.#X(q);q=K}if(J.#E(q),!q.ok&&(typeof J.#D.throwHttpErrors==="function"?J.#D.throwHttpErrors(q.status):J.#D.throwHttpErrors)){let X=new n0(q,J.request,J.#K());for(let Y of J.#D.hooks.beforeError)X=await Y(X,{retryCount:J.#G});throw X}if(J.#D.onDownloadProgress){if(typeof J.#D.onDownloadProgress!=="function")throw TypeError("The `onDownloadProgress` option must be a function");if(!JG)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let X=q.clone();return J.#X(q),UG(X,J.#D.onDownloadProgress)}return q},G=J.#z(Q).finally(()=>{let q=J.#Y;J.#U(q?.body??void 0),J.#U(J.request.body??void 0)});for(let[q,X]of Object.entries(GG)){if(q==="bytes"&&typeof globalThis.Response?.prototype?.bytes!=="function")continue;G[q]=async()=>{J.request.headers.set("accept",J.request.headers.get("accept")||X);let Y=await G;if(q==="json"){if(Y.status===204)return"";let Z=await Y.text();if(Z==="")return"";if($.parseJson)return $.parseJson(Z);return JSON.parse(Z)}return Y[q]()}}return G}static#J(D){if(D&&typeof D==="object"&&!Array.isArray(D)&&!(D instanceof URLSearchParams))return Object.fromEntries(Object.entries(D).filter(([,$])=>$!==void 0));return D}request;#$;#G=0;#Q;#D;#Y;#q;#Z;constructor(D,$={}){if(this.#Q=D,this.#D={...$,headers:w6(this.#Q.headers,$.headers),hooks:O6({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},$.hooks),method:zG($.method??this.#Q.method??"GET"),prefixUrl:String($.prefixUrl||""),retry:CG($.retry),throwHttpErrors:$.throwHttpErrors??!0,timeout:$.timeout??1e4,fetch:$.fetch??globalThis.fetch.bind(globalThis),context:$.context??{}},typeof this.#Q!=="string"&&!(this.#Q instanceof URL||this.#Q instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(this.#D.prefixUrl&&typeof this.#Q==="string"){if(this.#Q.startsWith("/"))throw Error("`input` must not begin with a slash when using `prefixUrl`");if(!this.#D.prefixUrl.endsWith("/"))this.#D.prefixUrl+="/";this.#Q=this.#D.prefixUrl+this.#Q}if($G&&N9)this.#q=this.#D.signal??this.#Q.signal,this.#$=new globalThis.AbortController,this.#D.signal=this.#q?AbortSignal.any([this.#q,this.#$.signal]):this.#$.signal;if(I6)this.#D.duplex="half";if(this.#D.json!==void 0)this.#D.body=this.#D.stringifyJson?.(this.#D.json)??JSON.stringify(this.#D.json),this.#D.headers.set("content-type",this.#D.headers.get("content-type")??"application/json");let J=$.headers&&new globalThis.Headers($.headers).has("content-type");if(this.#Q instanceof globalThis.Request&&(QG&&this.#D.body instanceof globalThis.FormData||this.#D.body instanceof URLSearchParams)&&!J)this.#D.headers.delete("content-type");if(this.request=new globalThis.Request(this.#Q,this.#D),NG(this.#D.searchParams)){let G="?"+(typeof this.#D.searchParams==="string"?this.#D.searchParams.replace(/^\?/,""):new URLSearchParams(e0.#J(this.#D.searchParams)).toString()),q=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,G);this.request=new globalThis.Request(q,this.#D)}if(this.#D.onUploadProgress){if(typeof this.#D.onUploadProgress!=="function")throw TypeError("The `onUploadProgress` option must be a function");if(!I6)throw Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#C(this.request,this.#D.body??void 0)}}#j(){let D=this.#D.retry.delay(this.#G),$=D;if(this.#D.retry.jitter===!0)$=Math.random()*D;else if(typeof this.#D.retry.jitter==="function"){if($=this.#D.retry.jitter(D),!Number.isFinite($)||$<0)$=D}let J=this.#D.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(J,$)}async#H(D){if(this.#G++,this.#G>this.#D.retry.limit)throw D;let $=D instanceof Error?D:new M8(D);if($ instanceof P8)return $.customDelay??this.#j();if(!this.#D.retry.methods.includes(this.request.method.toLowerCase()))throw D;if(this.#D.retry.shouldRetry!==void 0){let J=await this.#D.retry.shouldRetry({error:$,retryCount:this.#G});if(J===!1)throw D;if(J===!0)return this.#j()}if(FG(D)&&!this.#D.retry.retryOnTimeout)throw D;if(VG(D)){if(!this.#D.retry.statusCodes.includes(D.response.status))throw D;let J=D.response.headers.get("Retry-After")??D.response.headers.get("RateLimit-Reset")??D.response.headers.get("X-RateLimit-Retry-After")??D.response.headers.get("X-RateLimit-Reset")??D.response.headers.get("X-Rate-Limit-Reset");if(J&&this.#D.retry.afterStatusCodes.includes(D.response.status)){let Q=Number(J)*1000;if(Number.isNaN(Q))Q=Date.parse(J)-Date.now();else if(Q>=Date.parse("2024-01-01"))Q-=Date.now();let G=this.#D.retry.maxRetryAfter??Q;return Q<G?Q:G}if(D.response.status===413)throw D}return this.#j()}#E(D){if(this.#D.parseJson)D.json=async()=>this.#D.parseJson(await D.text());return D}#U(D){if(!D)return;D.cancel().catch(()=>{return})}#X(D){this.#U(D.body??void 0)}async#z(D){try{return await D()}catch($){let J=Math.min(await this.#H($),F9);if(this.#G<1)throw $;if(await P6(J,this.#q?{signal:this.#q}:{}),$ instanceof P8&&$.customRequest){let Q=this.#D.signal?new globalThis.Request($.customRequest,{signal:this.#D.signal}):new globalThis.Request($.customRequest);this.#W(Q)}for(let Q of this.#D.hooks.beforeRetry){let G=await Q({request:this.request,options:this.#K(),error:$,retryCount:this.#G});if(G instanceof globalThis.Request){this.#W(G);break}if(G instanceof globalThis.Response)return G;if(G===L9)return}return this.#z(D)}}async#N(){if(this.#$?.signal.aborted)this.#$=new globalThis.AbortController,this.#D.signal=this.#q?AbortSignal.any([this.#q,this.#$.signal]):this.#$.signal,this.request=new globalThis.Request(this.request,{signal:this.#D.signal});for(let $ of this.#D.hooks.beforeRequest){let J=await $(this.request,this.#K(),{retryCount:this.#G});if(J instanceof Response)return J;if(J instanceof globalThis.Request){this.#W(J);break}}let D=HG(this.request,this.#D);if(this.#Y=this.request,this.request=this.#Y.clone(),this.#D.timeout===!1)return this.#D.fetch(this.#Y,D);return M6(this.#Y,D,this.#$,this.#D)}#K(){if(!this.#Z){let{hooks:D,...$}=this.#D;this.#Z=Object.freeze($)}return this.#Z}#W(D){this.#Z=void 0,this.request=this.#C(D)}#C(D,$){if(!this.#D.onUploadProgress||!D.body)return D;return WG(D,this.#D.onUploadProgress,$??this.#D.body??void 0)}}/*! MIT License © Sindre Sorhus */var S6=(D)=>{let $=(J,Q)=>e0.create(J,S8(D,Q));for(let J of V9)$[J]=(Q,G)=>e0.create(Q,S8(D,G,{method:J}));return $.create=(J)=>S6(S8(J)),$.extend=(J)=>{if(typeof J==="function")J=J(D??{});return S6(S8(D,J))},$.stop=L9,$.retry=XG,$},tK=S6(),rD=tK;class _8{static#J="https://lite-api.jup.ag/tokens/v2";static async search(D){return rD.get(`${this.#J}/search`,{searchParams:D,throwHttpErrors:!1}).json()}}class oD{static#J="https://lite-api.jup.ag/ultra/v1";static#$={"x-client-platform":"jupiter.cli"};static async getOrder(D){return rD.get(`${this.#J}/order`,{searchParams:D,throwHttpErrors:!1,headers:this.#$}).json()}static async getHoldings(D){return rD.get(`${this.#J}/holdings/${D}`,{headers:this.#$}).json()}static async postExecute(D){return rD.post(`${this.#J}/execute`,{json:D,headers:this.#$}).json()}static async getTransferTokenTx(D){return rD.get(`${this.#J}/transfer/craft-token`,{searchParams:D,throwHttpErrors:!1,headers:this.#$}).json()}static async getTransferSolTx(D){return rD.get(`${this.#J}/transfer/craft-native`,{searchParams:D,throwHttpErrors:!1,headers:this.#$}).json()}static async postExecuteTransfer(D){return rD.post(`${this.#J}/transfer/execute`,{json:D,headers:this.#$}).json()}}var E0={WSOL:x7("So11111111111111111111111111111111111111112")};class BD{static removeInsignificantZeros(D){if(D.length===0)return"";if(Number(D)===0)return"0";let $=0;while($<D.length&&D[$]==="0"&&D[$+1]!==".")$++;let J=D.length-1;if(D.includes(".")){while(J>=0&&(D[J]==="0"||D[J]==="."))if(J--,D[J]==="."){J--;break}}return D.substring($,J+1)}static fromChainAmount(D,$,J){let Q=D.toString(),G;if(Q.length<=$){let q="0".repeat($-Q.length);G=this.removeInsignificantZeros(`0.${q}${Q}`)}else{let q=Q.length-$,X=Q.substring(0,q),Y=Q.substring(q);G=this.removeInsignificantZeros(`${X}.${Y}`)}if(!J||J===1)return G;return this.removeInsignificantZeros((Number(G)*J).toFixed($))}static toChainAmount(D,$,J){let[Q,G]=D.split("."),q=this.removeInsignificantZeros((Q??"")+(G??"").padEnd($,"0").slice(0,$));if(!J||J===1)return q;return this.removeInsignificantZeros(Math.round(Number(q)/J).toFixed(0))}}class _6{static register(D){let $=D.command("spot").description("Swaps, transfers, token and portfolio data");$.command("tokens").description("Search for tokens by symbol or mint address").requiredOption("--search <query>","Token symbol or comma-delimited mint addresses").option("--limit <n>","Max number of results").action((J)=>this.tokens(J)),$.command("quote").description("Get a swap quote").requiredOption("--from <token>","Input token (symbol or mint address)").requiredOption("--to <token>","Output token (symbol or mint address)").option("--amount <n>","Amount in human-readable units").option("--raw-amount <n>","Amount in on-chain units (no decimal conversion)").action((J)=>this.quote(J)),$.command("swap").description("Execute a swap").requiredOption("--from <token>","Input token (symbol or mint address)").requiredOption("--to <token>","Output token (symbol or mint address)").option("--amount <n>","Amount in human-readable units").option("--raw-amount <n>","Amount in on-chain units (no decimal conversion)").option("--key <name>","Key to use for signing").action((J)=>this.swap(J)),$.command("portfolio").description("Show spot portfolio for a wallet").option("--address <address>","Wallet address to look up").option("--key <name>","Key to use (overrides active key)").action((J)=>this.portfolio(J)),$.command("transfer").description("Transfer tokens to another wallet").requiredOption("--token <token>","Token to transfer (symbol or mint address)").requiredOption("--to <address>","Recipient wallet address").option("--amount <n>","Amount in human-readable units").option("--raw-amount <n>","Amount in on-chain units (no decimal conversion)").option("--key <name>","Key to use for signing").action((J)=>this.transfer(J))}static async tokens(D){if(D.limit&&isNaN(Number(D.limit)))throw Error("--limit must be a number");let $=await _8.search({query:D.search,limit:D.limit});if($.length===0)throw Error("No tokens found matching query.");if(v.isJson()){v.json($);return}v.table({type:"horizontal",headers:{id:"Address",symbol:"Symbol",name:"Name",price:"Price",mcap:"Market Cap",verified:"Verified"},rows:$.map((J)=>({...J,price:v.formatDollar(J.usdPrice),mcap:v.formatDollar(J.mcap),verified:v.formatBoolean(J.isVerified)}))})}static async quote(D){this.validateAmountOpts(D);let[$,J]=await Promise.all([this.resolveToken(D.from),this.resolveToken(D.to)]),Q=this.getScaledUiMultiplier($),G=this.getScaledUiMultiplier(J),q=await oD.getOrder({inputMint:$.id,outputMint:J.id,amount:D.rawAmount??BD.toChainAmount(D.amount,$.decimals,Q)});if(q.error)throw Error(q.errorMessage??q.error);let X=BD.fromChainAmount(q.inAmount,$.decimals,Q),Y=BD.fromChainAmount(q.outAmount,J.decimals,G);if(v.isJson()){v.json({inputToken:{id:$.id,symbol:$.symbol,decimals:$.decimals},outputToken:{id:J.id,symbol:J.symbol,decimals:J.decimals},inAmount:X,outAmount:Y,inUsdValue:q.inUsdValue,outUsdValue:q.outUsdValue,priceImpact:q.priceImpact});return}v.table({type:"vertical",rows:[{label:"Input",value:`${X} ${$.symbol} (${v.formatDollar(q.inUsdValue)})`},{label:"Quoted Output",value:`${Y} ${J.symbol} (${v.formatDollar(q.outUsdValue)})`},{label:"Price Impact",value:v.formatPercentageChange(q.priceImpact)}]})}static async swap(D){this.validateAmountOpts(D);let $=d.load(),[J,Q,G]=await Promise.all([wD.load(D.key??$.activeKey),this.resolveToken(D.from),this.resolveToken(D.to)]),q=this.getScaledUiMultiplier(Q),X=this.getScaledUiMultiplier(G),Y=await oD.getOrder({inputMint:Q.id,outputMint:G.id,amount:D.rawAmount??BD.toChainAmount(D.amount,Q.decimals,q),taker:J.address});if(Y.error)throw Error(Y.errorMessage??Y.error);if(!Y.transaction)throw Error("No valid routes found.");let Z=await J.signTransaction(Y.transaction),K=await oD.postExecute({requestId:Y.requestId,signedTransaction:Z}),j=BD.fromChainAmount(K.inputAmountResult,Q.decimals,q),U=BD.fromChainAmount(K.outputAmountResult,G.decimals,X),C=0;if(Y.prioritizationFeePayer===J.address&&Y.prioritizationFeeLamports)C=Y.prioritizationFeeLamports;if(Y.rentFeePayer===J.address&&Y.rentFeeLamports)C+=Y.rentFeeLamports;if(Y.signatureFeePayer===J.address&&Y.signatureFeeLamports)C+=Y.signatureFeeLamports;let z=BD.fromChainAmount(C.toString(),9);if(v.isJson()){v.json({trader:J.address,signature:K.signature,inputToken:{id:Q.id,symbol:Q.symbol,decimals:Q.decimals},outputToken:{id:G.id,symbol:G.symbol,decimals:G.decimals},inAmount:j,outAmount:U,inUsdValue:Y.inUsdValue,outUsdValue:Y.outUsdValue,priceImpact:Y.priceImpact,networkFeeLamports:C});return}v.table({type:"vertical",rows:[{label:"Trader",value:J.address},{label:"Input",value:`${j} ${Q.symbol} (${v.formatDollar(Y.inUsdValue)})`},{label:"Output",value:`${U} ${G.symbol} (${v.formatDollar(Y.outUsdValue)})`},{label:"Network Fee",value:`${z} SOL`},{label:"Tx Signature",value:K.signature}]})}static async portfolio(D){if(D.address&&D.key)throw Error("Only one of --address or --key can be provided.");let $=D.address??(await wD.load(D.key??d.load().activeKey)).address,J=9,Q=await oD.getHoldings($),G=new Map;for(let[W,H]of Object.entries(Q.tokens)){let N=H.find((I)=>I.isAssociatedTokenAccount);if(N)G.set(W,N)}let q=[...G.keys()];if(!G.has(E0.WSOL))q.push(E0.WSOL);let X=100,Y=new Map,Z=[];for(let W=0;W<q.length;W+=X)Z.push(q.slice(W,W+X));let K=await Promise.all(Z.map((W)=>_8.search({query:W.join(","),limit:X.toString()})));for(let W of K)for(let H of W)Y.set(H.id,H);let j=[],U=Y.get(E0.WSOL),C=BigInt(Q.amount),z=BigInt(G.get(E0.WSOL)?.amount??"0"),E=C+z;if(U&&E>0n){let W=Number(BD.fromChainAmount(E,J));j.push({id:E0.WSOL,symbol:U.symbol,decimals:J,amount:W,rawAmount:E.toString(),value:W*(U.usdPrice??0),price:U.usdPrice??0,priceChange:U.stats24h?.priceChange??0,isVerified:U.isVerified})}for(let[W,H]of G){if(W===E0.WSOL)continue;let N=Y.get(W);if(!N)continue;let I=this.getScaledUiMultiplier(N),O=Number(BD.fromChainAmount(H.amount,N.decimals,I));j.push({id:W,symbol:N.symbol,decimals:N.decimals,amount:O,rawAmount:H.amount,value:O*(N.usdPrice??0),price:N.usdPrice??0,priceChange:N.stats24h?.priceChange??0,isVerified:N.isVerified,scaledUiMultiplier:I})}j.sort((W,H)=>H.value-W.value);let F=j.reduce((W,H)=>W+H.value,0);if(v.isJson()){v.json({totalValue:F,tokens:j});return}if(j.length===0)throw Error("No holdings found for this address.");v.table({type:"horizontal",headers:{symbol:"Token",amount:"Amount",price:"Price",value:"Value",priceChange:"24h Change",verified:"Verified"},rows:j.map((W)=>({symbol:W.symbol,amount:W.amount.toLocaleString("en-US",{maximumFractionDigits:6}),price:v.formatDollar(W.price),value:v.formatDollar(W.value),priceChange:v.formatPercentageChange(W.priceChange),verified:v.formatBoolean(W.isVerified)}))}),console.log(`
2091
- Total Value: ${v.formatDollar(F)}`)}static async transfer(D){this.validateAmountOpts(D);let $=d.load(),[J,Q]=await Promise.all([wD.load(D.key??$.activeKey),this.resolveToken(D.token)]),G=this.getScaledUiMultiplier(Q),q=D.rawAmount??BD.toChainAmount(D.amount,Q.decimals,G),X;if(Q.id===E0.WSOL)X=await oD.getTransferSolTx({senderAddress:J.address,receiverAddress:D.to,amount:q});else{let[C]=await DG({mint:Q.id,owner:J.address,tokenProgram:Q.tokenProgram});X=await oD.getTransferTokenTx({mint:Q.id,tokenDecimals:Q.decimals.toString(),tokenProgramId:Q.tokenProgram,senderAddress:J.address,senderTokenAccountAddress:C,receiverAddress:D.to,amount:q})}if("error"in X)throw Error(X.error);let Y=await J.signTransaction(X.transaction),Z=await oD.postExecuteTransfer({requestId:X.requestId,signedTransaction:Y}),K=BD.fromChainAmount(q,Q.decimals,G),j=Number(K)*(Q.usdPrice??0);if(v.isJson()){v.json({sender:J.address,recipient:D.to,token:{id:Q.id,symbol:Q.symbol,decimals:Q.decimals},amount:K,value:j,networkFeeLamports:X.feeAmount,signature:Z.signature});return}let U=BD.fromChainAmount(X.feeAmount.toString(),9);v.table({type:"vertical",rows:[{label:"Sender",value:J.address},{label:"Recipient",value:D.to},{label:"Amount",value:`${K} ${Q.symbol} (${v.formatDollar(j)})`},{label:"Network Fee",value:`${U} SOL`},{label:"Tx Signature",value:Z.signature}]})}static validateAmountOpts(D){if(!D.amount&&!D.rawAmount)throw Error("Either --amount or --raw-amount must be provided.");if(D.amount&&D.rawAmount)throw Error("Only one of --amount or --raw-amount can be provided.")}static getScaledUiMultiplier(D){if(!D.scaledUiConfig)return;return new Date>=new Date(D.scaledUiConfig.newMultiplierEffectiveAt)?D.scaledUiConfig.newMultiplier:D.scaledUiConfig.multiplier}static async resolveToken(D){let[$]=await _8.search({query:D,limit:"1"});if(!$)throw Error(`Token not found: ${D}`);return $}}d.init();var k8=new t6;k8.name("jup").description("Jupiter CLI for agentic workflows").version("0.1.0").option("-f, --format <type>","Output format ('table' or 'json')").hook("preAction",(D)=>{let $=D.opts();if($.format){if($.format!=="table"&&$.format!=="json")throw Error("Invalid --format value. Must be 'table' or 'json'.");v.outputOverride=$.format}});r9.register(k8);R6.register(k8);_6.register(k8);k8.parseAsync().catch((D)=>{v.error(D),process.exit(1)});
2090
+ `);class E0{privateKey;publicKey;constructor(D,$){this.privateKey=D,this.publicKey=$}static async generate(D=24){let $=Cq(Lq,D===12?128:256);return{keyPair:await this.fromSeedPhrase($),mnemonic:$}}static async fromSeedPhrase(D){let $=Rq(D),J=z0.fromMasterSeed($).derive("m/44'/501'/0'/0'");if(!J.privateKey)throw Error("Failed to derive private key");return new E0(J.privateKey,V7.getPublicKey(J.privateKey))}static async fromPrivateKey(D){let $=void 0;try{let Q=JSON.parse(D.startsWith("[")&&D.endsWith("]")?D:`[${D}]`);if(Array.isArray(Q)&&Q.every((q)=>typeof q==="number"&&q>=0&&q<=255)){let q=new Uint8Array(Q);if(q.length===32||q.length===64)$=q}}catch(Q){}try{$??=PJ().encode(D)}catch(Q){}try{$??=J9().encode(D)}catch(Q){}try{$??=u6().encode(D)}catch(Q){}if($==null||$.length!==32&&$.length!==64)throw Error("Invalid private key format");let J=$.slice(0,32);return new E0(J,V7.getPublicKey(J))}toJson(){return JSON.stringify([...this.privateKey,...this.publicKey])}}class UD{#$;#Q;constructor(D,$){this.#$=D,this.#Q=$}static async fromKeyPair(D){let $=await JQ(D.privateKey);return new UD($,D)}static async fromSeedPhrase(D){return this.fromKeyPair(await E0.fromSeedPhrase(D))}static async fromPrivateKey(D){return this.fromKeyPair(await E0.fromPrivateKey(D))}static async generate(){let{keyPair:D}=await E0.generate();return this.fromKeyPair(D)}static async load(D){let $=Bq(u.KEYS_DIR,`${D}.json`);if(!MU($))throw Error(`Key "${D}" does not exist.`);let J=PU($,"utf-8");return this.fromKeyPair(await E0.fromPrivateKey(J))}save(D){let $=Bq(u.KEYS_DIR,`${D}.json`);_U($,this.#Q.toJson())}get address(){return this.#$.address}async signTransaction(D){let $=SJ().encode(D),J=eJ().decode($),Q=await j9([this.#$.keyPair],J);return $Q(Q)}}class A7{static register(D){let $=D.command("keys").description("Private key management");$.command("list").description("List all keys").action(()=>this.list()),$.command("add [name]").description("Generate or recover a keypair").option("--overwrite","Overwrite existing key").option("--recover","Recover from seed phrase or private key").option("--seed-phrase <phrase>","Seed phrase for recovery").option("--private-key <key>","Private key (base58) for recovery").action((J,Q)=>this.add(J,Q)),$.command("delete <name>").description("Delete a key").action((J)=>this.delete(J)),$.command("edit <name>").description("Edit a key's name or credentials").option("--name <new-name>","Rename the key").option("--seed-phrase <phrase>","Replace key with new seed phrase").option("--private-key <key>","Replace key with new private key").action((J,Q)=>this.edit(J,Q)),$.command("use <name>").description("Set the active key").action((J)=>this.use(J)),$.command("solana-import").description("Import a Solana CLI keypair").option("--name <name>","Name for the imported key").option("--path <path>","Path to Solana keypair file").option("--overwrite","Overwrite existing key").action((J)=>this.solanaImport(J))}static async list(){if(!H0(u.KEYS_DIR))throw Error("No keys found.");let D=kU(u.KEYS_DIR).filter((Q)=>Q.endsWith(".json")),$=u.load(),J=await Promise.all(D.map(async(Q)=>{let q=Q.replace(".json",""),G=await UD.load(q);return{name:q,address:G.address,active:$.activeKey===q}}));if(L.isJson()){L.json(J);return}L.table({type:"horizontal",headers:{name:"Name",address:"Address",active:"Active"},rows:J.map((Q)=>({...Q,active:L.formatBoolean(Q.active)}))})}static async add(D="default",$={}){let J=S0(u.KEYS_DIR,`${D}.json`);if(H0(J)&&!$.overwrite)throw Error(`Key "${D}" already exists. Use --overwrite to replace.`);let Q;if($.recover)if($.seedPhrase)Q=await UD.fromSeedPhrase($.seedPhrase);else if($.privateKey)Q=await UD.fromPrivateKey($.privateKey);else throw Error("--recover requires --seed-phrase or --private-key");else Q=await UD.generate();Q.save(D),this.list()}static delete(D){let $=S0(u.KEYS_DIR,`${D}.json`);if(!H0($))throw Error(`Key "${D}" not found.`);xU($),this.list()}static async edit(D,$={}){if(!$.name&&!$.seedPhrase&&!$.privateKey)throw Error("At least one option is required (--name, --seed-phrase, or --private-key).");if($.seedPhrase&&$.privateKey)throw Error("--seed-phrase and --private-key are mutually exclusive.");let J=S0(u.KEYS_DIR,`${D}.json`);if(!H0(J))throw Error(`Key "${D}" not found.`);if($.seedPhrase||$.privateKey)($.seedPhrase?await UD.fromSeedPhrase($.seedPhrase):await UD.fromPrivateKey($.privateKey)).save(D);if($.name){let Q=S0(u.KEYS_DIR,`${$.name}.json`);if(H0(Q))throw Error(`Key "${$.name}" already exists.`);if(AU(J,Q),u.load().activeKey===D)u.set({activeKey:$.name})}this.list()}static use(D){let $=S0(u.KEYS_DIR,`${D}.json`);if(!H0($))throw Error(`Key "${D}" not found.`);u.set({activeKey:D}),this.list()}static solanaImport(D={}){let $=D.name??"default",J=D.path??S0(bU(),".config","solana","id.json");if(!H0(J))throw Error(`Solana keypair not found at: ${J}`);let Q=S0(u.KEYS_DIR,`${$}.json`);if(H0(Q)&&!D.overwrite)throw Error(`Key "${$}" already exists. Use --overwrite to replace.`);SU(J,Q),this.list()}}var zD={SOL:{id:g0("So11111111111111111111111111111111111111112"),decimals:9},BTC:{id:g0("3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh"),decimals:8},ETH:{id:g0("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs"),decimals:8},USDC:{id:g0("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),decimals:6}};function b8(D){let $=D.toUpperCase(),J=zD[$];if(!J)throw Error(`Unknown asset: ${D}`);return J}class DD{static removeInsignificantZeros(D){if(D.length===0)return"";if(Number(D)===0)return"0";let $=0;while($<D.length&&D[$]==="0"&&D[$+1]!==".")$++;let J=D.length-1;if(D.includes(".")){while(J>=0&&(D[J]==="0"||D[J]==="."))if(J--,D[J]==="."){J--;break}}return D.substring($,J+1)}static fromChainAmount(D,$,J){let Q=D.toString(),q;if(Q.length<=$){let G="0".repeat($-Q.length);q=this.removeInsignificantZeros(`0.${G}${Q}`)}else{let G=Q.length-$,X=Q.substring(0,G),Y=Q.substring(G);q=this.removeInsignificantZeros(`${X}.${Y}`)}if(!J||J===1)return q;return this.removeInsignificantZeros((Number(q)*J).toFixed($))}static toChainAmount(D,$,J){let[Q,q]=D.split("."),G=this.removeInsignificantZeros((Q??"")+(q??"").padEnd($,"0").slice(0,$));if(!J||J===1)return G;return this.removeInsignificantZeros(Math.round(Number(G)/J).toFixed(0))}}class tD{static#$=u.load().apiKey;static host=this.#$?"https://api.jup.ag":"https://lite-api.jup.ag";static headers={"x-client-platform":"jupiter.cli",...this.#$&&{"x-api-key":this.#$}}}class k{static#$=y0.create({prefixUrl:"https://perps-api.jup.ag/v2",headers:tD.headers});static toUsdRaw(D){return DD.toChainAmount(D,zD.USDC.decimals)}static fromUsdRaw(D){return DD.fromChainAmount(D,zD.USDC.decimals)}static async getMarkets(){return Promise.all(["SOL","BTC","ETH"].map(async(D)=>{let $=b8(D).id,J=await this.#$.get("market-stats",{searchParams:{mint:$}}).json();return{asset:D,...J}}))}static async getPositions(D){return this.#$.get("positions",{searchParams:{walletAddress:D}}).json()}static async getLimitOrders(D){return this.#$.get("orders/limit",{searchParams:{walletAddress:D}}).json()}static async postIncreasePosition(D){return this.#$.post("positions/increase",{json:D}).json()}static async postDecreasePosition(D){return this.#$.post("positions/decrease",{json:D}).json()}static async postCloseAll(D){return this.#$.post("positions/close-all",{json:{walletAddress:D}}).json()}static async postLimitOrder(D){return this.#$.post("orders/limit",{json:D}).json()}static async patchLimitOrder(D){return this.#$.patch("orders/limit",{json:D}).json()}static async deleteLimitOrder(D){return this.#$.delete("orders/limit",{json:{positionRequestPubkey:D}}).json()}static async postTpsl(D){return this.#$.post("tpsl",{json:D}).json()}static async patchTpsl(D){return this.#$.patch("tpsl",{json:D}).json()}static async deleteTpsl(D){return this.#$.delete("tpsl",{json:{positionRequestPubkey:D}}).json()}static async postExecute(D){return this.#$.post("transaction/execute",{json:D}).json()}}class x7{static register(D){let $=D.command("perps").description("Perpetual futures trading");$.command("positions").description("View open positions and pending limit orders").option("--key <name>","Key to use (overrides active key)").option("--address <address>","Wallet address to look up").action((J)=>this.positions(J)),$.command("markets").description("List all perpetual markets with current prices").action(()=>this.markets()),$.command("open").description("Open a new position via market or limit order").requiredOption("--asset <asset>","Market to trade (SOL, BTC, ETH)").requiredOption("--side <side>","Direction (long, short, buy, sell)").requiredOption("--amount <number>","Input token amount (human-readable)").option("--size <usd>","Position size in USD").option("--input <token>","Input token (SOL, BTC, ETH, USDC)","SOL").option("--leverage <number>","Leverage multiplier").option("--limit <price>","Trigger price for limit order").option("--tp <price>","Take-profit trigger price").option("--sl <price>","Stop-loss trigger price").option("--slippage <bps>","Max slippage in basis points","200").option("--key <name>","Key to use for signing").action((J)=>this.open(J)),$.command("set").description("Update TP/SL or limit order trigger price").option("--position <pubkey>","Position to set/update TP/SL on").option("--order <pubkey>","Limit order to update").option("--tp <price>","Take-profit trigger price").option("--sl <price>","Stop-loss trigger price").option("--limit <price>","New trigger price for limit order").option("--key <name>","Key to use for signing").action((J)=>this.set(J)),$.command("close").description("Close a position, cancel a limit order, or cancel TP/SL").option("--position <pubkey>","Position to close (or 'all')").option("--order <pubkey>","Limit order to cancel").option("--tpsl <pubkey>","TP/SL order to cancel").option("--size <usd>","USD amount to reduce (partial close)").option("--receive <token>","Token to receive (defaults to position's collateral)").option("--slippage <bps>","Max slippage in basis points","200").option("--key <name>","Key to use for signing").action((J)=>this.close(J))}static async signAndExecute(D,$,J){let Q=await D.signTransaction(J);return k.postExecute({action:$,serializedTxBase64:Q})}static normalizeSide(D){let $=D.toLowerCase();if($==="buy"||$==="long")return"long";if($==="sell"||$==="short")return"short";throw Error("Invalid --side. Must be long, short, buy, or sell.")}static async positions(D){if(D.address&&D.key)throw Error("Only one of --address or --key can be provided.");let $=D.address??(await UD.load(D.key??u.load().activeKey)).address,[J,Q]=await Promise.all([k.getPositions($),k.getLimitOrders($)]),q=new Map(Object.entries(zD).map(([G,X])=>[X.id,G]));if(L.isJson()){L.json({positions:J.dataList.map((G)=>({positionPubkey:G.positionPubkey,asset:G.asset,side:G.side,leverage:Number(G.leverage),sizeUsd:Number(k.fromUsdRaw(G.sizeUsd)),entryPriceUsd:Number(k.fromUsdRaw(G.entryPriceUsd)),markPriceUsd:Number(k.fromUsdRaw(G.markPriceUsd)),pnlPct:Number(G.pnlAfterFeesPct),liquidationPriceUsd:Number(k.fromUsdRaw(G.liquidationPriceUsd)),tpsl:G.tpslRequests.map((X)=>({pubkey:X.positionRequestPubkey,type:X.requestType,triggerPriceUsd:X.triggerPriceUsd?Number(k.fromUsdRaw(X.triggerPriceUsd)):null}))})),limitOrders:Q.dataList.map((G)=>({orderPubkey:G.positionRequestPubkey,asset:q.get(G.marketMint)??G.marketMint,side:G.side,sizeUsd:Number(k.fromUsdRaw(G.sizeUsdDelta)),triggerPriceUsd:G.triggerPrice?Number(k.fromUsdRaw(G.triggerPrice)):null}))});return}if(J.dataList.length>0)for(let G of J.dataList){let X=G.tpslRequests.find((j)=>j.requestType==="tp"),Y=G.tpslRequests.find((j)=>j.requestType==="sl"),U=[{label:"Type",value:`${(G.side==="long"?BD.green.bold:BD.red.bold)(`${G.asset} ${Number(G.leverage).toFixed(1)}x ${G.side}`)} ${BD.gray(`(${G.positionPubkey})`)}`},{label:"Size",value:L.formatDollar(Number(k.fromUsdRaw(G.sizeUsd)))},{label:"Entry Price",value:L.formatDollar(Number(k.fromUsdRaw(G.entryPriceUsd)))},{label:"Mark Price",value:L.formatDollar(Number(k.fromUsdRaw(G.markPriceUsd)))},{label:"PnL",value:L.formatPercentageChange(Number(G.pnlAfterFeesPct))},{label:"Liq. Price",value:L.formatDollar(Number(k.fromUsdRaw(G.liquidationPriceUsd)))},{label:"TP",value:X?`${L.formatDollar(X.triggerPriceUsd?Number(k.fromUsdRaw(X.triggerPriceUsd)):void 0)} ${BD.gray(`(${X.positionRequestPubkey})`)}`:L.formatDollar(void 0)},{label:"SL",value:Y?`${L.formatDollar(Y.triggerPriceUsd?Number(k.fromUsdRaw(Y.triggerPriceUsd)):void 0)} ${BD.gray(`(${Y.positionRequestPubkey})`)}`:L.formatDollar(void 0)}];L.table({type:"vertical",rows:U})}else console.log(`
2091
+ No open positions.`);if(Q.dataList.length>0)console.log(`
2092
+ Pending Limit Orders:`),L.table({type:"horizontal",headers:{asset:"Asset",side:"Side",size:"Size",trigger:"Trigger Price",pubkey:"Order"},rows:Q.dataList.map((G)=>({asset:q.get(G.marketMint)??G.marketMint.slice(0,8)+"...",side:G.side,size:L.formatDollar(Number(k.fromUsdRaw(G.sizeUsdDelta))),trigger:L.formatDollar(G.triggerPrice?Number(k.fromUsdRaw(G.triggerPrice)):void 0),pubkey:G.positionRequestPubkey}))});else console.log(`
2093
+ No pending limit orders.`)}static async markets(){let $=(await k.getMarkets()).map((J)=>({asset:J.asset,priceUsd:Number(J.price),changePct24h:Number(J.priceChange24H),highUsd24h:Number(J.priceHigh24H),lowUsd24h:Number(J.priceLow24H),volumeUsd24h:Number(J.volume)}));if(L.isJson()){L.json($);return}L.table({type:"horizontal",headers:{asset:"Asset",priceUsd:"Price",changePct24h:"24h Change",highUsd24h:"24h High",lowUsd24h:"24h Low",volumeUsd24h:"24h Volume"},rows:$.map((J)=>({asset:J.asset,priceUsd:L.formatDollar(J.priceUsd),changePct24h:L.formatPercentageChange(J.changePct24h),highUsd24h:L.formatDollar(J.highUsd24h),lowUsd24h:L.formatDollar(J.lowUsd24h),volumeUsd24h:L.formatDollar(J.volumeUsd24h)}))})}static async open(D){if(!D.leverage&&!D.size)throw Error("Either --leverage or --size is required.");if(D.leverage&&D.size)throw Error("Only one of --leverage or --size can be provided.");if(D.limit&&(D.tp||D.sl))throw Error("--limit cannot be combined with --tp or --sl. Use 'perps set' after the limit order fills.");let $=this.normalizeSide(D.side),J=D.asset.toUpperCase(),Q=D.input.toUpperCase(),q=await UD.load(D.key??u.load().activeKey),G=b8(Q).decimals,X=DD.toChainAmount(D.amount,G),Y=D.size?k.toUsdRaw(D.size):void 0;if(D.limit){let Z=k.toUsdRaw(D.limit),U=await k.postLimitOrder({asset:J,inputToken:Q,inputTokenAmount:X,side:$,triggerPrice:Z,leverage:D.leverage,sizeUsdDelta:Y,walletAddress:q.address});if(!U.serializedTxBase64)throw Error("API returned no transaction for limit order.");let j=await this.signAndExecute(q,"create-limit-order",U.serializedTxBase64);if(L.isJson()){L.json({type:"limit-order",positionPubkey:U.positionPubkey,asset:J,side:$,triggerPriceUsd:Number(D.limit),sizeUsd:Number(k.fromUsdRaw(U.quote.sizeUsdDelta)),leverage:Number(U.quote.leverage),signature:j.txid});return}L.table({type:"vertical",rows:[{label:"Type",value:"Limit Order"},{label:"Asset",value:J},{label:"Side",value:$},{label:"Trigger Price",value:L.formatDollar(Number(D.limit))},{label:"Size",value:L.formatDollar(Number(k.fromUsdRaw(U.quote.sizeUsdDelta)))},{label:"Leverage",value:`${U.quote.leverage}x`},{label:"Tx",value:j.txid}]})}else{let Z=[];if(D.tp)Z.push({receiveToken:Q,triggerPrice:k.toUsdRaw(D.tp),requestType:"tp"});if(D.sl)Z.push({receiveToken:Q,triggerPrice:k.toUsdRaw(D.sl),requestType:"sl"});let U=await k.postIncreasePosition({asset:J,inputToken:Q,inputTokenAmount:X,side:$,maxSlippageBps:D.slippage,leverage:D.leverage,sizeUsdDelta:Y,walletAddress:q.address,tpsl:Z.length>0?Z:void 0}),j=await this.signAndExecute(q,"increase-position",U.serializedTxBase64);if(L.isJson()){L.json({type:"market-order",positionPubkey:U.positionPubkey,asset:J,side:$,entryPriceUsd:Number(k.fromUsdRaw(U.quote.averagePriceUsd)),sizeUsd:Number(k.fromUsdRaw(U.quote.sizeUsdDelta)),leverage:Number(U.quote.leverage),liquidationPriceUsd:Number(k.fromUsdRaw(U.quote.liquidationPriceUsd)),openFeeUsd:Number(k.fromUsdRaw(U.quote.openFeeUsd)),signature:j.txid});return}L.table({type:"vertical",rows:[{label:"Type",value:"Market Order"},{label:"Asset",value:J},{label:"Side",value:$},{label:"Entry Price",value:L.formatDollar(Number(k.fromUsdRaw(U.quote.averagePriceUsd)))},{label:"Size",value:L.formatDollar(Number(k.fromUsdRaw(U.quote.sizeUsdDelta)))},{label:"Leverage",value:`${U.quote.leverage}x`},{label:"Liq. Price",value:L.formatDollar(Number(k.fromUsdRaw(U.quote.liquidationPriceUsd)))},{label:"Open Fee",value:L.formatDollar(Number(k.fromUsdRaw(U.quote.openFeeUsd)))},{label:"Tx",value:j.txid}]})}}static async set(D){if(!D.position&&!D.order)throw Error("Either --position or --order is required.");if(D.position&&D.order)throw Error("Only one of --position or --order can be provided.");if(D.position&&!D.tp&&!D.sl)throw Error("--position requires at least one of --tp or --sl.");if(D.order&&!D.limit)throw Error("--order requires --limit.");let $=await UD.load(D.key??u.load().activeKey);if(D.order){let G=await k.patchLimitOrder({positionRequestPubkey:D.order,triggerPrice:k.toUsdRaw(D.limit)});if(!G.serializedTxBase64)throw Error("API returned no transaction for limit order update.");let X=await this.signAndExecute($,"update-limit-order",G.serializedTxBase64);if(L.isJson()){L.json({action:"update-limit-order",triggerPriceUsd:Number(D.limit),signature:X.txid});return}L.table({type:"vertical",rows:[{label:"Action",value:"Update Limit Order"},{label:"New Trigger Price",value:L.formatDollar(Number(D.limit))},{label:"Tx",value:X.txid}]});return}let Q=(await k.getPositions($.address)).dataList.find((G)=>G.positionPubkey===D.position);if(!Q)throw Error(`Position not found: ${D.position}`);let q=[];for(let[G,X]of[["tp",D.tp],["sl",D.sl]]){if(!X)continue;let Y=Q.tpslRequests.find((Z)=>Z.requestType===G);if(Y){let Z=await k.patchTpsl({positionRequestPubkey:Y.positionRequestPubkey,triggerPrice:k.toUsdRaw(X)}),U=await this.signAndExecute($,"update-tpsl",Z.serializedTxBase64);q.push({type:G,action:"updated",triggerPriceUsd:Number(X),signature:U.txid})}else{let Z=await k.postTpsl({walletAddress:$.address,positionPubkey:D.position,tpsl:[{receiveToken:Q.collateralToken,triggerPrice:k.toUsdRaw(X),requestType:G,entirePosition:!0}]}),U=await this.signAndExecute($,"create-tpsl",Z.serializedTxBase64);q.push({type:G,action:"created",triggerPriceUsd:Number(X),signature:U.txid})}}if(L.isJson()){L.json({action:"set-tpsl",updates:q});return}for(let G of q)console.log(`${G.type.toUpperCase()} ${G.action} at $${G.triggerPriceUsd} (tx: ${G.signature})`)}static async close(D){let $=[D.position,D.order,D.tpsl].filter(Boolean);if($.length===0)throw Error("One of --position, --order, or --tpsl is required.");if($.length>1)throw Error("Only one of --position, --order, or --tpsl can be provided.");let J=await UD.load(D.key??u.load().activeKey);if(D.order){let U=await k.deleteLimitOrder(D.order),j=await this.signAndExecute(J,"cancel-limit-order",U.serializedTxBase64);if(L.isJson()){L.json({action:"cancel-limit-order",signature:j.txid});return}console.log(`Limit order cancelled (tx: ${j.txid})`);return}if(D.tpsl){let U=await k.deleteTpsl(D.tpsl),j=await this.signAndExecute(J,"cancel-tpsl",U.serializedTxBase64);if(L.isJson()){L.json({action:"cancel-tpsl",signature:j.txid});return}console.log(`TP/SL cancelled (tx: ${j.txid})`);return}if(D.position==="all"){let U=await k.postCloseAll(J.address);if(U.serializedTxs.length===0)throw Error("No open positions to close.");let j=[];for(let K of U.serializedTxs){let H=await this.signAndExecute(J,"decrease-position",K.serializedTxBase64);j.push(H.txid)}if(L.isJson()){L.json({action:"close-all",signatures:j});return}console.log(`Closed ${j.length} position(s):
2094
+ ${j.map((K)=>` ${K}`).join(`
2095
+ `)}`);return}let Q=D.receive?.toUpperCase();if(!Q){let j=(await k.getPositions(J.address)).dataList.find((K)=>K.positionPubkey===D.position);if(!j)throw Error(`Position not found: ${D.position}`);Q=j.collateralToken}let q=!D.size,G=await k.postDecreasePosition({positionPubkey:D.position,receiveToken:Q,sizeUsdDelta:D.size?k.toUsdRaw(D.size):void 0,entirePosition:q||void 0,maxSlippageBps:D.slippage}),X=await this.signAndExecute(J,"decrease-position",G.serializedTxBase64),Y=b8(Q).decimals,Z=DD.fromChainAmount(G.quote.transferAmountToken,Y);if(L.isJson()){L.json({action:q?"close-position":"decrease-position",positionPubkey:G.positionPubkey,sizeReducedUsd:Number(k.fromUsdRaw(G.quote.sizeUsdDelta)),pnlUsd:Number(k.fromUsdRaw(G.quote.pnlAfterFeesUsd)),pnlPct:Number(G.quote.pnlAfterFeesPercent),received:`${Z} ${Q}`,receivedUsd:Number(k.fromUsdRaw(G.quote.transferAmountUsd)),feesUsd:Number(k.fromUsdRaw(G.quote.totalFeeUsd)),signature:X.txid});return}L.table({type:"vertical",rows:[{label:"Action",value:q?"Close Position":"Decrease Position"},{label:"Size Reduced",value:L.formatDollar(Number(k.fromUsdRaw(G.quote.sizeUsdDelta)))},{label:"PnL",value:`${L.formatDollar(Number(k.fromUsdRaw(G.quote.pnlAfterFeesUsd)))} (${L.formatPercentageChange(Number(G.quote.pnlAfterFeesPercent))})`},{label:"Received",value:`${Z} ${Q} (${L.formatDollar(Number(k.fromUsdRaw(G.quote.transferAmountUsd)))})`},{label:"Fees",value:L.formatDollar(Number(k.fromUsdRaw(G.quote.totalFeeUsd)))},{label:"Tx",value:X.txid}]})}}async function Iq(D,$={}){let{programAddress:J="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"}=$;return await yJ({programAddress:J,seeds:[V8().encode(D.owner),V8().encode(D.tokenProgram),V8().encode(D.mint)]})}var hU=0,vU;vU={[hU]:"Associated token account owner does not match address derivation"};var yU=0,fU=1,mU=2,uU=3,gU=4,lU=5,dU=6,pU=7,cU=8,aU=9,iU=10,rU=11,oU=12,nU=13,sU=14,tU=15,eU=16,Dj=17,$j=18,Jj=19,Qj;Qj={[Dj]:"Account is frozen",[dU]:"Already in use",[tU]:"Account does not support specified authority type",[lU]:"Fixed supply",[fU]:"Insufficient funds",[oU]:"Invalid instruction",[mU]:"Invalid Mint",[pU]:"Invalid number of provided signers",[cU]:"Invalid number of required signers",[nU]:"State is invalid for requested operation",[eU]:"This token mint cannot freeze accounts",[$j]:"The provided decimals value different from the Mint decimals",[uU]:"Account not associated with this Mint",[iU]:"Instruction does not support native tokens",[rU]:"Non-native account can only be closed if its balance is zero",[Jj]:"Instruction does not support non-native tokens",[yU]:"Lamport balance below rent-exempt threshold",[sU]:"Operation overflowed",[gU]:"Owner does not match",[aU]:"State is unititialized"};class h8{static#$=y0.create({prefixUrl:`${tD.host}/tokens/v2`,headers:tD.headers,throwHttpErrors:!1});static async search(D){return this.#$.get("search",{searchParams:D}).json()}}class eD{static#$=y0.create({prefixUrl:`${tD.host}/ultra/v1`,headers:tD.headers});static async getOrder(D){return this.#$.get("order",{searchParams:D,throwHttpErrors:!1}).json()}static async getHoldings(D){return this.#$.get(`holdings/${D}`).json()}static async postExecute(D){return this.#$.post("execute",{json:D}).json()}static async getTransferTokenTx(D){return this.#$.get("transfer/craft-token",{searchParams:D,throwHttpErrors:!1}).json()}static async getTransferSolTx(D){return this.#$.get("transfer/craft-native",{searchParams:D,throwHttpErrors:!1}).json()}static async postExecuteTransfer(D){return this.#$.post("transfer/execute",{json:D}).json()}}class b7{static register(D){let $=D.command("spot").description("Swaps, transfers, token and portfolio data");$.command("tokens").description("Search for tokens by symbol or mint address").requiredOption("--search <query>","Token symbol or comma-delimited mint addresses").option("--limit <n>","Max number of results").action((J)=>this.tokens(J)),$.command("quote").description("Get a swap quote").requiredOption("--from <token>","Input token (symbol or mint address)").requiredOption("--to <token>","Output token (symbol or mint address)").option("--amount <n>","Amount in human-readable units").option("--raw-amount <n>","Amount in on-chain units (no decimal conversion)").action((J)=>this.quote(J)),$.command("swap").description("Execute a swap").requiredOption("--from <token>","Input token (symbol or mint address)").requiredOption("--to <token>","Output token (symbol or mint address)").option("--amount <n>","Amount in human-readable units").option("--raw-amount <n>","Amount in on-chain units (no decimal conversion)").option("--key <name>","Key to use for signing").action((J)=>this.swap(J)),$.command("portfolio").description("Show spot portfolio for a wallet").option("--address <address>","Wallet address to look up").option("--key <name>","Key to use (overrides active key)").action((J)=>this.portfolio(J)),$.command("transfer").description("Transfer tokens to another wallet").requiredOption("--token <token>","Token to transfer (symbol or mint address)").requiredOption("--to <address>","Recipient wallet address").option("--amount <n>","Amount in human-readable units").option("--raw-amount <n>","Amount in on-chain units (no decimal conversion)").option("--key <name>","Key to use for signing").action((J)=>this.transfer(J))}static async tokens(D){if(D.limit&&isNaN(Number(D.limit)))throw Error("--limit must be a number");let $=await h8.search({query:D.search,limit:D.limit});if($.length===0)throw Error("No tokens found matching query.");if(L.isJson()){L.json($);return}L.table({type:"horizontal",headers:{id:"Address",symbol:"Symbol",name:"Name",price:"Price",mcap:"Market Cap",verified:"Verified"},rows:$.map((J)=>({...J,price:L.formatDollar(J.usdPrice),mcap:L.formatDollar(J.mcap),verified:L.formatBoolean(J.isVerified)}))})}static async quote(D){this.validateAmountOpts(D);let[$,J]=await Promise.all([this.resolveToken(D.from),this.resolveToken(D.to)]),Q=this.getScaledUiMultiplier($),q=this.getScaledUiMultiplier(J),G=await eD.getOrder({inputMint:$.id,outputMint:J.id,amount:D.rawAmount??DD.toChainAmount(D.amount,$.decimals,Q)});if(G.error)throw Error(G.errorMessage??G.error);let X=DD.fromChainAmount(G.inAmount,$.decimals,Q),Y=DD.fromChainAmount(G.outAmount,J.decimals,q);if(L.isJson()){L.json({inputToken:{id:$.id,symbol:$.symbol,decimals:$.decimals},outputToken:{id:J.id,symbol:J.symbol,decimals:J.decimals},inAmount:X,outAmount:Y,inUsdValue:G.inUsdValue,outUsdValue:G.outUsdValue,priceImpact:G.priceImpact});return}L.table({type:"vertical",rows:[{label:"Input",value:`${X} ${$.symbol} (${L.formatDollar(G.inUsdValue)})`},{label:"Quoted Output",value:`${Y} ${J.symbol} (${L.formatDollar(G.outUsdValue)})`},{label:"Price Impact",value:L.formatPercentageChange(G.priceImpact)}]})}static async swap(D){this.validateAmountOpts(D);let $=u.load(),[J,Q,q]=await Promise.all([UD.load(D.key??$.activeKey),this.resolveToken(D.from),this.resolveToken(D.to)]),G=this.getScaledUiMultiplier(Q),X=this.getScaledUiMultiplier(q),Y=await eD.getOrder({inputMint:Q.id,outputMint:q.id,amount:D.rawAmount??DD.toChainAmount(D.amount,Q.decimals,G),taker:J.address});if(Y.error)throw Error(Y.errorMessage??Y.error);if(!Y.transaction)throw Error("No valid routes found.");let Z=await J.signTransaction(Y.transaction),U=await eD.postExecute({requestId:Y.requestId,signedTransaction:Z}),j=DD.fromChainAmount(U.inputAmountResult,Q.decimals,G),K=DD.fromChainAmount(U.outputAmountResult,q.decimals,X),H=0;if(Y.prioritizationFeePayer===J.address&&Y.prioritizationFeeLamports)H=Y.prioritizationFeeLamports;if(Y.rentFeePayer===J.address&&Y.rentFeeLamports)H+=Y.rentFeeLamports;if(Y.signatureFeePayer===J.address&&Y.signatureFeeLamports)H+=Y.signatureFeeLamports;let E=DD.fromChainAmount(H.toString(),zD.SOL.decimals);if(L.isJson()){L.json({trader:J.address,signature:U.signature,inputToken:{id:Q.id,symbol:Q.symbol,decimals:Q.decimals},outputToken:{id:q.id,symbol:q.symbol,decimals:q.decimals},inAmount:j,outAmount:K,inUsdValue:Y.inUsdValue,outUsdValue:Y.outUsdValue,priceImpact:Y.priceImpact,networkFeeLamports:H});return}L.table({type:"vertical",rows:[{label:"Trader",value:J.address},{label:"Input",value:`${j} ${Q.symbol} (${L.formatDollar(Y.inUsdValue)})`},{label:"Output",value:`${K} ${q.symbol} (${L.formatDollar(Y.outUsdValue)})`},{label:"Network Fee",value:`${E} SOL`},{label:"Tx Signature",value:U.signature}]})}static async portfolio(D){if(D.address&&D.key)throw Error("Only one of --address or --key can be provided.");let $=D.address??(await UD.load(D.key??u.load().activeKey)).address,J=zD.SOL.decimals,Q=await eD.getHoldings($),q=new Map;for(let[W,V]of Object.entries(Q.tokens)){let N=V.find((w)=>w.isAssociatedTokenAccount);if(N)q.set(W,N)}let G=[...q.keys()];if(!q.has(zD.SOL.id))G.push(zD.SOL.id);let X=100,Y=new Map,Z=[];for(let W=0;W<G.length;W+=X)Z.push(G.slice(W,W+X));let U=await Promise.all(Z.map((W)=>h8.search({query:W.join(","),limit:X.toString()})));for(let W of U)for(let V of W)Y.set(V.id,V);let j=[],K=Y.get(zD.SOL.id),H=BigInt(Q.amount),E=BigInt(q.get(zD.SOL.id)?.amount??"0"),z=H+E;if(K&&z>0n){let W=Number(DD.fromChainAmount(z,J));j.push({id:zD.SOL.id,symbol:K.symbol,decimals:J,amount:W,rawAmount:z.toString(),value:W*(K.usdPrice??0),price:K.usdPrice??0,priceChange:K.stats24h?.priceChange??0,isVerified:K.isVerified})}for(let[W,V]of q){if(W===zD.SOL.id)continue;let N=Y.get(W);if(!N)continue;let w=this.getScaledUiMultiplier(N),O=Number(DD.fromChainAmount(V.amount,N.decimals,w));j.push({id:W,symbol:N.symbol,decimals:N.decimals,amount:O,rawAmount:V.amount,value:O*(N.usdPrice??0),price:N.usdPrice??0,priceChange:N.stats24h?.priceChange??0,isVerified:N.isVerified,scaledUiMultiplier:w})}j.sort((W,V)=>V.value-W.value);let C=j.reduce((W,V)=>W+V.value,0);if(L.isJson()){L.json({totalValue:C,tokens:j});return}if(j.length===0)throw Error("No holdings found for this address.");L.table({type:"horizontal",headers:{symbol:"Token",amount:"Amount",price:"Price",value:"Value",priceChange:"24h Change",verified:"Verified"},rows:j.map((W)=>({symbol:W.symbol,amount:W.amount.toLocaleString("en-US",{maximumFractionDigits:6}),price:L.formatDollar(W.price),value:L.formatDollar(W.value),priceChange:L.formatPercentageChange(W.priceChange),verified:L.formatBoolean(W.isVerified)}))}),console.log(`
2096
+ Total Value: ${L.formatDollar(C)}`)}static async transfer(D){this.validateAmountOpts(D);let $=u.load(),[J,Q]=await Promise.all([UD.load(D.key??$.activeKey),this.resolveToken(D.token)]),q=this.getScaledUiMultiplier(Q),G=D.rawAmount??DD.toChainAmount(D.amount,Q.decimals,q),X;if(Q.id===zD.SOL.id)X=await eD.getTransferSolTx({senderAddress:J.address,receiverAddress:D.to,amount:G});else{let[H]=await Iq({mint:Q.id,owner:J.address,tokenProgram:Q.tokenProgram});X=await eD.getTransferTokenTx({mint:Q.id,tokenDecimals:Q.decimals.toString(),tokenProgramId:Q.tokenProgram,senderAddress:J.address,senderTokenAccountAddress:H,receiverAddress:D.to,amount:G})}if("error"in X)throw Error(X.error);let Y=await J.signTransaction(X.transaction),Z=await eD.postExecuteTransfer({requestId:X.requestId,signedTransaction:Y}),U=DD.fromChainAmount(G,Q.decimals,q),j=Number(U)*(Q.usdPrice??0);if(L.isJson()){L.json({sender:J.address,recipient:D.to,token:{id:Q.id,symbol:Q.symbol,decimals:Q.decimals},amount:U,value:j,networkFeeLamports:X.feeAmount,signature:Z.signature});return}let K=DD.fromChainAmount(X.feeAmount.toString(),zD.SOL.decimals);L.table({type:"vertical",rows:[{label:"Sender",value:J.address},{label:"Recipient",value:D.to},{label:"Amount",value:`${U} ${Q.symbol} (${L.formatDollar(j)})`},{label:"Network Fee",value:`${K} SOL`},{label:"Tx Signature",value:Z.signature}]})}static validateAmountOpts(D){if(!D.amount&&!D.rawAmount)throw Error("Either --amount or --raw-amount must be provided.");if(D.amount&&D.rawAmount)throw Error("Only one of --amount or --raw-amount can be provided.")}static getScaledUiMultiplier(D){if(!D.scaledUiConfig)return;return new Date>=new Date(D.scaledUiConfig.newMultiplierEffectiveAt)?D.scaledUiConfig.newMultiplier:D.scaledUiConfig.multiplier}static async resolveToken(D){let[$]=await h8.search({query:D,limit:"1"});if(!$)throw Error(`Token not found: ${D}`);return $}}var wq="0.2.1";u.init();var Q8=new J1;Q8.name("jup").description("Jupiter CLI for agentic workflows").version(wq).option("-f, --format <type>","Output format ('table' or 'json')").hook("preAction",(D)=>{let $=D.opts();if($.format){if($.format!=="table"&&$.format!=="json")throw Error("Invalid --format value. Must be 'table' or 'json'.");L.outputOverride=$.format}});G6.register(Q8);A7.register(Q8);x7.register(Q8);b7.register(Q8);Q8.parseAsync().catch(async(D)=>{await L.error(D),process.exit(1)});