UNPKG

tw-stock

Version:

This is a search tw stock price with command

20 lines 741 kB
#!/usr/bin/env node "use strict";const Zu=require("events"),hl=require("child_process"),Xu=require("path"),Fi=require("fs"),fl=require("process"),Al=require("buffer"),ml=require("string_decoder"),$u=require("readline"),gl=require("os");function pl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Oi=pl(Fi);var Nn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ur(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bn={exports:{}},Fn={},On={},Fa;function or(){if(Fa)return On;Fa=1;class e extends Error{constructor(r,i,a){super(a),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=i,this.exitCode=r,this.nestedError=void 0}}class t extends e{constructor(r){super(1,"commander.invalidArgument",r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}return On.CommanderError=e,On.InvalidArgumentError=t,On}var Oa;function vi(){if(Oa)return Fn;Oa=1;const{InvalidArgumentError:e}=or();class t{constructor(i,a){switch(this.description=a||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,i[0]){case"<":this.required=!0,this._name=i.slice(1,-1);break;case"[":this.required=!1,this._name=i.slice(1,-1);break;default:this.required=!0,this._name=i;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(i,a){return a===this.defaultValue||!Array.isArray(a)?[i]:a.concat(i)}default(i,a){return this.defaultValue=i,this.defaultValueDescription=a,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(a,s)=>{if(!this.argChoices.includes(a))throw new e(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(a,s):a},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function n(r){const i=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+i+">":"["+i+"]"}return Fn.Argument=t,Fn.humanReadableArgName=n,Fn}var yr={},Ir={},va;function zu(){if(va)return Ir;va=1;const{humanReadableArgName:e}=vi();class t{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(r){const i=r.commands.filter(a=>!a._hidden);if(r._hasImplicitHelpCommand()){const[,a,s]=r._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),o=r.createCommand(a).helpOption(!1);o.description(r._helpCommandDescription),s&&o.arguments(s),i.push(o)}return this.sortSubcommands&&i.sort((a,s)=>a.name().localeCompare(s.name())),i}compareOptions(r,i){const a=s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,"");return a(r).localeCompare(a(i))}visibleOptions(r){const i=r.options.filter(o=>!o.hidden),a=r._hasHelpOption&&r._helpShortFlag&&!r._findOption(r._helpShortFlag),s=r._hasHelpOption&&!r._findOption(r._helpLongFlag);if(a||s){let o;a?s?o=r.createOption(r._helpFlags,r._helpDescription):o=r.createOption(r._helpShortFlag,r._helpDescription):o=r.createOption(r._helpLongFlag,r._helpDescription),i.push(o)}return this.sortOptions&&i.sort(this.compareOptions),i}visibleGlobalOptions(r){if(!this.showGlobalOptions)return[];const i=[];for(let a=r.parent;a;a=a.parent){const s=a.options.filter(o=>!o.hidden);i.push(...s)}return this.sortOptions&&i.sort(this.compareOptions),i}visibleArguments(r){return r._argsDescription&&r._args.forEach(i=>{i.description=i.description||r._argsDescription[i.name()]||""}),r._args.find(i=>i.description)?r._args:[]}subcommandTerm(r){const i=r._args.map(a=>e(a)).join(" ");return r._name+(r._aliases[0]?"|"+r._aliases[0]:"")+(r.options.length?" [options]":"")+(i?" "+i:"")}optionTerm(r){return r.flags}argumentTerm(r){return r.name()}longestSubcommandTermLength(r,i){return i.visibleCommands(r).reduce((a,s)=>Math.max(a,i.subcommandTerm(s).length),0)}longestOptionTermLength(r,i){return i.visibleOptions(r).reduce((a,s)=>Math.max(a,i.optionTerm(s).length),0)}longestGlobalOptionTermLength(r,i){return i.visibleGlobalOptions(r).reduce((a,s)=>Math.max(a,i.optionTerm(s).length),0)}longestArgumentTermLength(r,i){return i.visibleArguments(r).reduce((a,s)=>Math.max(a,i.argumentTerm(s).length),0)}commandUsage(r){let i=r._name;r._aliases[0]&&(i=i+"|"+r._aliases[0]);let a="";for(let s=r.parent;s;s=s.parent)a=s.name()+" "+a;return a+i+" "+r.usage()}commandDescription(r){return r.description()}subcommandDescription(r){return r.summary()||r.description()}optionDescription(r){const i=[];return r.argChoices&&i.push(`choices: ${r.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),r.defaultValue!==void 0&&(r.required||r.optional||r.isBoolean()&&typeof r.defaultValue=="boolean")&&i.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),r.presetArg!==void 0&&r.optional&&i.push(`preset: ${JSON.stringify(r.presetArg)}`),r.envVar!==void 0&&i.push(`env: ${r.envVar}`),i.length>0?`${r.description} (${i.join(", ")})`:r.description}argumentDescription(r){const i=[];if(r.argChoices&&i.push(`choices: ${r.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),r.defaultValue!==void 0&&i.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),i.length>0){const a=`(${i.join(", ")})`;return r.description?`${r.description} ${a}`:a}return r.description}formatHelp(r,i){const a=i.padWidth(r,i),s=i.helpWidth||80,o=2,c=2;function l(y,B){if(B){const A=`${y.padEnd(a+c)}${B}`;return i.wrap(A,s-o,a+c)}return y}function h(y){return y.join(` `).replace(/^/gm," ".repeat(o))}let m=[`Usage: ${i.commandUsage(r)}`,""];const g=i.commandDescription(r);g.length>0&&(m=m.concat([g,""]));const E=i.visibleArguments(r).map(y=>l(i.argumentTerm(y),i.argumentDescription(y)));E.length>0&&(m=m.concat(["Arguments:",h(E),""]));const T=i.visibleOptions(r).map(y=>l(i.optionTerm(y),i.optionDescription(y)));if(T.length>0&&(m=m.concat(["Options:",h(T),""])),this.showGlobalOptions){const y=i.visibleGlobalOptions(r).map(B=>l(i.optionTerm(B),i.optionDescription(B)));y.length>0&&(m=m.concat(["Global Options:",h(y),""]))}const I=i.visibleCommands(r).map(y=>l(i.subcommandTerm(y),i.subcommandDescription(y)));return I.length>0&&(m=m.concat(["Commands:",h(I),""])),m.join(` `)}padWidth(r,i){return Math.max(i.longestOptionTermLength(r,i),i.longestGlobalOptionTermLength(r,i),i.longestSubcommandTermLength(r,i),i.longestArgumentTermLength(r,i))}wrap(r,i,a,s=40){if(r.match(/[\n]\s+/))return r;const o=i-a;if(o<s)return r;const c=r.slice(0,a),l=r.slice(a),h=" ".repeat(a),m=new RegExp(".{1,"+(o-1)+"}([\\s​]|$)|[^\\s​]+?([\\s​]|$)","g"),g=l.match(m)||[];return c+g.map((E,T)=>(E.slice(-1)===` `&&(E=E.slice(0,E.length-1)),(T>0?h:"")+E.trimRight())).join(` `)}}return Ir.Help=t,Ir}var _t={},Ra;function eo(){if(Ra)return _t;Ra=1;const{InvalidArgumentError:e}=or();class t{constructor(s,o){this.flags=s,this.description=o||"",this.required=s.includes("<"),this.optional=s.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(s),this.mandatory=!1;const c=i(s);this.short=c.shortFlag,this.long=c.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(s,o){return this.defaultValue=s,this.defaultValueDescription=o,this}preset(s){return this.presetArg=s,this}conflicts(s){return this.conflictsWith=this.conflictsWith.concat(s),this}implies(s){return this.implied=Object.assign(this.implied||{},s),this}env(s){return this.envVar=s,this}argParser(s){return this.parseArg=s,this}makeOptionMandatory(s=!0){return this.mandatory=!!s,this}hideHelp(s=!0){return this.hidden=!!s,this}_concatValue(s,o){return o===this.defaultValue||!Array.isArray(o)?[s]:o.concat(s)}choices(s){return this.argChoices=s.slice(),this.parseArg=(o,c)=>{if(!this.argChoices.includes(o))throw new e(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(o,c):o},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return r(this.name().replace(/^no-/,""))}is(s){return this.short===s||this.long===s}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class n{constructor(s){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,s.forEach(o=>{o.negate?this.negativeOptions.set(o.attributeName(),o):this.positiveOptions.set(o.attributeName(),o)}),this.negativeOptions.forEach((o,c)=>{this.positiveOptions.has(c)&&this.dualOptions.add(c)})}valueFromOption(s,o){const c=o.attributeName();if(!this.dualOptions.has(c))return!0;const l=this.negativeOptions.get(c).presetArg,h=l!==void 0?l:!1;return o.negate===(h===s)}}function r(a){return a.split("-").reduce((s,o)=>s+o[0].toUpperCase()+o.slice(1))}function i(a){let s,o;const c=a.split(/[ |,]+/);return c.length>1&&!/^[[<]/.test(c[1])&&(s=c.shift()),o=c.shift(),!s&&/^-[^-]$/.test(o)&&(s=o,o=void 0),{shortFlag:s,longFlag:o}}return _t.Option=t,_t.splitOptionFlags=i,_t.DualOptions=n,_t}var Sr={},xa;function bl(){if(xa)return Sr;xa=1;const e=3;function t(r,i){if(Math.abs(r.length-i.length)>e)return Math.max(r.length,i.length);const a=[];for(let s=0;s<=r.length;s++)a[s]=[s];for(let s=0;s<=i.length;s++)a[0][s]=s;for(let s=1;s<=i.length;s++)for(let o=1;o<=r.length;o++){let c=1;r[o-1]===i[s-1]?c=0:c=1,a[o][s]=Math.min(a[o-1][s]+1,a[o][s-1]+1,a[o-1][s-1]+c),o>1&&s>1&&r[o-1]===i[s-2]&&r[o-2]===i[s-1]&&(a[o][s]=Math.min(a[o][s],a[o-2][s-2]+1))}return a[r.length][i.length]}function n(r,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));const a=r.startsWith("--");a&&(r=r.slice(2),i=i.map(l=>l.slice(2)));let s=[],o=e;const c=.4;return i.forEach(l=>{if(l.length<=1)return;const h=t(r,l),m=Math.max(r.length,l.length);(m-h)/m>c&&(h<o?(o=h,s=[l]):h===o&&s.push(l))}),s.sort((l,h)=>l.localeCompare(h)),a&&(s=s.map(l=>`--${l}`)),s.length>1?` (Did you mean one of ${s.join(", ")}?)`:s.length===1?` (Did you mean ${s[0]}?)`:""}return Sr.suggestSimilar=n,Sr}var La;function El(){if(La)return yr;La=1;const e=Zu.EventEmitter,t=hl,n=Xu,r=Fi,i=fl,{Argument:a,humanReadableArgName:s}=vi(),{CommanderError:o}=or(),{Help:c}=zu(),{Option:l,splitOptionFlags:h,DualOptions:m}=eo(),{suggestSimilar:g}=bl();class E extends e{constructor(A){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this._args=[],this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=A||"",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._outputConfiguration={writeOut:p=>i.stdout.write(p),writeErr:p=>i.stderr.write(p),getOutHelpWidth:()=>i.stdout.isTTY?i.stdout.columns:void 0,getErrHelpWidth:()=>i.stderr.isTTY?i.stderr.columns:void 0,outputError:(p,D)=>D(p)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(A){return this._outputConfiguration=A._outputConfiguration,this._hasHelpOption=A._hasHelpOption,this._helpFlags=A._helpFlags,this._helpDescription=A._helpDescription,this._helpShortFlag=A._helpShortFlag,this._helpLongFlag=A._helpLongFlag,this._helpCommandName=A._helpCommandName,this._helpCommandnameAndArgs=A._helpCommandnameAndArgs,this._helpCommandDescription=A._helpCommandDescription,this._helpConfiguration=A._helpConfiguration,this._exitCallback=A._exitCallback,this._storeOptionsAsProperties=A._storeOptionsAsProperties,this._combineFlagAndOptionalValue=A._combineFlagAndOptionalValue,this._allowExcessArguments=A._allowExcessArguments,this._enablePositionalOptions=A._enablePositionalOptions,this._showHelpAfterError=A._showHelpAfterError,this._showSuggestionAfterError=A._showSuggestionAfterError,this}command(A,p,D){let f=p,b=D;typeof f=="object"&&f!==null&&(b=f,f=null),b=b||{};const[,L,H]=A.match(/([^ ]+) *(.*)/),O=this.createCommand(L);return f&&(O.description(f),O._executableHandler=!0),b.isDefault&&(this._defaultCommandName=O._name),O._hidden=!!(b.noHelp||b.hidden),O._executableFile=b.executableFile||null,H&&O.arguments(H),this.commands.push(O),O.parent=this,O.copyInheritedSettings(this),f?this:O}createCommand(A){return new E(A)}createHelp(){return Object.assign(new c,this.configureHelp())}configureHelp(A){return A===void 0?this._helpConfiguration:(this._helpConfiguration=A,this)}configureOutput(A){return A===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,A),this)}showHelpAfterError(A=!0){return typeof A!="string"&&(A=!!A),this._showHelpAfterError=A,this}showSuggestionAfterError(A=!0){return this._showSuggestionAfterError=!!A,this}addCommand(A,p){if(!A._name)throw new Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);return p=p||{},p.isDefault&&(this._defaultCommandName=A._name),(p.noHelp||p.hidden)&&(A._hidden=!0),this.commands.push(A),A.parent=this,this}createArgument(A,p){return new a(A,p)}argument(A,p,D,f){const b=this.createArgument(A,p);return typeof D=="function"?b.default(f).argParser(D):b.default(D),this.addArgument(b),this}arguments(A){return A.split(/ +/).forEach(p=>{this.argument(p)}),this}addArgument(A){const p=this._args.slice(-1)[0];if(p&&p.variadic)throw new Error(`only the last argument can be variadic '${p.name()}'`);if(A.required&&A.defaultValue!==void 0&&A.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${A.name()}'`);return this._args.push(A),this}addHelpCommand(A,p){return A===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof A=="string"&&(this._helpCommandName=A.split(" ")[0],this._helpCommandnameAndArgs=A),this._helpCommandDescription=p||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(A,p){const D=["preSubcommand","preAction","postAction"];if(!D.includes(A))throw new Error(`Unexpected value for event passed to hook : '${A}'. Expecting one of '${D.join("', '")}'`);return this._lifeCycleHooks[A]?this._lifeCycleHooks[A].push(p):this._lifeCycleHooks[A]=[p],this}exitOverride(A){return A?this._exitCallback=A:this._exitCallback=p=>{if(p.code!=="commander.executeSubCommandAsync")throw p},this}_exit(A,p,D){this._exitCallback&&this._exitCallback(new o(A,p,D)),i.exit(A)}action(A){const p=D=>{const f=this._args.length,b=D.slice(0,f);return this._storeOptionsAsProperties?b[f]=this:b[f]=this.opts(),b.push(this),A.apply(this,b)};return this._actionHandler=p,this}createOption(A,p){return new l(A,p)}addOption(A){const p=A.name(),D=A.attributeName();if(A.negate){const b=A.long.replace(/^--no-/,"--");this._findOption(b)||this.setOptionValueWithSource(D,A.defaultValue===void 0?!0:A.defaultValue,"default")}else A.defaultValue!==void 0&&this.setOptionValueWithSource(D,A.defaultValue,"default");this.options.push(A);const f=(b,L,H)=>{b==null&&A.presetArg!==void 0&&(b=A.presetArg);const O=this.getOptionValue(D);if(b!==null&&A.parseArg)try{b=A.parseArg(b,O)}catch(d){if(d.code==="commander.invalidArgument"){const w=`${L} ${d.message}`;this.error(w,{exitCode:d.exitCode,code:d.code})}throw d}else b!==null&&A.variadic&&(b=A._concatValue(b,O));b==null&&(A.negate?b=!1:A.isBoolean()||A.optional?b=!0:b=""),this.setOptionValueWithSource(D,b,H)};return this.on("option:"+p,b=>{const L=`error: option '${A.flags}' argument '${b}' is invalid.`;f(b,L,"cli")}),A.envVar&&this.on("optionEnv:"+p,b=>{const L=`error: option '${A.flags}' value '${b}' from env '${A.envVar}' is invalid.`;f(b,L,"env")}),this}_optionEx(A,p,D,f,b){if(typeof p=="object"&&p instanceof l)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const L=this.createOption(p,D);if(L.makeOptionMandatory(!!A.mandatory),typeof f=="function")L.default(b).argParser(f);else if(f instanceof RegExp){const H=f;f=(O,d)=>{const w=H.exec(O);return w?w[0]:d},L.default(b).argParser(f)}else L.default(f);return this.addOption(L)}option(A,p,D,f){return this._optionEx({},A,p,D,f)}requiredOption(A,p,D,f){return this._optionEx({mandatory:!0},A,p,D,f)}combineFlagAndOptionalValue(A=!0){return this._combineFlagAndOptionalValue=!!A,this}allowUnknownOption(A=!0){return this._allowUnknownOption=!!A,this}allowExcessArguments(A=!0){return this._allowExcessArguments=!!A,this}enablePositionalOptions(A=!0){return this._enablePositionalOptions=!!A,this}passThroughOptions(A=!0){if(this._passThroughOptions=!!A,this.parent&&A&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(A=!0){if(this._storeOptionsAsProperties=!!A,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(A){return this._storeOptionsAsProperties?this[A]:this._optionValues[A]}setOptionValue(A,p){return this.setOptionValueWithSource(A,p,void 0)}setOptionValueWithSource(A,p,D){return this._storeOptionsAsProperties?this[A]=p:this._optionValues[A]=p,this._optionValueSources[A]=D,this}getOptionValueSource(A){return this._optionValueSources[A]}getOptionValueSourceWithGlobals(A){let p;return y(this).forEach(D=>{D.getOptionValueSource(A)!==void 0&&(p=D.getOptionValueSource(A))}),p}_prepareUserArgs(A,p){if(A!==void 0&&!Array.isArray(A))throw new Error("first parameter to parse must be array or undefined");p=p||{},A===void 0&&(A=i.argv,i.versions&&i.versions.electron&&(p.from="electron")),this.rawArgs=A.slice();let D;switch(p.from){case void 0:case"node":this._scriptPath=A[1],D=A.slice(2);break;case"electron":i.defaultApp?(this._scriptPath=A[1],D=A.slice(2)):D=A.slice(1);break;case"user":D=A.slice(0);break;default:throw new Error(`unexpected parse option { from: '${p.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",D}parse(A,p){const D=this._prepareUserArgs(A,p);return this._parseCommand([],D),this}async parseAsync(A,p){const D=this._prepareUserArgs(A,p);return await this._parseCommand([],D),this}_executeSubCommand(A,p){p=p.slice();let D=!1;const f=[".js",".ts",".tsx",".mjs",".cjs"];function b(w,_){const v=n.resolve(w,_);if(r.existsSync(v))return v;if(f.includes(n.extname(_)))return;const Q=f.find(J=>r.existsSync(`${v}${J}`));if(Q)return`${v}${Q}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let L=A._executableFile||`${this._name}-${A._name}`,H=this._executableDir||"";if(this._scriptPath){let w;try{w=r.realpathSync(this._scriptPath)}catch{w=this._scriptPath}H=n.resolve(n.dirname(w),H)}if(H){let w=b(H,L);if(!w&&!A._executableFile&&this._scriptPath){const _=n.basename(this._scriptPath,n.extname(this._scriptPath));_!==this._name&&(w=b(H,`${_}-${A._name}`))}L=w||L}D=f.includes(n.extname(L));let O;i.platform!=="win32"?D?(p.unshift(L),p=I(i.execArgv).concat(p),O=t.spawn(i.argv[0],p,{stdio:"inherit"})):O=t.spawn(L,p,{stdio:"inherit"}):(p.unshift(L),p=I(i.execArgv).concat(p),O=t.spawn(i.execPath,p,{stdio:"inherit"})),O.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(_=>{i.on(_,()=>{O.killed===!1&&O.exitCode===null&&O.kill(_)})});const d=this._exitCallback;d?O.on("close",()=>{d(new o(i.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):O.on("close",i.exit.bind(i)),O.on("error",w=>{if(w.code==="ENOENT"){const _=H?`searched for local subcommand relative to directory '${H}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",v=`'${L}' does not exist - if '${A._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - ${_}`;throw new Error(v)}else if(w.code==="EACCES")throw new Error(`'${L}' not executable`);if(!d)i.exit(1);else{const _=new o(1,"commander.executeSubCommandAsync","(error)");_.nestedError=w,d(_)}}),this.runningCommand=O}_dispatchSubcommand(A,p,D){const f=this._findCommand(A);f||this.help({error:!0});let b;return b=this._chainOrCallSubCommandHook(b,f,"preSubcommand"),b=this._chainOrCall(b,()=>{if(f._executableHandler)this._executeSubCommand(f,p.concat(D));else return f._parseCommand(p,D)}),b}_checkNumberOfArguments(){this._args.forEach((A,p)=>{A.required&&this.args[p]==null&&this.missingArgument(A.name())}),!(this._args.length>0&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){const A=(D,f,b)=>{let L=f;if(f!==null&&D.parseArg)try{L=D.parseArg(f,b)}catch(H){if(H.code==="commander.invalidArgument"){const O=`error: command-argument value '${f}' is invalid for argument '${D.name()}'. ${H.message}`;this.error(O,{exitCode:H.exitCode,code:H.code})}throw H}return L};this._checkNumberOfArguments();const p=[];this._args.forEach((D,f)=>{let b=D.defaultValue;D.variadic?f<this.args.length?(b=this.args.slice(f),D.parseArg&&(b=b.reduce((L,H)=>A(D,H,L),D.defaultValue))):b===void 0&&(b=[]):f<this.args.length&&(b=this.args[f],D.parseArg&&(b=A(D,b,D.defaultValue))),p[f]=b}),this.processedArgs=p}_chainOrCall(A,p){return A&&A.then&&typeof A.then=="function"?A.then(()=>p()):p()}_chainOrCallHooks(A,p){let D=A;const f=[];return y(this).reverse().filter(b=>b._lifeCycleHooks[p]!==void 0).forEach(b=>{b._lifeCycleHooks[p].forEach(L=>{f.push({hookedCommand:b,callback:L})})}),p==="postAction"&&f.reverse(),f.forEach(b=>{D=this._chainOrCall(D,()=>b.callback(b.hookedCommand,this))}),D}_chainOrCallSubCommandHook(A,p,D){let f=A;return this._lifeCycleHooks[D]!==void 0&&this._lifeCycleHooks[D].forEach(b=>{f=this._chainOrCall(f,()=>b(this,p))}),f}_parseCommand(A,p){const D=this.parseOptions(p);if(this._parseOptionsEnv(),this._parseOptionsImplied(),A=A.concat(D.operands),p=D.unknown,this.args=A.concat(p),A&&this._findCommand(A[0]))return this._dispatchSubcommand(A[0],A.slice(1),p);if(this._hasImplicitHelpCommand()&&A[0]===this._helpCommandName)return A.length===1&&this.help(),this._dispatchSubcommand(A[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return T(this,p),this._dispatchSubcommand(this._defaultCommandName,A,p);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),T(this,D.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const f=()=>{D.unknown.length>0&&this.unknownOption(D.unknown[0])},b=`command:${this.name()}`;if(this._actionHandler){f(),this._processArguments();let L;return L=this._chainOrCallHooks(L,"preAction"),L=this._chainOrCall(L,()=>this._actionHandler(this.processedArgs)),this.parent&&(L=this._chainOrCall(L,()=>{this.parent.emit(b,A,p)})),L=this._chainOrCallHooks(L,"postAction"),L}if(this.parent&&this.parent.listenerCount(b))f(),this._processArguments(),this.parent.emit(b,A,p);else if(A.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",A,p);this.listenerCount("command:*")?this.emit("command:*",A,p):this.commands.length?this.unknownCommand():(f(),this._processArguments())}else this.commands.length?(f(),this.help({error:!0})):(f(),this._processArguments())}_findCommand(A){if(A)return this.commands.find(p=>p._name===A||p._aliases.includes(A))}_findOption(A){return this.options.find(p=>p.is(A))}_checkForMissingMandatoryOptions(){for(let A=this;A;A=A.parent)A.options.forEach(p=>{p.mandatory&&A.getOptionValue(p.attributeName())===void 0&&A.missingMandatoryOptionValue(p)})}_checkForConflictingLocalOptions(){const A=this.options.filter(D=>{const f=D.attributeName();return this.getOptionValue(f)===void 0?!1:this.getOptionValueSource(f)!=="default"});A.filter(D=>D.conflictsWith.length>0).forEach(D=>{const f=A.find(b=>D.conflictsWith.includes(b.attributeName()));f&&this._conflictingOption(D,f)})}_checkForConflictingOptions(){for(let A=this;A;A=A.parent)A._checkForConflictingLocalOptions()}parseOptions(A){const p=[],D=[];let f=p;const b=A.slice();function L(O){return O.length>1&&O[0]==="-"}let H=null;for(;b.length;){const O=b.shift();if(O==="--"){f===D&&f.push(O),f.push(...b);break}if(H&&!L(O)){this.emit(`option:${H.name()}`,O);continue}if(H=null,L(O)){const d=this._findOption(O);if(d){if(d.required){const w=b.shift();w===void 0&&this.optionMissingArgument(d),this.emit(`option:${d.name()}`,w)}else if(d.optional){let w=null;b.length>0&&!L(b[0])&&(w=b.shift()),this.emit(`option:${d.name()}`,w)}else this.emit(`option:${d.name()}`);H=d.variadic?d:null;continue}}if(O.length>2&&O[0]==="-"&&O[1]!=="-"){const d=this._findOption(`-${O[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,O.slice(2)):(this.emit(`option:${d.name()}`),b.unshift(`-${O.slice(2)}`));continue}}if(/^--[^=]+=/.test(O)){const d=O.indexOf("="),w=this._findOption(O.slice(0,d));if(w&&(w.required||w.optional)){this.emit(`option:${w.name()}`,O.slice(d+1));continue}}if(L(O)&&(f=D),(this._enablePositionalOptions||this._passThroughOptions)&&p.length===0&&D.length===0){if(this._findCommand(O)){p.push(O),b.length>0&&D.push(...b);break}else if(O===this._helpCommandName&&this._hasImplicitHelpCommand()){p.push(O),b.length>0&&p.push(...b);break}else if(this._defaultCommandName){D.push(O),b.length>0&&D.push(...b);break}}if(this._passThroughOptions){f.push(O),b.length>0&&f.push(...b);break}f.push(O)}return{operands:p,unknown:D}}opts(){if(this._storeOptionsAsProperties){const A={},p=this.options.length;for(let D=0;D<p;D++){const f=this.options[D].attributeName();A[f]=f===this._versionOptionName?this._version:this[f]}return A}return this._optionValues}optsWithGlobals(){return y(this).reduce((A,p)=>Object.assign(A,p.opts()),{})}error(A,p){this._outputConfiguration.outputError(`${A} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` `),this.outputHelp({error:!0}));const D=p||{},f=D.exitCode||1,b=D.code||"commander.error";this._exit(f,b,A)}_parseOptionsEnv(){this.options.forEach(A=>{if(A.envVar&&A.envVar in i.env){const p=A.attributeName();(this.getOptionValue(p)===void 0||["default","config","env"].includes(this.getOptionValueSource(p)))&&(A.required||A.optional?this.emit(`optionEnv:${A.name()}`,i.env[A.envVar]):this.emit(`optionEnv:${A.name()}`))}})}_parseOptionsImplied(){const A=new m(this.options),p=D=>this.getOptionValue(D)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(D));this.options.filter(D=>D.implied!==void 0&&p(D.attributeName())&&A.valueFromOption(this.getOptionValue(D.attributeName()),D)).forEach(D=>{Object.keys(D.implied).filter(f=>!p(f)).forEach(f=>{this.setOptionValueWithSource(f,D.implied[f],"implied")})})}missingArgument(A){const p=`error: missing required argument '${A}'`;this.error(p,{code:"commander.missingArgument"})}optionMissingArgument(A){const p=`error: option '${A.flags}' argument missing`;this.error(p,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(A){const p=`error: required option '${A.flags}' not specified`;this.error(p,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(A,p){const D=L=>{const H=L.attributeName(),O=this.getOptionValue(H),d=this.options.find(_=>_.negate&&H===_.attributeName()),w=this.options.find(_=>!_.negate&&H===_.attributeName());return d&&(d.presetArg===void 0&&O===!1||d.presetArg!==void 0&&O===d.presetArg)?d:w||L},f=L=>{const H=D(L),O=H.attributeName();return this.getOptionValueSource(O)==="env"?`environment variable '${H.envVar}'`:`option '${H.flags}'`},b=`error: ${f(A)} cannot be used with ${f(p)}`;this.error(b,{code:"commander.conflictingOption"})}unknownOption(A){if(this._allowUnknownOption)return;let p="";if(A.startsWith("--")&&this._showSuggestionAfterError){let f=[],b=this;do{const L=b.createHelp().visibleOptions(b).filter(H=>H.long).map(H=>H.long);f=f.concat(L),b=b.parent}while(b&&!b._enablePositionalOptions);p=g(A,f)}const D=`error: unknown option '${A}'${p}`;this.error(D,{code:"commander.unknownOption"})}_excessArguments(A){if(this._allowExcessArguments)return;const p=this._args.length,D=p===1?"":"s",b=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${p} argument${D} but got ${A.length}.`;this.error(b,{code:"commander.excessArguments"})}unknownCommand(){const A=this.args[0];let p="";if(this._showSuggestionAfterError){const f=[];this.createHelp().visibleCommands(this).forEach(b=>{f.push(b.name()),b.alias()&&f.push(b.alias())}),p=g(A,f)}const D=`error: unknown command '${A}'${p}`;this.error(D,{code:"commander.unknownCommand"})}version(A,p,D){if(A===void 0)return this._version;this._version=A,p=p||"-V, --version",D=D||"output the version number";const f=this.createOption(p,D);return this._versionOptionName=f.attributeName(),this.options.push(f),this.on("option:"+f.name(),()=>{this._outputConfiguration.writeOut(`${A} `),this._exit(0,"commander.version",A)}),this}description(A,p){return A===void 0&&p===void 0?this._description:(this._description=A,p&&(this._argsDescription=p),this)}summary(A){return A===void 0?this._summary:(this._summary=A,this)}alias(A){if(A===void 0)return this._aliases[0];let p=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(p=this.commands[this.commands.length-1]),A===p._name)throw new Error("Command alias can't be the same as its name");return p._aliases.push(A),this}aliases(A){return A===void 0?this._aliases:(A.forEach(p=>this.alias(p)),this)}usage(A){if(A===void 0){if(this._usage)return this._usage;const p=this._args.map(D=>s(D));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?p:[]).join(" ")}return this._usage=A,this}name(A){return A===void 0?this._name:(this._name=A,this)}nameFromFilename(A){return this._name=n.basename(A,n.extname(A)),this}executableDir(A){return A===void 0?this._executableDir:(this._executableDir=A,this)}helpInformation(A){const p=this.createHelp();return p.helpWidth===void 0&&(p.helpWidth=A&&A.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),p.formatHelp(this,p)}_getHelpContext(A){A=A||{};const p={error:!!A.error};let D;return p.error?D=f=>this._outputConfiguration.writeErr(f):D=f=>this._outputConfiguration.writeOut(f),p.write=A.write||D,p.command=this,p}outputHelp(A){let p;typeof A=="function"&&(p=A,A=void 0);const D=this._getHelpContext(A);y(this).reverse().forEach(b=>b.emit("beforeAllHelp",D)),this.emit("beforeHelp",D);let f=this.helpInformation(D);if(p&&(f=p(f),typeof f!="string"&&!Buffer.isBuffer(f)))throw new Error("outputHelp callback must return a string or a Buffer");D.write(f),this.emit(this._helpLongFlag),this.emit("afterHelp",D),y(this).forEach(b=>b.emit("afterAllHelp",D))}helpOption(A,p){if(typeof A=="boolean")return this._hasHelpOption=A,this;this._helpFlags=A||this._helpFlags,this._helpDescription=p||this._helpDescription;const D=h(this._helpFlags);return this._helpShortFlag=D.shortFlag,this._helpLongFlag=D.longFlag,this}help(A){this.outputHelp(A);let p=i.exitCode||0;p===0&&A&&typeof A!="function"&&A.error&&(p=1),this._exit(p,"commander.help","(outputHelp)")}addHelpText(A,p){const D=["beforeAll","before","after","afterAll"];if(!D.includes(A))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${D.join("', '")}'`);const f=`${A}Help`;return this.on(f,b=>{let L;typeof p=="function"?L=p({error:b.error,command:b.command}):L=p,L&&b.write(`${L} `)}),this}}function T(B,A){B._hasHelpOption&&A.find(D=>D===B._helpLongFlag||D===B._helpShortFlag)&&(B.outputHelp(),B._exit(0,"commander.helpDisplayed","(outputHelp)"))}function I(B){return B.map(A=>{if(!A.startsWith("--inspect"))return A;let p,D="127.0.0.1",f="9229",b;return(b=A.match(/^(--inspect(-brk)?)$/))!==null?p=b[1]:(b=A.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(p=b[1],/^\d+$/.test(b[3])?f=b[3]:D=b[3]):(b=A.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(p=b[1],D=b[3],f=b[4]),p&&f!=="0"?`${p}=${D}:${parseInt(f)+1}`:A})}function y(B){const A=[];for(let p=B;p;p=p.parent)A.push(p);return A}return yr.Command=E,yr}var ka;function Dl(){return ka||(ka=1,(function(e,t){const{Argument:n}=vi(),{Command:r}=El(),{CommanderError:i,InvalidArgumentError:a}=or(),{Help:s}=zu(),{Option:o}=eo();t=e.exports=new r,t.program=t,t.Argument=n,t.Command=r,t.CommanderError=i,t.Help=s,t.InvalidArgumentError=a,t.InvalidOptionArgumentError=a,t.Option=o})(Bn,Bn.exports)),Bn.exports}var Cl=Dl();const Tl=ur(Cl),{program:Me,createCommand:Eb,createArgument:Db,createOption:Cb,CommanderError:Tb,InvalidArgumentError:_b,InvalidOptionArgumentError:yb,Command:Ib,Argument:Sb,Option:wb,Help:Nb}=Tl;var z;(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})(z||(z={}));function _l(e){return e.type===z.Tag||e.type===z.Script||e.type===z.Style}const Ri=z.Root,to=z.Text,yl=z.Directive,no=z.Comment,Il=z.Script,Sl=z.Style,mi=z.Tag,wl=z.CDATA,Nl=z.Doctype;class ro{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(t){this.parent=t}get previousSibling(){return this.prev}set previousSibling(t){this.prev=t}get nextSibling(){return this.next}set nextSibling(t){this.next=t}cloneNode(t=!1){return hn(this,t)}}class xi extends ro{constructor(t){super(),this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t}}class dn extends xi{constructor(){super(...arguments),this.type=z.Text}get nodeType(){return 3}}class Li extends xi{constructor(){super(...arguments),this.type=z.Comment}get nodeType(){return 8}}class ki extends xi{constructor(t,n){super(n),this.name=t,this.type=z.Directive}get nodeType(){return 1}}class Mi extends ro{constructor(t){super(),this.children=t}get firstChild(){var t;return(t=this.children[0])!==null&&t!==void 0?t:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(t){this.children=t}}class io extends Mi{constructor(){super(...arguments),this.type=z.CDATA}get nodeType(){return 4}}class lt extends Mi{constructor(){super(...arguments),this.type=z.Root}get nodeType(){return 9}}class Pi extends Mi{constructor(t,n,r=[],i=t==="script"?z.Script:t==="style"?z.Style:z.Tag){super(r),this.name=t,this.attribs=n,this.type=i}get nodeType(){return 1}get tagName(){return this.name}set tagName(t){this.name=t}get attributes(){return Object.keys(this.attribs).map(t=>{var n,r;return{name:t,value:this.attribs[t],namespace:(n=this["x-attribsNamespace"])===null||n===void 0?void 0:n[t],prefix:(r=this["x-attribsPrefix"])===null||r===void 0?void 0:r[t]}})}}function G(e){return _l(e)}function cr(e){return e.type===z.CDATA}function xe(e){return e.type===z.Text}function lr(e){return e.type===z.Comment}function gi(e){return e.type===z.Directive}function Ze(e){return e.type===z.Root}function oe(e){return Object.prototype.hasOwnProperty.call(e,"children")}function hn(e,t=!1){let n;if(xe(e))n=new dn(e.data);else if(lr(e))n=new Li(e.data);else if(G(e)){const r=t?wr(e.children):[],i=new Pi(e.name,{...e.attribs},r);r.forEach(a=>a.parent=i),e.namespace!=null&&(i.namespace=e.namespace),e["x-attribsNamespace"]&&(i["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(i["x-attribsPrefix"]={...e["x-attribsPrefix"]}),n=i}else if(cr(e)){const r=t?wr(e.children):[],i=new io(r);r.forEach(a=>a.parent=i),n=i}else if(Ze(e)){const r=t?wr(e.children):[],i=new lt(r);r.forEach(a=>a.parent=i),e["x-mode"]&&(i["x-mode"]=e["x-mode"]),n=i}else if(gi(e)){const r=new ki(e.name,e.data);e["x-name"]!=null&&(r["x-name"]=e["x-name"],r["x-publicId"]=e["x-publicId"],r["x-systemId"]=e["x-systemId"]),n=r}else throw new Error(`Not implemented yet: ${e.type}`);return n.startIndex=e.startIndex,n.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function wr(e){const t=e.map(n=>hn(n,!0));for(let n=1;n<t.length;n++)t[n].prev=t[n-1],t[n-1].next=t[n];return t}const Ma={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};class Bl{constructor(t,n,r){this.dom=[],this.root=new lt(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof n=="function"&&(r=n,n=Ma),typeof t=="object"&&(n=t,t=void 0),this.callback=t??null,this.options=n??Ma,this.elementCB=r??null}onparserinit(t){this.parser=t}onreset(){this.dom=[],this.root=new lt(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(t){this.handleCallback(t)}onclosetag(){this.lastNode=null;const t=this.tagStack.pop();this.options.withEndIndices&&(t.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(t)}onopentag(t,n){const r=this.options.xmlMode?z.Tag:void 0,i=new Pi(t,n,void 0,r);this.addNode(i),this.tagStack.push(i)}ontext(t){const{lastNode:n}=this;if(n&&n.type===z.Text)n.data+=t,this.options.withEndIndices&&(n.endIndex=this.parser.endIndex);else{const r=new dn(t);this.addNode(r),this.lastNode=r}}oncomment(t){if(this.lastNode&&this.lastNode.type===z.Comment){this.lastNode.data+=t;return}const n=new Li(t);this.addNode(n),this.lastNode=n}oncommentend(){this.lastNode=null}oncdatastart(){const t=new dn(""),n=new io([t]);this.addNode(n),t.parent=n,this.lastNode=t}oncdataend(){this.lastNode=null}onprocessinginstruction(t,n){const r=new ki(t,n);this.addNode(r)}handleCallback(t){if(typeof this.callback=="function")this.callback(t,this.dom);else if(t)throw t}addNode(t){const n=this.tagStack[this.tagStack.length-1],r=n.children[n.children.length-1];this.options.withStartIndices&&(t.startIndex=this.parser.startIndex),this.options.withEndIndices&&(t.endIndex=this.parser.endIndex),n.children.push(t),r&&(t.prev=r,r.next=t),t.parent=n,this.lastNode=null}}const Pa=/["&'<>$\x80-\uFFFF]/g,Fl=new Map([[34,"&quot;"],[38,"&amp;"],[39,"&apos;"],[60,"&lt;"],[62,"&gt;"]]),Ol=String.prototype.codePointAt!=null?(e,t)=>e.codePointAt(t):(e,t)=>(e.charCodeAt(t)&64512)===55296?(e.charCodeAt(t)-55296)*1024+e.charCodeAt(t+1)-56320+65536:e.charCodeAt(t);function ao(e){let t="",n=0,r;for(;(r=Pa.exec(e))!==null;){const i=r.index,a=e.charCodeAt(i),s=Fl.get(a);s!==void 0?(t+=e.substring(n,i)+s,n=i+1):(t+=`${e.substring(n,i)}&#x${Ol(e,i).toString(16)};`,n=Pa.lastIndex+=+((a&64512)===55296))}return t+e.substr(n)}function so(e,t){return function(r){let i,a=0,s="";for(;i=e.exec(r);)a!==i.index&&(s+=r.substring(a,i.index)),s+=t.get(i[0].charCodeAt(0)),a=i.index+1;return s+r.substring(a)}}const vl=so(/["&\u00A0]/g,new Map([[34,"&quot;"],[38,"&amp;"],[160,"&nbsp;"]])),Rl=so(/[&<>\u00A0]/g,new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[160,"&nbsp;"]])),xl=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),Ll=new Map(["definitionURL","attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),kl=new Set(["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"]);function Ml(e){return e.replace(/"/g,"&quot;")}function Pl(e,t){var n;if(!e)return;const r=((n=t.encodeEntities)!==null&&n!==void 0?n:t.decodeEntities)===!1?Ml:t.xmlMode||t.encodeEntities!=="utf8"?ao:vl;return Object.keys(e).map(i=>{var a,s;const o=(a=e[i])!==null&&a!==void 0?a:"";return t.xmlMode==="foreign"&&(i=(s=Ll.get(i))!==null&&s!==void 0?s:i),!t.emptyAttrs&&!t.xmlMode&&o===""?i:`${i}="${r(o)}"`}).join(" ")}const Ha=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]);function dr(e,t={}){const n="length"in e?e:[e];let r="";for(let i=0;i<n.length;i++)r+=Hl(n[i],t);return r}function Hl(e,t){switch(e.type){case Ri:return dr(e.children,t);case Nl:case yl:return Ql(e);case no:return jl(e);case wl:return Kl(e);case Il:case Sl:case mi:return Wl(e,t);case to:return Gl(e,t)}}const Ul=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"]),Yl=new Set(["svg","math"]);function Wl(e,t){var n;t.xmlMode==="foreign"&&(e.name=(n=xl.get(e.name))!==null&&n!==void 0?n:e.name,e.parent&&Ul.has(e.parent.name)&&(t={...t,xmlMode:!1})),!t.xmlMode&&Yl.has(e.name)&&(t={...t,xmlMode:"foreign"});let r=`<${e.name}`;const i=Pl(e.attribs,t);return i&&(r+=` ${i}`),e.children.length===0&&(t.xmlMode?t.selfClosingTags!==!1:t.selfClosingTags&&Ha.has(e.name))?(t.xmlMode||(r+=" "),r+="/>"):(r+=">",e.children.length>0&&(r+=dr(e.children,t)),(t.xmlMode||!Ha.has(e.name))&&(r+=`</${e.name}>`)),r}function Ql(e){return`<${e.data}>`}function Gl(e,t){var n;let r=e.data||"";return((n=t.encodeEntities)!==null&&n!==void 0?n:t.decodeEntities)!==!1&&!(!t.xmlMode&&e.parent&&kl.has(e.parent.name))&&(r=t.xmlMode||t.encodeEntities!=="utf8"?ao(r):Rl(r)),r}function Kl(e){return`<![CDATA[${e.children[0].data}]]>`}function jl(e){return`<!--${e.data}-->`}function uo(e,t){return dr(e,t)}function ql(e,t){return oe(e)?e.children.map(n=>uo(n,t)).join(""):""}function Wn(e){return Array.isArray(e)?e.map(Wn).join(""):G(e)?e.name==="br"?` `:Wn(e.children):cr(e)?Wn(e.children):xe(e)?e.data:""}function pt(e){return Array.isArray(e)?e.map(pt).join(""):oe(e)&&!lr(e)?pt(e.children):xe(e)?e.data:""}function Jn(e){return Array.isArray(e)?e.map(Jn).join(""):oe(e)&&(e.type===z.Tag||cr(e))?Jn(e.children):xe(e)?e.data:""}function hr(e){return oe(e)?e.children:[]}function oo(e){return e.parent||null}function co(e){const t=oo(e);if(t!=null)return hr(t);const n=[e];let{prev:r,next:i}=e;for(;r!=null;)n.unshift(r),{prev:r}=r;for(;i!=null;)n.push(i),{next:i}=i;return n}function Jl(e,t){var n;return(n=e.attribs)===null||n===void 0?void 0:n[t]}function Vl(e,t){return e.attribs!=null&&Object.prototype.hasOwnProperty.call(e.attribs,t)&&e.attribs[t]!=null}function Zl(e){return e.name}function Hi(e){let{next:t}=e;for(;t!==null&&!G(t);)({next:t}=t);return t}function Ui(e){let{prev:t}=e;for(;t!==null&&!G(t);)({prev:t}=t);return t}function ht(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){const t=e.parent.children,n=t.lastIndexOf(e);n>=0&&t.splice(n,1)}e.next=null,e.prev=null,e.parent=null}function Xl(e,t){const n=t.prev=e.prev;n&&(n.next=t);const r=t.next=e.next;r&&(r.prev=t);const i=t.parent=e.parent;if(i){const a=i.children;a[a.lastIndexOf(e)]=t,e.parent=null}}function $l(e,t){if(ht(t),t.next=null,t.parent=e,e.children.push(t)>1){const n=e.children[e.children.length-2];n.next=t,t.prev=n}else t.prev=null}function zl(e,t){ht(t);const{parent:n}=e,r=e.next;if(t.next=r,t.prev=e,e.next=t,t.parent=n,r){if(r.prev=t,n){const i=n.children;i.splice(i.lastIndexOf(r),0,t)}}else n&&n.children.push(t)}function e0(e,t){if(ht(t),t.parent=e,t.prev=null,e.children.unshift(t)!==1){const n=e.children[1];n.prev=t,t.next=n}else t.next=null}function t0(e,t){ht(t);const{parent:n}=e;if(n){const r=n.children;r.splice(r.indexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=n,t.prev=e.prev,t.next=e,e.prev=t}function En(e,t,n=!0,r=1/0){return Yi(e,Array.isArray(t)?t:[t],n,r)}function Yi(e,t,n,r){const i=[],a=[Array.isArray(t)?t:[t]],s=[0];for(;;){if(s[0]>=a[0].length){if(s.length===1)return i;a.shift(),s.shift();continue}const o=a[0][s[0]++];if(e(o)&&(i.push(o),--r<=0))return i;n&&oe(o)&&o.children.length>0&&(s.unshift(0),a.unshift(o.children))}}function n0(e,t){return t.find(e)}function Wi(e,t,n=!0){const r=Array.isArray(t)?t:[t];for(let i=0;i<r.length;i++){const a=r[i];if(G(a)&&e(a))return a;if(n&&oe(a)&&a.children.length>0){const s=Wi(e,a.children,!0);if(s)return s}}return null}function lo(e,t){return(Array.isArray(t)?t:[t]).some(n=>G(n)&&e(n)||oe(n)&&lo(e,n.children))}function r0(e,t){const n=[],r=[Array.isArray(t)?t:[t]],i=[0];for(;;){if(i[0]>=r[0].length){if(r.length===1)return n;r.shift(),i.shift();continue}const a=r[0][i[0]++];G(a)&&e(a)&&n.push(a),oe(a)&&a.children.length>0&&(i.unshift(0),r.unshift(a.children))}}const Vn={tag_name(e){return typeof e=="function"?t=>G(t)&&e(t.name):e==="*"?G:t=>G(t)&&t.name===e},tag_type(e){return typeof e=="function"?t=>e(t.type):t=>t.type===e},tag_contains(e){return typeof e=="function"?t=>xe(t)&&e(t.data):t=>xe(t)&&t.data===e}};function Qi(e,t){return typeof t=="function"?n=>G(n)&&t(n.attribs[e]):n=>G(n)&&n.attribs[e]===t}function i0(e,t){return n=>e(n)||t(n)}function ho(e){const t=Object.keys(e).map(n=>{const r=e[n];return Object.prototype.hasOwnProperty.call(Vn,n)?Vn[n](r):Qi(n,r)});return t.length===0?null:t.reduce(i0)}function a0(e,t){const n=ho(e);return n?n(t):!0}function s0(e,t,n,r=1/0){const i=ho(e);return i?En(i,t,n,r):[]}function u0(e,t,n=!0){return Array.isArray(t)||(t=[t]),Wi(Qi("id",e),t,n)}function Et(e,t,n=!0,r=1/0){return En(Vn.tag_name(e),t,n,r)}function o0(e,t,n=!0,r=1/0){return En(Qi("class",e),t,n,r)}function c0(e,t,n=!0,r=1/0){return En(Vn.tag_type(e),t,n,r)}function l0(e){let t=e.length;for(;--t>=0;){const n=e[t];if(t>0&&e.lastIndexOf(n,t-1)>=0){e.splice(t,1);continue}for(let r=n.parent;r;r=r.parent)if(e.includes(r)){e.splice(t,1);break}}return e}var Ne;(function(e){e[e.DISCONNECTED=1]="DISCONNECTED",e[e.PRECEDING=2]="PRECEDING",e[e.FOLLOWING=4]="FOLLOWING",e[e.CONTAINS=8]="CONTAINS",e[e.CONTAINED_BY=16]="CONTAINED_BY"})(Ne||(Ne={}));function fo(e,t){const n=[],r=[];if(e===t)return 0;let i=oe(e)?e:e.parent;for(;i;)n.unshift(i),i=i.parent;for(i=oe(t)?t:t.parent;i;)r.unshift(i),i=i.parent;const a=Math.min(n.length,r.length);let s=0;for(;s<a&&n[s]===r[s];)s++;if(s===0)return Ne.DISCONNECTED;const o=n[s-1],c=o.children,l=n[s],h=r[s];return c.indexOf(l)>c.indexOf(h)?o===t?Ne.FOLLOWING|Ne.CONTAINED_BY:Ne.FOLLOWING:o===e?Ne.PRECEDING|Ne.CONTAINS:Ne.PRECEDING}function Dt(e){return e=e.filter((t,n,r)=>!r.includes(t,n+1)),e.sort((t,n)=>{const r=fo(t,n);return r&Ne.PRECEDING?-1:r&Ne.FOLLOWING?1:0}),e}function d0(e){const t=Zn(g0,e);return t?t.name==="feed"?h0(t):f0(t):null}function h0(e){var t;const n=e.children,r={type:"atom",items:Et("entry",n).map(s=>{var o;const{children:c}=s,l={media:Ao(c)};_e(l,"id","id",c),_e(l,"title","title",c);const h=(o=Zn("link",c))===null||o===void 0?void 0:o.attribs.href;h&&(l.link=h);const m=qe("summary",c)||qe("content",c);m&&(l.description=m);const g=qe("updated",c);return g&&(l.pubDate=new Date(g)),l})};_e(r,"id","id",n),_e(r,"title","title",n);const i=(t=Zn("link",n))===null||t===void 0?void 0:t.attribs.href;i&&(r.link=i),_e(r,"description","subtitle",n);const a=qe("updated",n);return a&&(r.updated=new Date(a)),_e(r,"author","email",n,!0),r}function f0(e){var t,n;const r=(n=(t=Zn("channel",e.children))===null||t===void 0?void 0:t.children)!==null&&n!==void 0?n:[],i={type:e.name.substr(0,3),id:"",items:Et("item",e.children).map(s=>{const{children:o}=s,c={media:Ao(o)};_e(c,"id","guid",o),_e(c,"title","title",o),_e(c,"link","link",o),_e(c,"description","description",o);const l=qe("pubDate",o)||qe("dc:date",o);return l&&(c.pubDate=new Date(l)),c})};_e(i,"title","title",r),_e(i,"link","link",r),_e(i,"description","description",r);const a=qe("lastBuildDate",r);return a&&(i.updated=new Date(a)),_e(i,"author","managingEditor",r,!0),i}const A0=["url","type","lang"],m0=["fileSize","bitrate","framerate","samplingrate","channels","duration","height","width"];function Ao(e){return Et("media:content",e).map(t=>{const{attribs:n}=t,r={medium:n.medium,isDefault:!!n.isDefault};for(const i of A0)n[i]&&(r[i]=n[i]);for(const i of m0)n[i]&&(r[i]=parseInt(n[i],10));retur