@jup-ag/cli 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +20 -22
  2. package/package.json +5 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
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 kq,Sq,f7=(D,$,J)=>{var Q=D!=null&&typeof D==="object";if(Q){var q=$?kq??=new WeakMap:Sq??=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(`
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
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
4
  `+" ".repeat($+Y));return G+X+" ".repeat(Y)+j.replace(/\n/g,`
5
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(`
@@ -11,35 +11,35 @@ ${G}`)}boxWrap(D,$){if($<this.minWidthToWrap)return D;let J=D.split(/\r\n|\n/),Q
11
11
  - too many long flags`);throw Error(`${Y}
12
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""}tq.suggestSimilar=sq});var n7=a((X4)=>{var D4=V0("node:events").EventEmitter,k9=V0("node:child_process"),mD=V0("node:path"),f8=V0("node:fs"),p=V0("node:process"),{Argument:$4,humanReadableArgName:J4}=y8(),{CommanderError:S9}=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
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
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 S9(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}'
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
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
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(q)}_executeSubCommand(D,$){$=$.slice();let J=!1,Q=[".js",".ts",".tsx",".mjs",".cjs"];function q(U,j){let K=mD.resolve(U,j);if(f8.existsSync(K))return K;if(Q.includes(mD.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=mD.resolve(mD.dirname(U),X)}if(X){let U=q(X,G);if(!U&&!D._executableFile&&this._scriptPath){let j=mD.basename(this._scriptPath,mD.extname(this._scriptPath));if(j!==this._name)U=q(X,`${j}-${D._name}`)}G=U||G}J=Q.includes(mD.extname(G));let Y;if(p.platform!=="win32")if(J)$.unshift(G),$=o7(p.execArgv).concat($),Y=k9.spawn(p.argv[0],$,{stdio:"inherit"});else Y=k9.spawn(G,$,{stdio:"inherit"});else this._checkForMissingExecutable(G,X,D._name),$.unshift(G),$=o7(p.execArgv).concat($),Y=k9.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 S9(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 S9(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}
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
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=mD.basename(D,mD.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.
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
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,S1)=>{var P1=M1();function d8(D){return D?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function xD(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=xD(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 k1(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===xD(D))return D.substr(0,$);while(xD(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+xD(U)>$)U=r4(U,$-G);if(X+=U,G+=xD(U),G<$){if(!Y)break;X+=Y[0],_1(Z,Y)}}return k1(Z,X)}function n4(D,$,J){if(J=J||"…",xD(D)<=$)return D;$-=xD(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+xD(Z);if(G>0&&X)U+=X.length;if(U>D){if(G!==0)J.push(q.join(""));q=[Z],G=xD(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(k1(G,q))}return J}function QG(D,$){return["\x1B]","8",";",";",D||$,"\x07",$,"\x1B]","8",";",";","\x07"].join("")}S1.exports={strlen:xD,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"),SD=y1(),FD=process.env,b0=void 0;if(SD("no-color")||SD("no-colors")||SD("color=false"))b0=!1;else if(SD("color")||SD("colors")||SD("color=true")||SD("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(SD("color=16m")||SD("color=full")||SD("color=truecolor"))return 3;if(SD("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(),TD=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=TD.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(TD.wordWrap(this.fixedWidth,this.content,q))}return this.wrapLines(this.content.split(`
31
- `))}wrapLines(D){let $=TD.colorizeLines(D);if(this.href)return $.map((J)=>TD.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=TD.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(TD.repeat(this.chars[this.y==0?"top":"mid"],J))},this);else $.push(this._topLeftChar(0)),$.push(TD.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=TD.repeat(" ",this.paddingLeft),X=$?this.chars.right:"",Y=TD.repeat(" ",this.paddingRight),Z=this.lines[D],U=this.width-(this.paddingLeft+this.paddingRight);if(J)Z+=this.truncate||"…";let j=TD.truncate(Z,U,this.truncate);return j=TD.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=TD.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=TD.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 uD=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":uD.setDebugLevel(uD.WARN);break;case"number":uD.setDebugLevel($.debug);break;case"string":uD.setDebugLevel(parseInt($.debug,10));break;default:uD.setDebugLevel(uD.WARN),uD.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof $.debug}`)}Object.defineProperty(this,"messages",{get(){return uD.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(`
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}}n9.reset=()=>uD.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),kj=[...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 k4 from"node:os";import Z1 from"node:tty";function PD(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(PD("no-color")||PD("no-colors")||PD("color=false")||PD("color=never"))u8=0;else if(PD("color")||PD("colors")||PD("color=true")||PD("color=always"))u8=1;function S4(){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=S4();if(Q!==void 0)u8=Q;let q=J?u8:Q;if(q===0)return 0;if(J){if(PD("color=16m")||PD("color=full")||PD("color=truecolor"))return 3;if(PD("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=k4.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
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
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"),S0=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[S0]),this[X8]);return Object.defineProperty(this,D,{value:J}),J}};A0.visible={get(){let D=g8(this,this[S0],!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[S0]);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[S0]);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[S0]=$,Q[X8]=J,Q},m4=(D,$)=>{if(D.level<=0||!$)return D[X8]?"":$;let J=D[S0];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 eD=u4;var q6=f7(z$(),1);class gD 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},k$=(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 S$(D){return D instanceof gD||D?.name===gD.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 gD(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),k$(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(S$(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$,$},kG=Q6(),y0=kG;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 gD){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(`${eD.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)=>eD.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({[eD.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 eD.green($);if(D<-0.5)return eD.red($);return eD.gray($)}static formatDollar(D){if(!D)return eD.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 kU,existsSync as H0,readdirSync as SU,renameSync as AU,rmSync as xU}from"node:fs";import{homedir as bU}from"node:os";import{join as k0}from"node:path";var SG=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,kX=4615008,SX=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,k2=5508007,S2=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,kY=7050024,SY=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,k6=8078005,S6=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.",[SG]:"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].",[k6]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[S6]:"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",[SX]:"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",[kX]:"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",[k2]:"The provided value does not implement the `TransactionPartialSigner` interface",[S2]:"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.
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.`,[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",[SY]:"Transaction loads an address table account with invalid data",[AY]:"Transaction address table lookup uses an invalid index",[kY]:"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,lD="i",bD="t";function L5(D,$={}){let J=C5[D];if(J.length===0)return"";let Q;function q(Y){if(Q[bD]===2){let Z=J.slice(Q[lD]+1,Y);G.push(Z in $?`${$[Z]}`:`$${Z}`)}else if(Q[bD]===1)G.push(J.slice(Q[lD],Y))}let G=[];J.split("").forEach((Y,Z)=>{if(Z===0){Q={[lD]:0,[bD]:J[0]==="\\"?0:J[0]==="$"?2:1};return}let U;switch(Q[bD]){case 0:U={[lD]:Z,[bD]:1};break;case 1:if(Y==="\\")U={[lD]:Z,[bD]:0};else if(Y==="$")U={[lD]:Z,[bD]:2};break;case 2:if(Y==="\\")U={[lD]:Z,[bD]:0};else if(Y==="$")U={[lD]:Z,[bD]:2};else if(!Y.match(/\w/))U={[lD]:Z,[bD]: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 BD(D){return"fixedSize"in D&&typeof D.fixedSize==="number"}function T5(D){return!BD(D)}function hD(D,$){if(BD(D)!==BD($))throw new v(_6);if(BD(D)&&BD($)&&D.fixedSize!==$.fixedSize)throw new v(k6,{decoderFixedSize:$.fixedSize,encoderFixedSize:D.fixedSize});if(!BD(D)&&!BD($)&&D.maxSize!==$.maxSize)throw new v(S6,{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(BD(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(BD(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}})},k5=(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=S5(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 S5(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=()=>k5(_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]})},kJ=()=>hD(u6(),g6());var{TextDecoder:ZW,TextEncoder:UW}=globalThis;function SJ(){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 hD(V8(),l0())}var v5=37095705934669439343138083508754565189542113879843219016388785533085940283555n,CD=57896044618658097711785492504343953926634992332820282019728792003956564819949n,xJ=19681161376707505956807079304988542015446066515923890162744021073123829784752n;function _D(D){let $=D%CD;return $>=0n?$:CD+$}function vD(D,$){let J=D;while($-- >0n)J*=J,J%=CD;return J}function y5(D){let J=D*D%CD*D%CD,Q=vD(J,2n)*J%CD,q=vD(Q,1n)*D%CD,G=vD(q,5n)*q%CD,X=vD(G,10n)*G%CD,Y=vD(X,20n)*X%CD,Z=vD(Y,40n)*Y%CD,U=vD(Z,80n)*Z%CD,j=vD(U,80n)*Z%CD,K=vD(j,10n)*G%CD;return vD(K,2n)*D%CD}function f5(D,$){let J=_D($*$*$),Q=_D(J*J*$),q=y5(D*Q),G=_D(D*J*q),X=_D($*G*G),Y=G,Z=_D(G*xJ),U=X===D,j=X===_D(-D),K=X===_D(-D*xJ);if(U)G=Y;if(j||K)G=Z;if((_D(G)&1n)===1n)G=_D(-G);if(!U&&!j)return null;return G}function m5(D,$){let J=_D(D*D),Q=_D(J-1n),q=_D(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(SJ(),$.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 BD(D)?D.fixedSize:null}function p0(D){return BD(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(!BD(D[0]))return null;let $=D[0].fixedSize;return D.every((Q)=>BD(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 kW=Symbol("AddressMapTypeProperty");var SW=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 hD(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 yD(D){return new DataView(D.buffer,D.byteOffset,D.byteLength)}function AD(D,$){return D<<32-$|D>>>$}function pD(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 cD(D){if(h(D),GQ)return D.toHex();let $="";for(let J=0;J<D.length;J++)$+=CZ[D[J]];return $}var dD={_0:48,_9:57,A:65,F:70,a:97,f:102};function QQ(D){if(D>=dD._0&&D<=dD._9)return D-dD._0;if(D>=dD.A&&D<=dD.F)return D-(dD.A-10);if(D>=dD.a&&D<=dD.f)return D-(dD.a-10);return}function aD(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=yD(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=yD(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=yD(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 iD=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),rD=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 fD(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=AD(K,7)^AD(K,18)^K>>>3,z=AD(H,17)^AD(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=AD(X,6)^AD(X,11)^AD(X,25),H=U+K+r0(X,Y,Z)+IZ[j]+q0[j]|0,z=(AD(J,2)^AD(J,13)^AD(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=iD[0]|0;B=iD[1]|0;C=iD[2]|0;D=iD[3]|0;E=iD[4]|0;F=iD[5]|0;G=iD[6]|0;H=iD[7]|0;constructor(){super(32)}}class wZ 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(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}=fD(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}=fD(this.Ah|0,this.Al|0,J|0,Q|0)),{h:q,l:G}=fD(this.Bh|0,this.Bl|0,q|0,G|0),{h:X,l:Y}=fD(this.Ch|0,this.Cl|0,X|0,Y|0),{h:Z,l:U}=fD(this.Dh|0,this.Dl|0,Z|0,U|0),{h:j,l:K}=fD(this.Eh|0,this.El|0,j|0,K|0),{h:H,l:E}=fD(this.Fh|0,this.Fl|0,H|0,E|0),{h:z,l:C}=fD(this.Gh|0,this.Gl|0,z|0,C|0),{h:W,l:V}=fD(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 oD(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(cD(D))}function T0(D){return CQ(cD(H9(h(D)).reverse()))}function E9(D,$){HD($),D=FQ(D);let J=aD(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 kZ(D,$,J){return z9(D)&&z9($)&&z9(J)&&$<=D&&D<J}function w8(D,$,J,Q){if(!kZ($,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),SZ=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+SZ)/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 kQ=(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 SQ{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 SQ(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")),oD(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(aD(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,k=F+I,_=Z(R-V*l),A=Z(B*P),x=Z(k*_),b=Z(B*_),e=Z(P*k);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 cD(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(oD(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),k=X.create(F+P*R);if(!X.isValid(k))throw Error("sign failed: invalid s");let _=QD(B,X.toBytes(k));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)oD(I,"zip215");if(Q)T=Q(T);let B=F/2,P=M.subarray(0,B),k=T0(M.subarray(B,F)),_,A,x;try{_=D.fromBytes(y,I),A=D.fromBytes(P,I),x=q.multiplyUnsafe(k)}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(kQ(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<nD,H=j<nD;if(K)U=-U;if(H)j=-j;let E=T8(Math.ceil(X7(J)/2))+e0;if(U<nD||U>=E||j<nD||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(oD(J.lowS,"lowS"),oD(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<nD)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)}},nD=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(),k=Q.toBytes(B);if(oD(F,"isCompressed"),F){j();let _=!Q.isOdd(P);return QD(iQ(_),k)}else return QD(Uint8Array.of(4),k,Q.toBytes(P))}function H(R){h(R,void 0,"Point");let{publicKey:I,publicKeyUncompressed:F}=U,B=R.length,P=R[0],k=R.subarray(1);if(B===I&&(P===2||P===3)){let _=Q.fromBytes(k);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(k.subarray(0,_)),x=Q.fromBytes(k.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 k=R.is0();if(I==null)I=k?Q.ONE:Q.inv(P);let _=Q.mul(F,I),A=Q.mul(B,I),x=Q.mul(P,I);if(k)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(aD(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:k,Z:_}=R,A=Q.eql(Q.mul(I,_),Q.mul(P,B)),x=Q.eql(Q.mul(F,_),Q.mul(k,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:k}=this,_=Q.ZERO,A=Q.ZERO,x=Q.ZERO,b=Q.mul(B,B),e=Q.mul(P,P),i=Q.mul(k,k),d=Q.mul(B,P);return d=Q.add(d,d),x=Q.mul(B,k),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,k),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:k,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,k),qD=Q.mul(B,_),MD=Q.add(I,F),JD=Q.add(P,k);MD=Q.mul(MD,JD),JD=Q.add(d,$D),MD=Q.sub(MD,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(k,_),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(MD,A),A=Q.sub(A,d),d=Q.mul(MD,$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=(k)=>l.cached(this,k,(_)=>P0(T,_));if(I){let{k1neg:k,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,k,A)}else{let{p:k,f:_}=P(R);F=k,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===nD||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:k,k2:_}=f(R),{p1:A,p2:x}=fQ(T,F,P,_);return M(I.beta,A,x,B,k)}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 oD(R,"isCompressed"),this.assertValidity(),E(T,this,R)}toHex(R=!0){return cD(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,k=B==="compact"?P:B==="recovered"?P+1:void 0;return h(F,k)}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 k=E.signature/2,_=F.subarray(0,k),A=F.subarray(k,k*2);return new O(X.fromBytes(_),X.fromBytes(A),P)}static fromHex(F,B){return this.fromBytes(aD(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,k=this.assertRecovery(),_=k===2||k===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((k&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 aD(j0.hexFromSig(this));let{r:B,s:P}=this,k=X.toBytes(B),_=X.toBytes(P);if(F==="recovered")return N(),QD(Uint8Array.of(this.assertRecovery()),k,_);return QD(k,_)}toHex(F){return cD(this.toBytes(F))}}let f=J.bits2int||function(B){if(B.length>8192)throw Error("input is too large");let P=o0(B),k=B.length*8-Z;return k>0?P>>BigInt(k):P},c=J.bits2int_modN||function(B){return X.create(f(B))},g=T8(Z);function M(F){return w8("num < 2^"+Z,F,nD,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:k,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 MD=f(qD);if(!X.isValidNot0(MD))return;let JD=X.inv(MD),jD=D.BASE.multiply(MD).toAffine(),q8=X.create(jD.x);if(q8===nD)return;let v8=X.create(JD*X.create(d+q8*b));if(v8===nD)return;let h7=(jD.x===q8?0:2)|Number(jD.y&e0),v7=v8;if(k&&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:k,k2sig:_}=y(F,B,P);return RQ($.outputLen,X.BYTES,q)(k,_).toBytes(P.format)}function R(F,B,P,k={}){let{lowS:_,prehash:A,format:x}=F7(k,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),MD=X.create($D*qD),JD=X.create(i*qD),jD=D.BASE.multiplyUnsafe(MD).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:k}=F7(P,z);return B=T(B,k),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]=pD(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=pD(J,5)+Z+X+U+K0[Y]|0;X=G,G=q,q=pD(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+pD(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=pD(J+sQ(H,q,X,Z)+R9[W[O]]+z,N[O])+j|0;J=j,j=Z,Z=pD(X,10)|0,X=q,q=f}for(let O=0;O<16;O++){let f=pD(Q+sQ(E,G,Y,U)+R9[V[O]]+C,w[O])+K|0;Q=K,K=U,U=pD(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 ID(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 wD(D=""){return W0("join",D),{encode:($)=>{return I9("join.decode",$),$.join(D)},decode:($)=>{return W0("join.decode",$),$.split(D)}}}function k8(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 OD(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 S8={alphabet:ID,chain:LD,checksum:Wq,convertRadix:I7,convertRadix2:T9,radix:Kq,radix2:OD,join:wD,padding:k8},oz=LD(OD(4),ID("0123456789ABCDEF"),wD("")),nz=LD(OD(5),ID("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),k8(5),wD("")),sz=LD(OD(5),ID("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),wD("")),tz=LD(OD(5),ID("0123456789ABCDEFGHIJKLMNOPQRSTUV"),k8(5),wD("")),ez=LD(OD(5),ID("0123456789ABCDEFGHIJKLMNOPQRSTUV"),wD("")),DE=LD(OD(5),ID("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),wD(""),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(OD(6),ID("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),k8(6),wD("")),JE=LD(OD(6),ID("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),wD("")),QE=zq?{encode(D){return T7(D),D.toBase64({alphabet:"base64url"})},decode(D){return Eq(D,!0)}}:LD(OD(6),ID("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),k8(6),wD("")),qE=LD(OD(6),ID("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),wD("")),P7=(D)=>LD(Kq(58),ID(D),wD("")),WU=P7("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),GE=P7("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),XE=P7("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");var Hq=(D)=>LD(Wq(4,($)=>D(D($))),WU);var w7=LD(ID("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),wD("")),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=OD(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(OD(4),ID("0123456789abcdef"),wD(""),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)),k7={private:76066276,public:76067358},S7=2147483648,VU=(D)=>qq(I0(D)),NU=(D)=>yD(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 yD($).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,$=k7){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,$=k7){let J=_7.decode(D),Q=yD(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||k7,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>=S7)throw Error("Invalid index");if(q[2]==="'")X+=S7;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>=S7){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=yD(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: "+$)}),S8.chain(S8.checksum(1,IU),S8.radix2(11,!0),S8.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
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,12 +2087,10 @@ zebra
2087
2087
  zero
2088
2088
  zone
2089
2089
  zoo`.split(`
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 $=kJ().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=SU(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=k0(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 $=k0(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=k0(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=k0(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 $=k0(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??k0(bU(),".config","solana","id.json");if(!H0(J))throw Error(`Solana keypair not found at: ${J}`);let Q=k0(u.KEYS_DIR,`${$}.json`);if(H0(Q)&&!D.overwrite)throw Error(`Key "${$}" already exists. Use --overwrite to replace.`);kU(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 sD{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 S{static#$=y0.create({prefixUrl:"https://perps-api.jup.ag/v2",headers:sD.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 S.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([S.getPositions($),S.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(S.fromUsdRaw(G.sizeUsd)),entryPriceUsd:Number(S.fromUsdRaw(G.entryPriceUsd)),markPriceUsd:Number(S.fromUsdRaw(G.markPriceUsd)),pnlPct:Number(G.pnlAfterFeesPct),liquidationPriceUsd:Number(S.fromUsdRaw(G.liquidationPriceUsd)),tpsl:G.tpslRequests.map((X)=>({pubkey:X.positionRequestPubkey,type:X.requestType,triggerPriceUsd:Number(S.fromUsdRaw(X.triggerPrice))}))})),limitOrders:Q.dataList.map((G)=>({orderPubkey:G.positionRequestPubkey,asset:q.get(G.marketMint)??G.marketMint,side:G.side,sizeUsd:Number(S.fromUsdRaw(G.sizeUsdDelta)),triggerPriceUsd:Number(S.fromUsdRaw(G.triggerPrice))}))});return}if(J.dataList.length>0){console.log(`
2091
- Open Positions:`),L.table({type:"horizontal",headers:{asset:"Asset",side:"Side",leverage:"Leverage",size:"Size",entry:"Entry Price",mark:"Mark Price",pnl:"PnL",liq:"Liq. Price",pubkey:"Position"},rows:J.dataList.map((G)=>({asset:G.asset,side:G.side,leverage:`${Number(G.leverage).toFixed(1)}x`,size:L.formatDollar(Number(S.fromUsdRaw(G.sizeUsd))),entry:L.formatDollar(Number(S.fromUsdRaw(G.entryPriceUsd))),mark:L.formatDollar(Number(S.fromUsdRaw(G.markPriceUsd))),pnl:L.formatPercentageChange(Number(G.pnlAfterFeesPct)),liq:L.formatDollar(Number(S.fromUsdRaw(G.liquidationPriceUsd))),pubkey:G.positionPubkey}))});for(let G of J.dataList)if(G.tpslRequests.length>0){console.log(`
2092
- TP/SL for ${G.asset} ${G.side}:`);for(let X of G.tpslRequests){let Y=X.requestType==="tp"?"TP":"SL",Z=S.fromUsdRaw(X.triggerPrice);console.log(` ${Y}: $${Z} (${X.positionRequestPubkey})`)}}}else console.log(`
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(`
2093
2091
  No open positions.`);if(Q.dataList.length>0)console.log(`
2094
- 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(S.fromUsdRaw(G.sizeUsdDelta))),trigger:L.formatDollar(Number(S.fromUsdRaw(G.triggerPrice))),pubkey:G.positionRequestPubkey}))});else console.log(`
2095
- No pending limit orders.`)}static async markets(){let $=(await S.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?S.toUsdRaw(D.size):void 0;if(D.limit){let Z=S.toUsdRaw(D.limit),U=await S.postLimitOrder({asset:J,inputToken:Q,inputTokenAmount:X,side:$,triggerPrice:Z,leverage:D.leverage,sizeUsdDelta:Y,walletAddress:q.address}),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(S.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(S.fromUsdRaw(U.quote.sizeUsdDelta)))},{label:"Leverage",value:`${U.quote.leverage}x`},{label:"Tx",value:j.txid}]})}else{let Z=[];if(D.tp)Z.push({triggerPrice:S.toUsdRaw(D.tp),requestType:"tp"});if(D.sl)Z.push({triggerPrice:S.toUsdRaw(D.sl),requestType:"sl"});let U=await S.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(S.fromUsdRaw(U.quote.averagePriceUsd)),sizeUsd:Number(S.fromUsdRaw(U.quote.sizeUsdDelta)),leverage:Number(U.quote.leverage),liquidationPriceUsd:Number(S.fromUsdRaw(U.quote.liquidationPriceUsd)),openFeeUsd:Number(S.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(S.fromUsdRaw(U.quote.averagePriceUsd)))},{label:"Size",value:L.formatDollar(Number(S.fromUsdRaw(U.quote.sizeUsdDelta)))},{label:"Leverage",value:`${U.quote.leverage}x`},{label:"Liq. Price",value:L.formatDollar(Number(S.fromUsdRaw(U.quote.liquidationPriceUsd)))},{label:"Open Fee",value:L.formatDollar(Number(S.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 S.patchLimitOrder({positionRequestPubkey:D.order,triggerPrice:S.toUsdRaw(D.limit)}),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 S.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 S.patchTpsl({positionRequestPubkey:Y.positionRequestPubkey,triggerPrice:S.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 S.postTpsl({walletAddress:$.address,positionPubkey:D.position,tpsl:[{receiveToken:Q.collateralToken,triggerPrice:S.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 S.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 S.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 S.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):
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):
2096
2094
  ${j.map((K)=>` ${K}`).join(`
2097
- `)}`);return}let Q=D.receive?.toUpperCase();if(!Q){let j=(await S.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 S.postDecreasePosition({positionPubkey:D.position,receiveToken:Q,sizeUsdDelta:D.size?S.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(S.fromUsdRaw(G.quote.sizeUsdDelta)),pnlUsd:Number(S.fromUsdRaw(G.quote.pnlAfterFeesUsd)),pnlPct:Number(G.quote.pnlAfterFeesPercent),received:`${Z} ${Q}`,receivedUsd:Number(S.fromUsdRaw(G.quote.transferAmountUsd)),feesUsd:Number(S.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(S.fromUsdRaw(G.quote.sizeUsdDelta)))},{label:"PnL",value:`${L.formatDollar(Number(S.fromUsdRaw(G.quote.pnlAfterFeesUsd)))} (${L.formatPercentageChange(Number(G.quote.pnlAfterFeesPercent))})`},{label:"Received",value:`${Z} ${Q} (${L.formatDollar(Number(S.fromUsdRaw(G.quote.transferAmountUsd)))})`},{label:"Fees",value:L.formatDollar(Number(S.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:`${sD.host}/tokens/v2`,headers:sD.headers,throwHttpErrors:!1});static async search(D){return this.#$.get("search",{searchParams:D}).json()}}class tD{static#$=y0.create({prefixUrl:`${sD.host}/ultra/v1`,headers:sD.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 tD.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 tD.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 tD.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 tD.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(`
2098
- 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 tD.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 tD.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 tD.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.0";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)});
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)});